function enableEditor() { var content = document.getElementById('cms_editor_id').value; document.getElementById('content_queue').value = content; tinyMCE.init({ mode : "textareas", theme : "advanced", editor_selector : "cms_editor", plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : false, template_external_list_url : "lists/template_list.js", external_link_list_url : "lists/link_list.js", external_image_list_url : "lists/image_list.js", media_external_list_url : "lists/media_list.js" }); //backupDB(); document.getElementById('cmsContentBody').style.display = 'none'; winW = window.innerWidth; winH = window.innerHeight; divW = parseInt(document.getElementById('editDiv').style.width); divH = parseInt(document.getElementById('editDiv').style.height); newX = (winW - divW) / 2; newY = (winH - divH) / 2; document.getElementById('editDiv').style.top = newY+'px'; document.getElementById('editDiv').style.left = newX+'px'; document.getElementById('editDiv').style.display = 'block'; document.getElementById('outerEditDiv').style.display = 'block'; //document.getElementById('cms_edit_link').style.display = 'none'; } function showLogin() { document.getElementById('cmsContentBody').style.display = 'none'; document.getElementById('cmsLogin').style.display = 'block'; //document.getElementById('login_logout_link').style.display = 'none'; } function goToLogout() { document.location = '/logout.php'; } function cancelEdit() { tinyMCE.execCommand('mceRemoveControl', false, 'cms_editor_id'); var content = document.getElementById('content_queue').value; document.getElementById('cms_editor_id').value = content; document.getElementById('editDiv').style.display = 'none'; document.getElementById('outerEditDiv').style.display = 'none'; document.getElementById('cmsContentBody').style.display = 'block'; //document.getElementById('cms_edit_link').style.display = 'block'; } function backupDB(page) { var data = 'page='+page; var db_backup = processAjax('/~gelastic/includes/cms/backup.php', 'post', data); if (db_backup) alert('Database Backup Successful!'); } function ajaxInit() { var xmlhttp = false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function processAjax(serverPage, getOrPost, data) { var xmlhttp = ajaxInit(); var html; if (getOrPost == "get") { xmlhttp.open("GET", serverPage); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { html = xmlhttp.responseText; } } xmlhttp.send(null); } else { xmlhttp.open("POST", serverPage); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { html = xmlhttp.responseText; } } xmlhttp.send(data); } return html; }