69 setAjaxLoading(); |
69 setAjaxLoading(); |
70 ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
70 ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
71 if(ajax.readyState == 4) { |
71 if(ajax.readyState == 4) { |
72 unsetAjaxLoading(); |
72 unsetAjaxLoading(); |
73 if(edit_open) { |
73 if(edit_open) { |
74 c=confirm('Do you really want to revert your changes?'); |
74 c=confirm($lang.get('editor_msg_revert_confirm')); |
75 if(!c) return; |
75 if(!c) return; |
76 } |
76 } |
77 edit_open = true; |
77 edit_open = true; |
78 selectButtonMajor('article'); |
78 selectButtonMajor('article'); |
79 selectButtonMinor('edit'); |
79 selectButtonMinor('edit'); |
80 if(in_array('ajaxEditArea', grippied_textareas)) |
80 if(in_array('ajaxEditArea', grippied_textareas)) |
81 { |
81 { |
82 // Allow the textarea grippifier to re-create the resizer control on the textarea |
82 // Allow the textarea grippifier to re-create the resizer control on the textarea |
83 grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
83 grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
84 } |
84 } |
85 disableUnload('If you do, any changes that you have made to this page will be lost.'); |
85 disableUnload($lang.get('editor_msg_unload')); |
86 var switcher = ( readCookie('enano_editor_mode') == 'tinymce' ) ? |
86 var switcher = ( readCookie('enano_editor_mode') == 'tinymce' ) ? |
87 '<a href="#" onclick="setEditorText(); return false;">wikitext editor</a> | graphical editor' : |
87 '<a href="#" onclick="setEditorText(); return false;">' + $lang.get('editor_btn_wikitext') + '</a> | ' + $lang.get('editor_btn_graphical') : |
88 'wikitext editor | <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>' ; |
88 $lang.get('editor_btn_wikitext') + ' | <a href="#" onclick="setEditorMCE(); return false;">' + $lang.get('editor_btn_graphical') + '</a>' ; |
89 document.getElementById('ajaxEditContainer').innerHTML = '\ |
89 document.getElementById('ajaxEditContainer').innerHTML = '\ |
90 <div id="mdgPreviewContainer"></div> \ |
90 <div id="mdgPreviewContainer"></div> \ |
91 <span id="switcher">' + switcher + '</span><br />\ |
91 <span id="switcher">' + switcher + '</span><br />\ |
92 <form name="mdgAjaxEditor" method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
92 <form name="mdgAjaxEditor" method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
93 <textarea id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
93 <textarea id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
94 Edit summary: <input id="ajaxEditSummary" size="40" /><br />\ |
94 ' + $lang.get('editor_lbl_edit_summary') + ' <input id="ajaxEditSummary" size="40" /><br />\ |
95 <input id="ajaxEditMinor" name="minor" type="checkbox" /> <label for="ajaxEditMinor">This is a minor edit</label><br />\ |
95 <input id="ajaxEditMinor" name="minor" type="checkbox" /> <label for="ajaxEditMinor">' + $lang.get('editor_lbl_minor_edit') + '</label><br />\ |
96 <a href="#" onclick="void(ajaxSavePage()); return false;">save changes</a> | <a href="#" onclick="void(ajaxShowPreview()); return false;">preview changes</a> | <a href="#" onclick="void(ajaxEditor()); return false;">revert changes</a> | <a href="#" onclick="void(ajaxDiscard()); return false;">discard changes</a>\ |
96 <a href="#" onclick="void(ajaxSavePage()); return false;">' + $lang.get('editor_btn_save') + '</a> | <a href="#" onclick="void(ajaxShowPreview()); return false;">' + $lang.get('editor_btn_preview') + '</a> | <a href="#" onclick="void(ajaxEditor()); return false;">' + $lang.get('editor_btn_revert') + '</a> | <a href="#" onclick="void(ajaxDiscard()); return false;">' + $lang.get('editor_btn_cancel') + '</a>\ |
97 <br />\ |
97 <br />\ |
98 '+editNotice+'\ |
98 '+editNotice+'\ |
99 </form>'; |
99 </form>'; |
100 // initTextareas(); |
100 // initTextareas(); |
101 if(readCookie('enano_editor_mode') == 'tinymce') |
101 if(readCookie('enano_editor_mode') == 'tinymce') |
108 |
108 |
109 function setEditorMCE() |
109 function setEditorMCE() |
110 { |
110 { |
111 $('ajaxEditArea').switchToMCE(); |
111 $('ajaxEditArea').switchToMCE(); |
112 createCookie('enano_editor_mode', 'tinymce', 365); |
112 createCookie('enano_editor_mode', 'tinymce', 365); |
113 $('switcher').object.innerHTML = '<a href="#" onclick="setEditorText(); return false;">wikitext editor</a> | graphical editor'; |
113 $('switcher').object.innerHTML = '<a href="#" onclick="setEditorText(); return false;">' + $lang.get('editor_btn_wikitext') + '</a> | ' + $lang.get('editor_btn_graphical'); |
114 } |
114 } |
115 |
115 |
116 function setEditorText() |
116 function setEditorText() |
117 { |
117 { |
118 $('ajaxEditArea').destroyMCE(); |
118 $('ajaxEditArea').destroyMCE(); |
119 createCookie('enano_editor_mode', 'text', 365); |
119 createCookie('enano_editor_mode', 'text', 365); |
120 $('switcher').object.innerHTML = 'wikitext editor | <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>'; |
120 $('switcher').object.innerHTML = $lang.get('editor_btn_wikitext') + ' | <a href="#" onclick="setEditorMCE(); return false;">' + $lang.get('editor_btn_graphical') + '</a>'; |
121 } |
121 } |
122 |
122 |
123 function ajaxViewSource() |
123 function ajaxViewSource() |
124 { |
124 { |
125 // IE <6 pseudo-compatibility |
125 // IE <6 pseudo-compatibility |
142 grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
142 grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
143 } |
143 } |
144 document.getElementById('ajaxEditContainer').innerHTML = '\ |
144 document.getElementById('ajaxEditContainer').innerHTML = '\ |
145 <form method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
145 <form method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
146 <textarea readonly="readonly" id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
146 <textarea readonly="readonly" id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
147 <a href="#" onclick="void(ajaxReset()); return false;">close viewer</a>\ |
147 <a href="#" onclick="void(ajaxReset()); return false;">' + $lang.get('editor_btn_closeviewer') + '</a>\ |
148 </form>'; |
148 </form>'; |
149 initTextareas(); |
149 initTextareas(); |
150 } |
150 } |
151 }); |
151 }); |
152 } |
152 } |