CMSForm = Class.extend('ChangeTracker').extend('Observable'); CMSForm.prototype = { initialize : function(fn) { this.ChangeTracker.initialize(); this.formName = fn; this.prepareForm(); }, /** * Trigger normal save event, helpful e.g. when enter key is pressed in * single line input fields. */ onsubmit: function(e) { this.save(); Event.stop(e); return false; }, /** * 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); // Update the nav items down the bottom if($('SwitchView') && $('AjaxSwitchView')) { $('SwitchView').innerHTML = $('AjaxSwitchView').innerHTML; $('AjaxSwitchView').innerHTML = ''; Behaviour.apply('SwitchView'); // This is needed so calendar still works } }, /** * 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) { // Note: TinyMCE coupling tinymce_removeAll(); this.innerHTML = "
" + ss.i18n._t('LeftAndMain.PAGEWASDELETED') + "
"; } }, /** * 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) { var rightHTML = formContent; // reset the version view history if($('versions_holder')) $('versions_holder').reset(); // Rewrite # links rightHTML = rightHTML.replace(/(]+href *= *")#/g, '$1' + window.location.href.replace(/#.*$/,'') + '#'); // Rewrite iframe links (for IE) rightHTML = rightHTML.replace(/(