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 |
246 function ajaxRename() |
242 function ajaxRename() |
247 { |
243 { |
248 // IE <6 pseudo-compatibility |
244 // IE <6 pseudo-compatibility |
249 if ( KILL_SWITCH ) |
245 if ( KILL_SWITCH ) |
250 return true; |
246 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.'); |
247 r = prompt($lang.get('ajax_rename_prompt')); |
252 if(!r || r=='') return; |
248 if(!r || r=='') return; |
253 setAjaxLoading(); |
249 setAjaxLoading(); |
254 ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+escape(r), function() { |
250 ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+escape(r), function() { |
255 if(ajax.readyState == 4) { |
251 if(ajax.readyState == 4) { |
256 unsetAjaxLoading(); |
252 unsetAjaxLoading(); |
276 function ajaxDeletePage() |
272 function ajaxDeletePage() |
277 { |
273 { |
278 // IE <6 pseudo-compatibility |
274 // IE <6 pseudo-compatibility |
279 if ( KILL_SWITCH ) |
275 if ( KILL_SWITCH ) |
280 return true; |
276 return true; |
281 var reason = prompt('Please enter your reason for deleting this page.'); |
277 var reason = prompt($lang.get('ajax_delete_prompt_reason')); |
282 if ( !reason || reason == '' ) |
278 if ( !reason || reason == '' ) |
283 { |
279 { |
284 return false; |
280 return false; |
285 } |
281 } |
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)'); |
282 c = confirm($lang.get('ajax_delete_confirm')); |
287 if(!c) |
283 if(!c) |
288 { |
284 { |
289 return; |
285 return; |
290 } |
286 } |
291 setAjaxLoading(); |
287 setAjaxLoading(); |
301 function ajaxDelVote() |
297 function ajaxDelVote() |
302 { |
298 { |
303 // IE <6 pseudo-compatibility |
299 // IE <6 pseudo-compatibility |
304 if ( KILL_SWITCH ) |
300 if ( KILL_SWITCH ) |
305 return true; |
301 return true; |
306 c = confirm('Are you sure that you want to vote that this page be deleted?'); |
302 c = confirm($lang.get('ajax_delvote_confirm')); |
307 if(!c) return; |
303 if(!c) return; |
308 setAjaxLoading(); |
304 setAjaxLoading(); |
309 ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() { |
305 ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() { |
310 if(ajax.readyState == 4) { |
306 if(ajax.readyState == 4) { |
311 unsetAjaxLoading(); |
307 unsetAjaxLoading(); |
317 function ajaxResetDelVotes() |
313 function ajaxResetDelVotes() |
318 { |
314 { |
319 // IE <6 pseudo-compatibility |
315 // IE <6 pseudo-compatibility |
320 if ( KILL_SWITCH ) |
316 if ( KILL_SWITCH ) |
321 return true; |
317 return true; |
322 c = confirm('This will reset the number of votes against this page to zero. Do you really want to do this?'); |
318 c = confirm($lang.get('ajax_delvote_reset_confirm')); |
323 if(!c) return; |
319 if(!c) return; |
324 setAjaxLoading(); |
320 setAjaxLoading(); |
325 ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() { |
321 ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() { |
326 if(ajax.readyState == 4) { |
322 if(ajax.readyState == 4) { |
327 unsetAjaxLoading(); |
323 unsetAjaxLoading(); |
455 function ajaxClearLogs() |
451 function ajaxClearLogs() |
456 { |
452 { |
457 // IE <6 pseudo-compatibility |
453 // IE <6 pseudo-compatibility |
458 if ( KILL_SWITCH ) |
454 if ( KILL_SWITCH ) |
459 return true; |
455 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?'); |
456 c = confirm($lang.get('ajax_clearlogs_confirm')); |
461 if(!c) return; |
457 if(!c) return; |
462 c = confirm('You\'re ABSOLUTELY sure???'); |
458 c = confirm($lang.get('ajax_clearlogs_confirm_nag')); |
463 if(!c) return; |
459 if(!c) return; |
464 setAjaxLoading(); |
460 setAjaxLoading(); |
465 ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() { |
461 ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() { |
466 if(ajax.readyState == 4) { |
462 if(ajax.readyState == 4) { |
467 unsetAjaxLoading(); |
463 unsetAjaxLoading(); |
563 if ( KILL_SWITCH ) |
559 if ( KILL_SWITCH ) |
564 return true; |
560 return true; |
565 var inner_html = ''; |
561 var inner_html = ''; |
566 inner_html += '<p><label>Theme: '; |
562 inner_html += '<p><label>Theme: '; |
567 inner_html += ' <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">'; |
563 inner_html += ' <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">'; |
568 inner_html += ' <option value="_blank" selected="selected">[Select]</option>'; |
564 inner_html += ' <option value="_blank" selected="selected">' + $lang.get('ajax_changestyle_select') + '</option>'; |
569 inner_html += ENANO_THEME_LIST; |
565 inner_html += ENANO_THEME_LIST; |
570 inner_html += ' </select>'; |
566 inner_html += ' </select>'; |
571 inner_html += '</label></p>'; |
567 inner_html += '</label></p>'; |
572 var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, 'Change your theme', inner_html); |
568 var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, $lang.get('ajax_changestyle_title'), inner_html); |
573 chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete; |
569 chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete; |
574 } |
570 } |
575 |
571 |
576 function ajaxGetStyles(id) |
572 function ajaxGetStyles(id) |
577 { |
573 { |
641 return true; |
637 return true; |
642 var theme = $('chtheme_sel_theme'); |
638 var theme = $('chtheme_sel_theme'); |
643 var style = $('chtheme_sel_style'); |
639 var style = $('chtheme_sel_style'); |
644 if ( !theme.object || !style.object ) |
640 if ( !theme.object || !style.object ) |
645 { |
641 { |
646 alert('Please select a theme from the list.'); |
642 alert($lang.get('ajax_changestyle_pleaseselect_theme')); |
647 return true; |
643 return true; |
648 } |
644 } |
649 var theme_id = theme.object.value; |
645 var theme_id = theme.object.value; |
650 var style_id = style.object.value; |
646 var style_id = style.object.value; |
651 |
647 |
874 function ajaxDisableEmbeddedPHP() |
870 function ajaxDisableEmbeddedPHP() |
875 { |
871 { |
876 // IE <6 pseudo-compatibility |
872 // IE <6 pseudo-compatibility |
877 if ( KILL_SWITCH ) |
873 if ( KILL_SWITCH ) |
878 return true; |
874 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.') ) |
875 if ( !confirm($lang.get('ajax_killphp_confirm')) ) |
880 return false; |
876 return false; |
881 var $killdiv = $dynano('php_killer'); |
877 var $killdiv = $dynano('php_killer'); |
882 if ( !$killdiv.object ) |
878 if ( !$killdiv.object ) |
883 { |
879 { |
884 alert('Can\'t get kill div object'); |
880 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.'; |
891 //$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); |
892 $killdiv.object.parentNode.removeChild($killdiv.object); |
897 var newdiv = document.createElement('div'); |
893 var newdiv = document.createElement('div'); |
898 // newdiv.style = $killdiv.object.style; |
894 // newdiv.style = $killdiv.object.style; |
899 newdiv.className = $killdiv.object.className; |
895 newdiv.className = $killdiv.object.className; |
900 newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.'; |
896 newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />' + $lang.get('ajax_killphp_success'); |
901 $killdiv.object.parentNode.appendChild(newdiv); |
897 $killdiv.object.parentNode.appendChild(newdiv); |
902 $killdiv.object.parentNode.removeChild($killdiv.object); |
898 $killdiv.object.parentNode.removeChild($killdiv.object); |
903 } |
899 } |
904 else |
900 else |
905 { |
901 { |
932 var json = parseJSON(resptext); |
928 var json = parseJSON(resptext); |
933 var catbox = document.getElementById('mdgCatBox'); |
929 var catbox = document.getElementById('mdgCatBox'); |
934 if ( !catbox ) |
930 if ( !catbox ) |
935 return false; |
931 return false; |
936 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
932 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
937 linkbox.firstChild.nodeValue = 'show page categorization'; |
933 linkbox.firstChild.nodeValue = $lang.get('catedit_catbox_link_showcategorization'); |
938 linkbox.onclick = function() { ajaxTagToCat(); return false; }; |
934 linkbox.onclick = function() { ajaxTagToCat(); return false; }; |
939 catHTMLBuf = catbox.innerHTML; |
935 catHTMLBuf = catbox.innerHTML; |
940 catbox.innerHTML = ''; |
936 catbox.innerHTML = ''; |
941 catbox.appendChild(document.createTextNode('Page tags: ')); |
937 catbox.appendChild(document.createTextNode($lang.get('tags_lbl_page_tags')+' ')); |
942 if ( json.tags.length < 1 ) |
938 if ( json.tags.length < 1 ) |
943 { |
939 { |
944 catbox.appendChild(document.createTextNode('No tags on this page')); |
940 catbox.appendChild(document.createTextNode($lang.get('tags_lbl_no_tags'))); |
945 } |
941 } |
946 for ( var i = 0; i < json.tags.length; i++ ) |
942 for ( var i = 0; i < json.tags.length; i++ ) |
947 { |
943 { |
948 catbox.appendChild(document.createTextNode(json.tags[i].name)); |
944 catbox.appendChild(document.createTextNode(json.tags[i].name)); |
949 if ( json.tags[i].can_del ) |
945 if ( json.tags[i].can_del ) |
963 { |
959 { |
964 catbox.appendChild(document.createTextNode(' ')); |
960 catbox.appendChild(document.createTextNode(' ')); |
965 var addlink = document.createElement('a'); |
961 var addlink = document.createElement('a'); |
966 addlink.href = '#'; |
962 addlink.href = '#'; |
967 addlink.onclick = function() { try { ajaxAddTagStage1(); } catch(e) { }; return false; }; |
963 addlink.onclick = function() { try { ajaxAddTagStage1(); } catch(e) { }; return false; }; |
968 addlink.appendChild(document.createTextNode('(add a tag)')); |
964 addlink.appendChild(document.createTextNode($lang.get('tags_btn_add_tag'))); |
969 catbox.appendChild(addlink); |
965 catbox.appendChild(addlink); |
970 } |
966 } |
971 } |
967 } |
972 }); |
968 }); |
973 } |
969 } |
982 var adddiv = document.createElement('div'); |
978 var adddiv = document.createElement('div'); |
983 var text = document.createElement('input'); |
979 var text = document.createElement('input'); |
984 var addlink = document.createElement('a'); |
980 var addlink = document.createElement('a'); |
985 addlink.href = '#'; |
981 addlink.href = '#'; |
986 addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; }; |
982 addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; }; |
987 addlink.appendChild(document.createTextNode('+ Add')); |
983 addlink.appendChild(document.createTextNode($lang.get('tags_btn_add'))); |
988 text.type = 'text'; |
984 text.type = 'text'; |
989 text.size = '15'; |
985 text.size = '15'; |
990 text.onkeyup = function(e) |
986 text.onkeyup = function(e) |
991 { |
987 { |
992 if ( e.keyCode == 13 ) |
988 if ( e.keyCode == 13 ) |
994 ajaxAddTagStage2(this.value, this.parentNode); |
990 ajaxAddTagStage2(this.value, this.parentNode); |
995 } |
991 } |
996 } |
992 } |
997 |
993 |
998 adddiv.style.margin = '5px 0 0 0'; |
994 adddiv.style.margin = '5px 0 0 0'; |
999 adddiv.appendChild(document.createTextNode('Add a tag: ')); |
995 adddiv.appendChild(document.createTextNode($lang.get('tags_lbl_add_tag')+' ')); |
1000 adddiv.appendChild(text); |
996 adddiv.appendChild(text); |
1001 adddiv.appendChild(document.createTextNode(' ')); |
997 adddiv.appendChild(document.createTextNode(' ')); |
1002 adddiv.appendChild(addlink); |
998 adddiv.appendChild(addlink); |
1003 catbox.appendChild(adddiv); |
999 catbox.appendChild(adddiv); |
1004 addtag_open = true; |
1000 addtag_open = true; |
1036 if ( json.success ) |
1032 if ( json.success ) |
1037 { |
1033 { |
1038 var node = parent.childNodes[1]; |
1034 var node = parent.childNodes[1]; |
1039 var insertafter = false; |
1035 var insertafter = false; |
1040 var nukeafter = false; |
1036 var nukeafter = false; |
1041 if ( node.nodeValue == 'No tags on this page' ) |
1037 if ( node.nodeValue == $lang.get('tags_lbl_no_tags') ) |
1042 { |
1038 { |
1043 nukeafter = true; |
1039 nukeafter = true; |
1044 } |
1040 } |
1045 insertafter = parent.childNodes[ parent.childNodes.length - 3 ]; |
1041 insertafter = parent.childNodes[ parent.childNodes.length - 3 ]; |
1046 // these need to be inserted in reverse order |
1042 // these need to be inserted in reverse order |
1077 var arrDelete = [ parentobj, parentobj.previousSibling, parentobj.previousSibling.previousSibling ]; |
1073 var arrDelete = [ parentobj, parentobj.previousSibling, parentobj.previousSibling.previousSibling ]; |
1078 var parent = parentobj.parentNode; |
1074 var parent = parentobj.parentNode; |
1079 var writeNoTags = false; |
1075 var writeNoTags = false; |
1080 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' ) |
1076 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' ) |
1081 arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling); |
1077 arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling); |
1082 else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' ) |
1078 else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' ) |
1083 arrDelete.push(parentobj.nextSibling); |
1079 arrDelete.push(parentobj.nextSibling); |
1084 |
1080 |
1085 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' && |
1081 if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' && |
1086 parentobj.nextSibling.nextSibling.firstChild ) |
1082 parentobj.nextSibling.nextSibling.firstChild ) |
1087 if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == '(add a tag)') |
1083 if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == $lang.get('tags_btn_add_tag')) |
1088 writeNoTags = true; |
1084 writeNoTags = true; |
1089 |
1085 |
1090 ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function() |
1086 ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function() |
1091 { |
1087 { |
1092 if ( ajax.readyState == 4 ) |
1088 if ( ajax.readyState == 4 ) |
1100 parent.removeChild(arrDelete[i]); |
1096 parent.removeChild(arrDelete[i]); |
1101 } catch(e) {} |
1097 } catch(e) {} |
1102 } |
1098 } |
1103 if ( writeNoTags ) |
1099 if ( writeNoTags ) |
1104 { |
1100 { |
1105 var node1 = document.createTextNode('No tags on this page'); |
1101 var node1 = document.createTextNode($lang.get('tags_lbl_no_tags')); |
1106 var node2 = document.createTextNode(' '); |
1102 var node2 = document.createTextNode(' '); |
1107 insertAfter(parent, node1, parent.firstChild); |
1103 insertAfter(parent, node1, parent.firstChild); |
1108 insertAfter(parent, node2, node1); |
1104 insertAfter(parent, node2, node1); |
1109 } |
1105 } |
1110 } |
1106 } |
1123 var catbox = document.getElementById('mdgCatBox'); |
1119 var catbox = document.getElementById('mdgCatBox'); |
1124 if ( !catbox ) |
1120 if ( !catbox ) |
1125 return false; |
1121 return false; |
1126 addtag_open = false; |
1122 addtag_open = false; |
1127 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
1123 var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
1128 linkbox.firstChild.nodeValue = 'show page tags'; |
1124 linkbox.firstChild.nodeValue = $lang.get('tags_catbox_link'); |
1129 linkbox.onclick = function() { ajaxCatToTag(); return false; }; |
1125 linkbox.onclick = function() { ajaxCatToTag(); return false; }; |
1130 catbox.innerHTML = catHTMLBuf; |
1126 catbox.innerHTML = catHTMLBuf; |
1131 catHTMLBuf = false; |
1127 catHTMLBuf = false; |
1132 } |
1128 } |
1133 |
1129 |