mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR JavaScript code indentation and formatting
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92656 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bb6f4a9200
commit
4809523bae
@ -14,108 +14,109 @@ var ss_MainLayout;
|
|||||||
$('body.CMSMain').concrete('ss', function($){
|
$('body.CMSMain').concrete('ss', function($){
|
||||||
return/** @lends ss.CMSMain */{
|
return/** @lends ss.CMSMain */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to jQuery.layout element
|
* Reference to jQuery.layout element
|
||||||
* @type Object
|
* @type Object
|
||||||
*/
|
*/
|
||||||
MainLayout: null,
|
MainLayout: null,
|
||||||
|
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
ss_MainLayout = this._setupLayout();
|
ss_MainLayout = this._setupLayout();
|
||||||
this.setMainLayout(ss_MainLayout);
|
this.setMainLayout(ss_MainLayout);
|
||||||
layoutState.options.keys = "west.size,west.isClosed";
|
layoutState.options.keys = "west.size,west.isClosed";
|
||||||
$(window).unload(function(){ layoutState.save('ss_MainLayout') });
|
$(window).unload(function(){ layoutState.save('ss_MainLayout');});
|
||||||
|
|
||||||
// artificially delay the resize event 200ms
|
// artificially delay the resize event 200ms
|
||||||
// to avoid overlapping height changes in different onresize() methods
|
// to avoid overlapping height changes in different onresize() methods
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
var timerID = "timerCMSMainResize";
|
var timerID = "timerCMSMainResize";
|
||||||
if (window[timerID]) clearTimeout(window[timerID]);
|
if (window[timerID]) clearTimeout(window[timerID]);
|
||||||
window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
|
window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
// If tab has no nested tabs, set overflow to auto
|
// If tab has no nested tabs, set overflow to auto
|
||||||
$(this).find('.tab').not(':has(.tab)').css('overflow', 'auto');
|
$(this).find('.tab').not(':has(.tab)').css('overflow', 'auto');
|
||||||
|
|
||||||
this._resizeChildren();
|
this._resizeChildren();
|
||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
},
|
},
|
||||||
|
|
||||||
_resizeChildren: function() {
|
_resizeChildren: function() {
|
||||||
$("#treepanes", this).accordion("resize");
|
$("#treepanes", this).accordion("resize");
|
||||||
$('#sitetree_and_tools', this).fitHeightToParent();
|
$('#sitetree_and_tools', this).fitHeightToParent();
|
||||||
$('#contentPanel form', this).fitHeightToParent();
|
$('#contentPanel form', this).fitHeightToParent();
|
||||||
$('#contentPanel form fieldset', this).fitHeightToParent();
|
$('#contentPanel form fieldset', this).fitHeightToParent();
|
||||||
$('#contentPanel form fieldset .content', this).fitHeightToParent();
|
$('#contentPanel form fieldset .content', this).fitHeightToParent();
|
||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize jQuery layout manager with the following panes:
|
* Initialize jQuery layout manager with the following panes:
|
||||||
* - east: Tree, Page Version History, Site Reports
|
* - east: Tree, Page Version History, Site Reports
|
||||||
* - center: Form
|
* - center: Form
|
||||||
* - west: "Insert Image", "Insert Link", "Insert Flash" panes
|
* - west: "Insert Image", "Insert Link", "Insert Flash" panes
|
||||||
* - north: CMS area menu bar
|
* - north: CMS area menu bar
|
||||||
* - south: "Page view", "profile" and "logout" links
|
* - south: "Page view", "profile" and "logout" links
|
||||||
*/
|
*/
|
||||||
_setupLayout: function() {
|
_setupLayout: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// layout containing the tree, CMS menu, the main form etc.
|
// layout containing the tree, CMS menu, the main form etc.
|
||||||
var savedLayoutSettings = layoutState.load('ss_MainLayout');
|
var savedLayoutSettings = layoutState.load('ss_MainLayout');
|
||||||
var layoutSettings = jQuery.extend({
|
var layoutSettings = jQuery.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
// TODO Reactivate once we have localized values
|
// TODO Reactivate once we have localized values
|
||||||
togglerTip_open: '',
|
togglerTip_open: '',
|
||||||
togglerTip_closed: '',
|
togglerTip_closed: '',
|
||||||
resizerTip: '',
|
resizerTip: '',
|
||||||
sliderTip: '',
|
sliderTip: '',
|
||||||
onresize: function() {self._resizeChildren();},
|
onresize: function() {self._resizeChildren();},
|
||||||
onopen: function() {self._resizeChildren();}
|
onopen: function() {self._resizeChildren();}
|
||||||
},
|
},
|
||||||
north: {
|
north: {
|
||||||
slidable: false,
|
slidable: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
size: 35,
|
size: 35,
|
||||||
togglerLength_open: 0
|
togglerLength_open: 0
|
||||||
},
|
},
|
||||||
south: {
|
south: {
|
||||||
slidable: false,
|
slidable: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
size: 23,
|
size: 23,
|
||||||
togglerLength_open: 0
|
togglerLength_open: 0
|
||||||
},
|
},
|
||||||
west: {
|
west: {
|
||||||
size: 225,
|
size: 225,
|
||||||
fxName: "none"
|
fxName: "none"
|
||||||
},
|
},
|
||||||
east: {
|
east: {
|
||||||
initClosed: true,
|
initClosed: true,
|
||||||
// multiple panels which are triggered through tinymce buttons,
|
// multiple panels which are triggered through tinymce buttons,
|
||||||
// so a user shouldn't be able to toggle this panel manually
|
// so a user shouldn't be able to toggle this panel manually
|
||||||
initHidden: true,
|
initHidden: true,
|
||||||
fxName: "none",
|
fxName: "none",
|
||||||
size: 250
|
size: 250
|
||||||
},
|
},
|
||||||
center: {}
|
center: {}
|
||||||
}, savedLayoutSettings);
|
}, savedLayoutSettings);
|
||||||
var layout = $('body').layout(layoutSettings);
|
var layout = $('body').layout(layoutSettings);
|
||||||
|
|
||||||
// Adjust tree accordion etc. in left panel to work correctly
|
// Adjust tree accordion etc. in left panel to work correctly
|
||||||
// with jQuery.layout (see http://layout.jquery-dev.net/tips.html#Widget_Accordion)
|
// with jQuery.layout (see http://layout.jquery-dev.net/tips.html#Widget_Accordion)
|
||||||
this.find("#treepanes").accordion({
|
this.find("#treepanes").accordion({
|
||||||
fillSpace: true,
|
fillSpace: true,
|
||||||
animated: false
|
animated: false
|
||||||
});
|
});
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
}});
|
};
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CMS-specific form behaviour
|
* @class CMS-specific form behaviour
|
||||||
@ -123,18 +124,17 @@ var ss_MainLayout;
|
|||||||
*/
|
*/
|
||||||
$('#Form_EditForm').concrete('ss', function($){
|
$('#Form_EditForm').concrete('ss', function($){
|
||||||
return/** @lends ss.EditForm */{
|
return/** @lends ss.EditForm */{
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
// Alert the user on change of page-type - this might have implications
|
// Alert the user on change of page-type - this might have implications
|
||||||
// on the available form fields etc.
|
// on the available form fields etc.
|
||||||
this.find(':input[name=ClassName]').bind('change',
|
this.find(':input[name=ClassName]').bind('change',
|
||||||
function() {
|
function() {
|
||||||
alert('The page type will be updated after the page is saved');
|
alert('The page type will be updated after the page is saved');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
this.find(':input[name=ParentID]')
|
};
|
||||||
}
|
});
|
||||||
}});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ParentID field combination - mostly toggling between
|
* @class ParentID field combination - mostly toggling between
|
||||||
@ -143,32 +143,33 @@ var ss_MainLayout;
|
|||||||
*/
|
*/
|
||||||
$('#Form_EditForm_ParentType').concrete('ss', function($){
|
$('#Form_EditForm_ParentType').concrete('ss', function($){
|
||||||
return/** @lends ss.EditForm.ParentType */{
|
return/** @lends ss.EditForm.ParentType */{
|
||||||
onmatch : function() {
|
onmatch : function() {
|
||||||
var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
|
var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
|
||||||
var parentTypeSubpageEl = $('#Form_EditForm_ParentType_subpage');
|
var parentTypeSubpageEl = $('#Form_EditForm_ParentType_subpage');
|
||||||
if(parentTypeRootEl) {
|
if(parentTypeRootEl) {
|
||||||
parentTypeRootEl.onclick = this._rootClick.bind(this);
|
parentTypeRootEl.onclick = this._rootClick.bind(this);
|
||||||
}
|
}
|
||||||
if(parentTypeSubpageEl) {
|
if(parentTypeSubpageEl) {
|
||||||
parentTypeSubpageEl.onclick = this.showHide;
|
parentTypeSubpageEl.onclick = this.showHide;
|
||||||
}
|
}
|
||||||
this.showHide();
|
this.showHide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_rootClick : function() {
|
_rootClick : function() {
|
||||||
$('#Form_EditForm_ParentID').val(0);
|
$('#Form_EditForm_ParentID').val(0);
|
||||||
this.showHide();
|
this.showHide();
|
||||||
},
|
},
|
||||||
|
|
||||||
showHide : function() {
|
showHide : function() {
|
||||||
var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
|
var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
|
||||||
if(parentTypeRootEl && parentTypeRootEl.checked) {
|
if(parentTypeRootEl && parentTypeRootEl.checked) {
|
||||||
$('#ParentID').hide();
|
$('#ParentID').hide();
|
||||||
} else {
|
} else {
|
||||||
$('#ParentID').show();
|
$('#ParentID').show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Toggle display of group dropdown in "access" tab,
|
* @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();
|
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
|
||||||
dropdown.toggle(currentVal == 'OnlyTheseUsers');
|
dropdown.toggle(currentVal == 'OnlyTheseUsers');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,18 +202,19 @@ var ss_MainLayout;
|
|||||||
*/
|
*/
|
||||||
$('#Form_EditForm .Actions #Form_EditForm_action_email').concrete('ss', function($){
|
$('#Form_EditForm .Actions #Form_EditForm_action_email').concrete('ss', function($){
|
||||||
return/** @lends ss.Form_EditForm_action_email */{
|
return/** @lends ss.Form_EditForm_action_email */{
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
window.open(
|
window.open(
|
||||||
'mailto:?subject='
|
'mailto:?subject='
|
||||||
+ $('input[name=ArchiveEmailSubject]', this[0].form).val()
|
+ $('input[name=ArchiveEmailSubject]', this[0].form).val()
|
||||||
+ '&body='
|
+ '&body='
|
||||||
+ $(':input[name=ArchiveEmailMessage]', this[0].form).val(),
|
+ $(':input[name=ArchiveEmailMessage]', this[0].form).val(),
|
||||||
'archiveemail'
|
'archiveemail'
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}});
|
};
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Open a printable representation of the form in a new window.
|
* @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($){
|
$('#Form_EditForm .Actions #Form_EditForm_action_print').concrete('ss', function($){
|
||||||
return/** @lends ss.Form_EditForm_action_print */{
|
return/** @lends ss.Form_EditForm_action_print */{
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
var printURL = $(this[0].form).attr('action').replace(/\?.*$/,'')
|
var printURL = $(this[0].form).attr('action').replace(/\?.*$/,'')
|
||||||
+ '/printable/'
|
+ '/printable/'
|
||||||
+ $(':input[name=ID]',this[0].form).val();
|
+ $(':input[name=ID]',this[0].form).val();
|
||||||
if(printURL.substr(0,7) != 'http://') printURL = $('base').attr('href') + printURL;
|
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.
|
* @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($){
|
$('#Form_EditForm .Actions #Form_EditForm_action_rollback').concrete('ss', function($){
|
||||||
return/** @lends ss.Form_EditForm_action_rollback */{
|
return/** @lends ss.Form_EditForm_action_rollback */{
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
// @todo i18n
|
// @todo i18n
|
||||||
return confirm("Do you really want to copy the published content to the stage site?");
|
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.
|
* @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($){
|
$('#contentPanel form').concrete('ss', function($){
|
||||||
return/** @lends ss.contentPanel.form */{
|
return/** @lends ss.contentPanel.form */{
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
// Style as title bar
|
// Style as title bar
|
||||||
this.find(':header:first').titlebar({
|
this.find(':header:first').titlebar({
|
||||||
closeButton:true
|
closeButton:true
|
||||||
});
|
});
|
||||||
// The close button should close the east panel of the layout
|
// The close button should close the east panel of the layout
|
||||||
this.find(':header:first .ui-dialog-titlebar-close').bind('click', function(e) {
|
this.find(':header:first .ui-dialog-titlebar-close').bind('click', function(e) {
|
||||||
$('body.CMSMain').concrete('ss').MainLayout().close('east');
|
$('body.CMSMain').concrete('ss').MainLayout().close('east');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}});
|
};
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Control the site tree filter.
|
* @class Control the site tree filter.
|
||||||
@ -274,127 +279,127 @@ var ss_MainLayout;
|
|||||||
$('#Form_SearchTreeForm').concrete('ss', function($) {
|
$('#Form_SearchTreeForm').concrete('ss', function($) {
|
||||||
return/** @lends ss.Form_SeachTreeForm */{
|
return/** @lends ss.Form_SeachTreeForm */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
*/
|
*/
|
||||||
SelectEl: null,
|
SelectEl: null,
|
||||||
|
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// TODO Cant bind to onsubmit/onreset directly because of IE6
|
// TODO Cant bind to onsubmit/onreset directly because of IE6
|
||||||
this.bind('submit', function(e) {return self._submitForm(e);});
|
this.bind('submit', function(e) {return self._submitForm(e);});
|
||||||
this.bind('reset', function(e) {return self._resetForm(e);});
|
this.bind('reset', function(e) {return self._resetForm(e);});
|
||||||
|
|
||||||
// only the first field should be visible by default
|
// only the first field should be visible by default
|
||||||
this.find('.field').not(':first').hide();
|
this.find('.field').not(':first').hide();
|
||||||
|
|
||||||
// generate the field dropdown
|
// generate the field dropdown
|
||||||
this.setSelectEl($('<select name="options" class="options"></select>')
|
this.setSelectEl($('<select name="options" class="options"></select>')
|
||||||
.appendTo(this.find('fieldset:first'))
|
.appendTo(this.find('fieldset:first'))
|
||||||
.bind('change', function(e) {self._addField(e);})
|
.bind('change', function(e) {self._addField(e);})
|
||||||
);
|
);
|
||||||
|
|
||||||
this._setOptions();
|
this._setOptions();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_setOptions: function() {
|
_setOptions: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// reset existing elements
|
// reset existing elements
|
||||||
self.SelectEl().find('option').remove();
|
self.SelectEl().find('option').remove();
|
||||||
|
|
||||||
// add default option
|
// add default option
|
||||||
// TODO i18n
|
// TODO i18n
|
||||||
jQuery('<option value="0">Add Criteria</option>').appendTo(self.SelectEl())
|
jQuery('<option value="0">Add Criteria</option>').appendTo(self.SelectEl());
|
||||||
|
|
||||||
// populate dropdown values from existing fields
|
// populate dropdown values from existing fields
|
||||||
this.find('.field').each(function() {
|
this.find('.field').each(function() {
|
||||||
$('<option />').appendTo(self.SelectEl())
|
$('<option />').appendTo(self.SelectEl())
|
||||||
.val(this.id)
|
.val(this.id)
|
||||||
.text($(this).find('label').text());
|
.text($(this).find('label').text());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter tree based on selected criteria.
|
* Filter tree based on selected criteria.
|
||||||
*/
|
*/
|
||||||
_submitForm: function(e) {
|
_submitForm: function(e) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var data = [];
|
var data = [];
|
||||||
|
|
||||||
// convert from jQuery object literals to hash map
|
// convert from jQuery object literals to hash map
|
||||||
$(this.serializeArray()).each(function(i, el) {
|
$(this.serializeArray()).each(function(i, el) {
|
||||||
data[el.name] = el.value;
|
data[el.name] = el.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set new URL
|
// Set new URL
|
||||||
$('#sitetree')[0].setCustomURL(this.attr('action') + '&action_getfilteredsubtree=1', data);
|
$('#sitetree')[0].setCustomURL(this.attr('action') + '&action_getfilteredsubtree=1', data);
|
||||||
|
|
||||||
// Disable checkbox tree controls that currently don't work with search.
|
// Disable checkbox tree controls that currently don't work with search.
|
||||||
// @todo: Make them work together
|
// @todo: Make them work together
|
||||||
if ($('#sitetree')[0].isDraggable) $('#sitetree')[0].stopBeingDraggable();
|
if ($('#sitetree')[0].isDraggable) $('#sitetree')[0].stopBeingDraggable();
|
||||||
this.find('.checkboxAboveTree :checkbox').val(false).attr('disabled', true);
|
this.find('.checkboxAboveTree :checkbox').val(false).attr('disabled', true);
|
||||||
|
|
||||||
// disable buttons to avoid multiple submission
|
// disable buttons to avoid multiple submission
|
||||||
//this.find(':submit').attr('disabled', true);
|
//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) {
|
_resetForm: function(e) {
|
||||||
this.find('.field').clearFields().not(':first').hide();
|
this.find('.field').clearFields().not(':first').hide();
|
||||||
|
|
||||||
// Reset URL to default
|
// Reset URL to default
|
||||||
$('#sitetree')[0].clearCustomURL();
|
$('#sitetree')[0].clearCustomURL();
|
||||||
|
|
||||||
// Enable checkbox tree controls
|
// Enable checkbox tree controls
|
||||||
this.find('.checkboxAboveTree :checkbox').attr('disabled', 'false');
|
this.find('.checkboxAboveTree :checkbox').attr('disabled', 'false');
|
||||||
|
|
||||||
// reset all options, some of the might be removed
|
// reset all options, some of the might be removed
|
||||||
this._setOptions();
|
this._setOptions();
|
||||||
|
|
||||||
this._reloadSitetree();
|
this._reloadSitetree();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addField: function(e) {
|
_addField: function(e) {
|
||||||
var $select = $(e.target);
|
var $select = $(e.target);
|
||||||
// show formfield matching the option
|
// show formfield matching the option
|
||||||
this.find('#' + $select.val()).show();
|
this.find('#' + $select.val()).show();
|
||||||
|
|
||||||
// remove option from dropdown, each field should just exist once
|
// remove option from dropdown, each field should just exist once
|
||||||
this.find('option[value=' + $select.val() + ']').remove();
|
this.find('option[value=' + $select.val() + ']').remove();
|
||||||
|
|
||||||
// jump back to default entry
|
// jump back to default entry
|
||||||
$select.val(0);
|
$select.val(0);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadSitetree: function() {
|
_reloadSitetree: function() {
|
||||||
var self = this;
|
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<br />' + 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<br />' + response.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
@ -9,158 +9,159 @@
|
|||||||
$('#Form_EditForm').concrete('ss',function($){
|
$('#Form_EditForm').concrete('ss',function($){
|
||||||
return/** @lends ss.Form_EditForm */{
|
return/** @lends ss.Form_EditForm */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type String HTML text to show when the form has been deleted.
|
* @type String HTML text to show when the form has been deleted.
|
||||||
*/
|
*/
|
||||||
RemoveHtml: null,
|
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;
|
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');
|
$(button).removeClass('loading');
|
||||||
|
|
||||||
self._loadResponse(response);
|
return false;
|
||||||
},
|
|
||||||
// @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 <form> tag
|
|
||||||
* with a custom HTML fragment. Useful e.g. for deleting a page in the CMS.
|
|
||||||
*
|
|
||||||
* @param {String} removeText
|
|
||||||
*/
|
|
||||||
remove: function(removeHTML) {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove all the currently active TinyMCE editors.
|
|
||||||
* Note: Everything that calls this externally has an inappropriate coupling to TinyMCE.
|
|
||||||
*/
|
|
||||||
cleanup: function() {
|
|
||||||
if((typeof tinymce != 'undefined') && tinymce.EditorManager) {
|
|
||||||
var id;
|
|
||||||
for(id in tinymce.EditorManager.editors) {
|
|
||||||
tinymce.EditorManager.editors[id].remove();
|
|
||||||
}
|
}
|
||||||
tinymce.EditorManager.editors = {};
|
|
||||||
|
// 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 <form> tag
|
||||||
|
* with a custom HTML fragment. Useful e.g. for deleting a page in the CMS.
|
||||||
|
*
|
||||||
|
* @param {String} removeText
|
||||||
|
*/
|
||||||
|
remove: function(removeHTML) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all the currently active TinyMCE editors.
|
||||||
|
* Note: Everything that calls this externally has an inappropriate coupling to TinyMCE.
|
||||||
|
*/
|
||||||
|
cleanup: function() {
|
||||||
|
if((typeof tinymce != 'undefined') && tinymce.EditorManager) {
|
||||||
|
var id;
|
||||||
|
for(id in tinymce.EditorManager.editors) {
|
||||||
|
tinymce.EditorManager.editors[id].remove();
|
||||||
|
}
|
||||||
|
tinymce.EditorManager.editors = {};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {String} result Either HTML for straight insertion, or eval'ed JavaScript.
|
||||||
|
* If passed as HTML, it is assumed that everying inside the <form> tag is replaced,
|
||||||
|
* but the old <form> tag itself stays intact.
|
||||||
|
*/
|
||||||
|
_loadResponse: function(response) {
|
||||||
|
this.cleanup();
|
||||||
|
|
||||||
|
var html = response;
|
||||||
|
|
||||||
|
// Rewrite # links
|
||||||
|
html = html.replace(/(<a[^>]+href *= *")#/g, '$1' + window.location.href.replace(/#.*$/,'') + '#');
|
||||||
|
|
||||||
|
// Rewrite iframe links (for IE)
|
||||||
|
html = html.replace(/(<iframe[^>]*src=")([^"]+)("[^>]*>)/g, '$1' + $('base').attr('href') + '$2$3');
|
||||||
|
|
||||||
|
// Prepare iframes for removal, otherwise we get loading bugs
|
||||||
|
this.find('iframe').each(function() {
|
||||||
|
this.contentWindow.location.href = 'about:blank';
|
||||||
|
this.remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.html(html);
|
||||||
|
|
||||||
|
if(this.hasClass('validationerror')) {
|
||||||
|
statusMessage(ss.i18n._t('ModelAdmin.VALIDATIONERROR', 'Validation Error'), 'bad');
|
||||||
|
} else {
|
||||||
|
statusMessage(ss.i18n._t('ModelAdmin.SAVED', 'Saved'), 'good');
|
||||||
|
}
|
||||||
|
|
||||||
|
Behaviour.apply(); // refreshes ComplexTableField
|
||||||
|
|
||||||
|
// focus input on first form element
|
||||||
|
this.find(':input:visible:first').focus();
|
||||||
|
|
||||||
|
this.trigger('loadnewpage', {response: response});
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
|
});
|
||||||
/**
|
|
||||||
* @param {String} result Either HTML for straight insertion, or eval'ed JavaScript.
|
|
||||||
* If passed as HTML, it is assumed that everying inside the <form> tag is replaced,
|
|
||||||
* but the old <form> tag itself stays intact.
|
|
||||||
*/
|
|
||||||
_loadResponse: function(response) {
|
|
||||||
this.cleanup();
|
|
||||||
|
|
||||||
var html = response;
|
|
||||||
|
|
||||||
// Rewrite # links
|
|
||||||
html = html.replace(/(<a[^>]+href *= *")#/g, '$1' + window.location.href.replace(/#.*$/,'') + '#');
|
|
||||||
|
|
||||||
// Rewrite iframe links (for IE)
|
|
||||||
html = html.replace(/(<iframe[^>]*src=")([^"]+)("[^>]*>)/g, '$1' + $('base').attr('href') + '$2$3');
|
|
||||||
|
|
||||||
// Prepare iframes for removal, otherwise we get loading bugs
|
|
||||||
this.find('iframe').each(function() {
|
|
||||||
this.contentWindow.location.href = 'about:blank';
|
|
||||||
this.remove();
|
|
||||||
})
|
|
||||||
|
|
||||||
this.html(html);
|
|
||||||
|
|
||||||
if(this.hasClass('validationerror')) {
|
|
||||||
statusMessage(ss.i18n._t('ModelAdmin.VALIDATIONERROR', 'Validation Error'), 'bad');
|
|
||||||
} else {
|
|
||||||
statusMessage(ss.i18n._t('ModelAdmin.SAVED', 'Saved'), 'good');
|
|
||||||
}
|
|
||||||
|
|
||||||
Behaviour.apply(); // refreshes ComplexTableField
|
|
||||||
|
|
||||||
// focus input on first form element
|
|
||||||
this.find(':input:visible:first').focus();
|
|
||||||
|
|
||||||
this.trigger('loadnewpage', {response: response});
|
|
||||||
}
|
|
||||||
}});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class All buttons in the right CMS form go through here by default.
|
* @class All buttons in the right CMS form go through here by default.
|
||||||
|
@ -13,104 +13,106 @@
|
|||||||
*/
|
*/
|
||||||
$('.LeftAndMain').concrete('ss', function($){
|
$('.LeftAndMain').concrete('ss', function($){
|
||||||
return/** @lends ss.EditMemberProfile */ {
|
return/** @lends ss.EditMemberProfile */ {
|
||||||
|
/**
|
||||||
|
* @type Number Interval in which /Security/ping will be checked for a valid login session.
|
||||||
|
*/
|
||||||
|
PingIntervalSeconds: 5*60,
|
||||||
|
|
||||||
/**
|
onmatch: function() {
|
||||||
* @type Number Interval in which /Security/ping will be checked for a valid login session.
|
var self = this;
|
||||||
*/
|
|
||||||
PingIntervalSeconds: 5*60,
|
|
||||||
|
|
||||||
onmatch: function() {
|
this._setupPinging();
|
||||||
this._setupPinging();
|
this._setupButtons();
|
||||||
this._setupButtons();
|
this._resizeChildren();
|
||||||
this._resizeChildren();
|
|
||||||
|
|
||||||
// artificially delay the resize event 200ms
|
// artificially delay the resize event 200ms
|
||||||
// to avoid overlapping height changes in different onresize() methods
|
// to avoid overlapping height changes in different onresize() methods
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
var timerID = "timerLeftAndMainResize";
|
var timerID = "timerLeftAndMainResize";
|
||||||
if (window[timerID]) clearTimeout(window[timerID]);
|
if (window[timerID]) clearTimeout(window[timerID]);
|
||||||
window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
|
window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
|
||||||
});
|
|
||||||
|
|
||||||
// trigger resize whenever new tabs are shown
|
|
||||||
// @todo This is called multiple times when tabs are loaded
|
|
||||||
this.find('.ss-tabset').bind('tabsshow', function() {self._resizeChildren();});
|
|
||||||
|
|
||||||
$('#Form_EditForm').bind('loadnewpage', function() {self._resizeChildren();});
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is called by prototype when it receives notification that the user was logged out.
|
|
||||||
* It uses /Security/ping for this purpose, which should return '1' if a valid user session exists.
|
|
||||||
* It redirects back to the login form if the URL is either unreachable, or returns '0'.
|
|
||||||
*/
|
|
||||||
_setupPinging: function() {
|
|
||||||
var onSessionLost = function(response, type, XMLHttpRequest) {
|
|
||||||
if(XMLHttpRequest.status > 400 || response == 0) {
|
|
||||||
// TODO will pile up additional alerts when left unattended
|
|
||||||
if(window.open('Security/login')) {
|
|
||||||
alert("Please log in and then try again");
|
|
||||||
} else {
|
|
||||||
alert("Please enable pop-ups for this site");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// setup pinging for login expiry
|
|
||||||
setInterval(function() {
|
|
||||||
jQuery.ajax({
|
|
||||||
url: "Security/ping",
|
|
||||||
global: false,
|
|
||||||
error: onSessionLost,
|
|
||||||
success: onSessionLost
|
|
||||||
});
|
});
|
||||||
}, this.PingIntervalSeconds() * 1000);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// trigger resize whenever new tabs are shown
|
||||||
* Make all buttons "hoverable" with jQuery theming.
|
// @todo This is called multiple times when tabs are loaded
|
||||||
*/
|
this.find('.ss-tabset').bind('tabsshow', function() {self._resizeChildren();});
|
||||||
_setupButtons: function() {
|
|
||||||
// Initialize buttons
|
$('#Form_EditForm').bind('loadnewpage', function() {self._resizeChildren();});
|
||||||
this.find(':submit, button, :reset').livequery(function() {
|
|
||||||
jQuery(this).addClass(
|
this._super();
|
||||||
'ui-state-default ' +
|
},
|
||||||
'ui-corner-all'
|
|
||||||
)
|
/**
|
||||||
.hover(
|
* This function is called by prototype when it receives notification that the user was logged out.
|
||||||
function() {
|
* It uses /Security/ping for this purpose, which should return '1' if a valid user session exists.
|
||||||
$(this).addClass('ui-state-hover');
|
* It redirects back to the login form if the URL is either unreachable, or returns '0'.
|
||||||
},
|
*/
|
||||||
function() {
|
_setupPinging: function() {
|
||||||
$(this).removeClass('ui-state-hover');
|
var onSessionLost = function(response, type, XMLHttpRequest) {
|
||||||
|
if(XMLHttpRequest.status > 400 || response == 0) {
|
||||||
|
// TODO will pile up additional alerts when left unattended
|
||||||
|
if(window.open('Security/login')) {
|
||||||
|
alert("Please log in and then try again");
|
||||||
|
} else {
|
||||||
|
alert("Please enable pop-ups for this site");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
};
|
||||||
.focus(function() {
|
|
||||||
$(this).addClass('ui-state-focus');
|
|
||||||
})
|
|
||||||
.blur(function() {
|
|
||||||
$(this).removeClass('ui-state-focus');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// setup pinging for login expiry
|
||||||
* Resize elements in center panel
|
setInterval(function() {
|
||||||
* to fit the boundary box provided by the layout manager
|
jQuery.ajax({
|
||||||
*/
|
url: "Security/ping",
|
||||||
_resizeChildren: function() {
|
global: false,
|
||||||
$('#Form_EditForm').fitHeightToParent();
|
error: onSessionLost,
|
||||||
$('#Form_EditForm fieldset', this).fitHeightToParent();
|
success: onSessionLost
|
||||||
// Order of resizing is important: Outer to inner
|
});
|
||||||
// TODO Only supports two levels of tabs at the moment
|
}, this.PingIntervalSeconds() * 1000);
|
||||||
$('#Form_EditForm fieldset > .ss-tabset', this).fitHeightToParent();
|
},
|
||||||
$('#Form_EditForm fieldset > .ss-tabset > .tab', this).fitHeightToParent();
|
|
||||||
$('#Form_EditForm fieldset > .ss-tabset > .tab > .ss-tabset', this).fitHeightToParent();
|
/**
|
||||||
$('#Form_EditForm fieldset > .ss-tabset > .tab > .ss-tabset > .tab', this).fitHeightToParent();
|
* Make all buttons "hoverable" with jQuery theming.
|
||||||
}
|
*/
|
||||||
}});
|
_setupButtons: function() {
|
||||||
|
// Initialize buttons
|
||||||
|
this.find(':submit, button, :reset').livequery(function() {
|
||||||
|
jQuery(this).addClass(
|
||||||
|
'ui-state-default ' +
|
||||||
|
'ui-corner-all'
|
||||||
|
)
|
||||||
|
.hover(
|
||||||
|
function() {
|
||||||
|
$(this).addClass('ui-state-hover');
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
$(this).removeClass('ui-state-hover');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.focus(function() {
|
||||||
|
$(this).addClass('ui-state-focus');
|
||||||
|
})
|
||||||
|
.blur(function() {
|
||||||
|
$(this).removeClass('ui-state-focus');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resize elements in center panel
|
||||||
|
* to fit the boundary box provided by the layout manager
|
||||||
|
*/
|
||||||
|
_resizeChildren: function() {
|
||||||
|
$('#Form_EditForm').fitHeightToParent();
|
||||||
|
$('#Form_EditForm fieldset', this).fitHeightToParent();
|
||||||
|
// Order of resizing is important: Outer to inner
|
||||||
|
// TODO Only supports two levels of tabs at the moment
|
||||||
|
$('#Form_EditForm fieldset > .ss-tabset', this).fitHeightToParent();
|
||||||
|
$('#Form_EditForm fieldset > .ss-tabset > .tab', this).fitHeightToParent();
|
||||||
|
$('#Form_EditForm fieldset > .ss-tabset > .tab > .ss-tabset', this).fitHeightToParent();
|
||||||
|
$('#Form_EditForm fieldset > .ss-tabset > .tab > .ss-tabset > .tab', this).fitHeightToParent();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Container for tree actions like "create", "search", etc.
|
* @class Container for tree actions like "create", "search", etc.
|
||||||
@ -119,18 +121,19 @@
|
|||||||
$('#TreeActions').concrete('ss', function($){
|
$('#TreeActions').concrete('ss', function($){
|
||||||
return/** @lends ss.TreeActions */{
|
return/** @lends ss.TreeActions */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup "create", "search", "batch actions" layers above tree.
|
* Setup "create", "search", "batch actions" layers above tree.
|
||||||
* All tab contents are closed by default.
|
* All tab contents are closed by default.
|
||||||
*/
|
*/
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
this.tabs({
|
this.tabs({
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
selected: parseInt(jQuery.cookie('ui-tabs-TreeActions')) || null,
|
selected: parseInt(jQuery.cookie('ui-tabs-TreeActions'), 10) || null,
|
||||||
cookie: { expires: 30, path: '/', name: 'ui-tabs-TreeActions' }
|
cookie: { expires: 30, path: '/', name: 'ui-tabs-TreeActions' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}});
|
};
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Link for editing the profile for a logged-in member
|
* @class Link for editing the profile for a logged-in member
|
||||||
@ -140,87 +143,88 @@
|
|||||||
$('a#EditMemberProfile').concrete('ss', function($){
|
$('a#EditMemberProfile').concrete('ss', function($){
|
||||||
return/** @lends ss.EditMemberProfile */{
|
return/** @lends ss.EditMemberProfile */{
|
||||||
|
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.bind('click', function(e) {return self._openPopup();});
|
this.bind('click', function(e) {return self._openPopup();});
|
||||||
|
|
||||||
$('body').append(
|
$('body').append(
|
||||||
'<div id="ss-ui-dialog">'
|
'<div id="ss-ui-dialog">'
|
||||||
+ '<iframe id="ss-ui-dialog-iframe" '
|
+ '<iframe id="ss-ui-dialog-iframe" '
|
||||||
+ 'marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto">'
|
+ 'marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto">'
|
||||||
+ '</iframe>'
|
+ '</iframe>'
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
);
|
|
||||||
|
|
||||||
var cookieVal = (jQuery.cookie) ? JSON.parse(jQuery.cookie('ss-ui-dialog')) : false;
|
|
||||||
$("#ss-ui-dialog").dialog(jQuery.extend({
|
|
||||||
autoOpen: false,
|
|
||||||
bgiframe: true,
|
|
||||||
modal: true,
|
|
||||||
height: 300,
|
|
||||||
width: 500,
|
|
||||||
ghost: true,
|
|
||||||
resizeStop: function(e, ui) {
|
|
||||||
self._resize();
|
|
||||||
self._saveState();
|
|
||||||
},
|
|
||||||
dragStop: function(e, ui) {
|
|
||||||
self._saveState();
|
|
||||||
},
|
|
||||||
// TODO i18n
|
|
||||||
title: 'Edit Profile'
|
|
||||||
}, cookieVal)).css('overflow', 'hidden');
|
|
||||||
|
|
||||||
$('#ss-ui-dialog-iframe').bind('load', function(e) {self._resize();})
|
|
||||||
},
|
|
||||||
|
|
||||||
_openPopup: function(e) {
|
|
||||||
$('#ss-ui-dialog-iframe').attr('src', this.attr('href'));
|
|
||||||
|
|
||||||
$("#ss-ui-dialog").dialog('open');
|
|
||||||
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
|
|
||||||
_resize: function() {
|
|
||||||
var iframe = $('#ss-ui-dialog-iframe');
|
|
||||||
var container = $('#ss-ui-dialog');
|
|
||||||
|
|
||||||
iframe.attr('width',
|
|
||||||
container.innerWidth()
|
|
||||||
- parseFloat(container.css('paddingLeft'))
|
|
||||||
- parseFloat(container.css('paddingRight'))
|
|
||||||
);
|
|
||||||
iframe.attr('height',
|
|
||||||
container.innerHeight()
|
|
||||||
- parseFloat(container.css('paddingTop'))
|
|
||||||
- parseFloat(container.css('paddingBottom'))
|
|
||||||
);
|
|
||||||
|
|
||||||
this._saveState();
|
|
||||||
},
|
|
||||||
|
|
||||||
_saveState: function() {
|
|
||||||
var container = $('#ss-ui-dialog');
|
|
||||||
|
|
||||||
// save size in cookie (optional)
|
|
||||||
if(jQuery.cookie && container.width() && container.height()) {
|
|
||||||
jQuery.cookie(
|
|
||||||
'ss-ui-dialog',
|
|
||||||
JSON.stringify({
|
|
||||||
width: parseInt(container.width()),
|
|
||||||
height: parseInt(container.height()),
|
|
||||||
position: [
|
|
||||||
parseInt(container.offset().top),
|
|
||||||
parseInt(container.offset().left)
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
{ expires: 30, path: '/'}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var cookieVal = (jQuery.cookie) ? JSON.parse(jQuery.cookie('ss-ui-dialog')) : false;
|
||||||
|
$("#ss-ui-dialog").dialog(jQuery.extend({
|
||||||
|
autoOpen: false,
|
||||||
|
bgiframe: true,
|
||||||
|
modal: true,
|
||||||
|
height: 300,
|
||||||
|
width: 500,
|
||||||
|
ghost: true,
|
||||||
|
resizeStop: function(e, ui) {
|
||||||
|
self._resize();
|
||||||
|
self._saveState();
|
||||||
|
},
|
||||||
|
dragStop: function(e, ui) {
|
||||||
|
self._saveState();
|
||||||
|
},
|
||||||
|
// TODO i18n
|
||||||
|
title: 'Edit Profile'
|
||||||
|
}, cookieVal)).css('overflow', 'hidden');
|
||||||
|
|
||||||
|
$('#ss-ui-dialog-iframe').bind('load', function(e) {self._resize();});
|
||||||
|
},
|
||||||
|
|
||||||
|
_openPopup: function(e) {
|
||||||
|
$('#ss-ui-dialog-iframe').attr('src', this.attr('href'));
|
||||||
|
|
||||||
|
$("#ss-ui-dialog").dialog('open');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
_resize: function() {
|
||||||
|
var iframe = $('#ss-ui-dialog-iframe');
|
||||||
|
var container = $('#ss-ui-dialog');
|
||||||
|
|
||||||
|
iframe.attr('width',
|
||||||
|
container.innerWidth()
|
||||||
|
- parseFloat(container.css('paddingLeft'))
|
||||||
|
- parseFloat(container.css('paddingRight'))
|
||||||
|
);
|
||||||
|
iframe.attr('height',
|
||||||
|
container.innerHeight()
|
||||||
|
- parseFloat(container.css('paddingTop'))
|
||||||
|
- parseFloat(container.css('paddingBottom'))
|
||||||
|
);
|
||||||
|
|
||||||
|
this._saveState();
|
||||||
|
},
|
||||||
|
|
||||||
|
_saveState: function() {
|
||||||
|
var container = $('#ss-ui-dialog');
|
||||||
|
|
||||||
|
// save size in cookie (optional)
|
||||||
|
if(jQuery.cookie && container.width() && container.height()) {
|
||||||
|
jQuery.cookie(
|
||||||
|
'ss-ui-dialog',
|
||||||
|
JSON.stringify({
|
||||||
|
width: parseInt(container.width(), 10),
|
||||||
|
height: parseInt(container.height(), 10),
|
||||||
|
position: [
|
||||||
|
parseInt(container.offset().top, 10),
|
||||||
|
parseInt(container.offset().left, 10)
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
{ expires: 30, path: '/'}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Links for viewing the currently loaded page
|
* @class Links for viewing the currently loaded page
|
||||||
@ -270,7 +274,7 @@
|
|||||||
window.open($(e.target).attr('href'));
|
window.open($(e.target).attr('href'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
Loading…
Reference in New Issue
Block a user