silverstripe-cms/client/dist/js/bundle.js

171 lines
19 KiB
JavaScript
Raw Normal View History

!function(t){function e(i){if(n[i])return n[i].exports
var a=n[i]={exports:{},id:i,loaded:!1}
return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={}
return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict"
n(3),n(4),n(6),n(7),n(8),n(9),n(10),n(11)},,function(t,e){t.exports=jQuery},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t(".cms-add-form .parent-mode :input").entwine({onclick:function e(t){if("top"==this.val()){var e=this.closest("form").find("#Form_AddForm_ParentID_Holder .TreeDropdownField")
e.setValue(""),e.setTitle("")}}}),t(".cms-add-form").entwine({ParentID:0,ParentCache:{},onadd:function n(){var t=this
this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField").bind("change",function(){t.updateTypeList()}),this.find(".SelectionGroup.parent-mode").bind("change",function(){t.updateTypeList()}),this.updateTypeList()
},loadCachedChildren:function i(t){var e=this.getParentCache()
return"undefined"!=typeof e[t]?e[t]:null},saveCachedChildren:function a(t,e){var n=this.getParentCache()
n[t]=e,this.setParentCache(n)},updateTypeList:function o(){var e=this.data("hints"),n=this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField"),i=this.find("input[name=ParentModeField]:checked").val(),a=n.data("metadata"),o=a&&"child"===i?n.getValue()||this.getParentID():null,s=a?a.ClassName:null,r=s&&"child"===i?s:"Root",d="undefined"!=typeof e[r]?e[r]:null,l=this,c=d&&"undefined"!=typeof d.defaultChild?d.defaultChild:null,u=[]
if(o){if(this.hasClass("loading"))return
return this.addClass("loading"),this.setParentID(o),n.getValue()||n.setValue(o),u=this.loadCachedChildren(o),null!==u?(this.updateSelectionFilter(u,c),void this.removeClass("loading")):(t.ajax({url:l.data("childfilter"),
data:{ParentID:o},success:function h(t){l.saveCachedChildren(o,t),l.updateSelectionFilter(t,c)},complete:function f(){l.removeClass("loading")}}),!1)}u=d&&"undefined"!=typeof d.disallowedChildren?d.disallowedChildren:[],
this.updateSelectionFilter(u,c)},updateSelectionFilter:function s(e,n){var i=null
if(this.find("#Form_AddForm_PageType div.radio").each(function(){var n=t(this).find("input").val(),a=t.inArray(n,e)===-1
t(this).setEnabled(a),a||t(this).setSelected(!1),i=null===i?a:i&&a}),n)var a=this.find("#Form_AddForm_PageType div.radio input[value="+n+"]").parents("li:first")
else var a=this.find("#Form_AddForm_PageType div.radio:not(.disabled):first")
a.setSelected(!0),a.siblings().setSelected(!1)
var o=this.find("#Form_AddForm_PageType div.radio:not(.disabled)").length?"enable":"disable"
this.find("button[name=action_doAdd]").button(o),this.find(".message-restricted")[i?"hide":"show"]()}}),t(".cms-add-form #Form_AddForm_PageType div.radio").entwine({onclick:function r(t){this.setSelected(!0)
},setSelected:function d(t){var e=this.find("input")
t&&!e.is(":disabled")?(this.siblings().setSelected(!1),this.toggleClass("selected",!0),e.prop("checked",!0)):(this.toggleClass("selected",!1),e.prop("checked",!1))},setEnabled:function l(e){t(this).toggleClass("disabled",!e),
e?t(this).find("input").removeAttr("disabled"):t(this).find("input").attr("disabled","disabled").removeAttr("checked")}}),t(".cms-content-addpage-button").entwine({onclick:function c(e){var n=t(".cms-tree"),i=t(".cms-list"),a=0,o
if(n.is(":visible")){var s=n.jstree("get_selected")
a=s?t(s[0]).data("id"):null}else{var r=i.find('input[name="Page[GridState]"]').val()
r&&(a=parseInt(JSON.parse(r).ParentID,10))}var d={selector:this.data("targetPanel"),pjax:this.data("pjax")},l
a?(o=this.data("extraParams")?this.data("extraParams"):"",l=t.path.addSearchParams(i18n.sprintf(this.data("urlAddpage"),a),o)):l=this.attr("href"),t(".cms-container").loadPanel(l,null,d),e.preventDefault(),
this.blur()}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s)
o["default"].entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function e(){alert(r["default"]._t("CMSMAIN.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({
onmatch:function n(){var e=this
e.data("OrigVal",e.val())
var n=e.closest("form"),i=t("input:text[name=URLSegment]",n),a=t("input[name=LiveLink]",n)
i.length>0&&(e._addActions(),this.bind("change",function(n){var o=e.data("OrigVal"),s=e.val()
e.data("OrigVal",s),0===i.val().indexOf(i.data("defaultUrl"))&&""==a.val()?e.updateURLSegment(s):t(".update",e.parent()).show(),e.updateRelatedFields(s,o),e.updateBreadcrumbLabel(s)})),this._super()},onunmatch:function i(){
this._super()},updateRelatedFields:function a(e,n){this.parents("form").find("input[name=MetaTitle], input[name=MenuTitle]").each(function(){var i=t(this)
i.val()==n&&(i.val(e),i.updatedRelatedFields&&i.updatedRelatedFields())})},updateURLSegment:function o(e){var n=t("input:text[name=URLSegment]",this.closest("form")),i=n.closest(".field.urlsegment"),a=t(".update",this.parent())
i.update(e),a.is(":visible")&&a.hide()},updateBreadcrumbLabel:function s(e){var n=t(".cms-edit-form input[name=ID]").val(),i=t("span.cms-panel-link.crumb")
e&&""!=e&&i.text(e)},_addActions:function d(){var e=this,n
n=t("<button />",{"class":"update ss-ui-button-small",text:r["default"]._t("URLSEGMENT.UpdateURL"),type:"button",click:function i(t){t.preventDefault(),e.updateURLSegment(e.val())}}),n.insertAfter(e),n.hide()
}}),t(".cms-edit-form .parentTypeSelector").entwine({onmatch:function l(){var t=this
this.find(":input[name=ParentType]").bind("click",function(e){t._toggleSelection(e)}),this.find(".TreeDropdownField").bind("change",function(e){t._changeParentId(e)}),this._changeParentId(),this._toggleSelection(),
this._super()},onunmatch:function c(){this._super()},_toggleSelection:function u(e){var n=this.find(":input[name=ParentType]:checked").val(),i=this.find("#Form_EditForm_ParentID_Holder")
"root"==n?this.find(":input[name=ParentID]").val(0):this.find(":input[name=ParentID]").val(this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue")),"root"!=n?i.slideDown(400,function(){t(this).css("overflow","visible")
}):i.slideUp()},_changeParentId:function h(t){var e=this.find(":input[name=ParentID]").val()
this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue",e)}}),t(".cms-edit-form #CanViewType, .cms-edit-form #CanEditType, .cms-edit-form #CanCreateTopLevelType").entwine({onmatch:function f(){
var e
"CanViewType"==this.attr("id")?e=t("#Form_EditForm_ViewerGroups_Holder"):"CanEditType"==this.attr("id")?e=t("#Form_EditForm_EditorGroups_Holder"):"CanCreateTopLevelType"==this.attr("id")&&(e=t("#Form_EditForm_CreateTopLevelGroups_Holder")),
this.find(".optionset :input").bind("change",function(n){var i=t(this).closest(".middleColumn").parent("div")
"OnlyTheseUsers"==n.target.value?(i.addClass("remove-splitter"),e.show()):(i.removeClass("remove-splitter"),e.hide())})
var n=this.find("input[name="+this.attr("id")+"]:checked").val()
e["OnlyTheseUsers"==n?"show":"hide"](),this._super()},onunmatch:function m(){this._super()}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_print").entwine({onclick:function p(e){var n=t(this[0].form).attr("action").replace(/\?.*$/,"")+"/printable/"+t(":input[name=ID]",this[0].form).val()
return"http://"!=n.substr(0,7)&&(n=t("base").attr("href")+n),window.open(n,"printable"),!1}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_rollback").entwine({onclick:function v(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i=""
return i=n?r["default"].sprintf(r["default"]._t("CMSMain.RollbackToVersion"),n):r["default"]._t("CMSMain.ConfirmRestoreFromLive"),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_archive").entwine({
onclick:function g(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i=""
return i=r["default"].sprintf(r["default"]._t("CMSMain.Archive"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_restore").entwine({onclick:function _(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="",a=this.data("toRoot")
return i=r["default"].sprintf(r["default"]._t(a?"CMSMain.RestoreToRoot":"CMSMain.Restore"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_delete").entwine({onclick:function b(t){
var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i=""
return i=r["default"].sprintf(r["default"]._t("CMSMain.DeleteFromDraft"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function w(t){
var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i=""
return i=r["default"].sprintf(r["default"]._t("CMSMain.Unpublish"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form.changed").entwine({onmatch:function C(t){this.find("button[name=action_save]").button("option","showingAlternate",!0),
this.find("button[name=action_publish]").button("option","showingAlternate",!0),this._super(t)},onunmatch:function F(t){var e=this.find("button[name=action_save]")
e.data("button")&&e.button("option","showingAlternate",!1)
var n=this.find("button[name=action_publish]")
n.data("button")&&n.button("option","showingAlternate",!1),this._super(t)}}),t(".cms-edit-form .btn-toolbar button[name=action_publish]").entwine({onbuttonafterrefreshalternate:function P(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")
}}),t(".cms-edit-form .btn-toolbar button[name=action_save]").entwine({onbuttonafterrefreshalternate:function T(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")
}}),t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({onmatch:function S(){this.redraw(),this._super()},onunmatch:function k(){this._super()},redraw:function x(){var e=t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder")
"Form_EditForm_ParentType_root"==t(this).attr("id")?e.slideUp():e.slideDown()},onclick:function E(){this.redraw()}}),"Form_EditForm_ParentType_root"==t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr("id")&&t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder").hide()
})},function(t,e){t.exports=i18n},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function e(t){var e=this.closest(".cms-content").find(t.target)
0!==e.length&&this.parent()[e.hasClass("collapsed")?"addClass":"removeClass"]("collapsed")}}}),t(".cms-content-toolbar").entwine({onmatch:function n(){var e=this
this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this),i=n.data("toolid"),a=n.hasClass("active")
void 0!==i&&(n.data("active",!1).removeClass("active"),t("#"+i).hide(),e.bindActionButtonEvents(n))})},onunmatch:function i(){var e=this
this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this)
e.unbindActionButtonEvents(n)})},bindActionButtonEvents:function a(t){var e=this
t.on("click.cmsContentToolbar",function(n){e.showHideTool(t)})},unbindActionButtonEvents:function o(t){t.off(".cmsContentToolbar")},showHideTool:function s(e){var n=e.data("active"),i=e.data("toolid"),a=t("#"+i)
t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var e=t(this),n=t("#"+e.data("toolid"))
e.data("toolid")!==i&&(n.hide(),e.data("active",!1))}),e[n?"removeClass":"addClass"]("active"),a[n?"hide":"show"](),e.data("active",!n)}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s)
o["default"].entwine("ss.tree",function(t){t(".cms-tree").entwine({fromDocument:{"oncontext_show.vakata":function e(t){this.adjustContextClass()}},adjustContextClass:function n(){var e=t("#vakata-contextmenu").find("ul ul")
e.each(function(n){var i="1",a=t(e[n]).find("li").length
a>20?i="3":a>10&&(i="2"),t(e[n]).addClass("col-"+i).removeClass("right"),t(e[n]).find("li").on("mouseenter",function(e){t(this).parent("ul").removeClass("right")})})},getTreeConfig:function i(){var e=this,n=this._super(),i=this.getHints()
return n.plugins.push("contextmenu"),n.contextmenu={items:function a(n){var i={edit:{label:n.hasClass("edit-disabled")?r["default"]._t("Tree.EditPage","Edit page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"):r["default"]._t("Tree.ViewPage","View page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),
action:function c(n){t(".cms-container").entwine(".ss").loadPanel(r["default"].sprintf(e.data("urlEditpage"),n.data("id")))}}}
n.hasClass("nochildren")||(i.showaslist={label:r["default"]._t("Tree.ShowAsList"),action:function u(n){t(".cms-container").entwine(".ss").loadPanel(e.data("urlListview")+"&ParentID="+n.data("id"),null,{
tabState:{"pages-controller-cms-content":{tabSelector:".content-listview"}}})}})
var a=n.data("pagetype"),o=n.data("id"),s=n.find(">a .item").data("allowedchildren"),d={},l=!1
return t.each(s,function(n,i){l=!0,d["allowedchildren-"+n]={label:'<span class="jstree-pageicon"></span>'+i,_class:"class-"+n,action:function a(i){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlAddpage"),o,n),e.data("extraParams")))
}}}),l&&(i.addsubpage={label:r["default"]._t("Tree.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:d}),n.hasClass("edit-disabled")||(i.duplicate={
label:r["default"]._t("Tree.Duplicate"),submenu:[{label:r["default"]._t("Tree.ThisPageOnly"),action:function h(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicate"),n.data("id")),e.data("extraParams")))
}},{label:r["default"]._t("Tree.ThisPageAndSubpages"),action:function f(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicatewithchildren"),n.data("id")),e.data("extraParams")))
}}]}),i}},n}}),t(".cms-tree a.jstree-clicked").entwine({onmatch:function a(){var t=this,e=t.parents(".cms-panel-content"),n;(t.offset().top<0||t.offset().top>e.height()-t.height())&&(n=e.scrollTop()+t.offset().top+e.height()/2,
e.animate({scrollTop:n},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function o(){window.location=location.protocol+"//"+location.host+location.pathname}}),t(".cms-tree-filtered").entwine({
onmatch:function s(){var e=this,n=function i(){var n=t(".cms-content-tools .cms-panel-content").height()-e.parent().siblings(".cms-content-toolbar").outerHeight(!0)
e.css("height",n+"px")}
n(),t(window).on("resize",window.ss.debounce(n,300))}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s)
o["default"].entwine("ss",function(t){t("#Form_VersionsForm").entwine({onmatch:function e(){this._super()},onunmatch:function n(){this._super()},onsubmit:function i(e,n){e.preventDefault()
var i,a=this
if(i=this.find(":input[name=ID]").val(),!i)return!1
var o,s,d,l,c,u,h
if(u=this.find(":input[name=CompareMode]").is(":checked"),d=this.find("table input[type=checkbox]").filter(":checked"),u){if(2!=d.length)return!1
l=d.eq(0).val(),c=d.eq(1).val(),o=this.find(":submit[name=action_doCompare]"),s=r["default"].sprintf(this.data("linkTmplCompare"),i,c,l)}else l=d.eq(0).val(),o=this.find(":submit[name=action_doShowVersion]"),
s=r["default"].sprintf(this.data("linkTmplShow"),i,l)
t(".cms-container").loadPanel(s,"",{pjax:"CurrentForm"})}}),t("#Form_VersionsForm input[name=ShowUnpublished]").entwine({onmatch:function a(){this.toggle(),this._super()},onunmatch:function o(){this._super()
},onchange:function s(){this.toggle()},toggle:function d(){var e=t(this),n=e.parents("form")
e.attr("checked")?n.find("tr[data-published=false]").css("display",""):n.find("tr[data-published=false]").css("display","none")._unselect()}}),t("#Form_VersionsForm tbody tr").entwine({onclick:function l(t){
var e,n
return e=this.parents("form").find(":input[name=CompareMode]").attr("checked"),n=this.siblings(".active"),e&&this.hasClass("active")?void this._unselect():e?n.length>1?alert(r["default"]._t("ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),
void(1==n.length&&this.parents("form").submit())):(this._select(),n._unselect(),this.parents("form").submit(),void 0)},_unselect:function c(){this.removeClass("active"),this.find(":input[type=checkbox]").attr("checked",!1)
},_select:function u(){this.addClass("active"),this.find(":input[type=checkbox]").attr("checked",!0)}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t("#Form_EditForm_RedirectionType input").entwine({onmatch:function e(){var e=t(this)
e.attr("checked")&&this.toggle(),this._super()},onunmatch:function n(){this._super()},onclick:function i(){this.toggle()},toggle:function a(){"Internal"==t(this).attr("value")?(t("#Form_EditForm_ExternalURL_Holder").hide(),
t("#Form_EditForm_LinkToID_Holder").show()):(t("#Form_EditForm_ExternalURL_Holder").show(),t("#Form_EditForm_LinkToID_Holder").hide())}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t(".field.urlsegment:not(.readonly)").entwine({MaxPreviewLength:55,Ellipsis:"...",onmatch:function e(){this.find(":text").length&&this.toggleEdit(!1),this.redraw(),
this._super()},redraw:function n(){var t=this.find(":text"),e=decodeURI(t.data("prefix")+t.val()),n=e
e.length>this.getMaxPreviewLength()&&(n=this.getEllipsis()+e.substr(e.length-this.getMaxPreviewLength(),e.length)),this.find(".preview").attr("href",encodeURI(e+t.data("suffix"))).text(n)},toggleEdit:function i(t){
var e=this.find(":text")
this.find(".preview-holder")[t?"hide":"show"](),this.find(".edit-holder")[t?"show":"hide"](),t&&(e.data("origval",e.val()),e.focus())},update:function a(){var t=this,e=this.find(":text"),n=e.data("origval"),i=arguments[0],a=i&&""!==i?i:e.val()
n!=a?(this.addClass("loading"),this.suggest(a,function(n){e.val(decodeURIComponent(n.value)),t.toggleEdit(!1),t.removeClass("loading"),t.redraw()})):(this.toggleEdit(!1),this.redraw())},cancel:function o(){
var t=this.find(":text")
t.val(t.data("origval")),this.toggleEdit(!1)},suggest:function s(e,n){var i=this,a=i.find(":text"),o=t.path.parseUrl(i.closest("form").attr("action")),s=o.hrefNoSearch+"/field/"+a.attr("name")+"/suggest/?value="+encodeURIComponent(e)
o.search&&(s+="&"+o.search.replace(/^\?/,"")),t.ajax({url:s,success:function r(t){n.apply(this,arguments)},error:function d(t,e){t.statusText=t.responseText},complete:function l(){i.removeClass("loading")
}})}}),t(".field.urlsegment .edit").entwine({onclick:function r(t){t.preventDefault(),this.closest(".field").toggleEdit(!0)}}),t(".field.urlsegment .update").entwine({onclick:function d(t){t.preventDefault(),
this.closest(".field").update()}}),t(".field.urlsegment .cancel").entwine({onclick:function l(t){t.preventDefault(),this.closest(".field").cancel()}})})},function(t,e){}])
//# sourceMappingURL=bundle.js.map