/** * Loads, views and removes records in the main view. */ RightContent = Class.create(); RightContent.applyTo('#Form_EditForm'); RightContent.prototype = { welcomeMessage: "
Welcome to SilverStripe CMS! Please choose click on one of the items on the left pane.
", initialize : function() { }, updateCMSContent: function(el, currentTab, link, customCallBack) { if(!customCallBack) customCallBack = function(){}; if(el || link){ var reqLink = (el && el.href) ? el.href : link; if(typeof(currentTab) != 'undefined') $('Form_EditForm').openTab = currentTab; statusMessage("loading...", null, true); new Ajax.Request(reqLink, { asynchronous : true, postBody : 'ajax=1', onSuccess: customCallBack.bind(this), onComplete : this.successfullyReceivedPage.bind(this), onFailure : function(response) { errorMessage('Error loading page',response); } }); }else{ $('Form_EditForm').innerHTML = this.welcomeMessage; } }, successfullyReceivedPage : function(response) { $('Form_EditForm').loadNewPage(response.responseText); $('Form_EditForm').initialize(); onload_init_tabstrip(); // TODO // try to reopen saved tab (before ajax request) if($('Form_EditForm').openTab) { openTab($('Form_EditForm').openTab); } else { $('Form_EditForm').openTab = this.getCurrentTab(); openTab($('Form_EditForm').openTab); } clearStatusMessage(); }, remove: function(e) { if(window.confirm('Are you sure you want to delete?')){ var el = Event.element(e); Ajax.SubmitForm($('Form_EditForm'), el.name, { postBody : 'ajax=1', onSuccess: Ajax.Evaluator, onFailure: ajaxErrorHandler }); } Event.stop(e); return false; }, deleteEffect: function() { new Effect.Fade(this, {duration:2}); window.setTimeout(function() { $('Form_EditForm').updateCMSContent(); new Effect.Appear($('Form_EditForm'), {duration:3}); }, 3000); }, tabExists: function(tabName) { if($('Root')){ var tags = $('Root').getElementsByTagName('li'); for(var i=0; i