first commit
This commit is contained in:
commit
1218dd1517
12716 files changed
+989233
No files matched your search
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Severity","jquery","./Icons","./Modal","./Notification","./Viewport"],(function(e,t,n,a,i,o,r,d){"use strict";var l;return function(e){e.hide=".t3js-record-hide",e.delete=".t3js-record-delete",e.icon=".t3js-icon"}(l||(l={})),new(function(){function e(){var e=this;a((function(){e.initialize()}))}return e.refreshPageTree=function(){d.NavigationContainer&&d.NavigationContainer.PageTree&&d.NavigationContainer.PageTree.refreshTree()},e.prototype.process=function(e){var t=this;return this._call(e).done((function(e){e.hasErrors&&t.handleErrors(e)}))},e.prototype.initialize=function(){var e=this;a(document).on("click",l.hide,(function(t){t.preventDefault();var n=a(t.currentTarget),i=n.find(l.icon),o=n.closest("tr[data-uid]"),r=n.data("params");e._showSpinnerIcon(i),e._call(r).done((function(t){t.hasErrors?e.handleErrors(t):e.toggleRow(o)}))})),a(document).on("click",l.delete,(function(t){t.preventDefault();var i=a(t.currentTarget);i.tooltip("hide"),o.confirm(i.data("title"),i.data("message"),n.SeverityEnum.warning,[{text:i.data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:i.data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",(function(t){"cancel"===t.target.getAttribute("name")?o.dismiss():"delete"===t.target.getAttribute("name")&&(o.dismiss(),e.deleteRecord(i))}))}))},e.prototype.toggleRow=function(t){var n,o,r,d=t.find(l.hide),s=d.closest("table[data-table]").data("table"),c=d.data("params");"hidden"===d.data("state")?(o="visible",n=c.replace("=0","=1"),r="actions-edit-hide"):(o="hidden",n=c.replace("=1","=0"),r="actions-edit-unhide"),d.data("state",o).data("params",n),d.tooltip("hide").one("hidden.bs.tooltip",(function(){var e=d.data("toggleTitle");d.data("toggleTitle",d.attr("data-original-title")).attr("data-original-title",e)}));var f=d.find(l.icon);i.getIcon(r,i.sizes.small).done((function(e){f.replaceWith(e)}));var u=t.find(".col-icon "+l.icon);"hidden"===o?i.getIcon("miscellaneous-placeholder",i.sizes.small,"overlay-hidden").done((function(e){u.append(a(e).find(".icon-overlay"))})):u.find(".icon-overlay").remove(),t.fadeTo("fast",.4,(function(){t.fadeTo("fast",1)})),"pages"===s&&e.refreshPageTree()},e.prototype.deleteRecord=function(t){var n=this,a=t.data("params"),o=t.find(l.icon);this._showSpinnerIcon(o),this._call(a).done((function(a){if(i.getIcon("actions-edit-delete",i.sizes.small).done((function(e){(o=t.find(l.icon)).replaceWith(e)})),a.hasErrors)n.handleErrors(a);else{var r=t.closest("table[data-table]"),d=t.closest(".panel"),s=d.find(".panel-heading"),c=r.data("table"),f=t.closest("tr[data-uid]"),u=f.data("uid"),p=r.find("[data-l10nparent="+u+"]").closest("tr[data-uid]");if((f=f.add(p)).fadeTo("slow",.4,(function(){f.slideUp("slow",(function(){f.remove(),0===r.find("tbody tr").length&&d.slideUp("slow")}))})),"0"===t.data("l10parent")||""===t.data("l10parent")){var h=Number(s.find(".t3js-table-total-items").html());s.find(".t3js-table-total-items").text(h-1)}"pages"===c&&e.refreshPageTree()}}))},e.prototype.handleErrors=function(e){a.each(e.messages,(function(e,t){r.error(t.title,t.message)}))},e.prototype._call=function(e){return a.getJSON(TYPO3.settings.ajaxUrls.record_process,e)},e.prototype._showSpinnerIcon=function(e){i.getIcon("spinner-circle-dark",i.sizes.small).done((function(t){e.replaceWith(t)}))},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=function(e,i){void 0===e&&(e=""),void 0===i&&(i=0),this.message=e,this.code=i};i.BackendException=t}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Core/Contrib/jquery.minicolors"],(function(t,e,o){"use strict";return new(function(){function t(){this.selector=".t3js-color-picker"}return t.prototype.initialize=function(){o(this.selector).minicolors({format:"hex",position:"bottom left",theme:"bootstrap"}),o(document).on("change",".t3js-colorpicker-value-trigger",(function(t){var e=o(t.target);""!==e.val()&&(e.closest(".t3js-formengine-field-item").find(".t3js-color-picker").val(e.val()).trigger("paste"),e.val(""))})),o(document).on("blur",".t3js-color-picker",(function(t){var e=o(t.target);e.closest(".t3js-formengine-field-item").find('input[type="hidden"]').val(e.val()),""===e.val()&&e.trigger("paste")}))},t}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./Popover","bootstrap"],(function(t,e,o,n){"use strict";return new(function(){function t(){this.ajaxUrl=TYPO3.settings.ajaxUrls.context_help,this.trigger="click",this.placement="auto",this.selector=".t3-help-link",this.initialize()}return t.resolveBackend=function(){return void 0!==window.opener&&null!==window.opener?window.opener.top:top},t.prototype.initialize=function(){var e=this,a=t.resolveBackend();void 0!==a.TYPO3.settings.ContextHelp&&(this.helpModuleUrl=a.TYPO3.settings.ContextHelp.moduleUrl),void 0===TYPO3.ShortcutMenu&&void 0===a.TYPO3.ShortcutMenu&&o(".icon-actions-system-shortcut-new").closest(".btn").hide();var i=" ";void 0!==a.TYPO3.lang&&(i=a.TYPO3.lang.csh_tooltip_loading);var r=o(this.selector);r.attr("data-loaded","false").attr("data-html","true").attr("data-original-title",i).attr("data-placement",this.placement).attr("data-trigger",this.trigger),n.popover(r),o(document).on("show.bs.popover",this.selector,(function(t){var a=o(t.currentTarget),i=a.data("description");void 0!==i&&""!==i?n.setOptions(a,{title:a.data("title"),content:i}):"false"===a.attr("data-loaded")&&a.data("table")&&e.loadHelp(a),a.closest(".t3js-module-docheader").length&&n.setOption(a,"placement","bottom")})).on("shown.bs.popover",this.selector,(function(t){var e=o(t.target).data("bs.popover").$tip;e.find(".popover-title").is(":visible")||e.addClass("no-title")})).on("click",".tipIsLinked",(function(t){o(".popover").each((function(n,a){var i=o(a);i.has(t.target).length&&e.showHelpPopup(i.data("bs.popover").$element)}))})).on("click","body",(function(t){o(e.selector).each((function(e,a){var i=o(a);i.is(t.target)||0!==i.has(t.target).length||0!==o(".popover").has(t.target).length||n.hide(i)}))}))},t.prototype.showHelpPopup=function(t){try{var e=window.open(this.helpModuleUrl+"&table="+t.data("table")+"&field="+t.data("field"),"ContextHelpWindow","height=400,width=600,status=0,menubar=0,scrollbars=1");return e.focus(),n.hide(t),e}catch(t){}},t.prototype.loadHelp=function(t){var e=t.data("table"),a=t.data("field");e&&o.getJSON(this.ajaxUrl,{params:{action:"getContextHelp",table:e,field:a}}).done((function(e){var o=e.title||"",a=e.content||"<p></p>";n.setOptions(t,{title:o,content:a}),t.attr("data-loaded","true").one("hidden.bs.popover",(function(){n.show(t)})),n.hide(t)}))},t}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./ContextMenuActions"],(function(t,e,n,i){"use strict";return new(function(){function e(){var t=this;this.mousePos={X:null,Y:null},this.delayContextMenuHide=!1,this.record={uid:null,table:null},this.storeMousePositionEvent=function(e){t.mousePos={X:e.pageX,Y:e.pageY},t.mouseOutFromMenu("#contentMenu0"),t.mouseOutFromMenu("#contentMenu1")},this.initializeEvents()}return e.drawActionItem=function(t){var e=t.additionalAttributes||{},n="";for(var i in e)e.hasOwnProperty(i)&&(n+=" "+i+'="'+e[i]+'"');return'<a class="list-group-item" data-callback-action="'+t.callbackAction+'"'+n+'><span class="list-group-item-icon">'+t.icon+"</span> "+t.label+"</a>"},e.within=function(t,e,n){var i=t.offset();return n>=i.top&&n<i.top+t.height()&&e>=i.left&&e<i.left+t.width()},e.initializeContextMenuContainer=function(){if(0===n("#contentMenu0").length){n("body").append('<div id="contentMenu0" class="context-menu"></div><div id="contentMenu1" class="context-menu" style="display: block;"></div>')}},e.prototype.initializeEvents=function(){var t=this;n(document).on("click contextmenu",".t3js-contextmenutrigger",(function(e){var i=n(e.currentTarget);i.prop("onclick")&&"click"===e.type||(e.preventDefault(),t.show(i.data("table"),i.data("uid"),i.data("context"),i.data("iteminfo"),i.data("parameters")))})),n(document).on("mousemove",this.storeMousePositionEvent)},e.prototype.show=function(t,e,n,i,o){this.record={table:t,uid:e};var s="";void 0!==t&&(s+="table="+encodeURIComponent(t)),void 0!==e&&(s+=(s.length>0?"&":"")+"uid="+e),void 0!==n&&(s+=(s.length>0?"&":"")+"context="+n),void 0!==i&&(s+=(s.length>0?"&":"")+"enDisItems="+i),void 0!==o&&(s+=(s.length>0?"&":"")+"addParams="+o),this.fetch(s)},e.prototype.fetch=function(t){var e=this,i=TYPO3.settings.ajaxUrls.contextmenu;t&&(i+=(-1===i.indexOf("?")?"?":"&")+t),n.ajax(i).done((function(t){void 0!==t&&Object.keys(t).length>0&&e.populateData(t,0)}))},e.prototype.populateData=function(o,s){var a=this;e.initializeContextMenuContainer();var u=n("#contentMenu"+s);if(u.length&&(0===s||n("#contentMenu"+(s-1)).is(":visible"))){var l=this.drawMenu(o,s);u.html('<div class="list-group">'+l+"</div>"),n("a.list-group-item",u).click((function(e){e.preventDefault();var o=n(e.currentTarget);if(o.hasClass("list-group-item-submenu"))a.openSubmenu(s,o);else{var u=o.data("callback-action"),l=o.data("callback-module");o.data("callback-module")?t([l],(function(t){t[u].bind(o)(a.record.table,a.record.uid)})):i&&"function"==typeof i[u]?i[u].bind(o)(a.record.table,a.record.uid):console.log("action: "+u+" not found"),a.hideAll()}})),u.css(this.getPosition(u)).show()}},e.prototype.openSubmenu=function(t,e){var i=n("#contentMenu"+(t+1)).html("");e.next().find(".list-group").clone(!0).appendTo(i),i.css(this.getPosition(i)).show()},e.prototype.getPosition=function(t){var e=this.mousePos.X,i=this.mousePos.Y,o=n(window).width()-20,s=n(window).height(),a=t.width(),u=t.height(),l=this.mousePos.X-n(document).scrollLeft(),c=this.mousePos.Y-n(document).scrollTop();return s-u<c&&(c>u?i-=u-10:i+=s-u-c),o-a<l&&(l>a?e-=a-10:o-a-l<n(document).scrollLeft()?e=n(document).scrollLeft():e+=o-a-l),{left:e+"px",top:i+"px"}},e.prototype.drawMenu=function(t,n){var i="";for(var o in t)if(t.hasOwnProperty(o)){var s=t[o];if("item"===s.type)i+=e.drawActionItem(s);else if("divider"===s.type)i+='<a class="list-group-item list-group-item-divider"></a>';else if("submenu"===s.type||s.childItems){i+='<a class="list-group-item list-group-item-submenu"><span class="list-group-item-icon">'+s.icon+"</span> "+s.label+' <span class="fa fa-caret-right"></span></a>',i+='<div class="context-menu contentMenu'+(n+1)+'" style="display:none;"><div class="list-group">'+this.drawMenu(s.childItems,1)+"</div></div>"}}return i},e.prototype.mouseOutFromMenu=function(t){var i=n(t);i.length>0&&i.is(":visible")&&!e.within(i,this.mousePos.X,this.mousePos.Y)?this.hide(t):i.length>0&&i.is(":visible")&&(this.delayContextMenuHide=!0)},e.prototype.hide=function(t){var e=this;this.delayContextMenuHide=!1,window.setTimeout((function(){e.delayContextMenuHide||n(t).hide()}),500)},e.prototype.hideAll=function(){this.hide("#contentMenu0"),this.hide("#contentMenu1")},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Severity","jquery","./AjaxDataHandler","./InfoWindow","./Modal","./ModuleMenu","./Viewport"],(function(e,t,n,a,r,o,i,s,l){"use strict";return function(){function e(){}return e.getReturnUrl=function(){return top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search)},e.editRecord=function(t,n){var r="",o=a(this).data("pages-language-uid");o&&(r="&overrideVals[pages][sys_language_uid]="+o),l.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+n+"]=edit"+r+"&returnUrl="+e.getReturnUrl())},e.viewRecord=function(e,t){var n=a(this).data("preview-url");n&&window.open(n,"newTYPO3frontendWindow").focus()},e.openInfoPopUp=function(e,t){o.showItem(e,t)},e.mountAsTreeRoot=function(e,t){"pages"===e&&l.NavigationContainer.PageTree.setTemporaryMountPoint(t)},e.newPageWizard=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.NewRecord.moduleUrl+"&id="+n+"&pagesOnly=1&returnUrl="+e.getReturnUrl())},e.newContentWizard=function(t,r){var o=a(this),s=o.data("new-wizard-url");s&&(s+="&returnUrl="+e.getReturnUrl(),i.advanced({title:o.data("title"),type:i.types.ajax,size:i.sizes.medium,content:s,severity:n.SeverityEnum.notice}))},e.newRecord=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"][-"+n+"]=new&returnUrl="+e.getReturnUrl())},e.openHistoryPopUp=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.RecordHistory.moduleUrl+"&element="+t+":"+n+"&returnUrl="+e.getReturnUrl())},e.openListModule=function(e,t){var n="pages"===e?t:a(this).data("page-uid");s.App.showModule("web_list","id="+n)},e.pagesSort=function(e,t){var n=a(this).data("pages-sort-url");n&&l.ContentContainer.setUrl(n)},e.pagesNewMultiple=function(e,t){var n=a(this).data("pages-new-multiple-url");n&&l.ContentContainer.setUrl(n)},e.disableRecord=function(t,n){var r=a(this).data("disable-field")||"hidden";l.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+n+"]["+r+"]=1&redirect="+e.getReturnUrl()).done((function(){l.NavigationContainer.PageTree.refreshTree()}))},e.enableRecord=function(t,n){var r=a(this).data("disable-field")||"hidden";l.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+n+"]["+r+"]=0&redirect="+e.getReturnUrl()).done((function(){l.NavigationContainer.PageTree.refreshTree()}))},e.deleteRecord=function(e,t){var o=a(this);i.confirm(o.data("title"),o.data("message"),n.SeverityEnum.warning,[{text:a(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:a(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",(function(n){"delete"===n.target.getAttribute("name")&&r.process("cmd["+e+"]["+t+"][delete]=1").done((function(){if("pages"===e&&l.NavigationContainer.PageTree){if(t===top.fsMod.recentIds.web){var n=l.NavigationContainer.PageTree.instance.nodes[0];l.NavigationContainer.PageTree.selectNode(n)}l.NavigationContainer.PageTree.refreshTree()}}));i.dismiss()}))},e.copy=function(t,n){var r=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+n+"]=1&CB[setCopyMode]=1";a.ajax(r).always((function(){e.triggerRefresh(l.ContentContainer.get().location.href)}))},e.clipboardRelease=function(t,n){var r=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+n+"]=0";a.ajax(r).always((function(){e.triggerRefresh(l.ContentContainer.get().location.href)}))},e.cut=function(t,n){var r=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+n+"]=1&CB[setCopyMode]=0";a.ajax(r).always((function(){e.triggerRefresh(l.ContentContainer.get().location.href)}))},e.triggerRefresh=function(e){-1===e.indexOf("record%2Fedit")&&l.ContentContainer.refresh(!0)},e.clearCache=function(e,t){var n=top.TYPO3.settings.WebLayout.moduleUrl+"&id="+t+"&clear_cache=1";a.ajax(n)},e.pasteAfter=function(t,n){e.pasteInto.bind(a(this))(t,-n)},e.pasteInto=function(t,r){var o=a(this),s=function(){var n="&CB[paste]="+t+"%7C"+r+"&CB[pad]=normal&redirect="+e.getReturnUrl();l.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+n).done((function(){"pages"===t&&l.NavigationContainer.PageTree&&l.NavigationContainer.PageTree.refreshTree()}))};o.data("title")?i.confirm(o.data("title"),o.data("message"),n.SeverityEnum.warning,[{text:a(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:a(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",(function(e){"ok"===e.target.getAttribute("name")&&s(),i.dismiss()})):s()},e}()}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","moment","./Storage/Persistent"],(function(e,t,a,i,r){"use strict";return new(function(){function t(){var e=this;this.fieldSelector=".t3js-datetimepicker",this.format=(null!=opener&&void 0!==opener.top.TYPO3?opener.top:top).TYPO3.settings.DateTimePicker.DateFormat,a((function(){e.initialize()}))}return t.formatDateForHiddenField=function(e,t){return"time"!==t&&"timesec"!==t||e.year(1970).month(0).date(1),e.format()},t.prototype.initialize=function(){var n=this,o=a(this.fieldSelector).filter((function(e,t){return void 0===a(t).data("DateTimePicker")}));o.length>0&&e(["twbs/bootstrap-datetimepicker"],(function(){var e=r.get("lang");"ch"===e&&(e="zh-cn");var d=!!e&&i.locale(e);o.each((function(e,t){n.initializeField(a(t),d)})),o.on("blur",(function(e){var r=a(e.currentTarget),n=r.parent().parent().find('input[type="hidden"]');if(""===r.val())n.val("");else{var o=r.data("dateType"),d=r.data("DateTimePicker").format(),f=i.utc(r.val(),d);f.isValid()?n.val(t.formatDateForHiddenField(f,o)):r.val(t.formatDateForHiddenField(i.utc(n.val()),o))}})),o.on("dp.change",(function(e){var i=a(e.currentTarget),r=i.parent().parent().find("input[type=hidden]"),n=i.data("dateType"),o="";""!==i.val()&&(o=t.formatDateForHiddenField(e.date.utc(),n)),r.val(o),a(document).trigger("formengine.dp.change",[i])}))}))},t.prototype.initializeField=function(e,t){var a=this.format,r={format:"",locale:"",sideBySide:!0,showTodayButton:!0,toolbarPlacement:"bottom",icons:{time:"fa fa-clock-o",date:"fa fa-calendar",up:"fa fa-chevron-up",down:"fa fa-chevron-down",previous:"fa fa-chevron-left",next:"fa fa-chevron-right",today:"fa fa-calendar-o",clear:"fa fa-trash"}};switch(e.data("dateType")){case"datetime":r.format=a[1];break;case"date":r.format=a[0];break;case"time":r.format="HH:mm";break;case"timesec":r.format="HH:mm:ss";break;case"year":r.format="YYYY"}e.data("dateMindate")&&e.data("dateMindate",i.unix(e.data("dateMindate")).format(r.format)),e.data("dateMaxdate")&&e.data("dateMaxdate",i.unix(e.data("dateMaxdate")).format(r.format)),t&&(r.locale=t),e.datetimepicker(r)},t}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery"],(function(t,e,n){"use strict";var o=new(function(){function t(){var t=this;this.settings={autoscroll:!0},n((function(){t.createDom()}))}return t.incrementInactiveTabCounter=function(t){if(!t.hasClass("active")){var e=t.find(".badge"),n=parseInt(e.text(),10);isNaN(n)&&(n=0),e.text(++n)}},t.prototype.add=function(e,o,s){this.attachToViewport();var a=n("<p />").html(e);void 0!==o&&o.length>0&&a.prepend(n("<strong />").text(o)),void 0!==s&&0!==s.length||(s="Debug");var l="debugtab-"+s.toLowerCase().replace(/\W+/g,"-"),i=this.$consoleDom.find(".t3js-debuggroups"),r=this.$consoleDom.find(".t3js-debugcontent"),c=this.$consoleDom.find(".t3js-debuggroups li[data-identifier="+l+"]");0===c.length&&(c=n("<li />",{role:"presentation","data-identifier":l}).append(n("<a />",{"aria-controls":l,"data-toggle":"tab",href:"#"+l,role:"tab"}).text(s+" ").append(n("<span />",{class:"badge"}))).on("shown.bs.tab",(function(t){n(t.currentTarget).find(".badge").text("")})),i.append(c),r.append(n("<div />",{role:"tabpanel",class:"tab-pane",id:l}).append(n("<div />",{class:"t3js-messages messages"})))),0===i.find(".active").length&&i.find("a:first").tab("show"),t.incrementInactiveTabCounter(c),this.incrementUnreadMessagesIfCollapsed();var d=n("#"+l+" .t3js-messages"),p=d.parent().hasClass("active");d.append(a),this.settings.autoscroll&&p&&d.scrollTop(d.prop("scrollHeight"))},t.prototype.createDom=function(){var t=this;void 0===this.$consoleDom&&(this.$consoleDom=n("<div />",{id:"typo3-debug-console"}).append(n("<div />",{class:"t3js-topbar topbar"}).append(n("<p />",{class:"pull-left"}).text(" TYPO3 Debug Console").prepend(n("<span />",{class:"fa fa-terminal topbar-icon"})).append(n("<span />",{class:"badge"})),n("<div />",{class:"t3js-buttons btn-group pull-right"})),n("<div />").append(n("<div />",{role:"tabpanel"}).append(n("<ul />",{class:"nav nav-tabs t3js-debuggroups",role:"tablist"})),n("<div />",{class:"tab-content t3js-debugcontent"}))),this.addButton(n("<button />",{class:"btn btn-default btn-sm "+(this.settings.autoscroll?"active":""),title:TYPO3.lang["debuggerconsole.autoscroll"]}).append(n("<span />",{class:"t3-icon fa fa-magnet"})),(function(){n(t).button("toggle"),t.settings.autoscroll=!t.settings.autoscroll})).addButton(n("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.toggle.collapse"]}).append(n("<span />",{class:"t3-icon fa fa-chevron-down"})),(function(e){var o=n(e.currentTarget),s=o.find(".t3-icon"),a=t.$consoleDom.find(".t3js-topbar").next();a.toggle(),a.is(":visible")?(o.attr("title",TYPO3.lang["debuggerconsole.toggle.collapse"]),s.toggleClass("fa-chevron-down",!0).toggleClass("fa-chevron-up",!1),t.resetGlobalUnreadCounter()):(o.attr("title",TYPO3.lang["debuggerconsole.toggle.expand"]),s.toggleClass("fa-chevron-down",!1).toggleClass("fa-chevron-up",!0))})).addButton(n("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.clear"]}).append(n("<span />",{class:"t3-icon fa fa-undo"})),(function(){t.flush()})).addButton(n("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.close"]}).append(n("<span />",{class:"t3-icon fa fa-times"})),(function(){t.destroy(),t.createDom()})))},t.prototype.addButton=function(t,e){return t.on("click",e),this.$consoleDom.find(".t3js-buttons").append(t),this},t.prototype.attachToViewport=function(){var t=n(".t3js-scaffold-content");0===t.has(this.$consoleDom).length&&t.append(this.$consoleDom)},t.prototype.incrementUnreadMessagesIfCollapsed=function(){var t=this.$consoleDom.find(".t3js-topbar");if(t.next().is(":hidden")){var e=t.find(".badge"),n=parseInt(e.text(),10);isNaN(n)&&(n=0),e.text(++n)}},t.prototype.resetGlobalUnreadCounter=function(){this.$consoleDom.find(".t3js-topbar").find(".badge").text("")},t.prototype.flush=function(){var t=this.$consoleDom.find(".t3js-debuggroups"),e=this.$consoleDom.find(".t3js-debugcontent");t.children().remove(),e.children().remove()},t.prototype.destroy=function(){this.$consoleDom.remove(),this.$consoleDom=void 0},t}());return TYPO3.DebugConsole=o,o}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery"],(function(e,t,o){"use strict";return new(function(){function e(){var e=this;this.$documentHeader=null,this.$documentHeaderBars=null,this.$documentHeaderNavigationBar=null,this.$documentHeaderSearchBar=null,this.$moduleBody=null,this.direction="down",this.reactionRange=300,this.lastPosition=0,this.currentPosition=0,this.changedPosition=0,this.settings={margin:24,offset:100,selectors:{moduleDocumentHeader:".t3js-module-docheader",moduleDocheaderBar:".t3js-module-docheader-bar",moduleNavigationBar:".t3js-module-docheader-bar-navigation",moduleButtonBar:".t3js-module-docheader-bar-buttons",moduleSearchBar:".t3js-module-docheader-bar-search",moduleBody:".t3js-module-body"}},this.reposition=function(){e.$documentHeader.css("height","auto"),e.$documentHeaderBars.css("height","auto"),e.$moduleBody.css("padding-top",e.$documentHeader.outerHeight()+e.settings.margin)},this.scroll=function(t){e.currentPosition=o(t.currentTarget).scrollTop(),e.currentPosition>e.lastPosition?"down"!==e.direction&&(e.direction="down",e.changedPosition=e.currentPosition):e.currentPosition<e.lastPosition&&"up"!==e.direction&&(e.direction="up",e.changedPosition=e.currentPosition),"up"===e.direction&&e.changedPosition-e.reactionRange<e.currentPosition&&e.$documentHeader.css("margin-top",0),"down"===e.direction&&e.changedPosition+e.reactionRange<e.currentPosition&&e.$documentHeader.css("margin-top",-1*(e.$documentHeaderNavigationBar.outerHeight()+4)),e.lastPosition=e.currentPosition},o((function(){e.initialize()}))}return e.prototype.initialize=function(){this.$documentHeader=o(this.settings.selectors.moduleDocumentHeader),this.$documentHeader.length>0&&(this.$documentHeaderBars=o(this.settings.selectors.moduleDocheaderBar),this.$documentHeaderNavigationBar=o(this.settings.selectors.moduleNavigationBar),this.$documentHeaderSearchBar=o(this.settings.selectors.moduleSearchBar).remove(),this.$documentHeaderSearchBar.length>0&&this.$documentHeader.append(this.$documentHeaderSearchBar),this.$moduleBody=o(this.settings.selectors.moduleBody),this.start())},e.prototype.start=function(){this.reposition(),o(window).on("resize",this.reposition),o(".t3js-module-docheader + .t3js-module-body").on("scroll",this.scroll)},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Severity","jquery","moment","nprogress","./Modal","./Notification"],(function(e,t,i,r,a,o,s,n){"use strict";var d;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.OVERRIDE="replace",e.RENAME="rename",e.SKIP="cancel",e.USE_EXISTING="useExisting"}(d||(d={}));var l=function(){function e(e){var t=this;this.askForOverride=[],this.percentagePerFile=1,this.hideDropzone=function(e){e.stopPropagation(),e.preventDefault(),t.$dropzone.hide()},this.dragFileIntoDocument=function(e){return e.stopPropagation(),e.preventDefault(),r(e.currentTarget).addClass("drop-in-progress"),t.showDropzone(),!1},this.dragAborted=function(e){return e.stopPropagation(),e.preventDefault(),r(e.currentTarget).removeClass("drop-in-progress"),!1},this.ignoreDrop=function(e){return e.stopPropagation(),e.preventDefault(),t.dragAborted(e),!1},this.handleDrop=function(e){t.ignoreDrop(e),t.processFiles(e.originalEvent.dataTransfer.files),t.$dropzone.removeClass("drop-status-ok")},this.fileInDropzone=function(){t.$dropzone.addClass("drop-status-ok")},this.fileOutOfDropzone=function(){t.$dropzone.removeClass("drop-status-ok")},this.$body=r("body"),this.$element=r(e);var i=void 0!==this.$element.data("dropzoneTrigger");this.$trigger=r(this.$element.data("dropzoneTrigger")),this.$dropzone=r("<div />").addClass("dropzone").hide(),this.irreObjectUid=this.$element.data("fileIrreObject");var a=this.$element.data("dropzoneTarget");this.irreObjectUid&&0!==this.$element.nextAll(a).length?(this.dropZoneInsertBefore=!0,this.$dropzone.insertBefore(a)):(this.dropZoneInsertBefore=!1,this.$dropzone.insertAfter(a)),this.$dropzoneMask=r("<div />").addClass("dropzone-mask").appendTo(this.$dropzone),this.fileInput=document.createElement("input"),this.fileInput.setAttribute("type","file"),this.fileInput.setAttribute("multiple","multiple"),this.fileInput.setAttribute("name","files[]"),this.fileInput.classList.add("upload-file-picker"),this.$body.append(this.fileInput),this.$fileList=r(this.$element.data("progress-container")),this.fileListColumnCount=r("thead tr:first th",this.$fileList).length,this.filesExtensionsAllowed=this.$element.data("file-allowed"),this.fileDenyPattern=this.$element.data("file-deny-pattern")?new RegExp(this.$element.data("file-deny-pattern"),"i"):null,this.maxFileSize=parseInt(this.$element.data("max-file-size"),10),this.target=this.$element.data("target-folder"),this.browserCapabilities={fileReader:"undefined"!=typeof FileReader,DnD:"draggable"in document.createElement("span"),Progress:"upload"in new XMLHttpRequest},this.browserCapabilities.DnD?(this.$body.on("dragover",this.dragFileIntoDocument),this.$body.on("dragend",this.dragAborted),this.$body.on("drop",this.ignoreDrop),this.$dropzone.on("dragenter",this.fileInDropzone),this.$dropzoneMask.on("dragenter",this.fileInDropzone),this.$dropzoneMask.on("dragleave",this.fileOutOfDropzone),this.$dropzoneMask.on("drop",(function(e){return t.handleDrop(e)})),this.$dropzone.prepend('<div class="dropzone-hint"><div class="dropzone-hint-media"><div class="dropzone-hint-icon"></div></div><div class="dropzone-hint-body"><h3 class="dropzone-hint-title">'+TYPO3.lang["file_upload.dropzonehint.title"]+'</h3><p class="dropzone-hint-message">'+TYPO3.lang["file_upload.dropzonehint.message"]+"</p></div></div>").click((function(){t.fileInput.click()})),r("<span />").addClass("dropzone-close").click(this.hideDropzone).appendTo(this.$dropzone),0===this.$fileList.length&&(this.$fileList=r("<table />").attr("id","typo3-filelist").addClass("table table-striped table-hover upload-queue").html("<tbody></tbody>").hide(),this.dropZoneInsertBefore?this.$fileList.insertAfter(this.$dropzone):this.$fileList.insertBefore(this.$dropzone),this.fileListColumnCount=7),this.fileInput.addEventListener("change",(function(){t.processFiles(Array.apply(null,t.fileInput.files))})),this.bindUploadButton(!0===i?this.$trigger:this.$element)):console.warn("Browser has no Drag and drop capabilities; cannot initialize DragUploader")}return e.prototype.showDropzone=function(){this.$dropzone.show()},e.prototype.processFiles=function(e){var t=this;this.queueLength=e.length,this.$fileList.is(":visible")||this.$fileList.show(),o.start(),this.percentagePerFile=1/e.length;var i=[];r.each(e,(function(e,a){i[parseInt(e,10)]=r.ajax({url:TYPO3.settings.ajaxUrls.file_exists,data:{fileName:a.name,fileTarget:t.target},cache:!1,success:function(e){if(void 0!==e.uid)t.askForOverride.push({original:e,uploaded:a,action:t.irreObjectUid?d.USE_EXISTING:d.SKIP}),o.inc(t.percentagePerFile);else new p(t,a,d.SKIP)}})})),r.when.apply(r,i).done((function(){t.drawOverrideModal(),o.done()})),this.fileInput.value=""},e.prototype.bindUploadButton=function(e){var t=this;e.click((function(e){e.preventDefault(),t.fileInput.click(),t.showDropzone()}))},e.prototype.decrementQueueLength=function(){this.queueLength>0&&(this.queueLength--,0===this.queueLength&&r.ajax({url:TYPO3.settings.ajaxUrls.flashmessages_render,cache:!1,success:fLine truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,E){"use strict";Object.defineProperty(E,"__esModule",{value:!0}),function(e){e[e.ENTER=13]="ENTER",e[e.ESCAPE=27]="ESCAPE"}(E.KeyTypesEnum||(E.KeyTypesEnum={}))}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){e[e.notice=-2]="notice",e[e.info=-1]="info",e[e.ok=0]="ok",e[e.warning=1]="warning",e[e.error=2]="error"}(n.SeverityEnum||(n.SeverityEnum={}))}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(t){t.scaffold=".t3js-scaffold",t.header=".t3js-scaffold-header",t.moduleMenu=".t3js-scaffold-modulemenu",t.content=".t3js-scaffold-content",t.contentModule=".t3js-scaffold-content-module",t.contentModuleIframe=".t3js-scaffold-content-module-iframe",t.contentNavigation=".t3js-scaffold-content-navigation",t.contentNavigationDataComponent=".t3js-scaffold-content-navigation [data-component]",t.contentNavigationIframe=".t3js-scaffold-content-navigation-iframe"}(n.ScaffoldIdentifierEnum||(n.ScaffoldIdentifierEnum={}))}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){e.buttonNavigationComponent=".t3js-topbar-button-navigationcomponent"}(n.TopbarIdentifiersEnum||(n.TopbarIdentifiersEnum={}))}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])};return function(n,e){function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}();define(["require","exports","./InteractionRequest"],(function(t,n,e){"use strict";return function(t){function n(n,e){void 0===e&&(e=null);var r=t.call(this,n)||this;return r.clientEvent=e,r}return __extends(n,t),n}(e)}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery"],(function(n,t,e){"use strict";return new(function(){function n(){this.consumers=[]}return n.prototype.getConsumers=function(){return this.consumers},n.prototype.hasConsumer=function(n){return-1!==this.consumers.indexOf(n)},n.prototype.attach=function(n){this.hasConsumer(n)||this.consumers.push(n)},n.prototype.detach=function(n){this.consumers=this.consumers.filter((function(t){return t!==n}))},n.prototype.invoke=function(n){var t=[];return this.consumers.forEach((function(e){var r=e.consume.call(e,n);r&&t.push(r)})),e.when.apply(e,t)},n}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,t){"use strict";return function(){function e(e,t){void 0===t&&(t=null),this.processed=!1,this.processedData=null,this.type=e,this.parentRequest=t}return Object.defineProperty(e.prototype,"outerMostRequest",{get:function(){for(var t=this;t.parentRequest instanceof e;)t=t.parentRequest;return t},enumerable:!0,configurable:!0}),e.prototype.isProcessed=function(){return this.processed},e.prototype.getProcessedData=function(){return this.processedData},e.prototype.setProcessedData=function(e){void 0===e&&(e=null),this.processed=!0,this.processedData=e},e}()}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(t,e){"use strict";return new(function(){function t(){this.assignments=[]}return t.prototype.attachFor=function(t,e){var r=this.getFor(t);null===r&&(r={request:t,deferreds:[]},this.assignments.push(r)),r.deferreds.push(e)},t.prototype.detachFor=function(t){var e=this.getFor(t);this.assignments=this.assignments.filter((function(t){return t===e}))},t.prototype.getFor=function(t){var e=null;return this.assignments.some((function(r){return r.request===t&&(e=r,!0)})),e},t.prototype.resolveFor=function(t){var e=this.getFor(t);return null!==e&&(e.deferreds.forEach((function(t){return t.resolve()})),this.detachFor(t),!0)},t.prototype.rejectFor=function(t){var e=this.getFor(t);return null!==e&&(e.deferreds.forEach((function(t){return t.reject()})),this.detachFor(t),!0)},t}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();define(["require","exports","./InteractionRequest"],(function(t,e,n){"use strict";return function(t){function e(e,n){return void 0===n&&(n=null),t.call(this,e,n)||this}return __extends(e,t),e.prototype.concerns=function(t){if(this===t)return!0;for(var e=this;e.parentRequest instanceof n;)if((e=e.parentRequest)===t)return!0;return!1},e.prototype.concernsTypes=function(t){if(-1!==t.indexOf(this.type))return!0;for(var e=this;e.parentRequest instanceof n;)if(e=e.parentRequest,-1!==t.indexOf(e.type))return!0;return!1},e}(n)}));
|
||||
File diff suppressed because it is too large.
Load diff
+75
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/FormEngine/Element/SelectSingleElement
|
||||
* Logic for SelectSingleElement
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{}}
|
||||
* @exports TYPO3/CMS/Backend/FormEngine/Element/SelectSingleElement
|
||||
*/
|
||||
var SelectSingleElement = {};
|
||||
|
||||
/**
|
||||
* Initializes the SelectSingleEleemnt
|
||||
*
|
||||
* @param {String} selector
|
||||
* @param {Object} options
|
||||
*/
|
||||
SelectSingleElement.initialize = function(selector, options) {
|
||||
|
||||
var $selectElement = $(selector);
|
||||
var $groupIconContainer = $selectElement.prev('.input-group-icon');
|
||||
var options = options || {};
|
||||
|
||||
$selectElement.on('change', function(e) {
|
||||
var $me = $(e.target);
|
||||
|
||||
// Update prepended select icon
|
||||
$groupIconContainer.html($selectElement.find(':selected').data('icon'));
|
||||
|
||||
var $selectIcons = $me.closest('.t3js-formengine-field-item').find('.t3js-forms-select-single-icons');
|
||||
$selectIcons.find('.item.active').removeClass('active');
|
||||
$selectIcons.find('[data-select-index="' + $me.prop('selectedIndex') + '"]').closest('.item').addClass('active');
|
||||
});
|
||||
|
||||
// Append optionally passed additional "change" event callback
|
||||
if (typeof options.onChange === 'function') {
|
||||
$selectElement.on('change', options.onChange);
|
||||
}
|
||||
|
||||
// Append optionally passed additional "focus" event callback
|
||||
if (typeof options.onFocus === 'function') {
|
||||
$selectElement.on('focus', options.onFocus);
|
||||
}
|
||||
|
||||
$selectElement.closest('.form-control-wrap').find('.t3js-forms-select-single-icons a').on('click', function(e) {
|
||||
var $me = $(e.target);
|
||||
var $selectIcon = $me.closest('[data-select-index]');
|
||||
|
||||
$me.closest('.t3js-forms-select-single-icons').find('.item.active').removeClass('active');
|
||||
$selectElement
|
||||
.prop('selectedIndex', $selectIcon.data('selectIndex'))
|
||||
.trigger('change');
|
||||
$selectIcon.closest('.item').addClass('active');
|
||||
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
return SelectSingleElement;
|
||||
});
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/FormEngine/Element/SelectTree
|
||||
* Handles rendering of the record tree based on SVG for TCA fields with renderType "SelectTree"
|
||||
* (e.g. category tree).
|
||||
*
|
||||
* Extends TYPO3/CMS/Backend/SvgTree component.
|
||||
*/
|
||||
define(['d3', 'TYPO3/CMS/Backend/SvgTree', 'TYPO3/CMS/Backend/FormEngine'],
|
||||
function(d3, SvgTree) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @exports TYPO3/CMS/Backend/FormEngine/Element/SelectTree
|
||||
*/
|
||||
var SelectTree = function() {
|
||||
SvgTree.call(this);
|
||||
this.settings.showCheckboxes = true;
|
||||
};
|
||||
|
||||
SelectTree.prototype = Object.create(SvgTree.prototype);
|
||||
var _super_ = SvgTree.prototype;
|
||||
|
||||
/**
|
||||
* SelectTree initialization
|
||||
*
|
||||
* @param {String} selector
|
||||
* @param {Object} settings
|
||||
*/
|
||||
SelectTree.prototype.initialize = function(selector, settings) {
|
||||
if (!_super_.initialize.call(this, selector, settings)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.addIcons();
|
||||
this.dispatch.on('updateNodes.selectTree', this.updateNodes);
|
||||
this.dispatch.on('loadDataAfter.selectTree', this.loadDataAfter);
|
||||
this.dispatch.on('updateSvg.selectTree', this.renderCheckbox);
|
||||
this.dispatch.on('nodeSelectedAfter.selectTree', this.nodeSelectedAfter);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function relays on node.indeterminate state being up to date
|
||||
*
|
||||
* @param {Selection} nodeSelection
|
||||
*/
|
||||
SelectTree.prototype.updateNodes = function(nodeSelection) {
|
||||
if (this.settings.showCheckboxes) {
|
||||
nodeSelection
|
||||
.selectAll('.tree-check use')
|
||||
.attr('visibility', function(node) {
|
||||
var checked = Boolean(node.checked);
|
||||
if (d3.select(this).classed('icon-checked') && checked) {
|
||||
return 'visible';
|
||||
} else if (d3.select(this).classed('icon-indeterminate') && node.indeterminate && !checked) {
|
||||
return 'visible';
|
||||
} else if (d3.select(this).classed('icon-check') && !node.indeterminate && !checked) {
|
||||
return 'visible';
|
||||
} else {
|
||||
return 'hidden';
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds svg elements for checkbox rendering.
|
||||
*
|
||||
* @param {Selection} nodeSelection ENTER selection (only new DOM objects)
|
||||
*/
|
||||
SelectTree.prototype.renderCheckbox = function(nodeSelection) {
|
||||
var _this = this;
|
||||
if (this.settings.showCheckboxes) {
|
||||
this.textPosition = 50;
|
||||
|
||||
// this can be simplified to single "use" element with changing href on click
|
||||
// when we drop IE11 on WIN7 support
|
||||
var g = nodeSelection.filter(function(node) {
|
||||
// do not render checkbox if node is not selectable
|
||||
return _this.isNodeSelectable(node) || Boolean(node.checked);
|
||||
})
|
||||
.append('g')
|
||||
.attr('class', 'tree-check')
|
||||
.on('click', function(d) {
|
||||
_this.selectNode(d);
|
||||
});
|
||||
|
||||
g.append('use')
|
||||
.attr('x', 28)
|
||||
.attr('y', -8)
|
||||
.attr('visibility', 'hidden')
|
||||
.attr('class', 'icon-check')
|
||||
.attr('xlink:href', '#icon-check');
|
||||
g.append('use')
|
||||
.attr('x', 28)
|
||||
.attr('y', -8)
|
||||
.attr('visibility', 'hidden')
|
||||
.attr('class', 'icon-checked')
|
||||
.attr('xlink:href', '#icon-checked');
|
||||
g.append('use')
|
||||
.attr('x', 28)
|
||||
.attr('y', -8)
|
||||
.attr('visibility', 'hidden')
|
||||
.attr('class', 'icon-indeterminate')
|
||||
.attr('xlink:href', '#icon-indeterminate');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the indeterminate state for ancestors of the current node
|
||||
*
|
||||
* @param {Node} node
|
||||
*/
|
||||
SelectTree.prototype.updateAncestorsIndeterminateState = function(node) {
|
||||
var _this = this;
|
||||
|
||||
//foreach ancestor except node itself
|
||||
var indeterminate = false;
|
||||
node.parents.forEach(function(index) {
|
||||
var n = _this.nodes[index];
|
||||
n.indeterminate = (node.checked || node.indeterminate || indeterminate);
|
||||
|
||||
// check state for the next level
|
||||
indeterminate = (node.checked || node.indeterminate || n.checked || n.indeterminate);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the node.indeterminate for the whole tree.
|
||||
* It's done once after loading data.
|
||||
* Later indeterminate state is updated just for the subset of nodes
|
||||
*/
|
||||
SelectTree.prototype.loadDataAfter = function() {
|
||||
this.nodes.forEach(function(node) {
|
||||
node.indeterminate = false;
|
||||
});
|
||||
|
||||
this.calculateIndeterminate(this.nodes);
|
||||
|
||||
// Initialise "value" attribute of input field after load and revalidate form engine fields
|
||||
this.saveCheckboxes(this.nodes);
|
||||
if (typeof TYPO3.FormEngine.Validation !== 'undefined' && typeof TYPO3.FormEngine.Validation.validate === 'function') {
|
||||
TYPO3.FormEngine.Validation.validate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets indeterminate state for a subtree.
|
||||
* It relays on the tree to have indeterminate state reset beforehand.
|
||||
*
|
||||
* @param {Array} nodes
|
||||
*/
|
||||
SelectTree.prototype.calculateIndeterminate = function(nodes) {
|
||||
nodes.forEach(function(node) {
|
||||
if ((node.checked || node.indeterminate) && node.parents && node.parents.length > 0) {
|
||||
node.parents.forEach(function(parentNodeIndex) {
|
||||
nodes[parentNodeIndex].indeterminate = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Observer for the selectedNode event
|
||||
*
|
||||
* @param {Node} node
|
||||
*/
|
||||
SelectTree.prototype.nodeSelectedAfter = function(node) {
|
||||
this.updateAncestorsIndeterminateState(node);
|
||||
|
||||
// check all nodes again, to ensure correct display of indeterminate state
|
||||
this.calculateIndeterminate(this.nodes);
|
||||
this.saveCheckboxes();
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets a comma-separated list of selected nodes identifiers to configured input
|
||||
*/
|
||||
SelectTree.prototype.saveCheckboxes = function() {
|
||||
if (typeof this.settings.input !== 'undefined') {
|
||||
var selectedNodes = this.getSelectedNodes();
|
||||
this.settings.input.val(selectedNodes.map(function(d) {
|
||||
return d.identifier;
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add icons imitating checkboxes
|
||||
*/
|
||||
SelectTree.prototype.addIcons = function() {
|
||||
|
||||
this.data.icons = {
|
||||
check: {
|
||||
identifier: 'check',
|
||||
icon: '<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">' +
|
||||
'<rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M1312 256h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113v-832q0-66-47-113t-113-47zm288 160v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"></path></g>'
|
||||
},
|
||||
checked: {
|
||||
identifier: 'checked',
|
||||
icon: '<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M813 1299l614-614q19-19 19-45t-19-45l-102-102q-19-19-45-19t-45 19l-467 467-211-211q-19-19-45-19t-45 19l-102 102q-19 19-19 45t19 45l358 358q19 19 45 19t45-19zm851-883v960q0 119-84.5 203.5t-203.5 84.5h-960q-119 0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5 84.5t84.5 203.5z"></path></g>'
|
||||
},
|
||||
indeterminate: {
|
||||
identifier: 'indeterminate',
|
||||
icon: '<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"></path></g>'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
return SelectTree;
|
||||
});
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialization of the selectTree js component used e.g. for category tree rendering
|
||||
*/
|
||||
define(['jquery', 'TYPO3/CMS/Backend/FormEngine/Element/SelectTree'],
|
||||
function($, SelectTree) {
|
||||
'use strict';
|
||||
|
||||
var SelectTreeElement = {};
|
||||
|
||||
SelectTreeElement.initialize = function() {
|
||||
$(document).ready(function() {
|
||||
$('.typo3-tceforms-tree .treeRecord').each(function(i, element) {
|
||||
|
||||
/**
|
||||
* Hidden input field storing selected elements.
|
||||
* Tree is initialized based on values stored in it's data attributes
|
||||
*
|
||||
* @type {*|jQuery|HTMLElement}
|
||||
*/
|
||||
var $treeInput = $(element);
|
||||
var dataParams = {
|
||||
tableName: $treeInput.data('tablename'),
|
||||
fieldName: $treeInput.data('fieldname'),
|
||||
uid: $treeInput.data('uid'),
|
||||
recordTypeValue: $treeInput.data('recordtypevalue'),
|
||||
dataStructureIdentifier: $treeInput.data('datastructureidentifier'),
|
||||
flexFormSheetName: $treeInput.data('flexformsheetname'),
|
||||
flexFormFieldName: $treeInput.data('flexformfieldname'),
|
||||
flexFormContainerName: $treeInput.data('flexformcontainername'),
|
||||
flexFormContainerIdentifier: $treeInput.data('flexformcontaineridentifier'),
|
||||
flexFormContainerFieldName: $treeInput.data('flexformcontainerfieldname'),
|
||||
flexFormSectionContainerIsNew: $treeInput.data('flexformsectioncontainerisnew'),
|
||||
command: $treeInput.data('command')
|
||||
};
|
||||
var $wrapper = $treeInput.parent().siblings('.svg-tree-wrapper');
|
||||
var dataUrl = TYPO3.settings.ajaxUrls.record_tree_data + '&' + $.param(dataParams);
|
||||
var tree = new SelectTree();
|
||||
var initialized = tree.initialize($wrapper, {
|
||||
dataUrl: dataUrl,
|
||||
showIcons: true,
|
||||
showCheckboxes: true,
|
||||
readOnlyMode: $treeInput.data('read-only'),
|
||||
input: $treeInput,
|
||||
exclusiveNodesIdentifiers: $treeInput.data('tree-exclusive-keys'),
|
||||
validation: $treeInput.data('formengine-validation-rules')[0],
|
||||
expandUpToLevel: $treeInput.data('tree-expand-up-to-level')
|
||||
});
|
||||
if (!initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
tree.dispatch.on('nodeSelectedAfter.requestUpdate', window[$wrapper.attr('id')]);
|
||||
|
||||
if ($treeInput.data('tree-show-toolbar')) {
|
||||
require(['TYPO3/CMS/Backend/FormEngine/Element/TreeToolbar'], function(TreeToolbar) {
|
||||
var selectTreeToolbar = new TreeToolbar();
|
||||
selectTreeToolbar.initialize($wrapper);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return SelectTreeElement;
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery"],(function(e,l,n){"use strict";var i,t;return function(e){e.toggleButton=".t3js-form-field-slug-toggle",e.recreateButton=".t3js-form-field-slug-recreate",e.inputField=".t3js-form-field-slug-input",e.readOnlyField=".t3js-form-field-slug-readonly",e.hiddenField=".t3js-form-field-slug-hidden"}(i||(i={})),function(e){e.AUTO="auto",e.RECREATE="recreate",e.MANUAL="manual"}(t||(t={})),function(){function e(e,l){var t=this;this.options=null,this.$fullElement=null,this.manuallyChanged=!1,this.$readOnlyField=null,this.$inputField=null,this.$hiddenField=null,this.xhr=null,this.fieldsToListenOn={},this.options=l,this.fieldsToListenOn=this.options.listenerFieldNames||{},n((function(){t.$fullElement=n(e),t.$inputField=t.$fullElement.find(i.inputField),t.$readOnlyField=t.$fullElement.find(i.readOnlyField),t.$hiddenField=t.$fullElement.find(i.hiddenField),t.registerEvents()}))}return e.prototype.registerEvents=function(){var e=this,l=Object.keys(this.getAvailableFieldsForProposalGeneration()).map((function(l){return e.fieldsToListenOn[l]}));l.length>0?("new"===this.options.command&&n(this.$fullElement).on("keyup",l.join(","),(function(){e.manuallyChanged||e.sendSlugProposal(t.AUTO)})),n(this.$fullElement).on("click",i.recreateButton,(function(l){l.preventDefault(),e.$readOnlyField.hasClass("hidden")&&(e.$readOnlyField.toggleClass("hidden",!1),e.$inputField.toggleClass("hidden",!0)),e.sendSlugProposal(t.RECREATE)}))):n(this.$fullElement).find(i.recreateButton).addClass("disabled").prop("disabled",!0),n(this.$inputField).on("keyup",(function(){e.manuallyChanged=!0,e.sendSlugProposal(t.MANUAL)})),n(this.$fullElement).on("click",i.toggleButton,(function(l){l.preventDefault();var n=e.$readOnlyField.hasClass("hidden");e.$readOnlyField.toggleClass("hidden",!n),e.$inputField.toggleClass("hidden",n),n?(e.$inputField.val()!==e.$readOnlyField.val()?e.$readOnlyField.val(e.$inputField.val()):(e.manuallyChanged=!1,e.$fullElement.find(".t3js-form-proposal-accepted").addClass("hidden"),e.$fullElement.find(".t3js-form-proposal-different").addClass("hidden")),e.$hiddenField.val(e.$readOnlyField.val())):e.$hiddenField.val(e.$inputField.val())}))},e.prototype.sendSlugProposal=function(e){var l=this,i={};e===t.AUTO||e===t.RECREATE?(n.each(this.getAvailableFieldsForProposalGeneration(),(function(e,l){i[e]=n('[data-formengine-input-name="'+l+'"]').val()})),!0===this.options.includeUidInValues&&(i.uid=this.options.recordId.toString())):i.manual=this.$inputField.val(),null!==this.xhr&&4!==this.xhr.readyState&&this.xhr.abort(),this.xhr=n.post(TYPO3.settings.ajaxUrls.record_slug_suggest,{values:i,mode:e,tableName:this.options.tableName,pageId:this.options.pageId,parentPageId:this.options.parentPageId,recordId:this.options.recordId,language:this.options.language,fieldName:this.options.fieldName,command:this.options.command,signature:this.options.signature},(function(n){var i="/"+n.proposal.replace(/^\//,"");n.hasConflicts?(l.$fullElement.find(".t3js-form-proposal-accepted").addClass("hidden"),l.$fullElement.find(".t3js-form-proposal-different").removeClass("hidden").find("span").text(i)):(l.$fullElement.find(".t3js-form-proposal-accepted").removeClass("hidden").find("span").text(i),l.$fullElement.find(".t3js-form-proposal-different").addClass("hidden")),l.$hiddenField.val()!==n.proposal&&l.$fullElement.find("input").trigger("change"),e===t.AUTO||e===t.RECREATE?(l.$readOnlyField.val(n.proposal),l.$hiddenField.val(n.proposal),l.$inputField.val(n.proposal)):l.$hiddenField.val(n.proposal)}),"json")},e.prototype.getAvailableFieldsForProposalGeneration=function(){var e={};return n.each(this.fieldsToListenOn,(function(l,i){n('[data-formengine-input-name="'+i+'"]').length>0&&(e[l]=i)})),e},e}()}));
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/FormEngine/Element/TreeToolbar
|
||||
*/
|
||||
define(['jquery',
|
||||
'TYPO3/CMS/Backend/Icons',
|
||||
'TYPO3/CMS/Backend/Tooltip',
|
||||
'TYPO3/CMS/Backend/SvgTree'
|
||||
],
|
||||
function($, Icons) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* TreeToolbar class
|
||||
*
|
||||
* @constructor
|
||||
* @exports TYPO3/CMS/Backend/FormEngine/Element/TreeToolbar
|
||||
*/
|
||||
var TreeToolbar = function() {
|
||||
this.settings = {
|
||||
toolbarSelector: '.tree-toolbar',
|
||||
collapseAllBtn: '.collapse-all-btn',
|
||||
expandAllBtn: '.expand-all-btn',
|
||||
searchInput: '.search-input',
|
||||
toggleHideUnchecked: '.hide-unchecked-btn'
|
||||
};
|
||||
|
||||
/**
|
||||
* jQuery object wrapping the SvgTree
|
||||
*
|
||||
* @type {jQuery}
|
||||
*/
|
||||
this.$treeWrapper = null;
|
||||
|
||||
/**
|
||||
* SvgTree instance
|
||||
*
|
||||
* @type {SvgTree}
|
||||
*/
|
||||
this.tree = null;
|
||||
|
||||
/**
|
||||
* State of the hide unchecked toggle button
|
||||
*
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this._hideUncheckedState = false;
|
||||
|
||||
/**
|
||||
* Toolbar template
|
||||
*
|
||||
* @type {jQuery}
|
||||
*/
|
||||
this.$template = $(
|
||||
'<div class="tree-toolbar btn-toolbar">' +
|
||||
'<div class="input-group">' +
|
||||
'<span class="input-group-addon input-group-icon filter"></span>' +
|
||||
'<input type="text" class="form-control search-input" placeholder="' + TYPO3.lang['tcatree.findItem'] + '">' +
|
||||
'</div>' +
|
||||
'<div class="btn-group">' +
|
||||
'<button type="button" data-toggle="tooltip" class="btn btn-default expand-all-btn" title="' + TYPO3.lang['tcatree.expandAll'] + '"></button>' +
|
||||
'<button type="button" data-toggle="tooltip" class="btn btn-default collapse-all-btn" title="' + TYPO3.lang['tcatree.collapseAll'] + '"></button>' +
|
||||
'<button type="button" data-toggle="tooltip" class="btn btn-default hide-unchecked-btn" title="' + TYPO3.lang['tcatree.toggleHideUnchecked'] + '"></button>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Toolbar initialization
|
||||
*
|
||||
* @param {String} treeSelector
|
||||
* @param {Object} settings
|
||||
*/
|
||||
TreeToolbar.prototype.initialize = function(treeSelector, settings) {
|
||||
this.$treeWrapper = $(treeSelector);
|
||||
if (!this.$treeWrapper.data('svgtree-initialized') || typeof this.$treeWrapper.data('svgtree') !== 'object') {
|
||||
|
||||
// both toolbar and tree are loaded independently through require js,
|
||||
// so we don't know which is loaded first.
|
||||
// In case of toolbar being loaded first, we wait for an event from svgTree
|
||||
this.$treeWrapper.on('svgTree.initialized', this.render.bind(this));
|
||||
return;
|
||||
}
|
||||
|
||||
$.extend(this.settings, settings);
|
||||
this.render();
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders toolbar
|
||||
*/
|
||||
TreeToolbar.prototype.render = function() {
|
||||
var _this = this;
|
||||
this.tree = this.$treeWrapper.data('svgtree');
|
||||
var $toolbar = this.$template.clone().insertBefore(this.$treeWrapper);
|
||||
|
||||
Icons.getIcon('actions-filter', Icons.sizes.small).done(function(icon) {
|
||||
$toolbar.find('.filter').append(icon);
|
||||
});
|
||||
|
||||
Icons.getIcon('apps-pagetree-category-expand-all', Icons.sizes.small).done(function(icon) {
|
||||
$toolbar.find('.expand-all-btn').append(icon);
|
||||
});
|
||||
|
||||
Icons.getIcon('apps-pagetree-category-collapse-all', Icons.sizes.small).done(function(icon) {
|
||||
$toolbar.find('.collapse-all-btn').append(icon);
|
||||
});
|
||||
|
||||
Icons.getIcon('apps-pagetree-category-toggle-hide-checked', Icons.sizes.small).done(function(icon) {
|
||||
$toolbar.find('.hide-unchecked-btn').append(icon);
|
||||
});
|
||||
|
||||
$toolbar.find(this.settings.collapseAllBtn).on('click', this.collapseAll.bind(this));
|
||||
$toolbar.find(this.settings.expandAllBtn).on('click', this.expandAll.bind(this));
|
||||
$toolbar.find(this.settings.searchInput).on('input', function() {
|
||||
_this.search.call(_this, this);
|
||||
});
|
||||
|
||||
$toolbar.find(this.settings.toggleHideUnchecked).on('click', this.toggleHideUnchecked.bind(this));
|
||||
$toolbar.find('[data-toggle="tooltip"]').tooltip();
|
||||
};
|
||||
|
||||
/**
|
||||
* Collapse children of root node
|
||||
*/
|
||||
TreeToolbar.prototype.collapseAll = function() {
|
||||
this.tree.collapseAll();
|
||||
};
|
||||
|
||||
/**
|
||||
* Expand all nodes
|
||||
*/
|
||||
TreeToolbar.prototype.expandAll = function() {
|
||||
this.tree.expandAll();
|
||||
};
|
||||
|
||||
/**
|
||||
* Find node by name
|
||||
*
|
||||
* @param {HTMLElement} input
|
||||
*/
|
||||
TreeToolbar.prototype.search = function(input) {
|
||||
var _this = this;
|
||||
var name = $(input).val();
|
||||
|
||||
this.tree.nodes[0].open = false;
|
||||
this.tree.nodes.forEach(function(node) {
|
||||
var regex = new RegExp(name, 'i');
|
||||
if (regex.test(node.name)) {
|
||||
_this.showParents(node);
|
||||
node.open = true;
|
||||
node.hidden = false;
|
||||
} else {
|
||||
node.hidden = true;
|
||||
node.open = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.tree.prepareDataForVisibleNodes();
|
||||
this.tree.update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Show only checked items
|
||||
*/
|
||||
TreeToolbar.prototype.toggleHideUnchecked = function() {
|
||||
var _this = this;
|
||||
|
||||
this._hideUncheckedState = !this._hideUncheckedState;
|
||||
|
||||
if (this._hideUncheckedState) {
|
||||
this.tree.nodes.forEach(function(node) {
|
||||
if (node.checked) {
|
||||
_this.showParents(node);
|
||||
node.open = true;
|
||||
node.hidden = false;
|
||||
} else {
|
||||
node.hidden = true;
|
||||
node.open = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.tree.nodes.forEach(function(node) {
|
||||
node.hidden = false;
|
||||
});
|
||||
}
|
||||
|
||||
this.tree.prepareDataForVisibleNodes();
|
||||
this.tree.update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds and show all parents of node
|
||||
*
|
||||
* @param {Node} node
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
TreeToolbar.prototype.showParents = function(node) {
|
||||
if (node.parents.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var parent = this.tree.nodes[node.parents[0]];
|
||||
parent.hidden = false;
|
||||
|
||||
//expand parent node
|
||||
parent.open = true;
|
||||
this.showParents(parent);
|
||||
};
|
||||
|
||||
return TreeToolbar;
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine"],(function(e,t,n,r){"use strict";return function(e){var t=this;this.controlElement=null,this.registerClickHandler=function(e){e.preventDefault(),r.preventFollowLinkIfNotSaved(t.controlElement.getAttribute("href"))},n((function(){t.controlElement=document.querySelector(e),t.controlElement.addEventListener("click",t.registerClickHandler)}))}}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __values=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine"],(function(e,t,r,n){"use strict";return function(e){var t=this;this.controlElement=null,this.registerClickHandler=function(e){e.preventDefault();var r,l,o=t.controlElement.dataset.element,i=JSON.parse(t.controlElement.dataset.clipboardItems);try{for(var a=__values(i),c=a.next();!c.done;c=a.next()){var u=c.value;n.setSelectOptionFromExternalSource(o,u.value,u.title,u.title)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(l=a.return)&&l.call(a)}finally{if(r)throw r.error}}},r((function(){t.controlElement=document.querySelector(e),t.controlElement.addEventListener("click",t.registerClickHandler)}))}}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine"],(function(e,t,n,r){"use strict";return function(e){var t=this;this.controlElement=null,this.registerClickHandler=function(e){e.preventDefault(),r.preventFollowLinkIfNotSaved(t.controlElement.getAttribute("href"))},n((function(){t.controlElement=document.querySelector(e),t.controlElement.addEventListener("click",t.registerClickHandler)}))}}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __values=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}};define(["require","exports","jquery"],(function(e,t,n){"use strict";return function(e){var t=this;this.controlElement=null,this.registerClickHandler=function(e){e.preventDefault();var n,r,l=t.controlElement.dataset.itemName,o=JSON.parse(t.controlElement.dataset.selectedIndices),c=document.forms.namedItem("editform").querySelector('[name="'+l+'[]"]');c.selectedIndex=-1;try{for(var i=__values(o),a=i.next();!a.done;a=i.next()){var u=a.value;c.options[u].selected=!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},n((function(){t.controlElement=document.querySelector(e),null!==t.controlElement&&t.controlElement.addEventListener("click",t.registerClickHandler)}))}}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine"],(function(e,t,n,r){"use strict";return function(e){var t=this;this.controlElement=null,this.registerClickHandler=function(e){e.preventDefault(),r.preventFollowLinkIfNotSaved(t.controlElement.getAttribute("href"))},n((function(){t.controlElement=document.querySelector(e),t.controlElement.addEventListener("click",t.registerClickHandler)}))}}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","twbs/bootstrap-slider"],(function(e,t,a){"use strict";return function(){function e(e){var t=this;this.controlElement=null,this.renderTooltipValue=function(e){var n;switch(a(t.controlElement).data().sliderValueType){case"double":n=parseFloat(e).toFixed(2);break;case"int":default:n=parseInt(e,10).toString()}return n},this.controlElement=document.getElementById(e),this.initializeSlider()}return e.updateValue=function(e){var t=a(e.currentTarget),n=a('[data-formengine-input-name="'+t.data("sliderItemName")+'"]'),r=t.data("sliderCallbackParams");n.val(e.value.newValue),TBE_EDITOR.fieldChanged.apply(TBE_EDITOR,r)},e.prototype.initializeSlider=function(){var t=a(this.controlElement);t.slider({formatter:this.renderTooltipValue}),t.on("change",e.updateValue)},e}()}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Backend/Modal","jquery-ui/sortable"],(function(require,exports,$,FormEngine,Modal){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var FlexFormElement=function(){function e(t,o){this.el=t;var n=this;return this.el=t,this.$el=$(t),void 0!==this.$el.data("TYPO3.FormEngine.FlexFormElement")&&this.$el.removeData("TYPO3.FormEngine.FlexFormElement"),this.$el.data("TYPO3.FormEngine.FlexFormElement",this),o||(o=e.defaults),o.allowRestructure=this.$el.data("t3-flex-allow-restructure"),o.flexformId=this.$el.attr("id"),this.opts=$.extend({},e.defaults,o),this.initializeEvents(),this.$el.find(this.opts.sectionSelector).each((function(){n.generateSectionPreview($(this))})),this}return e.prototype.initializeEvents=function(){var e=this;return this.$el.prev(this.opts.flexFormToggleAllSectionsSelector).off("click").on("click",(function(){e.$el.find(e.opts.sectionToggleButtonSelector).trigger("click")})),this.opts.allowRestructure&&(this.createSortable(),this.$el.off("click").on("click",this.opts.deleteIconSelector,(function(t){t.preventDefault();var o=TYPO3.lang["flexform.section.delete.title"]||"Are you sure?",n=TYPO3.lang["flexform.section.delete.message"]||"Are you sure you want to delete this section?",i=Modal.confirm(o,n);i.on("confirm.button.cancel",(function(){Modal.currentModal.trigger("modal-dismiss")})),i.on("confirm.button.ok",(function(){$(t.target).closest(e.opts.sectionSelector).hide().addClass(e.opts.sectionDeletedClass),e.setActionStatus(),FormEngine.Validation.validate(),Modal.currentModal.trigger("modal-dismiss")}))})),this.$el.on("click",this.opts.sectionToggleButtonSelector,(function(t){t.preventDefault();var o=$(t.currentTarget).closest(e.opts.sectionSelector);e.toggleSection(o)})).on("click",this.opts.sectionToggleButtonSelector+" .form-irre-header-control",(function(e){e.stopPropagation()}))),this},e.prototype.createSortable=function(){var e=this;this.$el.sortable({containment:"parent",handle:".t3js-sortable-handle",axis:"y",tolerance:"pointer",stop:function(){e.setActionStatus(),$(document).trigger("flexform:sorting-changed")}})},e.prototype.setActionStatus=function(){var e=this;this.$el.find(this.opts.sectionActionInputFieldSelector).each((function(t){var o=$(this).parents(e.opts.sectionSelector).hasClass(e.opts.sectionDeletedClass)?"DELETE":t;$(this).val(o)}))},e.prototype.toggleSection=function(e){var t=e.find(this.opts.sectionContentSelector);t.toggle(),t.is(":visible")?(e.find(this.opts.sectionToggleIconOpenSelector).show(),e.find(this.opts.sectionToggleIconCloseSelector).hide(),e.find(this.opts.sectionToggleInputFieldSelector).val(0)):(e.find(this.opts.sectionToggleIconOpenSelector).hide(),e.find(this.opts.sectionToggleIconCloseSelector).show(),e.find(this.opts.sectionToggleInputFieldSelector).val(1)),this.generateSectionPreview(e)},e.prototype.generateSectionPreview=function(e){var t=e.find(this.opts.sectionContentSelector),o="";t.is(":visible")||t.find("input[type=text], textarea").each((function(){var e=$($.parseHTML($(this).val())).text();e.length>50&&(e=e.substring(0,50)+"..."),o+=(o?" / ":"")+e})),0===e.find(this.opts.sectionHeaderPreviewSelector).length&&e.find(this.opts.sectionHeaderSelector).find(".t3js-record-title").parent().append('<span class="'+this.opts.sectionHeaderPreviewSelector.replace(/\./,"")+'"></span>'),e.find(this.opts.sectionHeaderPreviewSelector).text(o)},e.defaults={deleteIconSelector:".t3js-delete",sectionSelector:".t3js-flex-section",sectionContentSelector:".t3js-flex-section-content",sectionHeaderSelector:".t3js-flex-section-header",sectionHeaderPreviewSelector:".t3js-flex-section-header-preview",sectionActionInputFieldSelector:".t3js-flex-control-action",sectionToggleInputFieldSelector:".t3js-flex-control-toggle",sectionToggleIconOpenSelector:".t3js-flex-control-toggle-icon-open",sectionToggleIconCloseSelector:".t3js-flex-control-toggle-icon-close",sectionToggleButtonSelector:'[data-toggle="formengine-flex"]',flexFormToggleAllSectionsSelector:".t3js-form-field-toggle-flexsection",sectionDeletedClass:"t3js-flex-section-deleted",allowRestructure:!1,flexformId:!1},e}();$.fn.t3FormEngineFlexFormElement=function(e){return this.each((function(){new FlexFormElement(this,e)}))},$((function(){$(".t3-flex-container").t3FormEngineFlexFormElement(),$(document).on("click",".t3js-flex-container-add",(function(e){var me=$(this);e.preventDefault(),$.ajax({url:TYPO3.settings.ajaxUrls.record_flex_container_add,type:"POST",cache:!1,data:{vanillaUid:me.data("vanillauid"),databaseRowUid:me.data("databaserowuid"),command:me.data("command"),tableName:me.data("tablename"),fieldName:me.data("fieldname"),recordTypeValue:me.data("recordtypevalue"),dataStructureIdentifier:me.data("datastructureidentifier"),flexFormSheetName:me.data("flexformsheetname"),flexFormFieldName:me.data("flexformfieldname"),flexFormContainerName:me.data("flexformcontainername")},success:function(response){me.closest("Line truncated
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/FormEngineLinkBrowserAdapter
|
||||
* LinkBrowser communication with parent window
|
||||
*/
|
||||
define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{updateFunctions: null}}
|
||||
* @exports TYPO3/CMS/Backend/FormEngineLinkBrowserAdapter
|
||||
*/
|
||||
var FormEngineLinkBrowserAdapter = {
|
||||
updateFunctions: null // those are set in the module initializer function in PHP
|
||||
};
|
||||
|
||||
/**
|
||||
* Return reference to parent's form element
|
||||
*
|
||||
* @returns {Element}
|
||||
*/
|
||||
FormEngineLinkBrowserAdapter.checkReference = function() {
|
||||
var selector = 'form[name="' + LinkBrowser.parameters.formName + '"] [data-formengine-input-name="' + LinkBrowser.parameters.itemName + '"]';
|
||||
if (window.opener && window.opener.document && window.opener.document.querySelector(selector)) {
|
||||
return window.opener.document.querySelector(selector);
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Save the current link back to the opener
|
||||
*
|
||||
* @param {String} input
|
||||
*/
|
||||
LinkBrowser.finalizeFunction = function(input) {
|
||||
var field = FormEngineLinkBrowserAdapter.checkReference();
|
||||
if (field) {
|
||||
var attributeValues = LinkBrowser.getLinkAttributeValues();
|
||||
// encode link on server
|
||||
attributeValues.url = input;
|
||||
|
||||
$.ajax({
|
||||
url: TYPO3.settings.ajaxUrls['link_browser_encodetypolink'],
|
||||
data: attributeValues,
|
||||
method: 'GET'
|
||||
}).done(function(data) {
|
||||
if (data.typoLink) {
|
||||
$('#' + field.id, parent.opener.document).val(data.typoLink);
|
||||
if (typeof field.onchange === 'function') {
|
||||
field.onchange();
|
||||
}
|
||||
|
||||
FormEngineLinkBrowserAdapter.updateFunctions();
|
||||
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return FormEngineLinkBrowserAdapter;
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine","bootstrap"],(function(t,e,i,n){"use strict";return new(function(){function t(){var e=this;this.checkForReviewableField=function(){var n=e,a=t.findInvalidField(),o=i("."+e.toggleButtonClass);if(a.length>0){var l=i("<div />",{class:"list-group"});a.each((function(){var t=i(this),e=t.find("[data-formengine-validation-rules]"),a=e.attr("id");void 0===a&&(a=e.parent().children("[id]").first().attr("id")),l.append(i("<a />",{class:"list-group-item "+n.fieldListItemClass,"data-field-id":a,href:"#"}).text(t.find(n.labelSelector).text()))})),o.removeClass("hidden");var s=o.data("bs.popover");s&&(s.options.content=l.wrapAll("<div>").parent().html(),s.setContent(),s.$tip.addClass(s.options.placement))}else o.addClass("hidden").popover("hide")},this.switchToField=function(t){t.preventDefault();var e=i(t.currentTarget).data("fieldId"),n=i("#"+e);n.parents('[id][role="tabpanel"]').each((function(){i('[aria-controls="'+i(this).attr("id")+'"]').tab("show")})),n.focus()},this.toggleButtonClass="t3js-toggle-review-panel",this.fieldListItemClass="t3js-field-item",this.labelSelector=".t3js-formengine-label",this.initialize()}return t.findInvalidField=function(){return i(document).find(".tab-content ."+n.Validation.errorClass)},t.attachButtonToModuleHeader=function(t){var e=i(".t3js-module-docheader-bar-buttons").children().last().find('[role="toolbar"]'),n=i("<a />",{class:"btn btn-danger btn-sm hidden "+t.toggleButtonClass,href:"#",title:TYPO3.lang["buttons.reviewFailedValidationFields"]}).append(i("<span />",{class:"fa fa-fw fa-info"}));n.popover({container:"body",html:!0,placement:"bottom"}),e.prepend(n)},t.prototype.initialize=function(){var e=this,n=i(document);i((function(){t.attachButtonToModuleHeader(e)})),n.on("click","."+this.fieldListItemClass,this.switchToField),n.on("t3-formengine-postfieldvalidation",this.checkForReviewableField)},t}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Core/Contrib/jquery.autocomplete"],(function(e,t,a,n){"use strict";return function(){function e(e){var t=this;a((function(){t.initialize(e)}))}return e.prototype.initialize=function(e){var t=a(e).closest(".t3-form-suggest-container"),i=e.dataset.tablename,o=e.dataset.fieldname,r=e.dataset.field,s=parseInt(e.dataset.uid,10),d=parseInt(e.dataset.pid,10),l=e.dataset.datastructureidentifier,u=e.dataset.flexformsheetname,m=e.dataset.flexformfieldname,c=e.dataset.flexformcontainername,f=e.dataset.flexformcontainerfieldname,p=parseInt(e.dataset.minchars,10),g=TYPO3.settings.ajaxUrls.record_suggest,x={tableName:i,fieldName:o,uid:s,pid:d,dataStructureIdentifier:l,flexFormSheetName:u,flexFormFieldName:m,flexFormContainerName:c,flexFormContainerFieldName:f};a(e).autocomplete({serviceUrl:g,params:x,type:"POST",paramName:"value",dataType:"json",minChars:p,groupBy:"typeLabel",containerClass:"autocomplete-results",appendTo:t,forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,noSuggestionNotice:'<div class="autocomplete-info">No results</div>',minLength:p,preventBadQueries:!1,transformResult:function(e){return{suggestions:e.map((function(e){return{value:e.text,data:e}}))}},formatResult:function(e){return a("<div>").append(a('<a class="autocomplete-suggestion-link" href="#">'+e.data.sprite+e.data.text+"</a></div>").attr({"data-label":e.data.label,"data-table":e.data.table,"data-uid":e.data.uid})).html()},onSearchComplete:function(){t.addClass("open")},beforeRender:function(e){e.attr("style",""),t.addClass("open")},onHide:function(){t.removeClass("open")},onSelect:function(){var i,o;i=t.find(".autocomplete-selected a"),o="",o="select"===e.dataset.fieldtype?i.data("uid"):i.data("table")+"_"+i.data("uid"),n.setSelectOptionFromExternalSource(r,o,i.data("label"),i.data("label")),n.Validation.markFieldAsChanged(a(document.querySelector('input[name="'+r+'"]')))}})},e}()}));
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __values=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};define(["require","exports","./Enum/Severity","jquery","./Modal","TYPO3/CMS/Core/SecurityUtility","bootstrap"],(function(t,e,n,o,r,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){void 0===t&&(t=null);var e=this;this.colCount=1,this.rowCount=1,this.nameLabel="name",this.columnLabel="columen label",this.defaultCell={spanned:0,rowspan:1,colspan:1,name:"",colpos:"",column:void 0},this.selectorEditor=".t3js-grideditor",this.selectorAddColumn=".t3js-grideditor-addcolumn",this.selectorRemoveColumn=".t3js-grideditor-removecolumn",this.selectorAddRowTop=".t3js-grideditor-addrow-top",this.selectorRemoveRowTop=".t3js-grideditor-removerow-top",this.selectorAddRowBottom=".t3js-grideditor-addrow-bottom",this.selectorRemoveRowBottom=".t3js-grideditor-removerow-bottom",this.selectorLinkEditor=".t3js-grideditor-link-editor",this.selectorLinkExpandRight=".t3js-grideditor-link-expand-right",this.selectorLinkShrinkLeft=".t3js-grideditor-link-shrink-left",this.selectorLinkExpandDown=".t3js-grideditor-link-expand-down",this.selectorLinkShrinkUp=".t3js-grideditor-link-shrink-up",this.selectorDocHeaderSave=".t3js-grideditor-savedok",this.selectorDocHeaderSaveClose=".t3js-grideditor-savedokclose",this.selectorConfigPreview=".t3js-grideditor-preview-config",this.selectorConfigPreviewButton=".t3js-grideditor-preview-button",this.modalButtonClickHandler=function(t){var n=t.target;"cancel"===n.name?r.currentModal.trigger("modal-dismiss"):"ok"===n.name&&(e.setName(r.currentModal.find(".t3js-grideditor-field-name").val(),r.currentModal.data("col"),r.currentModal.data("row")),e.setColumn(r.currentModal.find(".t3js-grideditor-field-colpos").val(),r.currentModal.data("col"),r.currentModal.data("row")),e.drawTable(),e.writeConfig(e.export2LayoutRecord()),r.currentModal.trigger("modal-dismiss"))},this.addColumnHandler=function(t){t.preventDefault(),e.addColumn(),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.removeColumnHandler=function(t){t.preventDefault(),e.removeColumn(),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.addRowTopHandler=function(t){t.preventDefault(),e.addRowTop(),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.addRowBottomHandler=function(t){t.preventDefault(),e.addRowBottom(),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.removeRowTopHandler=function(t){t.preventDefault(),e.removeRowTop(),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.removeRowBottomHandler=function(t){t.preventDefault(),e.removeRowBottom(),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.linkEditorHandler=function(t){t.preventDefault();var n=o(t.target);e.showOptions(n.data("col"),n.data("row"))},this.linkExpandRightHandler=function(t){t.preventDefault();var n=o(t.target);e.addColspan(n.data("col"),n.data("row")),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.linkShrinkLeftHandler=function(t){t.preventDefault();var n=o(t.target);e.removeColspan(n.data("col"),n.data("row")),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.linkExpandDownHandler=function(t){t.preventDefault();var n=o(t.target);e.addRowspan(n.data("col"),n.data("row")),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.linkShrinkUpHandler=function(t){t.preventDefault();var n=o(t.target);e.removeRowspan(n.data("col"),n.data("row")),e.drawTable(),e.writeConfig(e.export2LayoutRecord())},this.configPreviewButtonHandler=function(t){t.preventDefault();var n=o(e.selectorConfigPreview),r=o(e.selectorConfigPreviewButton);n.is(":visible")?(r.empty().append(TYPO3.lang["button.showPageTsConfig"]),o(e.selectorConfigPreview).slideUp()):(r.empty().append(TYPO3.lang["button.hidePageTsConfig"]),o(e.selectorConfigPreview).slideDown())};var n=o(this.selectorEditor);this.colCount=n.data("colcount"),this.rowCount=n.data("rowcount"),this.field=o('input[name="'+n.data("field")+'"]'),this.data=n.data("data"),this.nameLabel=null!==t?t.nameLabel:"Name",this.columnLabel=null!==t?t.columnLabel:"Column",this.targetElement=o(this.selectorEditor),o(this.selectorConfigPreview).hide(),o(this.selectorConfigPreviewButton).empty().append(TYPO3.lang["button.showPageTsConfig"]),this.initializeEvents(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())}return t.stripMarkup=function(t){return(new a).stripHtml(t)},t.prototype.initializeEvents=function(){o(document).on("click",this.selectorAddColumn,this.addColumnHandler),o(document).on("click",this.selectorRemoveColumn,this.removeColumnHandler),o(document).on("click",this.selectorAddRowTop,this.addRowTopHandler),o(document).on("click",this.selectorAddRowBottom,this.addRowBottomHandler),o(document).on("click",this.selectorRemoveRowTop,this.removeRowTopHandler),o(document).on("click",this.selectorRemoveRowBottom,this.removeRowBottoLine truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./Storage/Client"],(function(e,t,i,r){"use strict";var n,o,s;!function(e){e.small="small",e.default="default",e.large="large",e.overlay="overlay"}(n||(n={})),function(e){e.default="default",e.disabled="disabled"}(o||(o={})),function(e){e.default="default",e.inline="inline"}(s||(s={}));var c,a=function(){function e(){this.sizes=n,this.states=o,this.markupIdentifiers=s,this.promiseCache={}}return e.prototype.getIcon=function(e,t,c,a,u){var h=this,f=[e,t=t||n.default,c,a=a||o.default,u=u||s.default],l=f.join("_");return i.when(this.getIconRegistryCache()).pipe((function(e){return r.isset("icon_registry_cache_identifier")&&r.get("icon_registry_cache_identifier")===e||(r.unsetByPrefix("icon_"),r.set("icon_registry_cache_identifier",e)),h.fetchFromLocal(l).then(null,(function(){return h.fetchFromRemote(f,l)}))}))},e.prototype.getIconRegistryCache=function(){return this.isPromiseCached("icon_registry_cache_identifier")||this.putInPromiseCache("icon_registry_cache_identifier",i.ajax({url:TYPO3.settings.ajaxUrls.icons_cache,success:function(e){return e}})),this.getFromPromiseCache("icon_registry_cache_identifier")},e.prototype.fetchFromRemote=function(e,t){return this.isPromiseCached(t)||this.putInPromiseCache(t,i.ajax({url:TYPO3.settings.ajaxUrls.icons,dataType:"html",data:{icon:JSON.stringify(e)},success:function(e){return-1!==e.indexOf("t3js-icon")&&-1!==e.indexOf('<span class="icon-markup">')&&r.set("icon_"+t,e),e}})),this.getFromPromiseCache(t)},e.prototype.fetchFromLocal=function(e){var t=i.Deferred();return r.isset("icon_"+e)?t.resolve(r.get("icon_"+e)):t.reject(),t.promise()},e.prototype.isPromiseCached=function(e){return void 0!==this.promiseCache[e]},e.prototype.getFromPromiseCache=function(e){return this.promiseCache[e]},e.prototype.putInPromiseCache=function(e,t){this.promiseCache[e]=t},e}();return c||(c=new a,TYPO3.Icons=c),c}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngineValidation","./Icons","./Modal","TYPO3/CMS/Core/Contrib/imagesloaded.pkgd.min","jquery-ui/draggable","jquery-ui/resizable"],(function(t,r,e,a,i,o,n){"use strict";return new(function(){function t(){var r=this;this.cropImageContainerSelector="#t3js-crop-image-container",this.cropImageSelector="#t3js-crop-image",this.coverAreaSelector=".t3js-cropper-cover-area",this.cropInfoSelector=".t3js-cropper-info-crop",this.focusAreaSelector="#t3js-cropper-focus-area",this.defaultFocusArea={height:1/3,width:1/3,x:0,y:0},this.defaultOpts={autoCrop:!0,autoCropArea:"0.7",dragMode:"crop",guides:!0,responsive:!0,viewMode:1,zoomable:!1},this.resizeTimeout=450,this.cropBuiltHandler=function(){var a=r.cropper.cropper("getImageData"),i=r.currentModal.find(r.cropImageSelector);r.imageOriginalSizeFactor=i.data("originalWidth")/a.naturalWidth,r.cropVariantTriggers.each((function(t,i){var o=e(i).attr("data-crop-variant-id"),n=r.convertRelativeToAbsoluteCropArea(r.data[o].cropArea,a),s=e.extend(!0,{},r.data[o],{cropArea:n});r.updatePreviewThumbnail(s,e(i))})),r.currentCropVariant.cropArea=r.convertRelativeToAbsoluteCropArea(r.currentCropVariant.cropArea,a),r.cropBox=r.currentModal.find(".cropper-crop-box"),r.setCropArea(r.currentCropVariant.cropArea),r.currentCropVariant.coverAreas&&r.initCoverAreas(r.cropBox,r.currentCropVariant.coverAreas),r.currentCropVariant.focusArea&&(t.isEmptyArea(r.currentCropVariant.focusArea)&&(r.currentCropVariant.focusArea=e.extend(!0,{},r.defaultFocusArea)),r.initFocusArea(r.cropBox),r.scaleAndMoveFocusArea(r.currentCropVariant.focusArea)),r.currentCropVariant.selectedRatio&&(r.setAspectRatio(r.currentCropVariant.allowedAspectRatios[r.currentCropVariant.selectedRatio]),r.setCropArea(r.currentCropVariant.cropArea),r.currentModal.find("[data-option='"+r.currentCropVariant.selectedRatio+"']").addClass("active")),r.cropperCanvas.addClass("is-visible")},this.cropMoveHandler=function(t){r.currentCropVariant.cropArea=e.extend(!0,r.currentCropVariant.cropArea,{height:Math.floor(t.height),width:Math.floor(t.width),x:Math.floor(t.x),y:Math.floor(t.y)}),r.updatePreviewThumbnail(r.currentCropVariant,r.activeCropVariantTrigger),r.updateCropVariantData(r.currentCropVariant);var a=Math.round(r.currentCropVariant.cropArea.width*r.imageOriginalSizeFactor),i=Math.round(r.currentCropVariant.cropArea.height*r.imageOriginalSizeFactor);r.cropInfo.text(a+"×"+i+" px")},this.cropStartHandler=function(){r.currentCropVariant.focusArea&&(r.focusArea.draggable("option","disabled",!0),r.focusArea.resizable("option","disabled",!0))},this.cropEndHandler=function(){r.currentCropVariant.focusArea&&(r.focusArea.draggable("option","disabled",!1),r.focusArea.resizable("option","disabled",!1))},e(window).resize((function(){r.cropper&&r.cropper.cropper("destroy")})),this.resizeEnd((function(){r.cropper&&r.init()}))}return t.isEmptyArea=function(t){return e.isEmptyObject(t)},t.wait=function(t,r){window.setTimeout(t,r)},t.toCssPercent=function(t){return 100*t+"%"},t.serializeCropVariants=function(t){return JSON.stringify(t,(function(t,r){return"id"===t||"title"===t||"allowedAspectRatios"===t||"coverAreas"===t?void 0:r}))},t.prototype.initializeTrigger=function(){var t=this;e(".t3js-image-manipulation-trigger").off("click").click((function(r){r.preventDefault(),t.trigger=e(r.currentTarget),t.show()}))},t.prototype.initializeCropperModal=function(){var t=this,r=this.currentModal.find(this.cropImageSelector);n(r,(function(){setTimeout((function(){t.init()}),100)}))},t.prototype.show=function(){var t=this,r=this.trigger.data("modalTitle"),a=this.trigger.data("buttonPreviewText"),n=this.trigger.data("buttonDismissText"),s=this.trigger.data("buttonSaveText"),c=this.trigger.data("url"),p=this.trigger.data("payload"),d=this.initializeCropperModal.bind(this);i.getIcon("spinner-circle",i.sizes.default,null,null,i.markupIdentifiers.inline).done((function(i){t.currentModal=o.advanced({additionalCssClasses:["modal-image-manipulation"],buttons:[{btnClass:"btn-default pull-left",dataAttributes:{method:"preview"},icon:"actions-view",text:a},{btnClass:"btn-default",dataAttributes:{method:"dismiss"},icon:"actions-close",text:n},{btnClass:"btn-primary",dataAttributes:{method:"save"},icon:"actions-document-save",text:s}],callback:function(t){e.post({url:c,data:p}).done((function(r){d(),t.find(".t3js-modal-body").append(r).addClass("cropper")}))},content:e('<div class="modal-loading">').append(i),size:o.sizes.full,style:o.styles.dark,title:r}),t.currentModal.on("hide.bs.modal",(function(r){t.destroy()})),t.currentModal.data("bs.modal").options.backdrop="static"}))},t.prototype.init=function(){var r=this,a=this.currentModal.find(this.cropImageSelector),i=e(a).height(),o=e(a).width(),n=this.trigger.attr("data-crop-variants");if(!n)throw new TypeError("ImageManipulation: No cropVariants data found for image");this.data=e.isEmptyObject(this.data)?JSON.parse(n):this.data,this.currentModal.find(this.cropILine truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Severity","./Modal"],(function(e,n,t,o){"use strict";var i=function(){function e(){}return e.showItem=function(e,n){o.advanced({type:o.types.iframe,size:o.sizes.large,content:top.TYPO3.settings.ShowItem.moduleUrl+"&table="+encodeURIComponent(e)+"&uid="+("number"==typeof n?n:encodeURIComponent(n)),severity:t.SeverityEnum.notice})},e}();return TYPO3.InfoWindow=i,i}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","../AjaxDataHandler","jquery-ui/droppable"],(function(e,t,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.initialize=function(){n(e.contentIdentifier).draggable({handle:e.dragHeaderIdentifier,scope:"tt_content",cursor:"move",distance:20,revert:"invalid",zIndex:100,start:function(t,o){e.onDragStart(n(t.target))},stop:function(t,o){e.onDragStop(n(t.target))}}),n(e.dropZoneIdentifier).droppable({accept:this.contentIdentifier,scope:"tt_content",tolerance:"pointer",over:function(t,o){e.onDropHoverOver(n(o.draggable),n(t.target))},out:function(t,o){e.onDropHoverOut(n(o.draggable),n(t.target))},drop:function(t,o){e.onDrop(n(o.draggable),n(t.target),t)}})},e.onDragStart=function(t){e.originalStyles=t.get(0).style.cssText,t.children(e.dragIdentifier).addClass("dragitem-shadow"),t.append('<div class="ui-draggable-copy-message">'+TYPO3.lang["dragdrop.copy.message"]+"</div>"),t.children(e.dropZoneIdentifier).addClass("drag-start"),t.closest(e.columnIdentifier).removeClass("active"),t.find(e.dropZoneIdentifier).hide(),n(e.dropZoneIdentifier).each((function(t,o){var a=n(o);a.parent().find(".t3js-toggle-new-content-element-wizard").length?a.addClass(e.validDropZoneClass):a.closest(e.contentIdentifier).find("> "+e.addContentIdentifier+", > > "+e.addContentIdentifier).show()}))},e.onDragStop=function(t){t.children(e.dragIdentifier).removeClass("dragitem-shadow"),t.children(e.dropZoneIdentifier).removeClass("drag-start"),t.closest(e.columnIdentifier).addClass("active"),t.find(e.dropZoneIdentifier).show(),t.find(".ui-draggable-copy-message").remove(),t.get(0).style.cssText=e.originalStyles,n(e.dropZoneIdentifier+"."+e.validDropZoneClass).removeClass(e.validDropZoneClass)},e.onDropHoverOver=function(t,n){n.hasClass(e.validDropZoneClass)&&n.addClass(e.dropPossibleHoverClass)},e.onDropHoverOut=function(t,n){n.removeClass(e.dropPossibleHoverClass)},e.onDrop=function(t,n,o){var a=e.getColumnPositionForElement(n);n.removeClass(e.dropPossibleHoverClass);var r=parseInt(t.data("uid"),10);if("number"==typeof r&&r>0){var i={},s=n.closest(e.contentIdentifier).data("uid"),d=0;d=void 0===s?parseInt(o.target.offsetParent.getAttribute("data-page"),10):0-parseInt(s,10);var l=parseInt(n.closest("[data-language-uid]").data("language-uid"),10),c=0;0!==d&&(c=a),i.cmd={tt_content:{}},i.data={tt_content:{}};var p=o&&o.originalEvent.ctrlKey||n.hasClass("t3js-paste-copy");p?(i.cmd.tt_content[r]={copy:{action:"paste",target:d,update:{colPos:c,sys_language_uid:l}}},e.ajaxAction(n,t,i,p)):(i.data.tt_content[r]={colPos:c,sys_language_uid:l},i.cmd.tt_content[r]={move:d},e.ajaxAction(n,t,i,p))}},e.ajaxAction=function(t,n,a,r){o.process(a).done((function(o){o.hasErrors||(t.parent().hasClass(e.contentIdentifier.substring(1))?n.detach().css({top:0,left:0}).insertAfter(t.closest(e.contentIdentifier)):n.detach().css({top:0,left:0}).insertAfter(t.closest(e.dropZoneIdentifier)),r&&self.location.reload(!0))}))},e.getColumnPositionForElement=function(e){var t=e.closest("[data-colpos]");return!(!t.length||"undefined"===t.data("colpos"))&&t.data("colpos")},e.contentIdentifier=".t3js-page-ce",e.dragIdentifier=".t3-page-ce-dragitem",e.dragHeaderIdentifier=".t3js-page-ce-draghandle",e.dropZoneIdentifier=".t3js-page-ce-dropzone-available",e.columnIdentifier=".t3js-page-column",e.validDropZoneClass="active",e.dropPossibleHoverClass="t3-page-ce-dropzone-possible",e.addContentIdentifier=".t3js-page-new-ce",e.originalStyles="",e}();t.default=a,n(a.initialize)}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","../AjaxDataHandler","../Modal","../Severity"],(function(t,e,a,n,o,s){"use strict";return new(function(){function t(){var t=this;this.elementIdentifier=".t3js-page-ce",a((function(){a(".t3js-page-columns").length&&t.activatePasteIcons()}))}return t.determineColumn=function(t){var e=t.closest("[data-colpos]");return e.length&&"undefined"!==e.data("colpos")?e.data("colpos"):0},t.prototype.activatePasteIcons=function(){var t=this;a(".t3-page-ce-wrapper-new-ce").each((function(e,n){a(n).find(".t3js-toggle-new-content-element-wizard").length&&(a(".t3js-page-lang-column .t3-page-ce > .t3-page-ce").removeClass("t3js-page-ce"),top.pasteAfterLinkTemplate&&top.pasteIntoLinkTemplate&&(a(n).parent().data("page")?a(n).append(top.pasteIntoLinkTemplate):a(n).append(top.pasteAfterLinkTemplate),a(n).find(".t3js-paste").on("click",(function(e){e.preventDefault(),t.activatePasteModal(a(e.currentTarget))}))))}))},t.prototype.activatePasteModal=function(t){var e=this,n=a(t),i=n.data("url")||null,r=(TYPO3.lang["paste.modal.title.paste"]||"Paste record")+': "'+n.data("title")+'"',l=void 0!==top.TYPO3.Severity[n.data("severity")]?top.TYPO3.Severity[n.data("severity")]:top.TYPO3.Severity.info,p="",c=[];if(n.hasClass("t3js-paste-copy")?(p=TYPO3.lang["paste.modal.pastecopy"]||"Do you want to copy the record to this position?",c=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:function(){o.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.pastecopy"]||"Copy",btnClass:"btn-"+s.getCssClass(l),trigger:function(){o.currentModal.trigger("modal-dismiss"),e.execute(n)}}]):(p=TYPO3.lang["paste.modal.paste"]||"Do you want to move the record to this position?",c=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:function(){o.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.paste"]||"Move",btnClass:"btn-"+s.getCssClass(l),trigger:function(){o.currentModal.trigger("modal-dismiss"),e.execute(n)}}]),null!==i){var d=i.indexOf("?")>-1?"&":"?",u=a.param({data:n.data()});o.loadUrl(r,l,c,i+d+u)}else o.show(r,p,l,c)},t.prototype.execute=function(e){var a=t.determineColumn(e),o=e.closest(this.elementIdentifier),s=o.data("uid"),i={CB:{paste:"tt_content|"+(void 0===s?parseInt(o.data("page"),10):0-parseInt(s,10)),update:{colPos:a,sys_language_uid:parseInt(e.closest("[data-language-uid]").data("language-uid"),10)}}};n.process(i).done((function(t){t.hasErrors||window.location.reload(!0)}))},t}())}));
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
var Tree, DragDrop;
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/LegacyTree
|
||||
* JavaScript RequireJS module in use for legacy trees, used
|
||||
* in FolderTree, Element Browser PageTree and
|
||||
* Element Browser FolderTree
|
||||
* note that this should not be used (thus, declared as anonymous
|
||||
* UMD module)
|
||||
* @exports TYPO3/CMS/Backend/LegacyTree
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
|
||||
DragDrop = {
|
||||
dragID: null,
|
||||
table: null // can be "pages" or "folders", needed for doing the changes when dropping
|
||||
};
|
||||
|
||||
DragDrop.dragElement = function(event, $element) {
|
||||
event.preventDefault();
|
||||
var $container = $element.parent().parent();
|
||||
var elementID = $container.prop('id');
|
||||
elementID = elementID.substring(elementID.indexOf('_') + 1);
|
||||
DragDrop.dragID = DragDrop.getIdFromEvent(event);
|
||||
|
||||
if (!DragDrop.dragID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!elementID) {
|
||||
elementID = DragDrop.dragID;
|
||||
}
|
||||
|
||||
if ($('#dragIcon').length === 0) {
|
||||
$('body').append('<div id="dragIcon" style="display: none;"> </div>');
|
||||
}
|
||||
|
||||
$('#dragIcon').html($container.find('.dragIcon').html() + $container.find('.dragTitle').children(':first').text());
|
||||
|
||||
document.onmouseup = function(event) {
|
||||
DragDrop.cancelDragEvent(event);
|
||||
};
|
||||
|
||||
document.onmousemove = function(event) {
|
||||
DragDrop.mouseMoveEvent(event);
|
||||
};
|
||||
};
|
||||
|
||||
DragDrop.dropElement = function(event) {
|
||||
var dropID = DragDrop.getIdFromEvent(event);
|
||||
if ((DragDrop.dragID) && (DragDrop.dragID !== dropID)) {
|
||||
var dragID = DragDrop.dragID;
|
||||
var table = DragDrop.table;
|
||||
var parameters = 'table=' + table + '-drag' +
|
||||
'&uid=' + dragID +
|
||||
'&dragDrop=' + table +
|
||||
'&srcId=' + dragID +
|
||||
'&dstId=' + dropID;
|
||||
require(['TYPO3/CMS/Backend/ContextMenu'], function(ContextMenu) {
|
||||
ContextMenu.record = {table: decodeURIComponent(table), uid: decodeURIComponent(dragID)};
|
||||
ContextMenu.fetch(parameters);
|
||||
});
|
||||
}
|
||||
DragDrop.cancelDragEvent();
|
||||
return false;
|
||||
};
|
||||
|
||||
DragDrop.cancelDragEvent = function(event) {
|
||||
DragDrop.dragID = null;
|
||||
if ($('#dragIcon').length && $('#dragIcon').is(':visible')) {
|
||||
$('#dragIcon').hide();
|
||||
}
|
||||
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
};
|
||||
|
||||
DragDrop.mouseMoveEvent = function(event) {
|
||||
if (!event) {
|
||||
event = window.event;
|
||||
}
|
||||
$('#dragIcon').css({
|
||||
left: (event.x + 5) + 'px',
|
||||
top: (event.y - 5) + 'px'
|
||||
}).show();
|
||||
};
|
||||
|
||||
DragDrop.getIdFromEvent = function(event) {
|
||||
var obj = event.currentTarget;
|
||||
while (obj.id == false && obj.parentNode) {
|
||||
obj = obj.parentNode;
|
||||
}
|
||||
return obj.id.substring(obj.id.indexOf('_') + 1);
|
||||
};
|
||||
|
||||
Tree = {
|
||||
ajaxRoute: 'sc_alt_file_navframe_expandtoggle',
|
||||
frameSetModule: null,
|
||||
activateDragDrop: true,
|
||||
highlightClass: 'active',
|
||||
pageID: 0,
|
||||
|
||||
// reloads a part of the page tree (useful when "expand" / "collapse")
|
||||
load: function(params, isExpand, obj, scopeData, scopeHash) {
|
||||
var $obj = $(obj);
|
||||
var $parentNode = $(obj).parent().parent();
|
||||
|
||||
// immediately collapse the subtree and change the plus to a minus when collapsing
|
||||
// without waiting for the response
|
||||
if (!isExpand) {
|
||||
$parentNode.find('ul:first').remove();
|
||||
var $pm = $obj.parent().find('.pm:first');
|
||||
if ($pm.length) {
|
||||
$pm.get().onclick = null;
|
||||
var src = $pm.children(':first').prop('src');
|
||||
src = src.replace(/minus/, 'plus');
|
||||
$pm.children('first').prop('src', src);
|
||||
}
|
||||
} else {
|
||||
$obj.css({cursor: 'wait'});
|
||||
}
|
||||
$.ajax({
|
||||
url: TYPO3.settings.ajaxUrls[this.ajaxRoute],
|
||||
data: {
|
||||
PM: params,
|
||||
scopeData: scopeData,
|
||||
scopeHash: scopeHash
|
||||
}
|
||||
}).done(function(data) {
|
||||
// the parent node needs to be overwritten, not the object
|
||||
$parentNode.replaceWith(data);
|
||||
Tree.reSelectActiveItem();
|
||||
});
|
||||
},
|
||||
|
||||
// does the complete page refresh (previously known as "_refresh_nav()")
|
||||
refresh: function() {
|
||||
var r = new Date();
|
||||
// randNum is useful so pagetree does not get cached in browser cache when refreshing
|
||||
var loc = window.location.href.replace(/&randNum=\d+|#.*/g, '');
|
||||
var addSign = loc.indexOf('?') > 0 ? '&' : '?';
|
||||
window.location = loc + addSign + 'randNum=' + r.getTime();
|
||||
},
|
||||
|
||||
// attaches the events to the elements needed for the drag and drop (for the titles and the icons)
|
||||
registerDragDropHandlers: function() {
|
||||
if (!Tree.activateDragDrop) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.list-tree-root').on('mousedown', '.dragTitle, .dragIcon', function(evt) {
|
||||
DragDrop.dragElement(evt, $(this));
|
||||
}).on('mouseup', '.dragTitle, .dragIcon', function(evt) {
|
||||
DragDrop.dropElement(evt, $(this));
|
||||
});
|
||||
},
|
||||
|
||||
// selects the activated item again, in case it collapsed and got expanded again
|
||||
reSelectActiveItem: function() {
|
||||
if (!top.fsMod) {
|
||||
return;
|
||||
}
|
||||
var $activeItem = $('#' + top.fsMod.navFrameHighlightedID[this.frameSetModule]);
|
||||
if ($activeItem.length) {
|
||||
$activeItem.addClass(Tree.highlightClass);
|
||||
Tree.extractPageIdFromTreeItem($activeItem.prop('id'));
|
||||
}
|
||||
},
|
||||
|
||||
// highlights an active list item in the page tree and registers it to the top-frame
|
||||
// used when loading the page for the first time
|
||||
highlightActiveItem: function(frameSetModule, highlightID) {
|
||||
Tree.frameSetModule = frameSetModule;
|
||||
Tree.extractPageIdFromTreeItem(highlightID);
|
||||
|
||||
// Remove all items that are already highlighted
|
||||
var $obj = $('#' + top.fsMod.navFrameHighlightedID[frameSetModule]);
|
||||
if ($obj.length) {
|
||||
$obj.removeClass(Tree.highlightClass);
|
||||
}
|
||||
|
||||
// Set the new item
|
||||
top.fsMod.navFrameHighlightedID[frameSetModule] = highlightID;
|
||||
$('#' + highlightID).addClass(Tree.highlightClass);
|
||||
},
|
||||
|
||||
//extract pageID from the given id (pagesxxx_y_z where xxx is the ID)
|
||||
extractPageIdFromTreeItem: function(highlightID) {
|
||||
if (highlightID) {
|
||||
Tree.pageID = highlightID.split('_')[0].substring(5);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Tree;
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./Viewport","./Icons","jquery/autocomplete","TYPO3/CMS/Backend/jquery.clearable"],(function(e,t,o,a,r){"use strict";var n;return function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem",e.toolbarItem=".t3js-toolbar-item-search",e.dropdownToggle=".t3js-toolbar-search-dropdowntoggle",e.searchFieldSelector=".t3js-topbar-navigation-search-field",e.formSelector=".t3js-topbar-navigation-search"}(n||(n={})),new(function(){function e(){var e=this;this.url=TYPO3.settings.ajaxUrls.livesearch,a.Topbar.Toolbar.registerEvent((function(){e.registerAutocomplete(),e.registerEvents(),o(n.toolbarItem).removeAttr("style"),o(n.searchFieldSelector).clearable({onClear:function(){o(n.toolbarItem).hasClass("open")&&o(n.dropdownToggle).dropdown("toggle")}})}))}return e.prototype.registerAutocomplete=function(){o(n.searchFieldSelector).autocomplete({serviceUrl:this.url,paramName:"q",dataType:"json",minChars:2,width:"100%",groupBy:"typeLabel",noCache:!0,containerClass:n.toolbarItem.substr(1,n.toolbarItem.length),appendTo:n.containerSelector+" .dropdown-menu",forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,triggerSelectOnValidInput:!1,preventBadQueries:!1,noSuggestionNotice:'<h3 class="dropdown-headline">'+TYPO3.lang.liveSearch_listEmptyText+"</h3><p>"+TYPO3.lang.liveSearch_helpTitle+"</p><hr><p>"+TYPO3.lang.liveSearch_helpDescription+"<br>"+TYPO3.lang.liveSearch_helpDescriptionPages+"</p>",transformResult:function(e){return{suggestions:o.map(e,(function(e){return{value:e.title,data:e}}))}},formatGroup:function(e,t,o){var a="";return o>0&&(a="<hr>"),a+'<h3 class="dropdown-headline">'+t+"</h3>"},formatResult:function(e){return'<div class="dropdown-table"><div class="dropdown-table-row"><div class="dropdown-table-column dropdown-table-icon">'+e.data.iconHTML+'</div><div class="dropdown-table-column dropdown-table-title"><a class="dropdown-table-title-ellipsis dropdown-list-link" href="#" data-pageid="'+e.data.pageId+'" data-target="'+e.data.editLink+'">'+e.data.title+"</a></div></div></div>"},onSearchStart:function(){var e=o(n.toolbarItem);e.hasClass("loading")||(e.addClass("loading"),r.getIcon("spinner-circle-light",r.sizes.small,"",r.states.default,r.markupIdentifiers.inline).done((function(t){e.find(".icon-apps-toolbar-menu-search").replaceWith(t)})))},onSearchComplete:function(){var e=o(n.toolbarItem),t=o(n.searchFieldSelector);!e.hasClass("open")&&t.val().length>1&&(o(n.dropdownToggle).dropdown("toggle"),t.focus()),e.hasClass("loading")&&(e.removeClass("loading"),r.getIcon("apps-toolbar-menu-search",r.sizes.small,"",r.states.default,r.markupIdentifiers.inline).done((function(t){e.find(".icon-spinner-circle-light").replaceWith(t)})))},beforeRender:function(e){e.append('<hr><div><a href="#" class="btn btn-primary pull-right t3js-live-search-show-all">'+TYPO3.lang.liveSearch_showAllResults+"</a></div>"),o(n.toolbarItem).hasClass("open")||(o(n.dropdownToggle).dropdown("toggle"),o(n.searchFieldSelector).focus())},onHide:function(){o(n.toolbarItem).hasClass("open")&&o(n.dropdownToggle).dropdown("toggle")}})},e.prototype.registerEvents=function(){var e=o(n.searchFieldSelector);(o(n.containerSelector).on("click",".t3js-live-search-show-all",(function(t){t.preventDefault(),TYPO3.ModuleMenu.App.showModule("web_list","id=0&search_levels=-1&search_field="+encodeURIComponent(e.val())),e.val("").trigger("change")})),e.length)&&o("."+e.autocomplete().options.containerClass).on("click.autocomplete",".dropdown-list-link",(function(t){t.preventDefault();var a=o(t.currentTarget);top.jump(a.data("target"),"web_list","web",a.data("pageid")),e.val("").trigger("change")}));o(n.formSelector).on("submit",(function(e){e.preventDefault()}))},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __values=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],a=0;return t?t.call(e):{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}}};define(["require","exports","./Enum/Severity","jquery","./Icons","TYPO3/CMS/Backend/Wizard"],(function(e,t,a,n,o,l){"use strict";return new(function(){function e(){var e=this;this.triggerButton=".t3js-localize",this.localizationMode=null,this.sourceLanguage=null,this.records=[],n((function(){e.initialize()}))}return e.prototype.initialize=function(){var e=this,t=this;o.getIcon("actions-localize",o.sizes.large).done((function(i){o.getIcon("actions-edit-copy",o.sizes.large).done((function(c){n(t.triggerButton).removeClass("disabled"),n(document).on("click",t.triggerButton,(function(t){t.preventDefault();var r=n(t.currentTarget),d=[],s="";r.data("allowTranslate")&&d.push('<div class="row"><div class="btn-group col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-translate">'+i+'<input type="radio" name="mode" id="mode_translate" value="localize" style="display: none"><br>Translate</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-translate text-muted">'+TYPO3.lang["localize.educate.translate"]+"</p></div></div>"),r.data("allowCopy")&&d.push('<div class="row"><div class="col-sm-3 btn-group"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-copy">'+c+'<input type="radio" name="mode" id="mode_copy" value="copyFromLanguage" style="display: none"><br>Copy</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-copy text-muted">'+TYPO3.lang["localize.educate.copy"]+"</p></div></div>"),s+='<div data-toggle="buttons">'+d.join("<hr>")+"</div>",l.addSlide("localize-choose-action",TYPO3.lang["localize.wizard.header_page"].replace("{0}",r.data("page")).replace("{1}",r.data("languageName")),s,a.SeverityEnum.info),l.addSlide("localize-choose-language",TYPO3.lang["localize.view.chooseLanguage"],"",a.SeverityEnum.info,(function(t){o.getIcon("spinner-circle-dark",o.sizes.large).done((function(a){t.html('<div class="text-center">'+a+"</div>"),e.loadAvailableLanguages(parseInt(r.data("pageId"),10),parseInt(r.data("languageId"),10)).done((function(a){if(1===a.length)return e.sourceLanguage=a[0].uid,void l.unlockNextStep().trigger("click");l.getComponent().on("click",".t3js-language-option",(function(t){var a=n(t.currentTarget).find('input[type="radio"]');e.sourceLanguage=a.val(),console.log("Localization.ts@132",e.sourceLanguage),l.unlockNextStep()}));var o,i,c=n("<div />",{class:"row","data-toggle":"buttons"});try{for(var r=__values(a),d=r.next();!d.done;d=r.next()){var s=d.value;c.append(n("<div />",{class:"col-sm-4"}).append(n("<label />",{class:"btn btn-default btn-block t3js-language-option option"}).text(" "+s.title).prepend(s.flagIcon).prepend(n("<input />",{type:"radio",name:"language",id:"language"+s.uid,value:s.uid,style:"display: none;"}))))}}catch(e){o={error:e}}finally{try{d&&!d.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}t.empty().append(c)}))}))})),l.addSlide("localize-summary",TYPO3.lang["localize.view.summary"],"",a.SeverityEnum.info,(function(t){o.getIcon("spinner-circle-dark",o.sizes.large).done((function(e){t.html('<div class="text-center">'+e+"</div>")})),e.getSummary(parseInt(r.data("pageId"),10),parseInt(r.data("languageId"),10)).done((function(a){t.empty(),e.records=[];var o=a.columns.columns;a.columns.columnList.forEach((function(l){if(void 0!==a.records[l]){var i=o[l],c=n("<div />",{class:"row"});a.records[l].forEach((function(t){var a=" ("+t.uid+") "+t.title;e.records.push(t.uid),c.append(n("<div />",{class:"col-sm-6"}).append(n("<div />",{class:"input-group"}).append(n("<span />",{class:"input-group-addon"}).append(n("<input />",{type:"checkbox",class:"t3js-localization-toggle-record",id:"record-uid-"+t.uid,checked:"checked","data-uid":t.uid,"aria-label":a})),n("<label />",{class:"form-control",for:"record-uid-"+t.uid}).text(a).prepend(t.icon))))})),t.append(n("<fieldset />",{class:"localization-fieldset"}).append(n("<label />").text(i).prepend(n("<input />",{class:"t3js-localization-toggle-column",type:"checkbox",checked:"checked"})),c))}})),l.unlockNextStep(),l.getComponent().on("change",".t3js-localization-toggle-record",(function(t){var a=n(t.currentTarget),o=a.data("uid"),i=a.closest("fieldset"),c=i.find(".t3js-localization-toggle-column");if(a.is(":checked"))e.records.push(o);else{var r=e.records.indexOf(o);r>-1&&e.records.splice(r,1)}var d=i.find(".t3js-localization-toggle-record"),s=i.find(".t3js-localization-toggle-record:checked");c.prop("checked",s.length>0),c.prop("indeterminate",s.length>0&&s.length<d.length),e.records.length>0?l.unlockNextStep():l.lockNextStep()})).on("change",".t3js-localization-toggle-column",(function(e){var t=n(e.currentTarget),a=t.closest("fieldset").find(".t3js-localization-toggle-record");a.prop("checked",t.is(":checLine truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","bootstrap","TYPO3/CMS/Backend/jquery.clearable"],(function(e,o,t){"use strict";return new(function(){function e(){this.ready=!0,this.options={error:".t3js-login-error",errorNoCookies:".t3js-login-error-nocookies",errorNoReferrer:".t3js-login-error-noreferrer",formFields:".t3js-login-formfields",interfaceField:".t3js-login-interface-field",loginForm:"#typo3-login-form",loginUrlLink:"t3js-login-url",submitButton:".t3js-login-submit",submitHandler:null,useridentField:".t3js-login-userident-field"},this.checkCookieSupport(),this.checkForInterfaceCookie(),this.checkDocumentReferrerSupport(),this.initializeEvents(),top.location.href!==location.href&&(this.ready=!1,top.location.href=location.href),this.ready&&document.body.setAttribute("data-typo3-login-ready","true")}return e.prototype.showLoginProcess=function(){this.showLoadingIndicator(),t(this.options.error).addClass("hidden"),t(this.options.errorNoCookies).addClass("hidden")},e.prototype.showLoadingIndicator=function(){t(this.options.submitButton).button("loading")},e.prototype.handleSubmit=function(e){this.showLoginProcess(),"function"==typeof this.options.submitHandler&&this.options.submitHandler(e)},e.prototype.interfaceSelectorChanged=function(){var e=new Date,o=new Date(e.getTime()+31536e6);document.cookie="typo3-login-interface="+t(this.options.interfaceField).val()+"; expires="+o.toUTCString()+";"},e.prototype.checkForInterfaceCookie=function(){if(t(this.options.interfaceField).length){var e=document.cookie.indexOf("typo3-login-interface=");if(-1!==e){var o=document.cookie.substr(e+22);o=o.substr(0,o.indexOf(";")),t(this.options.interfaceField).val(o)}}},e.prototype.checkDocumentReferrerSupport=function(){var e=this,o=document.getElementById(this.options.loginUrlLink);null!==o&&void 0===o.dataset.referrerCheckEnabled&&"1"!==o.dataset.referrerCheckEnabled||void 0!==TYPO3.settings&&void 0!==TYPO3.settings.ajaxUrls&&t.ajax({url:TYPO3.settings.ajaxUrls.login_preflight,type:"get",success:function(o){!0!==o.capabilities.referrer&&document.querySelectorAll(e.options.errorNoReferrer).forEach((function(e){return e.classList.remove("hidden")}))}})},e.prototype.showCookieWarning=function(){t(this.options.formFields).addClass("hidden"),t(this.options.errorNoCookies).removeClass("hidden")},e.prototype.hideCookieWarning=function(){t(this.options.formFields).removeClass("hidden"),t(this.options.errorNoCookies).addClass("hidden")},e.prototype.checkCookieSupport=function(){var e=navigator.cookieEnabled;!1===e?this.showCookieWarning():document.cookie||null!==e||(document.cookie="typo3-login-cookiecheck=1",document.cookie?document.cookie="typo3-login-cookiecheck=; expires="+new Date(0).toUTCString():this.showCookieWarning())},e.prototype.initializeEvents=function(){t(document).ajaxStart(this.showLoadingIndicator.bind(this)),t(this.options.loginForm).on("submit",this.handleSubmit.bind(this)),t(this.options.interfaceField).length>0&&t(document).on("change blur",this.options.interfaceField,this.interfaceSelectorChanged.bind(this)),t(".t3js-clearable").clearable(),t(".t3js-login-news-carousel").on("slide.bs.carousel",(function(e){var o=t(e.relatedTarget).height();t(e.target).find("div.active").parent().animate({height:o},500)}))},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Severity","TYPO3/CMS/Backend/Storage/Client"],(function(o,t,i,e,n,s,a){"use strict";var l;!function(o){o.loginrefresh="t3js-modal-loginrefresh",o.lockedModal="t3js-modal-backendlocked",o.loginFormModal="t3js-modal-backendloginform"}(l||(l={}));var r,d=function(){function t(){var o=this;this.options={modalConfig:{backdrop:"static"}},this.webNotification=null,this.intervalTime=60,this.intervalId=null,this.backendIsLocked=!1,this.isTimingOut=!1,this.$timeoutModal=null,this.$backendLockedModal=null,this.$loginForm=null,this.loginFramesetUrl="",this.logoutUrl="",this.submitForm=function(t){t.preventDefault();var n=o.$loginForm.find("form"),s=n.find("input[name=p_field]"),a=n.find("input[name=userident]"),l=s.val();if(""===l&&""===a.val())return e.error(TYPO3.lang["mess.refresh_login_failed"],TYPO3.lang["mess.refresh_login_emptyPassword"]),void s.focus();l&&(a.val(l),s.val(""));var r={login_status:"login"};i.each(n.serializeArray(),(function(o,t){r[t.name]=t.value})),i.ajax({url:n.attr("action"),method:"POST",data:r,success:function(t){t.login.success?o.hideLoginForm():(e.error(TYPO3.lang["mess.refresh_login_failed"],TYPO3.lang["mess.refresh_login_failed_message"]),s.focus())}})},this.checkActiveSession=function(){i.getJSON(TYPO3.settings.ajaxUrls.login_timedout,[],(function(t){t.login.locked?o.backendIsLocked||(o.backendIsLocked=!0,o.showBackendLockedModal()):o.backendIsLocked&&(o.backendIsLocked=!1,o.hideBackendLockedModal()),o.backendIsLocked||(t.login.timed_out||t.login.will_time_out)&&(t.login.timed_out?o.showLoginForm():o.showTimeoutModal())}))}}return t.prototype.initialize=function(){this.initializeTimeoutModal(),this.initializeBackendLockedModal(),this.initializeLoginForm(),this.startTask();var o=!(a.isset("notifications.asked")&&"yes"===a.get("notifications.asked")),t="undefined"!=typeof Notification&&"default"===Notification.permission;o&&"https:"===document.location.protocol&&t&&n.confirm(TYPO3.lang["notification.request.title"],TYPO3.lang["notification.request.description"],s.info,[{text:TYPO3.lang["button.yes"]||"Yes",btnClass:"btn-"+s.getCssClass(s.info),name:"ok",active:!0},{text:TYPO3.lang["button.no"]||"No",btnClass:"btn-"+s.getCssClass(s.notice),name:"cancel"}]).on("confirm.button.ok",(function(){Notification.requestPermission(),n.dismiss()})).on("confirm.button.cancel",(function(){n.dismiss()})).on("hide.bs.modal",(function(){a.set("notifications.asked","yes")}))},t.prototype.startTask=function(){if(null===this.intervalId){var o=1e3*this.intervalTime;this.intervalId=setInterval(this.checkActiveSession,o)}},t.prototype.stopTask=function(){clearInterval(this.intervalId),this.intervalId=null},t.prototype.setIntervalTime=function(o){this.intervalTime=Math.min(o,86400)},t.prototype.setLogoutUrl=function(o){this.logoutUrl=o},t.prototype.setLoginFramesetUrl=function(o){this.loginFramesetUrl=o},t.prototype.showTimeoutModal=function(){this.isTimingOut=!0,this.$timeoutModal.modal(this.options.modalConfig),this.fillProgressbar(this.$timeoutModal),"https:"===document.location.protocol&&"undefined"!=typeof Notification&&"granted"===Notification.permission&&document.hidden&&(this.webNotification=new Notification(TYPO3.lang["mess.login_about_to_expire_title"],{body:TYPO3.lang["mess.login_about_to_expire"],icon:"/typo3/sysext/backend/Resources/Public/Images/Logo.png"}),this.webNotification.onclick=function(){window.focus()})},t.prototype.hideTimeoutModal=function(){this.isTimingOut=!1,this.$timeoutModal.modal("hide"),"undefined"!=typeof Notification&&null!==this.webNotification&&this.webNotification.close()},t.prototype.showBackendLockedModal=function(){this.$backendLockedModal.modal(this.options.modalConfig)},t.prototype.hideBackendLockedModal=function(){this.$backendLockedModal.modal("hide")},t.prototype.showLoginForm=function(){var o=this;i.ajax({url:TYPO3.settings.ajaxUrls.logout,method:"GET",success:function(){TYPO3.configuration.showRefreshLoginPopup?o.showLoginPopup():o.$loginForm.modal(o.options.modalConfig)}})},t.prototype.showLoginPopup=function(){var o=window.open(this.loginFramesetUrl,"relogin_"+Math.random().toString(16).slice(2),"height=450,width=700,status=0,menubar=0,location=1");o&&o.focus()},t.prototype.hideLoginForm=function(){this.$loginForm.modal("hide")},t.prototype.initializeBackendLockedModal=function(){this.$backendLockedModal=this.generateModal(l.lockedModal),this.$backendLockedModal.find(".modal-header h4").text(TYPO3.lang["mess.please_wait"]),this.$backendLockedModal.find(".modal-body").append(i("<p />").text(TYPO3.lang["mess.be_locked"])),this.$backendLockedModal.find(".modal-footer").remove(),i("body").append(this.$backendLockedModal)},t.prototype.initializeTimeoutModal=function(){var o=this;this.$timeoutModal=this.generateModal(l.loginrefresh),this.$timeoutModal.addClass("modal-severity-notice"),this.$timeoutModal.find(".modal-header h4").text(TYPO3.lang["mess.logiLine truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __values=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],a=0;return e?e.call(t):{next:function(){return t&&a>=t.length&&(t=void 0),{value:t&&t[a++],done:!t}}}};define(["require","exports","./Enum/Severity","jquery","./Icons","./Severity","TYPO3/CMS/Core/SecurityUtility","bootstrap"],(function(t,e,a,n,i,o,l){"use strict";var s,r,d,c;!function(t){t.modal=".t3js-modal",t.content=".t3js-modal-content",t.title=".t3js-modal-title",t.close=".t3js-modal-close",t.body=".t3js-modal-body",t.footer=".t3js-modal-footer",t.iframe=".t3js-modal-iframe",t.iconPlaceholder=".t3js-modal-icon-placeholder"}(s||(s={})),function(t){t.small="small",t.default="default",t.medium="medium",t.large="large",t.full="full"}(r||(r={})),function(t){t.default="default",t.light="light",t.dark="dark"}(d||(d={})),function(t){t.default="default",t.ajax="ajax",t.iframe="iframe"}(c||(c={}));var u=function(){function t(t){this.sizes=r,this.styles=d,this.types=c,this.currentModal=null,this.instances=[],this.$template=n('<div class="t3js-modal modal fade"><div class="modal-dialog"><div class="t3js-modal-content modal-content"><div class="modal-header"><button class="t3js-modal-close close"><span aria-hidden="true"><span class="t3js-modal-icon-placeholder" data-icon="actions-close"></span></span><span class="sr-only"></span></button><h4 class="t3js-modal-title modal-title"></h4></div><div class="t3js-modal-body modal-body"></div><div class="t3js-modal-footer modal-footer"></div></div></div></div>'),this.defaultConfiguration={type:c.default,title:"Information",content:"No content provided, please check your <code>Modal</code> configuration.",severity:a.SeverityEnum.notice,buttons:[],style:d.default,size:r.default,additionalCssClasses:[],callback:n.noop(),ajaxCallback:n.noop(),ajaxTarget:null},this.securityUtility=t,n(document).on("modal-dismiss",this.dismiss),this.initializeMarkupTrigger(document)}return t.prototype.dismiss=function(){this.currentModal&&this.currentModal.modal("hide")},t.prototype.confirm=function(t,e,i,l,s){return void 0===i&&(i=a.SeverityEnum.warning),void 0===l&&(l=[]),0===l.length&&l.push({text:n(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:n(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+o.getCssClass(i),name:"ok"}),this.advanced({title:t,content:e,severity:i,buttons:l,additionalCssClasses:s,callback:function(t){t.on("button.clicked",(function(t){"cancel"===t.target.getAttribute("name")?n(t.currentTarget).trigger("confirm.button.cancel"):"ok"===t.target.getAttribute("name")&&n(t.currentTarget).trigger("confirm.button.ok")}))}})},t.prototype.loadUrl=function(t,e,n,i,o,l){return void 0===e&&(e=a.SeverityEnum.info),this.advanced({type:c.ajax,title:t,severity:e,buttons:n,ajaxCallback:o,ajaxTarget:l,content:i})},t.prototype.show=function(t,e,n,i,o){return void 0===n&&(n=a.SeverityEnum.info),this.advanced({type:c.default,title:t,content:e,severity:n,buttons:i,additionalCssClasses:o})},t.prototype.advanced=function(t){return t.type="string"==typeof t.type&&t.type in c?t.type:this.defaultConfiguration.type,t.title="string"==typeof t.title?t.title:this.defaultConfiguration.title,t.content="string"==typeof t.content||"object"==typeof t.content?t.content:this.defaultConfiguration.content,t.severity=void 0!==t.severity?t.severity:this.defaultConfiguration.severity,t.buttons=t.buttons||this.defaultConfiguration.buttons,t.size="string"==typeof t.size&&t.size in r?t.size:this.defaultConfiguration.size,t.style="string"==typeof t.style&&t.style in d?t.style:this.defaultConfiguration.style,t.additionalCssClasses=t.additionalCssClasses||this.defaultConfiguration.additionalCssClasses,t.callback="function"==typeof t.callback?t.callback:this.defaultConfiguration.callback,t.ajaxCallback="function"==typeof t.ajaxCallback?t.ajaxCallback:this.defaultConfiguration.ajaxCallback,t.ajaxTarget="string"==typeof t.ajaxTarget?t.ajaxTarget:this.defaultConfiguration.ajaxTarget,this.generate(t)},t.prototype.initializeMarkupTrigger=function(t){var e=this;n(t).on("click",".t3js-modal-trigger",(function(t){t.preventDefault();var i=n(t.currentTarget),l=i.data("content")||"Are you sure?",s=void 0!==a.SeverityEnum[i.data("severity")]?a.SeverityEnum[i.data("severity")]:a.SeverityEnum.info,r=i.data("url")||null;if(null!==r){var d=r.indexOf("?")>-1?"&":"?";r=r+d+n.param({data:i.data()})}e.advanced({type:null!==r?c.ajax:c.default,title:i.data("title")||"Alert",content:null!==r?r:l,severity:s,buttons:[{text:i.data("button-close-text")||TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:function(){e.currentModal.trigger("modal-dismiss")}},{text:i.data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+o.getCssClass(s),trigger:function(){e.currentModal.trigger("modal-dismiss"),t.target.ownerDocument.location.href=i.data("href")||i.attr("href")}}]})}))},t.prototype.generate=function(t){var e,a,Line truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Viewport/ScaffoldIdentifier","jquery","./Storage/Persistent","./Viewport","./Event/ClientRequest","./Event/TriggerRequest"],(function(e,n,t,o,a,i,r,d){"use strict";var u=function(){function n(){var e=this;this.loadedModule=null,this.loadedNavigationComponentId="",o((function(){return e.initialize()}))}return n.getCollapsedMainMenuItems=function(){return a.isset("modulemenu")?JSON.parse(a.get("modulemenu")):{}},n.addCollapsedMainMenuItem=function(e){var t=n.getCollapsedMainMenuItems();t[e]=!0,a.set("modulemenu",JSON.stringify(t))},n.removeCollapseMainMenuItem=function(e){var n=this.getCollapsedMainMenuItems();delete n[e],a.set("modulemenu",JSON.stringify(n))},n.includeId=function(e,n){if(!e.navigationComponentId&&!e.navigationFrameScript)return n;var t="";return t="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0],top.fsMod.recentIds[t]&&(n="id="+top.fsMod.recentIds[t]+"&"+n),n},n.toggleMenu=function(e){i.NavigationContainer.cleanup();var n=o(t.ScaffoldIdentifierEnum.scaffold);void 0===e&&(e=n.hasClass("scaffold-modulemenu-expanded")),n.toggleClass("scaffold-modulemenu-expanded",!e),e||o(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),a.set("BackendComponents.States.typo3-module-menu",{collapsed:e}),i.doLayout()},n.getRecordFromName=function(e){var n=o("#"+e);return{name:e,navigationComponentId:n.data("navigationcomponentid"),navigationFrameScript:n.data("navigationframescript"),navigationFrameScriptParam:n.data("navigationframescriptparameters"),link:n.find("a").data("link")}},n.highlightModuleMenuItem=function(e){o(".modulemenu-item.active").removeClass("active"),o("#"+e).addClass("active")},n.prototype.refreshMenu=function(){o.ajax(TYPO3.settings.ajaxUrls.modulemenu).done((function(e){o("#menu").replaceWith(e.menu),top.currentModuleLoaded&&n.highlightModuleMenuItem(top.currentModuleLoaded),i.doLayout()}))},n.prototype.reloadFrames=function(){i.NavigationContainer.refresh(),i.ContentContainer.refresh()},n.prototype.showModule=function(e,t,o){t=t||"";var a=n.getRecordFromName(e);return this.loadModuleComponents(a,t,new r("typo3.showModule",o))},n.prototype.initialize=function(){var e=this,n=o.Deferred();if(n.resolve(),top.startInModule&&top.startInModule[0]&&o("#"+top.startInModule[0]).length>0)n=this.showModule(top.startInModule[0],top.startInModule[1]);else{var t=o(".t3js-mainmodule:first");t.attr("id")&&(n=this.showModule(t.attr("id")))}n.then((function(){e.initializeEvents()}))},n.prototype.initializeEvents=function(){var e=this;o(document).on("click",".modulemenu-group .modulemenu-group-header",(function(e){var t=o(e.currentTarget).parent(".modulemenu-group"),a=t.find(".modulemenu-group-container");i.NavigationContainer.cleanup(),t.hasClass("expanded")?(n.addCollapsedMainMenuItem(t.attr("id")),t.addClass("collapsed").removeClass("expanded"),a.stop().slideUp().promise().done((function(){i.doLayout()}))):(n.removeCollapseMainMenuItem(t.attr("id")),t.addClass("expanded").removeClass("collapsed"),a.stop().slideDown().promise().done((function(){i.doLayout()})))})),o(document).on("click",".modulemenu-item,.t3-menuitem-submodule",(function(n){n.preventDefault(),e.showModule(o(n.currentTarget).attr("id"),"",n)})),o(document).on("click",".t3js-topbar-button-modulemenu",(function(e){e.preventDefault(),n.toggleMenu()})),o(document).on("click",".t3js-scaffold-content-overlay",(function(e){e.preventDefault(),n.toggleMenu(!0)})),o(document).on("click",".t3js-topbar-button-navigationcomponent",(function(e){e.preventDefault(),i.NavigationContainer.toggle()}))},n.prototype.loadModuleComponents=function(e,t,a){var r=this,u=e.name,l=i.ContentContainer.beforeSetUrl(a);return l.then(o.proxy((function(){e.navigationComponentId?r.loadNavigationComponent(e.navigationComponentId):e.navigationFrameScript?(i.NavigationContainer.show("typo3-navigationIframe"),r.openInNavFrame(e.navigationFrameScript,e.navigationFrameScriptParam,new d("typo3.loadModuleComponents",a))):i.NavigationContainer.hide(),n.highlightModuleMenuItem(u),r.loadedModule=u,t=n.includeId(e,t),r.openInContentFrame(e.link,t,new d("typo3.loadModuleComponents",a)),top.currentSubScript=e.link,top.currentModuleLoaded=u,i.doLayout()}),this)),l},n.prototype.loadNavigationComponent=function(n){var t=this;if(i.NavigationContainer.show(n),n!==this.loadedNavigationComponentId){var a=n.replace(/[/]/g,"_");""!==this.loadedNavigationComponentId&&o("#navigationComponent-"+this.loadedNavigationComponentId.replace(/[/]/g,"_")).hide(),o('.t3js-scaffold-content-navigation [data-component="'+n+'"]').length<1&&o(".t3js-scaffold-content-navigation").append(o("<div />",{class:"scaffold-content-navigation-component","data-component":n,id:"navigationComponent-"+a})),e([n],(function(e){e.initialize("#navigationComponent-"+a),i.NavigationContainer.show(n),t.loadedNavigationComponentId=n}))}},n.prototype.openInNavFrame=function(e,n,t){var o=e+(n?(-1!==e.indexOf("?Line truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery"],(function(e,t,n){"use strict";var i;return function(e){e.containerSelector=".t3js-newmultiplepages-container",e.addMoreFieldsButtonSelector=".t3js-newmultiplepages-createnewfields",e.doktypeSelector=".t3js-newmultiplepages-select-doktype",e.templateRow=".t3js-newmultiplepages-newlinetemplate"}(i||(i={})),new(function(){function e(){var e=this;this.lineCounter=5,n((function(){e.initializeEvents()}))}return e.prototype.initializeEvents=function(){var e=this;n(i.addMoreFieldsButtonSelector).on("click",(function(){e.createNewFormFields()})),n(document).on("change",i.doktypeSelector,(function(t){e.actOnTypeSelectChange(n(t.currentTarget))}))},e.prototype.createNewFormFields=function(){for(var e=0;e<5;e++){var t=this.lineCounter+e+1,o=n(i.templateRow).html().replace(/\[0\]/g,(this.lineCounter+e).toString()).replace(/\[1\]/g,t.toString());n(o).appendTo(i.containerSelector)}this.lineCounter+=5},e.prototype.actOnTypeSelectChange=function(e){var t=e.find(":selected");n(e.data("target")).html(t.data("icon"))},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Severity","./Severity"],(function(e,i,t,a){"use strict";var n,s=function(){function e(){}return e.notice=function(i,a,n){e.showMessage(i,a,t.SeverityEnum.notice,n)},e.info=function(i,a,n){e.showMessage(i,a,t.SeverityEnum.info,n)},e.success=function(i,a,n){e.showMessage(i,a,t.SeverityEnum.ok,n)},e.warning=function(i,a,n){e.showMessage(i,a,t.SeverityEnum.warning,n)},e.error=function(i,a,n){void 0===n&&(n=0),e.showMessage(i,a,t.SeverityEnum.error,n)},e.showMessage=function(e,i,n,s){void 0===s&&(s=this.duration);var r=a.getCssClass(n),o="";switch(n){case t.SeverityEnum.notice:o="lightbulb-o";break;case t.SeverityEnum.ok:o="check";break;case t.SeverityEnum.warning:o="exclamation";break;case t.SeverityEnum.error:o="times";break;case t.SeverityEnum.info:default:o="info"}s=void 0===s?this.duration:"string"==typeof s?parseFloat(s):s,null===this.messageContainer&&(this.messageContainer=$('<div id="alert-container"></div>').appendTo("body"));var c=$('<div class="alert alert-'+r+' alert-dismissible fade" role="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true"><i class="fa fa-times-circle"></i></span><span class="sr-only">Close</span></button><div class="media"><div class="media-left"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-'+o+' fa-stack-1x"></i></span></div><div class="media-body"><h4 class="alert-title"></h4><p class="alert-message text-pre-wrap"></p></div></div></div>');c.find(".alert-title").text(e),c.find(".alert-message").text(i),c.on("close.bs.alert",(function(e){e.preventDefault();var i=$(e.currentTarget);i.clearQueue().queue((function(e){i.removeClass("in"),e()})).slideUp((function(){i.remove()}))})),c.appendTo(this.messageContainer),c.delay(200).queue((function(e){c.addClass("in"),e()})),s>0&&c.delay(1e3*s).queue((function(e){c.alert("close"),e()}))},e.duration=5,e.messageContainer=null,e}();try{parent&&parent.window.TYPO3&&parent.window.TYPO3.Notification&&(n=parent.window.TYPO3.Notification),top&&top.TYPO3.Notification&&(n=top.TYPO3.Notification)}catch(e){}return n||(n=s,"undefined"!=typeof TYPO3&&(TYPO3.Notification=n)),n}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/KeyTypes","jquery","nprogress","./Modal","./Severity","TYPO3/CMS/Core/SecurityUtility"],(function(e,t,n,i,r,o,a,l){"use strict";return new(function(){function e(){var e=this;this.securityUtility=new l,i((function(){e.registerEvents()}))}return e.prototype.registerEvents=function(){var e=this;i(document).on("click",".t3js-online-media-add-btn",(function(t){e.triggerModal(i(t.currentTarget))}))},e.prototype.addOnlineMedia=function(e,t){var n=e.data("target-folder"),l=e.data("online-media-allowed"),s=e.data("file-irre-object");r.start(),i.post(TYPO3.settings.ajaxUrls.online_media_create,{url:t,targetFolder:n,allowed:l},(function(e){if(e.file)window.inline.delayedImportElement(s,"sys_file",e.file,"file");else var t=o.confirm("ERROR",e.error,a.error,[{text:TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+a.getCssClass(a.error),name:"ok",active:!0}]).on("confirm.button.ok",(function(){t.modal("hide")}));r.done()}))},e.prototype.triggerModal=function(e){var t=this,r=e.data("btn-submit")||"Add",l=e.data("placeholder")||"Paste media url here...",s=i.map(e.data("online-media-allowed").split(","),(function(e){return'<span class="label label-success">'+t.securityUtility.encodeHtml(e.toUpperCase(),!1)+"</span>"})),d=e.data("online-media-allowed-help-text")||"Allow to embed from sources:",c=i("<div>").attr("class","form-control-wrap").append([i("<input>").attr("type","text").attr("class","form-control online-media-url").attr("placeholder",l),i("<div>").attr("class","help-block").html(this.securityUtility.encodeHtml(d,!1)+"<br>"+s.join(" "))]),u=o.show(e.attr("title"),c,a.notice,[{text:r,btnClass:"btn btn-primary",name:"ok",trigger:function(){var n=u.find("input.online-media-url").val();n&&(u.modal("hide"),t.addOnlineMedia(e,n))}}]);u.on("shown.bs.modal",(function(e){i(e.currentTarget).find("input.online-media-url").first().focus().on("keydown",(function(e){e.keyCode===n.KeyTypesEnum.ENTER&&u.find('button[name="ok"]').trigger("click")}))}))},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/KeyTypes","jquery","./Storage/Persistent","./Wizard/NewContentElement"],(function(t,e,n,i,a,o){"use strict";var s;return function(t){t.pageTitle=".t3js-title-inlineedit",t.hiddenElements=".t3js-hidden-record",t.newButton=".t3js-toggle-new-content-element-wizard"}(s||(s={})),new(function(){function e(){var t=this;this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,i((function(){t.initializeElements(),t.initializeEvents(),t.initializeNewContentElementWizard(),t.initializePageTitleRenaming()}))}return e.prototype.setPageId=function(t){this.pageId=t},e.prototype.setLanguageOverlayId=function(t){this.pageOverlayId=t},e.prototype.initializePageTitleRenaming=function(){var t=this;if(i.isReady){if(!(this.pageId<=0)){var e=i('<a class="hidden" href="#" data-action="edit"><span class="t3-icon fa fa-pencil"></span></a>');e.on("click",(function(e){e.preventDefault(),t.editPageTitle()})),this.$pageTitle.on("dblclick",(function(){t.editPageTitle()})).on("mouseover",(function(){e.removeClass("hidden")})).on("mouseout",(function(){e.addClass("hidden")})).append(e)}}else i((function(){t.initializePageTitleRenaming()}))},e.prototype.initializeElements=function(){this.$pageTitle=i(s.pageTitle+":first"),this.$showHiddenElementsCheckbox=i("#checkTt_content_showHidden")},e.prototype.initializeEvents=function(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)},e.prototype.toggleContentElementVisibility=function(t){var e=i(t.currentTarget),n=i(s.hiddenElements),o=i("<span />",{class:"checkbox-spinner fa fa-circle-o-notch fa-spin"});e.hide().after(o),e.prop("checked")?n.slideDown():n.slideUp(),a.set("moduleData.web_layout.tt_content_showHidden",e.prop("checked")?"1":"0").done((function(){o.remove(),e.show()}))},e.prototype.editPageTitle=function(){var t=this,e=i('<form><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> </span><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> </span></div></div></form>'),a=e.find("input");e.find('[data-action="cancel"]').on("click",(function(){e.replaceWith(t.$pageTitle),t.initializePageTitleRenaming()})),e.find('[data-action="submit"]').on("click",(function(){var n=i.trim(a.val());""!==n&&t.$pageTitle.text()!==n?t.saveChanges(a):e.find('[data-action="cancel"]').trigger("click")})),a.parents("form").on("submit",(function(t){return t.preventDefault(),!1}));var o=this.$pageTitle;o.children().last().remove(),o.replaceWith(e),a.val(o.text()).focus(),a.on("keyup",(function(t){switch(t.which){case n.KeyTypesEnum.ENTER:e.find('[data-action="submit"]').trigger("click");break;case n.KeyTypesEnum.ESCAPE:e.find('[data-action="cancel"]').trigger("click")}}))},e.prototype.saveChanges=function(e){var n=this,i=e.parents("form");i.find("button").addClass("disabled"),e.attr("disabled","disabled");var a,o={};a=this.pageOverlayId>0?this.pageOverlayId:this.pageId,o.data={},o.data.pages={},o.data.pages[a]={title:e.val()},t(["TYPO3/CMS/Backend/AjaxDataHandler"],(function(t){t.process(o).done((function(){i.find("[data-action=cancel]").trigger("click"),n.$pageTitle.text(e.val()),n.initializePageTitleRenaming(),top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()})).fail((function(){i.find("[data-action=cancel]").trigger("click")}))}))},e.prototype.initializeNewContentElementWizard=function(){i(s.newButton).removeClass("disabled"),i(s.newButton).click((function(t){t.preventDefault();var e=i(t.currentTarget);o.wizard(e.attr("href"),e.data("title"))}))},e}())}));
|
||||
@@ -0,0 +1,679 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/PageTree/PageTree
|
||||
*/
|
||||
define(['jquery',
|
||||
'd3',
|
||||
'TYPO3/CMS/Backend/Icons',
|
||||
'TYPO3/CMS/Backend/PageTree/PageTreeDragDrop',
|
||||
'TYPO3/CMS/Backend/SvgTree',
|
||||
'TYPO3/CMS/Backend/ContextMenu',
|
||||
'TYPO3/CMS/Backend/Storage/Persistent',
|
||||
'TYPO3/CMS/Backend/Notification'
|
||||
],
|
||||
function($, d3, Icons, PageTreeDragDrop, SvgTree, ContextMenu, Persistent, Notification) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @exports TYPO3/CMS/Backend/PageTree/PageTree
|
||||
*/
|
||||
var PageTree = function() {
|
||||
SvgTree.call(this);
|
||||
this.originalNodes = [];
|
||||
this.settings.defaultProperties = {
|
||||
hasChildren: false,
|
||||
nameSourceField: 'title',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
locked: false,
|
||||
loaded: false,
|
||||
overlayIcon: '',
|
||||
selectable: true,
|
||||
expanded: false,
|
||||
checked: false,
|
||||
backgroundColor: '',
|
||||
stopPageTree: false,
|
||||
class: '',
|
||||
readableRootline: '',
|
||||
isMountPoint: false,
|
||||
};
|
||||
this.searchQuery = '';
|
||||
};
|
||||
|
||||
PageTree.prototype = Object.create(SvgTree.prototype);
|
||||
|
||||
var _super_ = SvgTree.prototype;
|
||||
|
||||
/**
|
||||
* SelectTree initialization
|
||||
*
|
||||
* @param {String} selector
|
||||
* @param {Object} settings
|
||||
*/
|
||||
PageTree.prototype.initialize = function(selector, settings) {
|
||||
var _this = this;
|
||||
|
||||
if (!_super_.initialize.call(_this, selector, settings)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_this.settings.isDragAnDrop = settings.allowDragMove;
|
||||
_this.dispatch.on('nodeSelectedAfter.pageTree', _this.nodeSelectedAfter);
|
||||
_this.dispatch.on('nodeRightClick.pageTree', _this.nodeRightClick);
|
||||
_this.dispatch.on('contextmenu.pageTree', _this.contextmenu);
|
||||
_this.dispatch.on('updateSvg.pageTree', _this.updateSvg);
|
||||
_this.dispatch.on('prepareLoadedNode.pageTree', _this.prepareLoadedNode);
|
||||
_this.dragDrop = PageTreeDragDrop;
|
||||
_this.dragDrop.init(_this);
|
||||
|
||||
if (_this.settings.temporaryMountPoint) {
|
||||
_this.addMountPoint(_this.settings.temporaryMountPoint);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add mount point
|
||||
*/
|
||||
PageTree.prototype.addMountPoint = function(breadcrumb) {
|
||||
var _this = this;
|
||||
|
||||
if (_this.wrapper.parent().find('.node-mount-point').length) {
|
||||
_this.wrapper.parent().find('.node-mount-point').remove();
|
||||
}
|
||||
|
||||
_this.mountPoint = _this.wrapper.before(
|
||||
'<div class="node-mount-point">' +
|
||||
'<div class="node-mount-point__icon" data-tree-icon="actions-document-info"></div>' +
|
||||
'<div class="node-mount-point__text"><div>' + breadcrumb + '</div></div>' +
|
||||
'<div class="node-mount-point__icon" data-tree-icon="actions-close" title="' + TYPO3.lang['labels.temporaryDBmount'] + '"></div>' +
|
||||
'</div>'
|
||||
);
|
||||
|
||||
_this.wrapper.parent()
|
||||
.find('[data-tree-icon=actions-close]')
|
||||
.on('click', function() {
|
||||
top.TYPO3.Backend.NavigationContainer.PageTree.unsetTemporaryMountPoint();
|
||||
_this.wrapper.parent().find('.node-mount-point').remove();
|
||||
});
|
||||
|
||||
//get icons
|
||||
_this.wrapper.parent().find('.node-mount-point [data-tree-icon]').each(function() {
|
||||
var $this = $(this);
|
||||
|
||||
Icons.getIcon($this.attr('data-tree-icon'), Icons.sizes.small, null, null, 'inline').done(function(icon) {
|
||||
$this.append(icon);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays a notification message and refresh nodes
|
||||
*
|
||||
* @param error
|
||||
*/
|
||||
PageTree.prototype.errorNotification = function(error) {
|
||||
var title = TYPO3.lang.pagetree_networkErrorTitle;
|
||||
var desc = TYPO3.lang.pagetree_networkErrorDesc;
|
||||
|
||||
if (error && error.target && (error.target.status || error.target.statusText)) {
|
||||
title += ' - ' + (error.target.status || '') + ' ' + (error.target.statusText || '');
|
||||
}
|
||||
|
||||
Notification.error(title, desc);
|
||||
this.loadData();
|
||||
};
|
||||
|
||||
PageTree.prototype.sendChangeCommand = function(data) {
|
||||
var _this = this;
|
||||
var params = '';
|
||||
|
||||
if (data.target) {
|
||||
var targetUid = data.target.identifier;
|
||||
if (data.position === 'after') {
|
||||
targetUid = -targetUid;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.command === 'new') {
|
||||
params = '&data[pages][NEW_1][pid]=' + targetUid +
|
||||
'&data[pages][NEW_1][title]=' + encodeURIComponent(data.name) +
|
||||
'&data[pages][NEW_1][doktype]=' + data.type;
|
||||
|
||||
} else if (data.command === 'edit') {
|
||||
params = '&data[pages][' + data.uid + '][' + data.nameSourceField + ']=' + encodeURIComponent(data.title);
|
||||
} else {
|
||||
if (data.command === 'delete') {
|
||||
if (data.uid === fsMod.recentIds.web) {
|
||||
_this.selectNode(_this.nodes[0]);
|
||||
}
|
||||
params = '&cmd[pages][' + data.uid + '][delete]=1';
|
||||
} else {
|
||||
params = 'cmd[pages][' + data.uid + '][' + data.command + ']=' + targetUid;
|
||||
}
|
||||
}
|
||||
|
||||
_this.nodesAddPlaceholder();
|
||||
|
||||
d3.request(top.TYPO3.settings.ajaxUrls.record_process)
|
||||
.header('X-Requested-With', 'XMLHttpRequest')
|
||||
.header('Content-Type', 'application/x-www-form-urlencoded')
|
||||
.on('error', function(error) {
|
||||
_this.errorNotification(error);
|
||||
throw error;
|
||||
})
|
||||
.post(params, function(data) {
|
||||
if (data) {
|
||||
var response = JSON.parse(data.response);
|
||||
|
||||
if (response && response.hasErrors) {
|
||||
if (response.messages) {
|
||||
$.each(response.messages, function(id, message) {
|
||||
Notification.error(
|
||||
message.title,
|
||||
message.message
|
||||
);
|
||||
});
|
||||
} else {
|
||||
_this.errorNotification();
|
||||
}
|
||||
|
||||
_this.nodesContainer.selectAll('.node').remove();
|
||||
_this.update();
|
||||
_this.nodesRemovePlaceholder();
|
||||
} else {
|
||||
_this.refreshOrFilterTree();
|
||||
}
|
||||
} else {
|
||||
_this.errorNotification();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds node by its stateIdentifier (e.g. "0_360")
|
||||
* @return {Node}
|
||||
*/
|
||||
PageTree.prototype.getNodeByIdentifier = function(identifier) {
|
||||
return this.nodes.find(function (node) {
|
||||
return node.stateIdentifier === identifier;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Observer for the selectedNode event
|
||||
*
|
||||
* @param {Node} node
|
||||
*/
|
||||
PageTree.prototype.nodeSelectedAfter = function(node) {
|
||||
if (!node.checked) {
|
||||
return;
|
||||
}
|
||||
//remember the selected page in the global state
|
||||
fsMod.recentIds.web = node.identifier;
|
||||
fsMod.currentBank = node.stateIdentifier.split('_')[0];
|
||||
fsMod.navFrameHighlightedID.web = node.stateIdentifier;
|
||||
|
||||
var separator = '?';
|
||||
if (currentSubScript.indexOf('?') !== -1) {
|
||||
separator = '&';
|
||||
}
|
||||
|
||||
TYPO3.Backend.ContentContainer.setUrl(
|
||||
currentSubScript + separator + 'id=' + node.identifier
|
||||
);
|
||||
};
|
||||
|
||||
PageTree.prototype.nodeRightClick = function(node) {
|
||||
d3.event.preventDefault();
|
||||
var $node = $(node).closest('svg').find('.nodes .node[data-state-id=' + this.stateIdentifier + ']');
|
||||
|
||||
if ($node.length) {
|
||||
ContextMenu.show(
|
||||
$node.data('table'),
|
||||
this.identifier,
|
||||
$node.data('context'),
|
||||
$node.data('iteminfo'),
|
||||
$node.data('parameters')
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
PageTree.prototype.contextmenu = function(node) {
|
||||
var $node = $(node).closest('svg').find('.nodes .node[data-state-id=' + this.stateIdentifier + ']');
|
||||
|
||||
if ($node.length) {
|
||||
ContextMenu.show(
|
||||
$node.data('table'),
|
||||
this.identifier,
|
||||
$node.data('context'),
|
||||
$node.data('iteminfo'),
|
||||
$node.data('parameters')
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
PageTree.prototype.updateSvg = function(nodeEnter) {
|
||||
nodeEnter
|
||||
.select('use')
|
||||
.attr('data-table', 'pages')
|
||||
.attr('data-context', 'tree');
|
||||
};
|
||||
|
||||
/**
|
||||
* Event listener called for each loaded node,
|
||||
* here used to mark node remembered in fsMode as selected
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
PageTree.prototype.prepareLoadedNode = function(node) {
|
||||
if (node.stateIdentifier === fsMod.navFrameHighlightedID.web) {
|
||||
node.checked = true;
|
||||
}
|
||||
};
|
||||
|
||||
PageTree.prototype.hideChildren = function(node) {
|
||||
_super_.hideChildren(node);
|
||||
Persistent.set('BackendComponents.States.Pagetree.stateHash.' + node.stateIdentifier, 0);
|
||||
};
|
||||
|
||||
PageTree.prototype.showChildren = function(node) {
|
||||
this.loadChildrenOfNode(node);
|
||||
_super_.showChildren(node);
|
||||
Persistent.set('BackendComponents.States.Pagetree.stateHash.' + node.stateIdentifier, 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Loads child nodes via Ajax (used when expanding a collapesed node)
|
||||
*
|
||||
* @param parentNode
|
||||
* @return {boolean}
|
||||
*/
|
||||
PageTree.prototype.loadChildrenOfNode = function(parentNode) {
|
||||
if (parentNode.loaded) {
|
||||
return;
|
||||
}
|
||||
var _this = this;
|
||||
_this.nodesAddPlaceholder();
|
||||
d3.json(_this.settings.dataUrl + '&pid=' + parentNode.identifier + '&mount=' + parentNode.mountPoint + '&pidDepth=' + parentNode.depth, function(error, json) {
|
||||
if (error) {
|
||||
var title = TYPO3.lang.pagetree_networkErrorTitle;
|
||||
var desc = TYPO3.lang.pagetree_networkErrorDesc;
|
||||
|
||||
if (error && error.target && (error.target.status || error.target.statusText)) {
|
||||
title += ' - ' + (error.target.status || '') + ' ' + (error.target.statusText || '');
|
||||
}
|
||||
|
||||
Notification.error(
|
||||
title,
|
||||
desc);
|
||||
|
||||
_this.nodesRemovePlaceholder();
|
||||
throw error;
|
||||
}
|
||||
|
||||
var nodes = Array.isArray(json) ? json : [];
|
||||
//first element is a parent
|
||||
nodes.shift();
|
||||
var index = _this.nodes.indexOf(parentNode) + 1;
|
||||
//adding fetched node after parent
|
||||
nodes.forEach(function (node, offset) {
|
||||
_this.nodes.splice(index + offset, 0, node);
|
||||
});
|
||||
|
||||
parentNode.loaded = true;
|
||||
_this.setParametersNode();
|
||||
_this.prepareDataForVisibleNodes();
|
||||
_this.update();
|
||||
_this.nodesRemovePlaceholder();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
PageTree.prototype.updateNodeBgClass = function(nodeBg) {
|
||||
return _super_.updateNodeBgClass.call(this, nodeBg).call(this.dragDrop.drag());
|
||||
};
|
||||
|
||||
PageTree.prototype.nodesUpdate = function(nodes) {
|
||||
var _this = this;
|
||||
|
||||
nodes = _super_.nodesUpdate.call(this, nodes)
|
||||
.call(this.dragDrop.drag())
|
||||
.attr('data-table', 'pages')
|
||||
.attr('data-context', 'tree')
|
||||
.on('contextmenu', function(node) {
|
||||
_this.dispatch.call('nodeRightClick', node, this);
|
||||
});
|
||||
|
||||
var nodeStop = nodes
|
||||
.append('text')
|
||||
.text('+')
|
||||
.attr('class', 'node-stop')
|
||||
.attr('dx', 30)
|
||||
.attr('dy', 5)
|
||||
.attr('visibility', function(node) {
|
||||
return (node.stopPageTree && (node.depth !== 0)) ? 'visible' : 'hidden';
|
||||
})
|
||||
.on('click', function(node) {
|
||||
_this.setTemporaryMountPoint(node.identifier);
|
||||
});
|
||||
|
||||
return nodes;
|
||||
};
|
||||
|
||||
/**
|
||||
* Node selection logic (triggered by different events)
|
||||
* Page tree supports only one node to be selected at a time
|
||||
* so the default function from SvgTree needs to be overriden
|
||||
*
|
||||
* @param {Node} node
|
||||
*/
|
||||
PageTree.prototype.selectNode = function (node) {
|
||||
if (!this.isNodeSelectable(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _this = this;
|
||||
var selectedNodes = this.getSelectedNodes();
|
||||
selectedNodes.forEach(function (node) {
|
||||
if (node.checked === true) {
|
||||
node.checked = false;
|
||||
_this.dispatch.call('nodeSelectedAfter', _this, node);
|
||||
}
|
||||
});
|
||||
|
||||
node.checked = true;
|
||||
|
||||
this.dispatch.call('nodeSelectedAfter', this, node);
|
||||
this.update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Event handler for double click on a node's label
|
||||
* Changed text position if there is 'stop page tree' option
|
||||
*
|
||||
* @param {Node} node
|
||||
*/
|
||||
PageTree.prototype.appendTextElement = function(node) {
|
||||
var _this = this;
|
||||
var clicks = 0;
|
||||
|
||||
_super_.appendTextElement.call(this, node)
|
||||
.attr('dx', function(node) {
|
||||
var position = _this.textPosition;
|
||||
if (node.stopPageTree && node.depth !== 0) {
|
||||
position += 15;
|
||||
}
|
||||
|
||||
if (node.locked) {
|
||||
position += 15;
|
||||
}
|
||||
|
||||
return position;
|
||||
})
|
||||
.on('click', function(node) {
|
||||
if (node.identifier !== 0) {
|
||||
clicks++;
|
||||
|
||||
if (clicks === 1) {
|
||||
setTimeout(function() {
|
||||
if (clicks === 1) {
|
||||
_this.clickOnLabel(node, this);
|
||||
} else {
|
||||
_this.editNodeLabel(node);
|
||||
}
|
||||
|
||||
clicks = 0;
|
||||
}, 300);
|
||||
}
|
||||
} else {
|
||||
_this.clickOnLabel(node, this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
PageTree.prototype.filterTree = function() {
|
||||
var _this = this;
|
||||
_this.nodesAddPlaceholder();
|
||||
|
||||
d3.json(_this.settings.filterUrl + '&q=' + _this.searchQuery, function(error, json) {
|
||||
if (error) {
|
||||
var title = TYPO3.lang.pagetree_networkErrorTitle;
|
||||
var desc = TYPO3.lang.pagetree_networkErrorDesc;
|
||||
|
||||
if (error && error.target && (error.target.status || error.target.statusText)) {
|
||||
title += ' - ' + (error.target.status || '') + ' ' + (error.target.statusText || '');
|
||||
}
|
||||
|
||||
Notification.error(
|
||||
title,
|
||||
desc);
|
||||
|
||||
_this.nodesRemovePlaceholder();
|
||||
throw error;
|
||||
}
|
||||
|
||||
var nodes = Array.isArray(json) ? json : [];
|
||||
if (nodes.length > 0) {
|
||||
if (_this.originalNodes.length === 0) {
|
||||
_this.originalNodes = JSON.stringify(_this.nodes);
|
||||
}
|
||||
_this.replaceData(nodes);
|
||||
}
|
||||
_this.nodesRemovePlaceholder();
|
||||
});
|
||||
};
|
||||
|
||||
PageTree.prototype.refreshOrFilterTree = function() {
|
||||
if (this.searchQuery !== '') {
|
||||
this.filterTree();
|
||||
} else {
|
||||
this.refreshTree();
|
||||
}
|
||||
}
|
||||
|
||||
PageTree.prototype.resetFilter = function() {
|
||||
this.searchQuery = '';
|
||||
if (this.originalNodes.length > 0) {
|
||||
var currentlySelected = this.getSelectedNodes()[0];
|
||||
if (typeof currentlySelected === 'undefined') {
|
||||
this.refreshTree();
|
||||
return;
|
||||
}
|
||||
|
||||
this.nodes = JSON.parse(this.originalNodes);
|
||||
this.originalNodes = '';
|
||||
var currentlySelectedNode = this.getNodeByIdentifier(currentlySelected.stateIdentifier);
|
||||
|
||||
if (currentlySelectedNode) {
|
||||
this.selectNode(currentlySelectedNode);
|
||||
} else {
|
||||
this.refreshTree();
|
||||
}
|
||||
} else {
|
||||
this.refreshTree();
|
||||
}
|
||||
};
|
||||
|
||||
PageTree.prototype.setTemporaryMountPoint = function(pid) {
|
||||
var params = 'pid=' + pid;
|
||||
var _this = this;
|
||||
|
||||
d3.request(top.TYPO3.settings.ajaxUrls.page_tree_set_temporary_mount_point)
|
||||
.header('X-Requested-With', 'XMLHttpRequest')
|
||||
.header('Content-Type', 'application/x-www-form-urlencoded')
|
||||
.on('error', function(error) {
|
||||
_this.errorNotification(error);
|
||||
throw error;
|
||||
})
|
||||
.post(params, function(data) {
|
||||
if (data) {
|
||||
var response = JSON.parse(data.response);
|
||||
|
||||
if (response && response.hasErrors) {
|
||||
if (response.messages) {
|
||||
$.each(response.messages, function(id, message) {
|
||||
Notification.error(
|
||||
message.title,
|
||||
message.message
|
||||
);
|
||||
});
|
||||
} else {
|
||||
_this.errorNotification();
|
||||
}
|
||||
|
||||
_this.update();
|
||||
} else {
|
||||
_this.addMountPoint(response.mountPointPath);
|
||||
_this.refreshOrFilterTree();
|
||||
}
|
||||
} else {
|
||||
_this.errorNotification();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
PageTree.prototype.unsetTemporaryMountPoint = function() {
|
||||
var _this = this;
|
||||
Persistent.unset('pageTree_temporaryMountPoint').then(function() {
|
||||
_this.refreshTree();
|
||||
});
|
||||
};
|
||||
|
||||
PageTree.prototype.sendEditNodeLabelCommand = function(node) {
|
||||
var _this = this;
|
||||
|
||||
var params = '&data[pages][' + node.identifier + '][' + node.nameSourceField + ']=' + encodeURIComponent(node.newName);
|
||||
|
||||
//remove old node from svg tree
|
||||
_this.nodesAddPlaceholder(node);
|
||||
|
||||
d3.request(top.TYPO3.settings.ajaxUrls.record_process)
|
||||
.header('X-Requested-With', 'XMLHttpRequest')
|
||||
.header('Content-Type', 'application/x-www-form-urlencoded')
|
||||
.on('error', function(error) {
|
||||
_this.errorNotification(error);
|
||||
throw error;
|
||||
})
|
||||
.post(params, function(data) {
|
||||
if (data) {
|
||||
var response = JSON.parse(data.response);
|
||||
|
||||
if (response && response.hasErrors) {
|
||||
if (response.messages) {
|
||||
$.each(response.messages, function(id, message) {
|
||||
Notification.error(
|
||||
message.title,
|
||||
message.message
|
||||
);
|
||||
});
|
||||
} else {
|
||||
_this.errorNotification();
|
||||
}
|
||||
|
||||
_this.nodesAddPlaceholder();
|
||||
_this.refreshOrFilterTree();
|
||||
} else {
|
||||
node.name = node.newName;
|
||||
_this.svg.select('.node-placeholder[data-uid="' + node.stateIdentifier + '"]').remove();
|
||||
_this.refreshOrFilterTree();
|
||||
_this.nodesRemovePlaceholder();
|
||||
}
|
||||
} else {
|
||||
_this.errorNotification();
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
PageTree.prototype.editNodeLabel = function(node) {
|
||||
var _this = this;
|
||||
|
||||
if (!node.allowEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
_this.removeEditedText();
|
||||
_this.nodeIsEdit = true;
|
||||
|
||||
d3.select(_this.svg.node().parentNode)
|
||||
.append('input')
|
||||
.attr('class', 'node-edit')
|
||||
.style('top', function() {
|
||||
var top = node.y + _this.settings.marginTop;
|
||||
return top + 'px';
|
||||
})
|
||||
.style('left', (node.x + _this.textPosition + 5) + 'px')
|
||||
.style('width', _this.settings.width - (node.x + _this.textPosition + 20) + 'px')
|
||||
.style('height', _this.settings.nodeHeight + 'px')
|
||||
.attr('type', 'text')
|
||||
.attr('value', node.name)
|
||||
.on('keydown', function() {
|
||||
var code = d3.event.keyCode;
|
||||
|
||||
if (code === 13 || code === 9) { //enter || tab
|
||||
var newName = this.value.trim();
|
||||
|
||||
if (newName.length && (newName !== node.name)) {
|
||||
_this.nodeIsEdit = false;
|
||||
_this.removeEditedText();
|
||||
node.nameSourceField = node.nameSourceField || 'title';
|
||||
node.newName = newName;
|
||||
_this.sendEditNodeLabelCommand(node);
|
||||
} else {
|
||||
_this.nodeIsEdit = false;
|
||||
_this.removeEditedText();
|
||||
}
|
||||
} else if (code === 27) { //esc
|
||||
_this.nodeIsEdit = false;
|
||||
_this.removeEditedText();
|
||||
}
|
||||
})
|
||||
.on('blur', function() {
|
||||
if (_this.nodeIsEdit) {
|
||||
var newName = this.value.trim();
|
||||
|
||||
if (newName.length && (newName !== node.name)) {
|
||||
node.nameSourceField = node.nameSourceField || 'title';
|
||||
node.newName = newName;
|
||||
|
||||
_this.sendEditNodeLabelCommand(node);
|
||||
}
|
||||
|
||||
_this.removeEditedText();
|
||||
}
|
||||
})
|
||||
.node()
|
||||
.select();
|
||||
};
|
||||
|
||||
PageTree.prototype.removeEditedText = function() {
|
||||
var _this = this;
|
||||
var inputWrapper = d3.selectAll('.node-edit');
|
||||
|
||||
if (inputWrapper.size()) {
|
||||
try {
|
||||
inputWrapper.remove();
|
||||
_this.nodeIsEdit = false;
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return PageTree;
|
||||
});
|
||||
@@ -0,0 +1,883 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/PageTree/PageTreeDragDrop
|
||||
*
|
||||
* Provides drag&drop related functionality for the SVG page tree
|
||||
*/
|
||||
define([
|
||||
'jquery',
|
||||
'd3',
|
||||
'TYPO3/CMS/Backend/Modal',
|
||||
'TYPO3/CMS/Backend/Severity',
|
||||
'TYPO3/CMS/Core/SecurityUtility'
|
||||
], function($, d3, Modal, Severity, SecurityUtility) {
|
||||
'use strict';
|
||||
|
||||
var securityUtility = new SecurityUtility();
|
||||
|
||||
/**
|
||||
* Creates a new drag instance and initializes the clickDistance setting to
|
||||
* prevent clicks from beeing wrongly detected as drag attempts.
|
||||
*/
|
||||
var createD3 = function() {
|
||||
return d3.drag()
|
||||
.clickDistance(5);
|
||||
};
|
||||
|
||||
/**
|
||||
* PageTreeDragDrop class
|
||||
*
|
||||
* @constructor
|
||||
* @exports TYPO3/CMS/Backend/PageTree/PageTreeDragDrop
|
||||
*/
|
||||
var PageTreeDragDrop;
|
||||
PageTreeDragDrop = {
|
||||
|
||||
/**
|
||||
* SVG <g> container for deleting drop zone
|
||||
*
|
||||
* @type {Selection}
|
||||
*/
|
||||
dropZoneDelete: null,
|
||||
|
||||
init: function(svgTree) {
|
||||
this.tree = svgTree;
|
||||
},
|
||||
|
||||
/**
|
||||
* Drag and drop for nodes
|
||||
*
|
||||
* Returns initialized d3.drag() function
|
||||
*/
|
||||
drag: function() {
|
||||
var self = {};
|
||||
var _this = this;
|
||||
var tree = _this.tree;
|
||||
|
||||
/**
|
||||
* Returns deleting drop zone open 'transform' attribute value
|
||||
*
|
||||
* @param node
|
||||
* @returns {string}
|
||||
*/
|
||||
self.getDropZoneOpenTransform = function(node) {
|
||||
var svgWidth = parseFloat(tree.svg.style('width')) || 300;
|
||||
|
||||
return 'translate(' + (svgWidth - 58 - node.x) + ', -10)';
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns deleting drop zone close 'transform' attribute value
|
||||
*
|
||||
* @param node
|
||||
* @returns {string}
|
||||
*/
|
||||
self.getDropZoneCloseTransform = function(node) {
|
||||
var svgWidth = parseFloat(tree.svg.style('width')) || 300;
|
||||
|
||||
return 'translate(' + (svgWidth - node.x) + ', -10)';
|
||||
};
|
||||
|
||||
self.dragStart = function(node) {
|
||||
if (tree.settings.isDragAnDrop !== true || node.depth === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.isDragging = false;
|
||||
|
||||
_this.dropZoneDelete = null;
|
||||
|
||||
if (node.allowDelete
|
||||
&& ((!tree.settings.allowRecursiveDelete && !node.hasChildren) || tree.settings.allowRecursiveDelete)
|
||||
) {
|
||||
_this.dropZoneDelete = tree.nodesContainer
|
||||
.select('.node[data-state-id="' + node.stateIdentifier + '"]')
|
||||
.append('g')
|
||||
.attr('class', 'nodes-drop-zone')
|
||||
.attr('height', tree.settings.nodeHeight);
|
||||
|
||||
tree.nodeIsOverDelete = false;
|
||||
|
||||
_this.dropZoneDelete.append('rect')
|
||||
.attr('height', tree.settings.nodeHeight)
|
||||
.attr('width', '50px')
|
||||
.attr('x', 0)
|
||||
.attr('y', 0)
|
||||
.on('mouseover', function() {
|
||||
tree.nodeIsOverDelete = true;
|
||||
})
|
||||
.on('mouseout', function() {
|
||||
tree.nodeIsOverDelete = false;
|
||||
});
|
||||
|
||||
_this.dropZoneDelete.append('text')
|
||||
.text(TYPO3.lang.deleteItem)
|
||||
.attr('dx', 5)
|
||||
.attr('dy', 15);
|
||||
|
||||
_this.dropZoneDelete
|
||||
.attr('data-open', 'false')
|
||||
.attr('transform', self.getDropZoneCloseTransform(node));
|
||||
}
|
||||
|
||||
$.extend(self, _this.setDragStart());
|
||||
};
|
||||
|
||||
self.dragDragged = function(node) {
|
||||
if (_this.isDragNodeDistanceMore(self, 10)) {
|
||||
self.startDrag = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tree.settings.isDragAnDrop !== true || node.depth === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.isDragging = true;
|
||||
tree.settings.nodeDrag = node;
|
||||
|
||||
var $svg = $(this).closest('svg');
|
||||
var $nodesBg = $svg.find('.nodes-bg');
|
||||
var $nodesWrap = $svg.find('.nodes-wrapper');
|
||||
var $nodeBg = $nodesBg.find('.node-bg[data-state-id=' + node.stateIdentifier + ']');
|
||||
var $nodeDd = $svg.siblings('.node-dd');
|
||||
|
||||
if ($nodeBg.length && (!node.isDragged)) {
|
||||
tree.settings.dragging = true;
|
||||
node.isDragged = true;
|
||||
|
||||
$svg.after(_this.template(tree.getIconId(node), node.name));
|
||||
$nodeBg.addClass('node-bg--dragging');
|
||||
|
||||
$svg
|
||||
.find('.nodes-wrapper')
|
||||
.addClass('nodes-wrapper--dragging');
|
||||
}
|
||||
|
||||
var left = 18;
|
||||
var top = 15;
|
||||
|
||||
if (d3.event.sourceEvent && d3.event.sourceEvent.pageX) {
|
||||
left += d3.event.sourceEvent.pageX;
|
||||
}
|
||||
|
||||
if (d3.event.sourceEvent && d3.event.sourceEvent.pageY) {
|
||||
top += d3.event.sourceEvent.pageY;
|
||||
}
|
||||
|
||||
$(document).find('.node-dd').css({
|
||||
left: left,
|
||||
top: top,
|
||||
display: 'block'
|
||||
});
|
||||
|
||||
tree.settings.nodeDragPosition = false;
|
||||
|
||||
_this.openNodeTimeout();
|
||||
|
||||
if (node.isOver
|
||||
|| (tree.settings.nodeOver.node && tree.settings.nodeOver.node.parentsStateIdentifier.indexOf(node.stateIdentifier) !== -1)
|
||||
|| !tree.isOverSvg) {
|
||||
|
||||
_this.addNodeDdClass({$nodeDd: $nodeDd, $nodesWrap: $nodesWrap, className: 'nodrop'});
|
||||
|
||||
if (!tree.isOverSvg) {
|
||||
_this.tree.nodesBgContainer
|
||||
.selectAll('.node-bg__border')
|
||||
.style('display', 'none');
|
||||
}
|
||||
|
||||
if (_this.dropZoneDelete && _this.dropZoneDelete.attr('data-open') !== 'true' && tree.isOverSvg) {
|
||||
_this.dropZoneDelete
|
||||
.transition(300)
|
||||
.attr('transform', self.getDropZoneOpenTransform(node))
|
||||
.attr('data-open', 'true');
|
||||
}
|
||||
} else if (!tree.settings.nodeOver.node) {
|
||||
_this.addNodeDdClass({$nodeDd: $nodeDd, $nodesWrap: $nodesWrap, className: 'nodrop'});
|
||||
_this.tree.nodesBgContainer
|
||||
.selectAll('.node-bg__border')
|
||||
.style('display', 'none');
|
||||
} else {
|
||||
if (_this.dropZoneDelete && _this.dropZoneDelete.attr('data-open') !== 'false') {
|
||||
_this.dropZoneDelete
|
||||
.transition(300)
|
||||
.attr('transform', self.getDropZoneCloseTransform(node))
|
||||
.attr('data-open', 'false');
|
||||
}
|
||||
|
||||
_this.changeNodeClasses();
|
||||
}
|
||||
};
|
||||
|
||||
self.dragEnd = function(node) {
|
||||
_this.setDragEnd();
|
||||
|
||||
if (_this.dropZoneDelete) {
|
||||
_this.dropZoneDelete
|
||||
.transition(300)
|
||||
.attr('transform', self.getDropZoneCloseTransform(node))
|
||||
.remove();
|
||||
_this.dropZoneDelete = null;
|
||||
}
|
||||
|
||||
if (!self.startDrag || tree.settings.isDragAnDrop !== true || node.depth === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $svg = $(this).closest('svg');
|
||||
var $nodesBg = $svg.find('.nodes-bg');
|
||||
var droppedNode = tree.settings.nodeOver.node;
|
||||
|
||||
node.isDragged = false;
|
||||
|
||||
_this.addNodeDdClass({
|
||||
$nodesWrap: $svg.find('.nodes-wrapper'),
|
||||
className: '',
|
||||
rmClass: 'dragging',
|
||||
setCanNodeDrag: false
|
||||
});
|
||||
|
||||
$nodesBg
|
||||
.find('.node-bg.node-bg--dragging')
|
||||
.removeClass('node-bg--dragging');
|
||||
|
||||
$svg
|
||||
.siblings('.node-dd')
|
||||
.remove();
|
||||
|
||||
tree
|
||||
.nodesBgContainer
|
||||
.selectAll('.node-bg__border')
|
||||
.style('display', 'none');
|
||||
|
||||
if (
|
||||
!(node.isOver
|
||||
|| (tree.settings.nodeOver.node && tree.settings.nodeOver.node.parentsStateIdentifier.indexOf(node.stateIdentifier) !== -1)
|
||||
|| !tree.settings.canNodeDrag
|
||||
|| !tree.isOverSvg
|
||||
)
|
||||
) {
|
||||
var options = _this.changeNodePosition({droppedNode: droppedNode});
|
||||
var modalText = options.position === 'in' ? TYPO3.lang['mess.move_into'] : TYPO3.lang['mess.move_after'];
|
||||
modalText = modalText.replace('%s', options.node.name).replace('%s', options.target.name);
|
||||
|
||||
Modal.confirm(
|
||||
TYPO3.lang.move_page,
|
||||
modalText,
|
||||
Severity.warning, [
|
||||
{
|
||||
text: $(this).data('button-close-text') || TYPO3.lang['labels.cancel'] || 'Cancel',
|
||||
active: true,
|
||||
btnClass: 'btn-default',
|
||||
name: 'cancel'
|
||||
},
|
||||
{
|
||||
text: $(this).data('button-ok-text') || TYPO3.lang['cm.copy'] || 'Copy',
|
||||
btnClass: 'btn-warning',
|
||||
name: 'copy'
|
||||
},
|
||||
{
|
||||
text: $(this).data('button-ok-text') || TYPO3.lang['labels.move'] || 'Move',
|
||||
btnClass: 'btn-warning',
|
||||
name: 'move'
|
||||
}
|
||||
])
|
||||
.on('button.clicked', function(e) {
|
||||
if (e.target.name === 'move') {
|
||||
options.command = 'move';
|
||||
tree.sendChangeCommand(options);
|
||||
} else if (e.target.name === 'copy') {
|
||||
options.command = 'copy';
|
||||
tree.sendChangeCommand(options);
|
||||
}
|
||||
|
||||
Modal.dismiss();
|
||||
});
|
||||
} else if (tree.nodeIsOverDelete) {
|
||||
var options = _this.changeNodePosition({droppedNode: droppedNode, command: 'delete'});
|
||||
if (tree.settings.displayDeleteConfirmation) {
|
||||
var $modal = Modal.confirm(
|
||||
TYPO3.lang.deleteItem,
|
||||
TYPO3.lang['mess.delete'].replace('%s', options.node.name),
|
||||
Severity.warning, [
|
||||
{
|
||||
text: $(this).data('button-close-text') || TYPO3.lang['labels.cancel'] || 'Cancel',
|
||||
active: true,
|
||||
btnClass: 'btn-default',
|
||||
name: 'cancel'
|
||||
},
|
||||
{
|
||||
text: $(this).data('button-ok-text') || TYPO3.lang['cm.delete'] || 'Delete',
|
||||
btnClass: 'btn-warning',
|
||||
name: 'delete'
|
||||
}
|
||||
]);
|
||||
|
||||
$modal.on('button.clicked', function(e) {
|
||||
if (e.target.name === 'delete') {
|
||||
|
||||
tree.sendChangeCommand(options);
|
||||
}
|
||||
|
||||
Modal.dismiss();
|
||||
});
|
||||
} else {
|
||||
tree.sendChangeCommand(options);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return createD3()
|
||||
.on('start', self.dragStart)
|
||||
.on('drag', self.dragDragged)
|
||||
.on('end', self.dragEnd);
|
||||
},
|
||||
|
||||
/**
|
||||
* Open node with children while holding the node/element over this node for one second
|
||||
*/
|
||||
openNodeTimeout: function() {
|
||||
var _this = this;
|
||||
|
||||
if (!_this.timeout) {
|
||||
_this.timeout = {}
|
||||
}
|
||||
|
||||
if (_this.tree.settings.nodeOver.node.hasChildren && !_this.tree.settings.nodeOver.node.expanded) {
|
||||
if (_this.timeout.node != _this.tree.settings.nodeOver.node) {
|
||||
_this.timeout.node = _this.tree.settings.nodeOver;
|
||||
clearTimeout(_this.timeout.time);
|
||||
_this.timeout.time = setTimeout(function() {
|
||||
if (_this.tree.settings.nodeOver.node) {
|
||||
_this.tree.showChildren(_this.tree.settings.nodeOver.node);
|
||||
_this.tree.prepareDataForVisibleNodes();
|
||||
_this.tree.update();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
clearTimeout(_this.timeout.time);
|
||||
}
|
||||
},
|
||||
|
||||
changeNodeClasses: function() {
|
||||
var elementNodeBg = this.tree.svg.select('.node-over');
|
||||
var $svg = $(this.tree.svg.node());
|
||||
var $nodesWrap = $svg.find('.nodes-wrapper');
|
||||
var $nodeDd = $svg.siblings('.node-dd');
|
||||
var nodeBgBorder = this.tree.nodesBgContainer.selectAll('.node-bg__border');
|
||||
|
||||
if (elementNodeBg.size() && this.tree.isOverSvg) {
|
||||
// line between nodes
|
||||
if (nodeBgBorder.empty()) {
|
||||
nodeBgBorder = this.tree.nodesBgContainer
|
||||
.append('rect')
|
||||
.attr('class', 'node-bg__border')
|
||||
.attr('height', '1px')
|
||||
.attr('width', '100%');
|
||||
}
|
||||
|
||||
var coordinates = d3.mouse(elementNodeBg.node());
|
||||
var y = coordinates[1];
|
||||
|
||||
if (y < 3) {
|
||||
nodeBgBorder
|
||||
.attr('transform', 'translate(-8, ' + (this.tree.settings.nodeOver.node.y - 10) + ')')
|
||||
.style('display', 'block');
|
||||
|
||||
if (this.tree.settings.nodeOver.node.depth === 0) {
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'nodrop'
|
||||
});
|
||||
} else if (this.tree.settings.nodeOver.node.firstChild) {
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'ok-above'
|
||||
});
|
||||
} else {
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'ok-between'
|
||||
});
|
||||
}
|
||||
|
||||
this.tree.settings.nodeDragPosition = 'before';
|
||||
} else if (y > 17) {
|
||||
nodeBgBorder
|
||||
.style('display', 'none');
|
||||
|
||||
if (this.tree.settings.nodeOver.node.expanded && this.tree.settings.nodeOver.node.hasChildren) {
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'ok-append'
|
||||
});
|
||||
this.tree.settings.nodeDragPosition = 'in';
|
||||
} else {
|
||||
nodeBgBorder
|
||||
.attr('transform', 'translate(-8, ' + (this.tree.settings.nodeOver.node.y + 10) + ')')
|
||||
.style('display', 'block');
|
||||
|
||||
if (this.tree.settings.nodeOver.node.lastChild) {
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'ok-below'
|
||||
});
|
||||
|
||||
} else {
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'ok-between'
|
||||
});
|
||||
}
|
||||
|
||||
this.tree.settings.nodeDragPosition = 'after';
|
||||
}
|
||||
} else {
|
||||
nodeBgBorder
|
||||
.style('display', 'none');
|
||||
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'ok-append'
|
||||
});
|
||||
this.tree.settings.nodeDragPosition = 'in';
|
||||
}
|
||||
} else {
|
||||
this.tree.nodesBgContainer
|
||||
.selectAll('.node-bg__border')
|
||||
.style('display', 'none');
|
||||
|
||||
this.addNodeDdClass({
|
||||
$nodeDd: $nodeDd,
|
||||
$nodesWrap: $nodesWrap,
|
||||
className: 'nodrop'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
addNodeDdClass: function(options) {
|
||||
var clearClass = ' #prefix#--nodrop #prefix#--ok-append #prefix#--ok-below #prefix#--ok-between #prefix#--ok-above';
|
||||
var rmClass = '';
|
||||
var addClass = '';
|
||||
|
||||
if (options.$nodeDd) {
|
||||
rmClass = (options.rmClass ? ' node-dd--' + options.rmClass : '');
|
||||
addClass = (options.className ? 'node-dd--' + options.className : '');
|
||||
|
||||
options.$nodeDd
|
||||
.removeClass(clearClass.replace(new RegExp('#prefix#', 'g'), 'node-dd') + rmClass)
|
||||
.addClass(addClass);
|
||||
}
|
||||
|
||||
if (options.$nodesWrap) {
|
||||
rmClass = (options.rmClass ? ' nodes-wrapper--' + options.rmClass : '');
|
||||
addClass = (options.className ? 'nodes-wrapper--' + options.className : '');
|
||||
|
||||
options.$nodesWrap
|
||||
.removeClass(clearClass.replace(new RegExp('#prefix#', 'g'), 'nodes-wrapper') + rmClass)
|
||||
.addClass(addClass);
|
||||
}
|
||||
|
||||
if ((typeof options.setCanNodeDrag === 'undefined') || options.setCanNodeDrag) {
|
||||
this.tree.settings.canNodeDrag = !(options.className === 'nodrop');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if node is dragged at least @distance
|
||||
*
|
||||
* @param {Object} data
|
||||
* @param {Integer} distance
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isDragNodeDistanceMore: function(data, distance) {
|
||||
return (data.startDrag ||
|
||||
(((data.startPageX - distance) > d3.event.sourceEvent.pageX) ||
|
||||
((data.startPageX + distance) < d3.event.sourceEvent.pageX) ||
|
||||
((data.startPageY - distance) > d3.event.sourceEvent.pageY) ||
|
||||
((data.startPageY + distance) < d3.event.sourceEvent.pageY)));
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the same parameters on start for method drag() and dragToolbar()
|
||||
*
|
||||
* @returns {{startPageX, startPageY, startDrag: boolean}}
|
||||
*/
|
||||
setDragStart: function() {
|
||||
$('body iframe').css({'pointer-events': 'none'});
|
||||
|
||||
return {
|
||||
startPageX: d3.event.sourceEvent.pageX,
|
||||
startPageY: d3.event.sourceEvent.pageY,
|
||||
startDrag: false
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the same parameters on end for method drag() and dragToolbar()
|
||||
*/
|
||||
setDragEnd: function() {
|
||||
$('body iframe').css({'pointer-events': ''});
|
||||
},
|
||||
|
||||
/**
|
||||
* Drag and drop for toolbar new elements
|
||||
*
|
||||
* Returns method from d3js
|
||||
*/
|
||||
dragToolbar: function() {
|
||||
var self = {};
|
||||
var _this = this;
|
||||
var tree = _this.tree;
|
||||
|
||||
self.dragStart = function() {
|
||||
self.id = $(this).data('node-type');
|
||||
self.name = $(this).attr('title');
|
||||
self.tooltip = $(this).attr('tooltip');
|
||||
self.icon = $(this).data('tree-icon');
|
||||
self.isDragged = false;
|
||||
$.extend(self, _this.setDragStart());
|
||||
};
|
||||
|
||||
self.dragDragged = function() {
|
||||
if (_this.isDragNodeDistanceMore(self, 10)) {
|
||||
self.startDrag = true;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
var $svg = $(_this.tree.svg.node());
|
||||
|
||||
if (self.isDragged === false) {
|
||||
_this.tree.settings.dragging = true;
|
||||
self.isDragged = true;
|
||||
|
||||
$svg.after(_this.template('#icon-' + self.icon, self.name));
|
||||
|
||||
$svg
|
||||
.find('.nodes-wrapper')
|
||||
.addClass('nodes-wrapper--dragging');
|
||||
}
|
||||
|
||||
var left = 18;
|
||||
var top = 15;
|
||||
|
||||
if (d3.event.sourceEvent && d3.event.sourceEvent.pageX) {
|
||||
left += d3.event.sourceEvent.pageX;
|
||||
}
|
||||
|
||||
if (d3.event.sourceEvent && d3.event.sourceEvent.pageY) {
|
||||
top += d3.event.sourceEvent.pageY;
|
||||
}
|
||||
|
||||
_this.openNodeTimeout();
|
||||
|
||||
$(document).find('.node-dd').css({
|
||||
left: left,
|
||||
top: top,
|
||||
display: 'block'
|
||||
});
|
||||
|
||||
_this.changeNodeClasses();
|
||||
};
|
||||
|
||||
self.dragEnd = function() {
|
||||
_this.setDragEnd();
|
||||
|
||||
if (!self.startDrag) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $svg = $(_this.tree.svg.node());
|
||||
var $nodesBg = $svg.find('.nodes-bg');
|
||||
|
||||
$svg
|
||||
.siblings('.node-dd')
|
||||
.remove();
|
||||
$svg
|
||||
.find('.nodes-wrapper')
|
||||
.removeClass('nodes-wrapper--dragging');
|
||||
|
||||
self.isDragged = false;
|
||||
_this.tree.settings.dragging = false;
|
||||
|
||||
_this.addNodeDdClass({
|
||||
$nodesWrap: $svg.find('.nodes-wrapper'),
|
||||
className: '',
|
||||
rmClass: 'dragging',
|
||||
setCanNodeDrag: false
|
||||
});
|
||||
|
||||
$nodesBg
|
||||
.find('.node-bg.node-bg--dragging')
|
||||
.removeClass('node-bg--dragging');
|
||||
|
||||
$svg
|
||||
.siblings('.node-dd')
|
||||
.remove();
|
||||
|
||||
_this
|
||||
.tree
|
||||
.nodesBgContainer
|
||||
.selectAll('.node-bg__border')
|
||||
.style('display', 'none');
|
||||
|
||||
if (_this.tree.settings.isDragAnDrop !== true || !_this.tree.settings.nodeOver.node || !_this.tree.isOverSvg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_this.tree.settings.canNodeDrag) {
|
||||
var data = {
|
||||
type: self.id,
|
||||
name: self.name,
|
||||
tooltip: self.tooltip,
|
||||
icon: self.icon,
|
||||
position: _this.tree.settings.nodeDragPosition,
|
||||
command: 'new',
|
||||
target: _this.tree.settings.nodeOver.node
|
||||
};
|
||||
|
||||
_this.addNewNode(data);
|
||||
}
|
||||
};
|
||||
|
||||
return createD3()
|
||||
.on('start', self.dragStart)
|
||||
.on('drag', self.dragDragged)
|
||||
.on('end', self.dragEnd);
|
||||
},
|
||||
|
||||
changeNodePosition: function(options) {
|
||||
var _this = this;
|
||||
var tree = _this.tree;
|
||||
var nodes = tree.nodes;
|
||||
var uid = tree.settings.nodeDrag.identifier;
|
||||
var index = nodes.indexOf(options.droppedNode);
|
||||
var position = tree.settings.nodeDragPosition;
|
||||
var target = tree.settings.nodeDrag;
|
||||
|
||||
if (options.droppedNode) {
|
||||
target = options.droppedNode;
|
||||
}
|
||||
|
||||
if ((uid === target.identifier) && options.command !== 'delete') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (position === 'before') {
|
||||
var positionAndTarget = this.setNodePositionAndTarget(index);
|
||||
position = positionAndTarget[0];
|
||||
target = positionAndTarget[1];
|
||||
}
|
||||
|
||||
var data = {
|
||||
node: tree.settings.nodeDrag,
|
||||
uid: uid, // dragged node id
|
||||
target: target, // hovered node
|
||||
position: position, // before, in, after
|
||||
command: options.command // element is copied or moved
|
||||
};
|
||||
|
||||
$.extend(data, options);
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns Array of position and target node
|
||||
*
|
||||
* @param {Integer} index of node which is over mouse
|
||||
* @returns {Array} [position, target]
|
||||
*/
|
||||
setNodePositionAndTarget: function(index) {
|
||||
var nodes = this.tree.nodes;
|
||||
var nodeOver = nodes[index];
|
||||
var nodeOverDepth = nodeOver.depth;
|
||||
if (index > 0) {
|
||||
index--;
|
||||
}
|
||||
var nodeBefore = nodes[index];
|
||||
var nodeBeforeDepth = nodeBefore.depth;
|
||||
var target = this.tree.nodes[index];
|
||||
|
||||
if (nodeBeforeDepth === nodeOverDepth) {
|
||||
return ['after', target];
|
||||
} else if (nodeBeforeDepth < nodeOverDepth) {
|
||||
return ['in', target];
|
||||
} else {
|
||||
for (var i = index; i >= 0; i--) {
|
||||
if (nodes[i].depth === nodeOverDepth) {
|
||||
return ['after', this.tree.nodes[i]];
|
||||
} else if (nodes[i].depth < nodeOverDepth) {
|
||||
return ['in', nodes[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add new node
|
||||
*
|
||||
* @type {Object} options
|
||||
*/
|
||||
addNewNode: function(options) {
|
||||
var _this = this;
|
||||
var target = options.target;
|
||||
var index = _this.tree.nodes.indexOf(target);
|
||||
var newNode = {};
|
||||
var removeNode = function(newNode) {
|
||||
var index = _this.tree.nodes.indexOf(newNode);
|
||||
|
||||
// if newNode is only one child
|
||||
if (_this.tree.nodes[index - 1].depth != newNode.depth
|
||||
&& (!_this.tree.nodes[index + 1] || _this.tree.nodes[index + 1].depth != newNode.depth)) {
|
||||
_this.tree.nodes[index - 1].hasChildren = false;
|
||||
}
|
||||
|
||||
_this.tree.nodes.splice(index, 1);
|
||||
_this.tree.setParametersNode();
|
||||
_this.tree.prepareDataForVisibleNodes();
|
||||
_this.tree.update();
|
||||
_this.tree.removeEditedText();
|
||||
};
|
||||
|
||||
newNode.command = 'new';
|
||||
newNode.type = options.type;
|
||||
newNode.identifier = -1;
|
||||
newNode.target = target;
|
||||
newNode.parents = target.parents;
|
||||
newNode.parentsStateIdentifier = target.parentsStateIdentifier;
|
||||
newNode.depth = target.depth;
|
||||
newNode.position = options.position;
|
||||
newNode.name = (typeof options.title !== 'undefined') ? options.title : TYPO3.lang['tree.defaultPageTitle'];
|
||||
newNode.y = newNode.y || newNode.target.y;
|
||||
newNode.x = newNode.x || newNode.target.x;
|
||||
|
||||
if (options.position === 'in') {
|
||||
newNode.depth++;
|
||||
newNode.parents.unshift(index);
|
||||
newNode.parentsStateIdentifier.unshift(_this.tree.nodes[index].stateIdentifier);
|
||||
_this.tree.nodes[index].hasChildren = true;
|
||||
_this.tree.showChildren(_this.tree.nodes[index]);
|
||||
}
|
||||
|
||||
if (options.position === 'in' || options.position === 'after') {
|
||||
index++;
|
||||
}
|
||||
|
||||
if (options.icon) {
|
||||
newNode.icon = options.icon;
|
||||
}
|
||||
|
||||
if (newNode.position === 'before') {
|
||||
var positionAndTarget = this.setNodePositionAndTarget(index);
|
||||
newNode.position = positionAndTarget[0];
|
||||
newNode.target = positionAndTarget[1];
|
||||
}
|
||||
|
||||
_this.tree.nodes.splice(index, 0, newNode);
|
||||
_this.tree.setParametersNode();
|
||||
_this.tree.prepareDataForVisibleNodes();
|
||||
_this.tree.update();
|
||||
_this.tree.removeEditedText();
|
||||
_this.tree.nodeIsEdit = true;
|
||||
|
||||
d3.select(_this.tree.svg.node().parentNode)
|
||||
.append('input')
|
||||
.attr('class', 'node-edit')
|
||||
.style('top', newNode.y + _this.tree.settings.marginTop + 'px')
|
||||
.style('left', newNode.x + _this.tree.textPosition + 5 + 'px')
|
||||
.style('width', _this.tree.settings.width - (newNode.x + _this.tree.textPosition + 20) + 'px')
|
||||
.style('height', _this.tree.settings.nodeHeight + 'px')
|
||||
.attr('text', 'text')
|
||||
.attr('value', newNode.name)
|
||||
.on('keydown', function() {
|
||||
var code = d3.event.keyCode;
|
||||
|
||||
if (code === 13 || code === 9) { // enter || tab
|
||||
_this.tree.nodeIsEdit = false;
|
||||
var newName = this.value.trim();
|
||||
|
||||
if (newName.length) {
|
||||
newNode.name = newName;
|
||||
_this.tree.removeEditedText();
|
||||
_this.tree.sendChangeCommand(newNode);
|
||||
} else {
|
||||
removeNode(newNode);
|
||||
}
|
||||
} else if (code === 27) { // esc
|
||||
_this.tree.nodeIsEdit = false;
|
||||
removeNode(newNode);
|
||||
}
|
||||
})
|
||||
.on('blur', function() {
|
||||
if (_this.tree.nodeIsEdit && (_this.tree.nodes.indexOf(newNode) > -1)) {
|
||||
var newName = this.value.trim();
|
||||
|
||||
if (newName.length) {
|
||||
newNode.name = newName;
|
||||
_this.tree.removeEditedText();
|
||||
_this.tree.sendChangeCommand(newNode);
|
||||
} else {
|
||||
removeNode(newNode);
|
||||
}
|
||||
}
|
||||
})
|
||||
.node()
|
||||
.select();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns template for dragged node
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
template: function(icon, name) {
|
||||
return $('<div>').append(
|
||||
$('<div>', {'class': 'node-dd node-dd--nodrop'}).append(
|
||||
$('<div>', {'class': 'node-dd__ctrl-icon'}),
|
||||
$('<div>', {'class': 'node-dd__text'}).append(
|
||||
$('<span>', {'class': 'node-dd__icon'}).append(
|
||||
$('<svg>', {
|
||||
'aria-hidden': 'true',
|
||||
'width': '16px',
|
||||
'height': '16px'
|
||||
}).append(
|
||||
$('<use>', {
|
||||
'xlink:href': icon
|
||||
})
|
||||
)
|
||||
),
|
||||
$('<span>', {'class': 'node-dd__name'}).html(
|
||||
securityUtility.encodeHtml(name)
|
||||
)
|
||||
)
|
||||
)
|
||||
).html();
|
||||
}
|
||||
};
|
||||
|
||||
return PageTreeDragDrop;
|
||||
});
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/PageTree/PageTreeElement
|
||||
*
|
||||
* Main entry point of the page tree.
|
||||
*/
|
||||
define(['jquery',
|
||||
'TYPO3/CMS/Backend/PageTree/PageTree',
|
||||
'TYPO3/CMS/Backend/PageTree/PageTreeToolbar',
|
||||
'TYPO3/CMS/Backend/Viewport',
|
||||
'TYPO3/CMS/Backend/Icons'
|
||||
],
|
||||
function($, PageTree, PageTreeToolbar, Viewport, Icons) {
|
||||
'use strict';
|
||||
|
||||
var PageTreeElement = {
|
||||
template:
|
||||
'<div id="typo3-pagetree" class="svg-tree">' +
|
||||
'<div>' +
|
||||
'<div id="svg-toolbar" class="svg-toolbar"></div>' +
|
||||
'<div id="typo3-pagetree-treeContainer">' +
|
||||
'<div id="typo3-pagetree-tree" class="svg-tree-wrapper" style="height:1000px;">' +
|
||||
'<div class="node-loader"></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="svg-tree-loader"></div>' +
|
||||
'</div>'
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches tree configuration and data via ajax and renders the tree with a toolbar.
|
||||
*
|
||||
* @param {String} selector
|
||||
*/
|
||||
PageTreeElement.initialize = function(selector) {
|
||||
$(function() {
|
||||
var $element = $(selector);
|
||||
|
||||
if ($element.html().trim().length !== 0) {
|
||||
$('#typo3-pagetree').trigger('isVisible');
|
||||
return;
|
||||
}
|
||||
|
||||
var tree = new PageTree();
|
||||
$element.append(PageTreeElement.template);
|
||||
|
||||
Icons.getIcon('spinner-circle-light', Icons.sizes.small).done(function(spinner) {
|
||||
$('.node-loader').append(spinner);
|
||||
});
|
||||
|
||||
Icons.getIcon('spinner-circle-light', Icons.sizes.large).done(function(spinner) {
|
||||
$('.svg-tree-loader').append(spinner);
|
||||
});
|
||||
|
||||
// Ensure tooltips don't stay when scrolling the pagetree
|
||||
$('#typo3-pagetree-tree').on('scroll', function () {
|
||||
$(this).find('[data-toggle=tooltip]').tooltip('hide');
|
||||
});
|
||||
|
||||
var dataUrl = top.TYPO3.settings.ajaxUrls.page_tree_data;
|
||||
var filterUrl = top.TYPO3.settings.ajaxUrls.page_tree_filter;
|
||||
|
||||
var configurationUrl = top.TYPO3.settings.ajaxUrls.page_tree_configuration;
|
||||
|
||||
$.ajax({url: configurationUrl}).done(function(configuration) {
|
||||
tree.initialize($element.find('#typo3-pagetree-tree'), $.extend(configuration, {
|
||||
dataUrl: dataUrl,
|
||||
filterUrl: filterUrl,
|
||||
showIcons: true
|
||||
}));
|
||||
|
||||
Viewport.NavigationContainer.setComponentInstance(tree);
|
||||
});
|
||||
|
||||
if (!$('#svg-toolbar').data('tree-show-toolbar')) {
|
||||
var pageTreeToolbar = new PageTreeToolbar();
|
||||
pageTreeToolbar.initialize('#typo3-pagetree-tree');
|
||||
$('#svg-toolbar').data('tree-show-toolbar', true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return PageTreeElement;
|
||||
});
|
||||
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/FormEngine/Element/TreeToolbar
|
||||
*/
|
||||
define(['jquery',
|
||||
'TYPO3/CMS/Backend/Icons',
|
||||
'd3',
|
||||
'TYPO3/CMS/Backend/PageTree/PageTreeDragDrop',
|
||||
'TYPO3/CMS/Backend/Tooltip',
|
||||
'TYPO3/CMS/Backend/SvgTree',
|
||||
'TYPO3/CMS/Backend/jquery.clearable'
|
||||
],
|
||||
function($, Icons, d3, PageTreeDragDrop) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* TreeToolbar class
|
||||
*
|
||||
* @constructor
|
||||
* @exports TYPO3/CMS/Backend/FormEngine/Element/TreeToolbar
|
||||
*/
|
||||
var TreeToolbar = function() {
|
||||
this.settings = {
|
||||
toolbarSelector: 'tree-toolbar',
|
||||
searchInput: '.search-input',
|
||||
target: '.svg-toolbar',
|
||||
filterTimeout: 450
|
||||
};
|
||||
|
||||
/**
|
||||
* jQuery object wrapping the SvgTree
|
||||
*
|
||||
* @type {jQuery}
|
||||
*/
|
||||
this.$treeWrapper = null;
|
||||
|
||||
/**
|
||||
* SvgTree instance
|
||||
*
|
||||
* @type {SvgTree}
|
||||
*/
|
||||
this.tree = null;
|
||||
|
||||
/**
|
||||
* State of the hide unchecked toggle button
|
||||
*
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this._hideUncheckedState = false;
|
||||
|
||||
/**
|
||||
* Toolbar template
|
||||
*
|
||||
* @type {jQuery}
|
||||
*/
|
||||
this.template = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Toolbar initialization
|
||||
*
|
||||
* @param {String} treeSelector
|
||||
* @param {Object} settings
|
||||
*/
|
||||
TreeToolbar.prototype.initialize = function(treeSelector, settings) {
|
||||
var _this = this;
|
||||
_this.$treeWrapper = $(treeSelector);
|
||||
|
||||
this.dragDrop = PageTreeDragDrop;
|
||||
this.dragDrop.init(this);
|
||||
if (!_this.$treeWrapper.data('svgtree-initialized') || typeof _this.$treeWrapper.data('svgtree') !== 'object') {
|
||||
//both toolbar and tree are loaded independently through require js,
|
||||
//so we don't know which is loaded first
|
||||
//in case of toolbar being loaded first, we wait for an event from svgTree
|
||||
_this.$treeWrapper.on('svgTree.initialized', _this.render.bind(_this));
|
||||
return;
|
||||
}
|
||||
|
||||
$.extend(this.settings, settings);
|
||||
this.render();
|
||||
};
|
||||
|
||||
/**
|
||||
* Create toolbar template
|
||||
*/
|
||||
TreeToolbar.prototype.createTemplate = function() {
|
||||
var _this = this;
|
||||
|
||||
var $template = $(
|
||||
'<div class="' + _this.settings.toolbarSelector + '">' +
|
||||
'<div class="svg-toolbar__menu">' +
|
||||
'<div class="x-btn btn btn-default btn-sm x-btn-noicon" data-tree-show-submenu="filter">' +
|
||||
'<button class="svg-toolbar__btn" data-tree-icon="actions-filter" title="' + TYPO3.lang['tree.buttonFilter'] + '"></button>' +
|
||||
'</div>' +
|
||||
'<div class="x-btn btn btn-default btn-sm x-btn-noicon js-svg-refresh">' +
|
||||
'<button class="svg-toolbar__btn" data-tree-icon="actions-refresh" title="' + TYPO3.lang['labels.refresh'] + '"></button>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="svg-toolbar__submenu">' +
|
||||
'<div class="svg-toolbar__submenu-item" data-tree-submenu="filter">' +
|
||||
'<input type="text" class="form-control search-input" placeholder="' + TYPO3.lang['tree.searchTermInfo'] + '">' +
|
||||
'</div>' +
|
||||
'<div class="svg-toolbar__submenu-item" data-tree-submenu="page-new">' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
);
|
||||
|
||||
if (this.tree.settings.doktypes && this.tree.settings.doktypes.length) {
|
||||
var $buttons = $template.find('[data-tree-submenu=page-new]');
|
||||
$template.find('.svg-toolbar__menu').prepend('<div class="x-btn btn btn-default btn-sm x-btn-noicon" data-tree-show-submenu="page-new">' +
|
||||
'<button class="svg-toolbar__btn" data-tree-icon="actions-page-new" title="' + TYPO3.lang['tree.buttonNewNode'] + '"></button>' +
|
||||
'</div>'
|
||||
);
|
||||
|
||||
$.each(this.tree.settings.doktypes, function(id, e) {
|
||||
_this.tree.fetchIcon(e.icon, false);
|
||||
$buttons.append('<div class="svg-toolbar__drag-node" data-tree-icon="' + e.icon + '" data-node-type="' + e.nodeType + '" title="' + e.title + '" tooltip="' + e.tooltip + '"></div>');
|
||||
});
|
||||
}
|
||||
|
||||
_this.template = $template;
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders toolbar
|
||||
*/
|
||||
TreeToolbar.prototype.render = function() {
|
||||
var _this = this;
|
||||
this.tree = this.$treeWrapper.data('svgtree');
|
||||
|
||||
$.extend(this.settings, this.tree.settings);
|
||||
this.createTemplate();
|
||||
|
||||
var $toolbar = $(this.settings.target).append(this.template);
|
||||
|
||||
//get icons
|
||||
$toolbar.find('[data-tree-icon]').each(function() {
|
||||
var $this = $(this);
|
||||
|
||||
Icons.getIcon($this.attr('data-tree-icon'), Icons.sizes.small).done(function(icon) {
|
||||
$this.append(icon);
|
||||
_this.tree.setWrapperHeight();
|
||||
});
|
||||
});
|
||||
|
||||
//toggle toolbar submenu
|
||||
$toolbar.find('[data-tree-show-submenu]').each(function() {
|
||||
$(this).click(function() {
|
||||
var $this = $(this);
|
||||
var name = $this.attr('data-tree-show-submenu');
|
||||
var $submenu = $toolbar.find('[data-tree-submenu=' + name + ']');
|
||||
|
||||
$toolbar.find('[data-tree-show-submenu]').not(this).removeClass('active');
|
||||
$this.addClass('active');
|
||||
|
||||
$toolbar.find('[data-tree-submenu]').not($submenu).removeClass('active');
|
||||
$submenu.addClass('active');
|
||||
$submenu.find('input').clearable({
|
||||
onClear: function(){
|
||||
_this.tree.resetFilter();
|
||||
_this.tree.prepareDataForVisibleNodes();
|
||||
_this.tree.update();
|
||||
}
|
||||
});
|
||||
$submenu.find('input').focus();
|
||||
});
|
||||
});
|
||||
|
||||
$toolbar.find('.js-svg-refresh').on('click', this.refreshTree.bind(this));
|
||||
|
||||
var d3Toolbar = d3.select('.svg-toolbar');
|
||||
|
||||
$.each(this.tree.settings.doktypes, function(id, e) {
|
||||
if (e.icon) {
|
||||
d3Toolbar
|
||||
.selectAll('[data-tree-icon=' + e.icon + ']')
|
||||
.call(_this.dragDrop.dragToolbar());
|
||||
} else {
|
||||
console.warn('Missing icon definition for doktype: ' + e.nodeType);
|
||||
}
|
||||
});
|
||||
|
||||
const debounced = _this.debounce(function(e) {
|
||||
_this.search(e.currentTarget);
|
||||
}, _this.settings.filterTimeout);
|
||||
$toolbar.find(this.settings.searchInput).on('input', debounced);
|
||||
|
||||
$toolbar.find('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
if ($('[data-tree-show-submenu="page-new"]').length) {
|
||||
$('[data-tree-show-submenu="page-new"]').trigger('click');
|
||||
} else {
|
||||
$('.svg-toolbar__menu :first-child:not(.js-svg-refresh)').trigger('click');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Refresh tree
|
||||
*/
|
||||
TreeToolbar.prototype.refreshTree = function() {
|
||||
const searchInput = document.querySelector(this.settings.target + ' ' + this.settings.searchInput);
|
||||
this.tree.refreshOrFilterTree();
|
||||
};
|
||||
|
||||
/**
|
||||
* Find node by name
|
||||
*
|
||||
* @param {HTMLElement} input
|
||||
*/
|
||||
TreeToolbar.prototype.search = function(input) {
|
||||
this.tree.searchQuery = $(input).val().trim();
|
||||
this.tree.refreshOrFilterTree();
|
||||
this.tree.prepareDataForVisibleNodes();
|
||||
this.tree.update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Show only checked items
|
||||
*
|
||||
* @param {HTMLElement} input
|
||||
*/
|
||||
TreeToolbar.prototype.toggleHideUnchecked = function(input) {
|
||||
var _this = this;
|
||||
|
||||
this._hideUncheckedState = !this._hideUncheckedState;
|
||||
|
||||
if (this._hideUncheckedState) {
|
||||
this.tree.nodes.forEach(function(node) {
|
||||
if (node.checked) {
|
||||
_this.showParents(node);
|
||||
node.expanded = true;
|
||||
node.hidden = false;
|
||||
} else {
|
||||
node.hidden = true;
|
||||
node.expanded = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.tree.nodes.forEach(function(node) {
|
||||
node.hidden = false;
|
||||
});
|
||||
}
|
||||
|
||||
this.tree.prepareDataForVisibleNodes();
|
||||
this.tree.update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds and show all parents of node
|
||||
*
|
||||
* @param {Node} node
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
TreeToolbar.prototype.showParents = function(node) {
|
||||
if (node.parents.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var parent = this.tree.nodes[node.parents[0]];
|
||||
parent.hidden = false;
|
||||
|
||||
//expand parent node
|
||||
parent.expanded = true;
|
||||
this.showParents(parent);
|
||||
};
|
||||
|
||||
TreeToolbar.prototype.debounce = function (callback, wait) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
clearTimeout(timeout);
|
||||
|
||||
timeout = setTimeout(function() {
|
||||
timeout = null;
|
||||
callback.apply(context, args);
|
||||
}, wait);
|
||||
};
|
||||
};
|
||||
|
||||
return TreeToolbar;
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","bootstrap"],(function(t,o,e){"use strict";var p=new(function(){function t(){this.DEFAULT_SELECTOR='[data-toggle="popover"]'}return t.prototype.initialize=function(t){t=t||this.DEFAULT_SELECTOR,e(t).popover()},t.prototype.popover=function(t){t.popover()},t.prototype.setOptions=function(t,o){var e=(o=o||{}).title||t.data("title")||"",p=o.content||t.data("content")||"";t.attr("data-original-title",e).attr("data-content",p).attr("data-placement","auto").popover(o)},t.prototype.setOption=function(t,o,e){t.data("bs.popover").options[o]=e},t.prototype.show=function(t){t.popover("show")},t.prototype.hide=function(t){t.popover("hide")},t.prototype.destroy=function(t){t.popover("destroy")},t.prototype.toggle=function(t){t.popover("toggle")},t}());return p.initialize(),TYPO3.Popover=p,p}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Severity","jquery","./Modal"],(function(e,t,a,n,i){"use strict";return new(function(){function e(){this.initialize()}return e.prototype.initialize=function(){n(".t3js-submit-file-rename").on("click",this.checkForDuplicate)},e.prototype.checkForDuplicate=function(e){e.preventDefault();var t=n("#"+n(e.currentTarget).attr("form")),r=t.find('input[name="data[rename][0][target]"]'),l=t.find('input[name="data[rename][0][conflictMode]"]'),c=TYPO3.settings.ajaxUrls.file_exists;n.ajax({cache:!1,data:{fileName:r.val(),fileTarget:t.find('input[name="data[rename][0][destination]"]').val()},success:function(e){var n=void 0!==e.uid,c=r.data("original"),s=r.val();if(n&&c!==s){var o=TYPO3.lang["file_rename.exists.description"].replace("{0}",c).replace("{1}",s);i.confirm(TYPO3.lang["file_rename.exists.title"],o,a.SeverityEnum.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:TYPO3.lang["file_rename.actions.cancel"]},{btnClass:"btn-primary",name:"rename",text:TYPO3.lang["file_rename.actions.rename"]},{btnClass:"btn-default",name:"replace",text:TYPO3.lang["file_rename.actions.override"]}]).on("button.clicked",(function(e){"cancel"!==e.target.name&&(l.val(e.target.name),t.submit()),i.dismiss()}))}else t.submit()},url:c})},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Enum/Severity"],(function(e,n,r){"use strict";var i,t=function(){function e(){}return e.getCssClass=function(e){var n;switch(e){case r.SeverityEnum.notice:n="notice";break;case r.SeverityEnum.ok:n="success";break;case r.SeverityEnum.warning:n="warning";break;case r.SeverityEnum.error:n="danger";break;case r.SeverityEnum.info:default:n="info"}return n},e.notice=r.SeverityEnum.notice,e.info=r.SeverityEnum.info,e.ok=r.SeverityEnum.ok,e.warning=r.SeverityEnum.warning,e.error=r.SeverityEnum.error,e}();try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Severity&&(i=window.opener.TYPO3.Severity),parent&&parent.window.TYPO3&&parent.window.TYPO3.Severity&&(i=parent.window.TYPO3.Severity),top&&top.TYPO3&&top.TYPO3.Severity&&(i=top.TYPO3.Severity)}catch(e){}return i||(i=t,"undefined"!=typeof TYPO3&&(TYPO3.Severity=i)),i}));
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
// Site configuration backend module FormEngine inline:
|
||||
// Override inline 'create' and 'details' route to point to SiteInlineAjaxController
|
||||
require(['jquery'], function($) {
|
||||
$(function() {
|
||||
TYPO3.inline.addMethod('create', 'site_configuration_inline_create');
|
||||
TYPO3.inline.addMethod('details', 'site_configuration_inline_details');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./Icons"],(function(t,a,e,n){"use strict";return new(function(){function t(){var t=this;this.preSubmitCallbacks=[],e((function(){t.initializeSaveHandling()}))}return t.prototype.addPreSubmitCallback=function(t){if("function"!=typeof t)throw"callback must be a function.";this.preSubmitCallbacks.push(t)},t.prototype.initializeSaveHandling=function(){var t=this,a=!1,r=["button[form]",'button[name^="_save"]','a[data-name^="_save"]','button[name="CMD"][value^="save"]','a[data-name="CMD"][data-value^="save"]','button[name^="_translation_save"]','a[data-name^="_translation_save"]','button[name="CMD"][value^="_translation_save"]','a[data-name="CMD"][data-value^="_translation_save"]'].join(",");e(".t3js-module-docheader").on("click",r,(function(r){if(!a){a=!0;for(var i=e(r.currentTarget),u=i.attr("form")||i.attr("data-form")||null,o=u?e("#"+u):i.closest("form"),l=i.data("name")||r.currentTarget.getAttribute("name"),s=i.data("value")||r.currentTarget.getAttribute("value"),c=e("<input />").attr("type","hidden").attr("name",l).attr("value",s),d=0;d<t.preSubmitCallbacks.length;++d)if(t.preSubmitCallbacks[d](r),r.isPropagationStopped())return a=!1,!1;o.append(c),o.on("submit",(function(){if(o.find(".has-error").length>0)return a=!1,!1;var t,e=i.closest(".t3js-splitbutton");return e.length>0?(e.find("button").prop("disabled",!0),t=e.children().first()):(i.prop("disabled",!0),t=i),n.getIcon("spinner-circle-dark",n.sizes.small).done((function(a){t.find(".t3js-icon").replaceWith(a)})),!0})),"A"!==r.currentTarget.tagName&&!i.attr("form")||r.isDefaultPrevented()||(o.submit(),r.preventDefault())}return!0}))},t}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","./Storage/Client","./Storage/Persistent"],(function(e,t,n,r){"use strict";var o,i=function(){var e=this;this.logDeprecated=function(e,t){console&&console.warn("top.TYPO3.Storage."+e+"."+t+"() is marked as deprecated since TYPO3 v9 and will be removed in TYPO3 v10.")},this.Client={clear:function(){e.logDeprecated("Client","clear"),n.clear()},get:function(t){return e.logDeprecated("Client","get"),n.get(t)},isset:function(t){return e.logDeprecated("Client","isset"),n.isset(t)},set:function(t,r){return e.logDeprecated("Client","set"),n.set(t,r)},unset:function(t){return e.logDeprecated("Client","unset"),n.unset(t)}},this.Persistent={addToList:function(t,n){return e.logDeprecated("Persistent","addToList"),r.addToList(t,n)},clear:function(){e.logDeprecated("Persistent","clear"),r.clear()},get:function(t){return e.logDeprecated("Persistent","get"),r.get(t)},isset:function(t){return e.logDeprecated("Persistent","isset"),r.isset(t)},load:function(t){return e.logDeprecated("Persistent","load"),r.load(t)},removeFromList:function(t,n){return e.logDeprecated("Persistent","removeFromList"),r.removeFromList(t,n)},set:function(t,n){return e.logDeprecated("Persistent","set"),r.set(t,n)},unset:function(t){return e.logDeprecated("Persistent","unset"),r.unset(t)}}};try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Storage&&(o=window.opener.TYPO3.Storage),parent&&parent.window.TYPO3&&parent.window.TYPO3.Storage&&(o=parent.window.TYPO3.Storage),top&&top.TYPO3.Storage&&(o=top.TYPO3.Storage)}catch(e){}return o||(o=new i),TYPO3.Storage=o,o}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __values=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};define(["require","exports"],(function(e,t){"use strict";return new(function(){function e(){var t=this;this.keyPrefix="t3-",this.get=function(r){return e.isCapable()?localStorage.getItem(t.keyPrefix+r):null},this.set=function(r,n){e.isCapable()&&localStorage.setItem(t.keyPrefix+r,n)},this.unset=function(r){e.isCapable()&&localStorage.removeItem(t.keyPrefix+r)},this.unsetByPrefix=function(r){if(e.isCapable()){r=t.keyPrefix+r;for(var n,a,i=[],l=0;l<localStorage.length;++l)if(localStorage.key(l).substring(0,r.length)===r){var o=localStorage.key(l).substr(t.keyPrefix.length);i.push(o)}try{for(var u=__values(i),s=u.next();!s.done;s=u.next()){o=s.value;t.unset(o)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}}},this.clear=function(){e.isCapable()&&localStorage.clear()},this.isset=function(r){if(e.isCapable()){var n=t.get(r);return null!=n}return!1}}return e.isCapable=function(){return null!==localStorage},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery"],(function(t,e,a){"use strict";return new function(){var t=this;this.data=!1,this.get=function(e){var a,s=t;return!1===t.data?(t.loadFromServer().done((function(){a=s.getRecursiveDataByDeepKey(s.data,e.split("."))})),a):t.getRecursiveDataByDeepKey(t.data,e.split("."))},this.set=function(e,a){return!1!==t.data&&(t.data=t.setRecursiveDataByDeepKey(t.data,e.split("."),a)),t.storeOnServer(e,a)},this.addToList=function(e,s){var n=t;return a.ajax(TYPO3.settings.ajaxUrls.usersettings_process,{data:{action:"addToList",key:e,value:s},method:"post"}).done((function(t){n.data=t}))},this.removeFromList=function(e,s){var n=t;return a.ajax(TYPO3.settings.ajaxUrls.usersettings_process,{data:{action:"removeFromList",key:e,value:s},method:"post"}).done((function(t){n.data=t}))},this.unset=function(e){var s=t;return a.ajax(TYPO3.settings.ajaxUrls.usersettings_process,{data:{action:"unset",key:e},method:"post"}).done((function(t){s.data=t}))},this.clear=function(){a.ajax(TYPO3.settings.ajaxUrls.usersettings_process,{data:{action:"clear"}}),t.data=!1},this.isset=function(e){var a=t.get(e);return null!=a},this.load=function(e){t.data=e},this.loadFromServer=function(){var e=t;return a.ajax(TYPO3.settings.ajaxUrls.usersettings_process,{async:!1,data:{action:"getAll"}}).done((function(t){e.data=t}))},this.storeOnServer=function(e,s){var n=t;return a.ajax(TYPO3.settings.ajaxUrls.usersettings_process,{data:{action:"set",key:e,value:s},method:"post"}).done((function(t){n.data=t}))},this.getRecursiveDataByDeepKey=function(e,a){if(1===a.length)return(e||{})[a[0]];var s=a.shift();return t.getRecursiveDataByDeepKey(e[s]||{},a)},this.setRecursiveDataByDeepKey=function(e,a,s){if(1===a.length)(e=e||{})[a[0]]=s;else{var n=a.shift();e[n]=t.setRecursiveDataByDeepKey(e[n]||{},a,s)}return e}}}));
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./Storage/Client","bootstrap"],(function(t,e,i,r){"use strict";return new(function(){function t(){this.cacheTimeInSeconds=1800,this.storeLastActiveTab=!0,this.storage=r;var t=this;i((function(){i(".t3js-tabs").each((function(){var e=i(this);t.storeLastActiveTab=1===e.data("storeLastTab");var r=t.receiveActiveTab(e.attr("id"));r&&e.find('a[href="'+r+'"]').tab("show"),e.on("show.bs.tab",(function(e){if(t.storeLastActiveTab){var i=e.currentTarget.id,r=e.target.hash;t.storeActiveTab(i,r)}}))}))}))}return t.getTimestamp=function(){return Math.round((new Date).getTime()/1e3)},t.prototype.receiveActiveTab=function(e){var i=this.storage.get(e)||"";return(this.storage.get(e+".expire")||0)>t.getTimestamp()?i:""},t.prototype.storeActiveTab=function(e,i){this.storage.set(e,i),this.storage.set(e+".expire",t.getTimestamp()+this.cacheTimeInSeconds)},t}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./DocumentHeader","TYPO3/CMS/Backend/jquery.clearable"],(function(e,i,t,o){"use strict";return new(function(){function e(){var e=this;t((function(){e.initialize()}))}return e.prototype.initialize=function(){var e=this,i=t("#db_list-searchbox-toolbar");t(".t3js-toggle-search-toolbox").on("click",(function(){i.toggle(),o.reposition(),i.is(":visible")&&t("#search_field").focus()}));var n=t("#search_field"),r=""!==n.val();n.clearable({onClear:function(){r&&t(e).closest("form").submit()}})},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./ModuleMenu"],(function(e,o,a,n){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var t=function(){function e(){}return e.initialize=function(){e.initializeEvents()},e.initializeEvents=function(){a(".t3js-toolbar-item").parent().on("hidden.bs.dropdown",(function(){a(".scaffold").removeClass("scaffold-toolbar-expanded").removeClass("scaffold-search-expanded")})),a(document).on("click",".toolbar-item [data-modulename]",(function(e){e.preventDefault();var o=a(e.target).closest("[data-modulename]").data("modulename");n.App.showModule(o)})),a(document).on("click",".t3js-topbar-button-toolbar",(function(){a(".scaffold").removeClass("scaffold-modulemenu-expanded").removeClass("scaffold-search-expanded").toggleClass("scaffold-toolbar-expanded")})),a(document).on("click",".t3js-topbar-button-search",(function(){a(".scaffold").removeClass("scaffold-modulemenu-expanded").removeClass("scaffold-toolbar-expanded").toggleClass("scaffold-search-expanded")}))},e}();a((function(){t.initialize()}))}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","../Icons","../Notification","../Viewport"],(function(e,t,c,r,o,n){"use strict";var i;return function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-clearcachetoolbaritem",e.menuItemSelector="a.toolbar-cache-flush-action",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon"}(i||(i={})),new(function(){function e(){var e=this;this.initializeEvents=function(){c(i.containerSelector).on("click",i.menuItemSelector,(function(t){t.preventDefault();var r=c(t.currentTarget).attr("href");r&&e.clearCache(r)}))},n.Topbar.Toolbar.registerEvent(this.initializeEvents)}return e.prototype.clearCache=function(e){c(i.containerSelector).removeClass("open");var t=c(i.toolbarIconSelector,i.containerSelector),n=t.clone();r.getIcon("spinner-circle-light",r.sizes.small).done((function(e){t.replaceWith(e)})),c.ajax({url:e,type:"post",cache:!1,success:function(e){!0===e.success?o.success(e.title,e.message):!1===e.success&&o.error(e.title,e.message)},error:function(){o.error("An error occurred","An error occurred while clearing the cache. It is likely not all caches were cleared as expected.")},complete:function(){c(i.toolbarIconSelector,i.containerSelector).replaceWith(n)}})},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","../Icons","../Modal","../Notification","../Viewport"],(function(t,e,o,r,c,n,a){"use strict";var s;!function(t){t.containerSelector="#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem",t.toolbarIconSelector=".dropdown-toggle span.icon",t.toolbarMenuSelector=".dropdown-menu",t.shortcutItemSelector=".t3js-topbar-shortcut",t.shortcutDeleteSelector=".t3js-shortcut-delete",t.shortcutEditSelector=".t3js-shortcut-edit",t.shortcutFormTitleSelector='input[name="shortcut-title"]',t.shortcutFormGroupSelector='select[name="shortcut-group"]',t.shortcutFormSaveSelector=".shortcut-form-save",t.shortcutFormCancelSelector=".shortcut-form-cancel",t.shortcutFormSelector=".shortcut-form"}(s||(s={}));var i=new(function(){function t(){var t=this;this.initializeEvents=function(){o(s.containerSelector).on("click",s.shortcutDeleteSelector,(function(e){e.preventDefault(),e.stopImmediatePropagation(),t.deleteShortcut(o(e.currentTarget).closest(s.shortcutItemSelector))})).on("click",s.shortcutFormGroupSelector,(function(t){t.preventDefault(),t.stopImmediatePropagation()})).on("click",s.shortcutEditSelector,(function(e){e.preventDefault(),e.stopImmediatePropagation(),t.editShortcut(o(e.currentTarget).closest(s.shortcutItemSelector))})).on("click",s.shortcutFormSaveSelector,(function(e){e.preventDefault(),e.stopImmediatePropagation(),t.saveShortcutForm(o(e.currentTarget).closest(s.shortcutFormSelector))})).on("submit",s.shortcutFormSelector,(function(e){e.preventDefault(),e.stopImmediatePropagation(),t.saveShortcutForm(o(e.currentTarget).closest(s.shortcutFormSelector))})).on("click",s.shortcutFormCancelSelector,(function(e){e.preventDefault(),e.stopImmediatePropagation(),t.refreshMenu()}))},a.Topbar.Toolbar.registerEvent(this.initializeEvents)}return t.prototype.createShortcut=function(t,e,n,a,i,u){var l=this;void 0!==n&&c.confirm(TYPO3.lang["bookmark.create"],n).on("confirm.button.ok",(function(c){var n=o(s.toolbarIconSelector,s.containerSelector),h=n.clone();r.getIcon("spinner-circle-light",r.sizes.small).done((function(t){n.replaceWith(t)})),o.ajax({url:TYPO3.settings.ajaxUrls.shortcut_create,type:"post",data:{module:t,url:e,motherModName:a,displayName:u},cache:!1}).done((function(){l.refreshMenu(),o(s.toolbarIconSelector,s.containerSelector).replaceWith(h),"object"==typeof i&&(r.getIcon("actions-system-shortcut-active",r.sizes.small).done((function(t){o(i).html(t)})),o(i).addClass("active"),o(i).attr("title",null),o(i).attr("onclick",null))})),o(c.currentTarget).trigger("modal-dismiss")})).on("confirm.button.cancel",(function(t){o(t.currentTarget).trigger("modal-dismiss")}))},t.prototype.deleteShortcut=function(t){var e=this;c.confirm(TYPO3.lang["bookmark.delete"],TYPO3.lang["bookmark.confirmDelete"]).on("confirm.button.ok",(function(r){o.ajax({url:TYPO3.settings.ajaxUrls.shortcut_remove,data:{shortcutId:t.data("shortcutid")},type:"post",cache:!1}).done((function(){e.refreshMenu()})),o(r.currentTarget).trigger("modal-dismiss")})).on("confirm.button.cancel",(function(t){o(t.currentTarget).trigger("modal-dismiss")}))},t.prototype.editShortcut=function(t){o.ajax({url:TYPO3.settings.ajaxUrls.shortcut_editform,data:{shortcutId:t.data("shortcutid"),shortcutGroup:t.data("shortcutgroup")},cache:!1}).done((function(t){o(s.containerSelector).find(s.toolbarMenuSelector).html(t)}))},t.prototype.saveShortcutForm=function(t){var e=this;o.ajax({url:TYPO3.settings.ajaxUrls.shortcut_saveform,data:{shortcutId:t.data("shortcutid"),shortcutTitle:t.find(s.shortcutFormTitleSelector).val(),shortcutGroup:t.find(s.shortcutFormGroupSelector).val()},type:"post",cache:!1}).done((function(){n.success(TYPO3.lang["bookmark.savedTitle"],TYPO3.lang["bookmark.savedMessage"]),e.refreshMenu()}))},t.prototype.refreshMenu=function(){o.ajax({url:TYPO3.settings.ajaxUrls.shortcut_list,type:"get",cache:!1}).done((function(t){o(s.toolbarMenuSelector,s.containerSelector).html(t)}))},t}());return TYPO3.ShortcutMenu=i,i}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","../Icons","../Storage/Persistent","../Viewport"],(function(e,t,n,o,r,i){"use strict";var a;return function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-systeminformationtoolbaritem",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon",e.menuContainerSelector=".dropdown-menu",e.moduleLinks=".t3js-systeminformation-module",e.counter=".t3js-systeminformation-counter"}(a||(a={})),new(function(){function e(){var t=this;this.timer=null,this.updateMenu=function(){var r=n(a.toolbarIconSelector,a.containerSelector),i=r.clone(),s=n(a.containerSelector).find(a.menuContainerSelector);null!==t.timer&&(clearTimeout(t.timer),t.timer=null),o.getIcon("spinner-circle-light",o.sizes.small).done((function(e){r.replaceWith(e)})),n.ajax({url:TYPO3.settings.ajaxUrls.systeminformation_render,type:"post",cache:!1,success:function(o){s.html(o),e.updateCounter(),n(a.moduleLinks).on("click",t.openModule)},complete:function(){n(a.toolbarIconSelector,a.containerSelector).replaceWith(i)}}).done((function(){t.timer=setTimeout(t.updateMenu,3e5)}))},i.Topbar.Toolbar.registerEvent(this.updateMenu)}return e.updateCounter=function(){var e=n(a.containerSelector).find(a.menuContainerSelector).find(".t3js-systeminformation-container"),t=n(a.counter),o=e.data("count"),r=e.data("severityclass");t.text(o).toggle(parseInt(o,10)>0),t.removeClass(),t.addClass("t3js-systeminformation-counter toolbar-item-badge badge"),""!==r&&t.addClass(r)},e.prototype.openModule=function(e){e.preventDefault(),e.stopPropagation();var t={},o={},a=n(e.currentTarget).data("modulename"),s=n(e.currentTarget).data("moduleparams"),c=Math.floor((new Date).getTime()/1e3);r.isset("systeminformation")&&(t=JSON.parse(r.get("systeminformation"))),o[a]={lastAccess:c},n.extend(!0,t,o),r.set("systeminformation",JSON.stringify(t)).done((function(){TYPO3.ModuleMenu.App.showModule(a,s),i.Topbar.refresh()}))},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","bootstrap"],(function(t,o,i){"use strict";var e=new(function(){function t(){var t=this;i((function(){t.initialize('[data-toggle="tooltip"]')}))}return t.prototype.initialize=function(t,o){o=o||{},i(t).tooltip(o)},t.prototype.show=function(t,o){t.attr("data-placement","auto").attr("data-title",o).tooltip("show")},t.prototype.hide=function(t){t.tooltip("hide")},t}());return TYPO3.Tooltip=e,e}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./Login"],(function(e,n,s,i){"use strict";return new(function(){function e(){var n=this;this.resetPassword=function(){var e=s(n.options.passwordField);e.val()&&(s(i.options.useridentField).val(e.val()),e.val(""))},this.showCapsLockWarning=function(n){s(n.target).parent().parent().find(".t3js-login-alert-capslock").toggleClass("hidden",!e.isCapslockEnabled(n))},this.options={passwordField:".t3js-login-password-field",usernameField:".t3js-login-username-field"},i.options.submitHandler=this.resetPassword;var o=s(this.options.usernameField),r=s(this.options.passwordField);o.on("keypress",this.showCapsLockWarning),r.on("keypress",this.showCapsLockWarning);try{parent.opener&&parent.opener.TYPO3&&parent.opener.TYPO3.configuration&&parent.opener.TYPO3.configuration.username&&o.val(parent.opener.TYPO3.configuration.username)}catch(e){}""===o.val()?o.focus():r.focus()}return e.isCapslockEnabled=function(e){var n=e||window.event;if(!n)return!1;var s=-1;n.which?s=n.which:n.keyCode&&(s=n.keyCode);var i=!1;return n.shiftKey?i=n.shiftKey:n.modifiers&&(i=!!(4&n.modifiers)),s>=65&&s<=90&&!i||s>=97&&s<=122&&i},e}())}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(t,e){"use strict";var r=new function(){this.isNumber=function(t){return!isNaN(parseFloat(t.toString()))&&isFinite(t)},this.getParameterFromUrl=function(t,e){if("function"!=typeof t.split)return"";var r=t.split("?"),i="";if(r.length>=2)for(var n=r.join("?"),a=encodeURIComponent(e)+"=",o=n.split(/[&;]/g),u=o.length;u-- >0;)if(-1!==o[u].lastIndexOf(a,0)){i=o[u].split("=")[1];break}return i},this.updateQueryStringParameter=function(t,e,r){var i=new RegExp("([?&])"+e+"=.*?(&|$)","i"),n=-1!==t.indexOf("?")?"&":"?";return t.match(i)?t.replace(i,"$1"+e+"="+r+"$2"):t+n+e+"="+r}};return TYPO3.Utility=r,r}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","jquery","./Viewport/ContentContainer","./Event/ConsumerScope","./Viewport/Loader","./Viewport/NavigationContainer","./Viewport/Topbar"],(function(t,n,o,i,e,r,a,s){"use strict";var u,c=function(){function t(){var t=this;this.Loader=r,this.Topbar=s,this.NavigationContainer=null,this.ContentContainer=null,this.consumerScope=e,o((function(){return t.initialize()})),this.NavigationContainer=new a(this.consumerScope),this.ContentContainer=new i(this.consumerScope)}return t.prototype.initialize=function(){var t=this;this.doLayout(),o(window).on("resize",(function(){t.doLayout()}))},t.prototype.doLayout=function(){this.NavigationContainer.cleanup(),this.NavigationContainer.calculateScrollbar(),o(".t3js-topbar-header").css("padding-right",o(".t3js-scaffold-toolbar").outerWidth())},t}();return top.TYPO3.Backend?u=top.TYPO3.Backend:(u=new c,top.TYPO3.Backend=u),u}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","../Event/ConsumerScope"],(function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){this.consumerScope=n,this.consumerScope=e};t.AbstractContainer=o}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();define(["require","exports","../Enum/Viewport/ScaffoldIdentifier","./AbstractContainer","jquery","./Loader","../Utility","../Event/TriggerRequest"],(function(e,t,r,n,o,i,u,c){"use strict";return function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.get=function(){return o(r.ScaffoldIdentifierEnum.contentModuleIframe)[0].contentWindow},t.prototype.beforeSetUrl=function(e){return this.consumerScope.invoke(new c("typo3.beforeSetUrl",e))},t.prototype.setUrl=function(e,t){var n;return null===this.resolveIFrameElement()?((n=o.Deferred()).reject(),n):((n=this.consumerScope.invoke(new c("typo3.setUrl",t))).then((function(){i.start(),o(r.ScaffoldIdentifierEnum.contentModuleIframe).attr("src",e).one("load",(function(){i.finish()}))})),n)},t.prototype.getUrl=function(){return o(r.ScaffoldIdentifierEnum.contentModuleIframe).attr("src")},t.prototype.refresh=function(e,t){var r,n=this.resolveIFrameElement();return null===n?((r=o.Deferred()).reject(),r):((r=this.consumerScope.invoke(new c("typo3.refresh",t))).then((function(){n.contentWindow.location.reload(e)})),r)},t.prototype.getIdFromUrl=function(){return this.getUrl?parseInt(u.getParameterFromUrl(this.getUrl(),"id"),10):0},t.prototype.resolveIFrameElement=function(){var e=o(r.ScaffoldIdentifierEnum.contentModuleIframe+":first");return 0===e.length?null:e.get(0)},t}(n.AbstractContainer)}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","../Enum/Viewport/ScaffoldIdentifier","nprogress"],(function(n,e,t,r){"use strict";return function(){function n(){}return n.start=function(){r.configure({parent:t.ScaffoldIdentifierEnum.contentModule,showSpinner:!1}),r.start()},n.finish=function(){r.done()},n}()}));
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();define(["require","exports","../Enum/Viewport/ScaffoldIdentifier","../Enum/Viewport/TopbarIdentifiers","./AbstractContainer","jquery","./PageTree","./../Icons","../Event/TriggerRequest"],(function(t,e,n,o,i,r,a,f,c){"use strict";return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.PageTree=null,e.instance=null,e}return __extends(e,t),e.prototype.setComponentInstance=function(t){this.instance=t,this.PageTree=new a(t)},e.prototype.toggle=function(){r(n.ScaffoldIdentifierEnum.scaffold).toggleClass("scaffold-content-navigation-expanded")},e.prototype.cleanup=function(){r(n.ScaffoldIdentifierEnum.moduleMenu).removeAttr("style"),r(n.ScaffoldIdentifierEnum.content).removeAttr("style")},e.prototype.hide=function(){r(o.TopbarIdentifiersEnum.buttonNavigationComponent).prop("disabled",!0),f.getIcon("actions-pagetree",f.sizes.small,"overlay-readonly",null,f.markupIdentifiers.inline).done((function(t){r(o.TopbarIdentifiersEnum.buttonNavigationComponent).html(t)})),r(n.ScaffoldIdentifierEnum.scaffold).removeClass("scaffold-content-navigation-expanded"),r(n.ScaffoldIdentifierEnum.contentModule).removeAttr("style")},e.prototype.show=function(t){r(o.TopbarIdentifiersEnum.buttonNavigationComponent).prop("disabled",!1),f.getIcon("actions-pagetree",f.sizes.small,null,null,f.markupIdentifiers.inline).done((function(t){r(o.TopbarIdentifiersEnum.buttonNavigationComponent).html(t)})),r(n.ScaffoldIdentifierEnum.contentNavigationDataComponent).hide(),void 0!==typeof t&&(r(n.ScaffoldIdentifierEnum.scaffold).addClass("scaffold-content-navigation-expanded"),r(n.ScaffoldIdentifierEnum.contentNavigation+' [data-component="'+t+'"]').show())},e.prototype.setUrl=function(t,e){var o=this.consumerScope.invoke(new c("typo3.setUrl",e));return o.then((function(){r(n.ScaffoldIdentifierEnum.scaffold).addClass("scaffold-content-navigation-expanded"),r(n.ScaffoldIdentifierEnum.contentNavigationIframe).attr("src",t)})),o},e.prototype.getUrl=function(){return r(n.ScaffoldIdentifierEnum.contentNavigationIframe).attr("src")},e.prototype.refresh=function(t){return r(n.ScaffoldIdentifierEnum.contentNavigationIframe)[0].contentWindow.location.reload(t)},e.prototype.calculateScrollbar=function(){this.cleanup();var t=r(n.ScaffoldIdentifierEnum.scaffold),e=r(n.ScaffoldIdentifierEnum.moduleMenu),o=r(n.ScaffoldIdentifierEnum.content),i=r(".t3js-modulemenu");e.css("overflow","auto");var a=e.outerWidth(),f=i.outerWidth();e.removeAttr("style").css("overflow","hidden"),!1===t.hasClass("scaffold-modulemenu-expanded")?(e.width(a+(a-f)),o.css("left",a+(a-f))):(e.removeAttr("style"),o.removeAttr("style")),e.css("overflow","auto")},e}(i.AbstractContainer)}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports"],(function(t,n){"use strict";return function(){function t(t){this.instance=null,this.instance=t}return t.prototype.refreshTree=function(){null!==this.instance&&this.instance.refreshOrFilterTree()},t.prototype.setTemporaryMountPoint=function(t){null!==this.instance&&this.instance.setTemporaryMountPoint(t)},t.prototype.unsetTemporaryMountPoint=function(){null!==this.instance&&this.instance.unsetTemporaryMountPoint()},t.prototype.selectNode=function(t){null!==this.instance&&this.instance.selectNode(t)},t}()}));
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","../Enum/Viewport/ScaffoldIdentifier","jquery"],(function(t,e,r,o){"use strict";return function(){function t(){}return t.refresh=function(){o.ajax(TYPO3.settings.ajaxUrls.topbar).done((function(e){o(t.topbarSelector).html(e.topbar),o(t.topbarSelector).trigger("t3-topbar-update")}))},t.topbarSelector=r.ScaffoldIdentifierEnum.header,t.Toolbar={registerEvent:function(e){o(e),o(t.topbarSelector).on("t3-topbar-update",e)}},t}()}));
|
||||
@@ -0,0 +1,360 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/Wizard
|
||||
* API for wizard windows.
|
||||
*/
|
||||
define(['jquery',
|
||||
'TYPO3/CMS/Backend/Modal',
|
||||
'TYPO3/CMS/Backend/Severity',
|
||||
'TYPO3/CMS/Backend/Icons',
|
||||
'bootstrap'
|
||||
], function($, Modal, Severity, Icons) {
|
||||
'use strict';
|
||||
|
||||
try {
|
||||
// fetch from parent
|
||||
if (parent && parent.window.TYPO3 && parent.window.TYPO3.Wizard) {
|
||||
return parent.window.TYPO3.Wizard;
|
||||
}
|
||||
|
||||
// fetch object from outer frame
|
||||
if (top && top.TYPO3 && top.TYPO3.Wizard) {
|
||||
return top.TYPO3.Wizard;
|
||||
}
|
||||
} catch (e) {
|
||||
// This only happens if the opener, parent or top is some other url (eg a local file)
|
||||
// which loaded the current window. Then the browser's cross domain policy jumps in
|
||||
// and raises an exception.
|
||||
// For this case we are safe and we can create our global object below.
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {{setup: {slides: Array, settings: {}, forceSelection: boolean, $carousel: null}, originalSetup: {}}}
|
||||
* @exports TYPO3/CMS/Backend/Wizard
|
||||
*/
|
||||
var Wizard = {
|
||||
setup: {
|
||||
slides: [],
|
||||
settings: {},
|
||||
forceSelection: true,
|
||||
$carousel: null
|
||||
},
|
||||
originalSetup: {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the events after building the wizards
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Wizard.initializeEvents = function() {
|
||||
var $modal = Wizard.setup.$carousel.closest('.modal'),
|
||||
$modalTitle = $modal.find('.modal-title'),
|
||||
$modalFooter = $modal.find('.modal-footer'),
|
||||
$nextButton = $modalFooter.find('button[name="next"]');
|
||||
|
||||
$nextButton.on('click', function() {
|
||||
Wizard.setup.$carousel.carousel('next');
|
||||
});
|
||||
|
||||
Wizard.setup.$carousel.on('slide.bs.carousel', function() {
|
||||
var nextSlideNumber = Wizard.setup.$carousel.data('currentSlide') + 1,
|
||||
currentIndex = Wizard.setup.$carousel.data('currentIndex') + 1;
|
||||
|
||||
$modalTitle.text(Wizard.setup.slides[currentIndex].title);
|
||||
|
||||
Wizard.setup.$carousel.data('currentSlide', nextSlideNumber);
|
||||
Wizard.setup.$carousel.data('currentIndex', currentIndex);
|
||||
|
||||
if (nextSlideNumber >= Wizard.setup.$carousel.data('realSlideCount')) {
|
||||
// Point of no return - hide modal footer disable any closing ability
|
||||
$modal.find('.modal-header .close').remove();
|
||||
$modalFooter.slideUp();
|
||||
} else {
|
||||
$modalFooter.find('.progress-bar')
|
||||
.width(Wizard.setup.$carousel.data('initialStep') * nextSlideNumber + '%')
|
||||
.text(top.TYPO3.lang['wizard.progress']
|
||||
.replace('{0}', nextSlideNumber)
|
||||
.replace('{1}', Wizard.setup.$carousel.data('slideCount')));
|
||||
}
|
||||
|
||||
$nextButton
|
||||
.removeClass('btn-' + Severity.getCssClass(Wizard.setup.slides[currentIndex - 1].severity))
|
||||
.addClass('btn-' + Severity.getCssClass(Wizard.setup.slides[currentIndex].severity));
|
||||
|
||||
$modal
|
||||
.removeClass('modal-severity-' + Severity.getCssClass(Wizard.setup.slides[currentIndex - 1].severity))
|
||||
.addClass('modal-severity-' + Severity.getCssClass(Wizard.setup.slides[currentIndex].severity));
|
||||
}).on('slid.bs.carousel', function(e) {
|
||||
var currentIndex = Wizard.setup.$carousel.data('currentIndex'),
|
||||
slide = Wizard.setup.slides[currentIndex];
|
||||
|
||||
Wizard.runSlideCallback(slide, $(e.relatedTarget));
|
||||
|
||||
if (Wizard.setup.forceSelection) {
|
||||
Wizard.lockNextStep();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Custom event, closes the wizard
|
||||
*/
|
||||
var cmp = Wizard.getComponent();
|
||||
cmp.on('wizard-dismiss', Wizard.dismiss);
|
||||
|
||||
Modal.currentModal.on('hidden.bs.modal', function() {
|
||||
cmp.trigger('wizard-dismissed');
|
||||
}).on('shown.bs.modal', function() {
|
||||
cmp.trigger('wizard-visible');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} key
|
||||
* @param {*} value
|
||||
* @returns {Object}
|
||||
*/
|
||||
Wizard.set = function(key, value) {
|
||||
Wizard.setup.settings[key] = value;
|
||||
return Wizard;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a new slide to the wizard
|
||||
*
|
||||
* @param {String} identifier
|
||||
* @param {String} title
|
||||
* @param {String} content
|
||||
* @param {String} severity
|
||||
* @param {Function} callback
|
||||
* @returns {Object}
|
||||
*/
|
||||
Wizard.addSlide = function(identifier, title, content, severity, callback) {
|
||||
Wizard.setup.slides.push({
|
||||
identifier: identifier,
|
||||
title: title,
|
||||
content: content || '',
|
||||
severity: (typeof severity !== 'undefined' ? severity : Severity.info),
|
||||
callback: callback
|
||||
});
|
||||
|
||||
return Wizard;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a final processing slide
|
||||
*
|
||||
* @param {Function} callback
|
||||
* @returns {Object}
|
||||
*/
|
||||
Wizard.addFinalProcessingSlide = function(callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
callback = function() {
|
||||
Wizard.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
return Icons.getIcon('spinner-circle-dark', Icons.sizes.large, null, null).done(function(markup) {
|
||||
var $processingSlide = $('<div />', {class: 'text-center'}).append(markup);
|
||||
Wizard.addSlide(
|
||||
'final-processing-slide', top.TYPO3.lang['wizard.processing.title'],
|
||||
$processingSlide[0].outerHTML,
|
||||
Severity.info,
|
||||
callback
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Processes the footer of the modal
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Wizard.addProgressBar = function() {
|
||||
var realSlideCount = Wizard.setup.$carousel.find('.item').length,
|
||||
slideCount = Math.max(1, realSlideCount),
|
||||
initialStep,
|
||||
$modal = Wizard.setup.$carousel.closest('.modal'),
|
||||
$modalFooter = $modal.find('.modal-footer');
|
||||
|
||||
initialStep = Math.round(100 / slideCount);
|
||||
|
||||
Wizard.setup.$carousel
|
||||
.data('initialStep', initialStep)
|
||||
.data('slideCount', slideCount)
|
||||
.data('realSlideCount', realSlideCount)
|
||||
.data('currentIndex', 0)
|
||||
.data('currentSlide', 1);
|
||||
|
||||
// Append progress bar to modal footer
|
||||
if (slideCount > 1) {
|
||||
$modalFooter.prepend(
|
||||
$('<div />', {class: 'progress'}).append(
|
||||
$('<div />', {
|
||||
role: 'progressbar',
|
||||
class: 'progress-bar',
|
||||
'aria-valuemin': 0,
|
||||
'aria-valuenow': initialStep,
|
||||
'aria-valuemax': 100
|
||||
}).width(initialStep + '%').text(
|
||||
top.TYPO3.lang['wizard.progress']
|
||||
.replace('{0}', '1')
|
||||
.replace('{1}', slideCount)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates the markup of slides added by addSlide()
|
||||
*
|
||||
* @returns {$}
|
||||
* @private
|
||||
*/
|
||||
Wizard.generateSlides = function() {
|
||||
// Check whether the slides were already generated
|
||||
if (Wizard.setup.$carousel !== null) {
|
||||
return Wizard.setup.$carousel;
|
||||
}
|
||||
|
||||
var slides =
|
||||
'<div class="carousel slide" data-ride="carousel" data-interval="false">'
|
||||
+ '<div class="carousel-inner" role="listbox">';
|
||||
|
||||
for (var i = 0; i < Wizard.setup.slides.length; ++i) {
|
||||
var currentSlide = Wizard.setup.slides[i],
|
||||
slideContent = currentSlide.content;
|
||||
|
||||
if (typeof slideContent === 'object') {
|
||||
slideContent = slideContent.html();
|
||||
}
|
||||
slides += '<div class="item" data-slide="' + currentSlide.identifier + '">' + slideContent + '</div>';
|
||||
}
|
||||
|
||||
slides += '</div></div>';
|
||||
|
||||
Wizard.setup.$carousel = $(slides);
|
||||
Wizard.setup.$carousel.find('.item').first().addClass('active');
|
||||
|
||||
return Wizard.setup.$carousel;
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders the wizard
|
||||
*
|
||||
* @returns {$}
|
||||
*/
|
||||
Wizard.show = function() {
|
||||
var $slides = Wizard.generateSlides(),
|
||||
firstSlide = Wizard.setup.slides[0];
|
||||
|
||||
var $modal = Modal.confirm(
|
||||
firstSlide.title,
|
||||
$slides,
|
||||
firstSlide.severity,
|
||||
[{
|
||||
text: top.TYPO3.lang['wizard.button.cancel'],
|
||||
active: true,
|
||||
btnClass: 'btn-default',
|
||||
name: 'cancel',
|
||||
trigger: function() {
|
||||
Wizard.getComponent().trigger('wizard-dismiss');
|
||||
}
|
||||
}, {
|
||||
text: top.TYPO3.lang['wizard.button.next'],
|
||||
btnClass: 'btn-' + Severity.getCssClass(firstSlide.severity),
|
||||
name: 'next'
|
||||
}]
|
||||
);
|
||||
|
||||
if (Wizard.setup.forceSelection) {
|
||||
Wizard.lockNextStep();
|
||||
}
|
||||
|
||||
Wizard.addProgressBar($modal);
|
||||
Wizard.initializeEvents();
|
||||
|
||||
Wizard.getComponent().on('wizard-visible', function() {
|
||||
Wizard.runSlideCallback(firstSlide, Wizard.setup.$carousel.find('.item').first());
|
||||
}).on('wizard-dismissed', function() {
|
||||
Wizard.setup = $.extend(true, {}, Wizard.originalSetup);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Runs the callback for the given slide
|
||||
*
|
||||
* @param {Object} slide
|
||||
* @param {$} $slide
|
||||
* @private
|
||||
*/
|
||||
Wizard.runSlideCallback = function(slide, $slide) {
|
||||
if (typeof slide.callback === 'function') {
|
||||
slide.callback($slide, Wizard.setup.settings, slide.identifier);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the wizard component
|
||||
*
|
||||
* @returns {$}
|
||||
*/
|
||||
Wizard.getComponent = function() {
|
||||
if (Wizard.setup.$carousel === null) {
|
||||
Wizard.generateSlides();
|
||||
}
|
||||
return Wizard.setup.$carousel;
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the wizard window
|
||||
*/
|
||||
Wizard.dismiss = function() {
|
||||
Modal.dismiss();
|
||||
};
|
||||
|
||||
/**
|
||||
* Locks the button for continuing to the next step
|
||||
*
|
||||
* @returns {$}
|
||||
*/
|
||||
Wizard.lockNextStep = function() {
|
||||
var $button = Wizard.setup.$carousel.closest('.modal').find('button[name="next"]');
|
||||
$button.prop('disabled', true);
|
||||
|
||||
return $button;
|
||||
};
|
||||
|
||||
/**
|
||||
* Unlocks the button for continuing to the next step
|
||||
*
|
||||
* @returns {$}
|
||||
*/
|
||||
Wizard.unlockNextStep = function() {
|
||||
var $button = Wizard.setup.$carousel.closest('.modal').find('button[name="next"]');
|
||||
$button.prop('disabled', false);
|
||||
|
||||
return $button;
|
||||
};
|
||||
|
||||
// Store the initial setup
|
||||
Wizard.originalSetup = $.extend(true, {}, Wizard.setup);
|
||||
|
||||
// expose as global object
|
||||
TYPO3.Wizard = Wizard;
|
||||
|
||||
return Wizard;
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Backend/Wizard/Colorpicker
|
||||
* Colorpicker JavaScript
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{options: {}}}
|
||||
* @exports TYPO3/CMS/Backend/Wizard/Colorpicker
|
||||
*/
|
||||
var Colorpicker = {
|
||||
options: {}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
Colorpicker.setFieldChangeFunctions = function(options) {
|
||||
Colorpicker.options = options;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
Colorpicker.initializeEvents = function() {
|
||||
// Set color value
|
||||
$('.t3js-colorpicker-value').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#colorValue').val($(this).data('color-value'));
|
||||
$(this).closest('form').submit();
|
||||
});
|
||||
|
||||
// Handle the change of the color selector
|
||||
$('.t3js-colorpicker-selector').on('change', function(e) {
|
||||
e.preventDefault();
|
||||
$('#colorValue').val($(this).val());
|
||||
$(this).closest('form').submit();
|
||||
});
|
||||
|
||||
// Handle the transfer of the color value and closing of popup
|
||||
$('#colorpicker-saveclose').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var theField = $('[data-formengine-input-name="' + $('[name="fieldName"]').val() + '"]').get(0);
|
||||
if (theField) {
|
||||
theField.value = $('#colorValue').val();
|
||||
|
||||
if (typeof Colorpicker.options.fieldChangeFunctions === 'function') {
|
||||
Colorpicker.options.fieldChangeFunctions();
|
||||
}
|
||||
}
|
||||
parent.close();
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
$(Colorpicker.initializeEvents);
|
||||
|
||||
return Colorpicker;
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
define(["require","exports","../Enum/Severity","../Modal"],(function(e,n,t,i){"use strict";return function(){function e(){}return e.wizard=function(e,n){i.advanced({callback:function(e){e.find(".t3js-modal-body").addClass("t3-new-content-element-wizard-window")},content:e,severity:t.SeverityEnum.notice,size:i.sizes.medium,title:n,type:i.types.ajax})},e}()}));
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
// Reset the current window name in case it was a preview before
|
||||
window.name = '';
|
||||
|
||||
// Remove window.opener from backend
|
||||
window.opener = undefined;
|
||||
|
||||
/**
|
||||
* common storage and global object, could later hold more information about the current user etc.
|
||||
*/
|
||||
var TYPO3 = TYPO3 || {};
|
||||
|
||||
/**
|
||||
* jump the backend to a module
|
||||
*/
|
||||
function jump(url, modName, mainModName, pageId) {
|
||||
if (isNaN(pageId)) {
|
||||
pageId = -2;
|
||||
}
|
||||
// clear information about which entry in nav. tree that might have been highlighted.
|
||||
top.fsMod.navFrameHighlightedID = [];
|
||||
top.fsMod.recentIds['web'] = pageId;
|
||||
|
||||
top.nextLoadModuleUrl = url;
|
||||
top.TYPO3.ModuleMenu.App.showModule(modName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function similar to PHPs rawurlencode();
|
||||
*/
|
||||
function rawurlencode(str) {
|
||||
var output = encodeURIComponent(str);
|
||||
output = str_replace("*", "%2A", output);
|
||||
output = str_replace("+", "%2B", output);
|
||||
output = str_replace("/", "%2F", output);
|
||||
output = str_replace("@", "%40", output);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* String-replace function
|
||||
*/
|
||||
function str_replace(match, replace, string) { //
|
||||
var input = "" + string;
|
||||
var matchStr = "" + match;
|
||||
if (!matchStr) {
|
||||
return string;
|
||||
}
|
||||
var output = "";
|
||||
var pointer = 0;
|
||||
var pos = input.indexOf(matchStr);
|
||||
while (pos !== -1) {
|
||||
output += "" + input.substr(pointer, pos - pointer) + replace;
|
||||
pointer = pos + matchStr.length;
|
||||
pos = input.indexOf(match, pos + 1);
|
||||
}
|
||||
output += "" + input.substr(pointer);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Launcing information window for records/files (fileref as "table" argument)
|
||||
*/
|
||||
function launchView(table, uid) {
|
||||
console.warn('Calling launchView() has been deprecated in v9 and will be removed in v10.0');
|
||||
var thePreviewWindow = window.open(TYPO3.settings.ShowItem.moduleUrl + '&table=' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid),
|
||||
"ShowItem" + Math.random().toString(16).slice(2),
|
||||
"width=650,height=600,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
|
||||
if (thePreviewWindow && thePreviewWindow.focus) {
|
||||
thePreviewWindow.focus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens plain window with url
|
||||
*/
|
||||
function openUrlInWindow(url, windowName) { //
|
||||
regularWindow = window.open(
|
||||
url,
|
||||
windowName,
|
||||
"status=1,menubar=1,resizable=1,location=1,directories=0,scrollbars=1,toolbar=1");
|
||||
regularWindow.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a page id for editing in the page edit module:
|
||||
*/
|
||||
function loadEditId(id, addGetVars) { //
|
||||
top.fsMod.recentIds.web = id;
|
||||
top.fsMod.navFrameHighlightedID.web = '0_' + id; // For highlighting
|
||||
|
||||
if (top.nav_frame && top.nav_frame.refresh_nav) {
|
||||
top.nav_frame.refresh_nav();
|
||||
}
|
||||
if (TYPO3.configuration.pageModule) {
|
||||
top.goToModule(TYPO3.configuration.pageModule, 0, addGetVars ? addGetVars : "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns incoming URL (to a module) unless nextLoadModuleUrl is set. If that is the case nextLoadModuleUrl is returned (and cleared)
|
||||
* Used by the shortcut frame to set a "intermediate URL"
|
||||
*/
|
||||
var nextLoadModuleUrl = "";
|
||||
|
||||
function getModuleUrl(inUrl) { //
|
||||
var nMU;
|
||||
if (top.nextLoadModuleUrl) {
|
||||
nMU = top.nextLoadModuleUrl;
|
||||
top.nextLoadModuleUrl = "";
|
||||
return nMU;
|
||||
} else {
|
||||
return inUrl;
|
||||
}
|
||||
}
|
||||
|
||||
// Used by Frameset Modules
|
||||
var currentSubScript = "";
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file provides a jQuery plugin for generating 'clearable' input fields.
|
||||
* These fields show a "clear"-button when someone hovers over them and
|
||||
* they are not empty.
|
||||
* Options:
|
||||
* * 'onClear': Function that is called after clearing. Takes no arguments,
|
||||
* 'this' is set to the clearable input element. Defaults to an
|
||||
* empty function.
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(["jquery"], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function($) {
|
||||
$.fn.clearable = function(options) {
|
||||
|
||||
var defaults = {
|
||||
'onClear': function() {
|
||||
}
|
||||
};
|
||||
|
||||
// The inlined markup represent the current generated markup from the
|
||||
// icon api for the icon actions-close that can be found in the official
|
||||
// icon repository and is registered in the backend icon api.
|
||||
//
|
||||
// It´s not possible to use/open the backend icon api without opening
|
||||
// new possible vectors for attackers to sniff system informations.
|
||||
//
|
||||
// When the icon definition of actions-close changes also the inlined
|
||||
// icon should be updated.
|
||||
//
|
||||
// https://github.com/typo3/typo3.icons
|
||||
var closeIcon = '<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">' +
|
||||
'<span class="icon-markup">' +
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"/></svg>' +
|
||||
'</span>' +
|
||||
'</span>';
|
||||
|
||||
// Merge defaults and given options. Given options have higher priority
|
||||
// because they are the last argument.
|
||||
var settings = $.extend({}, defaults, options);
|
||||
|
||||
// Iterate over the list of inputs and make each clearable. Return
|
||||
// the list to allow chaining.
|
||||
return this.each(function() {
|
||||
|
||||
// The input element to make clearable.
|
||||
var $input = $(this);
|
||||
|
||||
// make sure the input field is not used twice for a clearable
|
||||
// or the input field is a colorpicker, because it breaks the colorpicker.
|
||||
if (!$input.data('clearable') && !$input.hasClass('t3js-color-picker')) {
|
||||
$input.data('clearable', 'loaded');
|
||||
var hiddenClass = $input.hasClass('hidden') ? ' hidden' : '';
|
||||
|
||||
// Wrap it with a div and add a span that is the trigger for
|
||||
// clearing.
|
||||
$input.wrap('<div class="form-control-clearable" />');
|
||||
$input.after('<button type="button" class="close' + hiddenClass + '" tabindex="-1" aria-hidden="true">' + closeIcon + '</button>');
|
||||
$input.addClass('t3js-clearable');
|
||||
|
||||
var $clearer = $input.next();
|
||||
|
||||
// Register a listener the various events triggering the clearer to
|
||||
// be shown or hidden.
|
||||
var handler = function() {
|
||||
var $element = $(this);
|
||||
if ($element.next('input[type=hidden]').length) {
|
||||
$element = $element.next('input[type=hidden]');
|
||||
}
|
||||
var value = $element.val();
|
||||
var hasEmptyValue = (value.length === 0);
|
||||
if (value === "0" && $element.closest('.t3js-datetimepicker').length) {
|
||||
hasEmptyValue = true;
|
||||
}
|
||||
|
||||
// only show the clearing button if the value is set, or if the value is not "0" on a datetime field
|
||||
if (!hasEmptyValue) {
|
||||
$clearer.show();
|
||||
} else {
|
||||
$clearer.hide();
|
||||
}
|
||||
};
|
||||
$input.on('keyup', handler);
|
||||
$input.on('mouseenter', handler);
|
||||
$input.on('change', handler);
|
||||
$input.on('initialize', handler);
|
||||
|
||||
// The actual clearing action. Focus the input element afterwards,
|
||||
// the user probably wants to type into it after clearing.
|
||||
$clearer.click(function(e) {
|
||||
e.preventDefault();
|
||||
$input.val('').change();
|
||||
if (!$input.hasClass("t3js-datetimepicker")) {
|
||||
$input.focus();
|
||||
}
|
||||
$input.trigger('keyup');
|
||||
|
||||
if ('function' === typeof(settings.onClear)) {
|
||||
settings.onClear.call($input.get());
|
||||
}
|
||||
});
|
||||
|
||||
$input.trigger('initialize');
|
||||
}
|
||||
});
|
||||
};
|
||||
}));
|
||||
@@ -0,0 +1,572 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Evaluation of TYPO3 form field content
|
||||
*/
|
||||
|
||||
function evalFunc() {
|
||||
this.input = evalFunc_input;
|
||||
this.output = evalFunc_output;
|
||||
this.parseInt = evalFunc_parseInt;
|
||||
this.getNumChars = evalFunc_getNumChars;
|
||||
this.parseDouble = evalFunc_parseDouble;
|
||||
this.noSpace = evalFunc_noSpace;
|
||||
this.getSecs = evalFunc_getSecs;
|
||||
this.getYear = evalFunc_getYear;
|
||||
this.getTimeSecs = evalFunc_getTimeSecs;
|
||||
this.getTime = evalFunc_getTime;
|
||||
this.getDate = evalFunc_getDate;
|
||||
this.getTimestamp = evalFunc_getTimestamp;
|
||||
this.caseSwitch = evalFunc_caseSwitch;
|
||||
this.evalObjValue = evalFunc_evalObjValue;
|
||||
this.outputObjValue = evalFunc_outputObjValue;
|
||||
this.split = evalFunc_splitStr;
|
||||
this.pol = evalFunc_pol;
|
||||
this.convertClientTimestampToUTC = evalFunc_convertClientTimestampToUTC;
|
||||
|
||||
this.ltrim = evalFunc_ltrim;
|
||||
this.btrim = evalFunc_btrim;
|
||||
var today = new Date();
|
||||
this.lastYear = this.getYear(today);
|
||||
this.lastDate = this.getDate(today);
|
||||
this.lastTime = 0;
|
||||
this.refDate = today;
|
||||
this.isInString = '';
|
||||
this.USmode = 0;
|
||||
}
|
||||
|
||||
function evalFunc_pol(foreign, value) {
|
||||
return eval(((foreign == "-") ? '-' : '') + value);
|
||||
}
|
||||
|
||||
function evalFunc_evalObjValue(FObj, value) {
|
||||
var evallist = FObj.evallist;
|
||||
this.isInString = (FObj.is_in) ? '' + FObj.is_in : '';
|
||||
var index = 1;
|
||||
var theEvalType = (FObj.evallist) ? this.split(evallist, ",", index) : false;
|
||||
var newValue = value;
|
||||
while (theEvalType) {
|
||||
if (typeof TBE_EDITOR == 'object' && TBE_EDITOR.customEvalFunctions[theEvalType] && typeof TBE_EDITOR.customEvalFunctions[theEvalType] == 'function') {
|
||||
newValue = TBE_EDITOR.customEvalFunctions[theEvalType](newValue);
|
||||
} else {
|
||||
newValue = evalFunc.input(theEvalType, newValue);
|
||||
}
|
||||
index++;
|
||||
theEvalType = this.split(evallist, ",", index);
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
|
||||
function evalFunc_outputObjValue(FObj, value) {
|
||||
var evallist = FObj.evallist;
|
||||
var index = 1;
|
||||
var theEvalType = this.split(evallist, ",", index);
|
||||
var newValue = value;
|
||||
while (theEvalType) {
|
||||
if (theEvalType != 'required') {
|
||||
newValue = evalFunc.output(theEvalType, value, FObj);
|
||||
}
|
||||
index++;
|
||||
theEvalType = this.split(evallist, ",", index);
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
|
||||
function evalFunc_caseSwitch(type, inVal) {
|
||||
var theVal = '' + inVal;
|
||||
var newString = '';
|
||||
switch (type) {
|
||||
case "alpha":
|
||||
case "num":
|
||||
case "alphanum":
|
||||
case "alphanum_x":
|
||||
for (var a = 0; a < theVal.length; a++) {
|
||||
var theChar = theVal.substr(a, 1);
|
||||
var special = (theChar == '_' || theChar == '-');
|
||||
var alpha = (theChar >= 'a' && theChar <= 'z') || (theChar >= 'A' && theChar <= 'Z');
|
||||
var num = (theChar >= '0' && theChar <= '9');
|
||||
switch (type) {
|
||||
case "alphanum":
|
||||
special = 0;
|
||||
break;
|
||||
case "alpha":
|
||||
num = 0;
|
||||
special = 0;
|
||||
break;
|
||||
case "num":
|
||||
alpha = 0;
|
||||
special = 0;
|
||||
break;
|
||||
}
|
||||
if (alpha || num || special) {
|
||||
newString += theChar;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "is_in":
|
||||
if (this.isInString) {
|
||||
for (var a = 0; a < theVal.length; a++) {
|
||||
var theChar = theVal.substr(a, 1);
|
||||
if (this.isInString.indexOf(theChar) != -1) {
|
||||
newString += theChar;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newString = theVal;
|
||||
}
|
||||
break;
|
||||
case "nospace":
|
||||
newString = this.noSpace(theVal);
|
||||
break;
|
||||
case "upper":
|
||||
newString = theVal.toUpperCase();
|
||||
break;
|
||||
case "lower":
|
||||
newString = theVal.toLowerCase();
|
||||
break;
|
||||
default:
|
||||
return inVal;
|
||||
}
|
||||
return newString;
|
||||
}
|
||||
|
||||
function evalFunc_parseInt(value) {
|
||||
var theVal = '' + value;
|
||||
if (!value) {
|
||||
return 0;
|
||||
}
|
||||
for (var a = 0; a < theVal.length; a++) {
|
||||
if (theVal.substr(a, 1) != '0') {
|
||||
return parseInt(theVal.substr(a, theVal.length)) || 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function evalFunc_getNumChars(value) {
|
||||
var theVal = '' + value;
|
||||
if (!value) {
|
||||
return 0;
|
||||
}
|
||||
var outVal = "";
|
||||
for (var a = 0; a < theVal.length; a++) {
|
||||
if (theVal.substr(a, 1) == parseInt(theVal.substr(a, 1))) {
|
||||
outVal += theVal.substr(a, 1);
|
||||
}
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
|
||||
function evalFunc_parseDouble(value) {
|
||||
var theVal = "" + value;
|
||||
theVal = theVal.replace(/[^0-9,\.-]/g, "");
|
||||
var negative = theVal.substring(0, 1) === '-';
|
||||
theVal = theVal.replace(/-/g, "");
|
||||
theVal = theVal.replace(/,/g, ".");
|
||||
if (theVal.indexOf(".") == -1) {
|
||||
theVal += ".0";
|
||||
}
|
||||
var parts = theVal.split(".");
|
||||
var dec = parts.pop();
|
||||
theVal = Number(parts.join("") + "." + dec);
|
||||
if (negative) {
|
||||
theVal *= -1;
|
||||
}
|
||||
theVal = theVal.toFixed(2);
|
||||
|
||||
return theVal;
|
||||
}
|
||||
|
||||
function evalFunc_noSpace(value) {
|
||||
var theVal = '' + value;
|
||||
var newString = "";
|
||||
for (var a = 0; a < theVal.length; a++) {
|
||||
var theChar = theVal.substr(a, 1);
|
||||
if (theChar != ' ') {
|
||||
newString += theChar;
|
||||
}
|
||||
}
|
||||
return newString;
|
||||
}
|
||||
|
||||
function evalFunc_ltrim(value) {
|
||||
var theVal = '' + value;
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
for (var a = 0; a < theVal.length; a++) {
|
||||
if (theVal.substr(a, 1) != ' ') {
|
||||
return theVal.substr(a, theVal.length);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function evalFunc_btrim(value) {
|
||||
var theVal = '' + value;
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
for (var a = theVal.length; a > 0; a--) {
|
||||
if (theVal.substr(a - 1, 1) != ' ') {
|
||||
return theVal.substr(0, a);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function evalFunc_splitSingle(value) {
|
||||
var theVal = '' + value;
|
||||
this.values = new Array();
|
||||
this.pointer = 3;
|
||||
this.values[1] = theVal.substr(0, 2);
|
||||
this.values[2] = theVal.substr(2, 2);
|
||||
this.values[3] = theVal.substr(4, 10);
|
||||
}
|
||||
|
||||
function evalFunc_split(value) {
|
||||
this.values = new Array();
|
||||
this.valPol = new Array();
|
||||
this.pointer = 0;
|
||||
var numberMode = 0;
|
||||
var theVal = "";
|
||||
value += " ";
|
||||
for (var a = 0; a < value.length; a++) {
|
||||
var theChar = value.substr(a, 1);
|
||||
if (theChar < "0" || theChar > "9") {
|
||||
if (numberMode) {
|
||||
this.pointer++;
|
||||
this.values[this.pointer] = theVal;
|
||||
theVal = "";
|
||||
numberMode = 0;
|
||||
}
|
||||
if (theChar == "+" || theChar == "-") {
|
||||
this.valPol[this.pointer + 1] = theChar;
|
||||
}
|
||||
} else {
|
||||
theVal += theChar;
|
||||
numberMode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function evalFunc_input(type, inVal) {
|
||||
if (type == "md5") {
|
||||
return MD5(inVal);
|
||||
}
|
||||
if (type == "trim") {
|
||||
return this.ltrim(this.btrim(inVal));
|
||||
}
|
||||
if (type == "int") {
|
||||
return this.parseInt(inVal);
|
||||
}
|
||||
if (type == "double2") {
|
||||
return this.parseDouble(inVal);
|
||||
}
|
||||
|
||||
var today = new Date();
|
||||
var add = 0;
|
||||
var value = this.ltrim(inVal);
|
||||
var values = new evalFunc_split(value);
|
||||
var theCmd = value.substr(0, 1);
|
||||
value = this.caseSwitch(type, value);
|
||||
if (value == "") {
|
||||
return "";
|
||||
}
|
||||
switch (type) {
|
||||
case "datetime":
|
||||
switch (theCmd) {
|
||||
case "d":
|
||||
case "t":
|
||||
case "n":
|
||||
this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(today), 0);
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
case "+":
|
||||
case "-":
|
||||
if (this.lastTime == 0) {
|
||||
this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(today), 0);
|
||||
}
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
var index = value.indexOf(' ');
|
||||
if (index != -1) {
|
||||
var dateVal = this.input("date", value.substr(index, value.length));
|
||||
// set refDate so that evalFunc_input on time will work with correct DST information
|
||||
this.refDate = new Date(dateVal * 1000);
|
||||
this.lastTime = dateVal + this.input("time", value.substr(0, index));
|
||||
} else {
|
||||
// only date, no time
|
||||
this.lastTime = this.input("date", value);
|
||||
}
|
||||
}
|
||||
this.lastTime += add * 24 * 60 * 60;
|
||||
return this.lastTime;
|
||||
break;
|
||||
case "year":
|
||||
switch (theCmd) {
|
||||
case "d":
|
||||
case "t":
|
||||
case "n":
|
||||
this.lastYear = this.getYear(today);
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
case "+":
|
||||
case "-":
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (values.valPol[2]) {
|
||||
add = this.pol(values.valPol[2], this.parseInt(values.values[2]));
|
||||
}
|
||||
var year = (values.values[1]) ? this.parseInt(values.values[1]) : this.getYear(today);
|
||||
if ((year >= 0 && year < 38) || (year >= 70 && year < 100) || (year >= 1902 && year < 2038)) {
|
||||
if (year < 100) {
|
||||
year = (year < 38) ? year += 2000 : year += 1900;
|
||||
}
|
||||
} else {
|
||||
year = this.getYear(today);
|
||||
}
|
||||
this.lastYear = year;
|
||||
}
|
||||
this.lastYear += add;
|
||||
return this.lastYear;
|
||||
break;
|
||||
case "date":
|
||||
switch (theCmd) {
|
||||
case "d":
|
||||
case "t":
|
||||
case "n":
|
||||
this.lastDate = this.getTimestamp(today);
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
case "+":
|
||||
case "-":
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
var index = 4;
|
||||
if (values.valPol[index]) {
|
||||
add = this.pol(values.valPol[index], this.parseInt(values.values[index]));
|
||||
}
|
||||
if (values.values[1] && values.values[1].length > 2) {
|
||||
if (values.valPol[2]) {
|
||||
add = this.pol(values.valPol[2], this.parseInt(values.values[2]));
|
||||
}
|
||||
var temp = values.values[1];
|
||||
values = new evalFunc_splitSingle(temp);
|
||||
}
|
||||
|
||||
var year = (values.values[3]) ? this.parseInt(values.values[3]) : this.getYear(today);
|
||||
if ((year >= 0 && year < 38) || (year >= 70 && year < 100) || (year >= 1902 && year < 2038)) {
|
||||
if (year < 100) {
|
||||
year = (year < 38) ? year += 2000 : year += 1900;
|
||||
}
|
||||
} else {
|
||||
year = this.getYear(today);
|
||||
}
|
||||
var month = (values.values[this.USmode ? 1 : 2]) ? this.parseInt(values.values[this.USmode ? 1 : 2]) : today.getUTCMonth() + 1;
|
||||
var day = (values.values[this.USmode ? 2 : 1]) ? this.parseInt(values.values[this.USmode ? 2 : 1]) : today.getUTCDate();
|
||||
|
||||
var theTime = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
|
||||
|
||||
// Substract timezone offset from client
|
||||
this.lastDate = this.convertClientTimestampToUTC(this.getTimestamp(theTime), 0);
|
||||
}
|
||||
this.lastDate += add * 24 * 60 * 60;
|
||||
return this.lastDate;
|
||||
break;
|
||||
case "time":
|
||||
case "timesec":
|
||||
switch (theCmd) {
|
||||
case "d":
|
||||
case "t":
|
||||
case "n":
|
||||
this.lastTime = this.getTimeSecs(today);
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
case "+":
|
||||
case "-":
|
||||
if (this.lastTime == 0) {
|
||||
this.lastTime = this.getTimeSecs(today);
|
||||
}
|
||||
if (values.valPol[1]) {
|
||||
add = this.pol(values.valPol[1], this.parseInt(values.values[1]));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
var index = (type == "timesec") ? 4 : 3;
|
||||
if (values.valPol[index]) {
|
||||
add = this.pol(values.valPol[index], this.parseInt(values.values[index]));
|
||||
}
|
||||
if (values.values[1] && values.values[1].length > 2) {
|
||||
if (values.valPol[2]) {
|
||||
add = this.pol(values.valPol[2], this.parseInt(values.values[2]));
|
||||
}
|
||||
var temp = values.values[1];
|
||||
values = new evalFunc_splitSingle(temp);
|
||||
}
|
||||
var sec = (values.values[3]) ? this.parseInt(values.values[3]) : today.getUTCSeconds();
|
||||
if (sec > 59) {
|
||||
sec = 59;
|
||||
}
|
||||
var min = (values.values[2]) ? this.parseInt(values.values[2]) : today.getUTCMinutes();
|
||||
if (min > 59) {
|
||||
min = 59;
|
||||
}
|
||||
var hour = (values.values[1]) ? this.parseInt(values.values[1]) : today.getUTCHours();
|
||||
if (hour >= 24) {
|
||||
hour = 0;
|
||||
}
|
||||
|
||||
var theTime = new Date(this.getYear(this.refDate), this.refDate.getUTCMonth(), this.refDate.getUTCDate(), hour, min, ((type == "timesec") ? sec : 0));
|
||||
|
||||
// Substract timezone offset from client
|
||||
this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(theTime), 1);
|
||||
}
|
||||
this.lastTime += add * 60;
|
||||
if (this.lastTime < 0) {
|
||||
this.lastTime += 24 * 60 * 60;
|
||||
}
|
||||
return this.lastTime;
|
||||
break;
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
function evalFunc_output(type, value, FObj) {
|
||||
var theString = "";
|
||||
switch (type) {
|
||||
case "date":
|
||||
if (!parseInt(value)) {
|
||||
return '';
|
||||
}
|
||||
var theTime = new Date(parseInt(value) * 1000);
|
||||
if (this.USmode) {
|
||||
theString = (theTime.getUTCMonth() + 1) + '-' + theTime.getUTCDate() + '-' + this.getYear(theTime);
|
||||
} else {
|
||||
theString = theTime.getUTCDate() + '-' + (theTime.getUTCMonth() + 1) + '-' + this.getYear(theTime);
|
||||
}
|
||||
break;
|
||||
case "datetime":
|
||||
if (!parseInt(value)) {
|
||||
return '';
|
||||
}
|
||||
theString = this.output("time", value) + ' ' + this.output("date", value);
|
||||
break;
|
||||
case "time":
|
||||
case "timesec":
|
||||
if (!parseInt(value)) {
|
||||
return '';
|
||||
}
|
||||
var theTime = new Date(parseInt(value) * 1000);
|
||||
var h = theTime.getUTCHours();
|
||||
var m = theTime.getUTCMinutes();
|
||||
var s = theTime.getUTCSeconds();
|
||||
theString = h + ':' + ((m < 10) ? '0' : '') + m + ((type == "timesec") ? ':' + ((s < 10) ? '0' : '') + s : '');
|
||||
break;
|
||||
case "password":
|
||||
theString = (value) ? "********" : "";
|
||||
break;
|
||||
case "int":
|
||||
theString = (FObj.checkbox && value == FObj.checkboxValue) ? '' : value;
|
||||
break;
|
||||
default:
|
||||
theString = value;
|
||||
}
|
||||
return theString;
|
||||
}
|
||||
|
||||
function evalFunc_getSecs(timeObj) {
|
||||
return timeObj.getUTCSeconds();
|
||||
}
|
||||
|
||||
// Seconds since midnight:
|
||||
function evalFunc_getTime(timeObj) {
|
||||
return timeObj.getUTCHours() * 60 * 60 + timeObj.getUTCMinutes() * 60 + this.getSecs(timeObj);
|
||||
}
|
||||
|
||||
function evalFunc_getYear(timeObj) {
|
||||
return timeObj.getUTCFullYear();
|
||||
}
|
||||
|
||||
// Seconds since midnight with client timezone offset:
|
||||
function evalFunc_getTimeSecs(timeObj) {
|
||||
return timeObj.getHours() * 60 * 60 + timeObj.getMinutes() * 60 + timeObj.getSeconds();
|
||||
}
|
||||
|
||||
function evalFunc_getDate(timeObj) {
|
||||
var theTime = new Date(this.getYear(timeObj), timeObj.getUTCMonth(), timeObj.getUTCDate());
|
||||
return this.getTimestamp(theTime);
|
||||
}
|
||||
|
||||
function evalFunc_dummy(evallist, is_in, checkbox, checkboxValue) {
|
||||
this.evallist = evallist;
|
||||
this.is_in = is_in;
|
||||
this.checkboxValue = checkboxValue;
|
||||
this.checkbox = checkbox;
|
||||
}
|
||||
|
||||
function evalFunc_splitStr(theStr1, delim, index) {
|
||||
var theStr = '' + theStr1;
|
||||
var lengthOfDelim = delim.length;
|
||||
sPos = -lengthOfDelim;
|
||||
if (index < 1) {
|
||||
index = 1;
|
||||
}
|
||||
for (a = 1; a < index; a++) {
|
||||
sPos = theStr.indexOf(delim, sPos + lengthOfDelim);
|
||||
if (sPos == -1) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
ePos = theStr.indexOf(delim, sPos + lengthOfDelim);
|
||||
if (ePos == -1) {
|
||||
ePos = theStr.length;
|
||||
}
|
||||
return (theStr.substring(sPos + lengthOfDelim, ePos));
|
||||
}
|
||||
|
||||
function evalFunc_getTimestamp(timeObj) {
|
||||
return Date.parse(timeObj) / 1000;
|
||||
}
|
||||
|
||||
// Substract timezone offset from client to a timestamp to get UTC-timestamp to be send to server
|
||||
function evalFunc_convertClientTimestampToUTC(timestamp, timeonly) {
|
||||
var timeObj = new Date(timestamp * 1000);
|
||||
timeObj.setTime((timestamp - timeObj.getTimezoneOffset() * 60) * 1000);
|
||||
if (timeonly) {
|
||||
// only seconds since midnight
|
||||
return this.getTime(timeObj);
|
||||
} else {
|
||||
// seconds since the "unix-epoch"
|
||||
return this.getTimestamp(timeObj);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,349 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains JavaScript for TYPO3 Core Form generator - AKA "TCEforms"
|
||||
*/
|
||||
|
||||
var TBE_EDITOR = {
|
||||
/* Example:
|
||||
elements: {
|
||||
'data-parentPid-table-uid': {
|
||||
'field': {
|
||||
'range': [0, 100],
|
||||
'rangeImg': '',
|
||||
'required': true,
|
||||
'requiredImg': ''
|
||||
}
|
||||
}
|
||||
},
|
||||
*/
|
||||
|
||||
elements: {},
|
||||
nested: {'field': {}, 'level': {}},
|
||||
ignoreElements: [],
|
||||
actionChecks: {submit: []},
|
||||
customEvalFunctions: {},
|
||||
|
||||
formname: 'editform',
|
||||
isChanged: 0,
|
||||
|
||||
doSaveFieldName: 0,
|
||||
|
||||
labels: {},
|
||||
|
||||
clearBeforeSettingFormValueFromBrowseWin: [],
|
||||
|
||||
// Handling of data structures:
|
||||
removeElement: function(record) {
|
||||
if (TBE_EDITOR.elements && TBE_EDITOR.elements[record]) {
|
||||
delete(TBE_EDITOR.elements[record]);
|
||||
}
|
||||
},
|
||||
removeElementArray: function(removeStack) {
|
||||
if (removeStack && removeStack.length) {
|
||||
TBE_EDITOR.ignoreElements = removeStack;
|
||||
for (var i = removeStack.length; i >= 0; i--) {
|
||||
TBE_EDITOR.removeElement(removeStack[i]);
|
||||
}
|
||||
TBE_EDITOR.ignoreElements = [];
|
||||
}
|
||||
},
|
||||
getElement: function(record, field, type) {
|
||||
var result = null;
|
||||
var element;
|
||||
|
||||
if (TBE_EDITOR.elements && TBE_EDITOR.elements[record] && TBE_EDITOR.elements[record][field]) {
|
||||
element = TBE_EDITOR.elements[record][field];
|
||||
if (type) {
|
||||
if (element[type]) result = element;
|
||||
} else {
|
||||
result = element;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
checkElements: function() {
|
||||
return (document.getElementsByClassName('has-error').length == 0);
|
||||
},
|
||||
addActionChecks: function(type, checks) {
|
||||
TBE_EDITOR.actionChecks[type].push(checks);
|
||||
},
|
||||
|
||||
fieldChanged_fName: function(fName, el) {
|
||||
var idx = 2;
|
||||
var table = TBE_EDITOR.split(fName, "[", idx);
|
||||
var uid = TBE_EDITOR.split(fName, "[", idx + 1);
|
||||
var field = TBE_EDITOR.split(fName, "[", idx + 2);
|
||||
|
||||
table = table.substr(0, table.length - 1);
|
||||
uid = uid.substr(0, uid.length - 1);
|
||||
field = field.substr(0, field.length - 1);
|
||||
TBE_EDITOR.fieldChanged(table, uid, field, el);
|
||||
},
|
||||
fieldChanged: function(table, uid, field, el) {
|
||||
var theField = 'data[' + table + '][' + uid + '][' + field + ']';
|
||||
TBE_EDITOR.isChanged = 1;
|
||||
|
||||
// modify the "field has changed" info by adding a class to the container element (based on palette or main field)
|
||||
var $formField = $('[name="' + el + '"]');
|
||||
var $humanReadableField = $('[data-formengine-input-name="' + el + '"]');
|
||||
if (!$formField.is($humanReadableField)) {
|
||||
$humanReadableField.triggerHandler('change');
|
||||
}
|
||||
// add class to palette field
|
||||
$formField.closest('.t3js-formengine-palette-field').addClass('has-change');
|
||||
|
||||
if (TYPO3.FormEngine && TYPO3.FormEngine.Validation) {
|
||||
TYPO3.FormEngine.Validation.updateInputField(theField);
|
||||
TYPO3.FormEngine.Validation.validate();
|
||||
}
|
||||
},
|
||||
isFormChanged: function(noAlert) {
|
||||
if (TBE_EDITOR.isChanged && !noAlert && confirm(TYPO3.lang['FormEngine.fieldsChanged'])) {
|
||||
return 0;
|
||||
}
|
||||
return TBE_EDITOR.isChanged;
|
||||
},
|
||||
checkAndDoSubmit: function(sendAlert) {
|
||||
if (TBE_EDITOR.checkSubmit(sendAlert)) {
|
||||
TBE_EDITOR.submitForm();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Checks if the form can be submitted according to any possible restrains like required values, item numbers etc.
|
||||
* Returns true if the form can be submitted, otherwise false (and might issue an alert message, if "sendAlert" is 1)
|
||||
* If "sendAlert" is false, no error message will be shown upon false return value (if "1" then it will).
|
||||
* If "sendAlert" is "-1" then the function will ALWAYS return true regardless of constraints (except if login has expired) - this is used in the case where a form field change requests a form update and where it is accepted that constraints are not observed (form layout might change so other fields are shown...)
|
||||
*/
|
||||
checkSubmit: function(sendAlert) {
|
||||
var funcIndex, funcMax, funcRes;
|
||||
var OK = 1;
|
||||
var STOP = 0;
|
||||
|
||||
// $this->additionalJS_submit:
|
||||
if (TBE_EDITOR.actionChecks && TBE_EDITOR.actionChecks.submit) {
|
||||
for (funcIndex = 0, funcMax = TBE_EDITOR.actionChecks.submit.length; funcIndex < funcMax; funcIndex++) {
|
||||
try {
|
||||
eval(TBE_EDITOR.actionChecks.submit[funcIndex]);
|
||||
} catch (error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (STOP) {
|
||||
// return false immediately, if the code in additionalJS_submit set STOP variable.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!OK) {
|
||||
if (!confirm(unescape("SYSTEM ERROR: One or more Rich Text Editors on the page could not be contacted. This IS an error, although it should not be regular.\nYou can save the form now by pressing OK, but you will loose the Rich Text Editor content if you do.\n\nPlease report the error to your administrator if it persists."))) {
|
||||
return false;
|
||||
} else {
|
||||
OK = 1;
|
||||
}
|
||||
}
|
||||
if (!TBE_EDITOR.checkElements()) {
|
||||
OK = 0;
|
||||
}
|
||||
|
||||
if (OK || sendAlert == -1) {
|
||||
return true;
|
||||
} else {
|
||||
if (sendAlert) {
|
||||
var t = (opener != null && typeof opener.top.TYPO3 !== 'undefined' ? opener.top : top);
|
||||
t.TYPO3.Modal.confirm(
|
||||
t.TYPO3.lang['alert'] || 'Alert',
|
||||
TYPO3.lang['FormEngine.fieldsMissing'],
|
||||
t.TYPO3.Severity.error,
|
||||
[
|
||||
{
|
||||
text: t.TYPO3.lang['button.ok'] || 'OK',
|
||||
active: true,
|
||||
btnClass: 'btn-default',
|
||||
name: 'ok'
|
||||
}
|
||||
]
|
||||
).on('button.clicked', function(e) {
|
||||
t.TYPO3.Modal.dismiss();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
submitForm: function() {
|
||||
if (TBE_EDITOR.doSaveFieldName) {
|
||||
document[TBE_EDITOR.formname][TBE_EDITOR.doSaveFieldName].value = 1;
|
||||
}
|
||||
|
||||
const elements = [
|
||||
'button[form]',
|
||||
'button[name^="_save"]',
|
||||
'a[data-name^="_save"]',
|
||||
'button[name="CMD"][value^="save"]',
|
||||
'a[data-name="CMD"][data-value^="save"]',
|
||||
].join(',');
|
||||
|
||||
const button = document.querySelector(elements);
|
||||
if (button !== null) {
|
||||
button.disabled = true;
|
||||
|
||||
TYPO3.Icons.getIcon('spinner-circle-dark', TYPO3.Icons.sizes.small).done(function (markup) {
|
||||
button.querySelector('.t3js-icon').outerHTML = markup;
|
||||
});
|
||||
}
|
||||
|
||||
// Set a short timeout to allow other JS processes to complete, in particular those from
|
||||
// EXT:backend/Resources/Public/JavaScript/FormEngine.js (reference: http://forge.typo3.org/issues/58755).
|
||||
// TODO: This should be solved in a better way when this script is refactored.
|
||||
window.setTimeout(function() {
|
||||
var formElement = document.getElementsByName(TBE_EDITOR.formname).item(0);
|
||||
$('[data-active-password]:not([type=password])').each(
|
||||
function(index, element) {
|
||||
element.setAttribute('type', 'password');
|
||||
element.blur();
|
||||
}
|
||||
);
|
||||
formElement.submit();
|
||||
}, 100);
|
||||
},
|
||||
split: function(theStr1, delim, index) {
|
||||
var theStr = "" + theStr1;
|
||||
var lengthOfDelim = delim.length;
|
||||
sPos = -lengthOfDelim;
|
||||
if (index < 1) {
|
||||
index = 1;
|
||||
}
|
||||
for (var a = 1; a < index; a++) {
|
||||
sPos = theStr.indexOf(delim, sPos + lengthOfDelim);
|
||||
if (sPos == -1) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
ePos = theStr.indexOf(delim, sPos + lengthOfDelim);
|
||||
if (ePos == -1) {
|
||||
ePos = theStr.length;
|
||||
}
|
||||
return (theStr.substring(sPos + lengthOfDelim, ePos));
|
||||
},
|
||||
curSelected: function(theField) {
|
||||
var fObjSel = $('[data-formengine-input-name="' + theField + '"]').get(1);
|
||||
var retVal = "";
|
||||
if (fObjSel) {
|
||||
if (fObjSel.type == 'select-multiple' || fObjSel.type == 'select-one') {
|
||||
var l = fObjSel.length;
|
||||
for (a = 0; a < l; a++) {
|
||||
if (fObjSel.options[a].selected == 1) {
|
||||
retVal += fObjSel.options[a].value + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
},
|
||||
rawurlencode: function(str, maxlen) {
|
||||
var output = str;
|
||||
if (maxlen) output = output.substr(0, 200);
|
||||
output = encodeURIComponent(output);
|
||||
return output;
|
||||
},
|
||||
str_replace: function(match, replace, string) {
|
||||
var input = '' + string;
|
||||
var matchStr = '' + match;
|
||||
if (!matchStr) {
|
||||
return string;
|
||||
}
|
||||
var output = '';
|
||||
var pointer = 0;
|
||||
var pos = input.indexOf(matchStr);
|
||||
while (pos != -1) {
|
||||
output += '' + input.substr(pointer, pos - pointer) + replace;
|
||||
pointer = pos + matchStr.length;
|
||||
pos = input.indexOf(match, pos + 1);
|
||||
}
|
||||
output += '' + input.substr(pointer);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
// backwards compatibility for extensions
|
||||
var TBE_EDITOR_setHiddenContent = TBE_EDITOR.setHiddenContent;
|
||||
var TBE_EDITOR_isChanged = TBE_EDITOR.isChanged;
|
||||
var TBE_EDITOR_fieldChanged_fName = TBE_EDITOR.fieldChanged_fName;
|
||||
var TBE_EDITOR_fieldChanged = TBE_EDITOR.fieldChanged;
|
||||
var TBE_EDITOR_isFormChanged = TBE_EDITOR.isFormChanged;
|
||||
var TBE_EDITOR_checkAndDoSubmit = TBE_EDITOR.checkAndDoSubmit;
|
||||
var TBE_EDITOR_checkSubmit = TBE_EDITOR.checkSubmit;
|
||||
var TBE_EDITOR_submitForm = TBE_EDITOR.submitForm;
|
||||
var TBE_EDITOR_split = TBE_EDITOR.split;
|
||||
var TBE_EDITOR_curSelected = TBE_EDITOR.curSelected;
|
||||
var TBE_EDITOR_rawurlencode = TBE_EDITOR.rawurlencode;
|
||||
var TBE_EDITOR_str_replace = TBE_EDITOR.str_replace;
|
||||
|
||||
|
||||
var typo3form = {
|
||||
fieldSet: function(theField, evallist, is_in, checkbox, checkboxValue) {
|
||||
if (document[TBE_EDITOR.formname][theField]) {
|
||||
var theFObj = new evalFunc_dummy(evallist, is_in, checkbox, checkboxValue);
|
||||
var theValue = document[TBE_EDITOR.formname][theField].value;
|
||||
if (checkbox && theValue == checkboxValue) {
|
||||
document.querySelector('form[name="' + TBE_EDITOR.formname + '"] [data-formengine-input-name="' + theField + '"]').value = "";
|
||||
if (document[TBE_EDITOR.formname][theField + "_cb"]) document[TBE_EDITOR.formname][theField + "_cb"].checked = "";
|
||||
} else {
|
||||
document.querySelector('form[name="' + TBE_EDITOR.formname + '"] [data-formengine-input-name="' + theField + '"]').value = evalFunc.outputObjValue(theFObj, theValue);
|
||||
if (document[TBE_EDITOR.formname][theField + "_cb"]) document[TBE_EDITOR.formname][theField + "_cb"].checked = "on";
|
||||
}
|
||||
}
|
||||
},
|
||||
fieldGet: function(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off, checkSetValue) {
|
||||
if (document[TBE_EDITOR.formname][theField]) {
|
||||
var theFObj = new evalFunc_dummy(evallist, is_in, checkbox, checkboxValue);
|
||||
if (checkbox_off) {
|
||||
if (document[TBE_EDITOR.formname][theField + "_cb"].checked) {
|
||||
var split = evallist.split(',');
|
||||
for (var i = 0; split.length > i; i++) {
|
||||
var el = split[i].replace(/ /g, '');
|
||||
if (el == 'datetime' || el == 'date') {
|
||||
var now = new Date();
|
||||
checkSetValue = Date.parse(now) / 1000 - now.getTimezoneOffset() * 60;
|
||||
break;
|
||||
} else if (el == 'time' || el == 'timesec') {
|
||||
checkSetValue = evalFunc_getTimeSecs(new Date());
|
||||
break;
|
||||
}
|
||||
}
|
||||
document[TBE_EDITOR.formname][theField].value = checkSetValue;
|
||||
} else {
|
||||
document[TBE_EDITOR.formname][theField].value = checkboxValue;
|
||||
}
|
||||
} else {
|
||||
document[TBE_EDITOR.formname][theField].value = evalFunc.evalObjValue(theFObj, document.querySelector('form[name="' + TBE_EDITOR.formname + '"] [data-formengine-input-name="' + theField + '"]').value);
|
||||
}
|
||||
typo3form.fieldSet(theField, evallist, is_in, checkbox, checkboxValue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// @TODO: This function is a copy from jsfunc.evalfield.js
|
||||
// @TODO: Remove it later, after TBE_EDITOR is not used anymore.
|
||||
function evalFunc_dummy(evallist, is_in, checkbox, checkboxValue) {
|
||||
this.evallist = evallist;
|
||||
this.is_in = is_in;
|
||||
this.checkboxValue = checkboxValue;
|
||||
this.checkbox = checkbox;
|
||||
}
|
||||
|
||||
// backwards compatibility for extensions
|
||||
var typo3FormFieldSet = typo3form.fieldSet;
|
||||
var typo3FormFieldGet = typo3form.fieldGet;
|
||||
@@ -0,0 +1,224 @@
|
||||
/**
|
||||
*
|
||||
* MD5 (Message-Digest Algorithm)
|
||||
* http://www.webtoolkit.info/
|
||||
*
|
||||
**/
|
||||
|
||||
function MD5(string) {
|
||||
|
||||
function RotateLeft(lValue, iShiftBits) {
|
||||
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
|
||||
}
|
||||
|
||||
function AddUnsigned(lX, lY) {
|
||||
var lX4, lY4, lX8, lY8, lResult;
|
||||
lX8 = (lX & 0x80000000);
|
||||
lY8 = (lY & 0x80000000);
|
||||
lX4 = (lX & 0x40000000);
|
||||
lY4 = (lY & 0x40000000);
|
||||
lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
|
||||
if (lX4 & lY4) {
|
||||
return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
|
||||
}
|
||||
if (lX4 | lY4) {
|
||||
if (lResult & 0x40000000) {
|
||||
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
|
||||
} else {
|
||||
return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
|
||||
}
|
||||
} else {
|
||||
return (lResult ^ lX8 ^ lY8);
|
||||
}
|
||||
}
|
||||
|
||||
function F(x, y, z) {
|
||||
return (x & y) | ((~x) & z);
|
||||
}
|
||||
|
||||
function G(x, y, z) {
|
||||
return (x & z) | (y & (~z));
|
||||
}
|
||||
|
||||
function H(x, y, z) {
|
||||
return (x ^ y ^ z);
|
||||
}
|
||||
|
||||
function I(x, y, z) {
|
||||
return (y ^ (x | (~z)));
|
||||
}
|
||||
|
||||
function FF(a, b, c, d, x, s, ac) {
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
|
||||
return AddUnsigned(RotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
function GG(a, b, c, d, x, s, ac) {
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
|
||||
return AddUnsigned(RotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
function HH(a, b, c, d, x, s, ac) {
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
|
||||
return AddUnsigned(RotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
function II(a, b, c, d, x, s, ac) {
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
|
||||
return AddUnsigned(RotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
function ConvertToWordArray(string) {
|
||||
var lWordCount;
|
||||
var lMessageLength = string.length;
|
||||
var lNumberOfWords_temp1 = lMessageLength + 8;
|
||||
var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
|
||||
var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
|
||||
var lWordArray = Array(lNumberOfWords - 1);
|
||||
var lBytePosition = 0;
|
||||
var lByteCount = 0;
|
||||
while (lByteCount < lMessageLength) {
|
||||
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
||||
lBytePosition = (lByteCount % 4) * 8;
|
||||
lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
|
||||
lByteCount++;
|
||||
}
|
||||
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
||||
lBytePosition = (lByteCount % 4) * 8;
|
||||
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
|
||||
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
|
||||
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
|
||||
return lWordArray;
|
||||
};
|
||||
|
||||
function WordToHex(lValue) {
|
||||
var WordToHexValue = "", WordToHexValue_temp = "", lByte, lCount;
|
||||
for (lCount = 0; lCount <= 3; lCount++) {
|
||||
lByte = (lValue >>> (lCount * 8)) & 255;
|
||||
WordToHexValue_temp = "0" + lByte.toString(16);
|
||||
WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2);
|
||||
}
|
||||
return WordToHexValue;
|
||||
};
|
||||
|
||||
function Utf8Encode(string) {
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
var utftext = "";
|
||||
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
|
||||
var c = string.charCodeAt(n);
|
||||
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
else if ((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return utftext;
|
||||
};
|
||||
|
||||
var x = Array();
|
||||
var k, AA, BB, CC, DD, a, b, c, d;
|
||||
var S11 = 7, S12 = 12, S13 = 17, S14 = 22;
|
||||
var S21 = 5, S22 = 9, S23 = 14, S24 = 20;
|
||||
var S31 = 4, S32 = 11, S33 = 16, S34 = 23;
|
||||
var S41 = 6, S42 = 10, S43 = 15, S44 = 21;
|
||||
|
||||
string = Utf8Encode(string);
|
||||
|
||||
x = ConvertToWordArray(string);
|
||||
|
||||
a = 0x67452301;
|
||||
b = 0xEFCDAB89;
|
||||
c = 0x98BADCFE;
|
||||
d = 0x10325476;
|
||||
|
||||
for (k = 0; k < x.length; k += 16) {
|
||||
AA = a;
|
||||
BB = b;
|
||||
CC = c;
|
||||
DD = d;
|
||||
a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
|
||||
d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
|
||||
c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
|
||||
b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
|
||||
a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
|
||||
d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
|
||||
c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
|
||||
b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
|
||||
a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
|
||||
d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
|
||||
c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
|
||||
b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
|
||||
a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
|
||||
d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
|
||||
c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
|
||||
b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
|
||||
a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
|
||||
d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
|
||||
c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
|
||||
b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
|
||||
a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
|
||||
d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
|
||||
c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
|
||||
b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
|
||||
a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
|
||||
d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
|
||||
c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
|
||||
b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
|
||||
a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
|
||||
d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
|
||||
c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
|
||||
b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
|
||||
a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
|
||||
d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
|
||||
c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
|
||||
b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
|
||||
a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
|
||||
d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
|
||||
c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
|
||||
b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
|
||||
a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
|
||||
d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
|
||||
c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
|
||||
b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
|
||||
a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
|
||||
d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
|
||||
c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
|
||||
b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
|
||||
a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
|
||||
d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
|
||||
c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
|
||||
b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
|
||||
a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
|
||||
d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
|
||||
c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
|
||||
b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
|
||||
a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
|
||||
d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
|
||||
c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
|
||||
b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
|
||||
a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
|
||||
d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
|
||||
c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
|
||||
b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
|
||||
a = AddUnsigned(a, AA);
|
||||
b = AddUnsigned(b, BB);
|
||||
c = AddUnsigned(c, CC);
|
||||
d = AddUnsigned(d, DD);
|
||||
}
|
||||
|
||||
var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
|
||||
|
||||
return temp.toLowerCase();
|
||||
}
|
||||
Reference in new issue
Block a user