diff --git a/javascript/CMSMain.js b/javascript/CMSMain.js
index 4e1793c9..304b0509 100644
--- a/javascript/CMSMain.js
+++ b/javascript/CMSMain.js
@@ -14,108 +14,109 @@ var ss_MainLayout;
$('body.CMSMain').concrete('ss', function($){
return/** @lends ss.CMSMain */{
- /**
- * Reference to jQuery.layout element
- * @type Object
- */
- MainLayout: null,
+ /**
+ * Reference to jQuery.layout element
+ * @type Object
+ */
+ MainLayout: null,
- onmatch: function() {
- var self = this;
+ onmatch: function() {
+ var self = this;
- // Layout
- ss_MainLayout = this._setupLayout();
- this.setMainLayout(ss_MainLayout);
- layoutState.options.keys = "west.size,west.isClosed";
- $(window).unload(function(){ layoutState.save('ss_MainLayout') });
+ // Layout
+ ss_MainLayout = this._setupLayout();
+ this.setMainLayout(ss_MainLayout);
+ layoutState.options.keys = "west.size,west.isClosed";
+ $(window).unload(function(){ layoutState.save('ss_MainLayout');});
- // artificially delay the resize event 200ms
- // to avoid overlapping height changes in different onresize() methods
- $(window).resize(function () {
- var timerID = "timerCMSMainResize";
- if (window[timerID]) clearTimeout(window[timerID]);
- window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
- });
+ // artificially delay the resize event 200ms
+ // to avoid overlapping height changes in different onresize() methods
+ $(window).resize(function () {
+ var timerID = "timerCMSMainResize";
+ if (window[timerID]) clearTimeout(window[timerID]);
+ window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
+ });
- // If tab has no nested tabs, set overflow to auto
- $(this).find('.tab').not(':has(.tab)').css('overflow', 'auto');
+ // If tab has no nested tabs, set overflow to auto
+ $(this).find('.tab').not(':has(.tab)').css('overflow', 'auto');
- this._resizeChildren();
+ this._resizeChildren();
- this._super();
- },
+ this._super();
+ },
- _resizeChildren: function() {
- $("#treepanes", this).accordion("resize");
- $('#sitetree_and_tools', this).fitHeightToParent();
- $('#contentPanel form', this).fitHeightToParent();
- $('#contentPanel form fieldset', this).fitHeightToParent();
- $('#contentPanel form fieldset .content', this).fitHeightToParent();
+ _resizeChildren: function() {
+ $("#treepanes", this).accordion("resize");
+ $('#sitetree_and_tools', this).fitHeightToParent();
+ $('#contentPanel form', this).fitHeightToParent();
+ $('#contentPanel form fieldset', this).fitHeightToParent();
+ $('#contentPanel form fieldset .content', this).fitHeightToParent();
- this._super();
- },
+ this._super();
+ },
- /**
- * Initialize jQuery layout manager with the following panes:
- * - east: Tree, Page Version History, Site Reports
- * - center: Form
- * - west: "Insert Image", "Insert Link", "Insert Flash" panes
- * - north: CMS area menu bar
- * - south: "Page view", "profile" and "logout" links
- */
- _setupLayout: function() {
- var self = this;
+ /**
+ * Initialize jQuery layout manager with the following panes:
+ * - east: Tree, Page Version History, Site Reports
+ * - center: Form
+ * - west: "Insert Image", "Insert Link", "Insert Flash" panes
+ * - north: CMS area menu bar
+ * - south: "Page view", "profile" and "logout" links
+ */
+ _setupLayout: function() {
+ var self = this;
- // layout containing the tree, CMS menu, the main form etc.
- var savedLayoutSettings = layoutState.load('ss_MainLayout');
- var layoutSettings = jQuery.extend({
- defaults: {
- // TODO Reactivate once we have localized values
- togglerTip_open: '',
- togglerTip_closed: '',
- resizerTip: '',
- sliderTip: '',
- onresize: function() {self._resizeChildren();},
- onopen: function() {self._resizeChildren();}
- },
- north: {
- slidable: false,
- resizable: false,
- size: 35,
- togglerLength_open: 0
- },
- south: {
- slidable: false,
- resizable: false,
- size: 23,
- togglerLength_open: 0
- },
- west: {
- size: 225,
- fxName: "none"
- },
- east: {
- initClosed: true,
- // multiple panels which are triggered through tinymce buttons,
- // so a user shouldn't be able to toggle this panel manually
- initHidden: true,
- fxName: "none",
- size: 250
- },
- center: {}
- }, savedLayoutSettings);
- var layout = $('body').layout(layoutSettings);
+ // layout containing the tree, CMS menu, the main form etc.
+ var savedLayoutSettings = layoutState.load('ss_MainLayout');
+ var layoutSettings = jQuery.extend({
+ defaults: {
+ // TODO Reactivate once we have localized values
+ togglerTip_open: '',
+ togglerTip_closed: '',
+ resizerTip: '',
+ sliderTip: '',
+ onresize: function() {self._resizeChildren();},
+ onopen: function() {self._resizeChildren();}
+ },
+ north: {
+ slidable: false,
+ resizable: false,
+ size: 35,
+ togglerLength_open: 0
+ },
+ south: {
+ slidable: false,
+ resizable: false,
+ size: 23,
+ togglerLength_open: 0
+ },
+ west: {
+ size: 225,
+ fxName: "none"
+ },
+ east: {
+ initClosed: true,
+ // multiple panels which are triggered through tinymce buttons,
+ // so a user shouldn't be able to toggle this panel manually
+ initHidden: true,
+ fxName: "none",
+ size: 250
+ },
+ center: {}
+ }, savedLayoutSettings);
+ var layout = $('body').layout(layoutSettings);
- // Adjust tree accordion etc. in left panel to work correctly
- // with jQuery.layout (see http://layout.jquery-dev.net/tips.html#Widget_Accordion)
- this.find("#treepanes").accordion({
- fillSpace: true,
- animated: false
- });
+ // Adjust tree accordion etc. in left panel to work correctly
+ // with jQuery.layout (see http://layout.jquery-dev.net/tips.html#Widget_Accordion)
+ this.find("#treepanes").accordion({
+ fillSpace: true,
+ animated: false
+ });
- return layout;
- }
- }});
+ return layout;
+ }
+ };
+ });
/**
* @class CMS-specific form behaviour
@@ -123,18 +124,17 @@ var ss_MainLayout;
*/
$('#Form_EditForm').concrete('ss', function($){
return/** @lends ss.EditForm */{
- onmatch: function() {
- // Alert the user on change of page-type - this might have implications
- // on the available form fields etc.
- this.find(':input[name=ClassName]').bind('change',
- function() {
- alert('The page type will be updated after the page is saved');
- }
- );
-
- this.find(':input[name=ParentID]')
- }
- }});
+ onmatch: function() {
+ // Alert the user on change of page-type - this might have implications
+ // on the available form fields etc.
+ this.find(':input[name=ClassName]').bind('change',
+ function() {
+ alert('The page type will be updated after the page is saved');
+ }
+ );
+ }
+ };
+ });
/**
* @class ParentID field combination - mostly toggling between
@@ -143,32 +143,33 @@ var ss_MainLayout;
*/
$('#Form_EditForm_ParentType').concrete('ss', function($){
return/** @lends ss.EditForm.ParentType */{
- onmatch : function() {
- var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
- var parentTypeSubpageEl = $('#Form_EditForm_ParentType_subpage');
- if(parentTypeRootEl) {
- parentTypeRootEl.onclick = this._rootClick.bind(this);
- }
- if(parentTypeSubpageEl) {
- parentTypeSubpageEl.onclick = this.showHide;
- }
- this.showHide();
- },
+ onmatch : function() {
+ var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
+ var parentTypeSubpageEl = $('#Form_EditForm_ParentType_subpage');
+ if(parentTypeRootEl) {
+ parentTypeRootEl.onclick = this._rootClick.bind(this);
+ }
+ if(parentTypeSubpageEl) {
+ parentTypeSubpageEl.onclick = this.showHide;
+ }
+ this.showHide();
+ },
- _rootClick : function() {
- $('#Form_EditForm_ParentID').val(0);
- this.showHide();
- },
+ _rootClick : function() {
+ $('#Form_EditForm_ParentID').val(0);
+ this.showHide();
+ },
- showHide : function() {
- var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
- if(parentTypeRootEl && parentTypeRootEl.checked) {
- $('#ParentID').hide();
- } else {
- $('#ParentID').show();
+ showHide : function() {
+ var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
+ if(parentTypeRootEl && parentTypeRootEl.checked) {
+ $('#ParentID').hide();
+ } else {
+ $('#ParentID').show();
+ }
}
- }
- }});
+ };
+ });
/**
* @class Toggle display of group dropdown in "access" tab,
@@ -191,7 +192,7 @@ var ss_MainLayout;
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
dropdown.toggle(currentVal == 'OnlyTheseUsers');
}
- }
+ };
});
/**
@@ -201,18 +202,19 @@ var ss_MainLayout;
*/
$('#Form_EditForm .Actions #Form_EditForm_action_email').concrete('ss', function($){
return/** @lends ss.Form_EditForm_action_email */{
- onclick: function(e) {
- window.open(
- 'mailto:?subject='
- + $('input[name=ArchiveEmailSubject]', this[0].form).val()
- + '&body='
- + $(':input[name=ArchiveEmailMessage]', this[0].form).val(),
- 'archiveemail'
- );
+ onclick: function(e) {
+ window.open(
+ 'mailto:?subject='
+ + $('input[name=ArchiveEmailSubject]', this[0].form).val()
+ + '&body='
+ + $(':input[name=ArchiveEmailMessage]', this[0].form).val(),
+ 'archiveemail'
+ );
- return false;
- }
- }});
+ return false;
+ }
+ };
+ });
/**
* @class Open a printable representation of the form in a new window.
@@ -221,17 +223,18 @@ var ss_MainLayout;
*/
$('#Form_EditForm .Actions #Form_EditForm_action_print').concrete('ss', function($){
return/** @lends ss.Form_EditForm_action_print */{
- onclick: function(e) {
- var printURL = $(this[0].form).attr('action').replace(/\?.*$/,'')
- + '/printable/'
- + $(':input[name=ID]',this[0].form).val();
- if(printURL.substr(0,7) != 'http://') printURL = $('base').attr('href') + printURL;
+ onclick: function(e) {
+ var printURL = $(this[0].form).attr('action').replace(/\?.*$/,'')
+ + '/printable/'
+ + $(':input[name=ID]',this[0].form).val();
+ if(printURL.substr(0,7) != 'http://') printURL = $('base').attr('href') + printURL;
- window.open(printURL, 'printable');
+ window.open(printURL, 'printable');
- return false;
- }
- }});
+ return false;
+ }
+ };
+ });
/**
* @class A "rollback" to a specific version needs user confirmation.
@@ -239,11 +242,12 @@ var ss_MainLayout;
*/
$('#Form_EditForm .Actions #Form_EditForm_action_rollback').concrete('ss', function($){
return/** @lends ss.Form_EditForm_action_rollback */{
- onclick: function(e) {
- // @todo i18n
- return confirm("Do you really want to copy the published content to the stage site?");
- }
- }});
+ onclick: function(e) {
+ // @todo i18n
+ return confirm("Do you really want to copy the published content to the stage site?");
+ }
+ };
+ });
/**
* @class All forms in the right content panel should have closeable jQuery UI style titles.
@@ -251,19 +255,20 @@ var ss_MainLayout;
*/
$('#contentPanel form').concrete('ss', function($){
return/** @lends ss.contentPanel.form */{
- onmatch: function() {
- // Style as title bar
- this.find(':header:first').titlebar({
- closeButton:true
- });
- // The close button should close the east panel of the layout
- this.find(':header:first .ui-dialog-titlebar-close').bind('click', function(e) {
- $('body.CMSMain').concrete('ss').MainLayout().close('east');
+ onmatch: function() {
+ // Style as title bar
+ this.find(':header:first').titlebar({
+ closeButton:true
+ });
+ // The close button should close the east panel of the layout
+ this.find(':header:first .ui-dialog-titlebar-close').bind('click', function(e) {
+ $('body.CMSMain').concrete('ss').MainLayout().close('east');
- return false;
- });
- }
- }});
+ return false;
+ });
+ }
+ };
+ });
/**
* @class Control the site tree filter.
@@ -274,127 +279,127 @@ var ss_MainLayout;
$('#Form_SearchTreeForm').concrete('ss', function($) {
return/** @lends ss.Form_SeachTreeForm */{
- /**
- * @type DOMElement
- */
- SelectEl: null,
+ /**
+ * @type DOMElement
+ */
+ SelectEl: null,
- onmatch: function() {
- var self = this;
+ onmatch: function() {
+ var self = this;
- // TODO Cant bind to onsubmit/onreset directly because of IE6
- this.bind('submit', function(e) {return self._submitForm(e);});
- this.bind('reset', function(e) {return self._resetForm(e);});
+ // TODO Cant bind to onsubmit/onreset directly because of IE6
+ this.bind('submit', function(e) {return self._submitForm(e);});
+ this.bind('reset', function(e) {return self._resetForm(e);});
- // only the first field should be visible by default
- this.find('.field').not(':first').hide();
+ // only the first field should be visible by default
+ this.find('.field').not(':first').hide();
- // generate the field dropdown
- this.setSelectEl($('')
- .appendTo(this.find('fieldset:first'))
- .bind('change', function(e) {self._addField(e);})
- );
+ // generate the field dropdown
+ this.setSelectEl($('')
+ .appendTo(this.find('fieldset:first'))
+ .bind('change', function(e) {self._addField(e);})
+ );
- this._setOptions();
+ this._setOptions();
- },
+ },
- _setOptions: function() {
- var self = this;
+ _setOptions: function() {
+ var self = this;
- // reset existing elements
- self.SelectEl().find('option').remove();
+ // reset existing elements
+ self.SelectEl().find('option').remove();
- // add default option
- // TODO i18n
- jQuery('').appendTo(self.SelectEl())
+ // add default option
+ // TODO i18n
+ jQuery('').appendTo(self.SelectEl());
- // populate dropdown values from existing fields
- this.find('.field').each(function() {
- $('').appendTo(self.SelectEl())
- .val(this.id)
- .text($(this).find('label').text());
- });
- },
+ // populate dropdown values from existing fields
+ this.find('.field').each(function() {
+ $('').appendTo(self.SelectEl())
+ .val(this.id)
+ .text($(this).find('label').text());
+ });
+ },
- /**
- * Filter tree based on selected criteria.
- */
- _submitForm: function(e) {
- var self = this;
- var data = [];
+ /**
+ * Filter tree based on selected criteria.
+ */
+ _submitForm: function(e) {
+ var self = this;
+ var data = [];
- // convert from jQuery object literals to hash map
- $(this.serializeArray()).each(function(i, el) {
- data[el.name] = el.value;
- });
+ // convert from jQuery object literals to hash map
+ $(this.serializeArray()).each(function(i, el) {
+ data[el.name] = el.value;
+ });
- // Set new URL
- $('#sitetree')[0].setCustomURL(this.attr('action') + '&action_getfilteredsubtree=1', data);
+ // Set new URL
+ $('#sitetree')[0].setCustomURL(this.attr('action') + '&action_getfilteredsubtree=1', data);
- // Disable checkbox tree controls that currently don't work with search.
- // @todo: Make them work together
- if ($('#sitetree')[0].isDraggable) $('#sitetree')[0].stopBeingDraggable();
- this.find('.checkboxAboveTree :checkbox').val(false).attr('disabled', true);
+ // Disable checkbox tree controls that currently don't work with search.
+ // @todo: Make them work together
+ if ($('#sitetree')[0].isDraggable) $('#sitetree')[0].stopBeingDraggable();
+ this.find('.checkboxAboveTree :checkbox').val(false).attr('disabled', true);
- // disable buttons to avoid multiple submission
- //this.find(':submit').attr('disabled', true);
+ // disable buttons to avoid multiple submission
+ //this.find(':submit').attr('disabled', true);
- this.find(':submit[name=action_getfilteredsubtree]').addClass('loading');
+ this.find(':submit[name=action_getfilteredsubtree]').addClass('loading');
- this._reloadSitetree();
+ this._reloadSitetree();
- return false;
- },
+ return false;
+ },
- _resetForm: function(e) {
- this.find('.field').clearFields().not(':first').hide();
+ _resetForm: function(e) {
+ this.find('.field').clearFields().not(':first').hide();
- // Reset URL to default
- $('#sitetree')[0].clearCustomURL();
+ // Reset URL to default
+ $('#sitetree')[0].clearCustomURL();
- // Enable checkbox tree controls
- this.find('.checkboxAboveTree :checkbox').attr('disabled', 'false');
+ // Enable checkbox tree controls
+ this.find('.checkboxAboveTree :checkbox').attr('disabled', 'false');
- // reset all options, some of the might be removed
- this._setOptions();
+ // reset all options, some of the might be removed
+ this._setOptions();
- this._reloadSitetree();
+ this._reloadSitetree();
- return false;
- },
+ return false;
+ },
- _addField: function(e) {
- var $select = $(e.target);
- // show formfield matching the option
- this.find('#' + $select.val()).show();
+ _addField: function(e) {
+ var $select = $(e.target);
+ // show formfield matching the option
+ this.find('#' + $select.val()).show();
- // remove option from dropdown, each field should just exist once
- this.find('option[value=' + $select.val() + ']').remove();
+ // remove option from dropdown, each field should just exist once
+ this.find('option[value=' + $select.val() + ']').remove();
- // jump back to default entry
- $select.val(0);
+ // jump back to default entry
+ $select.val(0);
- return false;
- },
+ return false;
+ },
- _reloadSitetree: function() {
- var self = this;
+ _reloadSitetree: function() {
+ var self = this;
- $('#sitetree')[0].reload({
- onSuccess : function(response) {
- self.find(':submit').attr('disabled', false).removeClass('loading');
- self.find('.checkboxAboveTree :checkbox').attr('disabled', 'true');
- statusMessage('Filtered tree','good');
- },
- onFailure : function(response) {
- self.find(':submit').attr('disabled', false).removeClass('loading');
- self.find('.checkboxAboveTree :checkbox').attr('disabled', 'true');
- errorMessage('Could not filter site tree
' + response.responseText);
- }
- });
- }
- }});
-
+ $('#sitetree')[0].reload({
+ onSuccess : function(response) {
+ self.find(':submit').attr('disabled', false).removeClass('loading');
+ self.find('.checkboxAboveTree :checkbox').attr('disabled', 'true');
+ statusMessage('Filtered tree','good');
+ },
+ onFailure : function(response) {
+ self.find(':submit').attr('disabled', false).removeClass('loading');
+ self.find('.checkboxAboveTree :checkbox').attr('disabled', 'true');
+ errorMessage('Could not filter site tree
' + response.responseText);
+ }
+ });
+ }
+ };
+ });
})(jQuery);
\ No newline at end of file
diff --git a/javascript/LeftAndMain.EditForm.js b/javascript/LeftAndMain.EditForm.js
index 7daff135..a085a32a 100644
--- a/javascript/LeftAndMain.EditForm.js
+++ b/javascript/LeftAndMain.EditForm.js
@@ -9,158 +9,159 @@
$('#Form_EditForm').concrete('ss',function($){
return/** @lends ss.Form_EditForm */{
- /**
- * @type String HTML text to show when the form has been deleted.
- */
- RemoveHtml: null,
+ /**
+ * @type String HTML text to show when the form has been deleted.
+ */
+ RemoveHtml: null,
- /**
- * Suppress submission unless it is handled through ajaxSubmit()
- */
- onsubmit: function(e) {
- return false;
- },
-
- /**
- * @param {DOMElement} button The pressed button (optional)
- */
- ajaxSubmit: function(button) {
- // default to first button if none given - simulates browser behaviour
- if(!button) button = this.find(':submit:first');
-
- var self = this;
-
- this.trigger('ajaxsubmit', {button: button});
-
- // set button to "submitting" state
- $(button).addClass('loading');
-
- // @todo TinyMCE coupling
- if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
-
- // validate if required
- if(!this.validate()) {
- // TODO Automatically switch to the tab/position of the first error
- statusMessage("Validation failed.", "bad");
-
- $(button).removeClass('loading');
-
+ /**
+ * Suppress submission unless it is handled through ajaxSubmit()
+ */
+ onsubmit: function(e) {
return false;
- }
+ },
+
+ /**
+ * @param {DOMElement} button The pressed button (optional)
+ */
+ ajaxSubmit: function(button) {
+ // default to first button if none given - simulates browser behaviour
+ if(!button) button = this.find(':submit:first');
+
+ var self = this;
+
+ this.trigger('ajaxsubmit', {button: button});
+
+ // set button to "submitting" state
+ $(button).addClass('loading');
+
+ // @todo TinyMCE coupling
+ if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
+
+ // validate if required
+ if(!this.validate()) {
+ // TODO Automatically switch to the tab/position of the first error
+ statusMessage("Validation failed.", "bad");
- // get all data from the form
- var data = this.serializeArray();
- // add button action
- data.push({name: $(button).attr('name'), value:'1'});
- $.post(
- this.attr('action'),
- data,
- function(response) {
$(button).removeClass('loading');
-
- self._loadResponse(response);
- },
- // @todo Currently all responses are assumed to be evaluated
- 'script'
- );
-
- return false;
- },
-
- /**
- * Hook in (optional) validation routines.
- * Currently clientside validation is not supported out of the box in the CMS.
- *
- * @todo Placeholder implementation
- *
- * @return {boolean}
- */
- validate: function() {
- var isValid = true;
- this.trigger('validate', {isValid: isValid});
-
- return isValid;
- },
-
- /**
- * @param String url
- * @param Function callback (Optional)
- */
- load: function(url, callback) {
- var self = this;
- $.get(
- url,
- function(response) {
- self._loadResponse(response);
- if(callback) callback.apply(self, [response]);
- },
- // @todo Currently all responses are assumed to be evaluated
- 'script'
- );
- },
-
- /**
- * Remove everying inside the