equal
deleted
inserted
replaced
6 var new_format = $('#id_format').val() ; |
6 var new_format = $('#id_format').val() ; |
7 var mess = gettext( 'Should these comments be detached (i.e. kept with no scope) or removed from new version?') ; |
7 var mess = gettext( 'Should these comments be detached (i.e. kept with no scope) or removed from new version?') ; |
8 |
8 |
9 if (commentsKept) { |
9 if (commentsKept) { |
10 var pre_edit_url = tb_conf['pre_edit_url'] ; |
10 var pre_edit_url = tb_conf['pre_edit_url'] ; |
11 |
|
12 $.ajax({ |
11 $.ajax({ |
13 url: pre_edit_url, |
12 url: pre_edit_url, |
14 type:'POST', |
13 type:'POST', |
15 dataType:"json", |
14 dataType:"json", |
16 data: { "new_content": new_content, "new_format": new_format}, |
15 data: { "new_content": new_content, "new_format": new_format}, |
17 success: function(obj){ |
16 success: function(obj){ |
18 nb_removed = obj['nb_removed']; |
17 nb_removed = obj['nb_removed']; |
19 if (newVersion) { |
18 if (newVersion) { |
20 if (nb_removed == 0) { |
19 if (nb_removed == 0) { |
21 $('#edit_form').submit(); |
20 submit_edit_form(); |
22 } |
21 } |
23 else { |
22 else { |
24 var message = ngettext( |
23 var message = ngettext( |
25 '%(nb_comments)s comment applies to text that was modified.', |
24 '%(nb_comments)s comment applies to text that was modified.', |
26 '%(nb_comments)s comments apply to text that was modified.', |
25 '%(nb_comments)s comments apply to text that was modified.', |
33 $('#remove_scope_choice_dlg').dialog('open') ; |
32 $('#remove_scope_choice_dlg').dialog('open') ; |
34 } |
33 } |
35 } |
34 } |
36 else { |
35 else { |
37 if (nb_removed == 0) { |
36 if (nb_removed == 0) { |
38 $('#edit_form').submit(); |
37 submit_edit_form(); |
39 } |
38 } |
40 else { |
39 else { |
41 var message = ngettext( |
40 var message = ngettext( |
42 '%(nb_comments)s comment applies to text that was modified.', |
41 '%(nb_comments)s comment applies to text that was modified.', |
43 '%(nb_comments)s comments apply to text that was modified.', |
42 '%(nb_comments)s comments apply to text that was modified.', |
66 message += gettext( 'Do you want to continue?') ; |
65 message += gettext( 'Do you want to continue?') ; |
67 $('#confirm_all_removed_dlg').html(message) ; |
66 $('#confirm_all_removed_dlg').html(message) ; |
68 $('#confirm_all_removed_dlg').dialog('open') ; |
67 $('#confirm_all_removed_dlg').dialog('open') ; |
69 } |
68 } |
70 else { |
69 else { |
71 $('#edit_form').submit(); |
70 submit_edit_form() ; |
72 } |
71 } |
73 } |
72 } |
|
73 } |
|
74 |
|
75 function submit_edit_form() { |
|
76 needToConfirm = false; |
|
77 $('#edit_form').submit(); |
74 } |
78 } |
75 |
79 |
76 $(function() { |
80 $(function() { |
77 var buttons = {}; |
81 var buttons = {}; |
78 buttons[gettext('No')] = function() { |
82 buttons[gettext('No')] = function() { |
79 $(this).dialog('close'); |
83 $(this).dialog('close'); |
80 } ; |
84 } ; |
81 buttons[gettext('Yes')] = function() { |
85 buttons[gettext('Yes')] = function() { |
82 needToConfirm = false; |
86 $(this).dialog('close');submit_edit_form(); |
83 $(this).dialog('close');$('#edit_form').submit(); |
|
84 } ; |
87 } ; |
85 |
88 |
86 $('#confirm_all_removed_dlg').dialog({ |
89 $('#confirm_all_removed_dlg').dialog({ |
87 bgiframe: true, |
90 bgiframe: true, |
88 autoOpen: false, |
91 autoOpen: false, |
90 modal: true, |
93 modal: true, |
91 buttons:buttons |
94 buttons:buttons |
92 }) ; |
95 }) ; |
93 |
96 |
94 var buttons0 = {}; |
97 var buttons0 = {}; |
95 buttons0[gettext('Detach')] = function() { |
98 buttons0[gettext('Detach')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("1");submit_edit_form();} ; |
96 needToConfirm = false; |
99 buttons0[gettext('Remove')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("0");submit_edit_form();} ; |
97 $(this).dialog('close');$('#cancel_modified_scopes').val("1");$('#edit_form').submit(); |
|
98 } ; |
|
99 buttons0[gettext('Remove')] = function() { |
|
100 needToConfirm = false; |
|
101 $(this).dialog('close');$('#cancel_modified_scopes').val("0");$('#edit_form').submit(); |
|
102 } ; |
|
103 buttons0[gettext('Cancel')] = function() {$(this).dialog('close');} ; |
100 buttons0[gettext('Cancel')] = function() {$(this).dialog('close');} ; |
104 |
101 |
105 $('#remove_scope_choice_dlg').dialog({ |
102 $('#remove_scope_choice_dlg').dialog({ |
106 bgiframe: true, |
103 bgiframe: true, |
107 autoOpen: false, |
104 autoOpen: false, |