CMSForm = Class.extend('ChangeTracker').extend('Observable'); CMSForm.prototype = { initialize : function(fn) { this.ChangeTracker.initialize(); this.formName = fn; this.prepareForm(); }, /** * Processing called whenever a page is loaded in the right - including the initial one */ prepareForm : function() { ajaxActionsAtTop(this.id, 'form_actions_' + this.formName, this.formName); }, /** * Load actions from a string containing the HTML content */ loadActionsFromString : function(actionHTML) { var actionHolder = $('form_actions_' + this.formName); actionHolder.innerHTML = actionHTML; prepareAjaxActions(actionHolder, this.id, this.formName); }, /** * Close the form down without any corrective action, after its been deleted. */ closeIfSetTo: function(id) { if(this.elements.ID && this.elements.ID.value == id) { this.innerHTML = "
This page was deleted. To edit a page, select it from the left.
"; if(typeof tinyMCE != 'undefined') tinyMCE.instances = []; } }, /** * Reload lose the form if the current page is open. */ reloadIfSetTo: function(id) { if(this.elements.ID && this.elements.ID.value == id) { this.getPageFromServer(id); } }, close: function() { this.innerHTML = ""; var actions; if(actions = $('form_actions_' + this.formName)) { actions.parentNode.removeChild(actions); } }, updateStatus: function( newStatus ) { if( $('Form_EditForm_Status') ) $('Form_EditForm_Status').innerHTML = "STATUS: " + newStatus; }, /** * Load a new page into the right-hand form. * * @param formContent string * @param response object (optional) * @param evalResponse boolean (optional) */ loadNewPage : function(formContent, response, evalResponse) { //alert('here: ' + formContent); var rightHTML = formContent; // Rewrite # links rightHTML = rightHTML.replace(/href *= *"#/g, 'href="' + window.location.href.replace(/#.*$/,'') + '#'); // Rewrite iframe links (for IE) rightHTML = rightHTML.replace(/(