diff --git a/client/dist/js/TinyMCE_sslink-email.js b/client/dist/js/TinyMCE_sslink-email.js index 6de275a77..3fe11d27f 100644 --- a/client/dist/js/TinyMCE_sslink-email.js +++ b/client/dist/js/TinyMCE_sslink-email.js @@ -1 +1,5 @@ -webpackJsonp([2],{125:function(e,t){e.exports=ReactApollo},180:function(e,t){e.exports=InsertLinkModal},24:function(e,t){e.exports=i18n},45:function(e,t){e.exports=Injector},932:function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(24),a=n(r),l=i(99),o=n(l),s=i(0),d=n(s),u=i(25),c=n(u),m=i(125),f=i(27),p=n(f),k=i(180),g=i(45);o.default.addAction("sslink",{text:a.default._t("Admin.LINKLABEL_EMAIL","Link to email address"),onclick:function(e){return e.execCommand("sslinkemail")}}).addCommandWithUrlTest("sslinkemail",/^mailto:/);var h={init:function(e){e.addCommand("sslinkemail",function(){window.jQuery("#"+e.id).entwine("ss").openLinkEmailDialog()})}},_="insert-link__dialog-wrapper--email",A=(0,g.provideInjector)((0,k.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","EditorEmailLink"));p.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkEmailDialog:function(){var t=e("#"+_);t.length||(t=e('
'),e("body").append(t)),t.addClass("insert-link__dialog-wrapper"),t.setElement(this),t.open()}}),e("#"+_).entwine({renderModal:function(e){var t=this,i=ss.store,n=ss.apolloClient,r=function(){return t.close()},l=function(){return t.handleInsert.apply(t,arguments)},o=this.getOriginalAttributes();c.default.render(d.default.createElement(m.ApolloProvider,{store:i,client:n},d.default.createElement(A,{show:e,onInsert:l,onHide:r,title:a.default._t("Admin.LINK_EMAIL","Insert email link"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--email",fileAttributes:o,identifier:"Admin.InsertLinkEmailModal"})),this[0])},getOriginalAttributes:function(){var t=this.getElement().getEditor(),i=e(t.getSelectedNode()),n=(i.attr("href")||"").split("?"),r=n[0].replace(/^mailto:/,"").split("?")[0];r.match(/.+@.+\..+/)||(r="");var a=n[1]?n[1].match(/subject=([^&]+)/):"";return{Link:r,Subject:a?a[1]:"",Description:i.attr("title")}},buildAttributes:function(e){var t=this._super(e),i="",n=t.href.replace(/^mailto:/,"").split("?")[0];return n.match(/.+@.+\..+/)||(n=""),n&&(i="mailto:"+n),i&&e.Subject&&(i=i+"?subject="+encodeURIComponent(e.Subject)),t.href=i,delete t.target,t}})}),tinymce.PluginManager.add("sslinkemail",function(e){return h.init(e)}),t.default=h},99:function(e,t){e.exports=TinyMCEActionRegistrar}},[932]); \ No newline at end of file +<<<<<<< HEAD +webpackJsonp([2],{125:function(e,t){e.exports=ReactApollo},180:function(e,t){e.exports=InsertLinkModal},24:function(e,t){e.exports=i18n},45:function(e,t){e.exports=Injector},932:function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(24),a=n(r),l=i(99),o=n(l),s=i(0),d=n(s),u=i(25),c=n(u),m=i(125),f=i(27),p=n(f),k=i(180),g=i(45);o.default.addAction("sslink",{text:a.default._t("Admin.LINKLABEL_EMAIL","Link to email address"),onclick:function(e){return e.execCommand("sslinkemail")}}).addCommandWithUrlTest("sslinkemail",/^mailto:/);var h={init:function(e){e.addCommand("sslinkemail",function(){window.jQuery("#"+e.id).entwine("ss").openLinkEmailDialog()})}},_="insert-link__dialog-wrapper--email",A=(0,g.provideInjector)((0,k.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","EditorEmailLink"));p.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkEmailDialog:function(){var t=e("#"+_);t.length||(t=e(''),e("body").append(t)),t.addClass("insert-link__dialog-wrapper"),t.setElement(this),t.open()}}),e("#"+_).entwine({renderModal:function(e){var t=this,i=ss.store,n=ss.apolloClient,r=function(){return t.close()},l=function(){return t.handleInsert.apply(t,arguments)},o=this.getOriginalAttributes();c.default.render(d.default.createElement(m.ApolloProvider,{store:i,client:n},d.default.createElement(A,{show:e,onInsert:l,onHide:r,title:a.default._t("Admin.LINK_EMAIL","Insert email link"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--email",fileAttributes:o,identifier:"Admin.InsertLinkEmailModal"})),this[0])},getOriginalAttributes:function(){var t=this.getElement().getEditor(),i=e(t.getSelectedNode()),n=(i.attr("href")||"").split("?"),r=n[0].replace(/^mailto:/,"").split("?")[0];r.match(/.+@.+\..+/)||(r="");var a=n[1]?n[1].match(/subject=([^&]+)/):"";return{Link:r,Subject:a?a[1]:"",Description:i.attr("title")}},buildAttributes:function(e){var t=this._super(e),i="",n=t.href.replace(/^mailto:/,"").split("?")[0];return n.match(/.+@.+\..+/)||(n=""),n&&(i="mailto:"+n),i&&e.Subject&&(i=i+"?subject="+encodeURIComponent(e.Subject)),t.href=i,delete t.target,t}})}),tinymce.PluginManager.add("sslinkemail",function(e){return h.init(e)}),t.default=h},99:function(e,t){e.exports=TinyMCEActionRegistrar}},[932]); +======= +webpackJsonp([2],{100:function(e,t){e.exports=TinyMCEActionRegistrar},125:function(e,t){e.exports=ReactApollo},180:function(e,t){e.exports=InsertLinkModal},23:function(e,t){e.exports=i18n},45:function(e,t){e.exports=Injector},932:function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(23),a=n(r),l=i(100),o=n(l),s=i(0),d=n(s),u=i(25),c=n(u),m=i(125),f=i(27),p=n(f),k=i(180),g=i(45);o.default.addAction("sslink",{text:a.default._t("Admin.LINKLABEL_EMAIL","Link to email address"),onclick:function(e){return e.execCommand("sslinkemail")}}).addCommandWithUrlTest("sslinkemail",/^mailto:/);var h={init:function(e){e.addCommand("sslinkemail",function(){window.jQuery("#"+e.id).entwine("ss").openLinkEmailDialog()})}},_="insert-link__dialog-wrapper--email",A=(0,g.provideInjector)((0,k.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","EditorEmailLink"));p.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkEmailDialog:function(){var t=e("#"+_);t.length||(t=e(''),e("body").append(t)),t.addClass("insert-link__dialog-wrapper"),t.setElement(this),t.open()}}),e("#"+_).entwine({renderModal:function(e){var t=this,i=ss.store,n=ss.apolloClient,r=function(){return t.close()},l=function(){return t.handleInsert.apply(t,arguments)},o=this.getOriginalAttributes();c.default.render(d.default.createElement(m.ApolloProvider,{store:i,client:n},d.default.createElement(A,{show:e,onInsert:l,onHide:r,title:a.default._t("Admin.LINK_EMAIL","Insert email link"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--email",fileAttributes:o,identifier:"Admin.InsertLinkEmailModal"})),this[0])},getOriginalAttributes:function(){var t=this.getElement().getEditor(),i=e(t.getSelectedNode()),n=(i.attr("href")||"").split("?"),r=n[0].replace(/^mailto:/,"").split("?")[0];r.match(/.+@.+\..+/)||(r="");var a=n[1]?n[1].match(/subject=([^&]+)/):"";return{Link:r,Subject:a?a[1]:"",Description:i.attr("title")}},buildAttributes:function(e){var t=this._super(e),i="",n=t.href.replace(/^mailto:/,"").split("?")[0];return n.match(/.+@.+\..+/)||(n=""),n&&(i="mailto:"+n),i&&e.Subject&&(i=i+"?subject="+encodeURIComponent(e.Subject)),t.href=i,delete t.target,t}})}),tinymce.PluginManager.add("sslinkemail",function(e){return h.init(e)}),t.default=h}},[932]); +>>>>>>> build diff --git a/client/dist/js/TinyMCE_sslink-external.js b/client/dist/js/TinyMCE_sslink-external.js index 8c93d968a..17cd85cf5 100644 --- a/client/dist/js/TinyMCE_sslink-external.js +++ b/client/dist/js/TinyMCE_sslink-external.js @@ -1 +1,5 @@ -webpackJsonp([1],{125:function(e,n){e.exports=ReactApollo},180:function(e,n){e.exports=InsertLinkModal},24:function(e,n){e.exports=i18n},45:function(e,n){e.exports=Injector},933:function(e,n,t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r=t(24),o=i(r),a=t(99),l=i(a),s=t(0),d=i(s),u=t(25),c=i(u),f=t(125),p=t(27),x=i(p),m=t(180),k=t(45);l.default.addAction("sslink",{text:o.default._t("Admin.LINKLABEL_EXTERNALURL","Link to external URL"),onclick:function(e){return e.execCommand("sslinkexternal")}});var _={init:function(e){e.addCommand("sslinkexternal",function(){window.jQuery("#"+e.id).entwine("ss").openLinkExternalDialog()})}},L="insert-link__dialog-wrapper--external",A=(0,k.provideInjector)((0,m.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","EditorExternalLink"));x.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkExternalDialog:function(){var n=e("#"+L);n.length||(n=e(''),e("body").append(n)),n.addClass("insert-link__dialog-wrapper"),n.setElement(this),n.open()}}),e("#"+L).entwine({renderModal:function(e){var n=this,t=ss.store,i=ss.apolloClient,r=function(){return n.close()},a=function(){return n.handleInsert.apply(n,arguments)},l=this.getOriginalAttributes();c.default.render(d.default.createElement(f.ApolloProvider,{store:t,client:i},d.default.createElement(A,{show:e,onInsert:a,onHide:r,title:o.default._t("Admin.LINK_EXTERNAL","Insert external link"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--external",fileAttributes:l,identifier:"Admin.InsertLinkExternalModal"})),this[0])},buildAttributes:function(e){var n=this._super(e),t=n.href;return t.match(/:\/\//)||(t=window.location.protocol+"//"+t),t=t.replace(/:\/\/(#.*)$/,"$2"),t.match(/:\/\/$/)&&(t=""),n.href=t,n}})}),tinymce.PluginManager.add("sslinkexternal",function(e){return _.init(e)}),n.default=_},99:function(e,n){e.exports=TinyMCEActionRegistrar}},[933]); \ No newline at end of file +<<<<<<< HEAD +webpackJsonp([1],{125:function(e,n){e.exports=ReactApollo},180:function(e,n){e.exports=InsertLinkModal},24:function(e,n){e.exports=i18n},45:function(e,n){e.exports=Injector},933:function(e,n,t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r=t(24),o=i(r),a=t(99),l=i(a),s=t(0),d=i(s),u=t(25),c=i(u),f=t(125),p=t(27),x=i(p),m=t(180),k=t(45);l.default.addAction("sslink",{text:o.default._t("Admin.LINKLABEL_EXTERNALURL","Link to external URL"),onclick:function(e){return e.execCommand("sslinkexternal")}});var _={init:function(e){e.addCommand("sslinkexternal",function(){window.jQuery("#"+e.id).entwine("ss").openLinkExternalDialog()})}},L="insert-link__dialog-wrapper--external",A=(0,k.provideInjector)((0,m.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","EditorExternalLink"));x.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkExternalDialog:function(){var n=e("#"+L);n.length||(n=e(''),e("body").append(n)),n.addClass("insert-link__dialog-wrapper"),n.setElement(this),n.open()}}),e("#"+L).entwine({renderModal:function(e){var n=this,t=ss.store,i=ss.apolloClient,r=function(){return n.close()},a=function(){return n.handleInsert.apply(n,arguments)},l=this.getOriginalAttributes();c.default.render(d.default.createElement(f.ApolloProvider,{store:t,client:i},d.default.createElement(A,{show:e,onInsert:a,onHide:r,title:o.default._t("Admin.LINK_EXTERNAL","Insert external link"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--external",fileAttributes:l,identifier:"Admin.InsertLinkExternalModal"})),this[0])},buildAttributes:function(e){var n=this._super(e),t=n.href;return t.match(/:\/\//)||(t=window.location.protocol+"//"+t),t=t.replace(/:\/\/(#.*)$/,"$2"),t.match(/:\/\/$/)&&(t=""),n.href=t,n}})}),tinymce.PluginManager.add("sslinkexternal",function(e){return _.init(e)}),n.default=_},99:function(e,n){e.exports=TinyMCEActionRegistrar}},[933]); +======= +webpackJsonp([1],{100:function(e,n){e.exports=TinyMCEActionRegistrar},125:function(e,n){e.exports=ReactApollo},180:function(e,n){e.exports=InsertLinkModal},23:function(e,n){e.exports=i18n},45:function(e,n){e.exports=Injector},933:function(e,n,t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r=t(23),o=i(r),a=t(100),l=i(a),s=t(0),d=i(s),u=t(25),c=i(u),f=t(125),p=t(27),x=i(p),m=t(180),k=t(45);l.default.addAction("sslink",{text:o.default._t("Admin.LINKLABEL_EXTERNALURL","Link to external URL"),onclick:function(e){return e.execCommand("sslinkexternal")}});var _={init:function(e){e.addCommand("sslinkexternal",function(){window.jQuery("#"+e.id).entwine("ss").openLinkExternalDialog()})}},L="insert-link__dialog-wrapper--external",A=(0,k.provideInjector)((0,m.createInsertLinkModal)("SilverStripe\\Admin\\LeftAndMain","EditorExternalLink"));x.default.entwine("ss",function(e){e("textarea.htmleditor").entwine({openLinkExternalDialog:function(){var n=e("#"+L);n.length||(n=e(''),e("body").append(n)),n.addClass("insert-link__dialog-wrapper"),n.setElement(this),n.open()}}),e("#"+L).entwine({renderModal:function(e){var n=this,t=ss.store,i=ss.apolloClient,r=function(){return n.close()},a=function(){return n.handleInsert.apply(n,arguments)},l=this.getOriginalAttributes();c.default.render(d.default.createElement(f.ApolloProvider,{store:t,client:i},d.default.createElement(A,{show:e,onInsert:a,onHide:r,title:o.default._t("Admin.LINK_EXTERNAL","Insert external link"),bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--external",fileAttributes:l,identifier:"Admin.InsertLinkExternalModal"})),this[0])},buildAttributes:function(e){var n=this._super(e),t=n.href;return t.match(/:\/\//)||(t=window.location.protocol+"//"+t),t=t.replace(/:\/\/(#.*)$/,"$2"),t.match(/:\/\/$/)&&(t=""),n.href=t,n}})}),tinymce.PluginManager.add("sslinkexternal",function(e){return _.init(e)}),n.default=_}},[933]); +>>>>>>> build diff --git a/client/dist/js/TinyMCE_sslink.js b/client/dist/js/TinyMCE_sslink.js index 92d6f7eab..9421fcce4 100644 --- a/client/dist/js/TinyMCE_sslink.js +++ b/client/dist/js/TinyMCE_sslink.js @@ -1 +1 @@ -webpackJsonp([3],{775:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var o=Array.isArray(n)?n:[n||""];return Boolean(t&&o.map(function(t){return String(t)}).map(function(t){return t.toLowerCase()}).includes((t.tagName||"").toLowerCase())&&e)}function r(t,e){function n(){i(l,u,o)&&(r.hide(),clearTimeout(c),c=setTimeout(function(){r.show(),r.reposition(l)},300))}var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["a"],r=new a(t,e),l=null,c=null,u=!1;return r.hide().renderTo(window.document.body),t.on("remove",function(){r.remove()}),t.on("focus",function(){u=!0}),t.on("blur hide",function(){r.hide(),u=!1}),t.on("nodechange",function(e){var n={element:e.element,parents:e.parents,collapsed:t.selection.isCollapsed()};l=n.selection||n.element,i(l,u,o)?(r.show(),r.reposition(l)):r.hide()}),window.addEventListener("scroll",function(e){e.target.contains(document.querySelector("#"+t.id))&&n()},!0),t.contentDocument.addEventListener("scroll",n),r}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;nYour browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.
').css("z-index",$(".ss-loading-screen").css("z-index")+1),$(".loading-animation").remove(),void this._super();this.redraw(),$(".ss-loading-screen").hide(),$("body").removeClass("loading"),$(window).unbind("resize",positionLoadingSpinner),this.restoreTabState(),this._super()},onwindowresize:function(){this.redraw()},"from .cms-panel":{ontoggle:function(){this.redraw()}},"from .cms-container":{onaftersubmitform:function(){this.redraw()}},updateLayoutOptions:function(e){var t=this.getLayoutOptions(),n=!1;for(var r in e)t[r]!==e[r]&&(t[r]=e[r],n=!0);n&&this.redraw()},clearViewMode:function(){this.removeClass("cms-container--split-mode"),this.removeClass("cms-container--preview-mode"),this.removeClass("cms-container--content-mode")},splitViewMode:function(){this.updateLayoutOptions({mode:"split"})},contentViewMode:function(){this.updateLayoutOptions({mode:"content"})},previewMode:function(){this.updateLayoutOptions({mode:"preview"})},RedrawSuppression:!1,redraw:function(){this.getRedrawSuppression()||(window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.setProperMode()||(this.find(".cms-panel-layout").redraw(),this.find(".cms-content-fields[data-layout-type]").redraw(),this.find(".cms-edit-form[data-layout-type]").redraw(),this.find(".cms-preview").redraw(),this.find(".cms-content").redraw()))},setProperMode:function(){var e=this.getLayoutOptions(),t=e.mode;this.clearViewMode();var n=this.find(".cms-content"),r=this.find(".cms-preview");if(n.css({"min-width":0}),r.css({"min-width":0}),n.width()+r.width()>=e.minContentWidth+e.minPreviewWidth)n.css({"min-width":e.minContentWidth}),r.css({"min-width":e.minPreviewWidth}),r.trigger("enable");else if(r.trigger("disable"),"split"==t)return r.trigger("forcecontent"),!0;return this.addClass("cms-container--"+t+"-mode"),!1},checkCanNavigate:function(e){var t=this._findFragments(e||["Content"]),n=t.find(":data(changetracker)").add(t.filter(":data(changetracker)")),r=!0;return!n.length||(n.each(function(){$(this).confirmUnsavedChanges()||(r=!1)}),r)},loadPanel:function(e){var t=(arguments.length>1&&void 0!==arguments[1]&&arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),n=arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:document.URL;this.checkCanNavigate(t.pjax?t.pjax.split(","):["Content"])&&(this.saveTabState(),t.__forceReferer=r,n&&(t.__forceReload=1+Math.random()),window.ss.router.show(e,t))},reloadCurrentPanel:function(){this.loadPanel(document.URL,null,null,!0)},submitForm:function(e,t,n,r){var o=this;t||(t=this.find(".btn-toolbar :submit[name=action_save]")),t||(t=this.find(".btn-toolbar :submit:first")),e.trigger("beforesubmitform"),this.trigger("submitform",{form:e,button:t}),$(t).addClass("btn--loading loading"),$(t).is("button")&&($(t).data("original-text",$(t).text()),$(t).append($(' ')),$(t).css($(t).outerWidth()+"px"));var i=e.validate(),a=function(){$(t).removeClass("btn--loading loading"),$(t).find(".btn__loading-icon").remove(),$(t).css("width","auto"),$(t).text($(t).data("original-text"))};void 0===i||i||(statusMessage("Validation failed.","bad"),a());var s=e.serializeArray();return s.push({name:$(t).attr("name"),value:"1"}),s.push({name:"BackURL",value:document.URL.replace(/\/$/,"")}),this.saveTabState(),jQuery.ajax(jQuery.extend({headers:{"X-Pjax":"CurrentForm,Breadcrumbs"},url:e.attr("action"),data:s,type:"POST",complete:function(){a()},success:function(t,r,i){a(),e.removeClass("changed"),n&&n(t,r,i);var l=o.handleAjaxResponse(t,r,i);l&&l.filter("form").trigger("aftersubmitform",{status:r,xhr:i,formData:s})}},r)),!1},LastState:null,PauseState:!1,handleStateChange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.history.state;if(!this.getPauseState()){this.getStateChangeXHR()&&this.getStateChangeXHR().abort();var n=this,r=t.pjax||"Content",o={},i=r.split(","),a=this._findFragments(i);if(this.setStateChangeCount(this.getStateChangeCount()+1),!this.checkCanNavigate()){var s=this.getLastState();return this.setPauseState(!0),s&&s.path?window.ss.router.show(s.path):window.ss.router.back(),void this.setPauseState(!1)}if(this.setLastState(t),a.length' + 'Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.' + '
').css('z-index', $('.ss-loading-screen').css('z-index') + 1); + $('.loading-animation').remove(); + + this._super(); + return; + } + + this.redraw(); + + $('.ss-loading-screen').hide(); + $('body').removeClass('loading'); + $(window).unbind('resize', positionLoadingSpinner); + this.restoreTabState(); + this._super(); + }, + + 'onwindowresize': function onwindowresize() { + this.redraw(); + }, + + 'from .cms-panel': { + ontoggle: function ontoggle() { + this.redraw(); + } + }, + + 'from .cms-container': { + onaftersubmitform: function onaftersubmitform() { + this.redraw(); + } + }, + + updateLayoutOptions: function updateLayoutOptions(newSpec) { + var spec = this.getLayoutOptions(); + + var dirty = false; + + for (var k in newSpec) { + if (spec[k] !== newSpec[k]) { + spec[k] = newSpec[k]; + dirty = true; + } + } + + if (dirty) this.redraw(); + }, + + clearViewMode: function clearViewMode() { + this.removeClass('cms-container--split-mode'); + this.removeClass('cms-container--preview-mode'); + this.removeClass('cms-container--content-mode'); + }, + + splitViewMode: function splitViewMode() { + this.updateLayoutOptions({ + mode: 'split' + }); + }, + + contentViewMode: function contentViewMode() { + this.updateLayoutOptions({ + mode: 'content' + }); + }, + + previewMode: function previewMode() { + this.updateLayoutOptions({ + mode: 'preview' + }); + }, + + RedrawSuppression: false, + + redraw: function redraw() { + if (this.getRedrawSuppression()) return; + + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + + var changed = this.setProperMode(); + + if (!changed) { + this.find('.cms-panel-layout').redraw(); + this.find('.cms-content-fields[data-layout-type]').redraw(); + this.find('.cms-edit-form[data-layout-type]').redraw(); + this.find('.cms-preview').redraw(); + this.find('.cms-content').redraw(); + } + }, + + setProperMode: function setProperMode() { + var options = this.getLayoutOptions(); + var mode = options.mode; + this.clearViewMode(); + + var content = this.find('.cms-content'); + var preview = this.find('.cms-preview'); + + content.css({ 'min-width': 0 }); + preview.css({ 'min-width': 0 }); + + if (content.width() + preview.width() >= options.minContentWidth + options.minPreviewWidth) { + content.css({ 'min-width': options.minContentWidth }); + preview.css({ 'min-width': options.minPreviewWidth }); + preview.trigger('enable'); + } else { + preview.trigger('disable'); + if (mode == 'split') { + preview.trigger('forcecontent'); + return true; + } + } + + this.addClass('cms-container--' + mode + '-mode'); + return false; + }, + + checkCanNavigate: function checkCanNavigate(selectors) { + var contentEls = this._findFragments(selectors || ['Content']), + trackedEls = contentEls.find(':data(changetracker)').add(contentEls.filter(':data(changetracker)')), + safe = true; + + if (!trackedEls.length) { + return true; + } + + trackedEls.each(function () { + if (!$(this).confirmUnsavedChanges()) { + safe = false; + } + }); + + return safe; + }, + + loadPanel: function loadPanel(url) { + var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var forceReload = arguments[3]; + var forceReferer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : document.URL; + + if (!this.checkCanNavigate(data.pjax ? data.pjax.split(',') : ['Content'])) { + return; + } + + this.saveTabState(); + + data.__forceReferer = forceReferer; + + if (forceReload) { + data.__forceReload = 1 + Math.random(); + } + + window.ss.router.show(url, data); + }, + + reloadCurrentPanel: function reloadCurrentPanel() { + this.loadPanel(document.URL, null, null, true); + }, + + submitForm: function submitForm(form, button, callback, ajaxOptions) { + var self = this; + + if (!button) button = this.find('.btn-toolbar :submit[name=action_save]'); + + if (!button) button = this.find('.btn-toolbar :submit:first'); + + form.trigger('beforesubmitform'); + this.trigger('submitform', { form: form, button: button }); + + $(button).addClass('btn--loading loading'); + + if ($(button).is('button')) { + $(button).data('original-text', $(button).text()); + + $(button).append($(' ')); + + $(button).css($(button).outerWidth() + 'px'); + } + + var validationResult = form.validate(); + + var clearButton = function clearButton() { + $(button).removeClass('btn--loading loading'); + $(button).find('.btn__loading-icon').remove(); + $(button).css('width', 'auto'); + $(button).text($(button).data('original-text')); + }; + + if (typeof validationResult !== 'undefined' && !validationResult) { + statusMessage("Validation failed.", "bad"); + clearButton(); + } + + var formData = form.serializeArray(); + + formData.push({ name: $(button).attr('name'), value: '1' }); + + formData.push({ name: 'BackURL', value: document.URL.replace(/\/$/, '') }); + + this.saveTabState(); + + jQuery.ajax(jQuery.extend({ + headers: { "X-Pjax": "CurrentForm,Breadcrumbs" }, + url: form.attr('action'), + data: formData, + type: 'POST', + complete: function complete() { + clearButton(); + }, + success: function success(data, status, xhr) { + clearButton(); + form.removeClass('changed'); + if (callback) callback(data, status, xhr); + + var newContentEls = self.handleAjaxResponse(data, status, xhr); + if (!newContentEls) return; + + newContentEls.filter('form').trigger('aftersubmitform', { status: status, xhr: xhr, formData: formData }); + } + }, ajaxOptions)); + + return false; + }, + + LastState: null, + + PauseState: false, + + handleStateChange: function handleStateChange(event) { + var historyState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.history.state; + + if (this.getPauseState()) { + return; + } + + if (this.getStateChangeXHR()) { + this.getStateChangeXHR().abort(); + } + + var self = this, + fragments = historyState.pjax || 'Content', + headers = {}, + fragmentsArr = fragments.split(','), + contentEls = this._findFragments(fragmentsArr); + + this.setStateChangeCount(this.getStateChangeCount() + 1); + + if (!this.checkCanNavigate()) { + var lastState = this.getLastState(); + + this.setPauseState(true); + + if (lastState && lastState.path) { + window.ss.router.show(lastState.path); + } else { + window.ss.router.back(); + } + + this.setPauseState(false); + + return; + } + + this.setLastState(historyState); + + if (contentEls.length < fragmentsArr.length) { + fragments = 'Content', fragmentsArr = ['Content']; + contentEls = this._findFragments(fragmentsArr); + } + + this.trigger('beforestatechange', { state: historyState, element: contentEls }); + + headers['X-Pjax'] = fragments; + + if (typeof historyState.__forceReferer !== 'undefined') { + var url = historyState.__forceReferer; + + try { + url = decodeURI(url); + } catch (e) {} finally { + headers['X-Backurl'] = encodeURI(url); + } + } + + contentEls.addClass('loading'); + + var promise = $.ajax({ + headers: headers, + url: historyState.path || document.URL + }).done(function (data, status, xhr) { + var els = self.handleAjaxResponse(data, status, xhr, historyState); + self.trigger('afterstatechange', { data: data, status: status, xhr: xhr, element: els, state: historyState }); + }).always(function () { + self.setStateChangeXHR(null); + + contentEls.removeClass('loading'); + }); + + this.setStateChangeXHR(promise); + + return promise; + }, + + loadFragment: function loadFragment(url, pjaxFragments) { + + var self = this, + xhr, + headers = {}, + baseUrl = $('base').attr('href'), + fragmentXHR = this.getFragmentXHR(); + + if (typeof fragmentXHR[pjaxFragments] !== 'undefined' && fragmentXHR[pjaxFragments] !== null) { + fragmentXHR[pjaxFragments].abort(); + fragmentXHR[pjaxFragments] = null; + } + + url = $.path.isAbsoluteUrl(url) ? url : $.path.makeUrlAbsolute(url, baseUrl); + headers['X-Pjax'] = pjaxFragments; + + xhr = $.ajax({ + headers: headers, + url: url, + success: function success(data, status, xhr) { + var elements = self.handleAjaxResponse(data, status, xhr, null); + + self.trigger('afterloadfragment', { data: data, status: status, xhr: xhr, elements: elements }); + }, + error: function error(xhr, status, _error) { + self.trigger('loadfragmenterror', { xhr: xhr, status: status, error: _error }); + }, + complete: function complete() { + var fragmentXHR = self.getFragmentXHR(); + if (typeof fragmentXHR[pjaxFragments] !== 'undefined' && fragmentXHR[pjaxFragments] !== null) { + fragmentXHR[pjaxFragments] = null; + } + } + }); + + fragmentXHR[pjaxFragments] = xhr; + + return xhr; + }, + + handleAjaxResponse: function handleAjaxResponse(data, status, xhr, state) { + var self = this, + url, + selectedTabs, + guessFragment, + fragment, + $data; + + if (xhr.getResponseHeader('X-Reload') && xhr.getResponseHeader('X-ControllerURL')) { + var baseUrl = $('base').attr('href'), + rawURL = xhr.getResponseHeader('X-ControllerURL'), + url = $.path.isAbsoluteUrl(rawURL) ? rawURL : $.path.makeUrlAbsolute(rawURL, baseUrl); + + document.location.href = url; + return; + } + + if (!data) return; + + var title = xhr.getResponseHeader('X-Title'); + if (title) document.title = decodeURIComponent(title.replace(/\+/g, ' ')); + + var newFragments = {}, + newContentEls; + + if (xhr.getResponseHeader('Content-Type').match(/^((text)|(application))\/json[ \t]*;?/i)) { + newFragments = data; + } else { + fragment = document.createDocumentFragment(); + + jQuery.clean([data], document, fragment, []); + $data = $(jQuery.merge([], fragment.childNodes)); + + guessFragment = 'Content'; + if ($data.is('form') && !$data.is('[data-pjax-fragment~=Content]')) guessFragment = 'CurrentForm'; + + newFragments[guessFragment] = $data; + } + + this.setRedrawSuppression(true); + try { + $.each(newFragments, function (newFragment, html) { + var contentEl = $('[data-pjax-fragment]').filter(function () { + return $.inArray(newFragment, $(this).data('pjaxFragment').split(' ')) != -1; + }), + newContentEl = $(html); + + if (newContentEls) newContentEls.add(newContentEl);else newContentEls = newContentEl; + + if (newContentEl.find('.cms-container').length) { + throw 'Content loaded via ajax is not allowed to contain tags matching the ".cms-container" selector to avoid infinite loops'; + } + + var origStyle = contentEl.attr('style'); + var origParent = contentEl.parent(); + var layoutClasses = ['east', 'west', 'center', 'north', 'south', 'column-hidden']; + var elemClasses = contentEl.attr('class'); + var origLayoutClasses = []; + if (elemClasses) { + origLayoutClasses = $.grep(elemClasses.split(' '), function (val) { + return $.inArray(val, layoutClasses) >= 0; + }); + } + + newContentEl.removeClass(layoutClasses.join(' ')).addClass(origLayoutClasses.join(' ')); + if (origStyle) newContentEl.attr('style', origStyle); + + var styles = newContentEl.find('style').detach(); + if (styles.length) $(document).find('head').append(styles); + + contentEl.replaceWith(newContentEl); + }); + + var newForm = newContentEls.filter('form'); + if (newForm.hasClass('cms-tabset')) newForm.removeClass('cms-tabset').addClass('cms-tabset'); + } finally { + this.setRedrawSuppression(false); + } + + this.redraw(); + this.restoreTabState(state && typeof state.tabState !== 'undefined' ? state.tabState : null); + + return newContentEls; + }, + + _findFragments: function _findFragments(fragments) { + return $('[data-pjax-fragment]').filter(function () { + var i, + nodeFragments = $(this).data('pjaxFragment').split(' '); + for (i in fragments) { + if ($.inArray(fragments[i], nodeFragments) != -1) return true; + } + return false; + }); + }, + + refresh: function refresh() { + $(window).trigger('statechange'); + + $(this).redraw(); + }, + + saveTabState: function saveTabState() { + if (typeof window.sessionStorage == "undefined" || window.sessionStorage === null) return; + + var selectedTabs = [], + url = this._tabStateUrl(); + this.find('.cms-tabset,.ss-tabset').each(function (i, el) { + var id = $(el).attr('id'); + if (!id) return; + if (!$(el).data('tabs')) return; + if ($(el).data('ignoreTabState') || $(el).getIgnoreTabState()) return; + + selectedTabs.push({ id: id, selected: $(el).tabs('option', 'selected') }); + }); + + if (selectedTabs) { + var tabsUrl = 'tabs-' + url; + try { + window.sessionStorage.setItem(tabsUrl, JSON.stringify(selectedTabs)); + } catch (err) { + if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) { + return; + } else { + throw err; + } + } + } + }, + + restoreTabState: function restoreTabState(overrideStates) { + var self = this, + url = this._tabStateUrl(), + hasSessionStorage = typeof window.sessionStorage !== "undefined" && window.sessionStorage, + sessionData = hasSessionStorage ? window.sessionStorage.getItem('tabs-' + url) : null, + sessionStates = sessionData ? JSON.parse(sessionData) : false; + + this.find('.cms-tabset, .ss-tabset').each(function () { + var index, + tab, + tabset = $(this), + tabsetId = tabset.attr('id'), + forcedTab = tabset.children('ul').children('li.ss-tabs-force-active'); + + if (!tabset.data('tabs')) { + return; + } + + tabset.tabs('refresh'); + + if (forcedTab.length) { + index = forcedTab.first().index(); + } else if (overrideStates && overrideStates[tabsetId]) { + tab = tabset.find(overrideStates[tabsetId].tabSelector); + if (tab.length) { + index = tab.index(); + } + } else if (sessionStates) { + $.each(sessionStates, function (i, state) { + if (tabsetId == state.id) { + index = state.selected; + } + }); + } + if (index !== null) { + tabset.tabs('option', 'active', index); + self.trigger('tabstaterestored'); + } + }); + }, + + clearTabState: function clearTabState(url) { + if (typeof window.sessionStorage == "undefined") return; + + var s = window.sessionStorage; + if (url) { + s.removeItem('tabs-' + url); + } else { + for (var i = 0; i < s.length; i++) { + if (s.key(i).match(/^tabs-/)) s.removeItem(s.key(i)); + } + } + }, + + clearCurrentTabState: function clearCurrentTabState() { + this.clearTabState(this._tabStateUrl()); + }, + + _tabStateUrl: function _tabStateUrl() { + return window.location.href.replace(/\?.*/, '').replace(/#.*/, '').replace($('base').attr('href'), ''); + }, + + showLoginDialog: function showLoginDialog() { + var dialog = $('.leftandmain__login-dialog'); + if (dialog.length) { + dialog.destroy(); + } + + dialog = $(''); + $('body').append(dialog); + dialog.open(); + } + }); + + $('.leftandmain__login-dialog').entwine({ + destroy: function destroy() { + this.close(); + this.remove(); + }, + close: function close() { + this.renderModal(false); + }, + open: function open() { + this.renderModal(true); + }, + renderModal: function renderModal(show) { + var tempid = $('body').data('member-tempid'); + var url = $.path.addSearchParams('CMSSecurity/login', { + tempid: tempid, + BackURL: window.location.href + }); + + _reactDom2.default.render(_react2.default.createElement(_IframeDialog2.default, { + title: i18n._t('Admin.CMS_LOGIN_TITLE', 'Login'), + className: 'login-dialog', + bodyClassName: 'login-dialog__body', + iframeId: 'login-dialog-iframe', + iframeClassName: 'login-dialog__body__iframe', + show: show, + url: url + }), this[0]); + }, + reauthenticate: function reauthenticate(data) { + if (typeof data.SecurityID !== 'undefined') { + $(':input[name=SecurityID]').val(data.SecurityID); + } + + if (typeof data.TempID !== 'undefined') { + $('body').data('member-tempid', data.TempID); + } + this.close(); + } + }); + + $('form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading').entwine({ + onmatch: function onmatch() { + this.append(''); + this._super(); + }, + onunmatch: function onunmatch() { + this.find('.cms-content-loading-overlay,.cms-content-loading-spinner').remove(); + this._super(); + } + }); + + $('.cms .cms-panel-link').entwine({ + onclick: function onclick(e) { + if ($(this).hasClass('external-link')) { + e.stopPropagation(); + + return; + } + + var href = this.attr('href'), + url = href && !href.match(/^#/) ? href : this.data('href'), + data = { pjax: this.data('pjaxTarget') }; + + $('.cms-container').loadPanel(url, null, data); + e.preventDefault(); + } + }); + + $('.cms .ss-ui-button-ajax').entwine({ + onclick: function onclick(e) { + $(this).removeClass('ui-button-text-only'); + $(this).addClass('ss-ui-button-loading ui-button-text-icons'); + + var loading = $(this).find(".ss-ui-loading-icon"); + + if (loading.length < 1) { + loading = $("").addClass('ss-ui-loading-icon ui-button-icon-primary ui-icon'); + + $(this).prepend(loading); + } + + loading.show(); + + var href = this.attr('href'), + url = href ? href : this.data('href'); + + jQuery.ajax({ + url: url, + + complete: function complete(xmlhttp, status) { + var msg = xmlhttp.getResponseHeader('X-Status') ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.responseText; + + try { + if (typeof msg != "undefined" && msg !== null) eval(msg); + } catch (e) {} + + loading.hide(); + + $(".cms-container").refresh(); + + $(this).removeClass('ss-ui-button-loading ui-button-text-icons'); + $(this).addClass('ui-button-text-only'); + }, + dataType: 'html' + }); + e.preventDefault(); + } + }); + + $('.cms .ss-ui-dialog-link').entwine({ + UUID: null, + onmatch: function onmatch() { + this._super(); + this.setUUID(new Date().getTime()); + }, + onunmatch: function onunmatch() { + this._super(); + }, + onclick: function onclick() { + this._super(); + + var self = this, + id = 'ss-ui-dialog-' + this.getUUID(); + var dialog = $('#' + id); + if (!dialog.length) { + dialog = $(''); + $('body').append(dialog); + } + + var extraClass = this.data('popupclass') ? this.data('popupclass') : ''; + + dialog.ssdialog({ iframeUrl: this.attr('href'), autoOpen: true, dialogExtraClass: extraClass }); + return false; + } + }); + + $('.cms .field.date input.text').entwine({ + onmatch: function onmatch() { + var holder = $(this).parents('.field.date:first'), + config = holder.data(); + if (!config.showcalendar) { + this._super(); + return; + } + + config.showOn = 'button'; + if (config.locale && $.datepicker.regional[config.locale]) { + config = $.extend(config, $.datepicker.regional[config.locale], {}); + } + + if (!this.prop('disabled') && !this.prop('readonly')) { + $(this).datepicker(config); + } + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + + $('.cms .field.dropdown select, .cms .field select[multiple], .form__fieldgroup-item select.dropdown').entwine({ + onmatch: function onmatch() { + if (this.is('.no-chosen')) { + this._super(); + return; + } + + if (!this.data('placeholder')) this.data('placeholder', ' '); + + this.removeClass('has-chosen').chosen("destroy"); + this.siblings('.chosen-container').remove(); + + applyChosen(this); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + + $(".cms-panel-layout").entwine({ + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + } + }); + + $('.cms .grid-field').entwine({ + showDetailView: function showDetailView(url) { + var params = window.location.search.replace(/^\?/, ''); + if (params) url = $.path.addSearchParams(url, params); + $('.cms-container').loadPanel(url); + } + }); + + $('.cms-search-form').entwine({ + onsubmit: function onsubmit(e) { + var nonEmptyInputs, url; + + nonEmptyInputs = this.find(':input:not(:submit)').filter(function () { + var vals = $.grep($(this).fieldValue(), function (val) { + return val; + }); + return vals.length; + }); + + url = this.attr('action'); + + if (nonEmptyInputs.length) { + url = $.path.addSearchParams(url, nonEmptyInputs.serialize().replace('+', '%20')); + } + + var container = this.closest('.cms-container'); + container.find('.cms-edit-form').tabs('select', 0); + container.loadPanel(url, "", {}, true); + + return false; + } + }); + + $(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({ + onclick: function onclick(e) { + e.preventDefault(); + + var form = $(this).parents('form'); + + form.clearForm(); + form.find(".dropdown select").prop('selectedIndex', 0).trigger("chosen:updated"); + form.submit(); + } + }); + + window._panelDeferredCache = {}; + $('.cms-panel-deferred').entwine({ + onadd: function onadd() { + this._super(); + this.redraw(); + }, + onremove: function onremove() { + if (window.debug) console.log('saving', this.data('url'), this); + + if (!this.data('deferredNoCache')) window._panelDeferredCache[this.data('url')] = this.html(); + this._super(); + }, + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + + var self = this, + url = this.data('url'); + if (!url) throw 'Elements of class .cms-panel-deferred need a "data-url" attribute'; + + this._super(); + + if (!this.children().length) { + if (!this.data('deferredNoCache') && typeof window._panelDeferredCache[url] !== 'undefined') { + this.html(window._panelDeferredCache[url]); + } else { + this.addClass('loading'); + $.ajax({ + url: url, + complete: function complete() { + self.removeClass('loading'); + }, + success: function success(data, status, xhr) { + self.html(data); + } + }); + } + } + } + }); + + $('.cms-tabset').entwine({ + onadd: function onadd() { + this.redrawTabs(); + this._super(); + }, + onremove: function onremove() { + if (this.data('tabs')) this.tabs('destroy'); + this._super(); + }, + redrawTabs: function redrawTabs() { + this.rewriteHashlinks(); + + var id = this.attr('id'), + activeTab = this.find('ul:first .ui-tabs-active'); + + if (!this.data('tabs')) this.tabs({ + active: activeTab.index() != -1 ? activeTab.index() : 0, + beforeLoad: function beforeLoad(e, ui) { + return false; + }, + beforeActivate: function beforeActivate(e, ui) { + var link = ui.oldTab.find('.cms-panel-link'); + + if (link && link.length === 1) { + return false; + } + }, + activate: function activate(e, ui) { + var actions = $(this).closest('form').find('.btn-toolbar'); + if ($(ui.newTab).closest('li').hasClass('readonly')) { + actions.fadeOut(); + } else { + actions.show(); + } + } + }); + this.trigger('afterredrawtabs'); + }, + + rewriteHashlinks: function rewriteHashlinks() { + $(this).find('ul a').each(function () { + if (!$(this).attr('href')) return; + var matches = $(this).attr('href').match(/#.*/); + if (!matches) return; + $(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]); + }); + } + }); + + $('#filters-button').entwine({ + onmatch: function onmatch() { + this._super(); + + this.data('collapsed', true); + this.data('animating', false); + }, + onunmatch: function onunmatch() { + this._super(); + }, + showHide: function showHide() { + var self = this, + $filters = $('.cms-content-filters').first(), + collapsed = this.data('collapsed'); + + if (collapsed) { + this.addClass('active'); + $filters.css('display', 'block'); + } else { + this.removeClass('active'); + $filters.css('display', ''); + } + self.data('collapsed', !collapsed); + }, + onclick: function onclick() { + this.showHide(); + } + }); +}); + +var statusMessage = function statusMessage(text, type) { + text = jQuery('').text(text).html(); + jQuery.noticeAdd({ text: text, type: type, stayTime: 5000, inEffect: { left: '0', opacity: 'show' } }); +}; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(27))) + +/***/ }), + +/***/ 251: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _moment = __webpack_require__(181); + +var _moment2 = _interopRequireDefault(_moment); + +var _modernizr = __webpack_require__(180); + +var _modernizr2 = _interopRequireDefault(_modernizr); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(125); + +_jQuery2.default.entwine('ss', function (jQuery) { + jQuery('input[type=date]').entwine({ + onadd: function onadd() { + if (_modernizr2.default.inputtypes.date) { + return; + } + + if (this.prop('disabled') || this.prop('readonly') || this.hasClass('hasDatepicker')) { + return; + } + + var hiddenInput = jQuery('', { type: 'hidden', name: this.attr('name'), value: this.val() }); + this.parent().append(hiddenInput); + + this.removeAttr('name'); + + _moment2.default.locale(this.attr('lang')); + var isoDate = this.val(); + var localDate = ''; + if (isoDate) { + var dateObject = (0, _moment2.default)(isoDate); + if (dateObject.isValid()) { + localDate = dateObject.format('L'); + } + } + this.val(localDate); + + var placeholder = _i18n2.default.inject(_i18n2.default._t('Admin.FormatExample', 'Example: {format}'), { format: (0, _moment2.default)().endOf('month').format('L') }); + this.attr('placeholder', placeholder); + + this.updateValue(); + }, + onchange: function onchange() { + this.updateValue(); + }, + updateValue: function updateValue() { + var localDate = this.val(); + var isoDate = ''; + if (localDate) { + var _arr = ['L', 'YYYY-MM-DD']; + + for (var _i = 0; _i < _arr.length; _i++) { + var format = _arr[_i]; + var dateObject = (0, _moment2.default)(localDate, format); + if (dateObject.isValid()) { + isoDate = dateObject.format('YYYY-MM-DD'); + break; + } + } + } + this.parent().find('input[type=hidden]').val(isoDate); + } + }); +}); + +/***/ }), + +/***/ 255: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DateField = undefined; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _FieldHolder = __webpack_require__(44); + +var _FieldHolder2 = _interopRequireDefault(_FieldHolder); + +var _TextField2 = __webpack_require__(402); + +var _moment = __webpack_require__(181); + +var _moment2 = _interopRequireDefault(_moment); + +var _modernizr = __webpack_require__(180); + +var _modernizr2 = _interopRequireDefault(_modernizr); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var localFormat = 'L'; + +var DateField = function (_TextField) { + _inherits(DateField, _TextField); + + function DateField() { + _classCallCheck(this, DateField); + + return _possibleConstructorReturn(this, (DateField.__proto__ || Object.getPrototypeOf(DateField)).apply(this, arguments)); + } + + _createClass(DateField, [{ + key: 'render', + value: function render() { + return _get(DateField.prototype.__proto__ || Object.getPrototypeOf(DateField.prototype), 'render', this).call(this); + } + }, { + key: 'hasNativeSupport', + value: function hasNativeSupport() { + return _modernizr2.default.inputtypes.date; + } + }, { + key: 'getInputProps', + value: function getInputProps() { + var placeholder = _i18n2.default.inject(_i18n2.default._t('Admin.FormatExample', 'Example: {format}'), { format: (0, _moment2.default)().endOf('month').format(localFormat) }); + var props = {}; + + var val = this.props.value; + + if (!this.props.data.html5 || this.hasNativeSupport() && this.props.data.html5) { + val = this.props.value; + } else { + val = this.getLocalisedValue(); + } + + Object.assign(props, _get(DateField.prototype.__proto__ || Object.getPrototypeOf(DateField.prototype), 'getInputProps', this).call(this), { + type: this.props.data.html5 ? 'date' : 'text', + + defaultValue: val, + placeholder: placeholder + }); + + delete props.value; + + return props; + } + }, { + key: 'getLocalisedValue', + value: function getLocalisedValue() { + return this.convertToLocalised(this.props.value); + } + }, { + key: 'isMultiline', + value: function isMultiline() { + return false; + } + }, { + key: 'handleChange', + value: function handleChange(event) { + var enteredValue = event.target.value; + var isoValue = ''; + + if (!this.props.data.html5 || this.hasNativeSupport() && this.props.data.html5) { + isoValue = enteredValue; + } else { + isoValue = this.convertToIso(enteredValue); + } + + if (typeof this.props.onChange === 'function') { + this.triggerChange(isoValue); + } + } + }, { + key: 'triggerChange', + value: function triggerChange(value) { + this.props.onChange(value); + } + }, { + key: 'convertToIso', + value: function convertToIso(localDate) { + _moment2.default.locale(this.props.lang); + var isoDate = ''; + + if (localDate) { + var dateObject = (0, _moment2.default)(localDate, [localFormat, 'YYYY-MM-DD']); + if (dateObject.isValid()) { + isoDate = dateObject.format('YYYY-MM-DD'); + } + } + + return isoDate; + } + }, { + key: 'convertToLocalised', + value: function convertToLocalised(isoDate) { + _moment2.default.locale(this.props.lang); + var localDate = ''; + if (isoDate) { + var dateObject = (0, _moment2.default)(isoDate); + if (dateObject.isValid()) { + localDate = dateObject.format(localFormat); + } + } + return localDate; + } + }]); + + return DateField; +}(_TextField2.TextField); + +DateField.propTypes = { + lang: _react2.default.PropTypes.string, + data: _react2.default.PropTypes.shape({ + html5: _react2.default.PropTypes.boolean + }) +}; + +DateField.defaultProps = { + data: {} +}; + +exports.DateField = DateField; +exports.default = (0, _FieldHolder2.default)(DateField); + +/***/ }), + +/***/ 256: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _SilverStripeComponent = __webpack_require__(13); + +var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var GridFieldRow = function (_SilverStripeComponen) { + _inherits(GridFieldRow, _SilverStripeComponen); + + function GridFieldRow() { + _classCallCheck(this, GridFieldRow); + + return _possibleConstructorReturn(this, (GridFieldRow.__proto__ || Object.getPrototypeOf(GridFieldRow)).apply(this, arguments)); + } + + _createClass(GridFieldRow, [{ + key: 'render', + value: function render() { + var className = 'grid-field__row ' + this.props.className; + return _react2.default.createElement( + 'tr', + { tabIndex: '0', className: className }, + this.props.children + ); + } + }]); + + return GridFieldRow; +}(_SilverStripeComponent2.default); + +exports.default = GridFieldRow; + +/***/ }), + +/***/ 257: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _SilverStripeComponent = __webpack_require__(13); + +var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); + +var _castStringToElement = __webpack_require__(86); + +var _castStringToElement2 = _interopRequireDefault(_castStringToElement); + +var _reactBootstrapSs = __webpack_require__(38); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var OptionField = function (_SilverStripeComponen) { + _inherits(OptionField, _SilverStripeComponen); + + function OptionField(props) { + _classCallCheck(this, OptionField); + + var _this = _possibleConstructorReturn(this, (OptionField.__proto__ || Object.getPrototypeOf(OptionField)).call(this, props)); + + _this.handleChange = _this.handleChange.bind(_this); + return _this; + } + + _createClass(OptionField, [{ + key: 'handleChange', + value: function handleChange(event) { + if (typeof this.props.onChange === 'function') { + this.props.onChange(event, { + id: this.props.id, + value: event.target.checked ? 1 : 0 + }); + } else if (typeof this.props.onClick === 'function') { + this.props.onClick(event, { + id: this.props.id, + value: event.target.checked ? 1 : 0 + }); + } + } + }, { + key: 'getInputProps', + value: function getInputProps() { + var classNames = [this.props.className, this.props.extraClass]; + + if (!!this.props.value) { + classNames.push('checked'); + } + + return { + id: this.props.id, + name: this.props.name, + disabled: this.props.disabled, + readOnly: this.props.readOnly, + className: classNames.join(' '), + onChange: this.handleChange, + checked: !!this.props.value, + value: 1 + }; + } + }, { + key: 'render', + value: function render() { + var labelText = this.props.leftTitle !== null ? this.props.leftTitle : this.props.title; + + var Option = null; + + switch (this.props.type) { + case 'checkbox': + Option = _reactBootstrapSs.Checkbox; + break; + case 'radio': + Option = _reactBootstrapSs.Radio; + break; + default: + throw new Error('Invalid OptionField type: ' + this.props.type); + } + + var label = typeof labelText === 'string' ? { react: _react2.default.createElement( + 'span', + null, + labelText + ) } : labelText; + + return (0, _castStringToElement2.default)(Option, label, this.getInputProps()); + } + }]); + + return OptionField; +}(_SilverStripeComponent2.default); + +OptionField.propTypes = { + type: _react2.default.PropTypes.oneOf(['checkbox', 'radio']), + leftTitle: _react2.default.PropTypes.any, + title: _react2.default.PropTypes.any, + extraClass: _react2.default.PropTypes.string, + id: _react2.default.PropTypes.string, + name: _react2.default.PropTypes.string.isRequired, + onChange: _react2.default.PropTypes.func, + value: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number, _react2.default.PropTypes.bool]), + readOnly: _react2.default.PropTypes.bool, + disabled: _react2.default.PropTypes.bool +}; + +OptionField.defaultProps = { + extraClass: '', + className: '', + type: 'radio', + leftTitle: null +}; + +exports.default = OptionField; + +/***/ }), + +/***/ 258: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _buildInjectorContainer = __webpack_require__(959); + +var _buildInjectorContainer2 = _interopRequireDefault(_buildInjectorContainer); + +var _buildComponentContainer = __webpack_require__(957); + +var _buildComponentContainer2 = _interopRequireDefault(_buildComponentContainer); + +var _buildReducerContainer = __webpack_require__(960); + +var _buildReducerContainer2 = _interopRequireDefault(_buildReducerContainer); + +var _buildFormContainer = __webpack_require__(958); + +var _buildFormContainer2 = _interopRequireDefault(_buildFormContainer); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var Injector = (0, _buildInjectorContainer2.default)(); + +Injector.register('component', (0, _buildComponentContainer2.default)()); +Injector.register('reducer', (0, _buildReducerContainer2.default)()); +Injector.register('form', (0, _buildFormContainer2.default)()); + +exports.default = Injector; + +/***/ }), + +/***/ 259: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _MiddlewareRegistry = __webpack_require__(404); + +var _MiddlewareRegistry2 = _interopRequireDefault(_MiddlewareRegistry); + +var _redux = __webpack_require__(41); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); } + +var buildBaseContainer = function buildBaseContainer() { + return { + middlewareRegistries: {}, + + services: {}, + + factories: {}, + + factoryCache: {}, + + initialised: false, + + isProtected: function isProtected() { + if (this.initialised) { + throw new Error('Cannot mutate DI container after it has been initialised'); + } + }, + get: function get(key, context) { + if (!this.initialised) { + throw new Error('\n Injector.get(): Attempted to access DI layer before it was initialised.\n Did you forget to invoke Injector.load()?'); + } + var factory = this.factories[key]; + if (!factory) { + throw new Error('Injector.get(): Component ' + key + ' does not exist'); + } + + return factory(context); + }, + customise: function customise(meta, key, factory) { + this.isProtected(); + + var _key$split = key.split('.'), + _key$split2 = _toArray(_key$split), + serviceName = _key$split2[0], + context = _key$split2.slice(1); + + var registry = this.middlewareRegistries[serviceName]; + if (!registry) { + registry = new _MiddlewareRegistry2.default(); + this.middlewareRegistries = _extends({}, this.middlewareRegistries, _defineProperty({}, serviceName, registry)); + } + registry.add(meta, factory, context); + }, + load: function load() { + var _this = this; + + this.isProtected(); + this.factories = Object.entries(this.services).reduce(function (factories, _ref) { + var _ref2 = _slicedToArray(_ref, 2), + key = _ref2[0], + service = _ref2[1]; + + var middleware = _this.middlewareRegistries[key]; + if (middleware) { + middleware.sort(); + + return _extends({}, factories, _defineProperty({}, key, function () { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _MiddlewareRegistry.GLOBAL_CONTEXT; + + var cacheKey = key + '__' + context; + if (!_this.factoryCache[cacheKey]) { + var matches = middleware.getMatchesForContext(context); + _this.factoryCache[cacheKey] = _this.getFactory(key, matches); + } + + return _this.factoryCache[cacheKey]; + })); + } + return _extends({}, factories, _defineProperty({}, key, function () { + return service; + })); + }, {}); + + this.initialised = true; + }, + register: function register(key, value) { + var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + force = _ref3.force; + + this.isProtected(); + + if (this.services[key] && force !== true) { + throw new Error('\n Tried to register service ' + key + ' more than once. This practice is discouraged. Consider\n using Injector.update() to enhance the service rather than override it completely.\n Otherwise, invoke the register() function with { force: true } as the third argument.\n '); + } + this.services = _extends({}, this.services, _defineProperty({}, key, value)); + }, + registerMany: function registerMany(map) { + var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + force = _ref4.force; + + this.isProtected(); + + var mapKeys = Object.keys(map); + var existing = Object.keys(this.services).filter(function (service) { + return mapKeys.includes(service); + }); + if (existing.length && force !== true) { + var list = existing.join(', '); + + throw new Error('\n Tried to register services (' + list + ') more than once. This practice is discouraged. Consider\n using Injector.update() to enhance the service rather than override it completely.\n Otherwise, invoke the register() function with { force: true } as the third argument.\n '); + } + this.services = _extends({}, this.services, map); + }, + transform: function transform(name, callback) { + var priorities = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + this.isProtected(); + + callback(this.createTransformer(name, priorities)); + }, + createTransformer: function createTransformer(name, priorities) { + var _this2 = this; + + return function (key, wrapper) { + _this2.customise(_extends({ name: name }, priorities), key, wrapper); + }; + }, + getFactory: function getFactory(key, middlewareMatches) { + var service = this.services[key]; + var middlewares = middlewareMatches.map(function (m) { + return m.factory; + }); + return _redux.compose.apply(undefined, _toConsumableArray(middlewares))(service); + } + }; +}; + +exports.default = buildBaseContainer; + +/***/ }), + +/***/ 38: +/***/ (function(module, exports) { + +module.exports = ReactBootstrap; + +/***/ }), + +/***/ 391: +/***/ (function(module, exports) { + +module.exports = FormAlert; + +/***/ }), + +/***/ 392: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(jQuery) { + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(154); + +_jQuery2.default.widget("ssui.ssdialog", _jQuery2.default.ui.dialog, { + options: { + iframeUrl: '', + reloadOnOpen: true, + dialogExtraClass: '', + + modal: true, + bgiframe: true, + autoOpen: false, + autoPosition: true, + minWidth: 500, + maxWidth: 800, + minHeight: 300, + maxHeight: 700, + widthRatio: 0.8, + heightRatio: 0.8, + resizable: false + }, + _create: function _create() { + _jQuery2.default.ui.dialog.prototype._create.call(this); + + var self = this; + + var iframe = (0, _jQuery2.default)(''); + iframe.bind('load', function (e) { + if ((0, _jQuery2.default)(this).attr('src') == 'about:blank') return; + + iframe.addClass('loaded').show(); + self._resizeIframe(); + self.uiDialog.removeClass('loading'); + }).hide(); + + if (this.options.dialogExtraClass) this.uiDialog.addClass(this.options.dialogExtraClass); + this.element.append(iframe); + + if (this.options.iframeUrl) this.element.css('overflow', 'hidden'); + }, + open: function open() { + _jQuery2.default.ui.dialog.prototype.open.call(this); + + var self = this, + iframe = this.element.children('iframe'); + + if (this.options.iframeUrl && (!iframe.hasClass('loaded') || this.options.reloadOnOpen)) { + iframe.hide(); + iframe.attr('src', this.options.iframeUrl); + this.uiDialog.addClass('loading'); + } + + (0, _jQuery2.default)(window).bind('resize.ssdialog', function () { + self._resizeIframe(); + }); + }, + close: function close() { + _jQuery2.default.ui.dialog.prototype.close.call(this); + + this.uiDialog.unbind('resize.ssdialog'); + (0, _jQuery2.default)(window).unbind('resize.ssdialog'); + }, + _resizeIframe: function _resizeIframe() { + var opts = {}, + newWidth, + newHeight, + iframe = this.element.children('iframe');; + if (this.options.widthRatio) { + newWidth = (0, _jQuery2.default)(window).width() * this.options.widthRatio; + if (this.options.minWidth && newWidth < this.options.minWidth) { + opts.width = this.options.minWidth; + } else if (this.options.maxWidth && newWidth > this.options.maxWidth) { + opts.width = this.options.maxWidth; + } else { + opts.width = newWidth; + } + } + if (this.options.heightRatio) { + newHeight = (0, _jQuery2.default)(window).height() * this.options.heightRatio; + if (this.options.minHeight && newHeight < this.options.minHeight) { + opts.height = this.options.minHeight; + } else if (this.options.maxHeight && newHeight > this.options.maxHeight) { + opts.height = this.options.maxHeight; + } else { + opts.height = newHeight; + } + } + + if (!jQuery.isEmptyObject(opts)) { + this._setOptions(opts); + + iframe.attr('width', opts.width - parseFloat(this.element.css('paddingLeft')) - parseFloat(this.element.css('paddingRight'))); + iframe.attr('height', opts.height - parseFloat(this.element.css('paddingTop')) - parseFloat(this.element.css('paddingBottom'))); + + if (this.options.autoPosition) { + this._setOption("position", this.options.position); + } + } + } +}); + +_jQuery2.default.widget("ssui.titlebar", { + _create: function _create() { + this.originalTitle = this.element.attr('title'); + + var self = this; + var options = this.options; + + var title = options.title || this.originalTitle || ' '; + var titleId = _jQuery2.default.ui.dialog.getTitleId(this.element); + + this.element.parent().addClass('ui-dialog'); + + var uiDialogTitlebar = this.element.addClass('ui-dialog-titlebar ' + 'ui-widget-header ' + 'ui-corner-all ' + 'ui-helper-clearfix'); + + if (options.closeButton) { + var uiDialogTitlebarClose = (0, _jQuery2.default)('').addClass('ui-dialog-titlebar-close ' + 'ui-corner-all').attr('role', 'button').hover(function () { + uiDialogTitlebarClose.addClass('ui-state-hover'); + }, function () { + uiDialogTitlebarClose.removeClass('ui-state-hover'); + }).focus(function () { + uiDialogTitlebarClose.addClass('ui-state-focus'); + }).blur(function () { + uiDialogTitlebarClose.removeClass('ui-state-focus'); + }).mousedown(function (ev) { + ev.stopPropagation(); + }).appendTo(uiDialogTitlebar); + + var uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = (0, _jQuery2.default)('')).addClass('ui-icon ' + 'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose); + } + + var uiDialogTitle = (0, _jQuery2.default)('').addClass('ui-dialog-title').attr('id', titleId).html(title).prependTo(uiDialogTitlebar); + + uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); + }, + + destroy: function destroy() { + this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body'); + + this.originalTitle && this.element.attr('title', this.originalTitle); + } +}); + +_jQuery2.default.extend(_jQuery2.default.ssui.titlebar, { + version: "0.0.1", + options: { + title: '', + closeButton: false, + closeText: 'close' + }, + + uuid: 0, + + getTitleId: function getTitleId($el) { + return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid); + } +}); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(27))) + +/***/ }), + +/***/ 401: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _SilverStripeComponent = __webpack_require__(13); + +var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); + +var _castStringToElement = __webpack_require__(86); + +var _castStringToElement2 = _interopRequireDefault(_castStringToElement); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var CompositeField = function (_SilverStripeComponen) { + _inherits(CompositeField, _SilverStripeComponen); + + function CompositeField() { + _classCallCheck(this, CompositeField); + + return _possibleConstructorReturn(this, (CompositeField.__proto__ || Object.getPrototypeOf(CompositeField)).apply(this, arguments)); + } + + _createClass(CompositeField, [{ + key: 'getLegend', + value: function getLegend() { + if (this.props.data.tag === 'fieldset' && this.props.data.legend) { + return (0, _castStringToElement2.default)('legend', this.props.data.legend); + } + return null; + } + }, { + key: 'getClassName', + value: function getClassName() { + return this.props.className + ' ' + this.props.extraClass; + } + }, { + key: 'render', + value: function render() { + var legend = this.getLegend(); + var Tag = this.props.data.tag || 'div'; + var className = this.getClassName(); + + return _react2.default.createElement( + Tag, + { className: className }, + legend, + this.props.children + ); + } + }]); + + return CompositeField; +}(_SilverStripeComponent2.default); + +CompositeField.propTypes = { + data: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.array, _react2.default.PropTypes.shape({ + tag: _react2.default.PropTypes.string, + legend: _react2.default.PropTypes.string + })]), + extraClass: _react2.default.PropTypes.string +}; + +CompositeField.defaultProps = { + className: '', + extraClass: '' +}; + +exports.default = CompositeField; + +/***/ }), + +/***/ 402: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TextField = undefined; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _SilverStripeComponent = __webpack_require__(13); + +var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); + +var _FieldHolder = __webpack_require__(44); + +var _FieldHolder2 = _interopRequireDefault(_FieldHolder); + +var _reactBootstrapSs = __webpack_require__(38); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var TextField = function (_SilverStripeComponen) { + _inherits(TextField, _SilverStripeComponen); + + function TextField(props) { + _classCallCheck(this, TextField); + + var _this = _possibleConstructorReturn(this, (TextField.__proto__ || Object.getPrototypeOf(TextField)).call(this, props)); + + _this.handleChange = _this.handleChange.bind(_this); + return _this; + } + + _createClass(TextField, [{ + key: 'render', + value: function render() { + return _react2.default.createElement(_reactBootstrapSs.FormControl, this.getInputProps()); + } + }, { + key: 'getInputProps', + value: function getInputProps() { + var props = { + bsClass: this.props.bsClass, + className: this.props.className + ' ' + this.props.extraClass, + id: this.props.id, + name: this.props.name, + disabled: this.props.disabled, + readOnly: this.props.readOnly, + value: this.props.value, + placeholder: this.props.placeholder, + autoFocus: this.props.autoFocus + }; + + if (this.isMultiline()) { + Object.assign(props, { + componentClass: 'textarea', + rows: this.props.data.rows, + cols: this.props.data.columns + }); + } else { + Object.assign(props, { + componentClass: 'input', + type: this.props.type ? this.props.type : null + }); + } + + if (!this.props.readOnly) { + Object.assign(props, { + onChange: this.handleChange + }); + } + + return props; + } + }, { + key: 'isMultiline', + value: function isMultiline() { + return this.props.data && this.props.data.rows > 1; + } + }, { + key: 'handleChange', + value: function handleChange(event) { + if (typeof this.props.onChange === 'function') { + this.props.onChange(event, { id: this.props.id, value: event.target.value }); + } + } + }]); + + return TextField; +}(_SilverStripeComponent2.default); + +TextField.propTypes = { + extraClass: _react2.default.PropTypes.string, + id: _react2.default.PropTypes.string, + name: _react2.default.PropTypes.string.isRequired, + onChange: _react2.default.PropTypes.func, + value: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]), + readOnly: _react2.default.PropTypes.bool, + disabled: _react2.default.PropTypes.bool, + placeholder: _react2.default.PropTypes.string, + type: _react2.default.PropTypes.string, + autoFocus: _react2.default.PropTypes.bool +}; + +TextField.defaultProps = { + value: '', + extraClass: '', + className: '', + type: 'text' +}; + +exports.TextField = TextField; +exports.default = (0, _FieldHolder2.default)(TextField); + +/***/ }), + +/***/ 403: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _classnames = __webpack_require__(4); + +var _classnames2 = _interopRequireDefault(_classnames); + +var _TreeDropdownFieldNode = __webpack_require__(188); + +var _TreeDropdownFieldNode2 = _interopRequireDefault(_TreeDropdownFieldNode); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var TreeDropdownFieldMenu = function (_Component) { + _inherits(TreeDropdownFieldMenu, _Component); + + function TreeDropdownFieldMenu(props) { + _classCallCheck(this, TreeDropdownFieldMenu); + + var _this = _possibleConstructorReturn(this, (TreeDropdownFieldMenu.__proto__ || Object.getPrototypeOf(TreeDropdownFieldMenu)).call(this, props)); + + _this.render = _this.render.bind(_this); + _this.renderOption = _this.renderOption.bind(_this); + _this.renderBreadcrumbs = _this.renderBreadcrumbs.bind(_this); + _this.handleBack = _this.handleBack.bind(_this); + return _this; + } + + _createClass(TreeDropdownFieldMenu, [{ + key: 'handleBack', + value: function handleBack(event) { + if (typeof this.props.onBack === 'function') { + this.props.onBack(event); + } else { + event.stopPropagation(); + event.preventDefault(); + } + } + }, { + key: 'renderBreadcrumbs', + value: function renderBreadcrumbs() { + if (this.props.breadcrumbs.length === 0) { + return null; + } + + var breadcrumbs = this.props.breadcrumbs.map(function (item) { + return item.title; + }).join(' / '); + var icon = this.props.search ? 'font-icon-search' : 'font-icon-left-open-big'; + var button = _react2.default.createElement( + 'button', + { className: 'treedropdownfield__breadcrumbs-button' }, + _react2.default.createElement('span', { className: 'icon ' + icon }) + ); + + return _react2.default.createElement( + 'div', + { + className: 'Select-option treedropdownfield__breadcrumbs flexbox-area-grow fill-width', + onClick: this.handleBack + }, + button, + _react2.default.createElement( + 'span', + { className: 'treedropdownfield__breadcrumbs-crumbs flexbox-area-grow' }, + breadcrumbs + ) + ); + } + }, { + key: 'renderOption', + value: function renderOption(tree, index) { + if (!this.props.renderMenuOptions) { + return null; + } + var _props$renderMenuOpti = this.props.renderMenuOptions, + focusedOption = _props$renderMenuOpti.focusedOption, + instancePrefix = _props$renderMenuOpti.instancePrefix, + onFocus = _props$renderMenuOpti.onFocus, + onSelect = _props$renderMenuOpti.onSelect, + optionClassName = _props$renderMenuOpti.optionClassName, + optionComponent = _props$renderMenuOpti.optionComponent, + optionRenderer = _props$renderMenuOpti.optionRenderer, + onOptionRef = _props$renderMenuOpti.onOptionRef; + + var Option = optionComponent; + + var isSelected = this.props.value.includes(tree.id); + var isFocused = focusedOption && tree.id === focusedOption.id; + var optionClass = (0, _classnames2.default)(optionClassName, { + treedropdownfield__option: true, + 'Select-option': true, + 'is-selected': isSelected, + 'is-focused': isFocused, + 'is-disabled': tree.disabled + }); + + return _react2.default.createElement( + Option, + { + className: optionClass, + instancePrefix: instancePrefix, + isDisabled: tree.disabled, + isFocused: isFocused, + isSelected: isSelected, + key: 'option-' + tree.id + '-' + index, + onFocus: onFocus, + onSelect: onSelect, + option: tree, + optionIndex: index, + ref: function ref(_ref) { + onOptionRef(_ref, isFocused); + } + }, + optionRenderer(tree, index) + ); + } + }, { + key: 'render', + value: function render() { + if (this.props.loading) { + return _react2.default.createElement( + 'div', + { className: 'Select-option flexbox-area-grow fill-width' }, + _react2.default.createElement( + 'span', + { className: 'Select-loading-zone', 'aria-hidden': 'true' }, + _react2.default.createElement('span', { className: 'Select-loading' }) + ), + _react2.default.createElement( + 'span', + { className: 'treedropdownfield__menu-loading flexbox-area-grow' }, + _i18n2.default._t('Admin.TREEDROPDOWN_LOADING', 'Loading...') + ) + ); + } + if (this.props.failed) { + return _react2.default.createElement( + 'div', + { className: 'Select-option' }, + _i18n2.default._t('Admin.TREEDROPDOWN_FAILED', 'Failed to load') + ); + } + if (this.props.tree.count === 0) { + return _react2.default.createElement( + 'div', + { className: 'Select-option' }, + _i18n2.default._t('Admin.TREEDROPDOWN_NO_CHILDREN', 'No children') + ); + } + + var breadcrumbs = this.renderBreadcrumbs(); + var options = this.props.renderMenuOptions && this.props.renderMenuOptions.options; + + var children = options ? options.filter(function (option) { + return option.title !== null; + }).map(this.renderOption) : null; + + return _react2.default.createElement( + 'div', + { className: 'treedropdownfield__menu' }, + breadcrumbs, + children + ); + } + }]); + + return TreeDropdownFieldMenu; +}(_react.Component); + +TreeDropdownFieldMenu.propTypes = { + className: _react.PropTypes.string, + breadcrumbs: _react.PropTypes.arrayOf(_react.PropTypes.shape(_TreeDropdownFieldNode2.default.propTypes)), + loading: _react.PropTypes.bool, + failed: _react.PropTypes.bool, + tree: _react.PropTypes.shape(_TreeDropdownFieldNode2.default.propTypes), + renderMenuOptions: _react.PropTypes.object, + onBack: _react.PropTypes.func, + search: _react.PropTypes.bool, + value: _react.PropTypes.array +}; + +exports.default = TreeDropdownFieldMenu; + +/***/ }), + +/***/ 404: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.GLOBAL_CONTEXT = undefined; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _toposort = __webpack_require__(1842); + +var _toposort2 = _interopRequireDefault(_toposort); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var BEFORE = 'before'; + +var AFTER = 'after'; + +var GRAPH_HEAD = '__HEAD__'; + +var GRAPH_TAIL = '__TAIL__'; + +var PRIORITIES = [BEFORE, AFTER]; + +var GLOBAL_CONTEXT = '__GLOBAL__'; + +var WILDCARD = '*'; + +var validateMeta = function validateMeta(meta) { + PRIORITIES.forEach(function (k) { + if (typeof meta[k] !== 'undefined' && typeof meta[k] !== 'string' && !Array.isArray(meta[k])) { + throw new Error('Middleware key ' + k + ' must be a string or array'); + } + }); +}; + +var checkWildcard = function checkWildcard(middleware) { + var wildcard = null; + PRIORITIES.forEach(function (PRIORITY) { + if (middleware[PRIORITY].includes(WILDCARD)) { + if (middleware[PRIORITY].length > 1) { + throw new Error('\n Key ' + PRIORITY + ' on ' + middleware.name + ' should only specify one key \n if using the "' + WILDCARD + '" wildcard\n '); + } else if (wildcard) { + throw new Error('\n Cannot specify a ' + PRIORITY + ' rule on ' + middleware.name + ' if a wildcard \n has been specified\n '); + } else { + wildcard = PRIORITY; + } + } + }); + + return wildcard; +}; + +var MiddlewareRegistry = function () { + function MiddlewareRegistry() { + _classCallCheck(this, MiddlewareRegistry); + + this._middlewares = []; + this._contextCache = {}; + } + + _createClass(MiddlewareRegistry, [{ + key: 'sort', + value: function sort() { + var _this = this; + + var GRAPH_INIT = [GRAPH_HEAD, GRAPH_TAIL]; + var graph = [GRAPH_INIT]; + var sortedMiddlewares = []; + this._middlewares.forEach(function (middleware) { + var name = middleware.name; + + var wildcard = checkWildcard(middleware); + if (wildcard === AFTER) { + graph.push([GRAPH_TAIL, name]); + } else if (wildcard === BEFORE) { + graph.push([name, GRAPH_HEAD]); + } else { + graph.push([name, GRAPH_TAIL]); + graph.push([GRAPH_HEAD, name]); + + middleware[BEFORE].forEach(function (beforeEntry) { + graph.push([name, beforeEntry]); + }); + middleware[AFTER].forEach(function (afterEntry) { + graph.push([afterEntry, name]); + }); + } + }); + + (0, _toposort2.default)(graph).filter(function (item) { + return !GRAPH_INIT.includes(item); + }).forEach(function (name) { + sortedMiddlewares = sortedMiddlewares.concat(_this._middlewares.filter(function (m) { + return m.name === name; + })); + }); + + this._middlewares = sortedMiddlewares; + + return this; + } + }, { + key: 'add', + value: function add(meta, factory, contextList) { + validateMeta(meta); + + this._contextCache = {}; + var context = contextList; + if (!context || !context.length) { + context = [GLOBAL_CONTEXT]; + } else if (!Array.isArray(context)) { + context = [context]; + } + + var normalised = _extends({}, meta, { factory: factory, context: context }); + + PRIORITIES.forEach(function (k) { + if (!Array.isArray(meta[k])) { + normalised[k] = meta[k] ? [meta[k]] : []; + } else { + normalised[k] = meta[k]; + } + }); + + if (PRIORITIES.every(function (p) { + return !normalised[p].length; + })) { + normalised[AFTER] = [GRAPH_HEAD]; + normalised[BEFORE] = [GRAPH_TAIL]; + } + + this._middlewares.push(normalised); + + return this; + } + }, { + key: 'getMatchesForContext', + value: function getMatchesForContext() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GLOBAL_CONTEXT; + + if (!this._contextCache[context]) { + var requestedContext = context.split('.'); + this._contextCache[context] = this._middlewares.filter(function (middleware) { + return middleware.context[0] === GLOBAL_CONTEXT || middleware.context.every(function (part, index) { + return part === WILDCARD || requestedContext[index] === part; + }); + }); + } + return this._contextCache[context]; + } + }]); + + return MiddlewareRegistry; +}(); + +exports.GLOBAL_CONTEXT = GLOBAL_CONTEXT; +exports.default = MiddlewareRegistry; + +/***/ }), + +/***/ 405: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _injectorContext = __webpack_require__(406); + +var _injectorContext2 = _interopRequireDefault(_injectorContext); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var inject = function inject(dependencies, mapDependenciesToProps, getContext) { + return function (Component) { + if (dependencies && !Array.isArray(dependencies)) { + throw new Error('\n withInjector() passed an argument for dependencies that is ' + (typeof deps === 'undefined' ? 'undefined' : _typeof(deps)) + '. \n Must be a string or array of named dependencies.\n '); + } + + if (mapDependenciesToProps && typeof mapDependenciesToProps !== 'function') { + throw new Error('\n Second parameter of inject() [mapDependenciesToProps] must be a function, taking the resolved\n dependencies as enumerated arguments, and returning a map of prop names to dependencies.\n '); + } + + if (getContext && typeof getContext !== 'function') { + throw new Error('\n Third parameter of inject() [getContext] must be a function, taking the component\'s props\n as the single parameter, and returning a string representing the Injector\n context to use throughout the component.\n '); + } + + var Injected = function (_React$Component) { + _inherits(Injected, _React$Component); + + function Injected() { + _classCallCheck(this, Injected); + + return _possibleConstructorReturn(this, (Injected.__proto__ || Object.getPrototypeOf(Injected)).apply(this, arguments)); + } + + _createClass(Injected, [{ + key: 'render', + value: function render() { + var _this2 = this; + + var props = {}; + var context = getContext ? getContext(this.props) : null; + if (dependencies) { + var resolved = dependencies.map(function (dep) { + return _this2.context.injector.get(dep, context); + }); + + if (mapDependenciesToProps) { + props = mapDependenciesToProps.apply(undefined, _toConsumableArray(resolved)); + } else { + dependencies.forEach(function (dep, index) { + props[dep] = resolved[index]; + }); + } + + if (!props || (typeof props === 'undefined' ? 'undefined' : _typeof(props)) !== 'object') { + throw new Error('\n mapDepedenciesToProps parameter passed to inject()\n should return an object that maps prop names to dependencies\n '); + } + } + var newProps = _extends({}, this.props, props); + return _react2.default.createElement(Component, newProps); + } + }]); + + return Injected; + }(_react2.default.Component); + + Injected.contextTypes = _injectorContext2.default; + Injected.displayName = 'inject(\n ' + (Component.displayName || Component.name || 'Component') + '\n )'; + + return Injected; + }; +}; + +exports.default = inject; + +/***/ }), + +/***/ 406: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = { + injector: _react2.default.PropTypes.shape({ + get: _react2.default.PropTypes.func + }) +}; + +/***/ }), + +/***/ 407: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _Container = __webpack_require__(258); + +var _Container2 = _interopRequireDefault(_Container); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function provideInjector(Component) { + var InjectorProvider = function (_React$Component) { + _inherits(InjectorProvider, _React$Component); + + function InjectorProvider() { + _classCallCheck(this, InjectorProvider); + + return _possibleConstructorReturn(this, (InjectorProvider.__proto__ || Object.getPrototypeOf(InjectorProvider)).apply(this, arguments)); + } + + _createClass(InjectorProvider, [{ + key: 'getChildContext', + value: function getChildContext() { + var component = _Container2.default.component, + form = _Container2.default.form; + var get = component.get; + + + return { + injector: { + get: get.bind(component), + validate: form.getValidation.bind(form) + } + }; + } + }, { + key: 'render', + value: function render() { + return _react2.default.createElement(Component, this.props); + } + }]); + + return InjectorProvider; + }(_react2.default.Component); + + InjectorProvider.childContextTypes = { + injector: _react2.default.PropTypes.shape({ + get: _react2.default.PropTypes.func + }) + }; + + return InjectorProvider; +} + +exports.default = provideInjector; + +/***/ }), + +/***/ 408: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _injectorContext = __webpack_require__(406); + +var _injectorContext2 = _interopRequireDefault(_injectorContext); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var withInjector = function withInjector(Component) { + Component.contextTypes = _extends({}, Component.contextTypes, _injectorContext2.default); + + Component.displayName = 'withInjector(\n ' + (Component.displayName || Component.name || 'Component') + '\n )'; + + return Component; +}; + +exports.default = withInjector; + +/***/ }), + +/***/ 409: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = { + SET_BREADCRUMBS: 'SET_BREADCRUMBS' +}; + +/***/ }), + +/***/ 410: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = { + SET_CONFIG: 'SET_CONFIG' +}; + +/***/ }), + +/***/ 411: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = { + TOGGLE_MENU: 'TOGGLE_MENU', + OPEN_MENU: 'OPEN_MENU', + CLOSE_MENU: 'CLOSE_MENU' +}; + +/***/ }), + +/***/ 412: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.toggleMobileMenu = toggleMobileMenu; +exports.openMobileMenu = openMobileMenu; +exports.closeMobileMenu = closeMobileMenu; + +var _MobileMenuActionTypes = __webpack_require__(411); + +var _MobileMenuActionTypes2 = _interopRequireDefault(_MobileMenuActionTypes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toggleMobileMenu() { + return { + type: _MobileMenuActionTypes2.default.TOGGLE_MENU, + payload: null + }; +} + +function openMobileMenu() { + return { + type: _MobileMenuActionTypes2.default.OPEN_MENU, + payload: null + }; +} + +function closeMobileMenu() { + return { + type: _MobileMenuActionTypes2.default.CLOSE_MENU, + payload: null + }; +} + +/***/ }), + +/***/ 413: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = { + CREATE_RECORD: 'CREATE_RECORD', + UPDATE_RECORD: 'UPDATE_RECORD', + DELETE_RECORD: 'DELETE_RECORD', + FETCH_RECORDS_REQUEST: 'FETCH_RECORDS_REQUEST', + FETCH_RECORDS_FAILURE: 'FETCH_RECORDS_FAILURE', + FETCH_RECORDS_SUCCESS: 'FETCH_RECORDS_SUCCESS', + FETCH_RECORD_REQUEST: 'FETCH_RECORD_REQUEST', + FETCH_RECORD_FAILURE: 'FETCH_RECORD_FAILURE', + FETCH_RECORD_SUCCESS: 'FETCH_RECORD_SUCCESS', + DELETE_RECORD_REQUEST: 'DELETE_RECORD_REQUEST', + DELETE_RECORD_FAILURE: 'DELETE_RECORD_FAILURE', + DELETE_RECORD_SUCCESS: 'DELETE_RECORD_SUCCESS' +}; + +/***/ }), + +/***/ 414: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var ACTION_TYPES = { + SET_SCHEMA: 'SET_SCHEMA', + SET_SCHEMA_STATE_OVERRIDES: 'SET_SCHEMA_STATE_OVERRIDES', + SET_SCHEMA_LOADING: 'SET_SCHEMA_LOADING' +}; + +exports.default = ACTION_TYPES; + +/***/ }), + +/***/ 415: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = { + TREEFIELD_SET_VISIBLE: 'TREEDROPDOWNFIELD_SET_VISIBLE', + TREEFIELD_UPDATED_TREE: 'TREEDROPDOWNFIELD_UPDATED_TREE', + TREEFIELD_UPDATING_TREE: 'TREEDROPDOWNFIELD_UPDATING_TREE', + TREEFIELD_UPDATE_FAILED: 'TREEFIELD_UPDATE_FAILED', + TREEFIELD_SET_SEARCH: 'TREEFIELD_SET_SEARCH', + TREEFIELD_ADD_SELECTED_VALUES: 'TREEFIELD_ADD_SELECTED_VALUES' +}; + +/***/ }), + +/***/ 416: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.setVisible = setVisible; +exports.beginTreeUpdating = beginTreeUpdating; +exports.updateTree = updateTree; +exports.updateTreeFailed = updateTreeFailed; +exports.setSearch = setSearch; +exports.addSelectedValues = addSelectedValues; + +var _TreeDropdownFieldActionTypes = __webpack_require__(415); + +var _TreeDropdownFieldActionTypes2 = _interopRequireDefault(_TreeDropdownFieldActionTypes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function setVisible(fieldId, path) { + return { + type: _TreeDropdownFieldActionTypes2.default.TREEFIELD_SET_VISIBLE, + payload: { fieldId: fieldId, path: path } + }; +} + +function beginTreeUpdating(fieldId, path) { + return { + type: _TreeDropdownFieldActionTypes2.default.TREEFIELD_UPDATING_TREE, + payload: { fieldId: fieldId, path: path } + }; +} + +function updateTree(fieldId, path, tree) { + return { + type: _TreeDropdownFieldActionTypes2.default.TREEFIELD_UPDATED_TREE, + payload: { fieldId: fieldId, path: path, tree: tree } + }; +} + +function updateTreeFailed(fieldId, path) { + return { + type: _TreeDropdownFieldActionTypes2.default.TREEFIELD_UPDATE_FAILED, + payload: { fieldId: fieldId, path: path } + }; +} + +function setSearch(fieldId, search) { + return { + type: _TreeDropdownFieldActionTypes2.default.TREEFIELD_SET_SEARCH, + payload: { fieldId: fieldId, search: search } + }; +} + +function addSelectedValues(fieldId, values) { + return { + type: _TreeDropdownFieldActionTypes2.default.TREEFIELD_ADD_SELECTED_VALUES, + payload: { fieldId: fieldId, values: values } + }; +} + +/***/ }), + +/***/ 417: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = { + ADD_FORM_CHANGED: 'ADD_FORM_CHANGED', + REMOVE_FORM_CHANGED: 'REMOVE_FORM_CHANGED' +}; + +/***/ }), + +/***/ 44: +/***/ (function(module, exports) { + +module.exports = FieldHolder; + +/***/ }), + +/***/ 45: +/***/ (function(module, exports) { + +module.exports = Injector; + +/***/ }), + +/***/ 762: +/***/ (function(module, exports) { + +module.exports = Config; + +/***/ }), + +/***/ 763: +/***/ (function(module, exports) { + +module.exports = FormBuilderModal; + +/***/ }), + +/***/ 764: +/***/ (function(module, exports) { + +module.exports = ReactRouterRedux; + +/***/ }), + +/***/ 765: +/***/ (function(module, exports) { + +module.exports = ReactSelect; + +/***/ }), + +/***/ 766: +/***/ (function(module, exports) { + +module.exports = getFormState; + +/***/ }), + +/***/ 767: +/***/ (function(module, exports) { + +module.exports = schemaFieldValues; + +/***/ }), + +/***/ 768: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _BootRoutes = __webpack_require__(907); + +var _BootRoutes2 = _interopRequireDefault(_BootRoutes); + +var _Injector = __webpack_require__(45); + +var _Injector2 = _interopRequireDefault(_Injector); + +var _redux = __webpack_require__(41); + +var _reduxThunk = __webpack_require__(1906); + +var _reduxThunk2 = _interopRequireDefault(_reduxThunk); + +var _Config = __webpack_require__(762); + +var _Config2 = _interopRequireDefault(_Config); + +var _buildApolloClient = __webpack_require__(909); + +var _buildApolloClient2 = _interopRequireDefault(_buildApolloClient); + +var _ConfigActions = __webpack_require__(963); + +var _registerComponents = __webpack_require__(910); + +var _registerComponents2 = _interopRequireDefault(_registerComponents); + +var _registerReducers = __webpack_require__(911); + +var _registerReducers2 = _interopRequireDefault(_registerReducers); + +var _applyDevtools = __webpack_require__(908); + +var _applyDevtools2 = _interopRequireDefault(_applyDevtools); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +window.ss = window.ss || {}; + +function appBoot() { + var baseUrl = _Config2.default.get('absoluteBaseUrl'); + var apolloClient = (0, _buildApolloClient2.default)(baseUrl); + var apolloReducer = apolloClient.reducer(); + + (0, _registerComponents2.default)(); + (0, _registerReducers2.default)({ + apollo: apolloReducer + }); + var middleware = [_reduxThunk2.default, apolloClient.middleware()]; + var debugging = _Config2.default.get('debugging'); + var runMiddleware = _redux.applyMiddleware.apply(undefined, middleware); + + if (debugging) { + runMiddleware = (0, _applyDevtools2.default)(runMiddleware); + } + + var createStoreWithMiddleware = runMiddleware(_redux.createStore); + + var rootReducer = (0, _redux.combineReducers)(_Injector2.default.reducer.getAll()); + var store = createStoreWithMiddleware(rootReducer, {}); + + store.dispatch((0, _ConfigActions.setConfig)(_Config2.default.getAll())); + _Injector2.default.reducer.setStore(store); + + window.ss.store = store; + window.ss.apolloClient = apolloClient; + + if (window.jQuery) { + window.jQuery('body').addClass('js-react-boot'); + } + + var routes = new _BootRoutes2.default(store, apolloClient); + + window.setTimeout(function () { + _Injector2.default.load(); + routes.start(window.location.pathname); + + var newReducer = (0, _redux.combineReducers)(_Injector2.default.reducer.getAll()); + store.replaceReducer(newReducer); + }, 0); +} +window.onload = appBoot; + +/***/ }), + +/***/ 770: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var i18n = function () { + function i18n() { + _classCallCheck(this, i18n); + + this.defaultLocale = 'en_US'; + this.currentLocale = this.detectLocale(); + this.lang = {}; + } + + _createClass(i18n, [{ + key: 'setLocale', + value: function setLocale(locale) { + this.currentLocale = locale; + } + }, { + key: 'getLocale', + value: function getLocale() { + return this.currentLocale !== null ? this.currentLocale : this.defaultLocale; + } + }, { + key: '_t', + value: function _t(entity, fallbackString, priority, context) { + var langName = this.getLocale().replace(/_[\w]+/i, ''); + var defaultlangName = this.defaultLocale.replace(/_[\w]+/i, ''); + + if (this.lang && this.lang[this.getLocale()] && this.lang[this.getLocale()][entity]) { + return this.lang[this.getLocale()][entity]; + } else if (this.lang && this.lang[langName] && this.lang[langName][entity]) { + return this.lang[langName][entity]; + } else if (this.lang && this.lang[this.defaultLocale] && this.lang[this.defaultLocale][entity]) { + return this.lang[this.defaultLocale][entity]; + } else if (this.lang && this.lang[defaultlangName] && this.lang[defaultlangName][entity]) { + return this.lang[defaultlangName][entity]; + } else if (fallbackString) { + return fallbackString; + } else { + return ''; + } + } + }, { + key: 'addDictionary', + value: function addDictionary(locale, dict) { + if (typeof this.lang[locale] === 'undefined') { + this.lang[locale] = {}; + } + + for (var entity in dict) { + this.lang[locale][entity] = dict[entity]; + } + } + }, { + key: 'getDictionary', + value: function getDictionary(locale) { + return this.lang[locale]; + } + }, { + key: 'stripStr', + value: function stripStr(str) { + return str.replace(/^\s*/, '').replace(/\s*$/, ''); + } + }, { + key: 'stripStrML', + value: function stripStrML(str) { + var parts = str.split('\n'); + + for (var i = 0; i < parts.length; i += 1) { + parts[i] = stripStr(parts[i]); + } + + return stripStr(parts.join(' ')); + } + }, { + key: 'sprintf', + value: function sprintf(s) { + for (var _len = arguments.length, params = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + params[_key - 1] = arguments[_key]; + } + + if (params.length === 0) { + return s; + } + + var regx = new RegExp('(.?)(%s)', 'g'); + + var i = 0; + + return s.replace(regx, function (match, subMatch1, subMatch2, offset, string) { + if (subMatch1 === '%') { + return match; + } + + return subMatch1 + params[i++]; + }); + } + }, { + key: 'inject', + value: function inject(s, map) { + var regx = new RegExp('\{([A-Za-z0-9_]*)\}', 'g'); + + return s.replace(regx, function (match, key, offset, string) { + return map[key] ? map[key] : match; + }); + } + }, { + key: 'detectLocale', + value: function detectLocale() { + var rawLocale; + var detectedLocale; + + rawLocale = document.body.getAttribute('lang'); + + if (!rawLocale) { + var metas = document.getElementsByTagName('meta'); + + for (var i = 0; i < metas.length; i++) { + if (metas[i].attributes['http-equiv'] && metas[i].attributes['http-equiv'].nodeValue.toLowerCase() == 'content-language') { + rawLocale = metas[i].attributes['content'].nodeValue; + } + } + } + + if (!rawLocale) { + rawLocale = this.defaultLocale; + } + + var rawLocaleParts = rawLocale.match(/([^-|_]*)[-|_](.*)/); + + if (rawLocale.length == 2) { + for (var compareLocale in i18n.lang) { + if (compareLocale.substr(0, 2).toLowerCase() == rawLocale.toLowerCase()) { + detectedLocale = compareLocale; + break; + } + } + } else if (rawLocaleParts) { + detectedLocale = rawLocaleParts[1].toLowerCase() + '_' + rawLocaleParts[2].toUpperCase(); + } + + return detectedLocale; + } + }, { + key: 'addEvent', + value: function addEvent(obj, evType, fn, useCapture) { + if (obj.addEventListener) { + obj.addEventListener(evType, fn, useCapture); + return true; + } else if (obj.attachEvent) { + return obj.attachEvent('on' + evType, fn); + } else { + console.log('Handler could not be attached'); + } + } + }]); + + return i18n; +}(); + +var _i18n = new i18n(); + +window.ss = typeof window.ss !== 'undefined' ? window.ss : {}; +window.ss.i18n = window.i18n = _i18n; + +exports.default = _i18n; + +/***/ }), + +/***/ 771: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _reactDom = __webpack_require__(26); + +var _reactDom2 = _interopRequireDefault(_reactDom); + +var _reactRedux = __webpack_require__(42); + +var _Injector = __webpack_require__(45); + +var _FormBuilderModal = __webpack_require__(763); + +var _FormBuilderModal2 = _interopRequireDefault(_FormBuilderModal); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var InjectableFormBuilderModal = (0, _Injector.provideInjector)(_FormBuilderModal2.default); + +_jQuery2.default.entwine('ss', function ($) { + $('.cms-content-actions .add-to-campaign-action,' + '#add-to-campaign__action').entwine({ + onclick: function onclick() { + var dialog = $('#add-to-campaign__dialog-wrapper'); + + if (!dialog.length) { + dialog = $(''); + $('body').append(dialog); + } + + dialog.open(); + + return false; + } + }); + + $('.add-to-campaign-modal .add-to-campaign-modal__nav-link').entwine({ + onclick: function onclick(e) { + e.preventDefault(); + var $link = $(e.target); + window.location = $link.attr('href'); + } + }); + + $('#add-to-campaign__dialog-wrapper').entwine({ + onunmatch: function onunmatch() { + this._clearModal(); + }, + open: function open() { + this._renderModal(true); + }, + close: function close() { + this._renderModal(false); + }, + _renderModal: function _renderModal(show) { + var _this = this; + + var handleHide = function handleHide() { + return _this.close(); + }; + var handleSubmit = function handleSubmit() { + return _this._handleSubmitModal.apply(_this, arguments); + }; + var id = $('form.cms-edit-form :input[name=ID]').val(); + var store = window.ss.store; + var sectionConfigKey = 'SilverStripe\\CMS\\Controllers\\CMSPageEditController'; + var sectionConfig = store.getState().config.sections.find(function (section) { + return section.name === sectionConfigKey; + }); + var modalSchemaUrl = sectionConfig.form.AddToCampaignForm.schemaUrl + '/' + id; + + _reactDom2.default.render(_react2.default.createElement( + _reactRedux.Provider, + { store: store }, + _react2.default.createElement(InjectableFormBuilderModal, { + title: 'Add to campaign', + show: show, + handleSubmit: handleSubmit, + handleHide: handleHide, + schemaUrl: modalSchemaUrl, + bodyClassName: 'modal__dialog', + className: 'add-to-campaign-modal', + responseClassBad: 'modal__response modal__response--error', + responseClassGood: 'modal__response modal__response--good', + identifier: 'Admin.AddToCampaign' + }) + ), this[0]); + }, + _clearModal: function _clearModal() { + _reactDom2.default.unmountComponentAtNode(this[0]); + }, + _handleSubmitModal: function _handleSubmitModal(data, action, submitFn) { + return submitFn(); + } + }); +}); + +/***/ }), + +/***/ 772: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _jQuery2.default)(document).on('click', '.confirmedpassword .showOnClick a', function () { + var $container = (0, _jQuery2.default)('.showOnClickContainer', (0, _jQuery2.default)(this).parent()); + + $container.toggle('fast', function () { + $container.find('input[type="hidden"]').val($container.is(":visible") ? 1 : 0); + }); + + return false; +}); + +/***/ }), + +/***/ 773: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _moment = __webpack_require__(181); + +var _moment2 = _interopRequireDefault(_moment); + +var _modernizr = __webpack_require__(180); + +var _modernizr2 = _interopRequireDefault(_modernizr); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(125); + +_jQuery2.default.entwine('ss', function (jQuery) { + jQuery('input[type=datetime-local]').entwine({ + onadd: function onadd() { + if (_modernizr2.default.inputtypes['datetime-local']) { + return; + } + + if (this.prop('disabled') || this.prop('readonly') || this.hasClass('hasDatepicker')) { + return; + } + + var hiddenInput = jQuery('', { type: 'hidden', name: this.attr('name'), value: this.val() }); + this.parent().append(hiddenInput); + + this.removeAttr('name'); + + _moment2.default.locale(this.attr('lang')); + var isoDate = this.val(); + var localDate = ''; + if (isoDate) { + var dateObject = (0, _moment2.default)(isoDate); + if (dateObject.isValid()) { + localDate = dateObject.format('L LT'); + } + } + this.val(localDate); + + var placeholder = _i18n2.default.inject(_i18n2.default._t('Admin.FormatExample', 'Example: {format}'), { format: (0, _moment2.default)().endOf('month').format('L LT') }); + this.attr('placeholder', placeholder); + + this.updateValue(); + }, + onchange: function onchange() { + this.updateValue(); + }, + updateValue: function updateValue() { + var localDate = this.val(); + var isoDate = ''; + if (localDate) { + var dateObject = (0, _moment2.default)(localDate, ['L LT', _moment2.default.ISO_8601]); + if (dateObject.isValid()) { + isoDate = dateObject.format('YYYY-MM-DDTHH:mm:ss'); + } + } + this.parent().find('input[type=hidden]').val(isoDate); + } + }); +}); + +/***/ }), + +/***/ 774: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(154); +__webpack_require__(125); + +_jQuery2.default.entwine('ss', function ($) { + $('.grid-field').entwine({ + + reload: function reload(ajaxOpts, successCallback) { + var self = this, + form = this.closest('form'), + focusedElName = this.find(':input:focus').attr('name'), + data = form.find(':input').serializeArray(); + + if (!ajaxOpts) ajaxOpts = {}; + if (!ajaxOpts.data) ajaxOpts.data = []; + ajaxOpts.data = ajaxOpts.data.concat(data); + + if (window.location.search) { + ajaxOpts.data = window.location.search.replace(/^\?/, '') + '&' + $.param(ajaxOpts.data); + } + + form.addClass('loading'); + + $.ajax($.extend({}, { + headers: { "X-Pjax": 'CurrentField' }, + type: "POST", + url: this.data('url'), + dataType: 'html', + success: function success(data) { + self.empty().append($(data).children()); + + if (focusedElName) self.find(':input[name="' + focusedElName + '"]').focus(); + + if (self.find('.filter-header').length) { + var content; + if (ajaxOpts.data[0].filter == "show") { + content = ''; + self.addClass('show-filter').find('.filter-header').show(); + } else { + content = ''; + self.removeClass('show-filter').find('.filter-header').hide(); + } + + self.find('.sortable-header th:last').html(content); + } + + form.removeClass('loading'); + if (successCallback) successCallback.apply(this, arguments); + self.trigger('reload', self); + }, + error: function error(e) { + alert(_i18n2.default._t('Admin.ERRORINTRANSACTION')); + form.removeClass('loading'); + } + }, ajaxOpts)); + }, + showDetailView: function showDetailView(url) { + window.location.href = url; + }, + getItems: function getItems() { + return this.find('.ss-gridfield-item'); + }, + + setState: function setState(k, v) { + var state = this.getState(); + state[k] = v; + this.find(':input[name="' + this.data('name') + '[GridState]"]').val(JSON.stringify(state)); + }, + + getState: function getState() { + return JSON.parse(this.find(':input[name="' + this.data('name') + '[GridState]"]').val()); + } + }); + + $('.grid-field *').entwine({ + getGridField: function getGridField() { + return this.closest('.grid-field'); + } + }); + + $('.grid-field :button[name=showFilter]').entwine({ + onclick: function onclick(e) { + this.closest('.grid-field__table').find('.filter-header').show().find(':input:first').focus(); + + this.closest('.grid-field').addClass('show-filter'); + this.parent().html(''); + e.preventDefault(); + } + }); + + $('.grid-field .ss-gridfield-item').entwine({ + onclick: function onclick(e) { + if ($(e.target).closest('.action').length) { + this._super(e); + return false; + } + + var editLink = this.find('.edit-link'); + if (editLink.length) this.getGridField().showDetailView(editLink.prop('href')); + }, + onmouseover: function onmouseover() { + if (this.find('.edit-link').length) this.css('cursor', 'pointer'); + }, + onmouseout: function onmouseout() { + this.css('cursor', 'default'); + } + }); + + $('.grid-field .action.action_import:button').entwine({ + onclick: function onclick(e) { + e.preventDefault(); + this.openmodal(); + }, + onmatch: function onmatch() { + this._super(); + + if (this.data('state') === 'open') { + this.openmodal(); + } + }, + onunmatch: function onunmatch() { + this._super(); + }, + + openmodal: function openmodal() { + var modal = $(this.data('target')); + var newModal = $(this.data('modal')); + if (modal.length < 1) { + modal = newModal; + modal.appendTo(document.body); + } else { + modal.innerHTML = newModal.innerHTML; + } + + var backdrop = $('.modal-backdrop'); + if (backdrop.length < 1) { + backdrop = $(''); + backdrop.appendTo(document.body); + } + + modal.find('[data-dismiss]').on('click', function () { + backdrop.removeClass('in'); + modal.removeClass('in'); + setTimeout(function () { + backdrop.remove(); + }, 150); + }); + + setTimeout(function () { + backdrop.addClass('in'); + modal.addClass('in'); + }, 0); + } + }); + + $('.grid-field .action:button').entwine({ + onclick: function onclick(e) { + var filterState = 'show'; + if (this.is(':disabled')) { + e.preventDefault(); + return; + } + + if (this.hasClass('ss-gridfield-button-close') || !this.closest('.grid-field').hasClass('show-filter')) { + filterState = 'hidden'; + } + + this.getGridField().reload({ + data: [{ name: this.attr('name'), value: this.val(), filter: filterState }] + }); + + e.preventDefault(); + }, + + actionurl: function actionurl() { + var btn = this.closest(':button'), + grid = this.getGridField(), + form = this.closest('form'), + data = form.find(':input.gridstate').serialize(), + csrf = form.find('input[name="SecurityID"]').val(); + + data += "&" + encodeURIComponent(btn.attr('name')) + '=' + encodeURIComponent(btn.val()); + + if (csrf) { + data += "&SecurityID=" + encodeURIComponent(csrf); + } + + if (window.location.search) { + data = window.location.search.replace(/^\?/, '') + '&' + data; + } + + var connector = grid.data('url').indexOf('?') == -1 ? '?' : '&'; + + return $.path.makeUrlAbsolute(grid.data('url') + connector + data, $('base').attr('href')); + } + + }); + + $('.grid-field .add-existing-autocompleter').entwine({ + onbuttoncreate: function onbuttoncreate() { + var self = this; + + this.toggleDisabled(); + + this.find('input[type="text"]').on('keyup', function () { + self.toggleDisabled(); + }); + }, + onunmatch: function onunmatch() { + this.find('input[type="text"]').off('keyup'); + }, + toggleDisabled: function toggleDisabled() { + var $button = this.find('.ss-ui-button'), + $input = this.find('input[type="text"]'), + inputHasValue = $input.val() !== '', + buttonDisabled = $button.is(':disabled'); + + if (inputHasValue && buttonDisabled || !inputHasValue && !buttonDisabled) { + $button.attr("disabled", !buttonDisabled); + } + } + }); + + $('.grid-field .grid-field__col-compact .action.gridfield-button-delete, .cms-edit-form .btn-toolbar button.action.action-delete').entwine({ + onclick: function onclick(e) { + if (!confirm(_i18n2.default._t('Admin.DELETECONFIRMMESSAGE'))) { + e.preventDefault(); + return false; + } else { + this._super(e); + } + } + }); + + $('.grid-field .grid-print-button .action:button').entwine({ + UUID: null, + onmatch: function onmatch() { + this._super(); + this.setUUID(new Date().getTime()); + }, + onunmatch: function onunmatch() { + this._super(); + }, + onclick: function onclick(e) { + var url = this.actionurl(); + window.open(url); + e.preventDefault(); + return false; + } + }); + + $('.ss-gridfield-print-iframe').entwine({ + onmatch: function onmatch() { + this._super(); + + this.hide().bind('load', function () { + this.focus(); + var ifWin = this.contentWindow || this; + ifWin.print(); + }); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + + $('.grid-field .action.no-ajax, .grid-field .no-ajax .action:button').entwine({ + onclick: function onclick(e) { + window.location.href = this.actionurl(); + e.preventDefault(); + return false; + } + }); + + $('.grid-field .action-detail').entwine({ + onclick: function onclick() { + this.getGridField().showDetailView($(this).prop('href')); + return false; + } + }); + + $('.grid-field[data-selectable]').entwine({ + getSelectedItems: function getSelectedItems() { + return this.find('.ss-gridfield-item.ui-selected'); + }, + + getSelectedIDs: function getSelectedIDs() { + return $.map(this.getSelectedItems(), function (el) { + return $(el).data('id'); + }); + } + }); + $('.grid-field[data-selectable] .ss-gridfield-items').entwine({ + onadd: function onadd() { + this._super(); + + this.selectable(); + }, + onremove: function onremove() { + this._super(); + if (this.data('selectable')) this.selectable('destroy'); + } + }); + + $('.grid-field .filter-header :input').entwine({ + onmatch: function onmatch() { + var filterbtn = this.closest('.extra').find('.ss-gridfield-button-filter'), + resetbtn = this.closest('.extra').find('.ss-gridfield-button-reset'); + + if (this.val()) { + filterbtn.addClass('filtered'); + resetbtn.addClass('filtered'); + } + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + onkeydown: function onkeydown(e) { + if (this.closest('.ss-gridfield-button-reset').length) return; + + var filterbtn = this.closest('.extra').find('.ss-gridfield-button-filter'), + resetbtn = this.closest('.extra').find('.ss-gridfield-button-reset'); + + if (e.keyCode == '13') { + var btns = this.closest('.filter-header').find('.ss-gridfield-button-filter'); + var filterState = 'show'; + if (this.hasClass('ss-gridfield-button-close') || !this.closest('.grid-field').hasClass('show-filter')) { + filterState = 'hidden'; + } + + this.getGridField().reload({ data: [{ name: btns.attr('name'), value: btns.val(), filter: filterState }] }); + return false; + } else { + filterbtn.addClass('hover-alike'); + resetbtn.addClass('hover-alike'); + } + } + }); + + $(".grid-field .relation-search").entwine({ + onfocusin: function onfocusin(event) { + this.autocomplete({ + source: function source(request, response) { + var searchField = $(this.element); + var form = $(this.element).closest("form"); + $.ajax({ + headers: { + "X-Pjax": 'Partial' + }, + dataType: 'json', + type: "GET", + url: $(searchField).data('searchUrl'), + data: encodeURIComponent(searchField.attr('name')) + '=' + encodeURIComponent(searchField.val()), + success: response, + error: function error(e) { + alert(_i18n2.default._t('Admin.ERRORINTRANSACTION', 'An error occured while fetching data from the server\n Please try again later.')); + } + }); + }, + select: function select(event, ui) { + var hiddenField = $(''); + hiddenField.val(ui.item.id); + $(this).closest(".grid-field").find(".action_gridfield_relationfind").replaceWith(hiddenField); + var addbutton = $(this).closest(".grid-field").find(".action_gridfield_relationadd"); + + addbutton.removeAttr('disabled'); + } + }); + } + }); + + $(".grid-field .pagination-page-number input").entwine({ + onkeydown: function onkeydown(event) { + if (event.keyCode == 13) { + var newpage = parseInt($(this).val(), 10); + + var gridfield = $(this).getGridField(); + gridfield.setState('GridFieldPaginator', { currentPage: newpage }); + gridfield.reload(); + + return false; + } + } + }); +}); + +/***/ }), + +/***/ 775: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jquery = __webpack_require__(27); + +var _jquery2 = _interopRequireDefault(_jquery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var ss = typeof window.ss !== 'undefined' ? window.ss : {}; + +ss.editorWrappers = {}; +ss.editorWrappers.tinyMCE = function () { + var editorID; + + return { + init: function init(ID) { + editorID = ID; + + this.create(); + }, + + destroy: function destroy() { + tinymce.EditorManager.execCommand('mceRemoveEditor', false, editorID); + }, + + getInstance: function getInstance() { + return tinymce.EditorManager.get(editorID); + }, + + onopen: function onopen() {}, + + onclose: function onclose() {}, + + getConfig: function getConfig() { + var selector = "#" + editorID, + config = (0, _jquery2.default)(selector).data('config'), + self = this; + + config.selector = selector; + + config.setup = function (ed) { + ed.on('change', function () { + self.save(); + }); + }; + return config; + }, + + save: function save() { + var instance = this.getInstance(); + instance.save(); + + (0, _jquery2.default)(instance.getElement()).trigger("change"); + }, + + create: function create() { + var config = this.getConfig(); + + if (typeof config.baseURL !== 'undefined') { + tinymce.EditorManager.baseURL = config.baseURL; + } + tinymce.init(config); + }, + + repaint: function repaint() {}, + + isDirty: function isDirty() { + return this.getInstance().isDirty(); + }, + + getContent: function getContent() { + return this.getInstance().getContent(); + }, + + getDOM: function getDOM() { + return this.getInstance().getElement(); + }, + + getContainer: function getContainer() { + return this.getInstance().getContainer(); + }, + + getSelectedNode: function getSelectedNode() { + return this.getInstance().selection.getNode(); + }, + + selectNode: function selectNode(node) { + this.getInstance().selection.select(node); + }, + + setContent: function setContent(html, opts) { + this.getInstance().setContent(html, opts); + }, + + insertContent: function insertContent(html, opts) { + this.getInstance().insertContent(html, opts); + }, + + replaceContent: function replaceContent(html, opts) { + this.getInstance().execCommand('mceReplaceContent', false, html, opts); + }, + + insertLink: function insertLink(attrs, opts) { + this.getInstance().execCommand("mceInsertLink", false, attrs, opts); + }, + + removeLink: function removeLink() { + this.getInstance().execCommand('unlink', false); + }, + + cleanLink: function cleanLink(href, node) { + var settings = this.getConfig, + cb = settings['urlconverter_callback'], + cu = tinyMCE.settings['convert_urls']; + if (cb) href = eval(cb + "(href, node, true);"); + + if (cu && href.match(new RegExp('^' + tinyMCE.settings['document_base_url'] + '(.*)$'))) { + href = RegExp.$1; + } + + if (href.match(/^javascript:\s*mctmp/)) href = ''; + + return href; + }, + + createBookmark: function createBookmark() { + return this.getInstance().selection.getBookmark(); + }, + + moveToBookmark: function moveToBookmark(bookmark) { + this.getInstance().selection.moveToBookmark(bookmark); + this.getInstance().focus(); + }, + + blur: function blur() { + this.getInstance().selection.collapse(); + }, + + addUndo: function addUndo() { + this.getInstance().undoManager.add(); + } + }; +}; + +ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; + +_jquery2.default.entwine('ss', function ($) { + $('textarea.htmleditor').entwine({ + + Editor: null, + + onadd: function onadd() { + var edClass = this.data('editor') || 'default', + ed = ss.editorWrappers[edClass](); + this.setEditor(ed); + + ed.init(this.attr('id')); + + this._super(); + }, + + onremove: function onremove() { + this.getEditor().destroy(); + this._super(); + }, + + 'from .cms-edit-form': { + onbeforesubmitform: function onbeforesubmitform() { + this.getEditor().save(); + this._super(); + } + }, + + openLinkDialog: function openLinkDialog() { + this.openDialog('link'); + }, + + openMediaDialog: function openMediaDialog() { + this.openDialog('media'); + }, + + openEmbedDialog: function openEmbedDialog() { + this.openDialog('embed'); + }, + + openDialog: function openDialog(type) { + if (type === 'media' && window.InsertMediaModal) { + var dialog = $('#insert-media-react__dialog-wrapper'); + + if (!dialog.length) { + dialog = $(''); + $('body').append(dialog); + } + + dialog.setElement(this); + dialog.open(); + return; + } + + if (type === 'embed' && window.InsertEmbedModal) { + var _dialog = $('#insert-embed-react__dialog-wrapper'); + + if (!_dialog.length) { + _dialog = $(''); + $('body').append(_dialog); + } + + _dialog.setElement(this); + _dialog.open(); + return; + } + + throw new Error('Dialog named ' + type + ' is not available.'); + } + }); +}); + +/***/ }), + +/***/ 776: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + $('.ss-tabset.ss-ui-action-tabset').entwine({ + IgnoreTabState: true, + + onadd: function onadd() { + this._super(); + + this.tabs({ 'collapsible': true, 'active': false }); + }, + + onremove: function onremove() { + var frame = $('.cms-container').find('iframe'); + frame.each(function (index, iframe) { + try { + $(iframe).contents().off('click.ss-ui-action-tabset'); + } catch (e) { + console.warn('Unable to access iframe, possible https mis-match'); + } + }); + $(document).off('click.ss-ui-action-tabset'); + + this._super(); + }, + + 'ontabsbeforeactivate': function ontabsbeforeactivate(event, ui) { + this.riseUp(event, ui); + }, + + onclick: function onclick(event, ui) { + this.attachCloseHandler(event, ui); + }, + + attachCloseHandler: function attachCloseHandler(event, ui) { + var that = this, + frame = $('.cms-container').find('iframe'), + _closeHandler; + + _closeHandler = function closeHandler(event) { + var panel, frame; + panel = $(event.target).closest('.ss-ui-action-tabset .ui-tabs-panel'); + + if (!$(event.target).closest(that).length && !panel.length) { + that.tabs('option', 'active', false); + frame = $('.cms-container').find('iframe'); + frame.each(function (index, iframe) { + $(iframe).contents().off('click.ss-ui-action-tabset', _closeHandler); + }); + $(document).off('click.ss-ui-action-tabset', _closeHandler); + } + }; + + $(document).on('click.ss-ui-action-tabset', _closeHandler); + + if (frame.length > 0) { + frame.each(function (index, iframe) { + $(iframe).contents().on('click.ss-ui-action-tabset', _closeHandler); + }); + } + }, + + riseUp: function riseUp(event, ui) { + var elHeight, trigger, endOfWindow, elPos, activePanel, activeTab, topPosition, containerSouth, padding; + + elHeight = $(this).find('.ui-tabs-panel').outerHeight(); + trigger = $(this).find('.ui-tabs-nav').outerHeight(); + endOfWindow = $(window).height() + $(document).scrollTop() - trigger; + elPos = $(this).find('.ui-tabs-nav').offset().top; + + activePanel = ui.newPanel; + activeTab = ui.newTab; + + if (elPos + elHeight >= endOfWindow && elPos - elHeight > 0) { + this.addClass('rise-up'); + + if (activeTab.position() !== null) { + topPosition = -activePanel.outerHeight(); + containerSouth = activePanel.parents('.toolbar--south'); + if (containerSouth) { + padding = activeTab.offset().top - containerSouth.offset().top; + topPosition = topPosition - padding; + } + $(activePanel).css('top', topPosition + "px"); + } + } else { + this.removeClass('rise-up'); + if (activeTab.position() !== null) { + $(activePanel).css('bottom', '100%'); + } + } + return false; + } + }); + + $('.cms-content-actions .ss-tabset.ss-ui-action-tabset').entwine({ + 'ontabsbeforeactivate': function ontabsbeforeactivate(event, ui) { + this._super(event, ui); + + if ($(ui.newPanel).length > 0) { + $(ui.newPanel).css('left', ui.newTab.position().left + "px"); + } + } + }); + + $('.cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({ + 'ontabsbeforeactivate': function ontabsbeforeactivate(event, ui) { + this._super(event, ui); + + $(this).closest('.ss-ui-action-tabset').removeClass('tabset-open tabset-open-last'); + } + }); + + $('.cms-content-fields .ss-tabset.ss-ui-action-tabset').entwine({ + 'ontabsbeforeactivate': function ontabsbeforeactivate(event, ui) { + this._super(event, ui); + if ($(ui.newPanel).length > 0) { + if ($(ui.newTab).hasClass("last")) { + $(ui.newPanel).css({ 'left': 'auto', 'right': '0px' }); + + $(ui.newPanel).parent().addClass('tabset-open-last'); + } else { + $(ui.newPanel).css('left', ui.newTab.position().left + "px"); + + if ($(ui.newTab).hasClass("first")) { + $(ui.newPanel).css('left', "0px"); + $(ui.newPanel).parent().addClass('tabset-open'); + } + } + } + } + }); + + $('.cms-tree-view-sidebar .cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({ + 'from .ui-tabs-nav li': { + onhover: function onhover(e) { + $(e.target).parent().find('li .active').removeClass('active'); + $(e.target).find('a').addClass('active'); + } + }, + + 'ontabsbeforeactivate': function ontabsbeforeactivate(event, ui) { + this._super(event, ui); + + $(ui.newPanel).css({ 'left': 'auto', 'right': 'auto' }); + + if ($(ui.newPanel).length > 0) { + $(ui.newPanel).parent().addClass('tabset-open'); + } + } + }); +}); + +/***/ }), + +/***/ 777: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(jQuery) { + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss.tree', function ($) { + $('#Form_BatchActionsForm').entwine({ + Actions: [], + + getTree: function getTree() { + return $('.cms-tree'); + }, + + fromTree: { + oncheck_node: function oncheck_node(e, data) { + this.serializeFromTree(); + }, + onuncheck_node: function onuncheck_node(e, data) { + this.serializeFromTree(); + } + }, + + onmatch: function onmatch() { + var self = this; + + self.getTree().bind('load_node.jstree', function (e, data) { + self.refreshSelected(); + }); + }, + + onunmatch: function onunmatch() { + var self = this; + + self.getTree().unbind('load_node.jstree'); + }, + + registerDefault: function registerDefault() { + this.register('publish', function (ids) { + var confirmed = confirm(_i18n2.default.inject(_i18n2.default._t("Admin.BATCH_PUBLISH_PROMPT", "You have {num} page(s) selected.\n\nDo you really want to publish?"), { 'num': ids.length })); + return confirmed ? ids : false; + }); + + this.register('unpublish', function (ids) { + var confirmed = confirm(_i18n2.default.inject(_i18n2.default._t("Admin.BATCH_UNPUBLISH_PROMPT", "You have {num} page(s) selected.\n\nDo you really want to unpublish"), { 'num': ids.length })); + return confirmed ? ids : false; + }); + + this.register('delete', function (ids) { + var confirmed = confirm(_i18n2.default.inject(_i18n2.default._t("Admin.BATCH_DELETE_PROMPT", "You have {num} page(s) selected.\n\nAre you sure you want to delete these pages?\n\nThese pages and all of their children pages will be deleted and sent to the archive."), { 'num': ids.length })); + return confirmed ? ids : false; + }); + + this.register('restore', function (ids) { + var confirmed = confirm(_i18n2.default.inject(_i18n2.default._t("Admin.BATCH_RESTORE_PROMPT", "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."), { 'num': ids.length })); + return confirmed ? ids : false; + }); + }, + + onadd: function onadd() { + this.registerDefault(); + this._super(); + }, + + register: function register(type, callback) { + this.trigger('register', { type: type, callback: callback }); + var actions = this.getActions(); + actions[type] = callback; + this.setActions(actions); + }, + + unregister: function unregister(type) { + this.trigger('unregister', { type: type }); + + var actions = this.getActions(); + if (actions[type]) delete actions[type]; + this.setActions(actions); + }, + + refreshSelected: function refreshSelected(rootNode) { + var self = this, + st = this.getTree(), + ids = this.getIDs(), + allIds = [], + viewMode = $('.cms-content-batchactions-button'), + actionUrl = this.find(':input[name=Action]').val(); + + if (rootNode == null) rootNode = st; + + for (var idx in ids) { + $($(st).getNodeByID(idx)).addClass('selected').attr('selected', 'selected'); + } + + if (!actionUrl || actionUrl == -1 || !viewMode.hasClass('active')) { + $(rootNode).find('li').each(function () { + $(this).setEnabled(true); + }); + return; + } + + $(rootNode).find('li').each(function () { + allIds.push($(this).data('id')); + $(this).addClass('treeloading').setEnabled(false); + }); + + var actionUrlParts = $.path.parseUrl(actionUrl); + var applicablePagesUrl = actionUrlParts.hrefNoSearch + '/applicablepages/'; + applicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, actionUrlParts.search); + applicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, { csvIDs: allIds.join(',') }); + jQuery.getJSON(applicablePagesUrl, function (applicableIDs) { + jQuery(rootNode).find('li').each(function () { + $(this).removeClass('treeloading'); + + var id = $(this).data('id'); + if (id == 0 || $.inArray(id, applicableIDs) >= 0) { + $(this).setEnabled(true); + } else { + $(this).removeClass('selected').setEnabled(false); + $(this).prop('selected', false); + } + }); + + self.serializeFromTree(); + }); + }, + + serializeFromTree: function serializeFromTree() { + var tree = this.getTree(), + ids = tree.getSelectedIDs(); + + this.setIDs(ids); + + return true; + }, + + setIDs: function setIDs(ids) { + this.find(':input[name=csvIDs]').val(ids ? ids.join(',') : null); + }, + + getIDs: function getIDs() { + var value = this.find(':input[name=csvIDs]').val(); + return value ? value.split(',') : []; + }, + + onsubmit: function onsubmit(e) { + var self = this, + ids = this.getIDs(), + tree = this.getTree(), + actions = this.getActions(); + + if (!ids || !ids.length) { + alert(_i18n2.default._t('Admin.SELECTONEPAGE', 'Please select at least one page')); + e.preventDefault(); + return false; + } + + var actionURL = this.find(':input[name=Action]').val(); + if (!actionURL) { + e.preventDefault(); + return false; + } + + var type = actionURL.split('/').filter(function (n) { + return !!n; + }).pop(); + if (actions[type]) { + ids = actions[type].apply(this, [ids]); + } + + if (!ids || !ids.length) { + e.preventDefault(); + return false; + } + + this.setIDs(ids); + + tree.find('li').removeClass('failed'); + + var button = this.find(':submit:first'); + button.addClass('loading'); + + jQuery.ajax({ + url: actionURL, + type: 'POST', + data: this.serializeArray(), + complete: function complete(xmlhttp, status) { + button.removeClass('loading'); + + tree.jstree('refresh', -1); + self.setIDs([]); + + self.find(':input[name=Action]').val('').change(); + + var msg = xmlhttp.getResponseHeader('X-Status'); + if (msg) statusMessage(decodeURIComponent(msg), status == 'success' ? 'good' : 'bad'); + }, + success: function success(data, status) { + var id, node; + + if (data.modified) { + var modifiedNodes = []; + for (id in data.modified) { + node = tree.getNodeByID(id); + tree.jstree('set_text', node, data.modified[id]['TreeTitle']); + modifiedNodes.push(node); + } + $(modifiedNodes).effect('highlight'); + } + if (data.deleted) { + for (id in data.deleted) { + node = tree.getNodeByID(id); + if (node.length) tree.jstree('delete_node', node); + } + } + if (data.error) { + for (id in data.error) { + node = tree.getNodeByID(id); + $(node).addClass('failed'); + } + } + }, + dataType: 'json' + }); + + e.preventDefault(); + return false; + } + + }); + + $('.cms-content-batchactions-button').entwine({ + onmatch: function onmatch() { + this._super(); + this.updateTree(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + onclick: function onclick(e) { + this.updateTree(); + }, + updateTree: function updateTree() { + var tree = $('.cms-tree'), + form = $('#Form_BatchActionsForm'); + + this._super(); + + if (this.data('active')) { + tree.addClass('multiple'); + tree.removeClass('draggable'); + form.serializeFromTree(); + } else { + tree.removeClass('multiple'); + tree.addClass('draggable'); + } + + $('#Form_BatchActionsForm').refreshSelected(); + } + }); + + $('#Form_BatchActionsForm select[name=Action]').entwine({ + onchange: function onchange(e) { + var form = $(e.target.form), + btn = form.find(':submit'), + selected = $(e.target).val(); + + $('#Form_BatchActionsForm').refreshSelected(); + + this.trigger("chosen:updated"); + + this._super(e); + } + }); +}); +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(27))) + +/***/ }), + +/***/ 778: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + $('.cms-content').entwine({ + + onadd: function onadd() { + var self = this; + + this.find('.cms-tabset').redrawTabs(); + this._super(); + }, + + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + + this.add(this.find('.cms-tabset')).redrawTabs(); + this.find('.cms-content-header').redraw(); + this.find('.cms-content-actions').redraw(); + } + }); + + $('.cms-content .cms-tree').entwine({ + onadd: function onadd() { + var self = this; + + this._super(); + + this.bind('select_node.jstree', function (e, data) { + var node = data.rslt.obj, + loadedNodeID = self.find(':input[name=ID]').val(), + origEvent = data.args[2], + container = $('.cms-container'); + + if (!origEvent) { + return false; + } + + if ($(node).hasClass('disabled')) return false; + + if ($(node).data('id') == loadedNodeID) return; + + var url = $(node).find('a:first').attr('href'); + if (url && url != '#') { + url = url.split('?')[0]; + + self.jstree('deselect_all'); + self.jstree('uncheck_all'); + + if ($.path.isExternal($(node).find('a:first'))) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href')); + + if (document.location.search) url = $.path.addSearchParams(url, document.location.search.replace(/^\?/, '')); + + container.loadPanel(url); + } else { + self.removeForm(); + } + }); + } + }); + + $('.cms-content .cms-content-fields').entwine({ + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + } + }); + + $('.cms-content .cms-content-header, .cms-content .cms-content-actions').entwine({ + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + + this.height('auto'); + this.height(this.innerHeight() - this.css('padding-top') - this.css('padding-bottom')); + } + }); +}); + +/***/ }), + +/***/ 779: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(jQuery) { + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var currBeforeUnload = window.onbeforeunload; + +window.onbeforeunload = function (e) { + var form = (0, _jQuery2.default)('.cms-edit-form'); + form.trigger('beforesubmitform'); + if (form.is('.changed') && !form.is('.discardchanges')) { + return _i18n2.default._t('Admin.CONFIRMUNSAVEDSHORT'); + } + + if (typeof currBeforeUnload === 'function') { + return currBeforeUnload(); + } + + return undefined; +}; + +_jQuery2.default.entwine('ss', function ($) { + $('.cms-edit-form').entwine({ + PlaceholderHtml: '', + + ChangeTrackerOptions: { + ignoreFieldSelector: '.no-change-track, .ss-upload :input, .cms-navigator :input' + }, + + ValidationErrorShown: false, + + onadd: function onadd() { + var self = this; + + this.attr("autocomplete", "off"); + + this._setupChangeTracker(); + + for (var overrideAttr in { 'action': true, 'method': true, 'enctype': true, 'name': true }) { + var el = this.find(':input[name=' + '_form_' + overrideAttr + ']'); + if (el) { + this.attr(overrideAttr, el.val()); + el.remove(); + } + } + + this.setValidationErrorShown(false); + + this._super(); + }, + 'from .cms-tabset': { + onafterredrawtabs: function onafterredrawtabs() { + if (this.hasClass('validationerror')) { + var tabError = this.find('.message.validation, .message.required').first().closest('.tab'); + $('.cms-container').clearCurrentTabState(); + var $tabSet = tabError.closest('.ss-tabset'); + + if (!$tabSet.length) { + $tabSet = tabError.closest('.cms-tabset'); + } + + if ($tabSet.length) { + $tabSet.tabs('option', 'active', tabError.index('.tab')); + } else if (!this.getValidationErrorShown()) { + this.setValidationErrorShown(true); + errorMessage(ss.i18n._t('Admin.VALIDATIONERROR', 'Validation Error')); + } + } + } + }, + onremove: function onremove() { + this.changetracker('destroy'); + this._super(); + }, + onmatch: function onmatch() { + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + redraw: function redraw() { + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + + this.add(this.find('.cms-tabset')).redrawTabs(); + this.find('.cms-content-header').redraw(); + }, + + _setupChangeTracker: function _setupChangeTracker() { + this.changetracker(this.getChangeTrackerOptions()); + }, + + confirmUnsavedChanges: function confirmUnsavedChanges() { + this.trigger('beforesubmitform'); + if (!this.is('.changed') || this.is('.discardchanges')) { + return true; + } + if (this.find('.btn-toolbar :submit.btn--loading.loading').length > 0) { + return true; + } + var confirmed = confirm(_i18n2.default._t('Admin.CONFIRMUNSAVED')); + if (confirmed) { + this.addClass('discardchanges'); + } + return confirmed; + }, + + onsubmit: function onsubmit(e, button) { + if (this.prop("target") != "_blank") { + if (button) this.closest('.cms-container').submitForm(this, button); + return false; + } + }, + + validate: function validate() { + var isValid = true; + this.trigger('validate', { isValid: isValid }); + + return isValid; + }, + + 'from .htmleditor': { + oneditorinit: function oneditorinit(e) { + var self = this, + field = $(e.target).closest('.field.htmleditor'), + editor = field.find('textarea.htmleditor').getEditor().getInstance(); + + editor.onClick.add(function (e) { + self.saveFieldFocus(field.attr('id')); + }); + } + }, + + 'from .cms-edit-form :input:not(:submit)': { + onclick: function onclick(e) { + this.saveFieldFocus($(e.target).attr('id')); + }, + onfocus: function onfocus(e) { + this.saveFieldFocus($(e.target).attr('id')); + } + }, + + 'from .cms-edit-form .treedropdown *': { + onfocusin: function onfocusin(e) { + var field = $(e.target).closest('.field.treedropdown'); + this.saveFieldFocus(field.attr('id')); + } + }, + + 'from .cms-edit-form .dropdown .chosen-container a': { + onfocusin: function onfocusin(e) { + var field = $(e.target).closest('.field.dropdown'); + this.saveFieldFocus(field.attr('id')); + } + }, + + 'from .cms-container': { + ontabstaterestored: function ontabstaterestored(e) { + this.restoreFieldFocus(); + } + }, + + saveFieldFocus: function saveFieldFocus(selected) { + if (typeof window.sessionStorage == "undefined" || window.sessionStorage === null) return; + + var id = $(this).attr('id'), + focusElements = []; + + focusElements.push({ + id: id, + selected: selected + }); + + if (focusElements) { + try { + window.sessionStorage.setItem(id, JSON.stringify(focusElements)); + } catch (err) { + if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) { + return; + } else { + throw err; + } + } + } + }, + + restoreFieldFocus: function restoreFieldFocus() { + if (typeof window.sessionStorage == "undefined" || window.sessionStorage === null) return; + + var self = this, + hasSessionStorage = typeof window.sessionStorage !== "undefined" && window.sessionStorage, + sessionData = hasSessionStorage ? window.sessionStorage.getItem(this.attr('id')) : null, + sessionStates = sessionData ? JSON.parse(sessionData) : false, + elementID, + tabbed = this.find('.ss-tabset').length !== 0, + activeTab, + elementTab, + toggleComposite, + scrollY; + + if (hasSessionStorage && sessionStates.length > 0) { + $.each(sessionStates, function (i, sessionState) { + if (self.is('#' + sessionState.id)) { + elementID = $('#' + sessionState.selected); + } + }); + + if ($(elementID).length < 1) { + this.focusFirstInput(); + return; + } + + activeTab = $(elementID).closest('.ss-tabset').find('.ui-tabs-nav .ui-tabs-active .ui-tabs-anchor').attr('id'); + elementTab = 'tab-' + $(elementID).closest('.ss-tabset .ui-tabs-panel').attr('id'); + + if (tabbed && elementTab !== activeTab) { + return; + } + + toggleComposite = $(elementID).closest('.togglecomposite'); + + if (toggleComposite.length > 0) { + toggleComposite.accordion('activate', toggleComposite.find('.ui-accordion-header')); + } + + scrollY = $(elementID).position().top; + + if (!$(elementID).is(':visible')) { + elementID = '#' + $(elementID).closest('.field').attr('id'); + scrollY = $(elementID).position().top; + } + + $(elementID).focus(); + + if (scrollY > $(window).height() / 2) { + self.find('.cms-content-fields').scrollTop(scrollY); + } + } else { + this.focusFirstInput(); + } + }, + + focusFirstInput: function focusFirstInput() { + this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(':visible:first').focus(); + } + }); + + $('.cms-edit-form .btn-toolbar input.action[type=submit], .cms-edit-form .btn-toolbar button.action').entwine({ + onclick: function onclick(e) { + if (this.is(':disabled')) { + e.preventDefault(); + return false; + } + + if (this._super(e) !== false && !e.defaultPrevented && !e.isDefaultPrevented()) { + this.parents('form').trigger('submit', [this]); + e.preventDefault(); + return false; + } + } + }); + + $('.cms-edit-form .btn-toolbar input.action[type=submit].ss-ui-action-cancel, .cms-edit-form .btn-toolbar button.action.ss-ui-action-cancel').entwine({ + onclick: function onclick(e) { + if (window.history.length > 1) { + window.history.back(); + } else { + this.parents('form').trigger('submit', [this]); + } + e.preventDefault(); + } + }); + + $('.cms-edit-form .ss-tabset').entwine({ + onmatch: function onmatch() { + if (!this.hasClass('ss-ui-action-tabset')) { + var tabs = this.find("> ul:first"); + + if (tabs.children("li").length == 1) { + tabs.hide().parent().addClass("ss-tabset-tabshidden"); + } + } + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + + $('.cms-edit-form [name="CanViewType"], ' + '.cms-edit-form [name="CanEditType"], ' + '.cms-edit-form [name="CanCreateTopLevelType"]').entwine({ + onmatch: function onmatch() { + if (this.val() === 'OnlyTheseUsers') { + if (this.is(':checked')) { + this.showList(true); + } else { + this.hideList(true); + } + } + }, + onchange: function onchange(e) { + if (e.target.value === 'OnlyTheseUsers') { + this.showList(); + } else { + this.hideList(); + } + }, + showList: function showList(instant) { + var holder = this.closest('.field'); + var list = holder.next().filter('.listbox'); + holder.addClass('field--merge-below'); + if (instant) { + list.show().css('overflow', 'visible'); + } else { + list.slideDown(function () { + list.css('overflow', 'visible'); + }); + } + }, + hideList: function hideList(instant) { + var holder = this.closest('.field'); + var list = holder.next().filter('.listbox'); + list.css('overflow', 'hidden'); + if (instant) { + list.hide().css('display', 'none'); + holder.removeClass('field--merge-below'); + } else { + list.slideUp(function () { + holder.removeClass('field--merge-below'); + }); + } + } + }); +}); + +var errorMessage = function errorMessage(text) { + jQuery.noticeAdd({ text: text, type: 'error', stayTime: 5000, inEffect: { left: '0', opacity: 'show' } }); +}; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(27))) + +/***/ }), + +/***/ 780: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + + $('.cms-description-toggle').entwine({ + onadd: function onadd() { + var shown = false, + fieldId = this.prop('id').substr(0, this.prop('id').indexOf('_Holder')), + $trigger = this.find('.cms-description-trigger'), + $description = this.find('.description'); + + if (this.hasClass('description-toggle-enabled')) { + return; + } + + if ($trigger.length === 0) { + $trigger = this.find('.middleColumn').first().after('').next(); + } + + this.addClass('description-toggle-enabled'); + + $trigger.on('click', function () { + $description[shown ? 'hide' : 'show'](); + shown = !shown; + }); + + $description.hide(); + } + }); +}); + +/***/ }), + +/***/ 781: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + $(".cms .field.cms-description-tooltip").entwine({ + onmatch: function onmatch() { + this._super(); + + var descriptionEl = this.find('.description'), + inputEl, + tooltipEl; + if (descriptionEl.length) { + this.attr('title', descriptionEl.text()).tooltip({ content: descriptionEl.html() }); + descriptionEl.remove(); + } + } + }); + + $(".cms .field.cms-description-tooltip :input").entwine({ + onfocusin: function onfocusin(e) { + this.closest('.field').tooltip('open'); + }, + onfocusout: function onfocusout(e) { + this.closest('.field').tooltip('close'); + } + }); +}); + +/***/ }), + +/***/ 782: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + $('.cms-panel.cms-menu').entwine({ + + togglePanel: function togglePanel(doExpand, silent, doSaveState) { + $('.cms-menu__list').children('li').each(function () { + if (doExpand) { + $(this).children('ul').each(function () { + $(this).removeClass('collapsed-flyout'); + if ($(this).data('collapse')) { + $(this).removeData('collapse'); + $(this).addClass('collapse'); + } + }); + } else { + $(this).children('ul').each(function () { + $(this).addClass('collapsed-flyout'); + $(this).hasClass('collapse'); + $(this).removeClass('collapse'); + $(this).data('collapse', true); + }); + } + }); + + this.toggleFlyoutState(doExpand); + + this._super(doExpand, silent, doSaveState); + }, + toggleFlyoutState: function toggleFlyoutState(bool) { + if (bool) { + $('.collapsed').find('li').show(); + + $('.cms-menu__list').find('.child-flyout-indicator').hide(); + } else { + $('.collapsed-flyout').find('li').each(function () { + $(this).hide(); + }); + + var par = $('.cms-menu__list ul.collapsed-flyout').parent(); + if (par.children('.child-flyout-indicator').length === 0) par.append('').fadeIn(); + par.children('.child-flyout-indicator').fadeIn(); + } + }, + siteTreePresent: function siteTreePresent() { + return $('#cms-content-tools-CMSMain').length > 0; + }, + + getPersistedStickyState: function getPersistedStickyState() { + var persistedState, cookieValue; + + if ($.cookie !== void 0) { + cookieValue = $.cookie('cms-menu-sticky'); + + if (cookieValue !== void 0 && cookieValue !== null) { + persistedState = cookieValue === 'true'; + } + } + + return persistedState; + }, + + setPersistedStickyState: function setPersistedStickyState(isSticky) { + if ($.cookie !== void 0) { + $.cookie('cms-menu-sticky', isSticky, { path: '/', expires: 31 }); + } + }, + + getEvaluatedCollapsedState: function getEvaluatedCollapsedState() { + var shouldCollapse, + manualState = this.getPersistedCollapsedState(), + menuIsSticky = $('.cms-menu').getPersistedStickyState(), + automaticState = this.siteTreePresent(); + + if (manualState === void 0) { + shouldCollapse = automaticState; + } else if (manualState !== automaticState && menuIsSticky) { + shouldCollapse = manualState; + } else { + shouldCollapse = automaticState; + } + + return shouldCollapse; + }, + + onadd: function onadd() { + var self = this; + + setTimeout(function () { + self.togglePanel(!self.getEvaluatedCollapsedState(), false, false); + }, 0); + + $(window).on('ajaxComplete', function (e) { + setTimeout(function () { + self.togglePanel(!self.getEvaluatedCollapsedState(), false, false); + }, 0); + }); + + this._super(); + } + }); + + $('.cms-menu__list').entwine({ + onmatch: function onmatch() { + var self = this; + + this.find('li.current').select(); + + this.updateItems(); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + + updateMenuFromResponse: function updateMenuFromResponse(xhr) { + var controller = xhr.getResponseHeader('X-Controller'); + if (controller) { + var item = this.find('li#Menu-' + controller.replace(/\\/g, '-').replace(/[^a-zA-Z0-9\-_:.]+/, '')); + if (!item.hasClass('current')) item.select(); + } + this.updateItems(); + }, + + 'from .cms-container': { + onafterstatechange: function onafterstatechange(e, data) { + this.updateMenuFromResponse(data.xhr); + }, + onaftersubmitform: function onaftersubmitform(e, data) { + this.updateMenuFromResponse(data.xhr); + } + }, + + 'from .cms-edit-form': { + onrelodeditform: function onrelodeditform(e, data) { + this.updateMenuFromResponse(data.xmlhttp); + } + }, + + getContainingPanel: function getContainingPanel() { + return this.closest('.cms-panel'); + }, + + fromContainingPanel: { + ontoggle: function ontoggle(e) { + this.toggleClass('collapsed', $(e.target).hasClass('collapsed')); + + $('.cms-container').trigger('windowresize'); + + if (this.hasClass('collapsed')) this.find('li.children.opened').removeClass('opened'); + + if (!this.hasClass('collapsed')) { + $('.toggle-children.opened').closest('li').addClass('opened'); + } + } + }, + + updateItems: function updateItems() { + var editPageItem = this.find('#Menu-CMSMain'); + + editPageItem[editPageItem.is('.current') ? 'show' : 'hide'](); + + var currentID = $('.cms-content input[name=ID]').val(); + if (currentID) { + this.find('li').each(function () { + if ($.isFunction($(this).setRecordID)) $(this).setRecordID(currentID); + }); + } + } + }); + + $('.cms-menu__list li').entwine({ + toggleFlyout: function toggleFlyout(bool) { + var fly = $(this); + + if (fly.children('ul').first().hasClass('collapsed-flyout')) { + if (bool) { + if (!fly.children('ul').first().children('li').first().hasClass('clone')) { + + var li = fly.clone(); + li.addClass('clone').css({}); + + li.children('ul').first().remove(); + + li.find('span').not('.text').remove(); + + li.find('a').first().unbind('click'); + + fly.children('ul').prepend(li); + } + + $('.collapsed-flyout').show(); + fly.addClass('opened'); + fly.children('ul').find('li').fadeIn('fast'); + } else { + if (li) { + li.remove(); + } + $('.collapsed-flyout').hide(); + fly.removeClass('opened'); + fly.find('toggle-children').removeClass('opened'); + fly.children('ul').find('li').hide(); + } + } + } + }); + + $('.cms-menu__list li').hoverIntent(function () { + $(this).toggleFlyout(true); + }, function () { + $(this).toggleFlyout(false); + }); + + $('.cms-menu__list .toggle').entwine({ + onclick: function onclick(e) { + e.preventDefault(); + $(this).toogleFlyout(true); + } + }); + + $('.cms-menu__list li').entwine({ + onmatch: function onmatch() { + if (this.find('ul').length) { + this.find('a:first').append(''); + } + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + toggle: function toggle() { + this[this.hasClass('opened') ? 'close' : 'open'](); + }, + + open: function open() { + var parent = this.getMenuItem(); + if (parent) parent.open(); + if (this.find('li.clone')) { + this.find('li.clone').remove(); + } + this.addClass('opened').find('ul').show(); + this.find('.toggle-children').addClass('opened'); + }, + close: function close() { + this.removeClass('opened').find('ul').hide(); + this.find('.toggle-children').removeClass('opened'); + }, + select: function select() { + var parent = this.getMenuItem(); + this.addClass('current').open(); + + this.siblings().removeClass('current').close(); + this.siblings().find('li').removeClass('current'); + if (parent) { + var parentSiblings = parent.siblings(); + parent.addClass('current'); + parentSiblings.removeClass('current').close(); + parentSiblings.find('li').removeClass('current').close(); + } + + this.getMenu().updateItems(); + + this.trigger('select'); + } + }); + + $('.cms-menu__list *').entwine({ + getMenu: function getMenu() { + return this.parents('.cms-menu__list:first'); + } + }); + + $('.cms-menu__list li *').entwine({ + getMenuItem: function getMenuItem() { + return this.parents('li:first'); + } + }); + + $('.cms-menu__list li a').entwine({ + onclick: function onclick(e) { + var isExternal = $.path.isExternal(this.attr('href')); + if (e.which > 1 || isExternal) return; + + if (this.attr('target') == "_blank") { + return; + } + + e.preventDefault(); + + var item = this.getMenuItem(); + + var url = this.attr('href'); + if (!isExternal) url = $('base').attr('href') + url; + + var children = item.find('li'); + if (children.length) { + children.first().find('a').click(); + } else { + document.location.href = url; + } + + item.select(); + } + }); + + $('.cms-menu__list li .toggle-children').entwine({ + onclick: function onclick(e) { + var li = this.closest('li'); + li.toggle(); + return false; + } + }); + + $('.cms .profile-link').entwine({ + onclick: function onclick() { + $('.cms-container').loadPanel(this.attr('href')); + $('.cms-menu__list li').removeClass('current').close(); + return false; + } + }); + + $('.cms-menu .sticky-toggle').entwine({ + + onadd: function onadd() { + var isSticky = $('.cms-menu').getPersistedStickyState() ? true : false; + + this.toggleCSS(isSticky); + this.toggleIndicator(isSticky); + + this._super(); + }, + + toggleCSS: function toggleCSS(isSticky) { + this[isSticky ? 'addClass' : 'removeClass']('active'); + }, + + toggleIndicator: function toggleIndicator(isSticky) { + this.next('.sticky-status-indicator').text(isSticky ? 'fixed' : 'auto'); + }, + + onclick: function onclick() { + var $menu = this.closest('.cms-menu'), + persistedCollapsedState = $menu.getPersistedCollapsedState(), + persistedStickyState = $menu.getPersistedStickyState(), + newStickyState = persistedStickyState === void 0 ? !this.hasClass('active') : !persistedStickyState; + + if (persistedCollapsedState === void 0) { + $menu.setPersistedCollapsedState($menu.hasClass('collapsed')); + } else if (persistedCollapsedState !== void 0 && newStickyState === false) { + $menu.clearPersistedCollapsedState(); + } + + $menu.setPersistedStickyState(newStickyState); + + this.toggleCSS(newStickyState); + this.toggleIndicator(newStickyState); + + this._super(); + } + }); +}); + +/***/ }), + +/***/ 783: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _MobileMenuToggleContainer = __webpack_require__(933); + +var _MobileMenuToggleContainer2 = _interopRequireDefault(_MobileMenuToggleContainer); + +var _MobileMenuActions = __webpack_require__(412); + +var _reactDom = __webpack_require__(26); + +var _reactDom2 = _interopRequireDefault(_reactDom); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + + $('.js-react-boot').entwine({ + + onmatch: function onmatch() { + var menuToggleWrapper = $('.cms-mobile-menu-toggle-wrapper'); + if (menuToggleWrapper.length > 0) { + _reactDom2.default.render(React.createElement(_MobileMenuToggleContainer2.default, { store: window.ss.store, controls: 'cms-menu' }), menuToggleWrapper[0]); + } + + var store = window.ss.store; + var menu = $('.cms-menu'); + var menuOverlay = $('.cms-menu-mobile-overlay'); + store.subscribe(function () { + var state = store.getState(); + var isOpen = state.mobileMenu.isOpen; + menu.toggleClass('cms-menu--open', isOpen).attr('aria-expanded', isOpen); + menuOverlay.attr('aria-expanded', isOpen); + }); + } + }); + + $('.cms-menu-mobile-overlay').entwine({ + onclick: function onclick() { + var store = window.ss.store; + + store.dispatch((0, _MobileMenuActions.closeMobileMenu)()); + } + }); +}); + +/***/ }), + +/***/ 784: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + $.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE; + + $('.cms-panel').entwine({ + + WidthExpanded: null, + + WidthCollapsed: null, + + canSetCookie: function canSetCookie() { + return $.cookie !== void 0 && this.attr('id') !== void 0; + }, + + getPersistedCollapsedState: function getPersistedCollapsedState() { + var isCollapsed, cookieValue; + + if (this.canSetCookie()) { + cookieValue = $.cookie('cms-panel-collapsed-' + this.attr('id')); + + if (cookieValue !== void 0 && cookieValue !== null) { + isCollapsed = cookieValue === 'true'; + } + } + + return isCollapsed; + }, + + setPersistedCollapsedState: function setPersistedCollapsedState(newState) { + if (this.canSetCookie()) { + $.cookie('cms-panel-collapsed-' + this.attr('id'), newState, { path: '/', expires: 31 }); + } + }, + + clearPersistedCollapsedState: function clearPersistedCollapsedState() { + if (this.canSetCookie()) { + $.cookie('cms-panel-collapsed-' + this.attr('id'), '', { path: '/', expires: -1 }); + } + }, + + getInitialCollapsedState: function getInitialCollapsedState() { + var isCollapsed = this.getPersistedCollapsedState(); + + if (isCollapsed === void 0) { + isCollapsed = this.hasClass('collapsed'); + } + + return isCollapsed; + }, + + onadd: function onadd() { + var collapsedContent, container; + + if (!this.find('.cms-panel-content').length) throw new Exception('Content panel for ".cms-panel" not found'); + + if (!this.find('.cms-panel-toggle').length) { + container = $("").append('»').append('«'); + + this.append(container); + } + + this.setWidthExpanded(this.find('.cms-panel-content').innerWidth()); + + collapsedContent = this.find('.cms-panel-content-collapsed'); + this.setWidthCollapsed(collapsedContent.length ? collapsedContent.innerWidth() : this.find('.toggle-expand').innerWidth()); + + this.togglePanel(!this.getInitialCollapsedState(), true, false); + + this._super(); + }, + + togglePanel: function togglePanel(doExpand, silent, doSaveState) { + var newWidth, collapsedContent; + + if (!silent) { + this.trigger('beforetoggle.sspanel', doExpand); + this.trigger(doExpand ? 'beforeexpand' : 'beforecollapse'); + } + + this.toggleClass('collapsed', !doExpand); + newWidth = doExpand ? this.getWidthExpanded() : this.getWidthCollapsed(); + + this.width(newWidth); + collapsedContent = this.find('.cms-panel-content-collapsed'); + if (collapsedContent.length) { + this.find('.cms-panel-content')[doExpand ? 'show' : 'hide'](); + this.find('.cms-panel-content-collapsed')[doExpand ? 'hide' : 'show'](); + } + + if (doSaveState !== false) { + this.setPersistedCollapsedState(!doExpand); + } + + this.trigger('toggle', doExpand); + this.trigger(doExpand ? 'expand' : 'collapse'); + }, + + expandPanel: function expandPanel(force) { + if (!force && !this.hasClass('collapsed')) return; + + this.togglePanel(true); + }, + + collapsePanel: function collapsePanel(force) { + if (!force && this.hasClass('collapsed')) return; + + this.togglePanel(false); + } + }); + + $('.cms-panel.collapsed .cms-panel-toggle').entwine({ + onclick: function onclick(e) { + this.expandPanel(); + e.preventDefault(); + } + }); + + $('.cms-panel *').entwine({ + getPanel: function getPanel() { + return this.parents('.cms-panel:first'); + } + }); + + $('.cms-panel .toggle-expand').entwine({ + onclick: function onclick(e) { + e.preventDefault(); + e.stopPropagation(); + + this.getPanel().expandPanel(); + + this._super(e); + } + }); + + $('.cms-panel .toggle-collapse').entwine({ + onclick: function onclick(e) { + e.preventDefault(); + e.stopPropagation(); + + this.getPanel().collapsePanel(); + + this._super(e); + } + }); + + $('.cms-content-tools.collapsed').entwine({ + onclick: function onclick(e) { + this.expandPanel(); + this._super(e); + } + }); +}); + +/***/ }), + +/***/ 785: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss.preview', function ($) { + $('.cms-preview').entwine({ + AllowedStates: ['StageLink', 'LiveLink', 'ArchiveLink'], + + CurrentStateName: null, + + CurrentSizeName: 'auto', + + IsPreviewEnabled: false, + + DefaultMode: 'split', + + Sizes: { + auto: { + width: '100%', + height: '100%' + }, + mobile: { + width: '335px', + height: '568px' + }, + mobileLandscape: { + width: '583px', + height: '320px' + }, + tablet: { + width: '783px', + height: '1024px' + }, + tabletLandscape: { + width: '1039px', + height: '768px' + }, + desktop: { + width: '1024px', + height: '800px' + } + }, + + changeState: function changeState(stateName, save) { + var self = this, + states = this._getNavigatorStates(); + if (save !== false) { + $.each(states, function (index, state) { + self.saveState('state', stateName); + }); + } + + this.setCurrentStateName(stateName); + this._loadCurrentState(); + this.redraw(); + + return this; + }, + + changeMode: function changeMode(modeName, save) { + var container = $('.cms-container').entwine('.ss'); + + if (modeName == 'split') { + container.splitViewMode(); + this.setIsPreviewEnabled(true); + this._loadCurrentState(); + } else if (modeName == 'content') { + container.contentViewMode(); + this.setIsPreviewEnabled(false); + } else if (modeName == 'preview') { + container.previewMode(); + this.setIsPreviewEnabled(true); + this._loadCurrentState(); + } else { + throw 'Invalid mode: ' + modeName; + } + + if (save !== false) this.saveState('mode', modeName); + + this.redraw(); + + return this; + }, + + changeSize: function changeSize(sizeName) { + var sizes = this.getSizes(); + + this.setCurrentSizeName(sizeName); + this.removeClass('auto desktop tablet mobile').addClass(sizeName); + + this.saveState('size', sizeName); + + this.redraw(); + + return this; + }, + + redraw: function redraw() { + + if (window.debug) console.log('redraw', this.attr('class'), this.get(0)); + + var currentStateName = this.getCurrentStateName(); + if (currentStateName) { + this.find('.cms-preview-states').changeVisibleState(currentStateName); + } + + var layoutOptions = $('.cms-container').entwine('.ss').getLayoutOptions(); + if (layoutOptions) { + $('.preview-mode-selector').changeVisibleMode(layoutOptions.mode); + } + + var currentSizeName = this.getCurrentSizeName(); + if (currentSizeName) { + this.find('.preview-size-selector').changeVisibleSize(this.getCurrentSizeName()); + } + + return this; + }, + + saveState: function saveState(name, value) { + if (this._supportsLocalStorage()) window.localStorage.setItem('cms-preview-state-' + name, value); + }, + + loadState: function loadState(name) { + if (this._supportsLocalStorage()) return window.localStorage.getItem('cms-preview-state-' + name); + }, + + disablePreview: function disablePreview() { + this.setPendingURL(null); + this._loadUrl('about:blank'); + this._block(); + this.changeMode('content', false); + this.setIsPreviewEnabled(false); + return this; + }, + + enablePreview: function enablePreview() { + if (!this.getIsPreviewEnabled()) { + this.setIsPreviewEnabled(true); + + if ($.browser.msie && $.browser.version.slice(0, 3) <= 7) { + this.changeMode('content'); + } else { + this.changeMode(this.getDefaultMode(), false); + } + } + return this; + }, + + getOrAppendFontFixStyleElement: function getOrAppendFontFixStyleElement() { + var style = $('#FontFixStyleElement'); + if (!style.length) { + style = $('').appendTo('head'); + } + + return style; + }, + + onadd: function onadd() { + var self = this, + iframe = this.find('iframe'); + + iframe.addClass('center'); + iframe.bind('load', function () { + self._adjustIframeForPreview(); + + self._loadCurrentPage(); + + $(this).removeClass('loading'); + }); + + if ($.browser.msie && 8 === parseInt($.browser.version, 10)) { + iframe.bind('readystatechange', function (e) { + if (iframe[0].readyState == 'interactive') { + self.getOrAppendFontFixStyleElement().removeAttr('disabled'); + setTimeout(function () { + self.getOrAppendFontFixStyleElement().attr('disabled', 'disabled'); + }, 0); + } + }); + } + + this._unblock(); + + this.disablePreview(); + + this._super(); + }, + + _supportsLocalStorage: function _supportsLocalStorage() { + var uid = new Date(); + var storage; + var result; + try { + (storage = window.localStorage).setItem(uid, uid); + result = storage.getItem(uid) == uid; + storage.removeItem(uid); + return result && storage; + } catch (exception) { + console.warn('localStorge is not available due to current browser / system settings.'); + } + }, + + onforcecontent: function onforcecontent() { + this.changeMode('content', false); + }, + + onenable: function onenable() { + var $viewModeSelector = $('.preview-mode-selector'); + + $viewModeSelector.removeClass('split-disabled'); + $viewModeSelector.find('.disabled-tooltip').hide(); + }, + + ondisable: function ondisable() { + var $viewModeSelector = $('.preview-mode-selector'); + + $viewModeSelector.addClass('split-disabled'); + $viewModeSelector.find('.disabled-tooltip').show(); + }, + + _block: function _block() { + this.find('.preview-note').show(); + this.find('.cms-preview-overlay').show(); + return this; + }, + + _unblock: function _unblock() { + this.find('.preview-note').hide(); + this.find('.cms-preview-overlay').hide(); + return this; + }, + + _initialiseFromContent: function _initialiseFromContent() { + var mode, size; + + if (!$('.cms-previewable').length) { + this.disablePreview(); + } else { + mode = this.loadState('mode'); + size = this.loadState('size'); + + this._moveNavigator(); + if (!mode || mode != 'content') { + this.enablePreview(); + this._loadCurrentState(); + } + this.redraw(); + + if (mode) this.changeMode(mode); + if (size) this.changeSize(size); + } + return this; + }, + + 'from .cms-container': { + onafterstatechange: function onafterstatechange(e, data) { + if (data.xhr.getResponseHeader('X-ControllerURL')) return; + + this._initialiseFromContent(); + } + }, + + PendingURL: null, + + oncolumnvisibilitychanged: function oncolumnvisibilitychanged() { + var url = this.getPendingURL(); + if (url && !this.is('.column-hidden')) { + this.setPendingURL(null); + this._loadUrl(url); + this._unblock(); + } + }, + + 'from .cms-container .cms-edit-form': { + onaftersubmitform: function onaftersubmitform() { + this._initialiseFromContent(); + } + }, + + _loadUrl: function _loadUrl(url) { + this.find('iframe').addClass('loading').attr('src', url); + return this; + }, + + _getNavigatorStates: function _getNavigatorStates() { + var urlMap = $.map(this.getAllowedStates(), function (name) { + var stateLink = $('.cms-preview-states .state-name[data-name=' + name + ']'); + if (stateLink.length) { + return { + name: name, + url: stateLink.attr('href'), + active: stateLink.hasClass('active') + }; + } else { + return null; + } + }); + + return urlMap; + }, + + _loadCurrentState: function _loadCurrentState() { + if (!this.getIsPreviewEnabled()) return this; + + var states = this._getNavigatorStates(); + var currentStateName = this.getCurrentStateName(); + var currentState = null; + + if (states) { + currentState = $.grep(states, function (state, index) { + return currentStateName === state.name || !currentStateName && state.active; + }); + } + + var url = null; + + if (currentState[0]) { + url = currentState[0].url; + } else if (states.length) { + this.setCurrentStateName(states[0].name); + url = states[0].url; + } else { + this.setCurrentStateName(null); + } + + if (url) { + url += (url.indexOf('?') === -1 ? '?' : '&') + 'CMSPreview=1'; + } + + if (this.is('.column-hidden')) { + this.setPendingURL(url); + this._loadUrl('about:blank'); + this._block(); + } else { + this.setPendingURL(null); + + if (url) { + this._loadUrl(url); + this._unblock(); + } else { + this._block(); + } + } + + return this; + }, + + _moveNavigator: function _moveNavigator() { + var previewEl = $('.cms-preview .cms-preview-controls'); + var navigatorEl = $('.cms-edit-form .cms-navigator'); + + if (navigatorEl.length && previewEl.length) { + previewEl.html($('.cms-edit-form .cms-navigator').detach()); + } else { + this._block(); + } + }, + + _loadCurrentPage: function _loadCurrentPage() { + if (!this.getIsPreviewEnabled()) return; + + var doc, + containerEl = $('.cms-container'); + try { + doc = this.find('iframe')[0].contentDocument; + } catch (e) { + console.warn('Unable to access iframe, possible https mis-match'); + } + if (!doc) { + return; + } + + var id = $(doc).find('meta[name=x-page-id]').attr('content'); + var editLink = $(doc).find('meta[name=x-cms-edit-link]').attr('content'); + var contentPanel = $('.cms-content'); + + if (id && contentPanel.find(':input[name=ID]').val() != id) { + $('.cms-container').entwine('.ss').loadPanel(editLink); + } + }, + + _adjustIframeForPreview: function _adjustIframeForPreview() { + var iframe = this.find('iframe')[0], + doc; + if (!iframe) { + return; + } + + try { + doc = iframe.contentDocument; + } catch (e) { + console.warn('Unable to access iframe, possible https mis-match'); + } + if (!doc) { + return; + } + + var links = doc.getElementsByTagName('A'); + for (var i = 0; i < links.length; i++) { + var href = links[i].getAttribute('href'); + if (!href) continue; + + if (href.match(/^http:\/\//)) links[i].setAttribute('target', '_blank'); + } + + var navi = doc.getElementById('SilverStripeNavigator'); + if (navi) navi.style.display = 'none'; + var naviMsg = doc.getElementById('SilverStripeNavigatorMessage'); + if (naviMsg) naviMsg.style.display = 'none'; + + this.trigger('afterIframeAdjustedForPreview', [doc]); + } + }); + + $('.cms-edit-form').entwine({ + onadd: function onadd() { + this._super(); + $('.cms-preview')._initialiseFromContent(); + } + }); + + $('.cms-preview-states').entwine({ + changeVisibleState: function changeVisibleState(state) { + this.find('[data-name="' + state + '"]').addClass('active').siblings().removeClass('active'); + } + }); + + $('.cms-preview-states .state-name').entwine({ + onclick: function onclick(e) { + if (e.which == 1) { + var targetStateName = $(this).attr('data-name'); + + this.addClass('active').siblings().removeClass('active'); + + $('.cms-preview').changeState(targetStateName); + + e.preventDefault(); + } + } + }); + + $('.preview-mode-selector').entwine({ + changeVisibleMode: function changeVisibleMode(mode) { + this.find('select').val(mode).trigger('chosen:updated')._addIcon(); + } + }); + + $('.preview-mode-selector select').entwine({ + onchange: function onchange(e) { + this._super(e); + e.preventDefault(); + + var targetStateName = $(this).val(); + $('.cms-preview').changeMode(targetStateName); + } + }); + + $('.cms-container--content-mode').entwine({ + onmatch: function onmatch() { + if ($('.cms-preview .result-selected').hasClass('font-icon-columns')) { + statusMessage(_i18n2.default._t('Admin.DISABLESPLITVIEW', "Screen too small to show site preview in split mode"), "error"); + } + this._super(); + } + }); + + $('.preview-size-selector').entwine({ + changeVisibleSize: function changeVisibleSize(size) { + this.find('select').val(size).trigger('chosen:updated')._addIcon(); + } + }); + + $('.preview-size-selector select').entwine({ + onchange: function onchange(e) { + e.preventDefault(); + + var targetSizeName = $(this).val(); + $('.cms-preview').changeSize(targetSizeName); + } + }); + + $('.preview-selector select.preview-dropdown').entwine({ + 'onchosen:ready': function onchosenReady() { + this._super(); + this._addIcon(); + }, + + _addIcon: function _addIcon() { + var selected = this.find(':selected'); + var iconClass = selected.attr('data-icon'); + + var target = this.parent().find('.chosen-container a.chosen-single'); + var oldIcon = target.attr('data-icon'); + if (typeof oldIcon !== 'undefined') { + target.removeClass(oldIcon); + } + target.addClass(iconClass); + target.attr('data-icon', iconClass); + + return this; + } + }); + + $('.preview-mode-selector .chosen-drop li:last-child').entwine({ + onmatch: function onmatch() { + if ($('.preview-mode-selector').hasClass('split-disabled')) { + this.parent().append(''); + } else { + this.parent().append(''); + } + } + }); + + $('.preview-device-outer').entwine({ + onclick: function onclick() { + this.parent('.preview__device').toggleClass('rotate'); + } + }); +}); + +/***/ }), + +/***/ 786: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss.tree', function ($) { + + $('.cms-tree').entwine({ + + Hints: null, + + IsUpdatingTree: false, + + IsLoaded: false, + + onadd: function onadd() { + this._super(); + + if ($.isNumeric(this.data('jstree_instance_id'))) return; + + var hints = this.attr('data-hints'); + if (hints) this.setHints($.parseJSON(hints)); + + var self = this; + this.jstree(this.getTreeConfig()).bind('loaded.jstree', function (e, data) { + self.setIsLoaded(true); + + data.inst._set_settings({ 'html_data': { 'ajax': { + 'url': self.data('urlTree'), + 'data': function data(node) { + var params = self.data('searchparams') || []; + + params = $.grep(params, function (n, i) { + return n.name != 'ID' && n.name != 'value'; + }); + params.push({ name: 'ID', value: $(node).data("id") ? $(node).data("id") : 0 }); + params.push({ name: 'ajax', value: 1 }); + return params; + } + } } }); + + self.updateFromEditForm(); + self.css('visibility', 'visible'); + + data.inst.hide_checkboxes(); + }).bind('before.jstree', function (e, data) { + if (data.func == 'start_drag') { + if (!self.hasClass('draggable') || self.hasClass('multiselect')) { + e.stopImmediatePropagation(); + return false; + } + } + + if ($.inArray(data.func, ['check_node', 'uncheck_node'])) { + var node = $(data.args[0]).parents('li:first'); + var allowedChildren = node.find('li:not(.disabled)'); + + if (node.hasClass('disabled') && allowedChildren == 0) { + e.stopImmediatePropagation(); + return false; + } + } + }).bind('move_node.jstree', function (e, data) { + if (self.getIsUpdatingTree()) return; + + var movedNode = data.rslt.o, + newParentNode = data.rslt.np, + oldParentNode = data.inst._get_parent(movedNode), + newParentID = $(newParentNode).data('id') || 0, + nodeID = $(movedNode).data('id'); + var siblingIDs = $.map($(movedNode).siblings().andSelf(), function (el) { + return $(el).data('id'); + }); + + $.ajax({ + 'url': $.path.addSearchParams(self.data('urlSavetreenode'), self.data('extraParams')), + 'type': 'POST', + 'data': { + ID: nodeID, + ParentID: newParentID, + SiblingIDs: siblingIDs + }, + success: function success() { + if ($('.cms-edit-form :input[name=ID]').val() == nodeID) { + $('.cms-edit-form :input[name=ParentID]').val(newParentID); + } + self.updateNodesFromServer([nodeID]); + }, + statusCode: { + 403: function _() { + $.jstree.rollback(data.rlbk); + } + } + }); + }).bind('select_node.jstree check_node.jstree uncheck_node.jstree', function (e, data) { + $(document).triggerHandler(e, data); + }); + }, + onremove: function onremove() { + this.jstree('destroy'); + this._super(); + }, + + 'from .cms-container': { + onafterstatechange: function onafterstatechange(e) { + this.updateFromEditForm(); + } + }, + + 'from .cms-container form': { + onaftersubmitform: function onaftersubmitform(e) { + var id = $('.cms-edit-form :input[name=ID]').val(); + + this.updateNodesFromServer([id]); + } + }, + + getTreeConfig: function getTreeConfig() { + var self = this; + return { + 'core': { + 'initially_open': ['record-0'], + 'animation': 0, + 'html_titles': true + }, + 'html_data': {}, + 'ui': { + "select_limit": 1, + 'initially_select': [this.find('.current').attr('id')] + }, + "crrm": { + 'move': { + 'check_move': function check_move(data) { + var movedNode = $(data.o), + newParent = $(data.np), + isMovedOntoContainer = data.ot.get_container()[0] == data.np[0], + movedNodeClass = movedNode.getClassname(), + newParentClass = newParent.getClassname(), + hints = self.getHints(), + disallowedChildren = [], + hintKey = newParentClass ? newParentClass : 'Root', + hint = hints && typeof hints[hintKey] != 'undefined' ? hints[hintKey] : null; + + if (hint && movedNode.attr('class').match(/VirtualPage-([^\s]*)/)) movedNodeClass = RegExp.$1; + + if (hint) disallowedChildren = typeof hint.disallowedChildren != 'undefined' ? hint.disallowedChildren : []; + var isAllowed = movedNode.data('id') !== 0 && !movedNode.hasClass('status-archived') && (!isMovedOntoContainer || data.p == 'inside') && !newParent.hasClass('nochildren') && (!disallowedChildren.length || $.inArray(movedNodeClass, disallowedChildren) == -1); + + return isAllowed; + } + } + }, + 'dnd': { + "drop_target": false, + "drag_target": false + }, + 'checkbox': { + 'two_state': true + }, + 'themes': { + 'theme': 'apple', + 'url': $('body').data('frameworkpath') + '/admin/thirdparty/jstree/themes/apple/style.css' + }, + + 'plugins': ['html_data', 'ui', 'dnd', 'crrm', 'themes', 'checkbox'] + }; + }, + + search: function search(params, callback) { + if (params) this.data('searchparams', params);else this.removeData('searchparams'); + this.jstree('refresh', -1, callback); + }, + + getNodeByID: function getNodeByID(id) { + return this.find('*[data-id=' + id + ']'); + }, + + createNode: function createNode(html, data, callback) { + var self = this, + parentNode = data.ParentID !== void 0 ? self.getNodeByID(data.ParentID) : false, + newNode = $(html); + + var properties = { data: '' }; + if (newNode.hasClass('jstree-open')) { + properties.state = 'open'; + } else if (newNode.hasClass('jstree-closed')) { + properties.state = 'closed'; + } + this.jstree('create_node', parentNode.length ? parentNode : -1, 'last', properties, function (node) { + var origClasses = node.attr('class'); + + for (var i = 0; i < newNode[0].attributes.length; i++) { + var attr = newNode[0].attributes[i]; + node.attr(attr.name, attr.value); + } + + node.addClass(origClasses).html(newNode.html()); + callback(node); + }); + }, + + updateNode: function updateNode(node, html, data) { + var self = this, + newNode = $(html); + + var nextNode = data.NextID ? this.getNodeByID(data.NextID) : false; + var prevNode = data.PrevID ? this.getNodeByID(data.PrevID) : false; + var parentNode = data.ParentID ? this.getNodeByID(data.ParentID) : false; + + $.each(['id', 'style', 'class', 'data-pagetype'], function (i, attrName) { + node.attr(attrName, newNode.attr(attrName)); + }); + + var origChildren = node.children('ul').detach(); + node.html(newNode.html()).append(origChildren); + + if (nextNode && nextNode.length) { + this.jstree('move_node', node, nextNode, 'before'); + } else if (prevNode && prevNode.length) { + this.jstree('move_node', node, prevNode, 'after'); + } else { + this.jstree('move_node', node, parentNode.length ? parentNode : -1); + } + }, + + updateFromEditForm: function updateFromEditForm() { + var node, + id = $('.cms-edit-form :input[name=ID]').val(); + if (id) { + node = this.getNodeByID(id); + if (node.length) { + this.jstree('deselect_all'); + this.jstree('select_node', node); + } else { + this.updateNodesFromServer([id]); + } + } else { + this.jstree('deselect_all'); + } + }, + + updateNodesFromServer: function updateNodesFromServer(ids) { + if (this.getIsUpdatingTree() || !this.getIsLoaded()) return; + + var self = this, + i, + includesNewNode = false; + this.setIsUpdatingTree(true); + self.jstree('save_selected'); + + var correctStateFn = function correctStateFn(node) { + self.getNodeByID(node.data('id')).not(node).remove(); + + self.jstree('deselect_all'); + self.jstree('select_node', node); + }; + + self.jstree('open_node', this.getNodeByID(0)); + self.jstree('save_opened'); + self.jstree('save_selected'); + + $.ajax({ + url: $.path.addSearchParams(this.data('urlUpdatetreenodes'), 'ids=' + ids.join(',')), + dataType: 'json', + success: function success(data, xhr) { + $.each(data, function (nodeId, nodeData) { + var node = self.getNodeByID(nodeId); + + if (!nodeData) { + self.jstree('delete_node', node); + return; + } + + if (node.length) { + self.updateNode(node, nodeData.html, nodeData); + setTimeout(function () { + correctStateFn(node); + }, 500); + } else { + includesNewNode = true; + + if (nodeData.ParentID && !self.find('li[data-id=' + nodeData.ParentID + ']').length) { + self.jstree('load_node', -1, function () { + newNode = self.find('li[data-id=' + nodeId + ']'); + correctStateFn(newNode); + }); + } else { + self.createNode(nodeData.html, nodeData, function (newNode) { + correctStateFn(newNode); + }); + } + } + }); + + if (!includesNewNode) { + self.jstree('deselect_all'); + self.jstree('reselect'); + self.jstree('reopen'); + } + }, + complete: function complete() { + self.setIsUpdatingTree(false); + } + }); + } + + }); + + $('.cms-tree.multiple').entwine({ + onmatch: function onmatch() { + this._super(); + this.jstree('show_checkboxes'); + }, + onunmatch: function onunmatch() { + this._super(); + this.jstree('uncheck_all'); + this.jstree('hide_checkboxes'); + }, + + getSelectedIDs: function getSelectedIDs() { + return $(this).jstree('get_checked').not('.disabled').map(function () { + return $(this).data('id'); + }).get(); + } + }); + + $('.cms-tree li').entwine({ + setEnabled: function setEnabled(bool) { + this.toggleClass('disabled', !bool); + }, + + getClassname: function getClassname() { + var matches = this.attr('class').match(/class-([^\s]*)/i); + return matches ? matches[1] : ''; + }, + + getID: function getID() { + return this.data('id'); + } + }); +}); + +/***/ }), + +/***/ 787: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_jQuery2.default.entwine('ss', function ($) { + $('.TreeDropdownField').entwine({ + 'from .cms-container form': { + onaftersubmitform: function onaftersubmitform(e) { + this.find('.tree-holder').empty(); + this._super(); + } + } + }); +}); + +/***/ }), + +/***/ 788: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(250); + +_jQuery2.default.entwine('ss', function ($) { + $('.cms-content-tools #Form_SearchForm').entwine({ + onsubmit: function onsubmit(e) { + this.trigger('beforeSubmit'); + } + }); + + $('.importSpec').entwine({ + onmatch: function onmatch() { + this.find('div.details').hide(); + this.find('a.detailsLink').click(function () { + $('#' + $(this).attr('href').replace(/.*#/, '')).slideToggle(); + return false; + }); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + } + }); + + $('.cms .btn.clear-search').entwine({ + onclick: function onclick(e) { + e.preventDefault(); + var container = this.parents('.cms-container'); + container.loadPanel(this.attr('href'), '', {}, true, false); + } + }); +}); + +/***/ }), + +/***/ 789: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(250); +__webpack_require__(946); + +var refreshAfterImport = function refreshAfterImport(e) { + var existingFormMessage = (0, _jQuery2.default)((0, _jQuery2.default)(this).contents()).find('.message'); + if (existingFormMessage && existingFormMessage.html()) { + var memberTableField = (0, _jQuery2.default)(window.parent.document).find('#Form_EditForm_Members').get(0); + if (memberTableField) memberTableField.refresh(); + + var tree = (0, _jQuery2.default)(window.parent.document).find('.cms-tree').get(0); + if (tree) tree.reload(); + } +}; + +(0, _jQuery2.default)('#MemberImportFormIframe, #GroupImportFormIframe').entwine({ + onadd: function onadd() { + this._super(); + + (0, _jQuery2.default)(this).bind('load', refreshAfterImport); + } +}); + +_jQuery2.default.entwine('ss', function ($) { + $('.permissioncheckboxset .checkbox[value=ADMIN]').entwine({ + onmatch: function onmatch() { + this.toggleCheckboxes(); + + this._super(); + }, + onunmatch: function onunmatch() { + this._super(); + }, + + onclick: function onclick(e) { + this.toggleCheckboxes(); + }, + + toggleCheckboxes: function toggleCheckboxes() { + var self = this, + checkboxes = this.parents('.field:eq(0)').find('.checkbox').not(this); + + if (this.is(':checked')) { + checkboxes.each(function () { + $(this).data('SecurityAdmin.oldChecked', $(this).is(':checked')); + $(this).data('SecurityAdmin.oldDisabled', $(this).is(':disabled')); + $(this).prop('disabled', true); + $(this).prop('checked', true); + }); + } else { + checkboxes.each(function () { + $(this).prop('checked', $(this).data('SecurityAdmin.oldChecked')); + $(this).prop('disabled', $(this).data('SecurityAdmin.oldDisabled')); + }); + } + } + }); +}); + +/***/ }), + +/***/ 790: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _jQuery2.default)(document).ready(function () { + (0, _jQuery2.default)('ul.SelectionGroup input.selector, ul.selection-group input.selector').live('click', function () { + var li = (0, _jQuery2.default)(this).closest('li'); + li.addClass('selected'); + + var prev = li.prevAll('li.selected'); + if (prev.length) { + prev.removeClass('selected'); + } + var next = li.nextAll('li.selected'); + if (next.length) { + next.removeClass('selected'); + } + + (0, _jQuery2.default)(this).focus(); + }); +}); + +/***/ }), + +/***/ 791: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(154); +__webpack_require__(393); +__webpack_require__(125); + +_jQuery2.default.entwine('ss', function ($) { + $('.ss-tabset').entwine({ + IgnoreTabState: false, + + onadd: function onadd() { + var hash = window.location.hash; + + this.redrawTabs(); + + if (hash !== '') { + this.openTabFromURL(hash); + } + + this._super(); + }, + + onremove: function onremove() { + if (this.data('tabs')) this.tabs('destroy'); + this._super(); + }, + + redrawTabs: function redrawTabs() { + this.rewriteHashlinks(); + this.tabs(); + }, + + openTabFromURL: function openTabFromURL(hash) { + var $trigger; + + $.each(this.find('.ui-tabs-anchor'), function () { + if (this.href.indexOf(hash) !== -1 && $(hash).length === 1) { + $trigger = $(this); + return false; + } + }); + + if ($trigger === void 0) { + return; + } + + $(document).ready('ajaxComplete', function () { + $trigger.click(); + }); + }, + + rewriteHashlinks: function rewriteHashlinks() { + $(this).find('ul a').each(function () { + if (!$(this).attr('href')) return; + + var matches = $(this).attr('href').match(/#.*/); + if (!matches) return; + $(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]); + }); + } + }); + + $('.ui-tabs-active .ui-tabs-anchor').entwine({ + onmatch: function onmatch() { + this.addClass('nav-link active'); + }, + onunmatch: function onunmatch() { + this.removeClass('active'); + } + }); +}); + +/***/ }), + +/***/ 792: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(154); + +_jQuery2.default.entwine('ss', function ($) { + $('.ss-toggle').entwine({ + onadd: function onadd() { + this._super(); + + this.accordion({ + heightStyle: "content", + collapsible: true, + active: this.hasClass("ss-toggle-start-closed") ? false : 0 + }); + }, + onremove: function onremove() { + if (this.data('accordion')) this.accordion('destroy'); + this._super(); + }, + + getTabSet: function getTabSet() { + return this.closest(".ss-tabset"); + }, + + fromTabSet: { + ontabsshow: function ontabsshow() { + this.accordion("resize"); + } + } + }); +}); + +/***/ }), + +/***/ 793: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(jQuery) { + +var _jQuery = __webpack_require__(16); + +var _jQuery2 = _interopRequireDefault(_jQuery); + +var _i18n = __webpack_require__(23); + +var _i18n2 = _interopRequireDefault(_i18n); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +__webpack_require__(125); +__webpack_require__(394); + +_jQuery2.default.entwine('ss', function ($) { + var windowWidth, windowHeight; + $(window).bind('resize.treedropdownfield', function () { + var cb = function cb() { + $('.TreeDropdownField').closePanel(); + }; + + if ($.browser.msie && parseInt($.browser.version, 10) < 9) { + var newWindowWidth = $(window).width(), + newWindowHeight = $(window).height(); + if (newWindowWidth != windowWidth || newWindowHeight != windowHeight) { + windowWidth = newWindowWidth; + windowHeight = newWindowHeight; + cb(); + } + } else { + cb(); + } + }); + + var strings = { + 'openlink': _i18n2.default._t('TreeDropdownField.OpenLink'), + 'fieldTitle': '(' + _i18n2.default._t('TreeDropdownField.FieldTitle') + ')', + 'searchFieldTitle': '(' + _i18n2.default._t('TreeDropdownField.SearchFieldTitle') + ')' + }; + + var _clickTestFn = function _clickTestFn(e) { + if (!$(e.target).parents('.TreeDropdownField').length) $('.TreeDropdownField').closePanel(); + }; + + $('.TreeDropdownField').entwine({ + CurrentXhr: null, + + onadd: function onadd() { + this.append('' + '' + '