mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
1 line
257 KiB
Plaintext
1 line
257 KiB
Plaintext
{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","admin/javascript/src/LeftAndMain.ActionTabSet.js","admin/javascript/src/LeftAndMain.BatchActions.js","admin/javascript/src/LeftAndMain.Content.js","admin/javascript/src/LeftAndMain.EditForm.js","admin/javascript/src/LeftAndMain.FieldDescriptionToggle.js","admin/javascript/src/LeftAndMain.FieldHelp.js","admin/javascript/src/LeftAndMain.Layout.js","admin/javascript/src/LeftAndMain.Menu.js","admin/javascript/src/LeftAndMain.Panel.js","admin/javascript/src/LeftAndMain.Preview.js","admin/javascript/src/LeftAndMain.Tree.js","admin/javascript/src/LeftAndMain.TreeDropdownField.js","admin/javascript/src/LeftAndMain.js","admin/javascript/src/bundles/legacy.js"],"names":[],"mappings":"AAAA;;;ACQA;;;;;;AAEA,iBAAE,OAAF,CAAU,IAAV,EAAgB,UAAS,CAAT,EAAY;AAM3B,GAAE,gCAAF,EAAoC,OAApC,CAA4C;AAE3C,kBAAgB,IAAhB;;AAEA,SAAO,iBAAW;AAEjB,QAAK,MAAL,GAFiB;;AAIjB,QAAK,IAAL,CAAU,EAAC,eAAe,IAAf,EAAqB,UAAU,KAAV,EAAhC,EAJiB;GAAX;;AAOP,YAAU,oBAAW;AAIpB,OAAI,QAAQ,EAAE,gBAAF,EAAoB,IAApB,CAAyB,QAAzB,CAAR,CAJgB;AAKpB,SAAM,IAAN,CAAW,UAAS,KAAT,EAAgB,MAAhB,EAAuB;AACjC,QAAI;AACH,OAAE,MAAF,EAAU,QAAV,GAAqB,GAArB,CAAyB,2BAAzB,EADG;KAAJ,CAEE,OAAO,CAAP,EAAU;AACX,aAAQ,IAAR,CAAa,mDAAb,EADW;KAAV;IAHQ,CAAX,CALoB;AAYpB,KAAE,QAAF,EAAY,GAAZ,CAAgB,2BAAhB,EAZoB;;AAcpB,QAAK,MAAL,GAd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Q,kCAAR;AACA,QAAQ,mCAAR;AACA,QAAQ,+BAAR;AACA,QAAQ,kCAAR;AACA,QAAQ,uCAAR;AACA,QAAQ,oCAAR;AACA,QAAQ,iDAAR;AACA,QAAQ,4CAAR","file":"bundle-legacy.js","sourceRoot":"/source/","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","/**\n * File: LeftAndMain.ActionTabset.js\n *\n * Contains rules for .ss-ui-action-tabset, used for:\n * * Site tree action tabs (to perform actions on the site tree)\n * * Actions menu (Edit page actions)\n *\n */\nimport $ from 'jQuery';\n\n$.entwine('ss', function($) {\n\t/**\n\t * Generic rules for all ss-ui-action-tabsets\n\t * * ActionMenus\n\t * * SiteTree ActionTabs\n\t */\n\t$('.ss-tabset.ss-ui-action-tabset').entwine({\n\t\t// Ignore tab state so it will not be reopened on form submission.\n\t\tIgnoreTabState: true,\n\n\t\tonadd: function() {\n\t\t\t// Make sure the .ss-tabset is already initialised to apply our modifications on top.\n\t\t\tthis._super();\n\t\t\t//Set actionTabs to allow closing and be closed by default\n\t\t\tthis.tabs({'collapsible': true, 'active': false});\n\t\t},\n\n\t\tonremove: function() {\n\t\t\t// Remove all bound events.\n\t\t\t// This guards against an edge case where the click handlers are not unbound\n\t\t\t// because the panel is still open when the ajax edit form reloads.\n\t\t\tvar frame = $('.cms-container').find('iframe');\n\t\t\tframe.each(function(index, iframe){\n\t\t\t\ttry {\n\t\t\t\t\t$(iframe).contents().off('click.ss-ui-action-tabset');\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.warn('Unable to access iframe, possible https mis-match');\n\t\t\t\t}\n\t\t\t});\n\t\t\t$(document).off('click.ss-ui-action-tabset');\n\n\t\t\tthis._super();\n\t\t},\n\n\t\t/**\n\t\t * Deal with available vertical space\n\t\t */\n\t\t'ontabsbeforeactivate': function(event, ui) {\n\t\t\tthis.riseUp(event, ui);\n\t\t},\n\n\t\t/**\n\t\t * Handle opening and closing tabs\n\t\t */\n\t\tonclick: function(event, ui) {\n\t\t\tthis.attachCloseHandler(event, ui);\n\t\t},\n\n\t\t/**\n\t\t * Generic function to close open tabs. Stores event in a handler,\n\t\t * and removes the bound event once activated.\n\t\t *\n\t\t * Note: Should be called by a click event attached to 'this'\n\t\t */\n\t\tattachCloseHandler: function(event, ui) {\n\t\t\tvar that = this, frame = $('.cms-container').find('iframe'), closeHandler;\n\n\t\t\t// Create a handler for the click event so we can close tabs\n\t\t\t// and easily remove the event once done\n\t\t\tcloseHandler = function(event) {\n\t\t\t\tvar panel, frame;\n\t\t\t\tpanel = $(event.target).closest('.ss-ui-action-tabset .ui-tabs-panel');\n\n\t\t\t\t// If anything except the ui-nav button or panel is clicked,\n\t\t\t\t// close panel and remove handler. We can't close if click was\n\t\t\t\t// within panel, as it might've caused a button action,\n\t\t\t\t// and we need to show its loading indicator.\n\t\t\t\tif (!$(event.target).closest(that).length && !panel.length) {\n\t\t\t\t\tthat.tabs('option', 'active', false); // close tabs\n\n\t\t\t\t\t// remove click event from objects it is bound to (iframe's and document)\n\t\t\t\t\tframe = $('.cms-container').find('iframe');\n\t\t\t\t\tframe.each(function(index, iframe){\n\t\t\t\t\t\t$(iframe).contents().off('click.ss-ui-action-tabset', closeHandler);\n\t\t\t\t\t});\n\t\t\t\t\t$(document).off('click.ss-ui-action-tabset', closeHandler);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Bind click event to document, and use closeHandler to handle the event\n\t\t\t$(document).on('click.ss-ui-action-tabset', closeHandler);\n\t\t\t// Make sure iframe click also closes tab\n\t\t\t// iframe needs a special case, else the click event will not register here\n\t\t\tif(frame.length > 0){\n\t\t\t\tframe.each(function(index, iframe) {\n\t\t\t\t\t$(iframe).contents().on('click.ss-ui-action-tabset', closeHandler);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Function riseUp checks to see if a tab should be opened upwards\n\t\t * (based on space concerns). If true, the rise-up class is applied\n\t\t * and a new position is calculated and applied to the element.\n\t\t *\n\t\t * Note: Should be called by a tabsbeforeactivate event\n\t\t */\n\t\triseUp: function(event, ui) {\n\t\t\tvar elHeight, trigger, endOfWindow, elPos, activePanel, activeTab, topPosition, containerSouth, padding;\n\n\t\t\t// Get the numbers needed to calculate positions\n\t\t\telHeight = $(this).find('.ui-tabs-panel').outerHeight();\n\t\t\ttrigger = $(this).find('.ui-tabs-nav').outerHeight();\n\t\t\tendOfWindow = ($(window).height() + $(document).scrollTop()) - trigger;\n\t\t\telPos = $(this).find('.ui-tabs-nav').offset().top;\n\n\t\t\tactivePanel = ui.newPanel;\n\t\t\tactiveTab = ui.newTab;\n\n\t\t\tif (elPos + elHeight >= endOfWindow && elPos - elHeight > 0){\n\t\t\t\tthis.addClass('rise-up');\n\n\t\t\t\tif (activeTab.position() !== null){\n\t\t\t\t\ttopPosition = -activePanel.outerHeight();\n\t\t\t\t\tcontainerSouth = activePanel.parents('.south');\n\t\t\t\t\tif (containerSouth){\n\t\t\t\t\t\t// If container is the southern panel, make tab appear from the top of the container\n\t\t\t\t\t\tpadding = activeTab.offset().top - containerSouth.offset().top;\n\t\t\t\t\t\ttopPosition = topPosition-padding;\n\t\t\t\t\t}\n\t\t\t\t\t$(activePanel).css('top',topPosition+\"px\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// else remove the rise-up class and set top to 0\n\t\t\t\tthis.removeClass('rise-up');\n\t\t\t\tif (activeTab.position() !== null){\n\t\t\t\t\t$(activePanel).css('top','0px');\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t});\n\n\n\t/**\n\t * ActionMenus\n\t * * Specific rules for ActionMenus, used for edit page actions\n\t */\n\t$('.cms-content-actions .ss-tabset.ss-ui-action-tabset').entwine({\n\t\t/**\n\t\t * Make necessary adjustments before tab is activated\n\t\t */\n\t\t'ontabsbeforeactivate': function(event, ui) {\n\t\t\tthis._super(event, ui);\n\t\t\t//Set the position of the opening tab (if it exists)\n\t\t\tif($(ui.newPanel).length > 0){\n\t\t\t\t$(ui.newPanel).css('left', ui.newTab.position().left+\"px\");\n\t\t\t}\n\t\t}\n\t});\n\n\t/**\n\t * SiteTree ActionTabs\n\t * Specific rules for site tree action tabs. Applies to tabs\n\t * within the expanded content area, and within the sidebar\n\t */\n\t$('.cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({\n\t\t/**\n\t\t * Make necessary adjustments before tab is activated\n\t\t */\n\t\t'ontabsbeforeactivate': function(event, ui) {\n\t\t\tthis._super(event, ui);\n\t\t\t// Remove tabset open classes (Last gets a unique class\n\t\t\t// in the bigger sitetree. Remove this if we have it)\n\t\t\t$(this).closest('.ss-ui-action-tabset')\n\t\t\t\t\t.removeClass('tabset-open tabset-open-last');\n\t\t}\n\t});\n\n\t/**\n\t * SiteTree ActionTabs: expanded\n\t * * Specific rules for siteTree actions within the expanded content area.\n\t */\n\t$('.cms-content-fields .ss-tabset.ss-ui-action-tabset').entwine({\n\t\t/**\n\t\t * Make necessary adjustments before tab is activated\n\t\t */\n\t\t'ontabsbeforeactivate': function(event, ui) {\n\t\t\tthis._super(event, ui);\n\t\t\tif($( ui.newPanel).length > 0){\n\t\t\t\tif($(ui.newTab).hasClass(\"last\")){\n\t\t\t\t\t// Align open tab to the right (because opened tab is last)\n\t\t\t\t\t$(ui.newPanel).css({'left': 'auto', 'right': '0px'});\n\n\t\t\t\t\t// Last needs to be styled differently when open, so apply a unique class\n\t\t\t\t\t$(ui.newPanel).parent().addClass('tabset-open-last');\n\t\t\t\t}else{\n\t\t\t\t\t// Assign position to tabpanel based on position of relivent active tab item\n\t\t\t\t\t$(ui.newPanel).css('left', ui.newTab.position().left+\"px\");\n\n\t\t\t\t\t// If this is the first tab, make sure the position doesn't include border\n\t\t\t\t\t// (hard set position to 0 ), and add the tab-set open class\n\t\t\t\t\tif($(ui.newTab).hasClass(\"first\")){\n\t\t\t\t\t\t$(ui.newPanel).css('left',\"0px\");\n\t\t\t\t\t\t$(ui.newPanel).parent().addClass('tabset-open');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t/**\n\t * SiteTree ActionTabs: sidebar\n\t * * Specific rules for when the site tree actions panel appears in\n\t * * the side-bar\n\t */\n\t$('.cms-tree-view-sidebar .cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({\n\n\t\t// If actions panel is within the sidebar, apply active class\n\t\t// to help animate open/close on hover\n\t\t'from .ui-tabs-nav li': {\n\t\t\tonhover: function(e) {\n\t\t\t\t$(e.target).parent().find('li .active').removeClass('active');\n\t\t\t\t$(e.target).find('a').addClass('active');\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Make necessary adjustments before tab is activated\n\t\t */\n\t\t'ontabsbeforeactivate': function(event, ui) {\n\t\t\tthis._super(event, ui);\n\t\t\t// Reset position of tabs, else anyone going between the large\n\t\t\t// and the small sitetree will see broken tabs\n\t\t\t// Apply styles with .css, to avoid overriding currently applied styles\n\t\t\t$(ui.newPanel).css({'left': 'auto', 'right': 'auto'});\n\n\t\t\tif($(ui.newPanel).length > 0){\n\t\t\t\t$(ui.newPanel).parent().addClass('tabset-open');\n\t\t\t}\n\t\t}\n\t});\n\n});\n","/**\n * File: LeftAndMain.BatchActions.js\n */\nimport $ from 'jQuery';\nimport i18n from 'i18n';\n\n$.entwine('ss.tree', function($){\n\n\t/**\n\t * Class: #Form_BatchActionsForm\n\t * \n\t * Batch actions which take a bunch of selected pages,\n\t * usually from the CMS tree implementation, and perform serverside\n\t * callbacks on the whole set. We make the tree selectable when the jQuery.UI tab\n\t * enclosing this form is opened.\n\t * \n\t * Events:\n\t * register - Called before an action is added.\n\t * unregister - Called before an action is removed.\n\t */\n\t$('#Form_BatchActionsForm').entwine({\n\n\t\t/**\n\t\t * Variable: Actions\n\t\t * (Array) Stores all actions that can be performed on the collected IDs as\n\t\t * function closures. This might trigger filtering of the selected IDs,\n\t\t * a confirmation message, etc.\n\t\t */\n\t\tActions: [],\n\n\t\tgetTree: function() {\n\t\t\treturn $('.cms-tree');\n\t\t},\n\n\t\tfromTree: {\n\t\t\toncheck_node: function(e, data){\n\t\t\t\tthis.serializeFromTree();\n\t\t\t},\n\t\t\tonuncheck_node: function(e, data){\n\t\t\t\tthis.serializeFromTree();\n\t\t\t}\n\t\t},\n\t\t\n\t\t/**\n\t\t * @func registerDefault\n\t\t * @desc Register default bulk confirmation dialogs\n\t\t */\n\t\tregisterDefault: function() {\n\t\t\t// Publish selected pages action\n\t\t\tthis.register('admin/pages/batchactions/publish', function(ids) {\n\t\t\t\tvar confirmed = confirm(\n\t\t\t\t\ti18n.inject(\n\t\t\t\t\t\ti18n._t(\n\t\t\t\t\t\t\t\"CMSMAIN.BATCH_PUBLISH_PROMPT\",\n\t\t\t\t\t\t\t\"You have {num} page(s) selected.\\n\\nDo you really want to publish?\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{'num': ids.length}\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn (confirmed) ? ids : false;\n\t\t\t});\n\n\t\t\t// Unpublish selected pages action\n\t\t\tthis.register('admin/pages/batchactions/unpublish', function(ids) {\n\t\t\t\tvar confirmed = confirm(\n\t\t\t\t\ti18n.inject(\n\t\t\t\t\t\ti18n._t(\n\t\t\t\t\t\t\t\"CMSMAIN.BATCH_UNPUBLISH_PROMPT\",\n\t\t\t\t\t\t\t\"You have {num} page(s) selected.\\n\\nDo you really want to unpublish\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{'num': ids.length}\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn (confirmed) ? ids : false;\n\t\t\t});\n\n\t\t\t// Delete selected pages action\n\t\t\t// @deprecated since 4.0 Use archive instead\n\t\t\tthis.register('admin/pages/batchactions/delete', function(ids) {\n\t\t\t\tvar confirmed = confirm(\n\t\t\t\t\ti18n.inject(\n\t\t\t\t\t\ti18n._t(\n\t\t\t\t\t\t\t\"CMSMAIN.BATCH_DELETE_PROMPT\",\n\t\t\t\t\t\t\t\"You have {num} page(s) selected.\\n\\nDo you really want to delete?\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{'num': ids.length}\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn (confirmed) ? ids : false;\n\t\t\t});\n\n\t\t\t// Delete selected pages action\n\t\t\tthis.register('admin/pages/batchactions/archive', function(ids) {\n\t\t\t\tvar confirmed = confirm(\n\t\t\t\t\ti18n.inject(\n\t\t\t\t\t\ti18n._t(\n\t\t\t\t\t\t\t\"CMSMAIN.BATCH_ARCHIVE_PROMPT\",\n\t\t\t\t\t\t\t\"You have {num} page(s) selected.\\n\\nAre you sure you want to archive these pages?\\n\\nThese pages and all of their children pages will be unpublished and sent to the archive.\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{'num': ids.length}\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn (confirmed) ? ids : false;\n\t\t\t});\n\n\t\t\t// Restore selected archived pages\n\t\t\tthis.register('admin/pages/batchactions/restore', function(ids) {\n\t\t\t\tvar confirmed = confirm(\n\t\t\t\t\ti18n.inject(\n\t\t\t\t\t\ti18n._t(\n\t\t\t\t\t\t\t\"CMSMAIN.BATCH_RESTORE_PROMPT\",\n\t\t\t\t\t\t\t\"You have {num} page(s) selected.\\n\\nDo you really want to restore to stage?\\n\\nChildren of archived pages will be restored to the root level, unless those pages are also being restored.\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{'num': ids.length}\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn (confirmed) ? ids : false;\n\t\t\t});\n\n\t\t\t// Delete selected pages from live action\n\t\t\tthis.register('admin/pages/batchactions/deletefromlive', function(ids) {\n\t\t\t\tvar confirmed = confirm(\n\t\t\t\t\ti18n.inject(\n\t\t\t\t\t\ti18n._t(\n\t\t\t\t\t\t\t\"CMSMAIN.BATCH_DELETELIVE_PROMPT\",\n\t\t\t\t\t\t\t\"You have {num} page(s) selected.\\n\\nDo you really want to delete these pages from live?\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{'num': ids.length}\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn (confirmed) ? ids : false;\n\t\t\t});\n\t\t},\n\n\t\tonadd: function() {\n\t\t\tthis.registerDefault();\n\t\t\tthis._super();\n\t\t},\n\n\t\t/**\n\t\t * @func register\n\t\t * @param {string} type\n\t\t * @param {function} callback\n\t\t */\n\t\tregister: function(type, callback) {\n\t\t\tthis.trigger('register', {type: type, callback: callback});\n\t\t\tvar actions = this.getActions();\n\t\t\tactions[type] = callback;\n\t\t\tthis.setActions(actions);\n\t\t},\n\n\t\t/**\n\t\t * @func unregister\n\t\t * @param {string} type\n\t\t * @desc Remove an existing action.\n\t\t */\n\t\tunregister: function(type) {\n\t\t\tthis.trigger('unregister', {type: type});\n\n\t\t\tvar actions = this.getActions();\n\t\t\tif(actions[type]) delete actions[type];\n\t\t\tthis.setActions(actions);\n\t\t},\n\n\t\t/**\n\t\t * @func refreshSelected\n\t\t * @param {object} rootNode\n\t\t * @desc Ajax callbacks determine which pages is selectable in a certain batch action.\n\t\t */\n\t\trefreshSelected : function(rootNode) {\n\t\t\tvar self = this,\n\t\t\t\tst = this.getTree(),\n\t\t\t\tids = this.getIDs(),\n\t\t\t\tallIds = [],\n\t\t\t\tviewMode = $('.cms-content-batchactions-button'),\n\t\t\t\tactionUrl = this.find(':input[name=Action]').val();\n\t\t\n\t\t\t// Default to refreshing the entire tree\n\t\t\tif(rootNode == null) rootNode = st;\n\n\t\t\tfor(var idx in ids) {\n\t\t\t\t$($(st).getNodeByID(idx)).addClass('selected').attr('selected', 'selected');\n\t\t\t}\n\n\t\t\t// If no action is selected, enable all nodes\n\t\t\tif(!actionUrl || actionUrl == -1 || !viewMode.hasClass('active')) {\n\t\t\t\t$(rootNode).find('li').each(function() {\n\t\t\t\t\t$(this).setEnabled(true);\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Disable the nodes while the ajax request is being processed\n\t\t\t$(rootNode).find('li').each(function() {\n\t\t\t\tallIds.push($(this).data('id'));\n\t\t\t\t$(this).addClass('treeloading').setEnabled(false);\n\t\t\t});\n\t\t\t\n\t\t\t// Post to the server to ask which pages can have this batch action applied\n\t\t\t// Retain existing query parameters in URL before appending path\n\t\t\tvar actionUrlParts = $.path.parseUrl(actionUrl);\n\t\t\tvar applicablePagesUrl = actionUrlParts.hrefNoSearch + '/applicablepages/';\n\t\t\tapplicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, actionUrlParts.search);\n\t\t\tapplicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, {csvIDs: allIds.join(',')});\n\t\t\tjQuery.getJSON(applicablePagesUrl, function(applicableIDs) {\n\t\t\t\t// Set a CSS class on each tree node indicating which can be batch-actioned and which can't\n\t\t\t\tjQuery(rootNode).find('li').each(function() {\n\t\t\t\t\t$(this).removeClass('treeloading');\n\n\t\t\t\t\tvar id = $(this).data('id');\n\t\t\t\t\tif(id == 0 || $.inArray(id, applicableIDs) >= 0) {\n\t\t\t\t\t\t$(this).setEnabled(true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// De-select the node if it's non-applicable\n\t\t\t\t\t\t$(this).removeClass('selected').setEnabled(false);\n\t\t\t\t\t\t$(this).prop('selected', false);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tself.serializeFromTree();\n\t\t\t});\n\t\t},\n\t\t\n\t\t/**\n\t\t * @func serializeFromTree\n\t\t * @return {boolean}\n\t\t */\n\t\tserializeFromTree: function() {\n\t\t\tvar tree = this.getTree(), ids = tree.getSelectedIDs();\n\t\t\t\n\t\t\t// write IDs to the hidden field\n\t\t\tthis.setIDs(ids);\n\t\t\t\n\t\t\treturn true;\n\t\t},\n\t\t\n\t\t/**\n\t\t * @func setIDS\n\t\t * @param {array} ids\n\t\t */\n\t\tsetIDs: function(ids) {\n\t\t\tthis.find(':input[name=csvIDs]').val(ids ? ids.join(',') : null);\n\t\t},\n\t\t\n\t\t/**\n\t\t * @func getIDS\n\t\t * @return {array}\n\t\t */\n\t\tgetIDs: function() {\n\t\t\t// Map empty value to empty array\n\t\t\tvar value = this.find(':input[name=csvIDs]').val();\n\t\t\treturn value\n\t\t\t\t? value.split(',')\n\t\t\t\t: [];\n\t\t},\n\n\t\tonsubmit: function(e) {\n\t\t\tvar self = this, ids = this.getIDs(), tree = this.getTree(), actions = this.getActions();\n\t\t\t\n\t\t\t// if no nodes are selected, return with an error\n\t\t\tif(!ids || !ids.length) {\n\t\t\t\talert(i18n._t('CMSMAIN.SELECTONEPAGE', 'Please select at least one page'));\n\t\t\t\te.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t// apply callback, which might modify the IDs\n\t\t\tvar type = this.find(':input[name=Action]').val();\n\t\t\tif(actions[type]) {\n\t\t\t\tids = this.getActions()[type].apply(this, [ids]);\n\t\t\t}\n\t\t\t\n\t\t\t// Discontinue processing if there are no further items\n\t\t\tif(!ids || !ids.length) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\n\t\t\t// write (possibly modified) IDs back into to the hidden field\n\t\t\tthis.setIDs(ids);\n\t\t\t\n\t\t\t// Reset failure states\n\t\t\ttree.find('li').removeClass('failed');\n\t\t\n\t\t\tvar button = this.find(':submit:first');\n\t\t\tbutton.addClass('loading');\n\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\t// don't use original form url\n\t\t\t\turl: type,\n\t\t\t\ttype: 'POST',\n\t\t\t\tdata: this.serializeArray(),\n\t\t\t\tcomplete: function(xmlhttp, status) {\n\t\t\t\t\tbutton.removeClass('loading');\n\n\t\t\t\t\t// Refresh the tree.\n\t\t\t\t\t// Makes sure all nodes have the correct CSS classes applied.\n\t\t\t\t\ttree.jstree('refresh', -1);\n\t\t\t\t\tself.setIDs([]);\n\n\t\t\t\t\t// Reset action\n\t\t\t\t\tself.find(':input[name=Action]').val('').change();\n\t\t\t\t\n\t\t\t\t\t// status message (decode into UTF-8, HTTP headers don't allow multibyte)\n\t\t\t\t\tvar msg = xmlhttp.getResponseHeader('X-Status');\n\t\t\t\t\tif(msg) statusMessage(decodeURIComponent(msg), (status == 'success') ? 'good' : 'bad');\n\t\t\t\t},\n\t\t\t\tsuccess: function(data, status) {\n\t\t\t\t\tvar id, node;\n\t\t\t\t\t\n\t\t\t\t\tif(data.modified) {\n\t\t\t\t\t\tvar modifiedNodes = [];\n\t\t\t\t\t\tfor(id in data.modified) {\n\t\t\t\t\t\t\tnode = tree.getNodeByID(id);\n\t\t\t\t\t\t\ttree.jstree('set_text', node, data.modified[id]['TreeTitle']);\n\t\t\t\t\t\t\tmodifiedNodes.push(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(modifiedNodes).effect('highlight');\n\t\t\t\t\t}\n\t\t\t\t\tif(data.deleted) {\n\t\t\t\t\t\tfor(id in data.deleted) {\n\t\t\t\t\t\t\tnode = tree.getNodeByID(id);\n\t\t\t\t\t\t\tif(node.length)\ttree.jstree('delete_node', node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(data.error) {\n\t\t\t\t\t\tfor(id in data.error) {\n\t\t\t\t\t\t\tnode = tree.getNodeByID(id);\n\t\t\t\t\t\t\t$(node).addClass('failed');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdataType: 'json'\n\t\t\t});\n\t\t\n\t\t\t// Never process this action; Only invoke via ajax\n\t\t\te.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t\n\t});\n\n\t$('.cms-content-batchactions-button').entwine({\n\t\tonmatch: function () {\n\t\t\tthis._super();\n\t\t\tthis.updateTree();\n\t\t},\n\t\tonunmatch: function () {\n\t\t\tthis._super();\n\t\t},\n\t\tonclick: function (e) {\n\t\t\tthis.updateTree();\n\t\t},\n\t\tupdateTree: function () {\n\t\t\tvar tree = $('.cms-tree'),\n\t\t\t\tform = $('#Form_BatchActionsForm');\n\n\t\t\tthis._super();\n\n\t\t\tif(this.data('active')) {\n\t\t\t\ttree.addClass('multiple');\n\t\t\t\ttree.removeClass('draggable');\n\t\t\t\tform.serializeFromTree();\n\t\t\t} else {\n\t\t\t\ttree.removeClass('multiple');\n\t\t\t\ttree.addClass('draggable');\n\t\t\t}\n\t\t\t\n\t\t\t$('#Form_BatchActionsForm').refreshSelected();\n\t\t}\n\t});\n\n\t/**\n\t * Class: #Form_BatchActionsForm :select[name=Action]\n\t */\n\t$('#Form_BatchActionsForm select[name=Action]').entwine({\n\t\tonchange: function(e) {\n\t\t\tvar form = $(e.target.form),\n\t\t\t\tbtn = form.find(':submit'),\n\t\t\t\tselected = $(e.target).val();\n\t\t\tif(!selected || selected == -1) {\n\t\t\t\tbtn.attr('disabled', 'disabled').button('refresh');\n\t\t\t} else {\n\t\t\t\tbtn.removeAttr('disabled').button('refresh');\n\t\t\t}\n\t\t\t\n\t\t\t// Refresh selected / enabled nodes\n\t\t\t$('#Form_BatchActionsForm').refreshSelected();\n\n\t\t\t// TODO Should work by triggering change() along, but doesn't - entwine event bubbling?\n\t\t\tthis.trigger(\"liszt:updated\");\n\n\t\t\tthis._super(e);\n\t\t}\n\t});\n});\n","import $ from 'jQuery';\n\n$.entwine('ss', function($){\n\t\n\t/**\n\t * The \"content\" area contains all of the section specific UI (excluding the menu).\n\t * This area can be a form itself, as well as contain one or more forms.\n\t * For example, a page edit form might fill the whole area, \n\t * while a ModelAdmin layout shows a search form on the left, and edit form on the right.\n\t */\n\t$('.cms-content').entwine({\n\t\t\n\t\tonadd: function() {\n\t\t\tvar self = this;\n\t\t\t\n\t\t\t// Force initialization of certain UI elements to avoid layout glitches\n\t\t\tthis.find('.cms-tabset').redrawTabs();\n\t\t\tthis._super();\n\n\t\t},\n\n\t\tredraw: function() {\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\t\t\t\n\t\t\t// Force initialization of certain UI elements to avoid layout glitches\n\t\t\tthis.add(this.find('.cms-tabset')).redrawTabs();\n\t\t\tthis.find('.cms-content-header').redraw();\n\t\t\tthis.find('.cms-content-actions').redraw();\n\t\t}\n\t});\n\n\t/**\n\t * Load edit form for the selected node when its clicked.\n\t */\n\t$('.cms-content .cms-tree').entwine({\n\t\tonadd: function() {\n\t\t\tvar self = this;\n\n\t\t\tthis._super();\n\n\t\t\tthis.bind('select_node.jstree', function(e, data) {\n\t\t\t\tvar node = data.rslt.obj, loadedNodeID = self.find(':input[name=ID]').val(), origEvent = data.args[2], container = $('.cms-container');\n\t\t\t\t\n\t\t\t\t// Don't trigger unless coming from a click event.\n\t\t\t\t// Avoids problems with automated section switches from tree to detail view\n\t\t\t\t// when JSTree auto-selects elements on first load.\n\t\t\t\tif(!origEvent) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Don't allow checking disabled nodes\n\t\t\t\tif($(node).hasClass('disabled')) return false;\n\n\t\t\t\t// Don't allow reloading of currently selected node,\n\t\t\t\t// mainly to avoid doing an ajax request on initial page load\n\t\t\t\tif($(node).data('id') == loadedNodeID) return;\n\n\t\t\t\tvar url = $(node).find('a:first').attr('href');\n\t\t\t\tif(url && url != '#') {\n\t\t\t\t\t// strip possible querystrings from the url to avoid duplicateing document.location.search\n\t\t\t\t\turl = url.split('?')[0];\n\t\t\t\t\t\n\t\t\t\t\t// Deselect all nodes (will be reselected after load according to form state)\n\t\t\t\t\tself.jstree('deselect_all');\n\t\t\t\t\tself.jstree('uncheck_all');\n\n\t\t\t\t\t// Ensure URL is absolute (important for IE)\n\t\t\t\t\tif($.path.isExternal($(node).find('a:first'))) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));\n\t\t\t\t\t// Retain search parameters\n\t\t\t\t\tif(document.location.search) url = $.path.addSearchParams(url, document.location.search.replace(/^\\?/, ''));\n\t\t\t\t\t// Load new page\n\t\t\t\t\tcontainer.loadPanel(url);\t\n\t\t\t\t} else {\n\t\t\t\t\tself.removeForm();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\t$('.cms-content .cms-content-fields').entwine({\n\t\tredraw: function() {\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\t\t}\n\t});\n\n\t$('.cms-content .cms-content-header, .cms-content .cms-content-actions').entwine({\n\t\tredraw: function() {\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\n\t\t\t// Fix dimensions to actual extents, in preparation for a relayout via jslayout.\n\t\t\tthis.height('auto');\n\t\t\tthis.height(this.innerHeight()-this.css('padding-top')-this.css('padding-bottom'));\n\t\t}\n\t});\n\n\t\n});\n","/**\n * File: LeftAndMain.EditForm.js\n */\nimport $ from 'jQuery';\nimport i18n from 'i18n';\n\n// Can't bind this through jQuery\nwindow.onbeforeunload = function(e) {\n\tvar form = $('.cms-edit-form');\n\tform.trigger('beforesubmitform');\n\tif(form.is('.changed') && ! form.is('.discardchanges')) {\n\t\treturn i18n._t('LeftAndMain.CONFIRMUNSAVEDSHORT');\n\t}\n};\n\n$.entwine('ss', function($){\n\n\t/**\n\t * Class: .cms-edit-form\n\t *\n\t * Base edit form, provides ajaxified saving\n\t * and reloading itself through the ajax return values.\n\t * Takes care of resizing tabsets within the layout container.\n\t *\n\t * Change tracking is enabled on all fields within the form. If you want\n\t * to disable change tracking for a specific field, add a \"no-change-track\"\n\t * class to it.\n\t *\n\t * @name ss.Form_EditForm\n\t * @require jquery.changetracker\n\t *\n\t * Events:\n\t * ajaxsubmit - Form is about to be submitted through ajax\n\t * validate - Contains validation result\n\t * load - Form is about to be loaded through ajax\n\t */\n\t$('.cms-edit-form').entwine(/** @lends ss.Form_EditForm */{\n\t\t/**\n\t\t * Variable: PlaceholderHtml\n\t\t * (String_ HTML text to show when no form content is chosen.\n\t\t * Will show inside the <form> tag.\n\t\t */\n\t\tPlaceholderHtml: '',\n\n\t\t/**\n\t\t * Variable: ChangeTrackerOptions\n\t\t * (Object)\n\t\t */\n\t\tChangeTrackerOptions: {\n\t\t\tignoreFieldSelector: '.no-change-track, .ss-upload :input, .cms-navigator :input'\n\t\t},\n\n\t\t/**\n\t\t * Constructor: onmatch\n\t\t */\n\t\tonadd: function() {\n\t\t\tvar self = this;\n\n\t\t\t// Turn off autocomplete to fix the access tab randomly switching radio buttons in Firefox\n\t\t\t// when refresh the page with an anchor tag in the URL. E.g: /admin#Root_Access.\n\t\t\t// Autocomplete in the CMS also causes strangeness in other browsers,\n\t\t\t// filling out sections of the form that the user does not want to be filled out,\n\t\t\t// so this turns it off for all browsers.\n\t\t\t// See the following page for demo and explanation of the Firefox bug:\n\t\t\t// http://www.ryancramer.com/journal/entries/radio_buttons_firefox/\n\t\t\tthis.attr(\"autocomplete\", \"off\");\n\n\t\t\tthis._setupChangeTracker();\n\n\t\t\t// Catch navigation events before they reach handleStateChange(),\n\t\t\t// in order to avoid changing the menu state if the action is cancelled by the user\n\t\t\t// $('.cms-menu')\n\n\t\t\t// Optionally get the form attributes from embedded fields, see Form->formHtmlContent()\n\t\t\tfor(var overrideAttr in {'action':true,'method':true,'enctype':true,'name':true}) {\n\t\t\t\tvar el = this.find(':input[name='+ '_form_' + overrideAttr + ']');\n\t\t\t\tif(el) {\n\t\t\t\t\tthis.attr(overrideAttr, el.val());\n\t\t\t\t\tel.remove();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO\n\t\t\t// // Rewrite # links\n\t\t\t// html = html.replace(/(<a[^>]+href *= *\")#/g, '$1' + window.location.href.replace(/#.*$/,'') + '#');\n\t\t\t//\n\t\t\t// // Rewrite iframe links (for IE)\n\t\t\t// html = html.replace(/(<iframe[^>]*src=\")([^\"]+)(\"[^>]*>)/g, '$1' + $('base').attr('href') + '$2$3');\n\n\t\t\t// Show validation errors if necessary\n\t\t\tif(this.hasClass('validationerror')) {\n\t\t\t\t// Ensure the first validation error is visible\n\t\t\t\tvar tabError = this.find('.message.validation, .message.required').first().closest('.tab');\n\t\t\t\t$('.cms-container').clearCurrentTabState(); // clear state to avoid override later on\n\t\t\t\ttabError.closest('.ss-tabset').tabs('option', 'active', tabError.index('.tab'));\n\t\t\t}\n\n\t\t\tthis._super();\n\t\t},\n\t\tonremove: function() {\n\t\t\tthis.changetracker('destroy');\n\t\t\tthis._super();\n\t\t},\n\t\tonmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\t\tredraw: function() {\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\n\t\t\t// Force initialization of tabsets to avoid layout glitches\n\t\t\tthis.add(this.find('.cms-tabset')).redrawTabs();\n\t\t\tthis.find('.cms-content-header').redraw();\n\t\t},\n\n\t\t/**\n\t\t * Function: _setupChangeTracker\n\t\t */\n\t\t_setupChangeTracker: function() {\n\t\t\t// Don't bind any events here, as we dont replace the\n\t\t\t// full <form> tag by any ajax updates they won't automatically reapply\n\t\t\tthis.changetracker(this.getChangeTrackerOptions());\n\t\t},\n\n\t\t/**\n\t\t * Function: confirmUnsavedChanges\n\t\t *\n\t\t * Checks the jquery.changetracker plugin status for this form,\n\t\t * and asks the user for confirmation via a browser dialog if changes are detected.\n\t\t * Doesn't cancel any unload or form removal events, you'll need to implement this based on the return\n\t\t * value of this message.\n\t\t *\n\t\t * If changes are confirmed for discard, the 'changed' flag is reset.\n\t\t *\n\t\t * Returns:\n\t\t * (Boolean) FALSE if the user wants to abort with changes present, TRUE if no changes are detected\n\t\t * or the user wants to discard them.\n\t\t */\n\t\tconfirmUnsavedChanges: function() {\n\t\t\tthis.trigger('beforesubmitform');\n\t\t\tif(!this.is('.changed') || this.is('.discardchanges')) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tvar confirmed = confirm(i18n._t('LeftAndMain.CONFIRMUNSAVED'));\n\t\t\tif(confirmed) {\n\t\t\t\t// Ensures that once a form is confirmed, subsequent\n\t\t\t\t// changes to the underlying form don't trigger\n\t\t\t\t// additional change confirmation requests\n\t\t\t\tthis.addClass('discardchanges');\n\t\t\t}\n\t\t\treturn confirmed;\n\t\t},\n\n\t\t/**\n\t\t * Function: onsubmit\n\t\t *\n\t\t * Suppress submission unless it is handled through ajaxSubmit().\n\t\t */\n\t\tonsubmit: function(e, button) {\n\t\t\t// Only submit if a button is present.\n\t\t\t// This supressed submits from ENTER keys in input fields,\n\t\t\t// which means the browser auto-selects the first available form button.\n\t\t\t// This might be an unrelated button of the form field,\n\t\t\t// or a destructive action (if \"save\" is not available, or not on first position).\n\t\t\tif(this.prop(\"target\") != \"_blank\") {\n\t\t\t\tif(button) this.closest('.cms-container').submitForm(this, button);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Function: validate\n\t\t *\n\t\t * Hook in (optional) validation routines.\n\t\t * Currently clientside validation is not supported out of the box in the CMS.\n\t\t *\n\t\t * Todo:\n\t\t * Placeholder implementation\n\t\t *\n\t\t * Returns:\n\t\t * {boolean}\n\t\t */\n\t\tvalidate: function() {\n\t\t\tvar isValid = true;\n\t\t\tthis.trigger('validate', {isValid: isValid});\n\n\t\t\treturn isValid;\n\t\t},\n\t\t/*\n\t\t * Track focus on htmleditor fields\n\t\t */\n\t\t'from .htmleditor': {\n\t\t\toneditorinit: function(e){\n\t\t\t\tvar self = this,\n\t\t\t\t\tfield = $(e.target).closest('.field.htmleditor'),\n\t\t\t\t\teditor = field.find('textarea.htmleditor').getEditor().getInstance();\n\n\t\t\t\t// TinyMCE 4 will add a focus event, but for now, use click\n\t\t\t\teditor.onClick.add(function(e){\n\t\t\t\t\tself.saveFieldFocus(field.attr('id'));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t/*\n\t\t * Track focus on inputs\n\t\t */\n\t\t'from .cms-edit-form :input:not(:submit)': {\n\t\t\tonclick: function(e){\n\t\t\t\tthis.saveFieldFocus($(e.target).attr('id'));\n\t\t\t},\n\t\t\tonfocus: function(e){\n\t\t\t\tthis.saveFieldFocus($(e.target).attr('id'));\n\t\t\t}\n\t\t},\n\t\t/*\n\t\t * Track focus on treedropdownfields.\n\t\t */\n\t\t'from .cms-edit-form .treedropdown *': {\n\t\t\tonfocusin: function(e){\n\t\t\t\tvar field = $(e.target).closest('.field.treedropdown');\n\t\t\t\tthis.saveFieldFocus(field.attr('id'));\n\t\t\t}\n\t\t},\n\t\t/*\n\t\t * Track focus on chosen selects\n\t\t */\n\t\t'from .cms-edit-form .dropdown .chzn-container a': {\n\t\t\tonfocusin: function(e){\n\t\t\t\tvar field = $(e.target).closest('.field.dropdown');\n\t\t\t\tthis.saveFieldFocus(field.attr('id'));\n\t\t\t}\n\t\t},\n\t\t/*\n\t\t * Restore fields after tabs are restored\n\t\t */\n\t\t'from .cms-container': {\n\t\t\tontabstaterestored: function(e){\n\t\t\t\tthis.restoreFieldFocus();\n\t\t\t}\n\t\t},\n\t\t/*\n\t\t * Saves focus in Window session storage so it that can be restored on page load\n\t\t */\n\t\tsaveFieldFocus: function(selected){\n\t\t\tif(typeof(window.sessionStorage)==\"undefined\" || window.sessionStorage === null) return;\n\n\t\t\tvar id = $(this).attr('id'),\n\t\t\t\tfocusElements = [];\n\n\t\t\tfocusElements.push({\n\t\t\t\tid:id,\n\t\t\t\tselected:selected\n\t\t\t});\n\n\t\t\tif(focusElements) {\n\t\t\t\ttry {\n\t\t\t\t\twindow.sessionStorage.setItem(id, JSON.stringify(focusElements));\n\t\t\t\t} catch(err) {\n\t\t\t\t\tif (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) {\n\t\t\t\t\t\t// If this fails we ignore the error as the only issue is that it\n\t\t\t\t\t\t// does not remember the focus state.\n\t\t\t\t\t\t// This is a Safari bug which happens when private browsing is enabled.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Set focus or window to previously saved fields.\n\t\t * Requires HTML5 sessionStorage support.\n\t\t *\n\t\t * Must follow tab restoration, as reliant on active tab\n\t\t */\n\t\trestoreFieldFocus: function(){\n\t\t\tif(typeof(window.sessionStorage)==\"undefined\" || window.sessionStorage === null) return;\n\n\t\t\tvar self = this,\n\t\t\t\thasSessionStorage = (typeof(window.sessionStorage)!==\"undefined\" && window.sessionStorage),\n\t\t\t\tsessionData = hasSessionStorage ? window.sessionStorage.getItem(this.attr('id')) : null,\n\t\t\t\tsessionStates = sessionData ? JSON.parse(sessionData) : false,\n\t\t\t\telementID,\n\t\t\t\ttabbed = (this.find('.ss-tabset').length !== 0),\n\t\t\t\tactiveTab,\n\t\t\t\telementTab,\n\t\t\t\ttoggleComposite,\n\t\t\t\tscrollY;\n\n\t\t\tif(hasSessionStorage && sessionStates.length > 0){\n\t\t\t\t$.each(sessionStates, function(i, sessionState) {\n\t\t\t\t\tif(self.is('#' + sessionState.id)){\n\t\t\t\t\t\telementID = $('#' + sessionState.selected);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// If the element IDs saved in session states don't match up to anything in this particular form\n\t\t\t\t// that probably means we haven't encountered this form yet, so focus on the first input\n\t\t\t\tif($(elementID).length < 1){\n\t\t\t\t\tthis.focusFirstInput();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tactiveTab = $(elementID).closest('.ss-tabset').find('.ui-tabs-nav .ui-tabs-active .ui-tabs-anchor').attr('id');\n\t\t\t\telementTab = 'tab-' + $(elementID).closest('.ss-tabset .ui-tabs-panel').attr('id');\n\n\t\t\t\t// Last focussed element differs to last selected tab, do nothing\n\t\t\t\tif(tabbed && elementTab !== activeTab){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttoggleComposite = $(elementID).closest('.togglecomposite');\n\n\t\t\t\t//Reopen toggle fields\n\t\t\t\tif(toggleComposite.length > 0){\n\t\t\t\t\ttoggleComposite.accordion('activate', toggleComposite.find('.ui-accordion-header'));\n\t\t\t\t}\n\n\t\t\t\t//Calculate position for scroll\n\t\t\t\tscrollY = $(elementID).position().top;\n\n\t\t\t\t//Fall back to nearest visible element if hidden (for select type fields)\n\t\t\t\tif(!$(elementID).is(':visible')){\n\t\t\t\t\telementID = '#' + $(elementID).closest('.field').attr('id');\n\t\t\t\t\tscrollY = $(elementID).position().top;\n\t\t\t\t}\n\n\t\t\t\t//set focus to focus variable if element focusable\n\t\t\t\t$(elementID).focus();\n\n\t\t\t\t// Scroll fallback when element is not focusable\n\t\t\t\t// Only scroll if element at least half way down window\n\t\t\t\tif(scrollY > $(window).height() / 2){\n\t\t\t\t\tself.find('.cms-content-fields').scrollTop(scrollY);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// If session storage is not supported or there is nothing stored yet, focus on the first input\n\t\t\t\tthis.focusFirstInput();\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Skip if an element in the form is already focused. Exclude elements which specifically\n\t\t * opt-out of this behaviour via \"data-skip-autofocus\". This opt-out is useful if the\n\t\t * first visible field is shown far down a scrollable area, for example for the pagination\n\t\t * input field after a long GridField listing.\n\t\t */\n\t\tfocusFirstInput: function() {\n\t\t\tthis.find(':input:not(:submit)[data-skip-autofocus!=\"true\"]').filter(':visible:first').focus();\n\t\t}\n\t});\n\n\t/**\n\t * Class: .cms-edit-form .Actions :submit\n\t *\n\t * All buttons in the right CMS form go through here by default.\n\t * We need this onclick overloading because we can't get to the\n\t * clicked button from a form.onsubmit event.\n\t */\n\t$('.cms-edit-form .Actions input.action[type=submit], .cms-edit-form .Actions button.action').entwine({\n\t\t/**\n\t\t * Function: onclick\n\t\t */\n\t\tonclick: function(e) {\n\t\t\t// Confirmation on delete.\n\t\t\tif(\n\t\t\t\tthis.hasClass('gridfield-button-delete')\n\t\t\t\t&& !confirm(i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'))\n\t\t\t) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif(!this.is(':disabled')) {\n\t\t\t\tthis.parents('form').trigger('submit', [this]);\n\t\t\t}\n\t\t\te.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t/**\n\t * If we've a history state to go back to, go back, otherwise fall back to\n\t * submitting the form with the 'doCancel' action.\n\t */\n\t$('.cms-edit-form .Actions input.action[type=submit].ss-ui-action-cancel, .cms-edit-form .Actions button.action.ss-ui-action-cancel').entwine({\n\t\tonclick: function(e) {\n\t\t\tif (window.history.length > 1) {\n\t\t\t\twindow.history.back();\n\t\t\t} else {\n\t\t\t\tthis.parents('form').trigger('submit', [this]);\n\t\t\t}\n\t\t\te.preventDefault();\n\t\t}\n\t});\n\n\t/**\n\t * Hide tabs when only one is available.\n\t * Special case is actiontabs - tabs between buttons, where we want to have\n\t * extra options hidden within a tab (even if only one) by default.\n\t */\n\t$('.cms-edit-form .ss-tabset').entwine({\n\t\tonmatch: function() {\n\t\t\tif (!this.hasClass('ss-ui-action-tabset')) {\n\t\t\t\tvar tabs = this.find(\"> ul:first\");\n\n\t\t\t\tif(tabs.children(\"li\").length == 1) {\n\t\t\t\t\ttabs.hide().parent().addClass(\"ss-tabset-tabshidden\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t}\n\t});\n\n});\n","/**\n * Enable toggling (show/hide) of the field's description.\n */\n\nimport $ from 'jQuery';\n\n$.entwine('ss', function ($) {\n\n $('.cms-description-toggle').entwine({\n onadd: function () {\n var shown = false, // Current state of the description.\n fieldId = this.prop('id').substr(0, this.prop('id').indexOf('_Holder')),\n $trigger = this.find('.cms-description-trigger'), // Click target for toggling the description.\n $description = this.find('.description');\n\n // Prevent multiple events being added.\n if (this.hasClass('description-toggle-enabled')) {\n return;\n }\n\n // If a custom trigger han't been supplied use a sensible default.\n if ($trigger.length === 0) {\n $trigger = this\n .find('.middleColumn')\n .first() // Get the first middleColumn so we don't add multiple triggers on composite field types.\n .after('<label class=\"right\" for=\"' + fieldId + '\"><a class=\"cms-description-trigger\" href=\"javascript:void(0)\"><span class=\"btn-icon-information\"></span></a></label>')\n .next();\n }\n\n this.addClass('description-toggle-enabled');\n\n // Toggle next description when button is clicked.\n $trigger.on('click', function() {\n $description[shown ? 'hide' : 'show']();\n shown = !shown;\n });\n\n // Hide next description by default.\n $description.hide();\n }\n });\n\n});\n","import $ from 'jQuery';\n\n$.entwine('ss', function($) {\n\t/**\n\t * Converts an inline field description into a tooltip\n\t * which is shown on hover over any part of the field container,\n\t * as well as when focusing into an input element within the field container.\n\t *\n\t * Note that some fields don't have distinct focusable\n\t * input fields (e.g. GridField), and aren't compatible\n\t * with showing tooltips.\n\t */\n\t$(\".cms .field.cms-description-tooltip\").entwine({\n\t\tonmatch: function() {\n\t\t\tthis._super();\n\n\t\t\tvar descriptionEl = this.find('.description'), inputEl, tooltipEl;\n\t\t\tif(descriptionEl.length) {\n\t\t\t\tthis\n\t\t\t\t\t// TODO Remove title setting, shouldn't be necessary\n\t\t\t\t\t.attr('title', descriptionEl.text())\n\t\t\t\t\t.tooltip({content: descriptionEl.html()});\n\t\t\t\tdescriptionEl.remove();\n\t\t\t}\n\t\t},\n\t});\n\n\t$(\".cms .field.cms-description-tooltip :input\").entwine({\n\t\tonfocusin: function(e) {\n\t\t\tthis.closest('.field').tooltip('open');\n\t\t},\n\t\tonfocusout: function(e) {\n\t\t\tthis.closest('.field').tooltip('close');\n\t\t\t}\n\t});\n\n});\n","/**\n * File: LeftAndMain.Layout.js\n */\n\nimport $ from 'jQuery';\n\n$.fn.layout.defaults.resize = false;\n\n/**\n * Acccess the global variable in the same way the plugin does it.\n */\njLayout = (typeof jLayout === 'undefined') ? {} : jLayout;\n\n/**\n * Factory function for generating new type of algorithm for our CMS.\n *\n * Spec requires a definition of three column elements:\n * - `menu` on the left\n * - `content` area in the middle (includes the EditForm, side tool panel, actions, breadcrumbs and tabs)\n * - `preview` on the right (will be shown if there is enough space)\n *\n * Required options:\n * - `minContentWidth`: minimum size for the content display as long as the preview is visible\n * - `minPreviewWidth`: preview will not be displayed below this size\n * - `mode`: one of \"split\", \"content\" or \"preview\"\n *\n * The algorithm first checks which columns are to be visible and which hidden.\n *\n * In the case where both preview and content should be shown it first tries to assign half of non-menu space to\n * preview and the other half to content. Then if there is not enough space for either content or preview, it tries\n * to allocate the minimum acceptable space to that column, and the rest to the other one. If the minimum\n * requirements are still not met, it falls back to showing content only.\n *\n * @param spec A structure defining columns and parameters as per above.\n */\njLayout.threeColumnCompressor = function (spec, options) {\n\t// Spec sanity checks.\n\tif (typeof spec.menu==='undefined' ||\n\t\ttypeof spec.content==='undefined' ||\n\t\ttypeof spec.preview==='undefined') {\n\t\tthrow 'Spec is invalid. Please provide \"menu\", \"content\" and \"preview\" elements.';\n\t}\n\tif (typeof options.minContentWidth==='undefined' ||\n\t\ttypeof options.minPreviewWidth==='undefined' ||\n\t\ttypeof options.mode==='undefined') {\n\t\tthrow 'Spec is invalid. Please provide \"minContentWidth\", \"minPreviewWidth\", \"mode\"';\n\t}\n\tif (options.mode!=='split' && options.mode!=='content' && options.mode!=='preview') {\n\t\tthrow 'Spec is invalid. \"mode\" should be either \"split\", \"content\" or \"preview\"';\n\t}\n\n\t// Instance of the algorithm being produced.\n\tvar obj = {\n\t\toptions: options\n\t};\n\n\t// Internal column handles, also implementing layout.\n\tvar menu = $.jLayoutWrap(spec.menu),\n\t\tcontent = $.jLayoutWrap(spec.content),\n\t\tpreview = $.jLayoutWrap(spec.preview);\n\n\t/**\n\t * Required interface implementations follow.\n\t * Refer to https://github.com/bramstein/jlayout#layout-algorithms for the interface spec.\n\t */\n\tobj.layout = function (container) {\n\t\tvar size = container.bounds(),\n\t\t\tinsets = container.insets(),\n\t\t\ttop = insets.top,\n\t\t\tbottom = size.height - insets.bottom,\n\t\t\tleft = insets.left,\n\t\t\tright = size.width - insets.right;\n\n\t\tvar menuWidth = spec.menu.width(), \n\t\t\tcontentWidth = 0,\n\t\t\tpreviewWidth = 0;\n\n\t\tif (this.options.mode==='preview') {\n\t\t\t// All non-menu space allocated to preview.\n\t\t\tcontentWidth = 0;\n\t\t\tpreviewWidth = right - left - menuWidth;\n\t\t} else if (this.options.mode==='content') {\n\t\t\t// All non-menu space allocated to content.\n\t\t\tcontentWidth = right - left - menuWidth;\n\t\t\tpreviewWidth = 0;\n\t\t} else { // ==='split'\n\t\t\t// Split view - first try 50-50 distribution.\n\t\t\tcontentWidth = (right - left - menuWidth) / 2;\n\t\t\tpreviewWidth = right - left - (menuWidth + contentWidth);\n\n\t\t\t// If violating one of the minima, try to readjust towards satisfying it.\n\t\t\tif (contentWidth < this.options.minContentWidth) {\n\t\t\t\tcontentWidth = this.options.minContentWidth;\n\t\t\t\tpreviewWidth = right - left - (menuWidth + contentWidth);\n\t\t\t} else if (previewWidth < this.options.minPreviewWidth) {\n\t\t\t\tpreviewWidth = this.options.minPreviewWidth;\n\t\t\t\tcontentWidth = right - left - (menuWidth + previewWidth);\n\t\t\t}\n\n\t\t\t// If still violating one of the (other) minima, remove the preview and allocate everything to content.\n\t\t\tif (contentWidth < this.options.minContentWidth || previewWidth < this.options.minPreviewWidth) {\n\t\t\t\tcontentWidth = right - left - menuWidth;\n\t\t\t\tpreviewWidth = 0;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate what columns are already hidden pre-layout\n\t\tvar prehidden = {\n\t\t\tcontent: spec.content.hasClass('column-hidden'),\n\t\t\tpreview: spec.preview.hasClass('column-hidden')\n\t\t};\n\n\t\t// Calculate what columns will be hidden (zero width) post-layout\n\t\tvar posthidden = {\n\t\t\tcontent: contentWidth === 0,\n\t\t\tpreview: previewWidth === 0\n\t\t};\n\n\t\t// Apply classes for elements that might not be visible at all.\n\t\tspec.content.toggleClass('column-hidden', posthidden.content);\n\t\tspec.preview.toggleClass('column-hidden', posthidden.preview);\n\n\t\t// Apply the widths to columns, and call subordinate layouts to arrange the children.\n\t\tmenu.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': menuWidth});\n\t\tmenu.doLayout();\n\n\t\tleft += menuWidth;\n\n\t\tcontent.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': contentWidth});\n\t\tif (!posthidden.content) content.doLayout();\n\n\t\tleft += contentWidth;\n\n\t\tpreview.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': previewWidth});\n\t\tif (!posthidden.preview) preview.doLayout();\n\n\t\tif (posthidden.content !== prehidden.content) spec.content.trigger('columnvisibilitychanged');\n\t\tif (posthidden.preview !== prehidden.preview) spec.preview.trigger('columnvisibilitychanged');\n\n\t\t// Calculate whether preview is possible in split mode\n\t\tif (contentWidth + previewWidth < options.minContentWidth + options.minPreviewWidth) {\n\t\t\tspec.preview.trigger('disable');\n\t\t} else {\n\t\t\tspec.preview.trigger('enable');\n\t\t}\n\n\t\treturn container;\n\t};\n\n\t/**\n\t * Helper to generate the required `preferred`, `minimum` and `maximum` interface functions.\n\t */\n\tfunction typeLayout(type) {\n\t\tvar func = type + 'Size';\n\n\t\treturn function (container) {\n\t\t\tvar menuSize = menu[func](),\n\t\t\t\tcontentSize = content[func](),\n\t\t\t\tpreviewSize = preview[func](),\n\t\t\t\tinsets = container.insets();\n\n\t\t\twidth = menuSize.width + contentSize.width + previewSize.width;\n\t\t\theight = Math.max(menuSize.height, contentSize.height, previewSize.height);\n\n\t\t\treturn {\n\t\t\t\t'width': insets.left + insets.right + width,\n\t\t\t\t'height': insets.top + insets.bottom + height\n\t\t\t};\n\t\t};\n\t}\n\n\t// Generate interface functions.\n\tobj.preferred = typeLayout('preferred');\n\tobj.minimum = typeLayout('minimum');\n\tobj.maximum = typeLayout('maximum');\n\n\treturn obj;\n};\n","import $ from 'jQuery';\n\n$.entwine('ss', function($){\n\t\t\n\t/**\n\t * Vertical CMS menu with two levels, built from a nested unordered list. \n\t * The (optional) second level is collapsible, hiding its children.\n\t * The whole menu (including second levels) is collapsible as well,\n\t * exposing only a preview for every menu item in order to save space.\n\t * In this \"preview/collapsed\" mode, the secondary menu hovers over the menu item,\n\t * rather than expanding it.\n\t * \n\t * Example:\n\t * \n\t * <ul class=\"cms-menu-list\">\n\t * <li><a href=\"#\">Item 1</a></li>\n\t * <li class=\"current opened\">\n\t * <a href=\"#\">Item 2</a>\n\t * <ul>\n\t * <li class=\"current opened\"><a href=\"#\">Item 2.1</a></li>\n\t * <li><a href=\"#\">Item 2.2</a></li>\n\t * </ul>\n\t * </li>\n\t * </ul>\n\t * \n\t * Custom Events:\n\t * - 'select': Fires when a menu item is selected (on any level).\n\t */\n\t$('.cms-panel.cms-menu').entwine({\n\t\ttogglePanel: function(doExpand, silent, doSaveState) {\n\t\t\t//apply or unapply the flyout formatting, should only apply to cms-menu-list when the current collapsed panal is the cms menu.\n\t\t\t$('.cms-menu-list').children('li').each(function(){\n\t\t\t\tif (doExpand) { //expand\n\t\t\t\t\t$(this).children('ul').each(function() {\n\t\t\t\t\t\t$(this).removeClass('collapsed-flyout');\n\t\t\t\t\t\tif ($(this).data('collapse')) {\n\t\t\t\t\t\t\t$(this).removeData('collapse');\n\t\t\t\t\t\t\t$(this).addClass('collapse');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else { //collapse\n\t\t\t\t\t$(this).children('ul').each(function() {\n\t\t\t\t\t\t$(this).addClass('collapsed-flyout');\n\t\t\t\t\t\t$(this).hasClass('collapse');\n\t\t\t\t\t\t$(this).removeClass('collapse');\n\t\t\t\t\t\t$(this).data('collapse', true);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.toggleFlyoutState(doExpand);\n\n\t\t\tthis._super(doExpand, silent, doSaveState);\n\t\t},\n\t\ttoggleFlyoutState: function(bool) {\n\t\t\tif (bool) { //expand\n\t\t\t\t//show the flyout\n\t\t\t\t$('.collapsed').find('li').show();\n\n\t\t\t\t//hide all the flyout-indicator\n\t\t\t\t$('.cms-menu-list').find('.child-flyout-indicator').hide();\n\t\t\t} else { //collapse\n\t\t\t\t//hide the flyout only if it is not the current section\n\t\t\t\t$('.collapsed-flyout').find('li').each(function() {\n\t\t\t\t\t//if (!$(this).hasClass('current'))\n\t\t\t\t\t$(this).hide();\n\t\t\t\t});\n\n\t\t\t\t//show all the flyout-indicators\n\t\t\t\tvar par = $('.cms-menu-list ul.collapsed-flyout').parent();\n\t\t\t\tif (par.children('.child-flyout-indicator').length === 0) par.append('<span class=\"child-flyout-indicator\"></span>').fadeIn();\n\t\t\t\tpar.children('.child-flyout-indicator').fadeIn();\n\t\t\t}\n\t\t},\n\t\tsiteTreePresent: function () {\n\t\t\treturn $('#cms-content-tools-CMSMain').length > 0;\n\t\t},\n\n\t\t/**\n\t\t * @func getPersistedStickyState\n\t\t * @return {boolean|undefined} - Returns true if the menu is sticky, false if unsticky. Returns undefined if there is no cookie set.\n\t\t * @desc Get the sticky state of the menu according to the cookie.\n\t\t */\n\t\tgetPersistedStickyState: function () {\n\t\t\tvar persistedState, cookieValue;\n\n\t\t\tif ($.cookie !== void 0) {\n\t\t\t\tcookieValue = $.cookie('cms-menu-sticky');\n\n\t\t\t\tif (cookieValue !== void 0 && cookieValue !== null) {\n\t\t\t\t\tpersistedState = cookieValue === 'true';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn persistedState;\n\t\t},\n\n\t\t/**\n\t\t * @func setPersistedStickyState\n\t\t * @param {boolean} isSticky - Pass true if you want the panel to be sticky, false for unsticky.\n\t\t * @desc Set the collapsed value of the panel, stored in cookies.\n\t\t */\n\t\tsetPersistedStickyState: function (isSticky) {\n\t\t\tif ($.cookie !== void 0) {\n\t\t\t\t$.cookie('cms-menu-sticky', isSticky, { path: '/', expires: 31 });\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @func getEvaluatedCollapsedState\n\t\t * @return {boolean} - Returns true if the menu should be collapsed, false if expanded.\n\t\t * @desc Evaluate whether the menu should be collapsed.\n\t\t * The basic rule is \"If the SiteTree (middle column) is present, collapse the menu, otherwise expand the menu\".\n\t\t * This reason behind this is to give the content area more real estate when the SiteTree is present.\n\t\t * The user may wish to override this automatic behaviour and have the menu expanded or collapsed at all times.\n\t\t * So unlike manually toggling the menu, the automatic behaviour never updates the menu's cookie value.\n\t\t * Here we use the manually set state and the automatic behaviour to evaluate what the collapsed state should be.\n\t\t */\n\t\tgetEvaluatedCollapsedState: function () {\n\t\t\tvar shouldCollapse,\n\t\t\t\tmanualState = this.getPersistedCollapsedState(),\n\t\t\t\tmenuIsSticky = $('.cms-menu').getPersistedStickyState(),\n\t\t\t\tautomaticState = this.siteTreePresent();\n\n\t\t\tif (manualState === void 0) {\n\t\t\t\t// There is no manual state, use automatic state.\n\t\t\t\tshouldCollapse = automaticState;\n\t\t\t} else if (manualState !== automaticState && menuIsSticky) {\n\t\t\t\t// The manual and automatic statea conflict, use manual state.\n\t\t\t\tshouldCollapse = manualState;\n\t\t\t} else {\n\t\t\t\t// Use automatic state.\n\t\t\t\tshouldCollapse = automaticState;\n\t\t\t}\n\n\t\t\treturn shouldCollapse;\n\t\t},\n\n\t\tonadd: function () {\n\t\t\tvar self = this;\n\n\t\t\tsetTimeout(function () {\n\t\t\t\t// Use a timeout so this happens after the redraw.\n\t\t\t\t// Triggering a toggle before redraw will result in an incorrect\n\t\t\t\t// menu 'expanded width' being calculated when then menu\n\t\t\t\t// is added in a collapsed state.\n\t\t\t\tself.togglePanel(!self.getEvaluatedCollapsedState(), false, false);\n\t\t\t}, 0);\n\n\t\t\t// Setup automatic expand / collapse behaviour.\n\t\t\t$(window).on('ajaxComplete', function (e) {\n\t\t\t\tsetTimeout(function () { // Use a timeout so this happens after the redraw\n\t\t\t\t\tself.togglePanel(!self.getEvaluatedCollapsedState(), false, false);\n\t\t\t\t}, 0);\n\t\t\t});\n\n\t\t\tthis._super();\n\t\t}\n\t});\n\n\t$('.cms-menu-list').entwine({\n\t\tonmatch: function() {\n\t\t\tvar self = this;\n\n\t\t\t// Select default element (which might reveal children in hidden parents)\n\t\t\tthis.find('li.current').select();\n\n\t\t\tthis.updateItems();\n\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\n\t\tupdateMenuFromResponse: function(xhr) {\n\t\t\tvar controller = xhr.getResponseHeader('X-Controller');\n\t\t\tif(controller) {\n\t\t\t\tvar item = this.find('li#Menu-' + controller.replace(/\\\\/g, '-').replace(/[^a-zA-Z0-9\\-_:.]+/, ''));\n\t\t\t\tif(!item.hasClass('current')) item.select();\n\t\t\t}\n\t\t\tthis.updateItems();\n\t\t},\n\n\t\t'from .cms-container': {\n\t\t\tonafterstatechange: function(e, data){\n\t\t\t\tthis.updateMenuFromResponse(data.xhr);\n\t\t\t},\n\t\t\tonaftersubmitform: function(e, data){\n\t\t\t\tthis.updateMenuFromResponse(data.xhr);\n\t\t\t}\n\t\t},\n\n\t\t'from .cms-edit-form': {\n\t\t\tonrelodeditform: function(e, data){\n\t\t\t\tthis.updateMenuFromResponse(data.xmlhttp);\n\t\t\t}\n\t\t},\n\n\t\tgetContainingPanel: function(){\n\t\t\treturn this.closest('.cms-panel');\n\t\t},\n\n\t\tfromContainingPanel: {\n\t\t\tontoggle: function(e){\n\t\t\t\tthis.toggleClass('collapsed', $(e.target).hasClass('collapsed'));\n\n\t\t\t\t// Trigger synthetic resize event. Avoid native window.resize event\n\t\t\t\t// since it causes other behaviour which should be reserved for actual window dimension changes.\n\t\t\t\t$('.cms-container').trigger('windowresize');\n\n\t\t\t\t//If panel is closing\n\t\t\t\tif (this.hasClass('collapsed')) this.find('li.children.opened').removeClass('opened');\n\n\t\t\t\t//If panel is opening\n\t\t\t\tif(!this.hasClass('collapsed')) {\n\t\t\t\t\t$('.toggle-children.opened').closest('li').addClass('opened');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tupdateItems: function() {\n\t\t\t// Hide \"edit page\" commands unless the section is activated\n\t\t\tvar editPageItem = this.find('#Menu-CMSMain');\n\t\t\t\n\t\t\teditPageItem[editPageItem.is('.current') ? 'show' : 'hide']();\n\t\t\t\n\t\t\t// Update the menu links to reflect the page ID if the page has changed the URL.\n\t\t\tvar currentID = $('.cms-content input[name=ID]').val();\n\t\t\tif(currentID) {\n\t\t\t\tthis.find('li').each(function() {\n\t\t\t\t\tif($.isFunction($(this).setRecordID)) $(this).setRecordID(currentID);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\n\t/** Toggle the flyout panel to appear/disappear when mouse over */\n\t$('.cms-menu-list li').entwine({\n\t\ttoggleFlyout: function(bool) {\n\t\t\tvar fly = $(this);\n\n\t\t\tif (fly.children('ul').first().hasClass('collapsed-flyout')) {\n\t\t\t\tif (bool) { //expand\n\t\t\t\t\t// create the clone of the list item to be displayed\n\t\t\t\t\t// over the existing one\n\t\t\t\t\tif (\n\t\t\t\t\t\t!fly.children('ul')\n\t\t\t\t\t\t\t.first()\n\t\t\t\t\t\t\t.children('li')\n\t\t\t\t\t\t\t.first()\n\t\t\t\t\t\t\t.hasClass('clone')\n\t\t\t\t\t) {\n\n\t\t\t\t\t\tvar li = fly.clone();\n\t\t\t\t\t\tli.addClass('clone').css({\n\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tli.children('ul').first().remove();\n\n\t\t\t\t\t\tli.find('span').not('.text').remove();\n\n\t\t\t\t\t\tli.find('a').first().unbind('click');\n\n\t\t\t\t\t\tfly.children('ul').prepend(li);\n\t\t\t\t\t}\n\n\t\t\t\t\t$('.collapsed-flyout').show();\n\t\t\t\t\tfly.addClass('opened');\n\t\t\t\t\tfly.children('ul').find('li').fadeIn('fast');\n\t\t\t\t} else { //collapse\n\t\t\t\t\tif(li) {\n\t\t\t\t\t\tli.remove();\n\t\t\t\t\t}\n\t\t\t\t\t$('.collapsed-flyout').hide();\n\t\t\t\t\tfly.removeClass('opened');\n\t\t\t\t\tfly.find('toggle-children').removeClass('opened');\n\t\t\t\t\tfly.children('ul').find('li').hide();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t//slight delay to prevent flyout closing from \"sloppy mouse movement\"\n\t$('.cms-menu-list li').hoverIntent(function(){$(this).toggleFlyout(true);},function(){$(this).toggleFlyout(false);});\n\t\n\t$('.cms-menu-list .toggle').entwine({\n\t\tonclick: function(e) {\n\t\t\te.preventDefault();\n\t\t\t$(this).toogleFlyout(true);\n\t\t}\n\t});\n\t\n\t$('.cms-menu-list li').entwine({\n\t\tonmatch: function() {\n\t\t\tif(this.find('ul').length) {\n\t\t\t\tthis.find('a:first').append('<span class=\"toggle-children\"><span class=\"toggle-children-icon\"></span></span>');\n\t\t\t}\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\t\ttoggle: function() {\n\t\t\tthis[this.hasClass('opened') ? 'close' : 'open']();\n\t\t},\n\t\t/**\n\t\t * \"Open\" is just a visual state, and unrelated to \"current\".\n\t\t * More than one item can be open at the same time.\n\t\t */\n\t\topen: function() {\n\t\t\tvar parent = this.getMenuItem();\n\t\t\tif(parent) parent.open();\n\t\t\tif( this.find('li.clone') ) {\n\t\t\t\tthis.find('li.clone').remove();\n\t\t\t}\n\t\t\tthis.addClass('opened').find('ul').show();\n\t\t\tthis.find('.toggle-children').addClass('opened');\n\t\t},\n\t\tclose: function() {\n\t\t\tthis.removeClass('opened').find('ul').hide();\n\t\t\tthis.find('.toggle-children').removeClass('opened');\n\t\t},\n\t\tselect: function() {\n\t\t\tvar parent = this.getMenuItem();\n\t\t\tthis.addClass('current').open();\n\n\t\t\t// Remove \"current\" class from all siblings and their children\n\t\t\tthis.siblings().removeClass('current').close();\n\t\t\tthis.siblings().find('li').removeClass('current');\n\t\t\tif(parent) {\n\t\t\t\tvar parentSiblings = parent.siblings();\n\t\t\t\tparent.addClass('current');\n\t\t\t\tparentSiblings.removeClass('current').close();\n\t\t\t\tparentSiblings.find('li').removeClass('current').close();\n\t\t\t}\n\t\t\t\n\t\t\tthis.getMenu().updateItems();\n\n\t\t\tthis.trigger('select');\n\t\t}\n\t});\n\t\n\t$('.cms-menu-list *').entwine({\n\t\tgetMenu: function() {\n\t\t\treturn this.parents('.cms-menu-list:first');\n\t\t}\n\t});\n\n\t$('.cms-menu-list li *').entwine({\n\t\tgetMenuItem: function() {\n\t\t\treturn this.parents('li:first');\n\t\t}\n\t});\n\t\n\t/**\n\t * Both primary and secondary nav.\n\t */\n\t$('.cms-menu-list li a').entwine({\n\t\tonclick: function(e) {\n\t\t\t// Only catch left clicks, in order to allow opening in tabs.\n\t\t\t// Ignore external links, fallback to standard link behaviour\n\t\t\tvar isExternal = $.path.isExternal(this.attr('href'));\n\t\t\tif(e.which > 1 || isExternal) return;\n\n\t\t\t// if the developer has this to open in a new window, handle \n\t\t\t// that\n\t\t\tif(this.attr('target') == \"_blank\") {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\te.preventDefault();\n\n\t\t\tvar item = this.getMenuItem();\n\n\t\t\tvar url = this.attr('href');\n\t\t\tif(!isExternal) url = $('base').attr('href') + url;\n\t\t\t\n\t\t\tvar children = item.find('li');\n\t\t\tif(children.length) {\n\t\t\t\tchildren.first().find('a').click();\n\t\t\t} else {\n\t\t\t\t// Load URL, but give the loading logic an opportunity to veto the action\n\t\t\t\t// (e.g. because of unsaved changes)\n\t\t\t\tif(!$('.cms-container').loadPanel(url)) return false;\t\n\t\t\t}\n\n\t\t\titem.select();\n\t\t}\n\t});\n\n\t$('.cms-menu-list li .toggle-children').entwine({\n\t\tonclick: function(e) {\n\t\t\tvar li = this.closest('li');\n\t\t\tli.toggle();\n\t\t\treturn false; // prevent wrapping link event to fire\n\t\t}\n\t});\n\n\t$('.cms .profile-link').entwine({\n\t\tonclick: function() {\n\t\t\t$('.cms-container').loadPanel(this.attr('href'));\n\t\t\t$('.cms-menu-list li').removeClass('current').close(); \n\t\t\treturn false;\n\t\t}\n\t});\n\n\t/**\n\t * Toggles the manual override of the left menu's automatic expand / collapse behaviour.\n\t */\n\t$('.cms-menu .sticky-toggle').entwine({\n\n\t\tonadd: function () {\n\t\t\tvar isSticky = $('.cms-menu').getPersistedStickyState() ? true : false;\n\n\t\t\tthis.toggleCSS(isSticky);\n\t\t\tthis.toggleIndicator(isSticky);\n\n\t\t\tthis._super();\n\t\t},\n\n\t\t/**\n\t\t * @func toggleCSS\n\t\t * @param {boolean} isSticky - The current state of the menu.\n\t\t * @desc Toggles the 'active' CSS class of the element.\n\t\t */\n\t\ttoggleCSS: function (isSticky) {\n\t\t\tthis[isSticky ? 'addClass' : 'removeClass']('active');\n\t\t},\n\n\t\t/**\n\t\t * @func toggleIndicator\n\t\t * @param {boolean} isSticky - The current state of the menu.\n\t\t * @desc Updates the indicator's text based on the sticky state of the menu.\n\t\t */\n\t\ttoggleIndicator: function (isSticky) {\n\t\t\tthis.next('.sticky-status-indicator').text(isSticky ? 'fixed' : 'auto');\n\t\t},\n\n\t\tonclick: function () {\n\t\t\tvar $menu = this.closest('.cms-menu'),\n\t\t\t\tpersistedCollapsedState = $menu.getPersistedCollapsedState(),\n\t\t\t\tpersistedStickyState = $menu.getPersistedStickyState(),\n\t\t\t\tnewStickyState = persistedStickyState === void 0 ? !this.hasClass('active') : !persistedStickyState;\n\n\t\t\t// Update the persisted collapsed state\n\t\t\tif (persistedCollapsedState === void 0) {\n\t\t\t\t// If there is no persisted menu state currently set, then set it to the menu's current state.\n\t\t\t\t// This will be the case if the user has never manually expanded or collapsed the menu,\n\t\t\t\t// or the menu has previously been made unsticky.\n\t\t\t\t$menu.setPersistedCollapsedState($menu.hasClass('collapsed'));\n\t\t\t} else if (persistedCollapsedState !== void 0 && newStickyState === false) {\n\t\t\t\t// If there is a persisted state and the menu has been made unsticky, remove the persisted state.\n\t\t\t\t$menu.clearPersistedCollapsedState();\n\t\t\t}\n\n\t\t\t// Persist the sticky state of the menu\n\t\t\t$menu.setPersistedStickyState(newStickyState);\n\n\t\t\tthis.toggleCSS(newStickyState);\n\t\t\tthis.toggleIndicator(newStickyState);\n\n\t\t\tthis._super();\n\t\t}\n\t});\n});","import $ from 'jQuery';\n\n$.entwine('ss', function($) {\n\n\t// setup jquery.entwine\n\t$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;\n\n\t/**\n\t * Horizontal collapsible panel. Generic enough to work with CMS menu as well as various \"filter\" panels.\n\t * \n\t * A panel consists of the following parts:\n\t * - Container div: The outer element, with class \".cms-panel\"\n\t * - Header (optional)\n\t * - Content\n\t * - Expand and collapse toggle anchors (optional)\n\t * \n\t * Sample HTML:\n\t * <div class=\"cms-panel\">\n\t * <div class=\"cms-panel-header\">your header</div>\n\t * \t<div class=\"cms-panel-content\">your content here</div>\n\t *\t<div class=\"cms-panel-toggle\">\n\t * \t\t<a href=\"#\" class=\"toggle-expande\">your toggle text</a>\n\t * \t\t<a href=\"#\" class=\"toggle-collapse\">your toggle text</a>\n\t *\t</div>\n\t * </div>\n\t */\n\t$('.cms-panel').entwine({\n\t\t\n\t\tWidthExpanded: null,\n\t\t\n\t\tWidthCollapsed: null,\n\n\t\t/**\n\t\t * @func canSetCookie\n\t\t * @return {boolean}\n\t\t * @desc Before trying to set a cookie, make sure $.cookie and the element's id are both defined.\n\t\t */\n\t\tcanSetCookie: function () {\n\t\t\treturn $.cookie !== void 0 && this.attr('id') !== void 0;\n\t\t},\n\n\t\t/**\n\t\t * @func getPersistedCollapsedState\n\t\t * @return {boolean|undefined} - Returns true if the panel is collapsed, false if expanded. Returns undefined if there is no cookie set.\n\t\t * @desc Get the collapsed state of the panel according to the cookie.\n\t\t */\n\t\tgetPersistedCollapsedState: function () {\n\t\t\tvar isCollapsed, cookieValue;\n\n\t\t\tif (this.canSetCookie()) {\n\t\t\t\tcookieValue = $.cookie('cms-panel-collapsed-' + this.attr('id'));\n\n\t\t\t\tif (cookieValue !== void 0 && cookieValue !== null) {\n\t\t\t\t\tisCollapsed = cookieValue === 'true';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn isCollapsed;\n\t\t},\n\n\t\t/**\n\t\t * @func setPersistedCollapsedState\n\t\t * @param {boolean} newState - Pass true if you want the panel to be collapsed, false for expanded.\n\t\t * @desc Set the collapsed value of the panel, stored in cookies.\n\t\t */\n\t\tsetPersistedCollapsedState: function (newState) {\n\t\t\tif (this.canSetCookie()) {\n\t\t\t\t$.cookie('cms-panel-collapsed-' + this.attr('id'), newState, { path: '/', expires: 31 });\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @func clearPersistedState\n\t\t * @desc Remove the cookie responsible for maintaing the collapsed state.\n\t\t */\n\t\tclearPersistedCollapsedState: function () {\n\t\t\tif (this.canSetCookie()) {\n\t\t\t\t$.cookie('cms-panel-collapsed-' + this.attr('id'), '', { path: '/', expires: -1 });\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @func getInitialCollapsedState\n\t\t * @return {boolean} - Returns true if the the panel is collapsed, false if expanded.\n\t\t * @desc Get the initial collapsed state of the panel. Check if a cookie value is set then fall back to checking CSS classes.\n\t\t */\n\t\tgetInitialCollapsedState: function () {\n\t\t\tvar isCollapsed = this.getPersistedCollapsedState();\n\n\t\t\t// Fallback to getting the state from the default CSS class\n\t\t\tif (isCollapsed === void 0) {\n\t\t\t\tisCollapsed = this.hasClass('collapsed');\n\t\t\t}\n\n\t\t\treturn isCollapsed;\n\t\t},\n\n\t\tonadd: function() {\n\t\t\tvar collapsedContent, container;\n\n\t\t\tif(!this.find('.cms-panel-content').length) throw new Exception('Content panel for \".cms-panel\" not found');\n\t\t\t\n\t\t\t// Create default controls unless they already exist.\n\t\t\tif(!this.find('.cms-panel-toggle').length) {\n\t\t\t\tcontainer = $(\"<div class='cms-panel-toggle south'></div>\")\n\t\t\t\t\t.append('<a class=\"toggle-expand\" href=\"#\"><span>»</span></a>')\n\t\t\t\t\t.append('<a class=\"toggle-collapse\" href=\"#\"><span>«</span></a>');\n\t\t\t\t\t\n\t\t\t\tthis.append(container);\n\t\t\t}\n\t\t\t\n\t\t\t// Set panel width same as the content panel it contains. Assumes the panel has overflow: hidden.\n\t\t\tthis.setWidthExpanded(this.find('.cms-panel-content').innerWidth());\n\t\t\t\n\t\t\t// Assumes the collapsed width is indicated by the toggle, or by an optionally collapsed view\n\t\t\tcollapsedContent = this.find('.cms-panel-content-collapsed');\n\t\t\tthis.setWidthCollapsed(collapsedContent.length ? collapsedContent.innerWidth() : this.find('.toggle-expand').innerWidth());\n\n\t\t\t// Toggle visibility\n\t\t\tthis.togglePanel(!this.getInitialCollapsedState(), true, false);\n\t\t\t\n\t\t\tthis._super();\n\t\t},\n\n\t\t/**\n\t\t * @func togglePanel\n\t\t * @param doExpand {boolean} - true to expand, false to collapse.\n\t\t * @param silent {boolean} - true means that events won't be fired, which is useful for the component initialization phase.\n\t\t * @param doSaveState - if false, the panel's state will not be persisted via cookies.\n\t\t * @desc Toggle the expanded / collapsed state of the panel.\n\t\t */\n\t\ttogglePanel: function(doExpand, silent, doSaveState) {\n\t\t\tvar newWidth, collapsedContent;\n\n\t\t\tif(!silent) {\n\t\t\t\tthis.trigger('beforetoggle.sspanel', doExpand);\n\t\t\t\tthis.trigger(doExpand ? 'beforeexpand' : 'beforecollapse');\n\t\t\t}\n\n\t\t\tthis.toggleClass('collapsed', !doExpand);\n\t\t\tnewWidth = doExpand ? this.getWidthExpanded() : this.getWidthCollapsed();\n\t\t\t\n\t\t\tthis.width(newWidth); // the content panel width always stays in \"expanded state\" to avoid floating elements\n\t\t\t\n\t\t\t// If an alternative collapsed view exists, toggle it as well\n\t\t\tcollapsedContent = this.find('.cms-panel-content-collapsed');\n\t\t\tif(collapsedContent.length) {\n\t\t\t\tthis.find('.cms-panel-content')[doExpand ? 'show' : 'hide']();\n\t\t\t\tthis.find('.cms-panel-content-collapsed')[doExpand ? 'hide' : 'show']();\n\t\t\t}\n\n\t\t\tif (doSaveState !== false) {\n\t\t\t\tthis.setPersistedCollapsedState(!doExpand);\n\t\t\t}\n\n\t\t\t// TODO Fix redraw order (inner to outer), and re-enable silent flag\n\t\t\t// to avoid multiple expensive redraws on a single load.\n\t\t\t// if(!silent) {\n\t\t\t\tthis.trigger('toggle', doExpand);\n\t\t\t\tthis.trigger(doExpand ? 'expand' : 'collapse');\n\t\t\t// }\n\t\t},\n\t\t\n\t\texpandPanel: function(force) {\n\t\t\tif(!force && !this.hasClass('collapsed')) return;\n\n\t\t\tthis.togglePanel(true);\n\t\t},\n\t\t\n\t\tcollapsePanel: function(force) {\n\t\t\tif(!force && this.hasClass('collapsed')) return;\n\n\t\t\tthis.togglePanel(false);\n\t\t}\n\t});\n\n\t$('.cms-panel.collapsed .cms-panel-toggle').entwine({\n\t\tonclick: function(e) {\n\t\t\tthis.expandPanel();\n\t\t\te.preventDefault();\n\t\t}\n\t});\n\t\n\t$('.cms-panel *').entwine({\n\t\tgetPanel: function() {\n\t\t\treturn this.parents('.cms-panel:first');\n\t\t}\n\t});\n\t\t\t\n\t$('.cms-panel .toggle-expand').entwine({\n\t\tonclick: function(e) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\n\t\t\tthis.getPanel().expandPanel();\n\n\t\t\tthis._super(e);\n\t\t}\n\t});\n\t\n\t$('.cms-panel .toggle-collapse').entwine({\n\t\tonclick: function(e) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\n\t\t\tthis.getPanel().collapsePanel();\n\n\t\t\tthis._super(e);\n\t\t}\n\t});\n\n\t$('.cms-content-tools.collapsed').entwine({\n\t\t// Expand CMS' centre pane, when the pane itself is clicked somewhere\n\t\tonclick: function(e) {\n\t\t\tthis.expandPanel();\n\t\t\tthis._super(e);\n\t\t}\n\t});\n});\n","import $ from 'jQuery';\nimport i18n from 'i18n';\n\n$.entwine('ss.preview', function($){\n\n\t/**\n\t * Shows a previewable website state alongside its editable version in backend UI.\n\t *\n\t * Relies on the server responses to indicate if a preview is available for the \n\t * currently loaded admin interface - signified by class \".cms-previewable\" being present.\n\t *\n\t * The preview options at the bottom are constructured by grabbing a SilverStripeNavigator \n\t * structure also provided by the backend.\n\t */\n\t$('.cms-preview').entwine({\n\n\t\t/**\n\t\t * List of SilverStripeNavigator states (SilverStripeNavigatorItem classes) to search for.\n\t\t * The order is significant - if the state is not available, preview will start searching the list\n\t\t * from the beginning.\n\t\t */\n\t\tAllowedStates: ['StageLink', 'LiveLink','ArchiveLink'],\n\n\t\t/**\n\t\t * API\n\t\t * Name of the current preview state - one of the \"AllowedStates\".\n\t\t */\n\t\tCurrentStateName: null,\n\n\t\t/**\n\t\t * API\n\t\t * Current size selection.\n\t\t */\n\t\tCurrentSizeName: 'auto',\n\n\t\t/**\n\t\t * Flags whether the preview is available on this CMS section.\n\t\t */\n\t\tIsPreviewEnabled: false,\n\n\t\t/**\n\t\t * Mode in which the preview will be enabled.\n\t\t */\n\t\tDefaultMode: 'split',\n\n\t\tSizes: {\n\t\t\tauto: {\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%'\n\t\t\t},\n\t\t\tmobile: {\n\t\t\t\twidth: '335px', // add 15px for approx desktop scrollbar \n\t\t\t\theight: '568px' \n\t\t\t},\n\t\t\tmobileLandscape: {\n\t\t\t\twidth: '583px', // add 15px for approx desktop scrollbar\n\t\t\t\theight: '320px'\n\t\t\t},\n\t\t\ttablet: {\n\t\t\t\twidth: '783px', // add 15px for approx desktop scrollbar\n\t\t\t\theight: '1024px'\n\t\t\t},\n\t\t\ttabletLandscape: {\n\t\t\t\twidth: '1039px', // add 15px for approx desktop scrollbar\n\t\t\t\theight: '768px'\n\t\t\t},\n\t\t\tdesktop: {\n\t\t\t\twidth: '1024px',\n\t\t\t\theight: '800px'\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * API\n\t\t * Switch the preview to different state.\n\t\t * stateName can be one of the \"AllowedStates\".\n\t\t *\n\t\t * @param {String}\n\t\t * @param {Boolean} Set to FALSE to avoid persisting the state\n\t\t */\n\t\tchangeState: function(stateName, save) {\t\t\t\t\n\t\t\tvar self = this, states = this._getNavigatorStates();\n\t\t\tif(save !== false) {\n\t\t\t\t$.each(states, function(index, state) {\n\t\t\t\t\tself.saveState('state', stateName);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.setCurrentStateName(stateName);\n\t\t\tthis._loadCurrentState();\n\t\t\tthis.redraw();\n\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * API\n\t\t * Change the preview mode.\n\t\t * modeName can be: split, content, preview.\n\t\t */\n\t\tchangeMode: function(modeName, save) {\t\t\t\t\n\t\t\tvar container = $('.cms-container');\n\n\t\t\tif (modeName == 'split') {\n\t\t\t\tcontainer.entwine('.ss').splitViewMode();\n\t\t\t\tthis.setIsPreviewEnabled(true);\n\t\t\t\tthis._loadCurrentState();\n\t\t\t} else if (modeName == 'content') {\n\t\t\t\tcontainer.entwine('.ss').contentViewMode();\n\t\t\t\tthis.setIsPreviewEnabled(false);\n\t\t\t\t// Do not load content as the preview is not visible.\n\t\t\t} else if (modeName == 'preview') {\n\t\t\t\tcontainer.entwine('.ss').previewMode();\n\t\t\t\tthis.setIsPreviewEnabled(true);\n\t\t\t\tthis._loadCurrentState();\n\t\t\t} else {\n\t\t\t\tthrow 'Invalid mode: ' + modeName;\n\t\t\t}\n\n\t\t\tif(save !== false) this.saveState('mode', modeName);\n\n\t\t\tthis.redraw();\n\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * API\n\t\t * Change the preview size.\n\t\t * sizeName can be: auto, desktop, tablet, mobile.\n\t\t */\n\t\tchangeSize: function(sizeName) {\n\t\t\tvar sizes = this.getSizes();\n\n\t\t\tthis.setCurrentSizeName(sizeName);\n\t\t\tthis.removeClass('auto desktop tablet mobile').addClass(sizeName);\n\t\t\tthis.find('.preview-device-outer')\n\t\t\t\t.width(sizes[sizeName].width)\n\t\t\t\t.height(sizes[sizeName].height);\n\t\t\tthis.find('.preview-device-inner')\n\t\t\t\t.width(sizes[sizeName].width);\n\n\t\t\tthis.saveState('size', sizeName);\n\n\t\t\tthis.redraw();\n\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * API\n\t\t * Update the visual appearance to match the internal preview state.\n\t\t */\n\t\tredraw: function() {\t\t\t\n\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\n\t\t\t// Update preview state selector.\n\t\t\tvar currentStateName = this.getCurrentStateName();\n\t\t\tif (currentStateName) {\n\t\t\t\tthis.find('.cms-preview-states').changeVisibleState(currentStateName);\n\t\t\t}\n\n\t\t\t// Update preview mode selectors.\n\t\t\tvar layoutOptions = $('.cms-container').entwine('.ss').getLayoutOptions();\n\t\t\tif (layoutOptions) {\n\t\t\t\t// There are two mode selectors that we need to keep in sync. Redraw both.\n\t\t\t\t$('.preview-mode-selector').changeVisibleMode(layoutOptions.mode);\n\t\t\t}\n\n\t\t\t// Update preview size selector.\n\t\t\tvar currentSizeName = this.getCurrentSizeName();\n\t\t\tif (currentSizeName) {\n\t\t\t\tthis.find('.preview-size-selector').changeVisibleSize(this.getCurrentSizeName());\n\t\t\t}\n\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Store the preview options for this page.\n\t\t */\n\t\tsaveState : function(name, value) {\n\t\t\tif(this._supportsLocalStorage()) window.localStorage.setItem('cms-preview-state-' + name, value);\n\t\t},\n\n\t\t/**\n\t\t * Load previously stored preferences\n\t\t */\n\t\tloadState : function(name) {\n\t\t\tif(this._supportsLocalStorage()) return window.localStorage.getItem('cms-preview-state-' + name);\n\t\t}, \n\n\t\t/**\n\t\t * Disable the area - it will not appear in the GUI.\n\t\t * Caveat: the preview will be automatically enabled when \".cms-previewable\" class is detected.\n\t\t */\n\t\tdisablePreview: function() {\n\t\t\tthis.setPendingURL(null);\n\t\t\tthis._loadUrl('about:blank');\n\t\t\tthis._block();\n\t\t\tthis.changeMode('content', false);\n\t\t\tthis.setIsPreviewEnabled(false);\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Enable the area and start updating to reflect the content editing.\n\t\t */\n\t\tenablePreview: function() {\n\t\t\tif (!this.getIsPreviewEnabled()) {\n\t\t\t\tthis.setIsPreviewEnabled(true);\n\n\t\t\t\t// Initialise mode.\n\t\t\t\tif ($.browser.msie && $.browser.version.slice(0,3)<=7) {\n\t\t\t\t\t// We do not support the split mode in IE < 8.\n\t\t\t\t\tthis.changeMode('content');\n\t\t\t\t} else {\n\t\t\t\t\tthis.changeMode(this.getDefaultMode(), false);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Return a style element we can use in IE8 to fix fonts (see readystatechange binding in onadd below)\n\t\t */\n\t\tgetOrAppendFontFixStyleElement: function() {\n\t\t\tvar style = $('#FontFixStyleElement');\n\t\t\tif (!style.length) {\n\t\t\t\tstyle = $(\n\t\t\t\t\t'<style type=\"text/css\" id=\"FontFixStyleElement\" disabled=\"disabled\">'+\n\t\t\t\t\t\t':before,:after{content:none !important}'+\n\t\t\t\t\t'</style>'\n\t\t\t\t).appendTo('head');\n\t\t\t}\n\n\t\t\treturn style;\n\t\t},\n\n\t\t/**\n\t\t * Initialise the preview element.\n\t\t */\n\t\tonadd: function() {\n\t\t\tvar self = this, layoutContainer = this.parent(), iframe = this.find('iframe');\n\n\t\t\t// Create layout and controls\n\t\t\tiframe.addClass('center');\n\t\t\tiframe.bind('load', function() {\n\t\t\t\tself._adjustIframeForPreview();\n\n\t\t\t\t// Load edit view for new page, but only if the preview is activated at the moment.\n\t\t\t\t// This avoids e.g. force-redirections of the edit view on RedirectorPage instances.\n\t\t\t\tself._loadCurrentPage();\n\t\t\t\t\n\t\t\t\t$(this).removeClass('loading');\n\t\t\t});\n\n\t\t\t// If there's any webfonts in the preview, IE8 will start glitching. This fixes that.\n\t\t\tif ($.browser.msie && 8 === parseInt($.browser.version, 10)) {\n\t\t\t\tiframe.bind('readystatechange', function(e) {\n\t\t\t\t\tif(iframe[0].readyState == 'interactive') {\n\t\t\t\t\t\tself.getOrAppendFontFixStyleElement().removeAttr('disabled');\n\t\t\t\t\t\tsetTimeout(function(){ self.getOrAppendFontFixStyleElement().attr('disabled', 'disabled'); }, 0);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Preview might not be available in all admin interfaces - block/disable when necessary\n\t\t\tthis.append('<div class=\"cms-preview-overlay ui-widget-overlay-light\"></div>');\n\t\t\tthis.find('.cms-preview-overlay').hide();\t\t\t\n\n\t\t\tthis.disablePreview();\n\n\t\t\tthis._super();\n\t\t},\n\t\t\n\t\t/**\n\t\t* Detect and use localStorage if available. In IE11 windows 8.1 call to window.localStorage was throwing out an access denied error in some cases which was causing the preview window not to display correctly in the CMS admin area.\n\t\t*/\n\t\t_supportsLocalStorage: function() {\n\t\t\tvar uid = new Date;\n\t\t\tvar storage;\n\t\t\tvar result;\n\t\t\ttry {\n\t\t\t\t(storage = window.localStorage).setItem(uid, uid);\n\t\t\t\tresult = storage.getItem(uid) == uid;\n\t\t\t\tstorage.removeItem(uid);\n\t\t\t\treturn result && storage;\n\t\t\t} catch (exception) {\n\t\t\t\tconsole.warn('localStorge is not available due to current browser / system settings.');\n\t\t\t}\n\t\t},\n\n\t\tonenable: function () {\n\t\t\tvar $viewModeSelector = $('.preview-mode-selector');\n\n\t\t\t$viewModeSelector.removeClass('split-disabled');\n\t\t\t$viewModeSelector.find('.disabled-tooltip').hide();\n\t\t},\n\n\t\tondisable: function () {\n\t\t\tvar $viewModeSelector = $('.preview-mode-selector');\n\n\t\t\t$viewModeSelector.addClass('split-disabled');\n\t\t\t$viewModeSelector.find('.disabled-tooltip').show();\n\t\t},\n\n\t\t/**\n\t\t * Set the preview to unavailable - could be still visible. This is purely visual.\n\t\t */\n\t\t_block: function() {\n\t\t\tthis.addClass('blocked');\n\t\t\tthis.find('.cms-preview-overlay').show();\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Set the preview to available (remove the overlay);\n\t\t */\n\t\t_unblock: function() {\n\t\t\tthis.removeClass('blocked');\n\t\t\tthis.find('.cms-preview-overlay').hide();\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Update the preview according to browser and CMS section capabilities.\n\t\t */\n\t\t_initialiseFromContent: function() {\n\t\t\tvar mode, size;\n\n\t\t\tif (!$('.cms-previewable').length) {\n\t\t\t\tthis.disablePreview();\n\t\t\t} else {\n\t\t\t\tmode = this.loadState('mode');\n\t\t\t\tsize = this.loadState('size');\n\n\t\t\t\tthis._moveNavigator();\n\t\t\t\tif(!mode || mode != 'content') {\n\t\t\t\t\tthis.enablePreview();\n\t\t\t\t\tthis._loadCurrentState();\n\t\t\t\t}\n\t\t\t\tthis.redraw();\n\n\t\t\t\t// now check the cookie to see if we have any preview settings that have been\n\t\t\t\t// retained for this page from the last visit\n\t\t\t\tif(mode) this.changeMode(mode);\n\t\t\t\tif(size) this.changeSize(size);\n\t\t\t}\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Update preview whenever any panels are reloaded.\n\t\t */\n\t\t'from .cms-container': {\n\t\t\tonafterstatechange: function(e, data) {\n\t\t\t\t// Don't update preview if we're dealing with a custom redirect\n\t\t\t\tif(data.xhr.getResponseHeader('X-ControllerURL')) return;\n\n\t\t\t\tthis._initialiseFromContent();\n\t\t\t}\n\t\t},\n\n\t\t/** @var string A URL that should be displayed in this preview panel once it becomes visible */\n\t\tPendingURL: null,\n\n\t\toncolumnvisibilitychanged: function() {\n\t\t\tvar url = this.getPendingURL();\n\t\t\tif (url && !this.is('.column-hidden')) {\n\t\t\t\tthis.setPendingURL(null);\n\t\t\t\tthis._loadUrl(url);\n\t\t\t\tthis._unblock();\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Update preview whenever a form is submitted.\n\t\t * This is an alternative to the LeftAndmMain::loadPanel functionality which we already\n\t\t * cover in the onafterstatechange handler.\n\t\t */\n\t\t'from .cms-container .cms-edit-form': {\n\t\t\tonaftersubmitform: function(){\n\t\t\t\tthis._initialiseFromContent();\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Change the URL of the preview iframe (if its not already displayed).\n\t\t */\n\t\t_loadUrl: function(url) {\n\t\t\tthis.find('iframe').addClass('loading').attr('src', url);\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Fetch available states from the current SilverStripeNavigator (SilverStripeNavigatorItems).\n\t\t * Navigator is supplied by the backend and contains all state options for the current object.\n\t\t */\n\t\t_getNavigatorStates: function() {\n\t\t\t// Walk through available states and get the URLs.\n\t\t\tvar urlMap = $.map(this.getAllowedStates(), function(name) {\n\t\t\t\tvar stateLink = $('.cms-preview-states .state-name[data-name=' + name + ']');\n\t\t\t\tif(stateLink.length) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: name, \n\t\t\t\t\t\turl: stateLink.attr('data-link'),\n\t\t\t\t\t\tactive: stateLink.is(':radio') ? stateLink.is(':checked') : stateLink.is(':selected')\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn urlMap;\n\t\t},\n\n\t\t/**\n\t\t * Load current state into the preview (e.g. StageLink or LiveLink).\n\t\t * We try to reuse the state we have been previously in. Otherwise we fall back\n\t\t * to the first state available on the \"AllowedStates\" list.\n\t\t *\n\t\t * @returns New state name.\n\t\t */\n\t\t_loadCurrentState: function() {\n\t\t\tif (!this.getIsPreviewEnabled()) return this;\n\n\t\t\tvar states = this._getNavigatorStates();\n\t\t\tvar currentStateName = this.getCurrentStateName();\n\t\t\tvar currentState = null;\n\n\t\t\t// Find current state within currently available states.\n\t\t\tif (states) {\n\t\t\t\tcurrentState = $.grep(states, function(state, index) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tcurrentStateName === state.name ||\n\t\t\t\t\t\t(!currentStateName && state.active)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tvar url = null;\n\n\t\t\tif (currentState[0]) {\n\t\t\t\t// State is available on the newly loaded content. Get it.\n\t\t\t\turl = currentState[0].url;\n\t\t\t} else if (states.length) {\n\t\t\t\t// Fall back to the first available content state.\n\t\t\t\tthis.setCurrentStateName(states[0].name);\n\t\t\t\turl = states[0].url;\n\t\t\t} else {\n\t\t\t\t// No state available at all.\n\t\t\t\tthis.setCurrentStateName(null);\n\t\t\t}\n\n\t\t\t// Mark url as a preview url so it can get special treatment\n \t\t\turl += ((url.indexOf('?') === -1) ? '?' : '&') + 'CMSPreview=1';\n\n\t\t\t// If this preview panel isn't visible at the moment, delay loading the URL until it (maybe) is later\n\t\t\tif (this.is('.column-hidden')) {\n\t\t\t\tthis.setPendingURL(url);\n\t\t\t\tthis._loadUrl('about:blank');\n\t\t\t\tthis._block();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.setPendingURL(null);\n\n\t\t\t\tif (url) {\n\t\t\t\t\tthis._loadUrl(url);\n\t\t\t\t\tthis._unblock();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis._block();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this;\n\t\t},\n\n\t\t/**\n\t\t * Move the navigator from the content to the preview bar.\n\t\t */\n\t\t_moveNavigator: function() {\n\t\t\tvar previewEl = $('.cms-preview .cms-preview-controls');\n\t\t\tvar navigatorEl = $('.cms-edit-form .cms-navigator');\n\n\t\t\tif (navigatorEl.length && previewEl.length) {\n\t\t\t\t// Navigator is available - install the navigator.\n\t\t\t\tpreviewEl.html($('.cms-edit-form .cms-navigator').detach());\n\t\t\t} else {\n\t\t\t\t// Navigator not available.\n\t\t\t\tthis._block();\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Loads the matching edit form for a page viewed in the preview iframe,\n\t\t * based on metadata sent along with this document.\n\t\t */\n\t\t_loadCurrentPage: function() {\n\t\t\tif (!this.getIsPreviewEnabled()) return;\n\n var doc,\n containerEl = $('.cms-container');\n try {\n doc = this.find('iframe')[0].contentDocument;\n } catch (e) {\n // iframe can't be accessed - might be secure?\n console.warn('Unable to access iframe, possible https mis-match');\n }\n if (!doc) {\n return;\n }\n\n\t\t\t// Load this page in the admin interface if appropriate\n\t\t\tvar id = $(doc).find('meta[name=x-page-id]').attr('content'); \n\t\t\tvar editLink = $(doc).find('meta[name=x-cms-edit-link]').attr('content');\n\t\t\tvar contentPanel = $('.cms-content');\n\t\t\t\n\t\t\tif(id && contentPanel.find(':input[name=ID]').val() != id) {\n\t\t\t\t// Ignore behaviour without history support (as we need ajax loading \n\t\t\t\t// for the new form to load in the background)\n\t\t\t\t$('.cms-container').entwine('.ss').loadPanel(editLink);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Prepare the iframe content for preview.\n\t\t */\n\t\t_adjustIframeForPreview: function() {\n var iframe = this.find('iframe')[0],\n doc;\n if(!iframe){\n return;\n }\n\n try {\n doc = iframe.contentDocument;\n } catch (e) {\n // iframe can't be accessed - might be secure?\n console.warn('Unable to access iframe, possible https mis-match');\n }\n if(!doc) {\n return;\n }\n\n\t\t\t// Open external links in new window to avoid \"escaping\" the internal page context in the preview\n\t\t\t// iframe, which is important to stay in for the CMS logic.\n\t\t\tvar links = doc.getElementsByTagName('A');\n\t\t\tfor (var i = 0; i < links.length; i++) {\n\t\t\t\tvar href = links[i].getAttribute('href');\n\t\t\t\tif(!href) continue;\n\t\t\t\t\n\t\t\t\tif (href.match(/^http:\\/\\//)) links[i].setAttribute('target', '_blank');\n\t\t\t}\n\n\t\t\t// Hide the navigator from the preview iframe and use only the CMS one.\n\t\t\tvar navi = doc.getElementById('SilverStripeNavigator');\n\t\t\tif(navi) navi.style.display = 'none';\n\t\t\tvar naviMsg = doc.getElementById('SilverStripeNavigatorMessage');\n\t\t\tif(naviMsg) naviMsg.style.display = 'none';\n\n\t\t\t// Trigger extensions.\n\t\t\tthis.trigger('afterIframeAdjustedForPreview', [ doc ]);\n\t\t}\n\t});\n\n\t$('.cms-edit-form').entwine({\n\t\tonadd: function() {\n\t\t\tthis._super();\n\t\t\t$('.cms-preview')._initialiseFromContent();\n\t\t}\n\t});\n\t\n\t/**\n\t * \"Preview state\" functions.\n\t * -------------------------------------------------------------------\n\t */\n\t$('.cms-preview-states').entwine({\n\t\t/**\n\t\t * Change the appearance of the state selector.\n\t\t */\n\t\tchangeVisibleState: function(state) {\n\t\t\tthis.find('input[data-name=\"'+state+'\"]').prop('checked', true);\n\t\t}\n\t});\n\n\t$('.cms-preview-states .state-name').entwine({\n\t\t/**\n\t\t * Reacts to the user changing the state of the preview.\n\t\t */\n\t\tonclick: function(e) {\t\n\t\t\t//Add and remove classes to make switch work ok in old IE\n\t\t\tthis.parent().find('.active').removeClass('active');\n\t\t\tthis.next('label').addClass('active');\n\n\t\t\tvar targetStateName = $(this).attr('data-name');\n\t\t\t// Reload preview with the selected state.\n\t\t\t$('.cms-preview').changeState(targetStateName);\t\t\t\t\n\t\t}\n\t});\t\n\t\n\t/**\n\t * \"Preview mode\" functions\n\t * -------------------------------------------------------------------\n\t */\n\t$('.preview-mode-selector').entwine({\n\t\t/**\n\t\t * Change the appearance of the mode selector.\n\t\t */\n\t\tchangeVisibleMode: function(mode) {\n\t\t\tthis.find('select')\n\t\t\t\t.val(mode)\n\t\t\t\t.trigger('liszt:updated')\n\t\t\t\t._addIcon();\n\t\t}\n\t});\n\n\t$('.preview-mode-selector select').entwine({\n\t\t/**\n\t\t * Reacts to the user changing the preview mode.\n\t\t */\n\t\tonchange: function(e) {\t\t\t\t\n\t\t\tthis._super(e);\n\t\t\te.preventDefault();\n\n\t\t\tvar targetStateName = $(this).val();\n\t\t\t$('.cms-preview').changeMode(targetStateName);\n\t\t}\n\t});\n\n\t\n\t$('.preview-mode-selector .chzn-results li').entwine({\n\t\t/**\n\t\t * IE8 doesn't support programatic access to onchange event \n\t\t *\tso react on click\n\t\t */\n\t\tonclick:function(e){\n\t\t\tif ($.browser.msie) {\n\t\t\t\te.preventDefault();\t\t\t\t\t\n\t\t\t\tvar index = this.index();\n\t\t\t\tvar targetStateName = this.closest('.preview-mode-selector').find('select option:eq('+index+')').val();\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t//var targetStateName = $(this).val();\n\t\t\t\t$('.cms-preview').changeMode(targetStateName);\n\t\t\t}\n\t\t}\n\t});\n\t\n\t/**\n\t * Adjust the visibility of the preview-mode selector in the CMS part (hidden if preview is visible).\n\t */\n\t$('.cms-preview.column-hidden').entwine({\n\t\tonmatch: function() {\n\t\t\t$('#preview-mode-dropdown-in-content').show();\n\t\t\t// Alert the user as to why the preview is hidden\n\t\t\tif ($('.cms-preview .result-selected').hasClass('font-icon-columns')) {\n\t\t\t\tstatusMessage(i18n._t(\n\t\t\t\t\t'LeftAndMain.DISABLESPLITVIEW',\n\t\t\t\t\t\"Screen too small to show site preview in split mode\"),\n\t\t\t\t\"error\");\n\t\t\t}\n\t\t\tthis._super();\n\t\t},\n\n\t\tonunmatch: function() {\n\t\t\t$('#preview-mode-dropdown-in-content').hide();\n\t\t\tthis._super();\n\t\t}\n\t});\n\n\t/**\n\t * Initialise the preview-mode selector in the CMS part (could be hidden if preview is visible).\n\t */\n\t$('#preview-mode-dropdown-in-content').entwine({\n\t\tonmatch: function() {\n\t\t\tif ($('.cms-preview').is('.column-hidden')) {\n\t\t\t\tthis.show();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.hide();\n\t\t\t}\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t}\n\t});\n\n\t/**\n\t * \"Preview size\" functions\n\t * -------------------------------------------------------------------\n\t */\n\t$('.preview-size-selector').entwine({\n\t\t/**\n\t\t * Change the appearance of the size selector.\n\t\t */\n\t\tchangeVisibleSize: function(size) {\t\t\t\t\n\t\t\tthis.find('select')\n\t\t\t\t.val(size)\n\t\t\t\t.trigger('liszt:updated')\n\t\t\t\t._addIcon();\n\t\t}\n\t});\n\n\t$('.preview-size-selector select').entwine({\n\t\t/**\n\t\t * Trigger change in the preview size.\n\t\t */\n\t\tonchange: function(e) {\n\t\t\te.preventDefault();\n\n\t\t\tvar targetSizeName = $(this).val();\n\t\t\t$('.cms-preview').changeSize(targetSizeName);\n\t\t}\n\t});\n\n\t\n\t/**\n\t * \"Chosen\" plumbing.\n\t * -------------------------------------------------------------------\n\t */\n\n\t/*\n\t*\tAdd a class to the chzn select trigger based on the currently \n\t*\tselected option. Update as this changes\n\t*/\n\t$('.preview-selector select.preview-dropdown').entwine({\n\t\t'onliszt:showing_dropdown': function() {\n\t\t\tthis.siblings().find('.chzn-drop').addClass('open')._alignRight();\n\t\t},\n\n\t\t'onliszt:hiding_dropdown': function() {\n\t\t\tthis.siblings().find('.chzn-drop').removeClass('open')._removeRightAlign();\n\t\t},\n\n\t\t/**\n\t\t * Trigger additional initial icon update when the control is fully loaded.\n\t\t * Solves an IE8 timing issue.\n\t\t */\n\t\t'onliszt:ready': function() {\n\t\t\tthis._super();\n\t\t\tthis._addIcon();\n\t\t},\n\n\t\t_addIcon: function(){\n\t\t\tvar selected = this.find(':selected');\t\t\t\t\n\t\t\tvar iconClass = selected.attr('data-icon');\t\n\t\t\t\t\t\t\t\n\t\t\tvar target = this.parent().find('.chzn-container a.chzn-single');\n\t\t\tvar oldIcon = target.attr('data-icon');\n\t\t\tif(typeof oldIcon !== 'undefined'){\n\t\t\t\ttarget.removeClass(oldIcon);\n\t\t\t}\n\t\t\ttarget.addClass(iconClass);\n\t\t\ttarget.attr('data-icon', iconClass);\t\t\t\t\n\n\t\t\treturn this;\n\t\t}\n\t});\n\n\t$('.preview-selector .chzn-drop').entwine({\n\t\t_alignRight: function(){\n\t\t\tvar that = this;\n\t\t\t$(this).hide();\n\t\t\t/* Delay so styles applied after chosen applies css\t\n\t\t\t (the line after we find out the dropdown is open)\n\t\t\t*/\n\t\t\tsetTimeout(function(){ \n\t\t\t\t$(that).css({left:'auto', right:0});\n\t\t\t\t$(that).show();\t\n\t\t\t}, 100);\t\t\t\t\t\t\t\n\t\t},\n\t\t_removeRightAlign:function(){\n\t\t\t$(this).css({right:'auto'});\n\t\t}\n\n\t});\n\n\t/* \n\t* Means of having extra styled data in chzn 'preview-selector' selects \n\t* When chzn ul is ready, grab data-description from original select. \n\t* If it exists, append to option and add description class to list item\n\t*/\n\t/*\n\n\tCurrently buggy (adds dexcription, then re-renders). This may need to \n\tbe done inside chosen. Chosen recommends to do this stuff in the css, \n\tbut that option is inaccessible and untranslatable \n\t(https://github.com/harvesthq/chosen/issues/399)\n\n\t$('.preview-selector .chzn-drop ul').entwine({\n\t\tonmatch: function() {\n\t\t\tthis.extraData();\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\t\textraData: function(){\n\t\t\tvar that = this;\n\t\t\tvar options = this.closest('.preview-selector').find('select option');\t\n\t\t\t\t\n\t\t\t$.each(options, function(index, option){\n\t\t\t\tvar target = $(that).find(\"li:eq(\" + index + \")\");\n\t\t\t\tvar description = $(option).attr('data-description');\n\t\t\t\tif(description != undefined && !$(target).hasClass('description')){\n\t\t\t\t\t$(target).append('<span>' + description + '</span>');\n\t\t\t\t\t$(target).addClass('description');\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}); */\n\n\t$('.preview-mode-selector .chzn-drop li:last-child').entwine({\n\t\tonmatch: function () {\n\t\t\tif ($('.preview-mode-selector').hasClass('split-disabled')) {\n\t\t\t\tthis.parent().append('<div class=\"disabled-tooltip\"></div>');\n\t\t\t} else {\n\t\t\t\tthis.parent().append('<div class=\"disabled-tooltip\" style=\"display: none;\"></div>');\n\t\t\t}\n\t\t}\n\t});\n\n\t/**\n\t * Recalculate the preview space to allow for horizontal scrollbar and the preview actions panel\n\t */\n\t$('.preview-scroll').entwine({\n\t\t/**\n\t\t * Height of the preview actions panel\n\t\t */\n\t\tToolbarSize: 53,\n\n\t\t_redraw: function() {\n\t\t\tvar toolbarSize = this.getToolbarSize();\n\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\t\t\tvar previewHeight = (this.height() - toolbarSize);\n\t\t\tthis.height(previewHeight);\n\t\t}, \n\n\t\tonmatch: function() {\n\t\t\tthis._redraw();\n\t\t\tthis._super();\n\t\t},\n\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t}\n\t\t// TODO: Need to recalculate on resize of browser\n\n\t});\n\n\t/**\n\t * Rotate preview to landscape\n\t */\n\t$('.preview-device-outer').entwine({\n\t\tonclick: function () {\n\t\t\tthis.toggleClass('rotate');\n\t\t}\n\t});\n});\n","/**\n * File: LeftAndMain.Tree.js\n */\n\nimport $ from 'jQuery';\n\n$.entwine('ss.tree', function($){\n\n\t$('.cms-tree').entwine({\n\t\t\n\t\tHints: null,\n\n\t\tIsUpdatingTree: false,\n\n\t\tIsLoaded: false,\n\n\t\tonadd: function(){\n\t\t\tthis._super();\n\n\t\t\t// Don't reapply (expensive) tree behaviour if already present\n\t\t\tif($.isNumeric(this.data('jstree_instance_id'))) return;\n\t\t\t\n\t\t\tvar hints = this.attr('data-hints');\n\t\t\tif(hints) this.setHints($.parseJSON(hints));\n\t\t\t\n\t\t\t/**\n\t\t\t * @todo Icon and page type hover support\n\t\t\t * @todo Sorting of sub nodes (originally placed in context menu)\n\t\t\t * @todo Automatic load of full subtree via ajax on node checkbox selection (minNodeCount = 0)\n\t\t\t * to avoid doing partial selection with \"hidden nodes\" (unloaded markup)\n\t\t\t * @todo Disallow drag'n'drop when node has \"noChildren\" set (see siteTreeHints)\n\t\t\t * @todo Disallow moving of pages marked as deleted \n\t\t\t * most likely by server response codes rather than clientside\n\t\t\t * @todo \"defaultChild\" when creating a page (sitetreeHints)\n\t\t\t * @todo Duplicate page (originally located in context menu)\n\t\t\t * @todo Update tree node title information and modified state after reordering (response is a JSON array)\n\t\t\t * \n\t\t\t * Tasks most likely not required after moving to a standalone tree:\n\t\t\t * \n\t\t\t * @todo Context menu - to be replaced by a bezel UI\n\t\t\t * @todo Refresh form for selected tree node if affected by reordering (new parent relationship)\n\t\t\t * @todo Cancel current form load via ajax when new load is requested (synchronous loading)\n\t\t\t */\n\t\t\tvar self = this;\n\t\t\t\tthis\n\t\t\t\t\t.jstree(this.getTreeConfig())\n\t\t\t\t\t.bind('loaded.jstree', function(e, data) {\n\t\t\t\t\t\tself.setIsLoaded(true);\n\n\t\t\t\t\t\t// Add ajax settings after init period to avoid unnecessary initial ajax load\n\t\t\t\t\t\t// of existing tree in DOM - see load_node_html()\n\t\t\t\t\t\tdata.inst._set_settings({'html_data': {'ajax': {\n\t\t\t\t\t\t\t'url': self.data('urlTree'),\n\t\t\t\t\t\t\t'data': function(node) {\n\t\t\t\t\t\t\t\tvar params = self.data('searchparams') || [];\n\t\t\t\t\t\t\t\t// Avoid duplication of parameters\n\t\t\t\t\t\t\t\tparams = $.grep(params, function(n, i) {return (n.name != 'ID' && n.name != 'value');});\n\t\t\t\t\t\t\t\tparams.push({name: 'ID', value: $(node).data(\"id\") ? $(node).data(\"id\") : 0});\n\t\t\t\t\t\t\t\tparams.push({name: 'ajax', value: 1});\n\t\t\t\t\t\t\t\treturn params;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}});\n\n\t\t\t\t\t\tself.updateFromEditForm();\n\t\t\t\t\t\tself.css('visibility', 'visible');\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Only show checkboxes with .multiple class\n\t\t\t\t\t\tdata.inst.hide_checkboxes();\n\t\t\t\t\t})\n\t\t\t\t\t.bind('before.jstree', function(e, data) {\n\t\t\t\t\t\tif(data.func == 'start_drag') {\n\t\t\t\t\t\t\t// Don't allow drag'n'drop if multi-select is enabled'\n\t\t\t\t\t\t\tif(!self.hasClass('draggable') || self.hasClass('multiselect')) {\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif($.inArray(data.func, ['check_node', 'uncheck_node'])) {\n\t\t\t\t\t\t\t// don't allow check and uncheck if parent is disabled\n\t\t\t\t\t\t\tvar node = $(data.args[0]).parents('li:first');\n\t\t\t\t\t\t\tvar allowedChildren = node.find('li:not(.disabled)');\n\n\t\t\t\t\t\t\t// if there are child nodes that aren't disabled, allow expanding the tree\n\t\t\t\t\t\t\tif(node.hasClass('disabled') && allowedChildren == 0) {\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.bind('move_node.jstree', function(e, data) {\n\t\t\t\t\t\tif(self.getIsUpdatingTree()) return;\n\n\t\t\t\t\t\tvar movedNode = data.rslt.o, newParentNode = data.rslt.np, oldParentNode = data.inst._get_parent(movedNode), newParentID = $(newParentNode).data('id') || 0, nodeID = $(movedNode).data('id');\n\t\t\t\t\t\tvar siblingIDs = $.map($(movedNode).siblings().andSelf(), function(el) {\n\t\t\t\t\t\t\treturn $(el).data('id');\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t'url': self.data('urlSavetreenode'),\n\t\t\t\t\t\t\t'type': 'POST',\n\t\t\t\t\t\t\t'data': {\n\t\t\t\t\t\t\t\tID: nodeID, \n\t\t\t\t\t\t\t\tParentID: newParentID,\n\t\t\t\t\t\t\t\tSiblingIDs: siblingIDs\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsuccess: function() {\n\t\t\t\t\t\t\t\t// We only need to update the ParentID if the current page we're on is the page being moved\n\t\t\t\t\t\t\t\tif ($('.cms-edit-form :input[name=ID]').val() == nodeID) {\n\t\t\t\t\t\t\t\t\t$('.cms-edit-form :input[name=ParentID]').val(newParentID);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tself.updateNodesFromServer([nodeID]);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tstatusCode: {\n\t\t\t\t\t\t\t\t403: function() {\n\t\t\t\t\t\t\t\t\t$.jstree.rollback(data.rlbk);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t})\n\t\t\t\t\t// Make some jstree events delegatable\n\t\t\t\t\t.bind('select_node.jstree check_node.jstree uncheck_node.jstree', function(e, data) {\n\t\t\t\t\t\t$(document).triggerHandler(e, data);\n\t\t\t\t\t});\n\t\t},\n\t\tonremove: function(){\n\t\t\tthis.jstree('destroy');\n\t\t\tthis._super();\n\t\t},\n\n\t\t'from .cms-container': {\n\t\t\tonafterstatechange: function(e){\n\t\t\t\tthis.updateFromEditForm();\n\t\t\t\t// No need to refresh tree nodes, we assume only form submits cause state changes\n\t\t\t}\n\t\t},\n\n\t\t'from .cms-container form': {\n\t\t\tonaftersubmitform: function(e){\n\t\t\t\tvar id = $('.cms-edit-form :input[name=ID]').val();\n\t\t\t\t// TODO Trigger by implementing and inspecting \"changed records\" metadata \n\t\t\t\t// sent by form submission response (as HTTP response headers)\n\t\t\t\tthis.updateNodesFromServer([id]);\n\t\t\t}\n\t\t},\n\n\t\tgetTreeConfig: function() {\n\t\t\tvar self = this;\n\t\t\treturn {\n\t\t\t\t'core': {\n\t\t\t\t\t'initially_open': ['record-0'],\n\t\t\t\t\t'animation': 0,\n\t\t\t\t\t'html_titles': true\n\t\t\t\t},\n\t\t\t\t'html_data': {\n\t\t\t\t\t// 'ajax' will be set on 'loaded.jstree' event\n\t\t\t\t},\n\t\t\t\t'ui': {\n\t\t\t\t\t\"select_limit\" : 1,\n\t\t\t\t\t'initially_select': [this.find('.current').attr('id')]\n\t\t\t\t},\n\t\t\t\t\"crrm\": {\n\t\t\t\t\t'move': {\n\t\t\t\t\t\t// Check if a node is allowed to be moved.\n\t\t\t\t\t\t// Caution: Runs on every drag over a new node\n\t\t\t\t\t\t'check_move': function(data) {\n\t\t\t\t\t\t\tvar movedNode = $(data.o), newParent = $(data.np), \n\t\t\t\t\t\t\t\tisMovedOntoContainer = data.ot.get_container()[0] == data.np[0],\n\t\t\t\t\t\t\t\tmovedNodeClass = movedNode.getClassname(), \n\t\t\t\t\t\t\t\tnewParentClass = newParent.getClassname(),\n\t\t\t\t\t\t\t\t// Check allowedChildren of newParent or against root node rules\n\t\t\t\t\t\t\t\thints = self.getHints(),\n\t\t\t\t\t\t\t\tdisallowedChildren = [],\n\t\t\t\t\t\t\t\thintKey = newParentClass ? newParentClass : 'Root',\n\t\t\t\t\t\t\t\thint = (hints && typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;\n\n\t\t\t\t\t\t\t// Special case for VirtualPage: Check that original page type is an allowed child\n\t\t\t\t\t\t\tif(hint && movedNode.attr('class').match(/VirtualPage-([^\\s]*)/)) movedNodeClass = RegExp.$1;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(hint) disallowedChildren = (typeof hint.disallowedChildren != 'undefined') ? hint.disallowedChildren : [];\n\t\t\t\t\t\t\tvar isAllowed = (\n\t\t\t\t\t\t\t\t// Don't allow moving the root node\n\t\t\t\t\t\t\t\tmovedNode.data('id') !== 0 \n\t\t\t\t\t\t\t\t// Archived pages can't be moved\n\t\t\t\t\t\t\t\t&& !movedNode.hasClass('status-archived')\n\t\t\t\t\t\t\t\t// Only allow moving node inside the root container, not before/after it\n\t\t\t\t\t\t\t\t&& (!isMovedOntoContainer || data.p == 'inside')\n\t\t\t\t\t\t\t\t// Children are generally allowed on parent\n\t\t\t\t\t\t\t\t&& !newParent.hasClass('nochildren')\n\t\t\t\t\t\t\t\t// movedNode is allowed as a child\n\t\t\t\t\t\t\t\t&& (!disallowedChildren.length || $.inArray(movedNodeClass, disallowedChildren) == -1)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\treturn isAllowed;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t'dnd': {\n\t\t\t\t\t\"drop_target\" : false,\n\t\t\t\t\t\"drag_target\" : false\n\t\t\t\t},\n\t\t\t\t'checkbox': {\n\t\t\t\t\t'two_state': true\n\t\t\t\t},\n\t\t\t\t'themes': {\n\t\t\t\t\t'theme': 'apple',\n\t\t\t\t\t'url': $('body').data('frameworkpath') + '/thirdparty/jstree/themes/apple/style.css'\n\t\t\t\t},\n\t\t\t\t// Caution: SilverStripe has disabled $.vakata.css.add_sheet() for performance reasons,\n\t\t\t\t// which means you need to add any CSS manually to framework/admin/scss/_tree.css\n\t\t\t\t'plugins': [\n\t\t\t\t\t'html_data', 'ui', 'dnd', 'crrm', 'themes', \n\t\t\t\t\t'checkbox' // checkboxes are hidden unless .multiple is set\n\t\t\t\t]\n\t\t\t};\n\t\t},\n\t\t\n\t\t/**\n\t\t * Function:\n\t\t * search\n\t\t * \n\t\t * Parameters:\n\t\t * (Object) data Pass empty data to cancel search\n\t\t * (Function) callback Success callback\n\t\t */\n\t\tsearch: function(params, callback) {\n\t\t\tif(params) this.data('searchparams', params);\n\t\t\telse this.removeData('searchparams');\n\t\t\tthis.jstree('refresh', -1, callback);\n\t\t},\n\t\t\n\t\t/**\n\t\t * Function: getNodeByID\n\t\t * \n\t\t * Parameters:\n\t\t * (Int) id \n\t\t * \n\t\t * Returns\n\t\t * DOMElement\n\t\t */\n\t\tgetNodeByID: function(id) {\n\t\t\treturn this.find('*[data-id='+id+']');\n\t\t},\n\n\t\t/**\n\t\t * Creates a new node from the given HTML.\n\t\t * Wrapping around jstree API because we want the flexibility to define\n\t\t * the node's <li> ourselves. Places the node in the tree\n\t\t * according to data.ParentID.\n\t\t *\n\t\t * Parameters:\n\t\t * (String) HTML New node content (<li>)\n\t\t * (Object) Map of additional data, e.g. ParentID\n\t\t * (Function) Success callback\n\t\t */\n\t\tcreateNode: function(html, data, callback) {\n\t\t\tvar self = this, \n\t\t\t\tparentNode = data.ParentID !== void 0 ? self.getNodeByID(data.ParentID) : false, // Explicitly check for undefined as 0 is a valid ParentID\n\t\t\t\tnewNode = $(html);\n\t\t\t\n\t\t\t// Extract the state for the new node from the properties taken from the provided HTML template.\n\t\t\t// This will correctly initialise the behaviour of the node for ajax loading of children.\n\t\t\tvar properties = {data: ''};\n\t\t\tif(newNode.hasClass('jstree-open')) {\n\t\t\t\tproperties.state = 'open';\n\t\t\t} else if(newNode.hasClass('jstree-closed')) {\n\t\t\t\tproperties.state = 'closed';\n\t\t\t}\n\t\t\tthis.jstree(\n\t\t\t\t'create_node', \n\t\t\t\tparentNode.length ? parentNode : -1, \n\t\t\t\t'last', \n\t\t\t\tproperties,\n\t\t\t\tfunction(node) {\n\t\t\t\t\tvar origClasses = node.attr('class');\n\t\t\t\t\t// Copy attributes\n\t\t\t\t\tfor(var i=0; i<newNode[0].attributes.length; i++){\n\t\t\t\t\t\tvar attr = newNode[0].attributes[i];\n\t\t\t\t\t\tnode.attr(attr.name, attr.value);\n\t\t\t\t\t}\n\t\t\t\t\t// Substitute html from request for that generated by jstree\n\t\t\t\t\tnode.addClass(origClasses).html(newNode.html());\n\t\t\t\t\tcallback(node);\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\n\t\t/**\n\t\t * Updates a node's state in the tree,\n\t\t * including all of its HTML, as well as its position.\n\t\t * \n\t\t * Parameters:\n\t\t * (DOMElement) Existing node\n\t\t * (String) HTML New node content (<li>)\n\t\t * (Object) Map of additional data, e.g. ParentID\n\t\t */\n\t\tupdateNode: function(node, html, data) {\n\t\t\tvar self = this, newNode = $(html), origClasses = node.attr('class');\n\n\t\t\tvar nextNode = data.NextID ? this.getNodeByID(data.NextID) : false;\n\t\t\tvar prevNode = data.PrevID ? this.getNodeByID(data.PrevID) : false;\n\t\t\tvar parentNode = data.ParentID ? this.getNodeByID(data.ParentID) : false;\n\n\t\t\t// Copy attributes. We can't replace the node completely\n\t\t\t// without removing or detaching its children nodes.\n\t\t\t$.each(['id', 'style', 'class', 'data-pagetype'], function(i, attrName) {\n\t\t\t\tnode.attr(attrName, newNode.attr(attrName));\n\t\t\t});\n\n\t\t\t// To avoid conflicting classes when the node gets its content replaced (see below)\n\t\t\t// Filter out all previous status flags if they are not in the class property of the new node\n\t\t\torigClasses = origClasses.replace(/status-[^\\s]*/, '');\n\n\t\t\t// Replace inner content\n\t\t\tvar origChildren = node.children('ul').detach();\n\t\t\tnode.addClass(origClasses).html(newNode.html()).append(origChildren);\n\n\t\t\tif (nextNode && nextNode.length) {\n\t\t\t\tthis.jstree('move_node', node, nextNode, 'before');\n\t\t\t}\n\t\t\telse if (prevNode && prevNode.length) {\n\t\t\t\tthis.jstree('move_node', node, prevNode, 'after');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.jstree('move_node', node, parentNode.length ? parentNode : -1);\n\t\t\t}\n\t\t},\n\t\t\n\t\t/**\n\t\t * Sets the current state based on the form the tree is managing.\n\t\t */\n\t\tupdateFromEditForm: function() {\n\t\t\tvar node, id = $('.cms-edit-form :input[name=ID]').val();\n\t\t\tif(id) {\n\t\t\t\tnode = this.getNodeByID(id);\n\t\t\t\tif(node.length) {\n\t\t\t\t\tthis.jstree('deselect_all');\n\t\t\t\t\tthis.jstree('select_node', node);\n\t\t\t\t} else {\n\t\t\t\t\t// If form is showing an ID that doesn't exist in the tree,\n\t\t\t\t\t// get it from the server\n\t\t\t\t\tthis.updateNodesFromServer([id]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// If no ID exists in a form view, we're displaying the tree on its own,\n\t\t\t\t// hence to page should show as active\n\t\t\t\tthis.jstree('deselect_all');\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Reloads the view of one or more tree nodes\n\t\t * from the server, ensuring that their state is up to date\n\t\t * (icon, title, hierarchy, badges, etc).\n\t\t * This is easier, more consistent and more extensible \n\t\t * than trying to correct all aspects via DOM modifications, \n\t\t * based on the sparse data available in the current edit form.\n\t\t *\n\t\t * Parameters:\n\t\t * (Array) List of IDs to retrieve\n\t\t */\n\t\tupdateNodesFromServer: function(ids) {\n\t\t\tif(this.getIsUpdatingTree() || !this.getIsLoaded()) return;\n\n\t\t\tvar self = this, i, includesNewNode = false;\n\t\t\tthis.setIsUpdatingTree(true);\n\t\t\tself.jstree('save_selected');\n\n\t\t\tvar correctStateFn = function(node) {\n\t\t\t\t// Duplicates can be caused by the subtree reloading through\n\t\t\t\t// a tree \"open\"/\"select\" event, while at the same time creating a new node\n\t\t\t\tself.getNodeByID(node.data('id')).not(node).remove();\n\t\t\t\t\n\t\t\t\t// Select this node\n\t\t\t\tself.jstree('deselect_all');\n\t\t\t\tself.jstree('select_node', node);\n\t\t\t};\n\n\t\t\t// TODO 'initially_opened' config doesn't apply here\n\t\t\tself.jstree('open_node', this.getNodeByID(0));\n\t\t\tself.jstree('save_opened');\n\t\t\tself.jstree('save_selected');\n\n\t\t\t$.ajax({\n\t\t\t\turl: $.path.addSearchParams(this.data('urlUpdatetreenodes'), 'ids=' + ids.join(',')),\n\t\t\t\tdataType: 'json',\n\t\t\t\tsuccess: function(data, xhr) {\n\t\t\t\t\t$.each(data, function(nodeId, nodeData) {\n\t\t\t\t\t\tvar node = self.getNodeByID(nodeId);\n\n\t\t\t\t\t\t// If no node data is given, assume the node has been removed\n\t\t\t\t\t\tif(!nodeData) {\n\t\t\t\t\t\t\tself.jstree('delete_node', node);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check if node exists, create if necessary\n\t\t\t\t\t\tif(node.length) {\n\t\t\t\t\t\t\tself.updateNode(node, nodeData.html, nodeData);\n\t\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t\tcorrectStateFn(node);\n\t\t\t\t\t\t\t}, 500);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tincludesNewNode = true;\n\n\t\t\t\t\t\t\t// If the parent node can't be found, it might have not been loaded yet.\n\t\t\t\t\t\t\t// This can happen for deep trees which require ajax loading.\n\t\t\t\t\t\t\t// Assumes that the new node has been submitted to the server already.\n\t\t\t\t\t\t\tif(nodeData.ParentID && !self.find('li[data-id='+nodeData.ParentID+']').length) {\n\t\t\t\t\t\t\t\tself.jstree('load_node', -1, function() {\n\t\t\t\t\t\t\t\t\tnewNode = self.find('li[data-id='+nodeId+']');\n\t\t\t\t\t\t\t\t\tcorrectStateFn(newNode);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tself.createNode(nodeData.html, nodeData, function(newNode) {\n\t\t\t\t\t\t\t\t\tcorrectStateFn(newNode);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tif(!includesNewNode) {\n\t\t\t\t\t\tself.jstree('deselect_all');\n\t\t\t\t\t\tself.jstree('reselect');\n\t\t\t\t\t\tself.jstree('reopen');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcomplete: function() {\n\t\t\t\t\tself.setIsUpdatingTree(false);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t});\n\t\n\t$('.cms-tree.multiple').entwine({\n\t\tonmatch: function() {\n\t\t\tthis._super();\n\t\t\tthis.jstree('show_checkboxes');\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t\tthis.jstree('uncheck_all');\n\t\t\tthis.jstree('hide_checkboxes');\n\t\t},\n\t\t/**\n\t\t * Function: getSelectedIDs\n\t\t * \n\t\t * Returns:\n\t\t * \t(Array)\n\t\t */\n\t\tgetSelectedIDs: function() {\n\t\t\treturn $(this)\n\t\t\t\t.jstree('get_checked')\n\t\t\t\t.not('.disabled')\n\t\t\t\t.map(function() {\n\t\t\t\t\treturn $(this).data('id');\n\t\t\t\t})\n\t\t\t\t.get();\n\t\t}\n\t});\n\t\n\t$('.cms-tree li').entwine({\n\t\t\n\t\t/**\n\t\t * Function: setEnabled\n\t\t * \n\t\t * Parameters:\n\t\t * \t(bool)\n\t\t */\n\t\tsetEnabled: function(bool) {\n\t\t\tthis.toggleClass('disabled', !(bool));\n\t\t},\n\t\t\n\t\t/**\n\t\t * Function: getClassname\n\t\t * \n\t\t * Returns PHP class for this element. Useful to check business rules like valid drag'n'drop targets.\n\t\t */\n\t\tgetClassname: function() {\n\t\t\tvar matches = this.attr('class').match(/class-([^\\s]*)/i);\n\t\t\treturn matches ? matches[1] : '';\n\t\t},\n\t\t\n\t\t/**\n\t\t * Function: getID\n\t\t * \n\t\t * Returns:\n\t\t * \t(Number)\n\t\t */\n\t\tgetID: function() {\n\t\t\treturn this.data('id');\n\t\t}\n\t});\n});\n","import $ from 'jQuery';\n\n$.entwine('ss', function($){\n\n\t// Any TreeDowndownField needs to refresh it's contents after a form submission,\n\t// because the tree on the backend might have changed\n\t$('.TreeDropdownField').entwine({\n\t\t'from .cms-container form': {\n\t\t\tonaftersubmitform: function(e){\n\t\t\t\tthis.find('.tree-holder').empty();\n\t\t\t\tthis._super();\n\t\t\t}\n\t\t}\n\t});\n\n});\n","/**\n * File: LeftAndMain.js\n */\nimport $ from 'jQuery';\nimport router from 'router';\n\n$.noConflict();\n\nwindow.ss = window.ss || {};\nwindow.ss.router = router;\n\nvar windowWidth, windowHeight;\n\n/**\n * Extracts the pathname from a URL.\n *\n * @param string url\n * @return string\n */\nfunction getUrlPath(url) {\n\tvar anchor = document.createElement('a');\n\tanchor.href = url;\n\n\treturn anchor.pathname\n}\n\n/**\n * @func debounce\n * @param func {function} - The callback to invoke after `wait` milliseconds.\n * @param wait {number} - Milliseconds to wait.\n * @param immediate {boolean} - If true the callback will be invoked at the start rather than the end.\n * @return {function}\n * @desc Returns a function that will not be called until it hasn't been invoked for `wait` seconds.\n */\nwindow.ss.debounce = function (func, wait, immediate) {\n\tvar timeout, context, args;\n\n\tvar later = function() {\n\t\ttimeout = null;\n\t\tif (!immediate) func.apply(context, args);\n\t};\n\n\treturn function() {\n\t\tvar callNow = immediate && !timeout;\n\n\t\tcontext = this;\n\t\targs = arguments;\n\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\n\t\tif (callNow) {\n\t\t\tfunc.apply(context, args);\n\t\t}\n\t};\n};\n\n$(window).bind('resize.leftandmain', function(e) {\n\t// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.\n\tvar cb = function() {$('.cms-container').trigger('windowresize');};\n\n\t// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event\n\tif($.browser.msie && parseInt($.browser.version, 10) < 9) {\n\t\tvar newWindowWidth = $(window).width(), newWindowHeight = $(window).height();\n\t\tif(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {\n\t\t\twindowWidth = newWindowWidth;\n\t\t\twindowHeight = newWindowHeight;\n\t\t\tcb();\n\t\t}\n\t} else {\n\t\tcb();\n\t}\n});\n\n// setup jquery.entwine\n$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;\n\n$.entwine('ss', function($) {\n\n\t/**\n\t * Client routing.\n\t */\n\tfunction handleLoadPanel(ctx, next) {\n\t\t// If the page isn't ready or the request hasn't come from 'loadPanel'\n\t\t// then don't PJAX load the panel. Note: __forceReferer is set by 'loadPanel' only.\n\t\tif (document.readyState !== 'complete' || typeof ctx.state.__forceReferer === 'undefined') {\n\t\t\treturn next();\n\t\t}\n\n\t\t// Load the panel and call the next route.\n\t\t// The next route is call after the panel is in the DOM so that\n\t\t// any routes defined in the panel are available.\n\t\t$('.cms-container')\n\t\t\t.handleStateChange(null, ctx.state)\n\t\t\t.done(() => {\n\t\t\t\tnext();\n\t\t\t});\n\t}\n\n\tlet basePath = getUrlPath($('base')[0].href);\n\n\t// Avoid adding a double slash if the base path is '/'\n\tif (basePath[basePath.length - 1] === '/') {\n\t\tbasePath += 'admin';\n\t} else {\n\t\tbasePath = '/admin';\n\t}\n\n\trouter.base(basePath);\n\n\trouter('*', (ctx, next) => {\n\t\t// Break routing and do a full page reload when going to the assets section.\n\t\tconst assetsRoute = new router.Route('/assets/*');\n\n\t\tif (assetsRoute.match(router.current, {}) && typeof ctx.state.__forceReferer !== 'undefined') {\n\t\t\twindow.location.href = ctx.pathname;\n\t\t\treturn;\n\t\t}\n\n\t\tnext();\n\t});\n\n\t// There's currently no way to get a list of routes dynamically.\n\t// We're hardcoding these until a configuration manager is implemented.\n\trouter('/pages/*', handleLoadPanel);\n\trouter('/reports/*', handleLoadPanel);\n\trouter('/security/*', handleLoadPanel);\n\trouter('/settings/*', handleLoadPanel);\n\n\trouter.start();\n\n\t/*\n\t * Handle messages sent via nested iframes\n\t * Messages should be raised via postMessage with an object with the 'type' parameter given.\n\t * An optional 'target' and 'data' parameter can also be specified. If no target is specified\n\t * events will be sent to the window instead.\n\t * type should be one of:\n\t * - 'event' - Will trigger the given event (specified by 'event') on the target\n\t * - 'callback' - Will call the given method (specified by 'callback') on the target\n\t */\n\t$(window).on(\"message\", function(e) {\n\t\tvar target,\n\t\t\tevent = e.originalEvent,\n\t\t\tdata = typeof event.data === 'object' ? event.data : JSON.parse(event.data);\n\n\t\t// Reject messages outside of the same origin\n\t\tif($.path.parseUrl(window.location.href).domain !== $.path.parseUrl(event.origin).domain) return;\n\n\t\t// Get target of this action\n\t\ttarget = typeof(data.target) === 'undefined'\n\t\t\t? $(window)\n\t\t\t: $(data.target);\n\n\t\t// Determine action\n\t\tswitch(data.type) {\n\t\t\tcase 'event':\n\t\t\t\ttarget.trigger(data.event, data.data);\n\t\t\t\tbreak;\n\t\t\tcase 'callback':\n\t\t\t\ttarget[data.callback].call(target, data.data);\n\t\t\t\tbreak;\n\t\t}\n\t});\n\n\t/**\n\t * Position the loading spinner animation below the ss logo\n\t */\n\tvar positionLoadingSpinner = function() {\n\t\tvar offset = 120; // offset from the ss logo\n\t\tvar spinner = $('.ss-loading-screen .loading-animation');\n\t\tvar top = ($(window).height() - spinner.height()) / 2;\n\t\tspinner.css('top', top + offset);\n\t\tspinner.show();\n\t};\n\n\t// apply an select element only when it is ready, ie. when it is rendered into a template\n\t// with css applied and got a width value.\n\tvar applyChosen = function(el) {\n\t\tif(el.is(':visible')) {\n\t\t\tel.addClass('has-chzn').chosen({\n\t\t\t\tallow_single_deselect: true,\n\t\t\t\tdisable_search_threshold: 20\n\t\t\t});\n\n\t\t\tvar title = el.prop('title');\n\n\t\t\tif(title) {\n\t\t\t\tel.siblings('.chzn-container').prop('title', title);\n\t\t\t}\n\t\t} else {\n\t\t\tsetTimeout(function() {\n\t\t\t\t// Make sure it's visible before applying the ui\n\t\t\t\tel.show();\n\t\t\t\tapplyChosen(el); },\n\t\t\t500);\n\t\t}\n\t};\n\n\t/**\n\t * Compare URLs, but normalize trailing slashes in\n\t * URL to work around routing weirdnesses in SS_HTTPRequest.\n\t * Also normalizes relative URLs by prefixing them with the <base>.\n\t */\n\tvar isSameUrl = function(url1, url2) {\n\t\tvar baseUrl = $('base').attr('href');\n\t\turl1 = $.path.isAbsoluteUrl(url1) ? url1 : $.path.makeUrlAbsolute(url1, baseUrl),\n\t\turl2 = $.path.isAbsoluteUrl(url2) ? url2 : $.path.makeUrlAbsolute(url2, baseUrl);\n\t\tvar url1parts = $.path.parseUrl(url1), url2parts = $.path.parseUrl(url2);\n\t\treturn (\n\t\t\turl1parts.pathname.replace(/\\/*$/, '') == url2parts.pathname.replace(/\\/*$/, '') &&\n\t\t\turl1parts.search == url2parts.search\n\t\t);\n\t};\n\n\tvar ajaxCompleteEvent = window.ss.debounce(function () {\n\t\t$(window).trigger('ajaxComplete');\n\t}, 1000, true);\n\n\t$(window).bind('resize', positionLoadingSpinner).trigger('resize');\n\n\t// global ajax handlers\n\t$(document).ajaxComplete(function(e, xhr, settings) {\n\t\t// Simulates a redirect on an ajax response.\n\t\tvar url = xhr.getResponseHeader('X-ControllerURL'),\n\t\t\torigUrl = window.history.state.path.replace(/\\/$/, ''), // TODO Replaces trailing slashes added by History after locale (e.g. admin/?locale=en/)\n\t\t\tdestUrl = settings.url,\n\t\t\tmsg = xhr.getResponseHeader('X-Status') !== null ? xhr.getResponseHeader('X-Status') : xhr.statusText, // Handle custom status message headers\n\t\t\tmsgType = (xhr.status < 200 || xhr.status > 399) ? 'bad' : 'good',\n\t\t\tignoredMessages = ['OK'];\n\n\t\t// Only redirect if controller url differs to the requested or current one\n\t\tif (url !== null && (!isSameUrl(origUrl, url) || !isSameUrl(destUrl, url))) {\n\t\t\trouter.show(url, {\n\t\t\t\tid: (new Date()).getTime() + String(Math.random()).replace(/\\D/g,''), // Ensure that redirections are followed through by history API by handing it a unique ID\n\t\t\t\tpjax: xhr.getResponseHeader('X-Pjax') ? xhr.getResponseHeader('X-Pjax') : settings.headers['X-Pjax']\n\t\t\t});\n\t\t}\n\n\t\t// Enable reauthenticate dialog if requested\n\t\tif (xhr.getResponseHeader('X-Reauthenticate')) {\n\t\t\t$('.cms-container').showLoginDialog();\n\t\t\treturn;\n\t\t}\n\n\t\t// Show message (but ignore aborted requests)\n\t\tif (xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages)) {\n\t\t\t// Decode into UTF-8, HTTP headers don't allow multibyte\n\t\t\tstatusMessage(decodeURIComponent(msg), msgType);\n\t\t}\n\n\t\tajaxCompleteEvent(this);\n\t});\n\n\t/**\n\t * Main LeftAndMain interface with some control panel and an edit form.\n\t *\n\t * Events:\n\t * ajaxsubmit - ...\n\t * validate - ...\n\t * aftersubmitform - ...\n\t */\n\t$('.cms-container').entwine({\n\n\t\t/**\n\t\t * Tracks current panel request.\n\t\t */\n\t\tStateChangeXHR: null,\n\n\t\t/**\n\t\t * Tracks current fragment-only parallel PJAX requests.\n\t\t */\n\t\tFragmentXHR: {},\n\n\t\tStateChangeCount: 0,\n\n\t\t/**\n\t\t * Options for the threeColumnCompressor layout algorithm.\n\t\t *\n\t\t * See LeftAndMain.Layout.js for description of these options.\n\t\t */\n\t\tLayoutOptions: {\n\t\t\tminContentWidth: 940,\n\t\t\tminPreviewWidth: 400,\n\t\t\tmode: 'content'\n\t\t},\n\n\t\t/**\n\t\t * Constructor: onmatch\n\t\t */\n\t\tonadd: function() {\n\t\t\tvar self = this;\n\n\t\t\t// Browser detection\n\t\t\tif($.browser.msie && parseInt($.browser.version, 10) < 8) {\n\t\t\t\t$('.ss-loading-screen').append(\n\t\t\t\t\t'<p class=\"ss-loading-incompat-warning\"><span class=\"notice\">' +\n\t\t\t\t\t'Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.' +\n\t\t\t\t\t'</span></p>'\n\t\t\t\t).css('z-index', $('.ss-loading-screen').css('z-index')+1);\n\t\t\t\t$('.loading-animation').remove();\n\n\t\t\t\tthis._super();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Initialize layouts\n\t\t\tthis.redraw();\n\n\t\t\t// Remove loading screen\n\t\t\t$('.ss-loading-screen').hide();\n\t\t\t$('body').removeClass('loading');\n\t\t\t$(window).unbind('resize', positionLoadingSpinner);\n\t\t\tthis.restoreTabState();\n\t\t\tthis._super();\n\t\t},\n\n\t\tfromWindow: {\n\t\t\tonstatechange: function(event, historyState){\n\t\t\t\tthis.handleStateChange(event, historyState); \n\t\t\t}\n\t\t},\n\n\t\t'onwindowresize': function() {\n\t\t\tthis.redraw();\n\t\t},\n\n\t\t'from .cms-panel': {\n\t\t\tontoggle: function(){ this.redraw(); }\n\t\t},\n\n\t\t'from .cms-container': {\n\t\t\tonaftersubmitform: function(){ this.redraw(); }\n\t\t},\n\n\t\t/**\n\t\t * Ensure the user can see the requested section - restore the default view.\n\t\t */\n\t\t'from .cms-menu-list li a': {\n\t\t\tonclick: function(e) {\n\t\t\t\tvar href = $(e.target).attr('href');\n\t\t\t\tif(e.which > 1 || href == this._tabStateUrl()) return;\n\t\t\t\tthis.splitViewMode();\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Change the options of the threeColumnCompressor layout, and trigger layouting if needed.\n\t\t * You can provide any or all options. The remaining options will not be changed.\n\t\t */\n\t\tupdateLayoutOptions: function(newSpec) {\n\t\t\tvar spec = this.getLayoutOptions();\n\n\t\t\tvar dirty = false;\n\n\t\t\tfor (var k in newSpec) {\n\t\t\t\tif (spec[k] !== newSpec[k]) {\n\t\t\t\t\tspec[k] = newSpec[k];\n\t\t\t\t\tdirty = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dirty) this.redraw();\n\t\t},\n\n\t\t/**\n\t\t * Enable the split view - with content on the left and preview on the right.\n\t\t */\n\t\tsplitViewMode: function() {\n\t\t\tthis.updateLayoutOptions({\n\t\t\t\tmode: 'split'\n\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * Content only.\n\t\t */\n\t\tcontentViewMode: function() {\n\t\t\tthis.updateLayoutOptions({\n\t\t\t\tmode: 'content'\n\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * Preview only.\n\t\t */\n\t\tpreviewMode: function() {\n\t\t\tthis.updateLayoutOptions({\n\t\t\t\tmode: 'preview'\n\t\t\t});\n\t\t},\n\n\t\tRedrawSuppression: false,\n\n\t\tredraw: function() {\n\t\t\tif (this.getRedrawSuppression()) return;\n\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\n\t\t\t// Reset the algorithm.\n\t\t\tthis.data('jlayout', jLayout.threeColumnCompressor(\n\t\t\t\t{\n\t\t\t\t\tmenu: this.children('.cms-menu'),\n\t\t\t\t\tcontent: this.children('.cms-content'),\n\t\t\t\t\tpreview: this.children('.cms-preview')\n\t\t\t\t},\n\t\t\t\tthis.getLayoutOptions()\n\t\t\t));\n\n\t\t\t// Trigger layout algorithm once at the top. This also lays out children - we move from outside to\n\t\t\t// inside, resizing to fit the parent.\n\t\t\tthis.layout();\n\n\t\t\t// Redraw on all the children that need it\n\t\t\tthis.find('.cms-panel-layout').redraw();\n\t\t\tthis.find('.cms-content-fields[data-layout-type]').redraw();\n\t\t\tthis.find('.cms-edit-form[data-layout-type]').redraw();\n\t\t\tthis.find('.cms-preview').redraw();\n\t\t\tthis.find('.cms-content').redraw();\n\t\t},\n\n\t\t/**\n\t\t * Confirm whether the current user can navigate away from this page\n\t\t * \n\t\t * @param {array} selectors Optional list of selectors\n\t\t * @returns {boolean} True if the navigation can proceed\n\t\t */\n\t\tcheckCanNavigate: function(selectors) {\n\t\t\t// Check change tracking (can't use events as we need a way to cancel the current state change)\n\t\t\tvar contentEls = this._findFragments(selectors || ['Content']),\n\t\t\t\ttrackedEls = contentEls\n\t\t\t\t\t.find(':data(changetracker)')\n\t\t\t\t\t.add(contentEls.filter(':data(changetracker)')),\n\t\t\t\tsafe = true;\n\n\t\t\tif(!trackedEls.length) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\ttrackedEls.each(function() {\n\t\t\t\t// See LeftAndMain.EditForm.js\n\t\t\t\tif(!$(this).confirmUnsavedChanges()) {\n\t\t\t\t\tsafe = false;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn safe;\n\t\t},\n\n\t\t/**\n\t\t * @param string url\n\t\t * @param string title - New window title.\n\t\t * @param object data - Any additional data passed through to `window.history.state`.\n\t\t * @param boolean forceReload - Forces the replacement of the current history state, even if the URL is the same, i.e. allows reloading.\n\t\t */\n\t\tloadPanel: function (url, title = '', data = {}, forceReload, forceReferer = window.history.state.path) {\n\t\t\t// Check for unsaved changes\n\t\t\tif (!this.checkCanNavigate(data.pjax ? data.pjax.split(',') : ['Content'])) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.saveTabState();\n\n\t\t\tdata.__forceReferer = forceReferer;\n\n\t\t\tif (forceReload) {\n\t\t\t\tdata.__forceReload = Math.random(); // Make sure the page reloads even if the URL is the same.\n\t\t\t}\n\n\t\t\trouter.show(url, data);\n\t\t},\n\n\t\t/**\n\t\t * Nice wrapper for reloading current history state.\n\t\t */\n\t\treloadCurrentPanel: function() {\n\t\t\tthis.loadPanel(window.history.state.path, null, null, true);\n\t\t},\n\n\t\t/**\n\t\t * Function: submitForm\n\t\t *\n\t\t * Parameters:\n\t\t * {DOMElement} form - The form to be submitted. Needs to be passed\n\t\t * in to avoid entwine methods/context being removed through replacing the node itself.\n\t\t * {DOMElement} button - The pressed button (optional)\n\t\t * {Function} callback - Called in complete() handler of jQuery.ajax()\n\t\t * {Object} ajaxOptions - Object literal to merge into $.ajax() call\n\t\t *\n\t\t * Returns:\n\t\t * (boolean)\n\t\t */\n\t\tsubmitForm: function(form, button, callback, ajaxOptions) {\n\t\t\tvar self = this;\n\n\t\t\t// look for save button\n\t\t\tif(!button) button = this.find('.Actions :submit[name=action_save]');\n\t\t\t// default to first button if none given - simulates browser behaviour\n\t\t\tif(!button) button = this.find('.Actions :submit:first');\n\n\t\t\tform.trigger('beforesubmitform');\n\t\t\tthis.trigger('submitform', {form: form, button: button});\n\n\t\t\t// set button to \"submitting\" state\n\t\t\t$(button).addClass('loading');\n\n\t\t\t// validate if required\n\t\t\tvar validationResult = form.validate();\n\t\t\tif(typeof validationResult!=='undefined' && !validationResult) {\n\t\t\t\t// TODO Automatically switch to the tab/position of the first error\n\t\t\t\tstatusMessage(\"Validation failed.\", \"bad\");\n\n\t\t\t\t$(button).removeClass('loading');\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// get all data from the form\n\t\t\tvar formData = form.serializeArray();\n\t\t\t// add button action\n\t\t\tformData.push({name: $(button).attr('name'), value:'1'});\n\t\t\t// Artificial HTTP referer, IE doesn't submit them via ajax.\n\t\t\t// Also rewrites anchors to their page counterparts, which is important\n\t\t\t// as automatic browser ajax response redirects seem to discard the hash/fragment.\n\t\t\t// TODO Replaces trailing slashes added by History after locale (e.g. admin/?locale=en/)\n\t\t\tformData.push({ name: 'BackURL', value: window.history.state.path.replace(/\\/$/, '') });\n\n\t\t\t// Save tab selections so we can restore them later\n\t\t\tthis.saveTabState();\n\n\t\t\t// Standard Pjax behaviour is to replace the submitted form with new content.\n\t\t\t// The returned view isn't always decided upon when the request\n\t\t\t// is fired, so the server might decide to change it based on its own logic,\n\t\t\t// sending back different `X-Pjax` headers and content\n\t\t\tjQuery.ajax(jQuery.extend({\n\t\t\t\theaders: {\"X-Pjax\" : \"CurrentForm,Breadcrumbs\"},\n\t\t\t\turl: form.attr('action'),\n\t\t\t\tdata: formData,\n\t\t\t\ttype: 'POST',\n\t\t\t\tcomplete: function() {\n\t\t\t\t\t$(button).removeClass('loading');\n\t\t\t\t},\n\t\t\t\tsuccess: function(data, status, xhr) {\n\t\t\t\t\tform.removeClass('changed'); // TODO This should be using the plugin API\n\t\t\t\t\tif(callback) callback(data, status, xhr);\n\n\t\t\t\t\tvar newContentEls = self.handleAjaxResponse(data, status, xhr);\n\t\t\t\t\tif(!newContentEls) return;\n\n\t\t\t\t\tnewContentEls.filter('form').trigger('aftersubmitform', {status: status, xhr: xhr, formData: formData});\n\t\t\t\t}\n\t\t\t}, ajaxOptions));\n\n\t\t\treturn false;\n\t\t},\n\n\t\t/**\n\t\t * Last html5 history state\n\t\t */\n\t\tLastState: null,\n\t\t\n\t\t/**\n\t\t * Flag to pause handleStateChange\n\t\t */\n\t\tPauseState: false,\n\n\t\t/**\n\t\t * Handles ajax loading of new panels through the window.history object.\n\t\t * To trigger loading, pass a new URL to router.show().\n\t\t * Use loadPanel() as a router.show() wrapper as it provides some additional functionality\n\t\t * like global changetracking and user aborts.\n\t\t *\n\t\t * Due to the nature of history management, no callbacks are allowed.\n\t\t * Use the 'beforestatechange' and 'afterstatechange' events instead,\n\t\t * or overwrite the beforeLoad() and afterLoad() methods on the\n\t\t * DOM element you're loading the new content into.\n\t\t * Although you can pass data into router.show(url, data), it shouldn't contain\n\t\t * DOM elements or callback closures.\n\t\t *\n\t\t * The passed URL should allow reconstructing important interface state\n\t\t * without additional parameters, in the following use cases:\n\t\t * - Explicit loading through router.show()\n\t\t * - Implicit loading through browser navigation event triggered by the user (forward or back)\n\t\t * - Full window refresh without ajax\n\t\t * For example, a ModelAdmin search event should contain the search terms\n\t\t * as URL parameters, and the result display should automatically appear\n\t\t * if the URL is loaded without ajax.\n\t\t */\n\t\thandleStateChange: function (event, historyState = window.history.state) {\n\t\t\tif (this.getPauseState()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Don't allow parallel loading to avoid edge cases\n\t\t\tif (this.getStateChangeXHR()) {\n\t\t\t\tthis.getStateChangeXHR().abort();\n\t\t\t}\n\n\t\t\tvar self = this,\n\t\t\t\tfragments = historyState.pjax || 'Content',\n\t\t\t\theaders = {},\n\t\t\t\tfragmentsArr = fragments.split(','),\n\t\t\t\tcontentEls = this._findFragments(fragmentsArr);\n\n\t\t\tthis.setStateChangeCount(this.getStateChangeCount() + 1);\n\n\t\t\tif (!this.checkCanNavigate()) {\n\t\t\t\tvar lastState = this.getLastState();\n\n\t\t\t\t// Suppress panel loading while resetting state\n\t\t\t\tthis.setPauseState(true);\n\n\t\t\t\t// Restore best last state\n\t\t\t\tif (lastState !== null) {\n\t\t\t\t\trouter.show(lastState.url);\n\t\t\t\t} else {\n\t\t\t\t\trouter.back();\n\t\t\t\t}\n\n\t\t\t\tthis.setPauseState(false);\n\n\t\t\t\t// Abort loading of this panel\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setLastState(historyState);\n\n\t\t\t// If any of the requested Pjax fragments don't exist in the current view,\n\t\t\t// fetch the \"Content\" view instead, which is the \"outermost\" fragment\n\t\t\t// that can be reloaded without reloading the whole window.\n\t\t\tif (contentEls.length < fragmentsArr.length) {\n\t\t\t\tfragments = 'Content', fragmentsArr = ['Content'];\n\t\t\t\tcontentEls = this._findFragments(fragmentsArr);\n\t\t\t}\n\n\t\t\tthis.trigger('beforestatechange', { state: historyState, element: contentEls });\n\n\t\t\t// Set Pjax headers, which can declare a preference for the returned view.\n\t\t\t// The actually returned view isn't always decided upon when the request\n\t\t\t// is fired, so the server might decide to change it based on its own logic.\n\t\t\theaders['X-Pjax'] = fragments;\n\n\t\t\tif (typeof historyState.__forceReferer !== 'undefined') {\n\t\t\t\t// Ensure query string is properly encoded if present\n\t\t\t\tlet url = historyState.__forceReferer;\n\n\t\t\t\ttry {\n\t\t\t\t\t// Prevent double-encoding by attempting to decode\n\t\t\t\t\turl = decodeURI(url);\n\t\t\t\t} catch(e) {\n\t\t\t\t\t// URL not encoded, or was encoded incorrectly, so do nothing\n\t\t\t\t} finally {\n\t\t\t\t\t// Set our referer header to the encoded URL\n\t\t\t\t\theaders['X-Backurl'] = encodeURI(url);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontentEls.addClass('loading');\n\n\t\t\tlet promise = $.ajax({\n\t\t\t\theaders: headers,\n\t\t\t\turl: historyState.path\n\t\t\t})\n\t\t\t.done((data, status, xhr) => {\n\t\t\t\tvar els = self.handleAjaxResponse(data, status, xhr, historyState);\n\t\t\t\tself.trigger('afterstatechange', {data: data, status: status, xhr: xhr, element: els, state: historyState});\n\t\t\t})\n\t\t\t.always(() => {\n\t\t\t\tself.setStateChangeXHR(null);\n\t\t\t\t// Remove loading indication from old content els (regardless of which are replaced)\n\t\t\t\tcontentEls.removeClass('loading');\n\t\t\t});\n\n\t\t\tthis.setStateChangeXHR(promise);\n\n\t\t\treturn promise;\n\t\t},\n\n\t\t/**\n\t\t * ALternative to loadPanel/submitForm.\n\t\t *\n\t\t * Triggers a parallel-fetch of a PJAX fragment, which is a separate request to the\n\t\t * state change requests. There could be any amount of these fetches going on in the background,\n\t\t * and they don't register as a HTML5 history states.\n\t\t *\n\t\t * This is meant for updating a PJAX areas that are not complete panel/form reloads. These you'd\n\t\t * normally do via submitForm or loadPanel which have a lot of automation built in.\n\t\t *\n\t\t * On receiving successful response, the framework will update the element tagged with appropriate\n\t\t * data-pjax-fragment attribute (e.g. data-pjax-fragment=\"<pjax-fragment-name>\"). Make sure this element\n\t\t * is available.\n\t\t *\n\t\t * Example usage:\n\t\t * $('.cms-container').loadFragment('admin/foobar/', 'FragmentName');\n\t\t *\n\t\t * @param url string Relative or absolute url of the controller.\n\t\t * @param pjaxFragments string PJAX fragment(s), comma separated.\n\t\t */\n\t\tloadFragment: function(url, pjaxFragments) {\n\n\t\t\tvar self = this,\n\t\t\t\txhr,\n\t\t\t\theaders = {},\n\t\t\t\tbaseUrl = $('base').attr('href'),\n\t\t\t\tfragmentXHR = this.getFragmentXHR();\n\n\t\t\t// Make sure only one XHR for a specific fragment is currently in progress.\n\t\t\tif(\n\t\t\t\ttypeof fragmentXHR[pjaxFragments]!=='undefined' &&\n\t\t\t\tfragmentXHR[pjaxFragments]!==null\n\t\t\t) {\n\t\t\t\tfragmentXHR[pjaxFragments].abort();\n\t\t\t\tfragmentXHR[pjaxFragments] = null;\n\t\t\t}\n\n\t\t\turl = $.path.isAbsoluteUrl(url) ? url : $.path.makeUrlAbsolute(url, baseUrl);\n\t\t\theaders['X-Pjax'] = pjaxFragments;\n\n\t\t\txhr = $.ajax({\n\t\t\t\theaders: headers,\n\t\t\t\turl: url,\n\t\t\t\tsuccess: function(data, status, xhr) {\n\t\t\t\t\tvar elements = self.handleAjaxResponse(data, status, xhr, null);\n\n\t\t\t\t\t// We are fully done now, make it possible for others to hook in here.\n\t\t\t\t\tself.trigger('afterloadfragment', { data: data, status: status, xhr: xhr, elements: elements });\n\t\t\t\t},\n\t\t\t\terror: function(xhr, status, error) {\n\t\t\t\t\tself.trigger('loadfragmenterror', { xhr: xhr, status: status, error: error });\n\t\t\t\t},\n\t\t\t\tcomplete: function() {\n\t\t\t\t\t// Reset the current XHR in tracking object.\n\t\t\t\t\tvar fragmentXHR = self.getFragmentXHR();\n\t\t\t\t\tif(\n\t\t\t\t\t\ttypeof fragmentXHR[pjaxFragments]!=='undefined' &&\n\t\t\t\t\t\tfragmentXHR[pjaxFragments]!==null\n\t\t\t\t\t) {\n\t\t\t\t\t\tfragmentXHR[pjaxFragments] = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Store the fragment request so we can abort later, should we get a duplicate request.\n\t\t\tfragmentXHR[pjaxFragments] = xhr;\n\n\t\t\treturn xhr;\n\t\t},\n\n\t\t/**\n\t\t * Handles ajax responses containing plain HTML, or mulitple\n\t\t * PJAX fragments wrapped in JSON (see PjaxResponseNegotiator PHP class).\n\t\t * Can be hooked into an ajax 'success' callback.\n\t\t *\n\t\t * Parameters:\n\t\t * \t(Object) data\n\t\t * \t(String) status\n\t\t * \t(XMLHTTPRequest) xhr\n\t\t * \t(Object) state The original history state which the request was initiated with\n\t\t */\n\t\thandleAjaxResponse: function(data, status, xhr, state) {\n\t\t\tvar self = this, url, selectedTabs, guessFragment, fragment, $data;\n\n\t\t\t// Support a full reload\n\t\t\tif(xhr.getResponseHeader('X-Reload') && xhr.getResponseHeader('X-ControllerURL')) {\n\t\t\t\tvar baseUrl = $('base').attr('href'),\n\t\t\t\t\trawURL = xhr.getResponseHeader('X-ControllerURL'),\n\t\t\t\t\turl = $.path.isAbsoluteUrl(rawURL) ? rawURL : $.path.makeUrlAbsolute(rawURL, baseUrl);\n\n\t\t\t\tdocument.location.href = url;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Pseudo-redirects via X-ControllerURL might return empty data, in which\n\t\t\t// case we'll ignore the response\n\t\t\tif(!data) return;\n\n\t\t\t// Update title\n\t\t\tvar title = xhr.getResponseHeader('X-Title');\n\t\t\tif(title) document.title = decodeURIComponent(title.replace(/\\+/g, ' '));\n\n\t\t\tvar newFragments = {}, newContentEls;\n\t\t\t// If content type is text/json (ignoring charset and other parameters)\n\t\t\tif(xhr.getResponseHeader('Content-Type').match(/^((text)|(application))\\/json[ \\t]*;?/i)) {\n\t\t\t\tnewFragments = data;\n\t\t\t} else {\n\n\t\t\t\t// Fall back to replacing the content fragment if HTML is returned\n\t\t\t\tfragment = document.createDocumentFragment();\n\n\t\t\t\tjQuery.clean( [ data ], document, fragment, [] );\n\t\t\t\t$data = $(jQuery.merge( [], fragment.childNodes ));\n\n\t\t\t\t// Try and guess the fragment if none is provided\n\t\t\t\t// TODO: data-pjax-fragment might actually give us the fragment. For now we just check most common case\n\t\t\t\tguessFragment = 'Content';\n\t\t\t\tif ($data.is('form') && !$data.is('[data-pjax-fragment~=Content]')) guessFragment = 'CurrentForm';\n\n\t\t\t\tnewFragments[guessFragment] = $data;\n\t\t\t}\n\n\t\t\tthis.setRedrawSuppression(true);\n\t\t\ttry {\n\t\t\t\t// Replace each fragment individually\n\t\t\t\t$.each(newFragments, function(newFragment, html) {\n\t\t\t\t\tvar contentEl = $('[data-pjax-fragment]').filter(function() {\n\t\t\t\t\t\treturn $.inArray(newFragment, $(this).data('pjaxFragment').split(' ')) != -1;\n\t\t\t\t\t}), newContentEl = $(html);\n\n\t\t\t\t\t// Add to result collection\n\t\t\t\t\tif(newContentEls) newContentEls.add(newContentEl);\n\t\t\t\t\telse newContentEls = newContentEl;\n\n\t\t\t\t\t// Update panels\n\t\t\t\t\tif(newContentEl.find('.cms-container').length) {\n\t\t\t\t\t\tthrow 'Content loaded via ajax is not allowed to contain tags matching the \".cms-container\" selector to avoid infinite loops';\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set loading state and store element state\n\t\t\t\t\tvar origStyle = contentEl.attr('style');\n\t\t\t\t\tvar origParent = contentEl.parent();\n\t\t\t\t\tvar origParentLayoutApplied = (typeof origParent.data('jlayout')!=='undefined');\n\t\t\t\t\tvar layoutClasses = ['east', 'west', 'center', 'north', 'south', 'column-hidden'];\n\t\t\t\t\tvar elemClasses = contentEl.attr('class');\n\t\t\t\t\tvar origLayoutClasses = [];\n\t\t\t\t\tif(elemClasses) {\n\t\t\t\t\t\torigLayoutClasses = $.grep(\n\t\t\t\t\t\t\telemClasses.split(' '),\n\t\t\t\t\t\t\tfunction(val) { return ($.inArray(val, layoutClasses) >= 0);}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tnewContentEl\n\t\t\t\t\t\t.removeClass(layoutClasses.join(' '))\n\t\t\t\t\t\t.addClass(origLayoutClasses.join(' '));\n\t\t\t\t\tif(origStyle) newContentEl.attr('style', origStyle);\n\n\t\t\t\t\t// Allow injection of inline styles, as they're not allowed in the document body.\n\t\t\t\t\t// Not handling this through jQuery.ondemand to avoid parsing the DOM twice.\n\t\t\t\t\tvar styles = newContentEl.find('style').detach();\n\t\t\t\t\tif(styles.length) $(document).find('head').append(styles);\n\n\t\t\t\t\t// Replace panel completely (we need to override the \"layout\" attribute, so can't replace the child instead)\n\t\t\t\t\tcontentEl.replaceWith(newContentEl);\n\n\t\t\t\t\t// Force jlayout to rebuild internal hierarchy to point to the new elements.\n\t\t\t\t\t// This is only necessary for elements that are at least 3 levels deep. 2nd level elements will\n\t\t\t\t\t// be taken care of when we lay out the top level element (.cms-container).\n\t\t\t\t\tif (!origParent.is('.cms-container') && origParentLayoutApplied) {\n\t\t\t\t\t\torigParent.layout();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Re-init tabs (in case the form tag itself is a tabset)\n\t\t\t\tvar newForm = newContentEls.filter('form');\n\t\t\t\tif(newForm.hasClass('cms-tabset')) newForm.removeClass('cms-tabset').addClass('cms-tabset');\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tthis.setRedrawSuppression(false);\n\t\t\t}\n\n\t\t\tthis.redraw();\n\t\t\tthis.restoreTabState((state && typeof state.tabState !== 'undefined') ? state.tabState : null);\n\n\t\t\treturn newContentEls;\n\t\t},\n\n\t\t/**\n\t\t *\n\t\t *\n\t\t * Parameters:\n\t\t * - fragments {Array}\n\t\t * Returns: jQuery collection\n\t\t */\n\t\t_findFragments: function(fragments) {\n\t\t\treturn $('[data-pjax-fragment]').filter(function() {\n\t\t\t\t// Allows for more than one fragment per node\n\t\t\t\tvar i, nodeFragments = $(this).data('pjaxFragment').split(' ');\n\t\t\t\tfor(i in fragments) {\n\t\t\t\t\tif($.inArray(fragments[i], nodeFragments) != -1) return true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * Function: refresh\n\t\t *\n\t\t * Updates the container based on the current url\n\t\t *\n\t\t * Returns: void\n\t\t */\n\t\trefresh: function() {\n\t\t\t$(window).trigger('statechange');\n\n\t\t\t$(this).redraw();\n\t\t},\n\n\t\t/**\n\t\t * Save tab selections in order to reconstruct them later.\n\t\t * Requires HTML5 sessionStorage support.\n\t\t */\n\t\tsaveTabState: function() {\n\t\t\tif(typeof(window.sessionStorage)==\"undefined\" || window.sessionStorage === null) return;\n\n\t\t\tvar selectedTabs = [], url = this._tabStateUrl();\n\t\t\tthis.find('.cms-tabset,.ss-tabset').each(function(i, el) {\n\t\t\t\tvar id = $(el).attr('id');\n\t\t\t\tif(!id) return; // we need a unique reference\n\t\t\t\tif(!$(el).data('tabs')) return; // don't act on uninit'ed controls\n\n\t\t\t\t// Allow opt-out via data element or entwine property.\n\t\t\t\tif($(el).data('ignoreTabState') || $(el).getIgnoreTabState()) return;\n\n\t\t\t\tselectedTabs.push({id:id, selected:$(el).tabs('option', 'selected')});\n\t\t\t});\n\n\t\t\tif(selectedTabs) {\n\t\t\t\tvar tabsUrl = 'tabs-' + url;\n\t\t\t\ttry {\n\t\t\t\t\twindow.sessionStorage.setItem(tabsUrl, JSON.stringify(selectedTabs));\n\t\t\t\t} catch(err) {\n\t\t\t\t\tif (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) {\n\t\t\t\t\t\t// If this fails we ignore the error as the only issue is that it\n\t\t\t\t\t\t// does not remember the tab state.\n\t\t\t\t\t\t// This is a Safari bug which happens when private browsing is enabled.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Re-select previously saved tabs.\n\t\t * Requires HTML5 sessionStorage support.\n\t\t *\n\t\t * Parameters:\n\t\t * \t(Object) Map of tab container selectors to tab selectors.\n\t\t * \tUsed to mark a specific tab as active regardless of the previously saved options.\n\t\t */\n\t\trestoreTabState: function(overrideStates) {\n\t\t\tvar self = this, url = this._tabStateUrl(),\n\t\t\t\thasSessionStorage = (typeof(window.sessionStorage)!==\"undefined\" && window.sessionStorage),\n\t\t\t\tsessionData = hasSessionStorage ? window.sessionStorage.getItem('tabs-' + url) : null,\n\t\t\t\tsessionStates = sessionData ? JSON.parse(sessionData) : false;\n\n\t\t\tthis.find('.cms-tabset, .ss-tabset').each(function() {\n\t\t\t\tvar index, tabset = $(this), tabsetId = tabset.attr('id'), tab,\n\t\t\t\t\tforcedTab = tabset.find('.ss-tabs-force-active');\n\n\t\t\t\tif(!tabset.data('tabs')){\n\t\t\t\t\treturn; // don't act on uninit'ed controls\n\t\t\t\t}\n\n\t\t\t\t// The tabs may have changed, notify the widget that it should update its internal state.\n\t\t\t\ttabset.tabs('refresh');\n\n\t\t\t\t// Make sure the intended tab is selected.\n\t\t\t\tif(forcedTab.length) {\n\t\t\t\t\tindex = forcedTab.index();\n\t\t\t\t} else if(overrideStates && overrideStates[tabsetId]) {\n\t\t\t\t\ttab = tabset.find(overrideStates[tabsetId].tabSelector);\n\t\t\t\t\tif(tab.length){\n\t\t\t\t\t\tindex = tab.index();\n\t\t\t\t\t}\n\t\t\t\t} else if(sessionStates) {\n\t\t\t\t\t$.each(sessionStates, function(i, sessionState) {\n\t\t\t\t\t\tif(tabset.is('#' + sessionState.id)){\n\t\t\t\t\t\t\tindex = sessionState.selected;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(index !== null){\n\t\t\t\t\ttabset.tabs('option', 'active', index);\n\t\t\t\t\tself.trigger('tabstaterestored');\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * Remove any previously saved state.\n\t\t *\n\t\t * Parameters:\n\t\t * (String) url Optional (sanitized) URL to clear a specific state.\n\t\t */\n\t\tclearTabState: function(url) {\n\t\t\tif(typeof(window.sessionStorage)==\"undefined\") return;\n\n\t\t\tvar s = window.sessionStorage;\n\t\t\tif(url) {\n\t\t\t\ts.removeItem('tabs-' + url);\n\t\t\t} else {\n\t\t\t\tfor(var i=0;i<s.length;i++) {\n\t\t\t\t\tif(s.key(i).match(/^tabs-/)) s.removeItem(s.key(i));\n\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove tab state for the current URL.\n\t\t */\n\t\tclearCurrentTabState: function() {\n\t\t\tthis.clearTabState(this._tabStateUrl());\n\t\t},\n\n\t\t_tabStateUrl: function() {\n\t\t\treturn window.history.state.path\n\t\t\t\t.replace(/\\?.*/, '')\n\t\t\t\t.replace(/#.*/, '')\n\t\t\t\t.replace($('base').attr('href'), '');\n\t\t},\n\n\t\tshowLoginDialog: function() {\n\t\t\tvar tempid = $('body').data('member-tempid'),\n\t\t\t\tdialog = $('.leftandmain-logindialog'),\n\t\t\t\turl = 'CMSSecurity/login';\n\n\t\t\t// Force regeneration of any existing dialog\n\t\t\tif(dialog.length) dialog.remove();\n\n\t\t\t// Join url params\n\t\t\turl = $.path.addSearchParams(url, {\n\t\t\t\t'tempid': tempid,\n\t\t\t\t'BackURL': window.location.href\n\t\t\t});\n\n\t\t\t// Show a placeholder for instant feedback. Will be replaced with actual\n\t\t\t// form dialog once its loaded.\n\t\t\tdialog = $('<div class=\"leftandmain-logindialog\"></div>');\n\t\t\tdialog.attr('id', new Date().getTime());\n\t\t\tdialog.data('url', url);\n\t\t\t$('body').append(dialog);\n\t\t}\n\t});\n\n\t// Login dialog page\n\t$('.leftandmain-logindialog').entwine({\n\t\tonmatch: function() {\n\t\t\tthis._super();\n\n\t\t\t// Create jQuery dialog\n\t\t\tthis.ssdialog({\n\t\t\t\tiframeUrl: this.data('url'),\n\t\t\t\tdialogClass: \"leftandmain-logindialog-dialog\",\n\t\t\t\tautoOpen: true,\n\t\t\t\tminWidth: 500,\n\t\t\t\tmaxWidth: 500,\n\t\t\t\tminHeight: 370,\n\t\t\t\tmaxHeight: 400,\n\t\t\t\tcloseOnEscape: false,\n\t\t\t\topen: function() {\n\t\t\t\t\t$('.ui-widget-overlay').addClass('leftandmain-logindialog-overlay');\n\t\t\t\t},\n\t\t\t\tclose: function() {\n\t\t\t\t\t$('.ui-widget-overlay').removeClass('leftandmain-logindialog-overlay');\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\t\topen: function() {\n\t\t\tthis.ssdialog('open');\n\t\t},\n\t\tclose: function() {\n\t\t\tthis.ssdialog('close');\n\t\t},\n\t\ttoggle: function(bool) {\n\t\t\tif(this.is(':visible')) this.close();\n\t\t\telse this.open();\n\t\t},\n\t\t/**\n\t\t * Callback activated by CMSSecurity_success.ss\n\t\t */\n\t\treauthenticate: function(data) {\n\t\t\t// Replace all SecurityID fields with the given value\n\t\t\tif(typeof(data.SecurityID) !== 'undefined') {\n\t\t\t\t$(':input[name=SecurityID]').val(data.SecurityID);\n\t\t\t}\n\t\t\t// Update TempID for current user\n\t\t\tif(typeof(data.TempID) !== 'undefined') {\n\t\t\t\t$('body').data('member-tempid', data.TempID);\n\t\t\t}\n\t\t\tthis.close();\n\t\t}\n\t});\n\n\t/**\n\t * Add loading overlay to selected regions in the CMS automatically.\n\t * Not applied to all \"*.loading\" elements to avoid secondary regions\n\t * like the breadcrumbs showing unnecessary loading status.\n\t */\n\t$('form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading').entwine({\n\t\tonmatch: function() {\n\t\t\tthis.append('<div class=\"cms-content-loading-overlay ui-widget-overlay-light\"></div><div class=\"cms-content-loading-spinner\"></div>');\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis.find('.cms-content-loading-overlay,.cms-content-loading-spinner').remove();\n\t\t\tthis._super();\n\t\t}\n\t});\n\n\t/** Make all buttons \"hoverable\" with jQuery theming. */\n\t$('.cms input[type=\"submit\"], .cms button, .cms input[type=\"reset\"], .cms .ss-ui-button').entwine({\n\t\tonadd: function() {\n\t\t\tthis.addClass('ss-ui-button');\n\t\t\tif(!this.data('button')) this.button();\n\t\t\tthis._super();\n\t\t},\n\t\tonremove: function() {\n\t\t\tif(this.data('button')) this.button('destroy');\n\t\t\tthis._super();\n\t\t}\n\t});\n\n\t/**\n\t * Loads the link's 'href' attribute into a panel via ajax,\n\t * as opposed to triggering a full page reload.\n\t * Little helper to avoid repetition, and make it easy to\n\t * \"opt in\" to panel loading, while by default links still exhibit their default behaviour.\n\t * The PJAX target can be specified via a 'data-pjax-target' attribute.\n\t */\n\t$('.cms .cms-panel-link').entwine({\n\t\tonclick: function(e) {\n\t\t\tif($(this).hasClass('external-link')) {\n\t\t\t\te.stopPropagation();\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar href = this.attr('href'),\n\t\t\t\turl = (href && !href.match(/^#/)) ? href : this.data('href'),\n\t\t\t\tdata = {pjax: this.data('pjaxTarget')};\n\n\t\t\t$('.cms-container').loadPanel(url, null, data);\n\t\t\te.preventDefault();\n\t\t}\n\t});\n\n\t/**\n\t * Does an ajax loads of the link's 'href' attribute via ajax and displays any FormResponse messages from the CMS.\n\t * Little helper to avoid repetition, and make it easy to trigger actions via a link,\n\t * without reloading the page, changing the URL, or loading in any new panel content.\n\t */\n\t$('.cms .ss-ui-button-ajax').entwine({\n\t\tonclick: function(e) {\n\t\t\t$(this).removeClass('ui-button-text-only');\n\t\t\t$(this).addClass('ss-ui-button-loading ui-button-text-icons');\n\n\t\t\tvar loading = $(this).find(\".ss-ui-loading-icon\");\n\n\t\t\tif(loading.length < 1) {\n\t\t\t\tloading = $(\"<span></span>\").addClass('ss-ui-loading-icon ui-button-icon-primary ui-icon');\n\n\t\t\t\t$(this).prepend(loading);\n\t\t\t}\n\n\t\t\tloading.show();\n\n\t\t\tvar href = this.attr('href'), url = href ? href : this.data('href');\n\n\t\t\tjQuery.ajax({\n\t\t\t\turl: url,\n\t\t\t\t// Ensure that form view is loaded (rather than whole \"Content\" template)\n\t\t\t\tcomplete: function(xmlhttp, status) {\n\t\t\t\t\tvar msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.responseText;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (typeof msg != \"undefined\" && msg !== null) eval(msg);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(e) {}\n\n\t\t\t\t\tloading.hide();\n\n\t\t\t\t\t$(\".cms-container\").refresh();\n\n\t\t\t\t\t$(this).removeClass('ss-ui-button-loading ui-button-text-icons');\n\t\t\t\t\t$(this).addClass('ui-button-text-only');\n\t\t\t\t},\n\t\t\t\tdataType: 'html'\n\t\t\t});\n\t\t\te.preventDefault();\n\t\t}\n\t});\n\n\t/**\n\t * Trigger dialogs with iframe based on the links href attribute (see ssui-core.js).\n\t */\n\t$('.cms .ss-ui-dialog-link').entwine({\n\t\tUUID: null,\n\t\tonmatch: function() {\n\t\t\tthis._super();\n\t\t\tthis.setUUID(new Date().getTime());\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\t\tonclick: function() {\n\t\t\tthis._super();\n\n\t\t\tvar self = this, id = 'ss-ui-dialog-' + this.getUUID();\n\t\t\tvar dialog = $('#' + id);\n\t\t\tif(!dialog.length) {\n\t\t\t\tdialog = $('<div class=\"ss-ui-dialog\" id=\"' + id + '\" />');\n\t\t\t\t$('body').append(dialog);\n\t\t\t}\n\n\t\t\tvar extraClass = this.data('popupclass')?this.data('popupclass'):'';\n\n\t\t\tdialog.ssdialog({iframeUrl: this.attr('href'), autoOpen: true, dialogExtraClass: extraClass});\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t/**\n\t * Add styling to all contained buttons, and create buttonsets if required.\n\t */\n\t$('.cms-content .Actions').entwine({\n\t\tonmatch: function() {\n\t\t\tthis.find('.ss-ui-button').click(function() {\n\t\t\t\t\tvar form = this.form;\n\n\t\t\t\t\t// forms don't natively store the button they've been triggered with\n\t\t\t\t\tif(form) {\n\t\t\t\t\t\tform.clickedButton = this;\n\t\t\t\t\t\t// Reset the clicked button shortly after the onsubmit handlers\n\t\t\t\t\t\t// have fired on the form\n\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\tform.clickedButton = null;\n\t\t\t\t\t}, 10);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.redraw();\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t},\n\t\tredraw: function() {\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\n\t\t\t// Remove whitespace to avoid gaps with inline elements\n\t\t\tthis.contents().filter(function() {\n\t\t\t\treturn (this.nodeType == 3 && !/\\S/.test(this.nodeValue));\n\t\t\t}).remove();\n\n\t\t\t// Init buttons if required\n\t\t\tthis.find('.ss-ui-button').each(function() {\n\t\t\t\tif(!$(this).data('button')) $(this).button();\n\t\t\t});\n\n\t\t\t// Mark up buttonsets\n\t\t\tthis.find('.ss-ui-buttonset').buttonset();\n\t\t}\n\t});\n\n\t/**\n\t * Duplicates functionality in DateField.js, but due to using entwine we can match\n\t * the DOM element on creation, rather than onclick - which allows us to decorate\n\t * the field with a calendar icon\n\t */\n\t$('.cms .field.date input.text').entwine({\n\t\tonmatch: function() {\n\t\t\tvar holder = $(this).parents('.field.date:first'), config = holder.data();\n\t\t\tif(!config.showcalendar) {\n\t\t\t\tthis._super();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconfig.showOn = 'button';\n\t\t\tif(config.locale && $.datepicker.regional[config.locale]) {\n\t\t\t\tconfig = $.extend(config, $.datepicker.regional[config.locale], {});\n\t\t\t}\n\n\t\t\t$(this).datepicker(config);\n\t\t\t// // Unfortunately jQuery UI only allows configuration of icon images, not sprites\n\t\t\t// this.next('button').button('option', 'icons', {primary : 'ui-icon-calendar'});\n\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t}\n\t});\n\n\t/**\n\t * Styled dropdown select fields via chosen. Allows things like search and optgroup\n\t * selection support. Rather than manually adding classes to selects we want\n\t * styled, we style everything but the ones we tell it not to.\n\t *\n\t * For the CMS we also need to tell the parent div that it has a select so\n\t * we can fix the height cropping.\n\t */\n\n\t$('.cms .field.dropdown select, .cms .field select[multiple], .fieldholder-small select.dropdown').entwine({\n\t\tonmatch: function() {\n\t\t\tif(this.is('.no-chzn')) {\n\t\t\t\tthis._super();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Explicitly disable default placeholder if no custom one is defined\n\t\t\tif(!this.data('placeholder')) this.data('placeholder', ' ');\n\n\t\t\t// We could've gotten stale classes and DOM elements from deferred cache.\n\t\t\tthis.removeClass('has-chzn chzn-done');\n\t\t\tthis.siblings('.chzn-container').remove();\n\n\t\t\t// Apply Chosen\n\t\t\tapplyChosen(this);\n\n\t\t\tthis._super();\n\t\t},\n\t\tonunmatch: function() {\n\t\t\tthis._super();\n\t\t}\n\t});\n\n\t$(\".cms-panel-layout\").entwine({\n\t\tredraw: function() {\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\t\t}\n\t});\n\n\t/**\n\t * Overload the default GridField behaviour (open a new URL in the browser)\n\t * with the CMS-specific ajax loading.\n\t */\n\t$('.cms .ss-gridfield').entwine({\n\t\tshowDetailView: function(url) {\n\t\t\t// Include any GET parameters from the current URL, as the view state might depend on it.\n\t\t\t// For example, a list prefiltered through external search criteria might be passed to GridField.\n\t\t\tvar params = window.location.search.replace(/^\\?/, '');\n\t\t\tif(params) url = $.path.addSearchParams(url, params);\n\t\t\t$('.cms-container').loadPanel(url);\n\t\t}\n\t});\n\n\n\t/**\n\t * Generic search form in the CMS, often hooked up to a GridField results display.\n\t */\n\t$('.cms-search-form').entwine({\n\t\tonsubmit: function(e) {\n\t\t\t// Remove empty elements and make the URL prettier\n\t\t\tvar nonEmptyInputs,\n\t\t\t\turl;\n\n\t\t\tnonEmptyInputs = this.find(':input:not(:submit)').filter(function() {\n\t\t\t\t// Use fieldValue() from jQuery.form plugin rather than jQuery.val(),\n\t\t\t\t// as it handles checkbox values more consistently\n\t\t\t\tvar vals = $.grep($(this).fieldValue(), function(val) { return (val);});\n\t\t\t\treturn (vals.length);\n\t\t\t});\n\n\t\t\turl = this.attr('action');\n\n\t\t\tif(nonEmptyInputs.length) {\n\t\t\t\turl = $.path.addSearchParams(url, nonEmptyInputs.serialize());\n\t\t\t}\n\n\t\t\tvar container = this.closest('.cms-container');\n\t\t\tcontainer.find('.cms-edit-form').tabs('select',0); //always switch to the first tab (list view) when searching\n\t\t\tcontainer.loadPanel(url, \"\", {}, true);\n\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t/**\n\t * Reset button handler. IE8 does not bubble reset events to\n\t */\n\t$(\".cms-search-form button[type=reset], .cms-search-form input[type=reset]\").entwine({\n\t\tonclick: function(e) {\n\t\t\te.preventDefault();\n\n\t\t\tvar form = $(this).parents('form');\n\n\t\t\tform.clearForm();\n\t\t\tform.find(\".dropdown select\").prop('selectedIndex', 0).trigger(\"liszt:updated\"); // Reset chosen.js\n\t\t\tform.submit();\n\t\t\t}\n\t});\n\n\t/**\n\t * Allows to lazy load a panel, by leaving it empty\n\t * and declaring a URL to load its content via a 'url' HTML5 data attribute.\n\t * The loaded HTML is cached, with cache key being the 'url' attribute.\n\t * In order for this to work consistently, we assume that the responses are stateless.\n\t * To avoid caching, add a 'deferred-no-cache' to the node.\n\t */\n\twindow._panelDeferredCache = {};\n\t$('.cms-panel-deferred').entwine({\n\t\tonadd: function() {\n\t\t\tthis._super();\n\t\t\tthis.redraw();\n\t\t},\n\t\tonremove: function() {\n\t\t\tif(window.debug) console.log('saving', this.data('url'), this);\n\n\t\t\t// Save the HTML state at the last possible moment.\n\t\t\t// Don't store the DOM to avoid memory leaks.\n\t\t\tif(!this.data('deferredNoCache')) window._panelDeferredCache[this.data('url')] = this.html();\n\t\t\tthis._super();\n\t\t},\n\t\tredraw: function() {\n\t\t\tif(window.debug) console.log('redraw', this.attr('class'), this.get(0));\n\n\t\t\tvar self = this, url = this.data('url');\n\t\t\tif(!url) throw 'Elements of class .cms-panel-deferred need a \"data-url\" attribute';\n\n\t\t\tthis._super();\n\n\t\t\t// If the node is empty, try to either load it from cache or via ajax.\n\t\t\tif(!this.children().length) {\n\t\t\t\tif(!this.data('deferredNoCache') && typeof window._panelDeferredCache[url] !== 'undefined') {\n\t\t\t\t\tthis.html(window._panelDeferredCache[url]);\n\t\t\t\t} else {\n\t\t\t\t\tthis.addClass('loading');\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\turl: url,\n\t\t\t\t\t\tcomplete: function() {\n\t\t\t\t\t\t\tself.removeClass('loading');\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(data, status, xhr) {\n\t\t\t\t\t\t\tself.html(data);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t/**\n\t * Lightweight wrapper around jQuery UI tabs.\n\t * Ensures that anchor links are set properly,\n\t * and any nested tabs are scrolled if they have\n\t * their height explicitly set. This is important\n\t * for forms inside the CMS layout.\n\t */\n\t$('.cms-tabset').entwine({\n\t\tonadd: function() {\n\t\t\t// Can't name redraw() as it clashes with other CMS entwine classes\n\t\t\tthis.redrawTabs();\n\t\t\tthis._super();\n\t\t},\n\t\tonremove: function() {\n\t\t\tif (this.data('tabs')) this.tabs('destroy');\n\t\t\tthis._super();\n\t\t},\n\t\tredrawTabs: function() {\n\t\t\tthis.rewriteHashlinks();\n\n\t\t\tvar id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active');\n\n\t\t\tif(!this.data('uiTabs')) this.tabs({\n\t\t\t\tactive: (activeTab.index() != -1) ? activeTab.index() : 0,\n\t\t\t\tbeforeLoad: function(e, ui) {\n\t\t\t\t\t// Disable automatic ajax loading of tabs without matching DOM elements,\n\t\t\t\t\t// determining if the current URL differs from the tab URL is too error prone.\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tactivate: function(e, ui) {\n\t\t\t\t\t// Usability: Hide actions for \"readonly\" tabs (which don't contain any editable fields)\n\t\t\t\t\tvar actions = $(this).closest('form').find('.Actions');\n\t\t\t\t\tif($(ui.newTab).closest('li').hasClass('readonly')) {\n\t\t\t\t\t\tactions.fadeOut();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tactions.show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * Ensure hash links are prefixed with the current page URL,\n\t\t * otherwise jQuery interprets them as being external.\n\t\t */\n\t\trewriteHashlinks: function() {\n\t\t\t$(this).find('ul a').each(function() {\n\t\t\t\tif (!$(this).attr('href')) return;\n\t\t\t\tvar matches = $(this).attr('href').match(/#.*/);\n\t\t\t\tif(!matches) return;\n\t\t\t\t$(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]);\n\t\t\t});\n\t\t}\n\t});\n\n\t/**\n\t * CMS content filters\n\t */\n\t$('#filters-button').entwine({\n\t\tonmatch: function () {\n\t\t\tthis._super();\n\n\t\t\tthis.data('collapsed', true); // The current collapsed state of the element.\n\t\t\tthis.data('animating', false); // True if the element is currently animating.\n\t\t},\n\t\tonunmatch: function () {\n\t\t\tthis._super();\n\t\t},\n\t\tshowHide: function () {\n\t\t\tvar self = this,\n\t\t\t\t$filters = $('.cms-content-filters').first(),\n\t\t\t\tcollapsed = this.data('collapsed');\n\n\t\t\t// Prevent the user from spamming the UI with animation requests.\n\t\t\tif (this.data('animating')) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.toggleClass('active');\n\t\t\tthis.data('animating', true);\n\n\t\t\t// Slide the element down / up based on it's current collapsed state.\n\t\t\t$filters[collapsed ? 'slideDown' : 'slideUp']({\n\t\t\t\tcomplete: function () {\n\t\t\t\t\t// Update the element's state.\n\t\t\t\t\tself.data('collapsed', !collapsed);\n\t\t\t\t\tself.data('animating', false);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tonclick: function () {\n\t\t\tthis.showHide();\n\t\t}\n\t});\n});\n\nvar statusMessage = function(text, type) {\n\ttext = jQuery('<div/>').text(text).html(); // Escape HTML entities in text\n\tjQuery.noticeAdd({text: text, type: type, stayTime: 5000, inEffect: {left: '0', opacity: 'show'}});\n};\n\nvar errorMessage = function(text) {\n\tjQuery.noticeAdd({text: text, type: 'error', stayTime: 5000, inEffect: {left: '0', opacity: 'show'}});\n};\n","require('../../src/LeftAndMain.Layout.js');\nrequire('../../src/LeftAndMain.js');\nrequire('../../src/LeftAndMain.ActionTabSet.js');\nrequire('../../src/LeftAndMain.Panel.js');\nrequire('../../src/LeftAndMain.Tree.js');\nrequire('../../src/LeftAndMain.Content.js');\nrequire('../../src/LeftAndMain.EditForm.js');\nrequire('../../src/LeftAndMain.Menu.js');\nrequire('../../src/LeftAndMain.Preview.js');\nrequire('../../src/LeftAndMain.BatchActions.js');\nrequire('../../src/LeftAndMain.FieldHelp.js');\nrequire('../../src/LeftAndMain.FieldDescriptionToggle.js');\nrequire('../../src/LeftAndMain.TreeDropdownField.js');\n"]} |