diff --git a/.gitattributes b/.gitattributes index d509cc6b9..e551ff893 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ -docs/ export-ignore +admin/javascript/src/ export-ignore +docs/ export-ignore +javascript/src/ export ignore diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index a55f7458e..8b0a893d7 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -308,23 +308,18 @@ class LeftAndMain extends Controller implements PermissionProvider { $htmlEditorConfig->setOption('content_css', implode(',', $cssFiles)); } - // Using uncompressed files as they'll be processed by JSMin in the Requirements class. - // Not as effective as other compressors or pre-compressed+finetuned files, - // but overall the unified minification into a single file brings more performance benefits - // than a couple of saved bytes (after gzip) in individual files. - // We also re-compress already compressed files through JSMin as this causes weird runtime bugs. - Requirements::combine_files( - 'lib.js', - array( + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/bundle-lib.js', [ + 'provides' => [ THIRDPARTY_DIR . '/jquery/jquery.js', - FRAMEWORK_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js', - FRAMEWORK_ADMIN_DIR . '/javascript/lib.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/json-js/json2.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', THIRDPARTY_DIR . '/jquery-form/jquery.form.js', + THIRDPARTY_DIR . '/jquery-ondemand/jquery.ondemand.js', + THIRDPARTY_DIR . '/jquery-changetracker/lib/jquery.changetracker.js', + THIRDPARTY_DIR . '/jstree/jquery.jstree.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', @@ -332,51 +327,48 @@ class LeftAndMain extends Controller implements PermissionProvider { FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js', - THIRDPARTY_DIR . '/jstree/jquery.jstree.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', - FRAMEWORK_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js', - FRAMEWORK_DIR . '/javascript/i18n.js', - FRAMEWORK_DIR . '/javascript/TreeDropdownField.js', - FRAMEWORK_DIR . '/javascript/DateField.js', - FRAMEWORK_DIR . '/javascript/HtmlEditorField.js', - FRAMEWORK_DIR . '/javascript/TabSet.js', - FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js', - FRAMEWORK_DIR . '/javascript/GridField.js', - ) - ); + FRAMEWORK_DIR . '/javascript/dist/TreeDropdownField.js', + FRAMEWORK_DIR . '/javascript/dist/DateField.js', + FRAMEWORK_DIR . '/javascript/dist/HtmlEditorField.js', + FRAMEWORK_DIR . '/javascript/dist/TabSet.js', + FRAMEWORK_DIR . '/javascript/dist/GridField.js', + FRAMEWORK_DIR . '/javascript/dist/i18n.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/sspath.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/ssui.core.js', + ] + ]); - if (Director::isDev()) Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/leaktools.js'); + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/bundle-leftandmain.js', [ + 'provides' => [ + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Layout.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.ActionTabSet.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Panel.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Tree.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Content.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.EditForm.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Menu.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Preview.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.BatchActions.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.FieldHelp.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.FieldDescriptionToggle.js', + FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.TreeDropdownField.js' + ] + ]); - $leftAndMainIncludes = array_unique(array_merge( - array( - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Layout.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.ActionTabSet.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldDescriptionToggle.js', - FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js', - ), - Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true), - Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true) - )); + Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true); + Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true); - if($this->config()->session_keepalive_ping) { - $leftAndMainIncludes[] = FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js'; + if ($this->config()->session_keepalive_ping) { + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Ping.js'); } - Requirements::combine_files('leftandmain.js', $leftAndMainIncludes); - - // TODO Confuses jQuery.ondemand through document.write() if (Director::isDev()) { + // TODO Confuses jQuery.ondemand through document.write() Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js'); + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/leaktools.js'); } Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css'); @@ -1765,7 +1757,7 @@ class LeftAndMain extends Controller implements PermissionProvider { /** * Register the given javascript file as required in the CMS. - * Filenames should be relative to the base, eg, FRAMEWORK_DIR . '/javascript/loader.js' + * Filenames should be relative to the base, eg, FRAMEWORK_DIR . '/javascript/dist/loader.js' * * @deprecated since version 4.0 */ diff --git a/admin/code/MemberImportForm.php b/admin/code/MemberImportForm.php index 6dc12e34e..2fc2e6b4e 100644 --- a/admin/code/MemberImportForm.php +++ b/admin/code/MemberImportForm.php @@ -63,7 +63,7 @@ class MemberImportForm extends Form { parent::__construct($controller, $name, $fields, $actions, $validator); Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); - Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js'); + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/MemberImportForm.js'); $this->addExtraClass('cms'); $this->addExtraClass('import-form'); diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index 037e9d6af..cd0eabd0f 100644 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -110,7 +110,7 @@ abstract class ModelAdmin extends LeftAndMain { user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR); } - Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ModelAdmin.js'); + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/ModelAdmin.js'); } public function Link($action = null) { diff --git a/admin/code/SecurityAdmin.php b/admin/code/SecurityAdmin.php index dd57b0c3b..cfbf4fe3d 100755 --- a/admin/code/SecurityAdmin.php +++ b/admin/code/SecurityAdmin.php @@ -31,7 +31,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { public function init() { parent::init(); - Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/SecurityAdmin.js'); + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/SecurityAdmin.js'); } /** @@ -202,10 +202,8 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { Requirements::clear(); Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); - Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/MemberImportForm.css'); Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); - Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js'); - + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/MemberImportForm.js'); return $this->renderWith('BlankPage', array( 'Form' => $this->MemberImportForm()->forTemplate(), 'Content' => ' ' @@ -234,10 +232,8 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { Requirements::clear(); Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); - Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/MemberImportForm.css'); Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); - Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js'); - + Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/MemberImportForm.js'); return $this->renderWith('BlankPage', array( 'Content' => ' ', 'Form' => $this->GroupImportForm()->forTemplate() diff --git a/admin/javascript/CMSSecurity.js b/admin/javascript/CMSSecurity.js deleted file mode 100644 index 088633076..000000000 --- a/admin/javascript/CMSSecurity.js +++ /dev/null @@ -1,23 +0,0 @@ -jQuery.noConflict(); - -/** - * File: LeftAndMain.js - */ -(function($) { - // setup jquery.entwine - $.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE; - $.entwine('ss', function($) { - // Make all buttons "hoverable" with jQuery theming. - $('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({ - onadd: function() { - this.addClass('ss-ui-button'); - if(!this.data('button')) this.button(); - this._super(); - }, - onremove: function() { - if(this.data('button')) this.button('destroy'); - this._super(); - } - }); - }); -}(jQuery)); diff --git a/admin/javascript/LeftAndMain.ActionTabSet.js b/admin/javascript/LeftAndMain.ActionTabSet.js deleted file mode 100644 index dbbf3da22..000000000 --- a/admin/javascript/LeftAndMain.ActionTabSet.js +++ /dev/null @@ -1,239 +0,0 @@ -/** - * File: LeftAndMain.ActionTabset.js - * - * Contains rules for .ss-ui-action-tabset, used for: - * * Site tree action tabs (to perform actions on the site tree) - * * Actions menu (Edit page actions) - * - */ -(function($){ - $.entwine('ss', function($) { - /** - * Generic rules for all ss-ui-action-tabsets - * * ActionMenus - * * SiteTree ActionTabs - */ - $('.ss-tabset.ss-ui-action-tabset').entwine({ - // Ignore tab state so it will not be reopened on form submission. - IgnoreTabState: true, - - onadd: function() { - // Make sure the .ss-tabset is already initialised to apply our modifications on top. - this._super(); - //Set actionTabs to allow closing and be closed by default - this.tabs({'collapsible': true, 'active': false}); - }, - - onremove: function() { - // Remove all bound events. - // This guards against an edge case where the click handlers are not unbound - // because the panel is still open when the ajax edit form reloads. - var frame = $('.cms-container').find('iframe'); - frame.each(function(index, iframe){ - $(iframe).contents().off('click.ss-ui-action-tabset'); - }); - $(document).off('click.ss-ui-action-tabset'); - - this._super(); - }, - - /** - * Deal with available vertical space - */ - 'ontabsbeforeactivate': function(event, ui) { - this.riseUp(event, ui); - }, - - /** - * Handle opening and closing tabs - */ - onclick: function(event, ui) { - this.attachCloseHandler(event, ui); - }, - - /** - * Generic function to close open tabs. Stores event in a handler, - * and removes the bound event once activated. - * - * Note: Should be called by a click event attached to 'this' - */ - attachCloseHandler: function(event, ui) { - var that = this, frame = $('.cms-container').find('iframe'), closeHandler; - - // Create a handler for the click event so we can close tabs - // and easily remove the event once done - closeHandler = function(event) { - var panel, frame; - panel = $(event.target).closest('.ss-ui-action-tabset .ui-tabs-panel'); - - // If anything except the ui-nav button or panel is clicked, - // close panel and remove handler. We can't close if click was - // within panel, as it might've caused a button action, - // and we need to show its loading indicator. - if (!$(event.target).closest(that).length && !panel.length) { - that.tabs('option', 'active', false); // close tabs - - // remove click event from objects it is bound to (iframe's and document) - frame = $('.cms-container').find('iframe'); - frame.each(function(index, iframe){ - $(iframe).contents().off('click.ss-ui-action-tabset', closeHandler); - }); - $(document).off('click.ss-ui-action-tabset', closeHandler); - } - }; - - // Bind click event to document, and use closeHandler to handle the event - $(document).on('click.ss-ui-action-tabset', closeHandler); - // Make sure iframe click also closes tab - // iframe needs a special case, else the click event will not register here - if(frame.length > 0){ - frame.each(function(index, iframe) { - $(iframe).contents().on('click.ss-ui-action-tabset', closeHandler); - }); - } - }, - /** - * Function riseUp checks to see if a tab should be opened upwards - * (based on space concerns). If true, the rise-up class is applied - * and a new position is calculated and applied to the element. - * - * Note: Should be called by a tabsbeforeactivate event - */ - riseUp: function(event, ui) { - var elHeight, trigger, endOfWindow, elPos, activePanel, activeTab, topPosition, containerSouth, padding; - - // Get the numbers needed to calculate positions - elHeight = $(this).find('.ui-tabs-panel').outerHeight(); - trigger = $(this).find('.ui-tabs-nav').outerHeight(); - endOfWindow = ($(window).height() + $(document).scrollTop()) - trigger; - elPos = $(this).find('.ui-tabs-nav').offset().top; - - activePanel = ui.newPanel; - activeTab = ui.newTab; - - if (elPos + elHeight >= endOfWindow && elPos - elHeight > 0){ - this.addClass('rise-up'); - - if (activeTab.position() !== null){ - topPosition = -activePanel.outerHeight(); - containerSouth = activePanel.parents('.south'); - if (containerSouth){ - // If container is the southern panel, make tab appear from the top of the container - padding = activeTab.offset().top - containerSouth.offset().top; - topPosition = topPosition-padding; - } - $(activePanel).css('top',topPosition+"px"); - } - } else { - // else remove the rise-up class and set top to 0 - this.removeClass('rise-up'); - if (activeTab.position() !== null){ - $(activePanel).css('top','0px'); - } - } - return false; - } - }); - - - /** - * ActionMenus - * * Specific rules for ActionMenus, used for edit page actions - */ - $('.cms-content-actions .ss-tabset.ss-ui-action-tabset').entwine({ - /** - * Make necessary adjustments before tab is activated - */ - 'ontabsbeforeactivate': function(event, ui) { - this._super(event, ui); - //Set the position of the opening tab (if it exists) - if($(ui.newPanel).length > 0){ - $(ui.newPanel).css('left', ui.newTab.position().left+"px"); - } - } - }); - - /** - * SiteTree ActionTabs - * Specific rules for site tree action tabs. Applies to tabs - * within the expanded content area, and within the sidebar - */ - $('.cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({ - /** - * Make necessary adjustments before tab is activated - */ - 'ontabsbeforeactivate': function(event, ui) { - this._super(event, ui); - // Remove tabset open classes (Last gets a unique class - // in the bigger sitetree. Remove this if we have it) - $(this).closest('.ss-ui-action-tabset') - .removeClass('tabset-open tabset-open-last'); - } - }); - - /** - * SiteTree ActionTabs: expanded - * * Specific rules for siteTree actions within the expanded content area. - */ - $('.cms-content-fields .ss-tabset.ss-ui-action-tabset').entwine({ - /** - * Make necessary adjustments before tab is activated - */ - 'ontabsbeforeactivate': function(event, ui) { - this._super(event, ui); - if($( ui.newPanel).length > 0){ - if($(ui.newTab).hasClass("last")){ - // Align open tab to the right (because opened tab is last) - $(ui.newPanel).css({'left': 'auto', 'right': '0px'}); - - // Last needs to be styled differently when open, so apply a unique class - $(ui.newPanel).parent().addClass('tabset-open-last'); - }else{ - // Assign position to tabpanel based on position of relivent active tab item - $(ui.newPanel).css('left', ui.newTab.position().left+"px"); - - // If this is the first tab, make sure the position doesn't include border - // (hard set position to 0 ), and add the tab-set open class - if($(ui.newTab).hasClass("first")){ - $(ui.newPanel).css('left',"0px"); - $(ui.newPanel).parent().addClass('tabset-open'); - } - } - } - } - }); - - /** - * SiteTree ActionTabs: sidebar - * * Specific rules for when the site tree actions panel appears in - * * the side-bar - */ - $('.cms-tree-view-sidebar .cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({ - - // If actions panel is within the sidebar, apply active class - // to help animate open/close on hover - 'from .ui-tabs-nav li': { - onhover: function(e) { - $(e.target).parent().find('li .active').removeClass('active'); - $(e.target).find('a').addClass('active'); - } - }, - - /** - * Make necessary adjustments before tab is activated - */ - 'ontabsbeforeactivate': function(event, ui) { - this._super(event, ui); - // Reset position of tabs, else anyone going between the large - // and the small sitetree will see broken tabs - // Apply styles with .css, to avoid overriding currently applied styles - $(ui.newPanel).css({'left': 'auto', 'right': 'auto'}); - - if($(ui.newPanel).length > 0){ - $(ui.newPanel).parent().addClass('tabset-open'); - } - } - }); - - }); -}(jQuery)); diff --git a/admin/javascript/LeftAndMain.FieldDescriptionToggle.js b/admin/javascript/LeftAndMain.FieldDescriptionToggle.js deleted file mode 100644 index c978db680..000000000 --- a/admin/javascript/LeftAndMain.FieldDescriptionToggle.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Enable toggling (show/hide) of the field's description. - */ - -(function ($) { - - $.entwine('ss', function ($) { - - $('.cms-description-toggle').entwine({ - onadd: function () { - var shown = false, // Current state of the description. - fieldId = this.prop('id').substr(0, this.prop('id').indexOf('_Holder')), - $trigger = this.find('.cms-description-trigger'), // Click target for toggling the description. - $description = this.find('.description'); - - // Prevent multiple events being added. - if (this.hasClass('description-toggle-enabled')) { - return; - } - - // If a custom trigger han't been supplied use a sensible default. - if ($trigger.length === 0) { - $trigger = this - .find('.middleColumn') - .first() // Get the first middleColumn so we don't add multiple triggers on composite field types. - .after('') - .next(); - } - - this.addClass('description-toggle-enabled'); - - // Toggle next description when button is clicked. - $trigger.on('click', function() { - $description[shown ? 'hide' : 'show'](); - shown = !shown; - }); - - // Hide next description by default. - $description.hide(); - } - }); - - }); -})(jQuery); diff --git a/admin/javascript/LeftAndMain.FieldHelp.js b/admin/javascript/LeftAndMain.FieldHelp.js deleted file mode 100644 index c94394009..000000000 --- a/admin/javascript/LeftAndMain.FieldHelp.js +++ /dev/null @@ -1,37 +0,0 @@ -(function($) { - $.entwine('ss', function($) { - /** - * Converts an inline field description into a tooltip - * which is shown on hover over any part of the field container, - * as well as when focusing into an input element within the field container. - * - * Note that some fields don't have distinct focusable - * input fields (e.g. GridField), and aren't compatible - * with showing tooltips. - */ - $(".cms .field.cms-description-tooltip").entwine({ - onmatch: function() { - this._super(); - - var descriptionEl = this.find('.description'), inputEl, tooltipEl; - if(descriptionEl.length) { - this - // TODO Remove title setting, shouldn't be necessary - .attr('title', descriptionEl.text()) - .tooltip({content: descriptionEl.html()}); - descriptionEl.remove(); - } - }, - }); - - $(".cms .field.cms-description-tooltip :input").entwine({ - onfocusin: function(e) { - this.closest('.field').tooltip('open'); - }, - onfocusout: function(e) { - this.closest('.field').tooltip('close'); - } - }); - - }); -}(jQuery)); diff --git a/admin/javascript/LeftAndMain.TreeDropdownField.js b/admin/javascript/LeftAndMain.TreeDropdownField.js deleted file mode 100644 index d1032cbec..000000000 --- a/admin/javascript/LeftAndMain.TreeDropdownField.js +++ /dev/null @@ -1,17 +0,0 @@ -(function($) { - $.entwine('ss', function($){ - - // Any TreeDowndownField needs to refresh it's contents after a form submission, - // because the tree on the backend might have changed - $('.TreeDropdownField').entwine({ - 'from .cms-container form': { - onaftersubmitform: function(e){ - this.find('.tree-holder').empty(); - this._super(); - } - } - }); - - }); - -})(jQuery); diff --git a/admin/javascript/dist/CMSSecurity.js b/admin/javascript/dist/CMSSecurity.js new file mode 100644 index 000000000..a8a6c721e --- /dev/null +++ b/admin/javascript/dist/CMSSecurity.js @@ -0,0 +1,43 @@ +'use strict'; + +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define('ss.CMSSecurity', ['jQuery'], factory); + } else if (typeof exports !== "undefined") { + factory(require('jQuery')); + } else { + var mod = { + exports: {} + }; + factory(global.jQuery); + global.ssCMSSecurity = mod.exports; + } +})(this, function (_jQuery) { + var _jQuery2 = _interopRequireDefault(_jQuery); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + _jQuery2.default.noConflict(); + + _jQuery2.default.entwine.warningLevel = _jQuery2.default.entwine.WARN_LEVEL_BESTPRACTISE; + + _jQuery2.default.entwine('ss', function ($) { + $('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({ + onadd: function onadd() { + this.addClass('ss-ui-button'); + if (!this.data('button')) this.button(); + + this._super(); + }, + onremove: function onremove() { + if (this.data('button')) this.button('destroy'); + + this._super(); + } + }); + }); +}); \ No newline at end of file diff --git a/admin/javascript/dist/LeftAndMain.Ping.js b/admin/javascript/dist/LeftAndMain.Ping.js new file mode 100644 index 000000000..c117bb168 --- /dev/null +++ b/admin/javascript/dist/LeftAndMain.Ping.js @@ -0,0 +1,54 @@ +'use strict'; + +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define('ss.LeftAndMain.Ping', ['jQuery'], factory); + } else if (typeof exports !== "undefined") { + factory(require('jQuery')); + } else { + var mod = { + exports: {} + }; + factory(global.jQuery); + global.ssLeftAndMainPing = mod.exports; + } +})(this, function (_jQuery) { + var _jQuery2 = _interopRequireDefault(_jQuery); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + _jQuery2.default.entwine('ss.ping', function ($) { + $('.cms-container').entwine({ + PingIntervalSeconds: 5 * 60, + onadd: function onadd() { + this._setupPinging(); + + this._super(); + }, + _setupPinging: function _setupPinging() { + var onSessionLost = function onSessionLost(xmlhttp, status) { + if (xmlhttp.status > 400 || xmlhttp.responseText == 0) { + if (window.open('Security/login')) { + alert('Please log in and then try again'); + } else { + alert('Please enable pop-ups for this site'); + } + } + }; + + setInterval(function () { + $.ajax({ + url: 'Security/ping', + global: false, + type: 'POST', + complete: onSessionLost + }); + }, this.getPingIntervalSeconds() * 1000); + } + }); + }); +}); \ No newline at end of file diff --git a/admin/javascript/dist/LeftAndMain.js b/admin/javascript/dist/LeftAndMain.js new file mode 100644 index 000000000..6bc978b14 --- /dev/null +++ b/admin/javascript/dist/LeftAndMain.js @@ -0,0 +1,1103 @@ +'use strict'; + +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define('ss.LeftAndMain', ['jQuery'], factory); + } else if (typeof exports !== "undefined") { + factory(require('jQuery')); + } else { + var mod = { + exports: {} + }; + factory(global.jQuery); + global.ssLeftAndMain = mod.exports; + } +})(this, function (_jQuery) { + var _jQuery2 = _interopRequireDefault(_jQuery); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; + }; + + _jQuery2.default.noConflict(); + + window.ss = window.ss || {}; + var windowWidth, windowHeight; + + window.ss.debounce = function (func, wait, immediate) { + var timeout, context, args; + + var later = function later() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + + return function () { + var callNow = immediate && !timeout; + context = this; + args = arguments; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + + if (callNow) { + func.apply(context, args); + } + }; + }; + + (0, _jQuery2.default)(window).bind('resize.leftandmain', function (e) { + var cb = function cb() { + (0, _jQuery2.default)('.cms-container').trigger('windowresize'); + }; + + if (_jQuery2.default.browser.msie && parseInt(_jQuery2.default.browser.version, 10) < 9) { + var newWindowWidth = (0, _jQuery2.default)(window).width(), + newWindowHeight = (0, _jQuery2.default)(window).height(); + + if (newWindowWidth != windowWidth || newWindowHeight != windowHeight) { + windowWidth = newWindowWidth; + windowHeight = newWindowHeight; + cb(); + } + } else { + cb(); + } + }); + _jQuery2.default.entwine.warningLevel = _jQuery2.default.entwine.WARN_LEVEL_BESTPRACTISE; + + _jQuery2.default.entwine('ss', function ($) { + $(window).on("message", function (e) { + var target, + event = e.originalEvent, + data = _typeof(event.data) === 'object' ? event.data : JSON.parse(event.data); + if ($.path.parseUrl(window.location.href).domain !== $.path.parseUrl(event.origin).domain) return; + target = typeof data.target === 'undefined' ? $(window) : $(data.target); + + switch (data.type) { + case 'event': + target.trigger(data.event, data.data); + break; + + case 'callback': + target[data.callback].call(target, data.data); + break; + } + }); + + var positionLoadingSpinner = function positionLoadingSpinner() { + var offset = 120; + var spinner = $('.ss-loading-screen .loading-animation'); + var top = ($(window).height() - spinner.height()) / 2; + spinner.css('top', top + offset); + spinner.show(); + }; + + var applyChosen = function applyChosen(el) { + if (el.is(':visible')) { + el.addClass('has-chzn').chosen({ + allow_single_deselect: true, + disable_search_threshold: 20 + }); + var title = el.prop('title'); + + if (title) { + el.siblings('.chzn-container').prop('title', title); + } + } else { + setTimeout(function () { + el.show(); + applyChosen(el); + }, 500); + } + }; + + var isSameUrl = function isSameUrl(url1, url2) { + var baseUrl = $('base').attr('href'); + url1 = $.path.isAbsoluteUrl(url1) ? url1 : $.path.makeUrlAbsolute(url1, baseUrl), url2 = $.path.isAbsoluteUrl(url2) ? url2 : $.path.makeUrlAbsolute(url2, baseUrl); + var url1parts = $.path.parseUrl(url1), + url2parts = $.path.parseUrl(url2); + return url1parts.pathname.replace(/\/*$/, '') == url2parts.pathname.replace(/\/*$/, '') && url1parts.search == url2parts.search; + }; + + var ajaxCompleteEvent = window.ss.debounce(function () { + $(window).trigger('ajaxComplete'); + }, 1000, true); + $(window).bind('resize', positionLoadingSpinner).trigger('resize'); + $(document).ajaxComplete(function (e, xhr, settings) { + if (window.History.enabled) { + var url = xhr.getResponseHeader('X-ControllerURL'), + origUrl = History.getPageUrl().replace(/\/$/, ''), + destUrl = settings.url, + opts; + + if (url !== null && (!isSameUrl(origUrl, url) || !isSameUrl(destUrl, url))) { + opts = { + id: new Date().getTime() + String(Math.random()).replace(/\D/g, ''), + pjax: xhr.getResponseHeader('X-Pjax') ? xhr.getResponseHeader('X-Pjax') : settings.headers['X-Pjax'] + }; + window.History.pushState(opts, '', url); + } + } + + var msg = xhr.getResponseHeader('X-Status') ? xhr.getResponseHeader('X-Status') : xhr.statusText, + reathenticate = xhr.getResponseHeader('X-Reauthenticate'), + msgType = xhr.status < 200 || xhr.status > 399 ? 'bad' : 'good', + ignoredMessages = ['OK']; + + if (reathenticate) { + $('.cms-container').showLoginDialog(); + return; + } + + if (xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages)) { + statusMessage(decodeURIComponent(msg), msgType); + } + + ajaxCompleteEvent(this); + }); + $('.cms-container').entwine({ + StateChangeXHR: null, + FragmentXHR: {}, + StateChangeCount: 0, + LayoutOptions: { + minContentWidth: 940, + minPreviewWidth: 400, + mode: 'content' + }, + onadd: function onadd() { + var self = this; + + if ($.browser.msie && parseInt($.browser.version, 10) < 8) { + $('.ss-loading-screen').append('
' + 'Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.' + '
').css('z-index', $('.ss-loading-screen').css('z-index') + 1); + $('.loading-animation').remove(); + + this._super(); + + return; + } + + this.redraw(); + $('.ss-loading-screen').hide(); + $('body').removeClass('loading'); + $(window).unbind('resize', positionLoadingSpinner); + this.restoreTabState(); + + this._super(); + }, + fromWindow: { + onstatechange: function onstatechange(e) { + this.handleStateChange(e); + } + }, + 'onwindowresize': function onwindowresize() { + this.redraw(); + }, + 'from .cms-panel': { + ontoggle: function ontoggle() { + this.redraw(); + } + }, + 'from .cms-container': { + onaftersubmitform: function onaftersubmitform() { + this.redraw(); + } + }, + 'from .cms-menu-list li a': { + onclick: function onclick(e) { + var href = $(e.target).attr('href'); + if (e.which > 1 || href == this._tabStateUrl()) return; + this.splitViewMode(); + } + }, + updateLayoutOptions: function updateLayoutOptions(newSpec) { + var spec = this.getLayoutOptions(); + var dirty = false; + + for (var k in newSpec) { + if (spec[k] !== newSpec[k]) { + spec[k] = newSpec[k]; + dirty = true; + } + } + + if (dirty) this.redraw(); + }, + splitViewMode: function splitViewMode() { + this.updateLayoutOptions({ + mode: 'split' + }); + }, + contentViewMode: function contentViewMode() { + this.updateLayoutOptions({ + mode: 'content' + }); + }, + previewMode: function previewMode() { + this.updateLayoutOptions({ + mode: 'preview' + }); + }, + RedrawSuppression: false, + redraw: function redraw() { + if (this.getRedrawSuppression()) return; + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + this.data('jlayout', jLayout.threeColumnCompressor({ + menu: this.children('.cms-menu'), + content: this.children('.cms-content'), + preview: this.children('.cms-preview') + }, this.getLayoutOptions())); + this.layout(); + this.find('.cms-panel-layout').redraw(); + this.find('.cms-content-fields[data-layout-type]').redraw(); + this.find('.cms-edit-form[data-layout-type]').redraw(); + this.find('.cms-preview').redraw(); + this.find('.cms-content').redraw(); + }, + checkCanNavigate: function checkCanNavigate(selectors) { + var contentEls = this._findFragments(selectors || ['Content']), + trackedEls = contentEls.find(':data(changetracker)').add(contentEls.filter(':data(changetracker)')), + safe = true; + + if (!trackedEls.length) { + return true; + } + + trackedEls.each(function () { + if (!$(this).confirmUnsavedChanges()) { + safe = false; + } + }); + return safe; + }, + loadPanel: function loadPanel(url, title, data, forceReload, forceReferer) { + if (!data) data = {}; + if (!title) title = ""; + if (!forceReferer) forceReferer = History.getState().url; + + if (!this.checkCanNavigate(data.pjax ? data.pjax.split(',') : ['Content'])) { + return; + } + + this.saveTabState(); + + if (window.History.enabled) { + $.extend(data, { + __forceReferer: forceReferer + }); + + if (forceReload) { + $.extend(data, { + __forceReload: Math.random() + }); + window.History.replaceState(data, title, url); + } else { + window.History.pushState(data, title, url); + } + } else { + window.location = $.path.makeUrlAbsolute(url, $('base').attr('href')); + } + }, + reloadCurrentPanel: function reloadCurrentPanel() { + this.loadPanel(window.History.getState().url, null, null, true); + }, + submitForm: function submitForm(form, button, callback, ajaxOptions) { + var self = this; + if (!button) button = this.find('.Actions :submit[name=action_save]'); + if (!button) button = this.find('.Actions :submit:first'); + form.trigger('beforesubmitform'); + this.trigger('submitform', { + form: form, + button: button + }); + $(button).addClass('loading'); + var validationResult = form.validate(); + + if (typeof validationResult !== 'undefined' && !validationResult) { + statusMessage("Validation failed.", "bad"); + $(button).removeClass('loading'); + return false; + } + + var formData = form.serializeArray(); + formData.push({ + name: $(button).attr('name'), + value: '1' + }); + formData.push({ + name: 'BackURL', + value: History.getPageUrl().replace(/\/$/, '') + }); + this.saveTabState(); + jQuery.ajax(jQuery.extend({ + headers: { + "X-Pjax": "CurrentForm,Breadcrumbs" + }, + url: form.attr('action'), + data: formData, + type: 'POST', + complete: function complete() { + $(button).removeClass('loading'); + }, + success: function success(data, status, xhr) { + form.removeClass('changed'); + if (callback) callback(data, status, xhr); + var newContentEls = self.handleAjaxResponse(data, status, xhr); + if (!newContentEls) return; + newContentEls.filter('form').trigger('aftersubmitform', { + status: status, + xhr: xhr, + formData: formData + }); + } + }, ajaxOptions)); + return false; + }, + LastState: null, + PauseState: false, + handleStateChange: function handleStateChange() { + if (this.getPauseState()) { + return; + } + + if (this.getStateChangeXHR()) this.getStateChangeXHR().abort(); + + var self = this, + h = window.History, + state = h.getState(), + fragments = state.data.pjax || 'Content', + headers = {}, + fragmentsArr = fragments.split(','), + contentEls = this._findFragments(fragmentsArr); + + this.setStateChangeCount(this.getStateChangeCount() + 1); + var isLegacyIE = $.browser.msie && parseInt($.browser.version, 10) < 9; + + if (isLegacyIE && this.getStateChangeCount() > 20) { + document.location.href = state.url; + return; + } + + if (!this.checkCanNavigate()) { + if (h.emulated.pushState) { + return; + } + + var lastState = this.getLastState(); + this.setPauseState(true); + + if (lastState) { + h.pushState(lastState.id, lastState.title, lastState.url); + } else { + h.back(); + } + + this.setPauseState(false); + return; + } + + this.setLastState(state); + + if (contentEls.length < fragmentsArr.length) { + fragments = 'Content', fragmentsArr = ['Content']; + contentEls = this._findFragments(fragmentsArr); + } + + this.trigger('beforestatechange', { + state: state, + element: contentEls + }); + headers['X-Pjax'] = fragments; + + if (typeof state.data.__forceReferer !== 'undefined') { + var url = state.data.__forceReferer; + + try { + url = decodeURI(url); + } catch (e) {} finally { + headers['X-Backurl'] = encodeURI(url); + } + } + + contentEls.addClass('loading'); + var xhr = $.ajax({ + headers: headers, + url: state.url, + complete: function complete() { + self.setStateChangeXHR(null); + contentEls.removeClass('loading'); + }, + success: function success(data, status, xhr) { + var els = self.handleAjaxResponse(data, status, xhr, state); + self.trigger('afterstatechange', { + data: data, + status: status, + xhr: xhr, + element: els, + state: state + }); + } + }); + this.setStateChangeXHR(xhr); + }, + loadFragment: function loadFragment(url, pjaxFragments) { + var self = this, + xhr, + headers = {}, + baseUrl = $('base').attr('href'), + fragmentXHR = this.getFragmentXHR(); + + if (typeof fragmentXHR[pjaxFragments] !== 'undefined' && fragmentXHR[pjaxFragments] !== null) { + fragmentXHR[pjaxFragments].abort(); + fragmentXHR[pjaxFragments] = null; + } + + url = $.path.isAbsoluteUrl(url) ? url : $.path.makeUrlAbsolute(url, baseUrl); + headers['X-Pjax'] = pjaxFragments; + xhr = $.ajax({ + headers: headers, + url: url, + success: function success(data, status, xhr) { + var elements = self.handleAjaxResponse(data, status, xhr, null); + self.trigger('afterloadfragment', { + data: data, + status: status, + xhr: xhr, + elements: elements + }); + }, + error: function error(xhr, status, _error) { + self.trigger('loadfragmenterror', { + xhr: xhr, + status: status, + error: _error + }); + }, + complete: function complete() { + var fragmentXHR = self.getFragmentXHR(); + + if (typeof fragmentXHR[pjaxFragments] !== 'undefined' && fragmentXHR[pjaxFragments] !== null) { + fragmentXHR[pjaxFragments] = null; + } + } + }); + fragmentXHR[pjaxFragments] = xhr; + return xhr; + }, + handleAjaxResponse: function handleAjaxResponse(data, status, xhr, state) { + var self = this, + url, + selectedTabs, + guessFragment, + fragment, + $data; + + if (xhr.getResponseHeader('X-Reload') && xhr.getResponseHeader('X-ControllerURL')) { + var baseUrl = $('base').attr('href'), + rawURL = xhr.getResponseHeader('X-ControllerURL'), + url = $.path.isAbsoluteUrl(rawURL) ? rawURL : $.path.makeUrlAbsolute(rawURL, baseUrl); + document.location.href = url; + return; + } + + if (!data) return; + var title = xhr.getResponseHeader('X-Title'); + if (title) document.title = decodeURIComponent(title.replace(/\+/g, ' ')); + var newFragments = {}, + newContentEls; + + if (xhr.getResponseHeader('Content-Type').match(/^((text)|(application))\/json[ \t]*;?/i)) { + newFragments = data; + } else { + fragment = document.createDocumentFragment(); + jQuery.clean([data], document, fragment, []); + $data = $(jQuery.merge([], fragment.childNodes)); + guessFragment = 'Content'; + if ($data.is('form') && !$data.is('[data-pjax-fragment~=Content]')) guessFragment = 'CurrentForm'; + newFragments[guessFragment] = $data; + } + + this.setRedrawSuppression(true); + + try { + $.each(newFragments, function (newFragment, html) { + var contentEl = $('[data-pjax-fragment]').filter(function () { + return $.inArray(newFragment, $(this).data('pjaxFragment').split(' ')) != -1; + }), + newContentEl = $(html); + if (newContentEls) newContentEls.add(newContentEl);else newContentEls = newContentEl; + + if (newContentEl.find('.cms-container').length) { + throw 'Content loaded via ajax is not allowed to contain tags matching the ".cms-container" selector to avoid infinite loops'; + } + + var origStyle = contentEl.attr('style'); + var origParent = contentEl.parent(); + var origParentLayoutApplied = typeof origParent.data('jlayout') !== 'undefined'; + var layoutClasses = ['east', 'west', 'center', 'north', 'south', 'column-hidden']; + var elemClasses = contentEl.attr('class'); + var origLayoutClasses = []; + + if (elemClasses) { + origLayoutClasses = $.grep(elemClasses.split(' '), function (val) { + return $.inArray(val, layoutClasses) >= 0; + }); + } + + newContentEl.removeClass(layoutClasses.join(' ')).addClass(origLayoutClasses.join(' ')); + if (origStyle) newContentEl.attr('style', origStyle); + var styles = newContentEl.find('style').detach(); + if (styles.length) $(document).find('head').append(styles); + contentEl.replaceWith(newContentEl); + + if (!origParent.is('.cms-container') && origParentLayoutApplied) { + origParent.layout(); + } + }); + var newForm = newContentEls.filter('form'); + if (newForm.hasClass('cms-tabset')) newForm.removeClass('cms-tabset').addClass('cms-tabset'); + } finally { + this.setRedrawSuppression(false); + } + + this.redraw(); + this.restoreTabState(state && typeof state.data.tabState !== 'undefined' ? state.data.tabState : null); + return newContentEls; + }, + _findFragments: function _findFragments(fragments) { + return $('[data-pjax-fragment]').filter(function () { + var i, + nodeFragments = $(this).data('pjaxFragment').split(' '); + + for (i in fragments) { + if ($.inArray(fragments[i], nodeFragments) != -1) return true; + } + + return false; + }); + }, + refresh: function refresh() { + $(window).trigger('statechange'); + $(this).redraw(); + }, + saveTabState: function saveTabState() { + if (typeof window.sessionStorage == "undefined" || window.sessionStorage === null) return; + + var selectedTabs = [], + url = this._tabStateUrl(); + + this.find('.cms-tabset,.ss-tabset').each(function (i, el) { + var id = $(el).attr('id'); + if (!id) return; + if (!$(el).data('tabs')) return; + if ($(el).data('ignoreTabState') || $(el).getIgnoreTabState()) return; + selectedTabs.push({ + id: id, + selected: $(el).tabs('option', 'selected') + }); + }); + + if (selectedTabs) { + var tabsUrl = 'tabs-' + url; + + try { + window.sessionStorage.setItem(tabsUrl, JSON.stringify(selectedTabs)); + } catch (err) { + if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) { + return; + } else { + throw err; + } + } + } + }, + restoreTabState: function restoreTabState(overrideStates) { + var self = this, + url = this._tabStateUrl(), + hasSessionStorage = typeof window.sessionStorage !== "undefined" && window.sessionStorage, + sessionData = hasSessionStorage ? window.sessionStorage.getItem('tabs-' + url) : null, + sessionStates = sessionData ? JSON.parse(sessionData) : false; + + this.find('.cms-tabset, .ss-tabset').each(function () { + var index, + tabset = $(this), + tabsetId = tabset.attr('id'), + tab, + forcedTab = tabset.find('.ss-tabs-force-active'); + + if (!tabset.data('tabs')) { + return; + } + + tabset.tabs('refresh'); + + if (forcedTab.length) { + index = forcedTab.index(); + } else if (overrideStates && overrideStates[tabsetId]) { + tab = tabset.find(overrideStates[tabsetId].tabSelector); + + if (tab.length) { + index = tab.index(); + } + } else if (sessionStates) { + $.each(sessionStates, function (i, sessionState) { + if (tabset.is('#' + sessionState.id)) { + index = sessionState.selected; + } + }); + } + + if (index !== null) { + tabset.tabs('option', 'active', index); + self.trigger('tabstaterestored'); + } + }); + }, + clearTabState: function clearTabState(url) { + if (typeof window.sessionStorage == "undefined") return; + var s = window.sessionStorage; + + if (url) { + s.removeItem('tabs-' + url); + } else { + for (var i = 0; i < s.length; i++) { + if (s.key(i).match(/^tabs-/)) s.removeItem(s.key(i)); + } + } + }, + clearCurrentTabState: function clearCurrentTabState() { + this.clearTabState(this._tabStateUrl()); + }, + _tabStateUrl: function _tabStateUrl() { + return History.getState().url.replace(/\?.*/, '').replace(/#.*/, '').replace($('base').attr('href'), ''); + }, + showLoginDialog: function showLoginDialog() { + var tempid = $('body').data('member-tempid'), + dialog = $('.leftandmain-logindialog'), + url = 'CMSSecurity/login'; + if (dialog.length) dialog.remove(); + url = $.path.addSearchParams(url, { + 'tempid': tempid, + 'BackURL': window.location.href + }); + dialog = $(''); + dialog.attr('id', new Date().getTime()); + dialog.data('url', url); + $('body').append(dialog); + } + }); + $('.leftandmain-logindialog').entwine({ + onmatch: function onmatch() { + this._super(); + + this.ssdialog({ + iframeUrl: this.data('url'), + dialogClass: "leftandmain-logindialog-dialog", + autoOpen: true, + minWidth: 500, + maxWidth: 500, + minHeight: 370, + maxHeight: 400, + closeOnEscape: false, + open: function open() { + $('.ui-widget-overlay').addClass('leftandmain-logindialog-overlay'); + }, + close: function close() { + $('.ui-widget-overlay').removeClass('leftandmain-logindialog-overlay'); + } + }); + }, + onunmatch: function onunmatch() { + this._super(); + }, + open: function open() { + this.ssdialog('open'); + }, + close: function close() { + this.ssdialog('close'); + }, + toggle: function toggle(bool) { + if (this.is(':visible')) this.close();else this.open(); + }, + reauthenticate: function reauthenticate(data) { + if (typeof data.SecurityID !== 'undefined') { + $(':input[name=SecurityID]').val(data.SecurityID); + } + + if (typeof data.TempID !== 'undefined') { + $('body').data('member-tempid', data.TempID); + } + + this.close(); + } + }); + $('form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading').entwine({ + onmatch: function onmatch() { + this.append(''); + + this._super(); + }, + onunmatch: function onunmatch() { + this.find('.cms-content-loading-overlay,.cms-content-loading-spinner').remove(); + + this._super(); + } + }); + $('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({ + onadd: function onadd() { + this.addClass('ss-ui-button'); + if (!this.data('button')) this.button(); + + this._super(); + }, + onremove: function onremove() { + if (this.data('button')) this.button('destroy'); + + this._super(); + } + }); + $('.cms .cms-panel-link').entwine({ + onclick: function onclick(e) { + if ($(this).hasClass('external-link')) { + e.stopPropagation(); + return; + } + + var href = this.attr('href'), + url = href && !href.match(/^#/) ? href : this.data('href'), + data = { + pjax: this.data('pjaxTarget') + }; + $('.cms-container').loadPanel(url, null, data); + e.preventDefault(); + } + }); + $('.cms .ss-ui-button-ajax').entwine({ + onclick: function onclick(e) { + $(this).removeClass('ui-button-text-only'); + $(this).addClass('ss-ui-button-loading ui-button-text-icons'); + var loading = $(this).find(".ss-ui-loading-icon"); + + if (loading.length < 1) { + loading = $("").addClass('ss-ui-loading-icon ui-button-icon-primary ui-icon'); + $(this).prepend(loading); + } + + loading.show(); + var href = this.attr('href'), + url = href ? href : this.data('href'); + jQuery.ajax({ + url: url, + complete: function complete(xmlhttp, status) { + var msg = xmlhttp.getResponseHeader('X-Status') ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.responseText; + + try { + if (typeof msg != "undefined" && msg !== null) eval(msg); + } catch (e) {} + + loading.hide(); + $(".cms-container").refresh(); + $(this).removeClass('ss-ui-button-loading ui-button-text-icons'); + $(this).addClass('ui-button-text-only'); + }, + dataType: 'html' + }); + e.preventDefault(); + } + }); + $('.cms .ss-ui-dialog-link').entwine({ + UUID: null, + onmatch: function onmatch() { + this._super(); + + this.setUUID(new Date().getTime()); + }, + onunmatch: function onunmatch() { + this._super(); + }, + onclick: function onclick() { + this._super(); + + var self = this, + id = 'ss-ui-dialog-' + this.getUUID(); + var dialog = $('#' + id); + + if (!dialog.length) { + dialog = $(''); + $('body').append(dialog); + } + + var extraClass = this.data('popupclass') ? this.data('popupclass') : ''; + dialog.ssdialog({ + iframeUrl: this.attr('href'), + autoOpen: true, + dialogExtraClass: extraClass + }); + return false; + } + }); + $('.cms-content .Actions').entwine({ + onmatch: function onmatch() { + this.find('.ss-ui-button').click(function () { + var form = this.form; + + if (form) { + form.clickedButton = this; + setTimeout(function () { + form.clickedButton = null; + }, 10); + } + }); + this.redraw(); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + this.contents().filter(function () { + return this.nodeType == 3 && !/\S/.test(this.nodeValue); + }).remove(); + this.find('.ss-ui-button').each(function () { + if (!$(this).data('button')) $(this).button(); + }); + this.find('.ss-ui-buttonset').buttonset(); + } + }); + $('.cms .field.date input.text').entwine({ + onmatch: function onmatch() { + var holder = $(this).parents('.field.date:first'), + config = holder.data(); + + if (!config.showcalendar) { + this._super(); + + return; + } + + config.showOn = 'button'; + + if (config.locale && $.datepicker.regional[config.locale]) { + config = $.extend(config, $.datepicker.regional[config.locale], {}); + } + + $(this).datepicker(config); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + $('.cms .field.dropdown select, .cms .field select[multiple], .fieldholder-small select.dropdown').entwine({ + onmatch: function onmatch() { + if (this.is('.no-chzn')) { + this._super(); + + return; + } + + if (!this.data('placeholder')) this.data('placeholder', ' '); + this.removeClass('has-chzn chzn-done'); + this.siblings('.chzn-container').remove(); + applyChosen(this); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + $(".cms-panel-layout").entwine({ + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + } + }); + $('.cms .ss-gridfield').entwine({ + showDetailView: function showDetailView(url) { + var params = window.location.search.replace(/^\?/, ''); + if (params) url = $.path.addSearchParams(url, params); + $('.cms-container').loadPanel(url); + } + }); + $('.cms-search-form').entwine({ + onsubmit: function onsubmit(e) { + var nonEmptyInputs, url; + nonEmptyInputs = this.find(':input:not(:submit)').filter(function () { + var vals = $.grep($(this).fieldValue(), function (val) { + return val; + }); + return vals.length; + }); + url = this.attr('action'); + + if (nonEmptyInputs.length) { + url = $.path.addSearchParams(url, nonEmptyInputs.serialize()); + } + + var container = this.closest('.cms-container'); + container.find('.cms-edit-form').tabs('select', 0); + container.loadPanel(url, "", {}, true); + return false; + } + }); + $(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({ + onclick: function onclick(e) { + e.preventDefault(); + var form = $(this).parents('form'); + form.clearForm(); + form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated"); + form.submit(); + } + }); + window._panelDeferredCache = {}; + $('.cms-panel-deferred').entwine({ + onadd: function onadd() { + this._super(); + + this.redraw(); + }, + onremove: function onremove() { + if (window.debug) console.log('saving', this.data('url'), this); + if (!this.data('deferredNoCache')) window._panelDeferredCache[this.data('url')] = this.html(); + + this._super(); + }, + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + var self = this, + url = this.data('url'); + if (!url) throw 'Elements of class .cms-panel-deferred need a "data-url" attribute'; + + this._super(); + + if (!this.children().length) { + if (!this.data('deferredNoCache') && typeof window._panelDeferredCache[url] !== 'undefined') { + this.html(window._panelDeferredCache[url]); + } else { + this.addClass('loading'); + $.ajax({ + url: url, + complete: function complete() { + self.removeClass('loading'); + }, + success: function success(data, status, xhr) { + self.html(data); + } + }); + } + } + } + }); + $('.cms-tabset').entwine({ + onadd: function onadd() { + this.redrawTabs(); + + this._super(); + }, + onremove: function onremove() { + if (this.data('tabs')) this.tabs('destroy'); + + this._super(); + }, + redrawTabs: function redrawTabs() { + this.rewriteHashlinks(); + var id = this.attr('id'), + activeTab = this.find('ul:first .ui-tabs-active'); + if (!this.data('uiTabs')) this.tabs({ + active: activeTab.index() != -1 ? activeTab.index() : 0, + beforeLoad: function beforeLoad(e, ui) { + return false; + }, + activate: function activate(e, ui) { + if (ui.newTab) { + ui.newTab.find('.cms-panel-link').click(); + } + + var actions = $(this).closest('form').find('.Actions'); + + if ($(ui.newTab).closest('li').hasClass('readonly')) { + actions.fadeOut(); + } else { + actions.show(); + } + } + }); + }, + rewriteHashlinks: function rewriteHashlinks() { + $(this).find('ul a').each(function () { + if (!$(this).attr('href')) return; + var matches = $(this).attr('href').match(/#.*/); + if (!matches) return; + $(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]); + }); + } + }); + $('#filters-button').entwine({ + onmatch: function onmatch() { + this._super(); + + this.data('collapsed', true); + this.data('animating', false); + }, + onunmatch: function onunmatch() { + this._super(); + }, + showHide: function showHide() { + var self = this, + $filters = $('.cms-content-filters').first(), + collapsed = this.data('collapsed'); + + if (this.data('animating')) { + return; + } + + this.toggleClass('active'); + this.data('animating', true); + $filters[collapsed ? 'slideDown' : 'slideUp']({ + complete: function complete() { + self.data('collapsed', !collapsed); + self.data('animating', false); + } + }); + }, + onclick: function onclick() { + this.showHide(); + } + }); + }); + + var statusMessage = function statusMessage(text, type) { + text = jQuery('').text(text).html(); + jQuery.noticeAdd({ + text: text, + type: type, + stayTime: 5000, + inEffect: { + left: '0', + opacity: 'show' + } + }); + }; + + var errorMessage = function errorMessage(text) { + jQuery.noticeAdd({ + text: text, + type: 'error', + stayTime: 5000, + inEffect: { + left: '0', + opacity: 'show' + } + }); + }; +}); \ No newline at end of file diff --git a/admin/javascript/dist/MemberDatetimeOptionsetField.js b/admin/javascript/dist/MemberDatetimeOptionsetField.js new file mode 100644 index 000000000..55d7663d7 --- /dev/null +++ b/admin/javascript/dist/MemberDatetimeOptionsetField.js @@ -0,0 +1,39 @@ +'use strict'; + +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define('ss.MemberDatetimeOptionsetField', ['jQuery'], factory); + } else if (typeof exports !== "undefined") { + factory(require('jQuery')); + } else { + var mod = { + exports: {} + }; + factory(global.jQuery); + global.ssMemberDatetimeOptionsetField = mod.exports; + } +})(this, function (_jQuery) { + var _jQuery2 = _interopRequireDefault(_jQuery); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + _jQuery2.default.entwine('ss', function ($) { + $('.memberdatetimeoptionset').entwine({ + onmatch: function onmatch() { + this.find('.description .toggle-content').hide(); + + this._super(); + } + }); + $('.memberdatetimeoptionset .toggle').entwine({ + onclick: function onclick(e) { + jQuery(this).closest('.description').find('.toggle-content').toggle(); + return false; + } + }); + }); +}); \ No newline at end of file diff --git a/admin/javascript/dist/MemberImportForm.js b/admin/javascript/dist/MemberImportForm.js new file mode 100644 index 000000000..5d2c4f302 --- /dev/null +++ b/admin/javascript/dist/MemberImportForm.js @@ -0,0 +1,42 @@ +'use strict'; + +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define('ss.MemberImportForm', ['jQuery'], factory); + } else if (typeof exports !== "undefined") { + factory(require('jQuery')); + } else { + var mod = { + exports: {} + }; + factory(global.jQuery); + global.ssMemberImportForm = mod.exports; + } +})(this, function (_jQuery) { + var _jQuery2 = _interopRequireDefault(_jQuery); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + _jQuery2.default.entwine('ss', function ($) { + $('.import-form .advanced').entwine({ + onmatch: function onmatch() { + this._super(); + + this.hide(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + $('.import-form a.toggle-advanced').entwine({ + onclick: function onclick(e) { + this.parents('form:eq(0)').find('.advanced').toggle(); + return false; + } + }); + }); +}); \ No newline at end of file diff --git a/admin/javascript/dist/ModelAdmin.js b/admin/javascript/dist/ModelAdmin.js new file mode 100644 index 000000000..dbaa6164c --- /dev/null +++ b/admin/javascript/dist/ModelAdmin.js @@ -0,0 +1,45 @@ +'use strict'; + +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define('ss.ModelAdmin', ['jQuery'], factory); + } else if (typeof exports !== "undefined") { + factory(require('jQuery')); + } else { + var mod = { + exports: {} + }; + factory(global.jQuery); + global.ssModelAdmin = mod.exports; + } +})(this, function (_jQuery) { + var _jQuery2 = _interopRequireDefault(_jQuery); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + _jQuery2.default.entwine('ss', function ($) { + $('.cms-content-tools #Form_SearchForm').entwine({ + onsubmit: function onsubmit(e) { + this.trigger('beforeSubmit'); + } + }); + $('.importSpec').entwine({ + onmatch: function onmatch() { + this.find('div.details').hide(); + this.find('a.detailsLink').click(function () { + $('#' + $(this).attr('href').replace(/.*#/, '')).slideToggle(); + return false; + }); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + }); +}); \ No newline at end of file diff --git a/admin/javascript/dist/SecurityAdmin.js b/admin/javascript/dist/SecurityAdmin.js new file mode 100644 index 000000000..d2e42a3a5 --- /dev/null +++ b/admin/javascript/dist/SecurityAdmin.js @@ -0,0 +1,76 @@ +'use strict'; + +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define('ss.SecurityAdmin', ['jQuery'], factory); + } else if (typeof exports !== "undefined") { + factory(require('jQuery')); + } else { + var mod = { + exports: {} + }; + factory(global.jQuery); + global.ssSecurityAdmin = mod.exports; + } +})(this, function (_jQuery) { + var _jQuery2 = _interopRequireDefault(_jQuery); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + var refreshAfterImport = function refreshAfterImport(e) { + var existingFormMessage = (0, _jQuery2.default)((0, _jQuery2.default)(this).contents()).find('.message'); + + if (existingFormMessage && existingFormMessage.html()) { + var memberTableField = (0, _jQuery2.default)(window.parent.document).find('#Form_EditForm_Members').get(0); + if (memberTableField) memberTableField.refresh(); + var tree = (0, _jQuery2.default)(window.parent.document).find('.cms-tree').get(0); + if (tree) tree.reload(); + } + }; + + (0, _jQuery2.default)('#MemberImportFormIframe, #GroupImportFormIframe').entwine({ + onadd: function onadd() { + this._super(); + + (0, _jQuery2.default)(this).bind('load', refreshAfterImport); + } + }); + + _jQuery2.default.entwine('ss', function ($) { + $('.permissioncheckboxset .checkbox[value=ADMIN]').entwine({ + onmatch: function onmatch() { + this.toggleCheckboxes(); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + onclick: function onclick(e) { + this.toggleCheckboxes(); + }, + toggleCheckboxes: function toggleCheckboxes() { + var self = this, + checkboxes = this.parents('.field:eq(0)').find('.checkbox').not(this); + + if (this.is(':checked')) { + checkboxes.each(function () { + $(this).data('SecurityAdmin.oldChecked', $(this).is(':checked')); + $(this).data('SecurityAdmin.oldDisabled', $(this).is(':disabled')); + $(this).prop('disabled', true); + $(this).prop('checked', true); + }); + } else { + checkboxes.each(function () { + $(this).prop('checked', $(this).data('SecurityAdmin.oldChecked')); + $(this).prop('disabled', $(this).data('SecurityAdmin.oldDisabled')); + }); + } + } + }); + }); +}); \ No newline at end of file diff --git a/admin/javascript/dist/bundle-leftandmain.js b/admin/javascript/dist/bundle-leftandmain.js new file mode 100644 index 000000000..8a9deab4c --- /dev/null +++ b/admin/javascript/dist/bundle-leftandmain.js @@ -0,0 +1,3 @@ +!function e(t,n,i){function s(o,r){if(!n[o]){if(!t[o]){var l="function"==typeof require&&require;if(!r&&l)return l(o,!0);if(a)return a(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){var n=t[o][1][e];return s(n?n:e)},c,c.exports,e,t,n,i)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;oYour browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.
').css("z-index",$(".ss-loading-screen").css("z-index")+1),$(".loading-animation").remove(),void this._super()):(this.redraw(),$(".ss-loading-screen").hide(),$("body").removeClass("loading"),$(window).unbind("resize",positionLoadingSpinner),this.restoreTabState(),void this._super())},fromWindow:{onstatechange:function(e){this.handleStateChange(e)}},onwindowresize:function(){this.redraw()},"from .cms-panel":{ontoggle:function(){this.redraw()}},"from .cms-container":{onaftersubmitform:function(){this.redraw()}},"from .cms-menu-list li a":{onclick:function(e){var t=$(e.target).attr("href");e.which>1||t==this._tabStateUrl()||this.splitViewMode()}},updateLayoutOptions:function(e){var t=this.getLayoutOptions(),n=!1;for(var i in e)t[i]!==e[i]&&(t[i]=e[i],n=!0);n&&this.redraw()},splitViewMode:function(){this.updateLayoutOptions({mode:"split"})},contentViewMode:function(){this.updateLayoutOptions({mode:"content"})},previewMode:function(){this.updateLayoutOptions({mode:"preview"})},RedrawSuppression:!1,redraw:function(){this.getRedrawSuppression()||(window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.data("jlayout",jLayout.threeColumnCompressor({menu:this.children(".cms-menu"),content:this.children(".cms-content"),preview:this.children(".cms-preview")},this.getLayoutOptions())),this.layout(),this.find(".cms-panel-layout").redraw(),this.find(".cms-content-fields[data-layout-type]").redraw(),this.find(".cms-edit-form[data-layout-type]").redraw(),this.find(".cms-preview").redraw(),this.find(".cms-content").redraw())},checkCanNavigate:function(e){var t=this._findFragments(e||["Content"]),n=t.find(":data(changetracker)").add(t.filter(":data(changetracker)")),i=!0;return n.length?(n.each(function(){$(this).confirmUnsavedChanges()||(i=!1)}),i):!0},loadPanel:function(e,t,n,i,s){n||(n={}),t||(t=""),s||(s=History.getState().url),this.checkCanNavigate(n.pjax?n.pjax.split(","):["Content"])&&(this.saveTabState(),window.History.enabled?($.extend(n,{__forceReferer:s}),i?($.extend(n,{__forceReload:Math.random()}),window.History.replaceState(n,t,e)):window.History.pushState(n,t,e)):window.location=$.path.makeUrlAbsolute(e,$("base").attr("href")))},reloadCurrentPanel:function(){this.loadPanel(window.History.getState().url,null,null,!0)},submitForm:function(e,t,n,i){var s=this;t||(t=this.find(".Actions :submit[name=action_save]")),t||(t=this.find(".Actions :submit:first")),e.trigger("beforesubmitform"),this.trigger("submitform",{form:e,button:t}),$(t).addClass("loading");var a=e.validate();if("undefined"!=typeof a&&!a)return statusMessage("Validation failed.","bad"),$(t).removeClass("loading"),!1;var o=e.serializeArray();return o.push({name:$(t).attr("name"),value:"1"}),o.push({name:"BackURL",value:History.getPageUrl().replace(/\/$/,"")}),this.saveTabState(),jQuery.ajax(jQuery.extend({headers:{"X-Pjax":"CurrentForm,Breadcrumbs"},url:e.attr("action"),data:o,type:"POST",complete:function(){$(t).removeClass("loading")},success:function(t,i,a){e.removeClass("changed"),n&&n(t,i,a);var r=s.handleAjaxResponse(t,i,a);r&&r.filter("form").trigger("aftersubmitform",{status:i,xhr:a,formData:o})}},i)),!1},LastState:null,PauseState:!1,handleStateChange:function(){if(!this.getPauseState()){this.getStateChangeXHR()&&this.getStateChangeXHR().abort();var e=this,t=window.History,n=t.getState(),i=n.data.pjax||"Content",s={},a=i.split(","),o=this._findFragments(a);this.setStateChangeCount(this.getStateChangeCount()+1);var r=$.browser.msie&&parseInt($.browser.version,10)<9;if(r&&this.getStateChangeCount()>20)return void(document.location.href=n.url);if(!this.checkCanNavigate()){if(t.emulated.pushState)return;var l=this.getLastState();return this.setPauseState(!0),l?t.pushState(l.id,l.title,l.url):t.back(),void this.setPauseState(!1)}if(this.setLastState(n),o.length"+t.text+"
").animate(t.inEffect,t.inEffectDuration).wrap(n),a=e("").addClass("notice-item-close").prependTo(s).html("x").click(function(){e.noticeRemove(s)}),s.hover(function(){o=!0},function(){o=!1}),t.stay||setTimeout(function(){var t=setInterval(function(){o||(e.noticeRemove(s),clearInterval(t))},1e3)},t.stayTime)},noticeRemove:function(e){e.animate({opacity:"0"},600,function(){e.parent().animate({height:"0px"},300,function(){e.parent().remove()})})}})}(jQuery)},{}],12:[function(e,t,i){!function(e){"use strict";var t=function(e){return parseInt(e,10)||0};e.each(["min","max"],function(i,n){e.fn[n+"Size"]=function(e){var i,s;return e?(void 0!==e.width&&this.css(n+"-width",e.width),void 0!==e.height&&this.css(n+"-height",e.height),this):(i=this.css(n+"-width"),s=this.css(n+"-height"),{width:"max"===n&&(void 0===i||"none"===i||-1===t(i))&&Number.MAX_VALUE||t(i),height:"max"===n&&(void 0===s||"none"===s||-1===t(s))&&Number.MAX_VALUE||t(s)})}}),e.fn.isVisible=function(){return this.is(":visible")},e.each(["border","margin","padding"],function(i,n){e.fn[n]=function(e){return e?(void 0!==e.top&&this.css(n+"-top"+("border"===n?"-width":""),e.top),void 0!==e.bottom&&this.css(n+"-bottom"+("border"===n?"-width":""),e.bottom),void 0!==e.left&&this.css(n+"-left"+("border"===n?"-width":""),e.left),void 0!==e.right&&this.css(n+"-right"+("border"===n?"-width":""),e.right),this):{top:t(this.css(n+"-top"+("border"===n?"-width":""))),bottom:t(this.css(n+"-bottom"+("border"===n?"-width":""))),left:t(this.css(n+"-left"+("border"===n?"-width":""))),right:t(this.css(n+"-right"+("border"===n?"-width":"")))}}})}(jQuery)},{}],13:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("./jQuery"),a=n(s);a["default"].fn.extend({ssDatepicker:function(e){return(0,a["default"])(this).each(function(){if(!(0,a["default"])(this).data("datepicker")){(0,a["default"])(this).siblings("button").addClass("ui-icon ui-icon-calendar");var t=((0,a["default"])(this).parents(".field.date:first"),a["default"].extend(e||{},(0,a["default"])(this).data(),(0,a["default"])(this).data("jqueryuiconfig"),{}));t.showcalendar&&(t.locale&&a["default"].datepicker.regional[t.locale]&&(t=a["default"].extend(t,a["default"].datepicker.regional[t.locale],{})), +t.min&&(t.minDate=a["default"].datepicker.parseDate("yy-mm-dd",t.min)),t.max&&(t.maxDate=a["default"].datepicker.parseDate("yy-mm-dd",t.max)),t.dateFormat=t.jquerydateformat,(0,a["default"])(this).datepicker(t))}})}}),(0,a["default"])(document).on("click",".field.date input.text,input.text.date",function(){(0,a["default"])(this).ssDatepicker(),(0,a["default"])(this).data("datepicker")&&(0,a["default"])(this).datepicker("show")})},{"./jQuery":"jQuery"}],14:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("./jQuery"),a=n(s),r=e("./i18n"),o=n(r);a["default"].entwine("ss",function(e){e(".ss-gridfield").entwine({reload:function(t,i){var n=this,s=this.closest("form"),a=this.find(":input:focus").attr("name"),r=s.find(":input").serializeArray();t||(t={}),t.data||(t.data=[]),t.data=t.data.concat(r),window.location.search&&(t.data=window.location.search.replace(/^\?/,"")+"&"+e.param(t.data)),window.history&&window.history.pushState||window.location.hash&&-1!=window.location.hash.indexOf("?")&&(t.data=window.location.hash.substring(window.location.hash.indexOf("?")+1)+"&"+e.param(t.data)),s.addClass("loading"),e.ajax(e.extend({},{headers:{"X-Pjax":"CurrentField"},type:"POST",url:this.data("url"),dataType:"html",success:function(r){if(n.empty().append(e(r).children()),a&&n.find(':input[name="'+a+'"]').focus(),n.find(".filter-header").length){var o;"show"==t.data[0].filter?(o='',n.addClass("show-filter").find(".filter-header").show()):(o='',n.removeClass("show-filter").find(".filter-header").hide()),n.find(".sortable-header th:last").html(o)}s.removeClass("loading"),i&&i.apply(this,arguments),n.trigger("reload",n)},error:function(e){alert(o["default"]._t("GRIDFIELD.ERRORINTRANSACTION")),s.removeClass("loading")}},t))},showDetailView:function(e){window.location.href=e},getItems:function(){return this.find(".ss-gridfield-item")},setState:function(e,t){var i=this.getState();i[e]=t,this.find(':input[name="'+this.data("name")+'[GridState]"]').val(JSON.stringify(i))},getState:function(){return JSON.parse(this.find(':input[name="'+this.data("name")+'[GridState]"]').val())}}),e(".ss-gridfield *").entwine({getGridField:function(){return this.closest(".ss-gridfield")}}),e(".ss-gridfield :button[name=showFilter]").entwine({onclick:function(t){e(".filter-header").show("slow").find(":input:first").focus(),this.closest(".ss-gridfield").addClass("show-filter"),this.parent().html(''),t.preventDefault()}}),e(".ss-gridfield .ss-gridfield-item").entwine({onclick:function(t){if(e(t.target).closest(".action").length)return this._super(t),!1;var i=this.find(".edit-link");i.length&&this.getGridField().showDetailView(i.prop("href"))},onmouseover:function(){this.find(".edit-link").length&&this.css("cursor","pointer")},onmouseout:function(){this.css("cursor","default")}}),e(".ss-gridfield .action").entwine({onclick:function(e){var t="show";return this.button("option","disabled")?void e.preventDefault():((this.hasClass("ss-gridfield-button-close")||!this.closest(".ss-gridfield").hasClass("show-filter"))&&(t="hidden"),this.getGridField().reload({data:[{name:this.attr("name"),value:this.val(),filter:t}]}),void e.preventDefault())}}),e(".ss-gridfield .add-existing-autocompleter").entwine({onbuttoncreate:function(){var e=this;this.toggleDisabled(),this.find('input[type="text"]').on("keyup",function(){e.toggleDisabled()})},onunmatch:function(){this.find('input[type="text"]').off("keyup")},toggleDisabled:function(){var e=this.find(".ss-ui-button"),t=this.find('input[type="text"]'),i=""!==t.val(),n=e.is(":disabled");(i&&n||!i&&!n)&&e.button("option","disabled",!n)}}),e(".ss-gridfield .col-buttons .action.gridfield-button-delete, .cms-edit-form .Actions button.action.action-delete").entwine({onclick:function(e){return confirm(o["default"]._t("TABLEFIELD.DELETECONFIRMMESSAGE"))?void this._super(e):(e.preventDefault(),!1)}}),e(".ss-gridfield .action.gridfield-button-print").entwine({UUID:null,onmatch:function(){this._super(),this.setUUID((new Date).getTime())},onunmatch:function(){this._super()},onclick:function(t){var i=this.closest(":button"),n=this.getGridField(),s=this.closest("form"),a=s.find(":input.gridstate").serialize();a+="&"+encodeURIComponent(i.attr("name"))+"="+encodeURIComponent(i.val()),window.location.search&&(a=window.location.search.replace(/^\?/,"")+"&"+a);var r=-1==n.data("url").indexOf("?")?"?":"&",o=e.path.makeUrlAbsolute(n.data("url")+r+a,e("base").attr("href"));window.open(o);return!1}}),e(".ss-gridfield-print-iframe").entwine({onmatch:function(){this._super(),this.hide().bind("load",function(){this.focus();var e=this.contentWindow||this;e.print()})},onunmatch:function(){this._super()}}),e(".ss-gridfield .action.no-ajax").entwine({onclick:function(t){var i=this.closest(":button"),n=this.getGridField(),s=this.closest("form"),a=s.find(":input.gridstate").serialize();a+="&"+encodeURIComponent(i.attr("name"))+"="+encodeURIComponent(i.val()),window.location.search&&(a=window.location.search.replace(/^\?/,"")+"&"+a);var r=-1==n.data("url").indexOf("?")?"?":"&";return window.location.href=e.path.makeUrlAbsolute(n.data("url")+r+a,e("base").attr("href")),!1}}),e(".ss-gridfield .action-detail").entwine({onclick:function(){return this.getGridField().showDetailView(e(this).prop("href")),!1}}),e(".ss-gridfield[data-selectable]").entwine({getSelectedItems:function(){return this.find(".ss-gridfield-item.ui-selected")},getSelectedIDs:function(){return e.map(this.getSelectedItems(),function(t){return e(t).data("id")})}}),e(".ss-gridfield[data-selectable] .ss-gridfield-items").entwine({onadd:function(){this._super(),this.selectable()},onremove:function(){this._super(),this.data("selectable")&&this.selectable("destroy")}}),e(".ss-gridfield .filter-header :input").entwine({onmatch:function(){var e=this.closest(".fieldgroup").find(".ss-gridfield-button-filter"),t=this.closest(".fieldgroup").find(".ss-gridfield-button-reset");this.val()&&(e.addClass("filtered"),t.addClass("filtered")),this._super()},onunmatch:function(){this._super()},onkeydown:function(e){if(!this.closest(".ss-gridfield-button-reset").length){var t=this.closest(".fieldgroup").find(".ss-gridfield-button-filter"),i=this.closest(".fieldgroup").find(".ss-gridfield-button-reset");if("13"==e.keyCode){var n=this.closest(".filter-header").find(".ss-gridfield-button-filter"),s="show";return(this.hasClass("ss-gridfield-button-close")||!this.closest(".ss-gridfield").hasClass("show-filter"))&&(s="hidden"),this.getGridField().reload({data:[{name:n.attr("name"),value:n.val(),filter:s}]}),!1}t.addClass("hover-alike"),i.addClass("hover-alike")}}}),e(".ss-gridfield .relation-search").entwine({onfocusin:function(t){this.autocomplete({source:function(t,i){var n=e(this.element);e(this.element).closest("form");e.ajax({headers:{"X-Pjax":"Partial"},type:"GET",url:e(n).data("searchUrl"),data:encodeURIComponent(n.attr("name"))+"="+encodeURIComponent(n.val()),success:function(e){i(JSON.parse(e))},error:function(e){alert(o["default"]._t("GRIDFIELD.ERRORINTRANSACTION","An error occured while fetching data from the server\n Please try again later."))}})},select:function(t,i){e(this).closest(".ss-gridfield").find("#action_gridfield_relationfind").replaceWith('');var n=e(this).closest(".ss-gridfield").find("#action_gridfield_relationadd");n.data("button")?n.button("enable"):n.removeAttr("disabled")}})}}),e(".ss-gridfield .pagination-page-number input").entwine({onkeydown:function(t){if(13==t.keyCode){var i=parseInt(e(this).val(),10),n=e(this).getGridField();return n.setState("GridFieldPaginator",{currentPage:i}),n.reload(),!1}}})})},{"./i18n":"i18n","./jQuery":"jQuery"}],15:[function(require,module,exports){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}var _jQuery=require("./jQuery"),_jQuery2=_interopRequireDefault(_jQuery),_i18n=require("./i18n"),_i18n2=_interopRequireDefault(_i18n),ss="undefined"!=typeof window.ss?window.ss:{};ss.editorWrappers={},ss.editorWrappers.tinyMCE=function(){var instance;return{init:function(e){ss.editorWrappers.tinyMCE.initialized||(tinyMCE.init(e),ss.editorWrappers.tinyMCE.initialized=!0)},getInstance:function(){return this.instance},onopen:function(){},onclose:function(){},save:function(){tinyMCE.triggerSave()},create:function(e,t){this.instance=new tinymce.Editor(e,t),this.instance.onInit.add(function(e){if(!ss.editorWrappers.tinyMCE.patched){var t=tinymce.themes.AdvancedTheme.prototype.destroy;tinymce.themes.AdvancedTheme.prototype.destroy=function(){t.apply(this,arguments),this.statusKeyboardNavigation&&(this.statusKeyboardNavigation.destroy(),this.statusKeyboardNavigation=null)},ss.editorWrappers.tinyMCE.patched=!0}if(jQuery(e.getElement()).trigger("editorinit"),e.settings.update_interval){var i;jQuery(e.getBody()).on("focus",function(){i=setInterval(function(){var t=jQuery(e.getElement());e.isDirty()&&t.val(e.getContent({format:"raw",no_events:1}))},e.settings.update_interval)}),jQuery(e.getBody()).on("blur",function(){clearInterval(i)})}}),this.instance.onChange.add(function(e,t){e.save(),jQuery(e.getElement()).trigger("change")}),this.instance.render()},repaint:function(){tinyMCE.execCommand("mceRepaint")},isDirty:function(){return this.getInstance().isDirty()},getContent:function(){return this.getInstance().getContent()},getDOM:function(){return this.getInstance().dom},getContainer:function(){return this.getInstance().getContainer()},getSelectedNode:function(){return this.getInstance().selection.getNode()},selectNode:function(e){this.getInstance().selection.select(e)},setContent:function(e,t){this.getInstance().execCommand("mceSetContent",!1,e,t)},insertContent:function(e,t){this.getInstance().execCommand("mceInsertContent",!1,e,t)},replaceContent:function(e,t){this.getInstance().execCommand("mceReplaceContent",!1,e,t)},insertLink:function(e,t){this.getInstance().execCommand("mceInsertLink",!1,e,t)},removeLink:function(){this.getInstance().execCommand("unlink",!1)},cleanLink:function cleanLink(href,node){var cb=tinyMCE.settings.urlconverter_callback;return cb&&(href=eval(cb+"(href, node, true);")),href.match(new RegExp("^"+tinyMCE.settings.document_base_url+"(.*)$"))&&(href=RegExp.$1),href.match(/^javascript:\s*mctmp/)&&(href=""),href},createBookmark:function(){return this.getInstance().selection.getBookmark()},moveToBookmark:function(e){this.getInstance().selection.moveToBookmark(e),this.getInstance().focus()},blur:function(){this.getInstance().selection.collapse()},addUndo:function(){this.getInstance().undoManager.add()}}},ss.editorWrappers["default"]=ss.editorWrappers.tinyMCE,_jQuery2["default"].entwine("ss",function(e){e("textarea.htmleditor").entwine({Editor:null,onadd:function(){var e=this.data("editor")||"default",t=ss.editorWrappers[e]();this.setEditor(t),"undefined"!=typeof ssTinyMceConfig&&this.redraw(),this._super()},onremove:function(){var t=tinyMCE.get(this.attr("id"));if(t){try{t.remove()}catch(i){}try{t.destroy()}catch(i){}this.next(".mceEditor").remove(),e.each(jQuery.cache,function(){var t=this.handle&&this.handle.elem;if(t){var i=t;try{for(;i&&1==i.nodeType;)i=i.parentNode}catch(n){}i||e(t).unbind().remove()}})}this._super()},getContainingForm:function(){return this.closest("form")},fromWindow:{onload:function(){this.redraw()}},redraw:function(){var e=ssTinyMceConfig[this.data("config")],t=this.getEditor();t.init(e),t.create(this.attr("id"),e),this._super()},"from .cms-edit-form":{onbeforesubmitform:function(e){this.getEditor().save(),this._super()}},oneditorinit:function(){var t=e(this.getEditor().getInstance().getContainer());setTimeout(function(){t.show()},10)},"from .cms-container":{onbeforestatechange:function(){this.css("visibility","hidden");var e=this.getEditor(),t=e&&e.getInstance()?e.getContainer():null;t&&t.length&&t.remove()}},isChanged:function(){var e=this.getEditor();return e&&e.getInstance()&&e.isDirty()},resetChanged:function(){this.getEditor();if("undefined"!=typeof tinyMCE){var e=tinyMCE.getInstanceById(this.attr("id"));e&&(e.startContent=tinymce.trim(e.getContent({format:"raw",no_events:1})))}},openLinkDialog:function(){this.openDialog("link")},openMediaDialog:function(){this.openDialog("media")},openDialog:function(t){var i=function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},n=this,s=e("#cms-editor-dialogs").data("url"+i(t)+"form"),a=e(".htmleditorfield-"+t+"dialog");a.length?(a.getForm().setElement(this),a.open()):(a=e('")[0],g=t.each;f.style.cssText="background-color:rgba(1,1,1,.5)",p.rgba=f.style.backgroundColor.indexOf("rgba")>-1,g(d,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),c.fn=t.extend(c.prototype,{parse:function(a,o,l,h){if(a===i)return this._rgba=[null,null,null,null],this;(a.jquery||a.nodeType)&&(a=t(a).css(o),o=i);var u=this,p=t.type(a),f=this._rgba=[];return o!==i&&(a=[a,o,l,h],p="array"),"string"===p?this.parse(s(a)||r._default):"array"===p?(g(d.rgba.props,function(e,t){f[t.idx]=n(a[t.idx],t)}),this):"object"===p?(a instanceof c?g(d,function(e,t){a[t.cache]&&(u[t.cache]=a[t.cache].slice())}):g(d,function(t,i){var s=i.cache;g(i.props,function(e,t){if(!u[s]&&i.to){if("alpha"===e||null==a[e])return;u[s]=i.to(u._rgba)}u[s][t.idx]=n(a[e],t,!0)}),u[s]&&e.inArray(null,u[s].slice(0,3))<0&&(u[s][3]=1,i.from&&(u._rgba=i.from(u[s])))}),this):void 0},is:function(e){var t=c(e),i=!0,n=this;return g(d,function(e,s){var a,r=t[s.cache];return r&&(a=n[s.cache]||s.to&&s.to(n._rgba)||[],g(s.props,function(e,t){return null!=r[t.idx]?i=r[t.idx]===a[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return g(d,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var i=c(e),s=i._space(),a=d[s],r=0===this.alpha()?c("transparent"):this,o=r[a.cache]||a.to(r._rgba),l=o.slice();return i=i[a.cache],g(a.props,function(e,s){var a=s.idx,r=o[a],h=i[a],c=u[s.type]||{};null!==h&&(null===r?l[a]=h:(c.mod&&(h-r>c.mod/2?r+=c.mod:r-h>c.mod/2&&(r-=c.mod)),l[a]=n((h-r)*t+r,s)))}),this[s](l)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),s=c(e)._rgba;return c(t.map(i,function(e,t){return(1-n)*s[t]+n*e}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),n=i.pop();return e&&i.push(~~(255*n)),"#"+t.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),c.fn.parse.prototype=c.fn,d.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,s=e[1]/255,a=e[2]/255,r=e[3],o=Math.max(n,s,a),l=Math.min(n,s,a),h=o-l,c=o+l,d=.5*c;return t=l===o?0:n===o?60*(s-a)/h+360:s===o?60*(a-n)/h+120:60*(n-s)/h+240,i=0===d||1===d?d:.5>=d?h/c:h/(2-c),[Math.round(t)%360,i,d,null==r?1:r]},d.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],s=e[3],r=.5>=n?n*(1+i):n+i-n*i,o=2*n-r;return[Math.round(255*a(o,r,t+1/3)),Math.round(255*a(o,r,t)),Math.round(255*a(o,r,t-1/3)),s]},g(d,function(e,s){var a=s.props,r=s.cache,o=s.to,h=s.from;c.fn[e]=function(e){if(o&&!this[r]&&(this[r]=o(this._rgba)),e===i)return this[r].slice();var s,l=t.type(e),d="array"===l||"object"===l?e:arguments,u=this[r].slice();return g(a,function(e,t){var i=d["object"===l?e:t.idx];null==i&&(i=u[t.idx]),u[t.idx]=n(i,t)}),h?(s=c(h(u)),s[r]=u,s):c(u)},g(a,function(i,n){c.fn[i]||(c.fn[i]=function(s){var a,r=t.type(s),o="alpha"===i?this._hsla?"hsla":"rgba":e,h=this[o](),c=h[n.idx];return"undefined"===r?c:("function"===r&&(s=s.call(this,c),r=t.type(s)),null==s&&n.empty?this:("string"===r&&(a=l.exec(s),a&&(s=c+parseFloat(a[2])*("+"===a[1]?1:-1))),h[n.idx]=s,this[o](h)))})})}),g(o,function(e,i){t.cssHooks[i]={set:function(e,n){var a,r,o="";if("string"!==t.type(n)||(a=s(n))){if(n=c(a||n),!p.rgba&&1!==n._rgba[3]){for(r="backgroundColor"===i?e.parentNode:e;(""===o||"transparent"===o)&&r&&r.style;)try{o=t.css(r,"backgroundColor"),r=r.parentNode}catch(l){}n=n.blend(o&&"transparent"!==o?o:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=c(e.elem,i),e.end=c(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}}),t.cssHooks.borderColor={expand:function(e){var t={};return g(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},r=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(){var t,i,n=this.ownerDocument.defaultView?this.ownerDocument.defaultView.getComputedStyle(this,null):this.currentStyle,s={};if(n&&n.length&&n[0]&&n[n[0]])for(i=n.length;i--;)t=n[i],"string"==typeof n[t]&&(s[e.camelCase(t)]=n[t]);else for(t in n)"string"==typeof n[t]&&(s[t]=n[t]);return s}function n(t,i){var n,s,r={};for(n in i)s=i[n],t[n]!==s&&(a[n]||(e.fx.step[n]||!isNaN(parseFloat(s)))&&(r[n]=s));return r}var s=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.effects.animateClass=function(t,a,r,o){var l=e.speed(a,r,o);return this.queue(function(){var a,r=e(this),o=r.attr("class")||"",h=l.children?r.find("*").andSelf():r;h=h.map(function(){var t=e(this);return{el:t,start:i.call(this)}}),a=function(){e.each(s,function(e,i){t[i]&&r[i+"Class"](t[i])})},a(),h=h.map(function(){return this.end=i.call(this.el[0]),this.diff=n(this.start,this.end),this}),r.attr("class",o),h=h.map(function(){var t=this,i=e.Deferred(),n=jQuery.extend({},l,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,n),i.promise()}),e.when.apply(e,h.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),l.complete.call(r[0])})})},e.fn.extend({_addClass:e.fn.addClass,addClass:function(t,i,n,s){return i?e.effects.animateClass.call(this,{add:t},i,n,s):this._addClass(t)},_removeClass:e.fn.removeClass,removeClass:function(t,i,n,s){return i?e.effects.animateClass.call(this,{remove:t},i,n,s):this._removeClass(t)},_toggleClass:e.fn.toggleClass,toggleClass:function(i,n,s,a,r){return"boolean"==typeof n||n===t?s?e.effects.animateClass.call(this,n?{add:i}:{remove:i},s,a,r):this._toggleClass(i,n):e.effects.animateClass.call(this,{toggle:i},n,s,a)},switchClass:function(t,i,n,s,a){return e.effects.animateClass.call(this,{add:i,remove:t},n,s,a)}})}(),function(){function s(t,i,n,s){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(s=i,n=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(s=n,n=i,i={}),e.isFunction(n)&&(s=n,n=null),i&&e.extend(t,i),n=n||i.duration,t.duration=e.fx.off?0:"number"==typeof n?n:n in e.fx.speeds?e.fx.speeds[n]:e.fx.speeds._default,t.complete=s||i.complete,t}function a(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?!1:i&&e.effects[t]?!1:!0}e.extend(e.effects,{version:"1.9.2",save:function(e,t){for(var i=0;i
t |