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); }, /** * 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) { //alert('here: ' + formContent); var rightHTML = formContent; // Rewrite # links rightHTML = rightHTML.replace(/(]+href *= *")#/g, '$1' + window.location.href.replace(/#.*$/,'') + '#'); // Rewrite iframe links (for IE) rightHTML = rightHTML.replace(/(]*src=")([^"]+)("[^>]*>)/g, '$1' + baseHref() + '$2$3'); // Note: TinyMCE coupling tinymce_removeAll(); // Prepare iframes for removal, otherwise we get loading bugs var i, allIframes = this.getElementsByTagName('iframe'); if(allIframes) for(i=0;i