equal
deleted
inserted
replaced
41 } |
41 } |
42 addOnloadHook(initTinyMCE); |
42 addOnloadHook(initTinyMCE); |
43 |
43 |
44 var editor_open = false; |
44 var editor_open = false; |
45 |
45 |
46 function ajaxEditor() |
46 function ajaxEditor(revid) |
47 { |
47 { |
48 if ( KILL_SWITCH ) |
48 if ( KILL_SWITCH ) |
49 return true; |
49 return true; |
50 if ( editor_open ) |
50 if ( editor_open ) |
51 return true; |
51 return true; |
|
52 var rev_id_uri = ( revid ) ? '&revid=' + revid : ''; |
52 selectButtonMinor('edit'); |
53 selectButtonMinor('edit'); |
53 selectButtonMajor('article'); |
54 selectButtonMajor('article'); |
54 setAjaxLoading(); |
55 setAjaxLoading(); |
55 ajaxGet(stdAjaxPrefix + '&_mode=getsource', function() |
56 ajaxGet(stdAjaxPrefix + '&_mode=getsource' + rev_id_uri, function() |
56 { |
57 { |
57 if ( ajax.readyState == 4 && ajax.status == 200 ) |
58 if ( ajax.readyState == 4 && ajax.status == 200 ) |
58 { |
59 { |
59 unsetAjaxLoading(); |
60 unsetAjaxLoading(); |
60 |
61 |
81 } |
82 } |
82 |
83 |
83 // do we need to enter a captcha before saving the page? |
84 // do we need to enter a captcha before saving the page? |
84 var captcha_hash = ( response.require_captcha ) ? response.captcha_id : false; |
85 var captcha_hash = ( response.require_captcha ) ? response.captcha_id : false; |
85 |
86 |
86 ajaxBuildEditor(response.src, (!response.auth_edit), response.time, response.allow_wysiwyg, captcha_hash); |
87 ajaxBuildEditor(response.src, (!response.auth_edit), response.time, response.allow_wysiwyg, captcha_hash, response.revid, response.undo_info); |
87 } |
88 } |
88 }); |
89 }); |
89 } |
90 } |
90 |
91 |
91 function ajaxBuildEditor(content, readonly, timestamp, allow_wysiwyg, captcha_hash) |
92 function ajaxBuildEditor(content, readonly, timestamp, allow_wysiwyg, captcha_hash, revid, undo_info) |
92 { |
93 { |
93 // Set flags |
94 // Set flags |
94 // We don't want the fancy confirmation framework to trigger if the user is only viewing the page source |
95 // We don't want the fancy confirmation framework to trigger if the user is only viewing the page source |
95 if ( !readonly ) |
96 if ( !readonly ) |
96 { |
97 { |
171 { |
172 { |
172 ajaxEditorSave(); |
173 ajaxEditorSave(); |
173 return false; |
174 return false; |
174 } |
175 } |
175 |
176 |
|
177 // Old-revision notice |
|
178 if ( revid > 0 ) |
|
179 { |
|
180 var oldrev_box = document.createElement('div'); |
|
181 oldrev_box.className = 'usermessage'; |
|
182 oldrev_box.appendChild(document.createTextNode($lang.get('editor_msg_editing_old_revision'))); |
|
183 form.appendChild(oldrev_box); |
|
184 } |
|
185 |
176 // Preview holder |
186 // Preview holder |
177 var preview_anchor = document.createElement('a'); |
187 var preview_anchor = document.createElement('a'); |
178 preview_anchor.name = 'ajax_preview'; |
188 preview_anchor.name = 'ajax_preview'; |
179 preview_anchor.id = 'ajax_preview'; |
189 preview_anchor.id = 'ajax_preview'; |
180 var preview_container = document.createElement('div'); |
190 var preview_container = document.createElement('div'); |
242 var field_es = document.createElement('input'); |
252 var field_es = document.createElement('input'); |
243 field_es.id = 'enano_editor_field_summary'; |
253 field_es.id = 'enano_editor_field_summary'; |
244 field_es.type = 'text'; |
254 field_es.type = 'text'; |
245 field_es.size = '40'; |
255 field_es.size = '40'; |
246 field_es.style.width = '96%'; |
256 field_es.style.width = '96%'; |
|
257 |
|
258 if ( revid > 0 ) |
|
259 { |
|
260 undo_info.last_rev_id = revid; |
|
261 field_es.value = $lang.get('editor_reversion_edit_summary', undo_info); |
|
262 } |
|
263 |
247 td1_2.appendChild(field_es); |
264 td1_2.appendChild(field_es); |
248 |
265 |
249 tr1.appendChild(td1_1); |
266 tr1.appendChild(td1_1); |
250 tr1.appendChild(td1_2); |
267 tr1.appendChild(td1_2); |
251 |
268 |