19 data: { "new_content": new_content, "new_format": new_format}, |
19 data: { "new_content": new_content, "new_format": new_format}, |
20 success: function(obj){ |
20 success: function(obj){ |
21 nb_removed = obj['nb_removed']; |
21 nb_removed = obj['nb_removed']; |
22 if (newVersion) { |
22 if (newVersion) { |
23 if (nb_removed == 0) { |
23 if (nb_removed == 0) { |
24 submit_edit_form(); |
24 submit_edit_form(); |
25 } |
25 } |
26 else { |
26 else { |
27 var message = ngettext( |
27 var message = ngettext( |
28 '%(nb_comments)s comment applies to text that was modified.', |
28 '%(nb_comments)s comment applies to text that was modified.', |
29 '%(nb_comments)s comments apply to text that was modified.', |
29 '%(nb_comments)s comments apply to text that was modified.', |
30 nb_removed) ; |
30 nb_removed) ; |
31 message += '<br />' ; |
31 message += '<br />' ; |
32 message += mess ; |
32 message += mess ; |
33 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
33 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
34 |
34 |
35 $('#remove_scope_choice_dlg').html(message) ; |
35 $('#remove_scope_choice_dlg').html(message) ; |
36 $('#remove_scope_choice_dlg').dialog('open') ; |
36 $('#remove_scope_choice_dlg').dialog('open') ; |
37 } |
37 } |
38 } |
38 } |
39 else { |
39 else { |
40 if (nb_removed == 0) { |
40 if (nb_removed == 0) { |
41 submit_edit_form(); |
41 submit_edit_form(); |
42 } |
42 } |
43 else { |
43 else { |
44 var message = ngettext( |
44 var message = ngettext( |
45 '%(nb_comments)s comment applies to text that was modified.', |
45 '%(nb_comments)s comment applies to text that was modified.', |
46 '%(nb_comments)s comments apply to text that was modified.', |
46 '%(nb_comments)s comments apply to text that was modified.', |
47 nb_removed) ; |
47 nb_removed) ; |
48 message += '<br />' ; |
48 message += '<br />' ; |
49 message += gettext( '(We suggest you create a new version)') ; |
49 message += gettext( '(We suggest you create a new version)') ; |
50 message += '<br />' ; |
50 message += '<br />' ; |
51 message += mess ; |
51 message += mess ; |
52 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
52 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
53 |
53 |
54 $('#remove_scope_choice_dlg').html(message) ; |
54 $('#remove_scope_choice_dlg').html(message) ; |
55 $('#remove_scope_choice_dlg').dialog('open') ; |
55 $('#remove_scope_choice_dlg').dialog('open') ; |
56 } |
56 } |
57 } |
57 } |
58 }, |
58 }, |
59 error: function(msg){ |
59 error: function(msg){ |
61 } |
61 } |
62 }); |
62 }); |
63 } |
63 } |
64 else { |
64 else { |
65 if (!newVersion) { |
65 if (!newVersion) { |
66 |
66 |
67 var message = gettext("You chose not to create a new version all comments will be deleted") ; |
67 var message = gettext("You chose not to create a new version all comments will be deleted") ; |
68 message += '<br />' ; |
68 message += '<br />' ; |
69 message += gettext( 'Do you want to continue?') ; |
69 message += gettext( 'Do you want to continue?') ; |
70 $('#confirm_all_removed_dlg').html(message) ; |
70 $('#confirm_all_removed_dlg').html(message) ; |
71 $('#confirm_all_removed_dlg').dialog('open') ; |
71 $('#confirm_all_removed_dlg').dialog('open') ; |
72 } |
72 } |
73 else { |
73 else { |
74 submit_edit_form() ; |
74 submit_edit_form() ; |
75 } |
75 } |
76 } |
76 } |
77 } |
77 } |
78 |
78 |
79 function submit_edit_form() { |
79 function submit_edit_form() { |
80 needToConfirm = false; |
80 needToConfirm = false; |
81 $('#edit_form').submit(); |
81 $('#edit_form').submit(); |
82 } |
82 } |
83 |
83 |
84 $(function() { |
84 $(function() { |
85 var buttons = {}; |
85 var buttons = {}; |
86 buttons[gettext('No')] = function() { |
86 buttons[gettext('No')] = function() { |
87 $(this).dialog('close'); |
87 $(this).dialog('close'); |
88 } ; |
88 } ; |
89 buttons[gettext('Yes')] = function() { |
89 buttons[gettext('Yes')] = function() { |
90 $(this).dialog('close');submit_edit_form(); |
90 $(this).dialog('close');submit_edit_form(); |
91 } ; |
91 } ; |
92 |
92 |
93 $('#confirm_all_removed_dlg').dialog({ |
93 $('#confirm_all_removed_dlg').dialog({ |
94 bgiframe: true, |
94 bgiframe: true, |
95 autoOpen: false, |
95 autoOpen: false, |
96 title :gettext('Warning'), |
96 title :gettext('Warning'), |
97 modal: true, |
97 modal: true, |
98 buttons:buttons |
98 buttons:buttons |
99 }) ; |
99 }) ; |
100 |
100 |
101 var buttons0 = {}; |
101 var buttons0 = {}; |
102 buttons0[gettext('Detach')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("1");submit_edit_form();} ; |
102 buttons0[gettext('Detach')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("1");submit_edit_form();} ; |
103 buttons0[gettext('Remove')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("0");submit_edit_form();} ; |
103 buttons0[gettext('Remove')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("0");submit_edit_form();} ; |
104 buttons0[gettext('Cancel')] = function() {$(this).dialog('close');} ; |
104 buttons0[gettext('Cancel')] = function() {$(this).dialog('close');} ; |
105 |
105 |
106 $('#remove_scope_choice_dlg').dialog({ |
106 $('#remove_scope_choice_dlg').dialog({ |
107 bgiframe: true, |
107 bgiframe: true, |
108 autoOpen: false, |
108 autoOpen: false, |
109 title :gettext('Warning'), |
109 title :gettext('Warning'), |