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