silverstripe-cms/javascript/GenericDataAdmin_right.js

115 lines
2.9 KiB
JavaScript
Raw Normal View History

/**
* Loads, views and removes records in the main view.
*/
RightContent = Class.create();
RightContent.applyTo('#Form_EditForm');
RightContent.prototype = {
welcomeMessage: "<h1>SilverStripe CMS</h1><p>Welcome to SilverStripe CMS! Please choose click on one of the items on the left pane.</p>",
initialize : function() {
},
updateCMSContent: function(el, currentTab, link, customCallBack) {
if(!customCallBack) customCallBack = function(){};
if(el || link){
switch externals to trunk. Inform-merge: from the changeset: r32477: Merge 2.0-inform from trunk previously r32478: Merge 2.0-inform from trunk previously r32481: merge 2.0infom with lastes chunk r32483: merge 2.0infom with lastes chunk r33526: Final styling of all forms and combined communication form add/alter javascript for height adjustment of First / Second block r33580: styling for combined form communication in myinfom pages r33706: styling of combined form (communication) in Email r33881: made compatible to $extraClass r33885: added defaultVal r33887: fixed typo r34728: modified SmallFieldHolder?() r34729: added "validationError"-class r34914: WIP3866: Factfinder: Hide "self emplyed" block r34964: Change current plan upto TraumaInsurance? r35038: disabled friggin field focus r35230: #1032 Fixed hash-link insertion r35887: conditionally setting parameters in sourceID() - to avoid empty overrides r35892: Saving value in SQL-compatible format (YYYY-MM-DD instead of DD/MM/YYYY), with fallback for non-sql values (just passed through without conversion) r35928: Removed "create a" from PageType?-dropdown, sorting alphabetically, falling back to $singular_name r35990: branched off for membertablefield r35994: fix for membertablefield r36024: added array-condition needed for DMYDateField r36083: fix bug for compositeField -> dropDatalessField r36394: removed debug code r36826: change wrong indent format r36828: WIP 4262: Logging out of My Inform goes to blank page r36858: Fixed error caused in r12472 while merging to Session-class r37132: Merged partial changesets from branches/2.0-nzct, only adding childID to detailform when not in add-mode r40815: add an unsubscribe record when a member subscribe a newslettertype r41113: fix the bug described in http://support.silverstripe.com/info/ticket/31: CRM not showing search results r43226: fixed search (partial merge from trunk) r43268: merged createNewPassword() from trunk, was referencing a non-existinent global function randomString() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@45473 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-11-23 02:10:19 +01:00
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<tags.length; i++){
var current = tags[i].getElementsByTagName('a')[0];
var match = current.id.match(/tab-(.+)$/);
if(match[0] == tabName) {
return true;
}
}
}
return false;
},
getCurrentTab: function() {
var current;
if($('Root')){
var tags = $('Root').getElementsByTagName('li');
for(var i=0; i<tags.length; i++){
if(Element.hasClassName(tags[0], 'current')){
current = tags[i].getElementsByTagName('a')[0];
}else{
current = tags[0].getElementsByTagName('a')[0]
}
current.id.match(/tab-(.+)$/);
return RegExp.$1;
}
}
},
setTitle: function(title) {
var titleHolder = $$('div#right .title div');
if(titleHolder[0]) {
titleHolder[0].innerHTML = title;
}
}
switch externals to trunk. Inform-merge: from the changeset: r32477: Merge 2.0-inform from trunk previously r32478: Merge 2.0-inform from trunk previously r32481: merge 2.0infom with lastes chunk r32483: merge 2.0infom with lastes chunk r33526: Final styling of all forms and combined communication form add/alter javascript for height adjustment of First / Second block r33580: styling for combined form communication in myinfom pages r33706: styling of combined form (communication) in Email r33881: made compatible to $extraClass r33885: added defaultVal r33887: fixed typo r34728: modified SmallFieldHolder?() r34729: added "validationError"-class r34914: WIP3866: Factfinder: Hide "self emplyed" block r34964: Change current plan upto TraumaInsurance? r35038: disabled friggin field focus r35230: #1032 Fixed hash-link insertion r35887: conditionally setting parameters in sourceID() - to avoid empty overrides r35892: Saving value in SQL-compatible format (YYYY-MM-DD instead of DD/MM/YYYY), with fallback for non-sql values (just passed through without conversion) r35928: Removed "create a" from PageType?-dropdown, sorting alphabetically, falling back to $singular_name r35990: branched off for membertablefield r35994: fix for membertablefield r36024: added array-condition needed for DMYDateField r36083: fix bug for compositeField -> dropDatalessField r36394: removed debug code r36826: change wrong indent format r36828: WIP 4262: Logging out of My Inform goes to blank page r36858: Fixed error caused in r12472 while merging to Session-class r37132: Merged partial changesets from branches/2.0-nzct, only adding childID to detailform when not in add-mode r40815: add an unsubscribe record when a member subscribe a newslettertype r41113: fix the bug described in http://support.silverstripe.com/info/ticket/31: CRM not showing search results r43226: fixed search (partial merge from trunk) r43268: merged createNewPassword() from trunk, was referencing a non-existinent global function randomString() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@45473 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-11-23 02:10:19 +01:00
}
var action_delete_right = function(e) {
$('Form_EditForm').remove(e);
}