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 |
127 return true; |
127 return true; |
128 setAjaxLoading(); |
128 setAjaxLoading(); |
129 ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
129 ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
130 if(ajax.readyState == 4) { |
130 if(ajax.readyState == 4) { |
131 unsetAjaxLoading(); |
131 unsetAjaxLoading(); |
132 if(edit_open) { |
132 edit_open = false; |
133 c=confirm('Do you really want to revert your changes?'); |
|
134 if(!c) return; |
|
135 } |
|
136 edit_open = true; |
|
137 selectButtonMajor('article'); |
133 selectButtonMajor('article'); |
138 selectButtonMinor('edit'); |
134 selectButtonMinor('edit'); |
139 if(in_array('ajaxEditArea', grippied_textareas)) |
135 if(in_array('ajaxEditArea', grippied_textareas)) |
140 { |
136 { |
141 // Allow the textarea grippifier to re-create the resizer control on the textarea |
137 // Allow the textarea grippifier to re-create the resizer control on the textarea |
142 grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
138 grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
143 } |
139 } |
144 document.getElementById('ajaxEditContainer').innerHTML = '\ |
140 document.getElementById('ajaxEditContainer').innerHTML = '\ |
145 <form method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
141 <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 />\ |
142 <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>\ |
143 <a href="#" onclick="void(ajaxReset()); return false;">' + $lang.get('editor_btn_closeviewer') + '</a>\ |
148 </form>'; |
144 </form>'; |
149 initTextareas(); |
145 initTextareas(); |
150 } |
146 } |
151 }); |
147 }); |
152 } |
148 } |
192 function ajaxDiscard() |
188 function ajaxDiscard() |
193 { |
189 { |
194 // IE <6 pseudo-compatibility |
190 // IE <6 pseudo-compatibility |
195 if ( KILL_SWITCH ) |
191 if ( KILL_SWITCH ) |
196 return true; |
192 return true; |
197 c = confirm('Do you really want to discard your changes?'); |
193 c = confirm($lang.get('editor_msg_discard_confirm')); |
198 if(!c) return; |
194 if(!c) return; |
199 ajaxReset(); |
195 ajaxReset(); |
200 } |
196 } |
201 |
197 |
202 function ajaxReset() |
198 function ajaxReset() |
203 { |
199 { |
204 // IE <6 pseudo-compatibility |
200 // IE <6 pseudo-compatibility |
205 if ( KILL_SWITCH ) |
201 if ( KILL_SWITCH ) |
206 return true; |
202 return true; |
|
203 var ns_id = strToPageID(title); |
|
204 if ( ns_id[1] == 'Special' || ns_id[1] == 'Admin' ) |
|
205 return false; |
207 enableUnload(); |
206 enableUnload(); |
208 setAjaxLoading(); |
207 setAjaxLoading(); |
209 ajaxGet(stdAjaxPrefix+'&_mode=getpage&noheaders', function() { |
208 ajaxGet(stdAjaxPrefix+'&_mode=getpage&noheaders', function() { |
210 if(ajax.readyState == 4) { |
209 if(ajax.readyState == 4) { |
211 unsetAjaxLoading(); |
210 unsetAjaxLoading(); |
246 function ajaxRename() |
245 function ajaxRename() |
247 { |
246 { |
248 // IE <6 pseudo-compatibility |
247 // IE <6 pseudo-compatibility |
249 if ( KILL_SWITCH ) |
248 if ( KILL_SWITCH ) |
250 return true; |
249 return true; |
251 r = prompt('What title should this page be renamed to?\nNote: This does not and will never change the URL of this page, that must be done from the admin panel.'); |
250 r = prompt($lang.get('ajax_rename_prompt')); |
252 if(!r || r=='') return; |
251 if(!r || r=='') return; |
253 setAjaxLoading(); |
252 setAjaxLoading(); |
254 ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+escape(r), function() { |
253 ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+escape(r), function() { |
255 if(ajax.readyState == 4) { |
254 if(ajax.readyState == 4) { |
256 unsetAjaxLoading(); |
255 unsetAjaxLoading(); |
276 function ajaxDeletePage() |
275 function ajaxDeletePage() |
277 { |
276 { |
278 // IE <6 pseudo-compatibility |
277 // IE <6 pseudo-compatibility |
279 if ( KILL_SWITCH ) |
278 if ( KILL_SWITCH ) |
280 return true; |
279 return true; |
281 var reason = prompt('Please enter your reason for deleting this page.'); |
280 var reason = prompt($lang.get('ajax_delete_prompt_reason')); |
282 if ( !reason || reason == '' ) |
281 if ( !reason || reason == '' ) |
283 { |
282 { |
284 return false; |
283 return false; |
285 } |
284 } |
286 c = confirm('You are about to REVERSIBLY delete this page. Do you REALLY want to do this?\n\n(Comments and categorization data, as well as any attached files, will be permanently lost)'); |
285 c = confirm($lang.get('ajax_delete_confirm')); |
287 if(!c) |
286 if(!c) |
288 { |
287 { |
289 return; |
288 return; |
290 } |
289 } |
291 setAjaxLoading(); |
290 setAjaxLoading(); |
455 function ajaxClearLogs() |
454 function ajaxClearLogs() |
456 { |
455 { |
457 // IE <6 pseudo-compatibility |
456 // IE <6 pseudo-compatibility |
458 if ( KILL_SWITCH ) |
457 if ( KILL_SWITCH ) |
459 return true; |
458 return true; |
460 c = confirm('You are about to DESTROY all log entries for this page. As opposed to (example) deleting this page, this action is completely IRREVERSIBLE and should not be used except in dire circumstances. Do you REALLY want to do this?'); |
459 c = confirm($lang.get('ajax_clearlogs_confirm')); |
461 if(!c) return; |
460 if(!c) return; |
462 c = confirm('You\'re ABSOLUTELY sure???'); |
461 c = confirm($lang.get('ajax_clearlogs_confirm_nag')); |
463 if(!c) return; |
462 if(!c) return; |
464 setAjaxLoading(); |
463 setAjaxLoading(); |
465 ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() { |
464 ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() { |
466 if(ajax.readyState == 4) { |
465 if(ajax.readyState == 4) { |
467 unsetAjaxLoading(); |
466 unsetAjaxLoading(); |
561 { |
560 { |
562 // IE <6 pseudo-compatibility |
561 // IE <6 pseudo-compatibility |
563 if ( KILL_SWITCH ) |
562 if ( KILL_SWITCH ) |
564 return true; |
563 return true; |
565 var inner_html = ''; |
564 var inner_html = ''; |
566 inner_html += '<p><label>Theme: '; |
565 inner_html += '<p><label>' + $lang.get('ajax_changestyle_lbl_theme') + ' '; |
567 inner_html += ' <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">'; |
566 inner_html += ' <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">'; |
568 inner_html += ' <option value="_blank" selected="selected">[Select]</option>'; |
567 inner_html += ' <option value="_blank" selected="selected">' + $lang.get('ajax_changestyle_select') + '</option>'; |
569 inner_html += ENANO_THEME_LIST; |
568 inner_html += ENANO_THEME_LIST; |
570 inner_html += ' </select>'; |
569 inner_html += ' </select>'; |
571 inner_html += '</label></p>'; |
570 inner_html += '</label></p>'; |
572 var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, 'Change your theme', inner_html); |
571 var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, $lang.get('ajax_changestyle_title'), inner_html); |
573 chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete; |
572 chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete; |
574 } |
573 } |
575 |
574 |
576 function ajaxGetStyles(id) |
575 function ajaxGetStyles(id) |
577 { |
576 { |
612 options.push(option); |
611 options.push(option); |
613 } |
612 } |
614 var p_parent = document.createElement('p'); |
613 var p_parent = document.createElement('p'); |
615 var label = document.createElement('label'); |
614 var label = document.createElement('label'); |
616 p_parent.id = 'chtheme_sel_style_parent'; |
615 p_parent.id = 'chtheme_sel_style_parent'; |
617 label.appendChild(document.createTextNode('Style: ')); |
616 label.appendChild(document.createTextNode($lang.get('ajax_changestyle_lbl_style') + ' ')); |
618 var select = document.createElement('select'); |
617 var select = document.createElement('select'); |
619 select.id = 'chtheme_sel_style'; |
618 select.id = 'chtheme_sel_style'; |
620 for ( var i in options ) |
619 for ( var i in options ) |
621 { |
620 { |
622 select.appendChild(options[i]); |
621 select.appendChild(options[i]); |
641 return true; |
640 return true; |
642 var theme = $('chtheme_sel_theme'); |
641 var theme = $('chtheme_sel_theme'); |
643 var style = $('chtheme_sel_style'); |
642 var style = $('chtheme_sel_style'); |
644 if ( !theme.object || !style.object ) |
643 if ( !theme.object || !style.object ) |
645 { |
644 { |
646 alert('Please select a theme from the list.'); |
645 alert($lang.get('ajax_changestyle_pleaseselect_theme')); |
647 return true; |
646 return true; |
648 } |
647 } |
649 var theme_id = theme.object.value; |
648 var theme_id = theme.object.value; |
650 var style_id = style.object.value; |
649 var style_id = style.object.value; |
651 |
650 |
874 function ajaxDisableEmbeddedPHP() |
873 function ajaxDisableEmbeddedPHP() |
875 { |
874 { |
876 // IE <6 pseudo-compatibility |
875 // IE <6 pseudo-compatibility |
877 if ( KILL_SWITCH ) |
876 if ( KILL_SWITCH ) |
878 return true; |
877 return true; |
879 if ( !confirm('Are you really sure you want to do this? Some pages might not function if this emergency-only feature is activated.') ) |
878 if ( !confirm($lang.get('ajax_killphp_confirm')) ) |
880 return false; |
879 return false; |
881 var $killdiv = $dynano('php_killer'); |
880 var $killdiv = $dynano('php_killer'); |
882 if ( !$killdiv.object ) |
881 if ( !$killdiv.object ) |
883 { |
882 { |
884 alert('Can\'t get kill div object'); |
883 alert('Can\'t get kill div object'); |
895 //$killdiv.object.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.'; |
894 //$killdiv.object.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.'; |
896 $killdiv.object.parentNode.removeChild($killdiv.object); |
895 $killdiv.object.parentNode.removeChild($killdiv.object); |
897 var newdiv = document.createElement('div'); |
896 var newdiv = document.createElement('div'); |
898 // newdiv.style = $killdiv.object.style; |
897 // newdiv.style = $killdiv.object.style; |
899 newdiv.className = $killdiv.object.className; |
898 newdiv.className = $killdiv.object.className; |
900 newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.'; |
899 newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />' + $lang.get('ajax_killphp_success'); |
901 $killdiv.object.parentNode.appendChild(newdiv); |
900 $killdiv.object.parentNode.appendChild(newdiv); |
902 $killdiv.object.parentNode.removeChild($killdiv.object); |
901 $killdiv.object.parentNode.removeChild($killdiv.object); |
903 } |
902 } |
904 else |
903 else |
905 { |
904 { |
932 var json = parseJSON(resptext); |
931 var json = parseJSON(resptext); |
933 var catbox = document.getElementById('mdgCatBox'); |
932 var catbox = document.getElementById('mdgCatBox'); |
934 if ( !catbox ) |
933 if ( !catbox ) |
935 return false; |
934 return false; |
936 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
935 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
937 linkbox.firstChild.nodeValue = 'show page categorization'; |
936 linkbox.firstChild.nodeValue = $lang.get('catedit_catbox_link_showcategorization'); |
938 linkbox.onclick = function() { ajaxTagToCat(); return false; }; |
937 linkbox.onclick = function() { ajaxTagToCat(); return false; }; |
939 catHTMLBuf = catbox.innerHTML; |
938 catHTMLBuf = catbox.innerHTML; |
940 catbox.innerHTML = ''; |
939 catbox.innerHTML = ''; |
941 catbox.appendChild(document.createTextNode('Page tags: ')); |
940 catbox.appendChild(document.createTextNode($lang.get('tags_lbl_page_tags')+' ')); |
942 if ( json.tags.length < 1 ) |
941 if ( json.tags.length < 1 ) |
943 { |
942 { |
944 catbox.appendChild(document.createTextNode('No tags on this page')); |
943 catbox.appendChild(document.createTextNode($lang.get('tags_lbl_no_tags'))); |
945 } |
944 } |
946 for ( var i = 0; i < json.tags.length; i++ ) |
945 for ( var i = 0; i < json.tags.length; i++ ) |
947 { |
946 { |
948 catbox.appendChild(document.createTextNode(json.tags[i].name)); |
947 catbox.appendChild(document.createTextNode(json.tags[i].name)); |
949 if ( json.tags[i].can_del ) |
948 if ( json.tags[i].can_del ) |
982 var adddiv = document.createElement('div'); |
981 var adddiv = document.createElement('div'); |
983 var text = document.createElement('input'); |
982 var text = document.createElement('input'); |
984 var addlink = document.createElement('a'); |
983 var addlink = document.createElement('a'); |
985 addlink.href = '#'; |
984 addlink.href = '#'; |
986 addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; }; |
985 addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; }; |
987 addlink.appendChild(document.createTextNode('+ Add')); |
986 addlink.appendChild(document.createTextNode($lang.get('tags_btn_add'))); |
988 text.type = 'text'; |
987 text.type = 'text'; |
989 text.size = '15'; |
988 text.size = '15'; |
990 text.onkeyup = function(e) |
989 text.onkeyup = function(e) |
991 { |
990 { |
992 if ( e.keyCode == 13 ) |
991 if ( e.keyCode == 13 ) |
994 ajaxAddTagStage2(this.value, this.parentNode); |
993 ajaxAddTagStage2(this.value, this.parentNode); |
995 } |
994 } |
996 } |
995 } |
997 |
996 |
998 adddiv.style.margin = '5px 0 0 0'; |
997 adddiv.style.margin = '5px 0 0 0'; |
999 adddiv.appendChild(document.createTextNode('Add a tag: ')); |
998 adddiv.appendChild(document.createTextNode($lang.get('tags_lbl_add_tag')+' ')); |
1000 adddiv.appendChild(text); |
999 adddiv.appendChild(text); |
1001 adddiv.appendChild(document.createTextNode(' ')); |
1000 adddiv.appendChild(document.createTextNode(' ')); |
1002 adddiv.appendChild(addlink); |
1001 adddiv.appendChild(addlink); |
1003 catbox.appendChild(adddiv); |
1002 catbox.appendChild(adddiv); |
1004 addtag_open = true; |
1003 addtag_open = true; |
1036 if ( json.success ) |
1035 if ( json.success ) |
1037 { |
1036 { |
1038 var node = parent.childNodes[1]; |
1037 var node = parent.childNodes[1]; |
1039 var insertafter = false; |
1038 var insertafter = false; |
1040 var nukeafter = false; |
1039 var nukeafter = false; |
1041 if ( node.nodeValue == 'No tags on this page' ) |
1040 if ( node.nodeValue == $lang.get('tags_lbl_no_tags') ) |
1042 { |
1041 { |
1043 nukeafter = true; |
1042 nukeafter = true; |
1044 } |
1043 } |
1045 insertafter = parent.childNodes[ parent.childNodes.length - 3 ]; |
1044 insertafter = parent.childNodes[ parent.childNodes.length - 3 ]; |
1046 // these need to be inserted in reverse order |
1045 // these need to be inserted in reverse order |
1077 var arrDelete = [ parentobj, parentobj.previousSibling, parentobj.previousSibling.previousSibling ]; |
1076 var arrDelete = [ parentobj, parentobj.previousSibling, parentobj.previousSibling.previousSibling ]; |
1078 var parent = parentobj.parentNode; |
1077 var parent = parentobj.parentNode; |
1079 var writeNoTags = false; |
1078 var writeNoTags = false; |
1080 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' ) |
1079 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' ) |
1081 arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling); |
1080 arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling); |
1082 else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' ) |
1081 else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' ) |
1083 arrDelete.push(parentobj.nextSibling); |
1082 arrDelete.push(parentobj.nextSibling); |
1084 |
1083 |
1085 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' && |
1084 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' && |
1086 parentobj.nextSibling.nextSibling.firstChild ) |
1085 parentobj.nextSibling.nextSibling.firstChild ) |
1087 if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == '(add a tag)') |
1086 if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == $lang.get('tags_btn_add_tag')) |
1088 writeNoTags = true; |
1087 writeNoTags = true; |
1089 |
1088 |
1090 ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function() |
1089 ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function() |
1091 { |
1090 { |
1092 if ( ajax.readyState == 4 ) |
1091 if ( ajax.readyState == 4 ) |
1100 parent.removeChild(arrDelete[i]); |
1099 parent.removeChild(arrDelete[i]); |
1101 } catch(e) {} |
1100 } catch(e) {} |
1102 } |
1101 } |
1103 if ( writeNoTags ) |
1102 if ( writeNoTags ) |
1104 { |
1103 { |
1105 var node1 = document.createTextNode('No tags on this page'); |
1104 var node1 = document.createTextNode($lang.get('tags_lbl_no_tags')); |
1106 var node2 = document.createTextNode(' '); |
1105 var node2 = document.createTextNode(' '); |
1107 insertAfter(parent, node1, parent.firstChild); |
1106 insertAfter(parent, node1, parent.firstChild); |
1108 insertAfter(parent, node2, node1); |
1107 insertAfter(parent, node2, node1); |
1109 } |
1108 } |
1110 } |
1109 } |
1123 var catbox = document.getElementById('mdgCatBox'); |
1122 var catbox = document.getElementById('mdgCatBox'); |
1124 if ( !catbox ) |
1123 if ( !catbox ) |
1125 return false; |
1124 return false; |
1126 addtag_open = false; |
1125 addtag_open = false; |
1127 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
1126 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
1128 linkbox.firstChild.nodeValue = 'show page tags'; |
1127 linkbox.firstChild.nodeValue = $lang.get('tags_catbox_link'); |
1129 linkbox.onclick = function() { ajaxCatToTag(); return false; }; |
1128 linkbox.onclick = function() { ajaxCatToTag(); return false; }; |
1130 catbox.innerHTML = catHTMLBuf; |
1129 catbox.innerHTML = catHTMLBuf; |
1131 catHTMLBuf = false; |
1130 catHTMLBuf = false; |
1132 } |
1131 } |
1133 |
1132 |
1146 { |
1145 { |
1147 createCookie('admin_keepalive', '0', 3650); |
1146 createCookie('admin_keepalive', '0', 3650); |
1148 if ( keepalive_interval ) |
1147 if ( keepalive_interval ) |
1149 clearInterval(keepalive_interval); |
1148 clearInterval(keepalive_interval); |
1150 var span = document.getElementById('keepalivestat'); |
1149 var span = document.getElementById('keepalivestat'); |
1151 span.firstChild.nodeValue = 'Turn on keep-alive'; |
1150 span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off'); |
1152 } |
1151 } |
1153 else |
1152 else |
1154 { |
1153 { |
1155 createCookie('admin_keepalive', '1', 3650); |
1154 createCookie('admin_keepalive', '1', 3650); |
1156 if ( !keepalive_interval ) |
1155 if ( !keepalive_interval ) |
1157 keepalive_interval = setInterval('ajaxPingServer();', 600000); |
1156 keepalive_interval = setInterval('ajaxPingServer();', 600000); |
1158 var span = document.getElementById('keepalivestat'); |
1157 var span = document.getElementById('keepalivestat'); |
1159 span.firstChild.nodeValue = 'Turn off keep-alive'; |
1158 span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on'); |
1160 ajaxPingServer(); |
1159 ajaxPingServer(); |
1161 } |
1160 } |
1162 } |
1161 } |
1163 |
1162 |
1164 var keepalive_onload = function() |
1163 var keepalive_onload = function() |
1166 if ( readCookie('admin_keepalive') == '1' ) |
1165 if ( readCookie('admin_keepalive') == '1' ) |
1167 { |
1166 { |
1168 if ( !keepalive_interval ) |
1167 if ( !keepalive_interval ) |
1169 keepalive_interval = setInterval('ajaxPingServer();', 600000); |
1168 keepalive_interval = setInterval('ajaxPingServer();', 600000); |
1170 var span = document.getElementById('keepalivestat'); |
1169 var span = document.getElementById('keepalivestat'); |
1171 span.firstChild.nodeValue = 'Turn off keep-alive'; |
1170 span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on'); |
1172 } |
1171 } |
1173 else |
1172 else |
1174 { |
1173 { |
1175 if ( keepalive_interval ) |
1174 if ( keepalive_interval ) |
1176 clearInterval(keepalive_interval); |
1175 clearInterval(keepalive_interval); |
1177 var span = document.getElementById('keepalivestat'); |
1176 var span = document.getElementById('keepalivestat'); |
1178 span.firstChild.nodeValue = 'Turn on keep-alive'; |
1177 span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off'); |
1179 } |
1178 } |
1180 }; |
1179 }; |
1181 |
1180 |
1182 function aboutKeepAlive() |
1181 function aboutKeepAlive() |
1183 { |
1182 { |
1184 new messagebox(MB_OK|MB_ICONINFORMATION, 'About the keep-alive feature', 'Keep-alive is a new Enano feature that keeps your administrative session from timing out while you are using the administration panel. This feature can be useful if you are editing a large page or doing something in the administration interface that will take longer than 15 minutes.<br /><br />For security reasons, Enano mandates that high-privilege logins last only 15 minutes, with the time being reset each time a page is loaded (or, more specifically, each time the session API is started). The consequence of this is that if you are performing an action in the administration panel that takes more than 15 minutes, your session may be terminated. The keep-alive feature attempts to relieve this by sending a "ping" to the server every 10 minutes.<br /><br />Please note that keep-alive state is determined by a cookie. Thus, if you log out and then back in as a different administrator, keep-alive will use the same setting that was used when you were logged in as the first administrative user. In the same way, if you log into the administration panel under your account from another computer, keep-alive will be set to "off".<br /><br /><b>For more information:</b><br /><a href="http://docs.enanocms.org/Help:Appendix_B" onclick="window.open(this.href); return false;">Overview of Enano'+"'"+'s security model'); |
1183 new messagebox(MB_OK|MB_ICONINFORMATION, $lang.get('user_keepalive_info_title'), $lang.get('user_keepalive_info_body')); |
1185 } |
1184 } |
1186 |
1185 |
|
1186 function ajaxShowCaptcha(code) |
|
1187 { |
|
1188 var mydiv = document.createElement('div'); |
|
1189 mydiv.style.backgroundColor = '#FFFFFF'; |
|
1190 mydiv.style.padding = '10px'; |
|
1191 mydiv.style.position = 'absolute'; |
|
1192 mydiv.style.top = '0px'; |
|
1193 mydiv.id = 'autoCaptcha'; |
|
1194 mydiv.style.zIndex = String( getHighestZ() + 1 ); |
|
1195 var img = document.createElement('img'); |
|
1196 img.onload = function() |
|
1197 { |
|
1198 if ( this.loaded ) |
|
1199 return true; |
|
1200 var mydiv = document.getElementById('autoCaptcha'); |
|
1201 var width = getWidth(); |
|
1202 var divw = $(mydiv).Width(); |
|
1203 var left = ( width / 2 ) - ( divw / 2 ); |
|
1204 mydiv.style.left = left + 'px'; |
|
1205 fly_in_top(mydiv, false, true); |
|
1206 this.loaded = true; |
|
1207 }; |
|
1208 img.src = makeUrlNS('Special', 'Captcha/' + code); |
|
1209 img.onclick = function() { this.src = this.src + '/a'; }; |
|
1210 img.style.cursor = 'pointer'; |
|
1211 mydiv.appendChild(img); |
|
1212 domObjChangeOpac(0, mydiv); |
|
1213 var body = document.getElementsByTagName('body')[0]; |
|
1214 body.appendChild(mydiv); |
|
1215 } |
|
1216 |