[TASK] Migrate Severity to TypeScript 80/55780/5
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 17 Feb 2018 18:46:43 +0000 (19:46 +0100)
committerAndreas Wolf <andreas.wolf@typo3.org>
Sun, 18 Feb 2018 16:47:00 +0000 (17:47 +0100)
Change-Id: I5b738983f733da77100830b841419ba9d12fdf23
Resolves: #83955
Releases: master
Reviewed-on: https://review.typo3.org/55780
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
13 files changed:
Build/types/TYPO3/index.d.ts
typo3/sysext/backend/Resources/Private/TypeScript/DragUploader.ts
typo3/sysext/backend/Resources/Private/TypeScript/GridEditor.ts
typo3/sysext/backend/Resources/Private/TypeScript/InfoWindow.ts
typo3/sysext/backend/Resources/Private/TypeScript/RenameFile.ts
typo3/sysext/backend/Resources/Private/TypeScript/Severity.ts [new file with mode: 0644]
typo3/sysext/backend/Resources/Private/TypeScript/Wizard/NewContentElement.ts
typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js
typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js
typo3/sysext/backend/Resources/Public/JavaScript/InfoWindow.js
typo3/sysext/backend/Resources/Public/JavaScript/RenameFile.js
typo3/sysext/backend/Resources/Public/JavaScript/Severity.js
typo3/sysext/backend/Resources/Public/JavaScript/Wizard/NewContentElement.js

index d114aad..0796631 100644 (file)
@@ -46,14 +46,6 @@ declare namespace TYPO3 {
         public error(title: string, message: string, duration: Number): string;
         public showMessage(title: string, message: string, severity: Number, duration?: Number): string;
       }
-      export class Severity {
-        public readonly notice: number;
-        public readonly info: number;
-        public readonly ok: number;
-        public readonly warning: number;
-        public readonly: number;
-        public getCssClass(severity: number): string;
-      }
     }
   }
 }
@@ -78,10 +70,6 @@ declare module 'TYPO3/CMS/Backend/Notification' {
   export = new TYPO3.CMS.Backend.Notification();
 }
 
-declare module 'TYPO3/CMS/Backend/Severity' {
-  export = new TYPO3.CMS.Backend.Severity();
-}
-
 // type definition for global namespace object
 interface Window {
   TYPO3: any;
index b1e7a32..fe66787 100644 (file)
@@ -20,7 +20,7 @@ import moment = require('moment');
 import NProgress = require('nprogress');
 import Modal = require('TYPO3/CMS/Backend/Modal');
 import Notification = require('TYPO3/CMS/Backend/Notification');
-import Severity = require('TYPO3/CMS/Backend/Severity');
+import Severity = require('./Severity');
 
 /**
  * Possible actions for conflicts w/ existing files
index c022e0a..e9bda7c 100644 (file)
@@ -14,7 +14,7 @@
 import 'bootstrap';
 import * as $ from 'jquery';
 import Modal = require('TYPO3/CMS/Backend/Modal');
-import Severity = require('TYPO3/CMS/Backend/Severity');
+import Severity = require('./Severity');
 
 /**
  * GridEditorConfigurationInterface
index a7aa9e6..9c1fd8f 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 import Modal = require('TYPO3/CMS/Backend/Modal');
-import Severity = require('TYPO3/CMS/Backend/Severity');
+import Severity = require('./Severity');
 
 /**
  * Module: TYPO3/CMS/Backend/InfoWindow
index 2bba56b..db6cf04 100644 (file)
@@ -13,7 +13,7 @@
 
 import * as $ from 'jquery';
 import Modal = require('TYPO3/CMS/Backend/Modal');
-import Severity = require('TYPO3/CMS/Backend/Severity');
+import Severity = require('./Severity');
 
 /**
  * Module: TYPO3/CMS/Backend/RenameFile
diff --git a/typo3/sysext/backend/Resources/Private/TypeScript/Severity.ts b/typo3/sysext/backend/Resources/Private/TypeScript/Severity.ts
new file mode 100644 (file)
index 0000000..afcf647
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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!
+ */
+
+enum SeverityEnum {
+  notice = -2,
+  info = -1,
+  ok = 0,
+  warning = 1,
+  error = 2
+}
+
+/**
+ * Module: TYPO3/CMS/Backend/Severity
+ * Severity for the TYPO3 backend
+ */
+class Severity {
+  public static notice: number = SeverityEnum.notice;
+  public static info: number = SeverityEnum.info;
+  public static ok: number = SeverityEnum.ok;
+  public static warning: number = SeverityEnum.warning;
+  public static error: number = SeverityEnum.error;
+
+  /**
+   * Gets the CSS class for the severity
+   *
+   * @param {SeverityEnum} severity
+   * @returns {string}
+   */
+  public static getCssClass(severity: SeverityEnum): string {
+    let severityClass: string;
+
+    switch (severity) {
+      case SeverityEnum.notice:
+        severityClass = 'notice';
+        break;
+      case SeverityEnum.ok:
+        severityClass = 'success';
+        break;
+      case SeverityEnum.warning:
+        severityClass = 'warning';
+        break;
+      case SeverityEnum.error:
+        severityClass = 'danger';
+        break;
+      case SeverityEnum.info:
+      default:
+        severityClass = 'info';
+    }
+
+    return severityClass;
+  }
+}
+
+let severityObject;
+try {
+  // fetch from opening window
+  if (window.opener && window.opener.TYPO3 && window.opener.TYPO3.Severity) {
+    severityObject = window.opener.TYPO3.Severity;
+  }
+
+  // fetch from parent
+  if (parent && parent.window.TYPO3 && parent.window.TYPO3.Severity) {
+    severityObject = parent.window.TYPO3.Severity;
+  }
+
+  // fetch object from outer frame
+  if (top && top.TYPO3 && top.TYPO3.Severity) {
+    severityObject = top.TYPO3.Severity;
+  }
+} 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.
+}
+
+if (!severityObject) {
+  severityObject = Severity;
+}
+
+TYPO3.Storage = severityObject;
+export = severityObject;
index f207e54..9af8785 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 import Modal = require('TYPO3/CMS/Backend/Modal');
-import Severity = require('TYPO3/CMS/Backend/Severity');
+import Severity = require('../Severity');
 
 /**
  * Module: TYPO3/CMS/Backend/Wizard/NewContentElement
index ac35b77..4a647a7 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","moment","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Severity"],function(a,b,c,d,e,f,g,h){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var i;!function(a){a.OVERRIDE="replace",a.RENAME="rename",a.SKIP="cancel",a.USE_EXISTING="useExisting"}(i||(i={}));var j=function(){function a(a){var b=this;this.askForOverride=[],this.percentagePerFile=1,this.dragFileIntoDocument=function(a){return a.stopPropagation(),a.preventDefault(),c(a.currentTarget).addClass("drop-in-progress"),b.showDropzone(),!1},this.dragAborted=function(a){return a.stopPropagation(),a.preventDefault(),c(a.currentTarget).removeClass("drop-in-progress"),!1},this.ignoreDrop=function(a){return a.stopPropagation(),a.preventDefault(),b.dragAborted(a),!1},this.handleDrop=function(a){b.ignoreDrop(a),b.processFiles(a.originalEvent.dataTransfer.files),b.$dropzone.removeClass("drop-status-ok")},this.fileInDropzone=function(){b.$dropzone.addClass("drop-status-ok")},this.fileOutOfDropzone=function(){b.$dropzone.removeClass("drop-status-ok")},this.$body=c("body"),this.$element=c(a);var d=void 0!==this.$element.data("dropzoneTrigger");this.$trigger=c(this.$element.data("dropzoneTrigger")),this.$dropzone=c("<div />").addClass("dropzone").hide(),this.irreObjectUid=this.$element.data("fileIrreObject");var e=this.$element.data("dropzoneTarget");return this.irreObjectUid&&0!==this.$element.nextAll(e).length?(this.dropZoneInsertBefore=!0,this.$dropzone.insertBefore(e)):(this.dropZoneInsertBefore=!1,this.$dropzone.insertAfter(e)),this.$dropzoneMask=c("<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=c(this.$element.data("progress-container")),this.fileListColumnCount=c("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(a){return b.handleDrop(a)}),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(){b.fileInput.click()}),c("<span />").addClass("dropzone-close").click(this.hideDropzone).appendTo(this.$dropzone),0===this.$fileList.length&&(this.$fileList=c("<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(){b.processFiles(Array.apply(null,b.fileInput.files))}),void this.bindUploadButton(d===!0?this.$trigger:this.$element)):void console.warn("Browser has no Drag and drop capabilities; cannot initialize DragUploader")}return a.prototype.showDropzone=function(){this.$dropzone.show()},a.prototype.hideDropzone=function(a){a.stopPropagation(),a.preventDefault(),this.$dropzone.hide()},a.prototype.processFiles=function(a){var b=this;this.queueLength=a.length,this.$fileList.is(":visible")||this.$fileList.show(),e.start(),this.percentagePerFile=1/a.length;var d=[];c.each(a,function(a,f){d[parseInt(a,10)]=c.ajax({url:TYPO3.settings.ajaxUrls.file_exists,data:{fileName:f.name,fileTarget:b.target},cache:!1,success:function(a){var c="undefined"!=typeof a.uid;if(c)b.askForOverride.push({original:a,uploaded:f,action:b.irreObjectUid?i.USE_EXISTING:i.SKIP}),e.inc(b.percentagePerFile);else{new k(b,f,i.SKIP)}}})}),c.when.apply(c,d).done(function(){b.drawOverrideModal(),e.done()}),this.fileInput.value=""},a.prototype.bindUploadButton=function(a){var b=this;a.click(function(a){a.preventDefault(),b.fileInput.click(),b.showDropzone()})},a.prototype.decrementQueueLength=function(){this.queueLength>0&&(this.queueLength--,0===this.queueLength&&c.ajax({url:TYPO3.settings.ajaxUrls.flashmessages_render,cache:!1,success:function(a){c.each(a,function(a,b){g.showMessage(b.title,b.message,b.severity)})}}))},a.prototype.drawOverrideModal=function(){var a=this,b=Object.keys(this.askForOverride).length;if(0!==b){for(var e=c("<div/>").append(c("<p/>").text(TYPO3.lang["file_upload.existingfiles.description"]),c("<table/>",{class:"table"}).append(c("<thead/>").append(c("<tr />").append(c("<th/>"),c("<th/>").text(TYPO3.lang["file_upload.header.originalFile"]),c("<th/>").text(TYPO3.lang["file_upload.header.uploadedFile"]),c("<th/>").text(TYPO3.lang["file_upload.header.action"]))))),g=0;g<b;++g){var j=c("<tr />").append(c("<td />").append(""!==this.askForOverride[g].original.thumbUrl?c("<img />",{src:this.askForOverride[g].original.thumbUrl,height:40}):c(this.askForOverride[g].original.icon)),c("<td />").html(this.askForOverride[g].uploaded.name+" ("+l.fileSizeAsString(this.askForOverride[g].uploaded.size)+")<br>"+d(this.askForOverride[g].uploaded.lastModifiedDate,"x").format("YYYY-MM-DD HH:mm")),c("<td />").html(this.askForOverride[g].uploaded.name+" ("+l.fileSizeAsString(this.askForOverride[g].original.size)+")<br>"+d(this.askForOverride[g].original.mtime,"X").format("YYYY-MM-DD HH:mm")),c("<td />").append(c("<select />",{class:"form-control t3js-actions","data-override":g}).append(this.irreObjectUid?c("<option/>").val(i.USE_EXISTING).text(TYPO3.lang["file_upload.actions.use_existing"]):"",c("<option />").val(i.SKIP).text(TYPO3.lang["file_upload.actions.skip"]),c("<option />").val(i.RENAME).text(TYPO3.lang["file_upload.actions.rename"]),c("<option />").val(i.OVERRIDE).text(TYPO3.lang["file_upload.actions.override"]))));e.find("table").append("<tbody />").append(j)}var m=f.confirm(TYPO3.lang["file_upload.existingfiles.title"],e,h.warning,[{text:c(this).data("button-close-text")||TYPO3.lang["file_upload.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:c(this).data("button-ok-text")||TYPO3.lang["file_upload.button.continue"]||"Continue with selected actions",btnClass:"btn-warning",name:"continue"}],["modal-inner-scroll"]);m.find(".modal-dialog").addClass("modal-lg"),m.find(".modal-footer").prepend(c("<span/>").addClass("form-inline").append(c("<label/>").text(TYPO3.lang["file_upload.actions.all.label"]),c("<select/>",{class:"form-control t3js-actions-all"}).append(c("<option/>").val("").text(TYPO3.lang["file_upload.actions.all.empty"]),this.irreObjectUid?c("<option/>").val(i.USE_EXISTING).text(TYPO3.lang["file_upload.actions.all.use_existing"]):"",c("<option/>").val(i.SKIP).text(TYPO3.lang["file_upload.actions.all.skip"]),c("<option/>").val(i.RENAME).text(TYPO3.lang["file_upload.actions.all.rename"]),c("<option/>").val(i.OVERRIDE).text(TYPO3.lang["file_upload.actions.all.override"]))));var n=this;m.on("change",".t3js-actions-all",function(){var a=c(this),b=a.val();""!==b?m.find(".t3js-actions").each(function(a,d){var e=c(d),f=parseInt(e.data("override"),10);e.val(b).prop("disabled","disabled"),n.askForOverride[f].action=e.val()}):m.find(".t3js-actions").removeProp("disabled")}).on("change",".t3js-actions",function(){var a=c(this),b=parseInt(a.data("override"),10);n.askForOverride[b].action=a.val()}).on("button.clicked",function(a){"cancel"===a.target.name?(n.askForOverride=[],f.dismiss()):"continue"===a.target.name&&(c.each(n.askForOverride,function(a,b){if(b.action===i.USE_EXISTING)l.addFileToIrre(n.irreObjectUid,b.original);else if(b.action!==i.SKIP){new k(n,b.uploaded,b.action)}}),n.askForOverride=[],f.dismiss())}).on("hidden.bs.modal",function(){a.askForOverride=[]})}},a}(),k=function(){function a(a,b,d){var e=this;if(this.dragUploader=a,this.file=b,this.override=d,this.$row=c("<tr />").addClass("upload-queue-item uploading"),this.$iconCol=c("<td />").addClass("col-icon").appendTo(this.$row),this.$fileName=c("<td />").text(b.name).appendTo(this.$row),this.$progress=c("<td />").attr("colspan",this.dragUploader.fileListColumnCount-2).appendTo(this.$row),this.$progressContainer=c("<div />").addClass("upload-queue-progress").appendTo(this.$progress),this.$progressBar=c("<div />").addClass("upload-queue-progress-bar").appendTo(this.$progressContainer),this.$progressPercentage=c("<span />").addClass("upload-queue-progress-percentage").appendTo(this.$progressContainer),this.$progressMessage=c("<span />").addClass("upload-queue-progress-message").appendTo(this.$progressContainer),0===c("tbody tr.upload-queue-item",this.dragUploader.$fileList).length?(this.$row.prependTo(c("tbody",this.dragUploader.$fileList)),this.$row.addClass("last")):this.$row.insertBefore(c("tbody tr.upload-queue-item:first",this.dragUploader.$fileList)),this.$iconCol.html('<span class="t3-icon t3-icon-mimetypes t3-icon-other-other">&nbsp;</span>'),this.dragUploader.maxFileSize>0&&this.file.size>this.dragUploader.maxFileSize)this.updateMessage(TYPO3.lang["file_upload.maxFileSizeExceeded"].replace(/\{0\}/g,this.file.name).replace(/\{1\}/g,l.fileSizeAsString(this.dragUploader.maxFileSize))),this.$row.addClass("error");else if(this.dragUploader.fileDenyPattern&&this.file.name.match(this.dragUploader.fileDenyPattern))this.updateMessage(TYPO3.lang["file_upload.fileNotAllowed"].replace(/\{0\}/g,this.file.name)),this.$row.addClass("error");else if(this.checkAllowedExtensions()){this.updateMessage("- "+l.fileSizeAsString(this.file.size));var f=new FormData;f.append("data[upload][1][target]",this.dragUploader.target),f.append("data[upload][1][data]","1"),f.append("overwriteExistingFiles",this.override),f.append("redirect",""),f.append("upload_1",this.file);var g=c.extend(!0,{},c.ajaxSettings,{url:TYPO3.settings.ajaxUrls.file_process,contentType:!1,processData:!1,data:f,cache:!1,type:"POST",success:function(a){return e.uploadSuccess(a)},error:function(a){return e.uploadError(a)}});g.xhr=function(){var a=c.ajaxSettings.xhr();return a.upload.addEventListener("progress",function(a){return e.updateProgress(a)}),a},this.upload=c.ajax(g)}else this.updateMessage(TYPO3.lang["file_upload.fileExtensionExpected"].replace(/\{0\}/g,this.dragUploader.filesExtensionsAllowed)),this.$row.addClass("error")}return a.prototype.updateMessage=function(a){this.$progressMessage.text(a)},a.prototype.removeProgress=function(){this.$progress&&this.$progress.remove()},a.prototype.uploadStart=function(){this.$progressPercentage.text("(0%)"),this.$progressBar.width("1%"),this.dragUploader.$trigger.trigger("uploadStart",[this])},a.prototype.uploadError=function(a){this.updateMessage(TYPO3.lang["file_upload.uploadFailed"].replace(/\{0\}/g,this.file.name));var b=c(a.responseText);b.is("t3err")?this.$progressPercentage.text(b.text()):this.$progressPercentage.text("("+a.statusText+")"),this.$row.addClass("error"),this.dragUploader.decrementQueueLength(),this.dragUploader.$trigger.trigger("uploadError",[this,a])},a.prototype.updateProgress=function(a){var b=Math.round(a.loaded/a.total*100)+"%";this.$progressBar.outerWidth(b),this.$progressPercentage.text(b),this.dragUploader.$trigger.trigger("updateProgress",[this,b,a])},a.prototype.uploadSuccess=function(a){var b=this;a.upload&&(this.dragUploader.decrementQueueLength(),this.$row.removeClass("uploading"),this.$fileName.text(a.upload[0].name),this.$progressPercentage.text(""),this.$progressMessage.text("100%"),this.$progressBar.outerWidth("100%"),a.upload[0].icon&&this.$iconCol.html('<a href="#" class="t3js-contextmenutrigger" data-uid="'+a.upload[0].id+'" data-table="sys_file">'+a.upload[0].icon+"&nbsp;</span></a>"),this.dragUploader.irreObjectUid?(l.addFileToIrre(this.dragUploader.irreObjectUid,a.upload[0]),setTimeout(function(){b.$row.remove(),0===c("tr",b.dragUploader.$fileList).length&&(b.dragUploader.$fileList.hide(),b.dragUploader.$trigger.trigger("uploadSuccess",[b,a]))},3e3)):setTimeout(function(){b.showFileInfo(a.upload[0]),b.dragUploader.$trigger.trigger("uploadSuccess",[b,a])},3e3))},a.prototype.showFileInfo=function(a){this.removeProgress();for(var b=7;b<this.dragUploader.fileListColumnCount;b++)c("<td />").text("").appendTo(this.$row);c("<td />").text(a.extension.toUpperCase()).appendTo(this.$row),c("<td />").text(a.date).appendTo(this.$row),c("<td />").text(l.fileSizeAsString(a.size)).appendTo(this.$row);var d="";a.permissions.read&&(d+='<strong class="text-danger">'+TYPO3.lang["permissions.read"]+"</strong>"),a.permissions.write&&(d+='<strong class="text-danger">'+TYPO3.lang["permissions.write"]+"</strong>"),c("<td />").html(d).appendTo(this.$row),c("<td />").text("-").appendTo(this.$row)},a.prototype.checkAllowedExtensions=function(){if(!this.dragUploader.filesExtensionsAllowed)return!0;var a=this.file.name.split(".").pop(),b=this.dragUploader.filesExtensionsAllowed.split(",");return c.inArray(a.toLowerCase(),b)!==-1},a}(),l=function(){function a(){}return a.fileSizeAsString=function(a){var b=a/1024,c="";return c=b>1024?(b/1024).toFixed(1)+" MB":b.toFixed(1)+" KB"},a.addFileToIrre=function(a,b){window.inline.delayedImportElement(a,"sys_file",b.uid,"file")},a.init=function(){var a=this,b=a.options;c.fn.extend({dragUploader:function(a){return this.each(function(b,d){var e=c(d),f=e.data("DragUploaderPlugin");f||e.data("DragUploaderPlugin",f=new j(d)),"string"==typeof a&&f[a]()})}}),c(function(){c(".t3js-drag-uploader").dragUploader(b)})},a}();b.initialize=function(){l.init(),"undefined"!=typeof TYPO3.settings&&"undefined"!=typeof TYPO3.settings.RequireJS&&"undefined"!=typeof TYPO3.settings.RequireJS.PostInitializationModules&&"undefined"!=typeof TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"]&&c.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"],function(b,c){a([c])})},b.initialize()});
\ No newline at end of file
+define(["require","exports","jquery","moment","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","./Severity"],function(a,b,c,d,e,f,g,h){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var i;!function(a){a.OVERRIDE="replace",a.RENAME="rename",a.SKIP="cancel",a.USE_EXISTING="useExisting"}(i||(i={}));var j=function(){function a(a){var b=this;this.askForOverride=[],this.percentagePerFile=1,this.dragFileIntoDocument=function(a){return a.stopPropagation(),a.preventDefault(),c(a.currentTarget).addClass("drop-in-progress"),b.showDropzone(),!1},this.dragAborted=function(a){return a.stopPropagation(),a.preventDefault(),c(a.currentTarget).removeClass("drop-in-progress"),!1},this.ignoreDrop=function(a){return a.stopPropagation(),a.preventDefault(),b.dragAborted(a),!1},this.handleDrop=function(a){b.ignoreDrop(a),b.processFiles(a.originalEvent.dataTransfer.files),b.$dropzone.removeClass("drop-status-ok")},this.fileInDropzone=function(){b.$dropzone.addClass("drop-status-ok")},this.fileOutOfDropzone=function(){b.$dropzone.removeClass("drop-status-ok")},this.$body=c("body"),this.$element=c(a);var d=void 0!==this.$element.data("dropzoneTrigger");this.$trigger=c(this.$element.data("dropzoneTrigger")),this.$dropzone=c("<div />").addClass("dropzone").hide(),this.irreObjectUid=this.$element.data("fileIrreObject");var e=this.$element.data("dropzoneTarget");return this.irreObjectUid&&0!==this.$element.nextAll(e).length?(this.dropZoneInsertBefore=!0,this.$dropzone.insertBefore(e)):(this.dropZoneInsertBefore=!1,this.$dropzone.insertAfter(e)),this.$dropzoneMask=c("<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=c(this.$element.data("progress-container")),this.fileListColumnCount=c("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(a){return b.handleDrop(a)}),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(){b.fileInput.click()}),c("<span />").addClass("dropzone-close").click(this.hideDropzone).appendTo(this.$dropzone),0===this.$fileList.length&&(this.$fileList=c("<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(){b.processFiles(Array.apply(null,b.fileInput.files))}),void this.bindUploadButton(d===!0?this.$trigger:this.$element)):void console.warn("Browser has no Drag and drop capabilities; cannot initialize DragUploader")}return a.prototype.showDropzone=function(){this.$dropzone.show()},a.prototype.hideDropzone=function(a){a.stopPropagation(),a.preventDefault(),this.$dropzone.hide()},a.prototype.processFiles=function(a){var b=this;this.queueLength=a.length,this.$fileList.is(":visible")||this.$fileList.show(),e.start(),this.percentagePerFile=1/a.length;var d=[];c.each(a,function(a,f){d[parseInt(a,10)]=c.ajax({url:TYPO3.settings.ajaxUrls.file_exists,data:{fileName:f.name,fileTarget:b.target},cache:!1,success:function(a){var c="undefined"!=typeof a.uid;if(c)b.askForOverride.push({original:a,uploaded:f,action:b.irreObjectUid?i.USE_EXISTING:i.SKIP}),e.inc(b.percentagePerFile);else{new k(b,f,i.SKIP)}}})}),c.when.apply(c,d).done(function(){b.drawOverrideModal(),e.done()}),this.fileInput.value=""},a.prototype.bindUploadButton=function(a){var b=this;a.click(function(a){a.preventDefault(),b.fileInput.click(),b.showDropzone()})},a.prototype.decrementQueueLength=function(){this.queueLength>0&&(this.queueLength--,0===this.queueLength&&c.ajax({url:TYPO3.settings.ajaxUrls.flashmessages_render,cache:!1,success:function(a){c.each(a,function(a,b){g.showMessage(b.title,b.message,b.severity)})}}))},a.prototype.drawOverrideModal=function(){var a=this,b=Object.keys(this.askForOverride).length;if(0!==b){for(var e=c("<div/>").append(c("<p/>").text(TYPO3.lang["file_upload.existingfiles.description"]),c("<table/>",{class:"table"}).append(c("<thead/>").append(c("<tr />").append(c("<th/>"),c("<th/>").text(TYPO3.lang["file_upload.header.originalFile"]),c("<th/>").text(TYPO3.lang["file_upload.header.uploadedFile"]),c("<th/>").text(TYPO3.lang["file_upload.header.action"]))))),g=0;g<b;++g){var j=c("<tr />").append(c("<td />").append(""!==this.askForOverride[g].original.thumbUrl?c("<img />",{src:this.askForOverride[g].original.thumbUrl,height:40}):c(this.askForOverride[g].original.icon)),c("<td />").html(this.askForOverride[g].uploaded.name+" ("+l.fileSizeAsString(this.askForOverride[g].uploaded.size)+")<br>"+d(this.askForOverride[g].uploaded.lastModifiedDate,"x").format("YYYY-MM-DD HH:mm")),c("<td />").html(this.askForOverride[g].uploaded.name+" ("+l.fileSizeAsString(this.askForOverride[g].original.size)+")<br>"+d(this.askForOverride[g].original.mtime,"X").format("YYYY-MM-DD HH:mm")),c("<td />").append(c("<select />",{class:"form-control t3js-actions","data-override":g}).append(this.irreObjectUid?c("<option/>").val(i.USE_EXISTING).text(TYPO3.lang["file_upload.actions.use_existing"]):"",c("<option />").val(i.SKIP).text(TYPO3.lang["file_upload.actions.skip"]),c("<option />").val(i.RENAME).text(TYPO3.lang["file_upload.actions.rename"]),c("<option />").val(i.OVERRIDE).text(TYPO3.lang["file_upload.actions.override"]))));e.find("table").append("<tbody />").append(j)}var m=f.confirm(TYPO3.lang["file_upload.existingfiles.title"],e,h.warning,[{text:c(this).data("button-close-text")||TYPO3.lang["file_upload.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:c(this).data("button-ok-text")||TYPO3.lang["file_upload.button.continue"]||"Continue with selected actions",btnClass:"btn-warning",name:"continue"}],["modal-inner-scroll"]);m.find(".modal-dialog").addClass("modal-lg"),m.find(".modal-footer").prepend(c("<span/>").addClass("form-inline").append(c("<label/>").text(TYPO3.lang["file_upload.actions.all.label"]),c("<select/>",{class:"form-control t3js-actions-all"}).append(c("<option/>").val("").text(TYPO3.lang["file_upload.actions.all.empty"]),this.irreObjectUid?c("<option/>").val(i.USE_EXISTING).text(TYPO3.lang["file_upload.actions.all.use_existing"]):"",c("<option/>").val(i.SKIP).text(TYPO3.lang["file_upload.actions.all.skip"]),c("<option/>").val(i.RENAME).text(TYPO3.lang["file_upload.actions.all.rename"]),c("<option/>").val(i.OVERRIDE).text(TYPO3.lang["file_upload.actions.all.override"]))));var n=this;m.on("change",".t3js-actions-all",function(){var a=c(this),b=a.val();""!==b?m.find(".t3js-actions").each(function(a,d){var e=c(d),f=parseInt(e.data("override"),10);e.val(b).prop("disabled","disabled"),n.askForOverride[f].action=e.val()}):m.find(".t3js-actions").removeProp("disabled")}).on("change",".t3js-actions",function(){var a=c(this),b=parseInt(a.data("override"),10);n.askForOverride[b].action=a.val()}).on("button.clicked",function(a){"cancel"===a.target.name?(n.askForOverride=[],f.dismiss()):"continue"===a.target.name&&(c.each(n.askForOverride,function(a,b){if(b.action===i.USE_EXISTING)l.addFileToIrre(n.irreObjectUid,b.original);else if(b.action!==i.SKIP){new k(n,b.uploaded,b.action)}}),n.askForOverride=[],f.dismiss())}).on("hidden.bs.modal",function(){a.askForOverride=[]})}},a}(),k=function(){function a(a,b,d){var e=this;if(this.dragUploader=a,this.file=b,this.override=d,this.$row=c("<tr />").addClass("upload-queue-item uploading"),this.$iconCol=c("<td />").addClass("col-icon").appendTo(this.$row),this.$fileName=c("<td />").text(b.name).appendTo(this.$row),this.$progress=c("<td />").attr("colspan",this.dragUploader.fileListColumnCount-2).appendTo(this.$row),this.$progressContainer=c("<div />").addClass("upload-queue-progress").appendTo(this.$progress),this.$progressBar=c("<div />").addClass("upload-queue-progress-bar").appendTo(this.$progressContainer),this.$progressPercentage=c("<span />").addClass("upload-queue-progress-percentage").appendTo(this.$progressContainer),this.$progressMessage=c("<span />").addClass("upload-queue-progress-message").appendTo(this.$progressContainer),0===c("tbody tr.upload-queue-item",this.dragUploader.$fileList).length?(this.$row.prependTo(c("tbody",this.dragUploader.$fileList)),this.$row.addClass("last")):this.$row.insertBefore(c("tbody tr.upload-queue-item:first",this.dragUploader.$fileList)),this.$iconCol.html('<span class="t3-icon t3-icon-mimetypes t3-icon-other-other">&nbsp;</span>'),this.dragUploader.maxFileSize>0&&this.file.size>this.dragUploader.maxFileSize)this.updateMessage(TYPO3.lang["file_upload.maxFileSizeExceeded"].replace(/\{0\}/g,this.file.name).replace(/\{1\}/g,l.fileSizeAsString(this.dragUploader.maxFileSize))),this.$row.addClass("error");else if(this.dragUploader.fileDenyPattern&&this.file.name.match(this.dragUploader.fileDenyPattern))this.updateMessage(TYPO3.lang["file_upload.fileNotAllowed"].replace(/\{0\}/g,this.file.name)),this.$row.addClass("error");else if(this.checkAllowedExtensions()){this.updateMessage("- "+l.fileSizeAsString(this.file.size));var f=new FormData;f.append("data[upload][1][target]",this.dragUploader.target),f.append("data[upload][1][data]","1"),f.append("overwriteExistingFiles",this.override),f.append("redirect",""),f.append("upload_1",this.file);var g=c.extend(!0,{},c.ajaxSettings,{url:TYPO3.settings.ajaxUrls.file_process,contentType:!1,processData:!1,data:f,cache:!1,type:"POST",success:function(a){return e.uploadSuccess(a)},error:function(a){return e.uploadError(a)}});g.xhr=function(){var a=c.ajaxSettings.xhr();return a.upload.addEventListener("progress",function(a){return e.updateProgress(a)}),a},this.upload=c.ajax(g)}else this.updateMessage(TYPO3.lang["file_upload.fileExtensionExpected"].replace(/\{0\}/g,this.dragUploader.filesExtensionsAllowed)),this.$row.addClass("error")}return a.prototype.updateMessage=function(a){this.$progressMessage.text(a)},a.prototype.removeProgress=function(){this.$progress&&this.$progress.remove()},a.prototype.uploadStart=function(){this.$progressPercentage.text("(0%)"),this.$progressBar.width("1%"),this.dragUploader.$trigger.trigger("uploadStart",[this])},a.prototype.uploadError=function(a){this.updateMessage(TYPO3.lang["file_upload.uploadFailed"].replace(/\{0\}/g,this.file.name));var b=c(a.responseText);b.is("t3err")?this.$progressPercentage.text(b.text()):this.$progressPercentage.text("("+a.statusText+")"),this.$row.addClass("error"),this.dragUploader.decrementQueueLength(),this.dragUploader.$trigger.trigger("uploadError",[this,a])},a.prototype.updateProgress=function(a){var b=Math.round(a.loaded/a.total*100)+"%";this.$progressBar.outerWidth(b),this.$progressPercentage.text(b),this.dragUploader.$trigger.trigger("updateProgress",[this,b,a])},a.prototype.uploadSuccess=function(a){var b=this;a.upload&&(this.dragUploader.decrementQueueLength(),this.$row.removeClass("uploading"),this.$fileName.text(a.upload[0].name),this.$progressPercentage.text(""),this.$progressMessage.text("100%"),this.$progressBar.outerWidth("100%"),a.upload[0].icon&&this.$iconCol.html('<a href="#" class="t3js-contextmenutrigger" data-uid="'+a.upload[0].id+'" data-table="sys_file">'+a.upload[0].icon+"&nbsp;</span></a>"),this.dragUploader.irreObjectUid?(l.addFileToIrre(this.dragUploader.irreObjectUid,a.upload[0]),setTimeout(function(){b.$row.remove(),0===c("tr",b.dragUploader.$fileList).length&&(b.dragUploader.$fileList.hide(),b.dragUploader.$trigger.trigger("uploadSuccess",[b,a]))},3e3)):setTimeout(function(){b.showFileInfo(a.upload[0]),b.dragUploader.$trigger.trigger("uploadSuccess",[b,a])},3e3))},a.prototype.showFileInfo=function(a){this.removeProgress();for(var b=7;b<this.dragUploader.fileListColumnCount;b++)c("<td />").text("").appendTo(this.$row);c("<td />").text(a.extension.toUpperCase()).appendTo(this.$row),c("<td />").text(a.date).appendTo(this.$row),c("<td />").text(l.fileSizeAsString(a.size)).appendTo(this.$row);var d="";a.permissions.read&&(d+='<strong class="text-danger">'+TYPO3.lang["permissions.read"]+"</strong>"),a.permissions.write&&(d+='<strong class="text-danger">'+TYPO3.lang["permissions.write"]+"</strong>"),c("<td />").html(d).appendTo(this.$row),c("<td />").text("-").appendTo(this.$row)},a.prototype.checkAllowedExtensions=function(){if(!this.dragUploader.filesExtensionsAllowed)return!0;var a=this.file.name.split(".").pop(),b=this.dragUploader.filesExtensionsAllowed.split(",");return c.inArray(a.toLowerCase(),b)!==-1},a}(),l=function(){function a(){}return a.fileSizeAsString=function(a){var b=a/1024,c="";return c=b>1024?(b/1024).toFixed(1)+" MB":b.toFixed(1)+" KB"},a.addFileToIrre=function(a,b){window.inline.delayedImportElement(a,"sys_file",b.uid,"file")},a.init=function(){var a=this,b=a.options;c.fn.extend({dragUploader:function(a){return this.each(function(b,d){var e=c(d),f=e.data("DragUploaderPlugin");f||e.data("DragUploaderPlugin",f=new j(d)),"string"==typeof a&&f[a]()})}}),c(function(){c(".t3js-drag-uploader").dragUploader(b)})},a}();b.initialize=function(){l.init(),"undefined"!=typeof TYPO3.settings&&"undefined"!=typeof TYPO3.settings.RequireJS&&"undefined"!=typeof TYPO3.settings.RequireJS.PostInitializationModules&&"undefined"!=typeof TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"]&&c.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"],function(b,c){a([c])})},b.initialize()});
\ No newline at end of file
index 66ed74a..5cb1bac 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-var __values=this&&this.__values||function(a){var b="function"==typeof Symbol&&a[Symbol.iterator],c=0;return b?b.call(a):{next:function(){return a&&c>=a.length&&(a=void 0),{value:a&&a[c++],done:!a}}}};define(["require","exports","jquery","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Severity","bootstrap"],function(a,b,c,d,e){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var f=function(){function a(a){void 0===a&&(a=null);var b=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(a){var c=a.target;"cancel"===c.name?d.currentModal.trigger("modal-dismiss"):"ok"===c.name&&(b.setName(d.currentModal.find(".t3js-grideditor-field-name").val(),d.currentModal.data("col"),d.currentModal.data("row")),b.setColumn(d.currentModal.find(".t3js-grideditor-field-colpos").val(),d.currentModal.data("col"),d.currentModal.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord()),d.currentModal.trigger("modal-dismiss"))},this.addColumnHandler=function(a){a.preventDefault(),b.addColumn(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.removeColumnHandler=function(a){a.preventDefault(),b.removeColumn(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.addRowTopHandler=function(a){a.preventDefault(),b.addRowTop(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.addRowBottomHandler=function(a){a.preventDefault(),b.addRowBottom(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.removeRowTopHandler=function(a){a.preventDefault(),b.removeRowTop(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.removeRowBottomHandler=function(a){a.preventDefault(),b.removeRowBottom(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkEditorHandler=function(a){a.preventDefault();var d=c(a.target);b.showOptions(d.data("col"),d.data("row"))},this.linkExpandRightHandler=function(a){a.preventDefault();var d=c(a.target);b.addColspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkShrinkLeftHandler=function(a){a.preventDefault();var d=c(a.target);b.removeColspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkExpandDownHandler=function(a){a.preventDefault();var d=c(a.target);b.addRowspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkShrinkUpHandler=function(a){a.preventDefault();var d=c(a.target);b.removeRowspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.configPreviewButtonHandler=function(a){a.preventDefault();var d=c(b.selectorConfigPreview),e=c(b.selectorConfigPreviewButton);d.is(":visible")?(e.empty().append(TYPO3.lang["button.showPageTsConfig"]),c(b.selectorConfigPreview).slideUp()):(e.empty().append(TYPO3.lang["button.hidePageTsConfig"]),c(b.selectorConfigPreview).slideDown())};var e=c(this.selectorEditor);this.colCount=e.data("colcount"),this.rowCount=e.data("rowcount"),this.field=c('input[name="'+e.data("field")+'"]'),this.data=e.data("data"),this.nameLabel=null!==a?a.nameLabel:"Name",this.columnLabel=null!==a?a.columnLabel:"Column",this.targetElement=c(this.selectorEditor),c(this.selectorConfigPreview).hide(),c(this.selectorConfigPreviewButton).empty().append(TYPO3.lang["button.showPageTsConfig"]),this.initializeEvents(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())}return a.stripMarkup=function(a){return a=a.replace(/<(.*)>/gi,""),c("<p>"+a+"</p>").text()},a.prototype.initializeEvents=function(){c(document).on("click",this.selectorAddColumn,this.addColumnHandler),c(document).on("click",this.selectorRemoveColumn,this.removeColumnHandler),c(document).on("click",this.selectorAddRowTop,this.addRowTopHandler),c(document).on("click",this.selectorAddRowBottom,this.addRowBottomHandler),c(document).on("click",this.selectorRemoveRowTop,this.removeRowTopHandler),c(document).on("click",this.selectorRemoveRowBottom,this.removeRowBottomHandler),c(document).on("click",this.selectorLinkEditor,this.linkEditorHandler),c(document).on("click",this.selectorLinkExpandRight,this.linkExpandRightHandler),c(document).on("click",this.selectorLinkShrinkLeft,this.linkShrinkLeftHandler),c(document).on("click",this.selectorLinkExpandDown,this.linkExpandDownHandler),c(document).on("click",this.selectorLinkShrinkUp,this.linkShrinkUpHandler),c(document).on("click",this.selectorConfigPreviewButton,this.configPreviewButtonHandler)},a.prototype.getNewCell=function(){return c.extend({},this.defaultCell)},a.prototype.writeConfig=function(a){this.field.val(a);var b=a.split("\n"),d="";try{for(var e=__values(b),f=e.next();!f.done;f=e.next()){var g=f.value;g&&(d+="\t\t\t"+g+"\n")}}catch(a){h={error:a}}finally{try{f&&!f.done&&(i=e.return)&&i.call(e)}finally{if(h)throw h.error}}c(this.selectorConfigPreview).find("code").empty().append("mod.web_layout.BackendLayouts {\n  exampleKey {\n    title = Example\n    icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif\n    config {\n"+d.replace(new RegExp("\t","g"),"  ")+"    }\n  }\n}\n");var h,i},a.prototype.addRowTop=function(){for(var a=[],b=0;b<this.colCount;b++){var c=this.getNewCell();c.name=b+"x"+this.data.length,a[b]=c}this.data.unshift(a),this.rowCount++},a.prototype.addRowBottom=function(){for(var a=[],b=0;b<this.colCount;b++){var c=this.getNewCell();c.name=b+"x"+this.data.length,a[b]=c}this.data.push(a),this.rowCount++},a.prototype.removeRowTop=function(){if(this.rowCount<=1)return!1;for(var a=[],b=1;b<this.rowCount;b++)a.push(this.data[b]);for(var c=0;c<this.colCount;c++)1===this.data[0][c].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(c,0);return this.data=a,this.rowCount--,!0},a.prototype.removeRowBottom=function(){if(this.rowCount<=1)return!1;for(var a=[],b=0;b<this.rowCount-1;b++)a.push(this.data[b]);for(var c=0;c<this.colCount;c++)1===this.data[this.rowCount-1][c].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(c,this.rowCount-1);return this.data=a,this.rowCount--,!0},a.prototype.findUpperCellWidthRowspanAndDecreaseByOne=function(a,b){var c=this.getCell(a,b-1);return!!c&&(1===c.spanned?this.findUpperCellWidthRowspanAndDecreaseByOne(a,b-1):c.rowspan>1&&this.removeRowspan(a,b-1),!0)},a.prototype.removeColumn=function(){if(this.colCount<=1)return!1;for(var a=[],b=0;b<this.rowCount;b++){for(var c=[],d=0;d<this.colCount-1;d++)c.push(this.data[b][d]);1===this.data[b][this.colCount-1].spanned&&this.findLeftCellWidthColspanAndDecreaseByOne(this.colCount-1,b),a.push(c)}return this.data=a,this.colCount--,!0},a.prototype.findLeftCellWidthColspanAndDecreaseByOne=function(a,b){var c=this.getCell(a-1,b);return!!c&&(1===c.spanned?this.findLeftCellWidthColspanAndDecreaseByOne(a-1,b):c.colspan>1&&this.removeColspan(a-1,b),!0)},a.prototype.addColumn=function(){for(var a=0;a<this.rowCount;a++){var b=this.getNewCell();b.name=this.colCount+"x"+a,this.data[a].push(b)}this.colCount++},a.prototype.drawTable=function(){for(var b=c("<colgroup>"),d=0;d<this.colCount;d++){var e=100/this.colCount;b.append(c("<col>").css({width:parseInt(e.toString(),10)+"%"}))}var f=c('<table id="base" class="table editor">');f.append(b);for(var g=0;g<this.rowCount;g++){var h=this.data[g];if(0!==h.length){for(var i=c("<tr>"),d=0;d<this.colCount;d++){var j=this.data[g][d];if(1!==j.spanned){var k=100/this.rowCount,l=100/this.colCount,m=c("<td>").css({height:parseInt(k.toString(),10)*j.rowspan+"%",width:parseInt(l.toString(),10)*j.colspan+"%"}),n=c('<div class="cell_container">');m.append(n);var o=c('<a href="#" data-col="'+d+'" data-row="'+g+'">');n.append(o.clone().attr("class","t3js-grideditor-link-editor link link_editor").attr("title",TYPO3.lang.grid_editCell)),this.cellCanSpanRight(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-expand-right link link_expand_right").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkLeft(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-shrink-left link link_shrink_left").attr("title",TYPO3.lang.grid_splitCell)),this.cellCanSpanDown(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-expand-down link link_expand_down").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkUp(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-shrink-up link link_shrink_up").attr("title",TYPO3.lang.grid_splitCell)),m.append(c('<div class="cell_data">').html(TYPO3.lang.grid_name+": "+(j.name?a.stripMarkup(j.name):TYPO3.lang.grid_notSet)+"<br />"+TYPO3.lang.grid_column+": "+("undefined"==typeof j.column||isNaN(j.column)?TYPO3.lang.grid_notSet:parseInt(j.column,10)))),j.colspan>1&&m.attr("colspan",j.colspan),j.rowspan>1&&m.attr("rowspan",j.rowspan),i.append(m)}}f.append(i)}}c(this.targetElement).empty().append(f)},a.prototype.setName=function(b,c,d){var e=this.getCell(c,d);return!!e&&(e.name=a.stripMarkup(b),!0)},a.prototype.setColumn=function(a,b,c){var d=this.getCell(b,c);return!!d&&(d.column=parseInt(a.toString(),10),!0)},a.prototype.showOptions=function(b,f){var g=this.getCell(b,f);if(!g)return!1;var h;h=0===g.column?0:g.column?parseInt(g.column.toString(),10):"";var i=c("<div>"),j=c('<div class="form-group">'),k=c("<label>"),l=c("<input>");i.append([j.clone().append([k.clone().text(TYPO3.lang.grid_nameHelp),l.clone().attr("type","text").attr("class","t3js-grideditor-field-name form-control").attr("name","name").val(a.stripMarkup(g.name)||"")]),j.clone().append([k.clone().text(TYPO3.lang.grid_columnHelp),l.clone().attr("type","text").attr("class","t3js-grideditor-field-colpos form-control").attr("name","column").val(h)])]);var m=d.show(TYPO3.lang.grid_windowTitle,i,e.notice,[{active:!0,btnClass:"btn-default",name:"cancel",text:c(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel"},{btnClass:"btn-primary",name:"ok",text:c(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK"}]);return m.data("col",b),m.data("row",f),m.on("button.clicked",this.modalButtonClickHandler),!0},a.prototype.getCell=function(a,b){return!(a>this.colCount-1)&&(!(b>this.rowCount-1)&&(this.data.length>b-1&&this.data[b].length>a-1?this.data[b][a]:null))},a.prototype.cellCanSpanRight=function(a,b){if(a===this.colCount-1)return!1;var c,d=this.getCell(a,b);if(d.rowspan>1){for(var e=b;e<b+d.rowspan;e++)if(c=this.getCell(a+d.colspan,e),!c||1===c.spanned||c.colspan>1||c.rowspan>1)return!1}else if(c=this.getCell(a+d.colspan,b),!c||1===d.spanned||1===c.spanned||c.colspan>1||c.rowspan>1)return!1;return!0},a.prototype.cellCanSpanDown=function(a,b){if(b===this.rowCount-1)return!1;var c,d=this.getCell(a,b);if(d.colspan>1){for(var e=a;e<a+d.colspan;e++)if(c=this.getCell(e,b+d.rowspan),!c||1===c.spanned||c.colspan>1||c.rowspan>1)return!1}else if(c=this.getCell(a,b+d.rowspan),!c||1===d.spanned||1===c.spanned||c.colspan>1||c.rowspan>1)return!1;return!0},a.prototype.cellCanShrinkLeft=function(a,b){return this.data[b][a].colspan>1},a.prototype.cellCanShrinkUp=function(a,b){return this.data[b][a].rowspan>1},a.prototype.addColspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanSpanRight(a,b))return!1;for(var d=b;d<b+c.rowspan;d++)this.data[d][a+c.colspan].spanned=1;return c.colspan+=1,!0},a.prototype.addRowspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanSpanDown(a,b))return!1;for(var d=a;d<a+c.colspan;d++)this.data[b+c.rowspan][d].spanned=1;return c.rowspan+=1,!0},a.prototype.removeColspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanShrinkLeft(a,b))return!1;c.colspan-=1;for(var d=b;d<b+c.rowspan;d++)this.data[d][a+c.colspan].spanned=0;return!0},a.prototype.removeRowspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanShrinkUp(a,b))return!1;c.rowspan-=1;for(var d=a;d<a+c.colspan;d++)this.data[b+c.rowspan][d].spanned=0;return!0},a.prototype.export2LayoutRecord=function(){for(var a="backend_layout {\n\tcolCount = "+this.colCount+"\n\trowCount = "+this.rowCount+"\n\trows {\n",b=0;b<this.rowCount;b++){a+="\t\t"+(b+1)+" {\n",a+="\t\t\tcolumns {\n";for(var c=0,d=0;d<this.colCount;d++){var e=this.getCell(d,b);e&&(e.spanned||(c++,a+="\t\t\t\t"+c+" {\n",a+="\t\t\t\t\tname = "+(e.name?e.name:d+"x"+b)+"\n",e.colspan>1&&(a+="\t\t\t\t\tcolspan = "+e.colspan+"\n"),e.rowspan>1&&(a+="\t\t\t\t\trowspan = "+e.rowspan+"\n"),"number"==typeof e.column&&(a+="\t\t\t\t\tcolPos = "+e.column+"\n"),a+="\t\t\t\t}\n"))}a+="\t\t\t}\n",a+="\t\t}\n"}return a+="\t}\n}\n"},a}();b.GridEditor=f});
\ No newline at end of file
+var __values=this&&this.__values||function(a){var b="function"==typeof Symbol&&a[Symbol.iterator],c=0;return b?b.call(a):{next:function(){return a&&c>=a.length&&(a=void 0),{value:a&&a[c++],done:!a}}}};define(["require","exports","jquery","TYPO3/CMS/Backend/Modal","./Severity","bootstrap"],function(a,b,c,d,e){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var f=function(){function a(a){void 0===a&&(a=null);var b=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(a){var c=a.target;"cancel"===c.name?d.currentModal.trigger("modal-dismiss"):"ok"===c.name&&(b.setName(d.currentModal.find(".t3js-grideditor-field-name").val(),d.currentModal.data("col"),d.currentModal.data("row")),b.setColumn(d.currentModal.find(".t3js-grideditor-field-colpos").val(),d.currentModal.data("col"),d.currentModal.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord()),d.currentModal.trigger("modal-dismiss"))},this.addColumnHandler=function(a){a.preventDefault(),b.addColumn(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.removeColumnHandler=function(a){a.preventDefault(),b.removeColumn(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.addRowTopHandler=function(a){a.preventDefault(),b.addRowTop(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.addRowBottomHandler=function(a){a.preventDefault(),b.addRowBottom(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.removeRowTopHandler=function(a){a.preventDefault(),b.removeRowTop(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.removeRowBottomHandler=function(a){a.preventDefault(),b.removeRowBottom(),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkEditorHandler=function(a){a.preventDefault();var d=c(a.target);b.showOptions(d.data("col"),d.data("row"))},this.linkExpandRightHandler=function(a){a.preventDefault();var d=c(a.target);b.addColspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkShrinkLeftHandler=function(a){a.preventDefault();var d=c(a.target);b.removeColspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkExpandDownHandler=function(a){a.preventDefault();var d=c(a.target);b.addRowspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.linkShrinkUpHandler=function(a){a.preventDefault();var d=c(a.target);b.removeRowspan(d.data("col"),d.data("row")),b.drawTable(),b.writeConfig(b.export2LayoutRecord())},this.configPreviewButtonHandler=function(a){a.preventDefault();var d=c(b.selectorConfigPreview),e=c(b.selectorConfigPreviewButton);d.is(":visible")?(e.empty().append(TYPO3.lang["button.showPageTsConfig"]),c(b.selectorConfigPreview).slideUp()):(e.empty().append(TYPO3.lang["button.hidePageTsConfig"]),c(b.selectorConfigPreview).slideDown())};var e=c(this.selectorEditor);this.colCount=e.data("colcount"),this.rowCount=e.data("rowcount"),this.field=c('input[name="'+e.data("field")+'"]'),this.data=e.data("data"),this.nameLabel=null!==a?a.nameLabel:"Name",this.columnLabel=null!==a?a.columnLabel:"Column",this.targetElement=c(this.selectorEditor),c(this.selectorConfigPreview).hide(),c(this.selectorConfigPreviewButton).empty().append(TYPO3.lang["button.showPageTsConfig"]),this.initializeEvents(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())}return a.stripMarkup=function(a){return a=a.replace(/<(.*)>/gi,""),c("<p>"+a+"</p>").text()},a.prototype.initializeEvents=function(){c(document).on("click",this.selectorAddColumn,this.addColumnHandler),c(document).on("click",this.selectorRemoveColumn,this.removeColumnHandler),c(document).on("click",this.selectorAddRowTop,this.addRowTopHandler),c(document).on("click",this.selectorAddRowBottom,this.addRowBottomHandler),c(document).on("click",this.selectorRemoveRowTop,this.removeRowTopHandler),c(document).on("click",this.selectorRemoveRowBottom,this.removeRowBottomHandler),c(document).on("click",this.selectorLinkEditor,this.linkEditorHandler),c(document).on("click",this.selectorLinkExpandRight,this.linkExpandRightHandler),c(document).on("click",this.selectorLinkShrinkLeft,this.linkShrinkLeftHandler),c(document).on("click",this.selectorLinkExpandDown,this.linkExpandDownHandler),c(document).on("click",this.selectorLinkShrinkUp,this.linkShrinkUpHandler),c(document).on("click",this.selectorConfigPreviewButton,this.configPreviewButtonHandler)},a.prototype.getNewCell=function(){return c.extend({},this.defaultCell)},a.prototype.writeConfig=function(a){this.field.val(a);var b=a.split("\n"),d="";try{for(var e=__values(b),f=e.next();!f.done;f=e.next()){var g=f.value;g&&(d+="\t\t\t"+g+"\n")}}catch(a){h={error:a}}finally{try{f&&!f.done&&(i=e.return)&&i.call(e)}finally{if(h)throw h.error}}c(this.selectorConfigPreview).find("code").empty().append("mod.web_layout.BackendLayouts {\n  exampleKey {\n    title = Example\n    icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif\n    config {\n"+d.replace(new RegExp("\t","g"),"  ")+"    }\n  }\n}\n");var h,i},a.prototype.addRowTop=function(){for(var a=[],b=0;b<this.colCount;b++){var c=this.getNewCell();c.name=b+"x"+this.data.length,a[b]=c}this.data.unshift(a),this.rowCount++},a.prototype.addRowBottom=function(){for(var a=[],b=0;b<this.colCount;b++){var c=this.getNewCell();c.name=b+"x"+this.data.length,a[b]=c}this.data.push(a),this.rowCount++},a.prototype.removeRowTop=function(){if(this.rowCount<=1)return!1;for(var a=[],b=1;b<this.rowCount;b++)a.push(this.data[b]);for(var c=0;c<this.colCount;c++)1===this.data[0][c].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(c,0);return this.data=a,this.rowCount--,!0},a.prototype.removeRowBottom=function(){if(this.rowCount<=1)return!1;for(var a=[],b=0;b<this.rowCount-1;b++)a.push(this.data[b]);for(var c=0;c<this.colCount;c++)1===this.data[this.rowCount-1][c].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(c,this.rowCount-1);return this.data=a,this.rowCount--,!0},a.prototype.findUpperCellWidthRowspanAndDecreaseByOne=function(a,b){var c=this.getCell(a,b-1);return!!c&&(1===c.spanned?this.findUpperCellWidthRowspanAndDecreaseByOne(a,b-1):c.rowspan>1&&this.removeRowspan(a,b-1),!0)},a.prototype.removeColumn=function(){if(this.colCount<=1)return!1;for(var a=[],b=0;b<this.rowCount;b++){for(var c=[],d=0;d<this.colCount-1;d++)c.push(this.data[b][d]);1===this.data[b][this.colCount-1].spanned&&this.findLeftCellWidthColspanAndDecreaseByOne(this.colCount-1,b),a.push(c)}return this.data=a,this.colCount--,!0},a.prototype.findLeftCellWidthColspanAndDecreaseByOne=function(a,b){var c=this.getCell(a-1,b);return!!c&&(1===c.spanned?this.findLeftCellWidthColspanAndDecreaseByOne(a-1,b):c.colspan>1&&this.removeColspan(a-1,b),!0)},a.prototype.addColumn=function(){for(var a=0;a<this.rowCount;a++){var b=this.getNewCell();b.name=this.colCount+"x"+a,this.data[a].push(b)}this.colCount++},a.prototype.drawTable=function(){for(var b=c("<colgroup>"),d=0;d<this.colCount;d++){var e=100/this.colCount;b.append(c("<col>").css({width:parseInt(e.toString(),10)+"%"}))}var f=c('<table id="base" class="table editor">');f.append(b);for(var g=0;g<this.rowCount;g++){var h=this.data[g];if(0!==h.length){for(var i=c("<tr>"),d=0;d<this.colCount;d++){var j=this.data[g][d];if(1!==j.spanned){var k=100/this.rowCount,l=100/this.colCount,m=c("<td>").css({height:parseInt(k.toString(),10)*j.rowspan+"%",width:parseInt(l.toString(),10)*j.colspan+"%"}),n=c('<div class="cell_container">');m.append(n);var o=c('<a href="#" data-col="'+d+'" data-row="'+g+'">');n.append(o.clone().attr("class","t3js-grideditor-link-editor link link_editor").attr("title",TYPO3.lang.grid_editCell)),this.cellCanSpanRight(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-expand-right link link_expand_right").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkLeft(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-shrink-left link link_shrink_left").attr("title",TYPO3.lang.grid_splitCell)),this.cellCanSpanDown(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-expand-down link link_expand_down").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkUp(d,g)&&n.append(o.clone().attr("class","t3js-grideditor-link-shrink-up link link_shrink_up").attr("title",TYPO3.lang.grid_splitCell)),m.append(c('<div class="cell_data">').html(TYPO3.lang.grid_name+": "+(j.name?a.stripMarkup(j.name):TYPO3.lang.grid_notSet)+"<br />"+TYPO3.lang.grid_column+": "+("undefined"==typeof j.column||isNaN(j.column)?TYPO3.lang.grid_notSet:parseInt(j.column,10)))),j.colspan>1&&m.attr("colspan",j.colspan),j.rowspan>1&&m.attr("rowspan",j.rowspan),i.append(m)}}f.append(i)}}c(this.targetElement).empty().append(f)},a.prototype.setName=function(b,c,d){var e=this.getCell(c,d);return!!e&&(e.name=a.stripMarkup(b),!0)},a.prototype.setColumn=function(a,b,c){var d=this.getCell(b,c);return!!d&&(d.column=parseInt(a.toString(),10),!0)},a.prototype.showOptions=function(b,f){var g=this.getCell(b,f);if(!g)return!1;var h;h=0===g.column?0:g.column?parseInt(g.column.toString(),10):"";var i=c("<div>"),j=c('<div class="form-group">'),k=c("<label>"),l=c("<input>");i.append([j.clone().append([k.clone().text(TYPO3.lang.grid_nameHelp),l.clone().attr("type","text").attr("class","t3js-grideditor-field-name form-control").attr("name","name").val(a.stripMarkup(g.name)||"")]),j.clone().append([k.clone().text(TYPO3.lang.grid_columnHelp),l.clone().attr("type","text").attr("class","t3js-grideditor-field-colpos form-control").attr("name","column").val(h)])]);var m=d.show(TYPO3.lang.grid_windowTitle,i,e.notice,[{active:!0,btnClass:"btn-default",name:"cancel",text:c(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel"},{btnClass:"btn-primary",name:"ok",text:c(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK"}]);return m.data("col",b),m.data("row",f),m.on("button.clicked",this.modalButtonClickHandler),!0},a.prototype.getCell=function(a,b){return!(a>this.colCount-1)&&(!(b>this.rowCount-1)&&(this.data.length>b-1&&this.data[b].length>a-1?this.data[b][a]:null))},a.prototype.cellCanSpanRight=function(a,b){if(a===this.colCount-1)return!1;var c,d=this.getCell(a,b);if(d.rowspan>1){for(var e=b;e<b+d.rowspan;e++)if(c=this.getCell(a+d.colspan,e),!c||1===c.spanned||c.colspan>1||c.rowspan>1)return!1}else if(c=this.getCell(a+d.colspan,b),!c||1===d.spanned||1===c.spanned||c.colspan>1||c.rowspan>1)return!1;return!0},a.prototype.cellCanSpanDown=function(a,b){if(b===this.rowCount-1)return!1;var c,d=this.getCell(a,b);if(d.colspan>1){for(var e=a;e<a+d.colspan;e++)if(c=this.getCell(e,b+d.rowspan),!c||1===c.spanned||c.colspan>1||c.rowspan>1)return!1}else if(c=this.getCell(a,b+d.rowspan),!c||1===d.spanned||1===c.spanned||c.colspan>1||c.rowspan>1)return!1;return!0},a.prototype.cellCanShrinkLeft=function(a,b){return this.data[b][a].colspan>1},a.prototype.cellCanShrinkUp=function(a,b){return this.data[b][a].rowspan>1},a.prototype.addColspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanSpanRight(a,b))return!1;for(var d=b;d<b+c.rowspan;d++)this.data[d][a+c.colspan].spanned=1;return c.colspan+=1,!0},a.prototype.addRowspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanSpanDown(a,b))return!1;for(var d=a;d<a+c.colspan;d++)this.data[b+c.rowspan][d].spanned=1;return c.rowspan+=1,!0},a.prototype.removeColspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanShrinkLeft(a,b))return!1;c.colspan-=1;for(var d=b;d<b+c.rowspan;d++)this.data[d][a+c.colspan].spanned=0;return!0},a.prototype.removeRowspan=function(a,b){var c=this.getCell(a,b);if(!c||!this.cellCanShrinkUp(a,b))return!1;c.rowspan-=1;for(var d=a;d<a+c.colspan;d++)this.data[b+c.rowspan][d].spanned=0;return!0},a.prototype.export2LayoutRecord=function(){for(var a="backend_layout {\n\tcolCount = "+this.colCount+"\n\trowCount = "+this.rowCount+"\n\trows {\n",b=0;b<this.rowCount;b++){a+="\t\t"+(b+1)+" {\n",a+="\t\t\tcolumns {\n";for(var c=0,d=0;d<this.colCount;d++){var e=this.getCell(d,b);e&&(e.spanned||(c++,a+="\t\t\t\t"+c+" {\n",a+="\t\t\t\t\tname = "+(e.name?e.name:d+"x"+b)+"\n",e.colspan>1&&(a+="\t\t\t\t\tcolspan = "+e.colspan+"\n"),e.rowspan>1&&(a+="\t\t\t\t\trowspan = "+e.rowspan+"\n"),"number"==typeof e.column&&(a+="\t\t\t\t\tcolPos = "+e.column+"\n"),a+="\t\t\t\t}\n"))}a+="\t\t\t}\n",a+="\t\t}\n"}return a+="\t}\n}\n"},a}();b.GridEditor=f});
\ No newline at end of file
index e02566a..e54611c 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Severity"],function(a,b,c,d){"use strict";var e=function(){function a(){}return a.showItem=function(a,b){c.advanced({type:c.types.iframe,size:c.sizes.large,content:TYPO3.settings.ShowItem.moduleUrl+"&table="+encodeURIComponent(a)+"&uid="+("number"==typeof b?b:encodeURIComponent(b)),severity:d.notice})},a}();return TYPO3.InfoWindow=e,e});
\ No newline at end of file
+define(["require","exports","TYPO3/CMS/Backend/Modal","./Severity"],function(a,b,c,d){"use strict";var e=function(){function a(){}return a.showItem=function(a,b){c.advanced({type:c.types.iframe,size:c.sizes.large,content:TYPO3.settings.ShowItem.moduleUrl+"&table="+encodeURIComponent(a)+"&uid="+("number"==typeof b?b:encodeURIComponent(b)),severity:d.notice})},a}();return TYPO3.InfoWindow=e,e});
\ No newline at end of file
index 9d52d5e..856443c 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Severity"],function(a,b,c,d,e){"use strict";var f=function(){function a(){this.initialize()}return a.prototype.initialize=function(){c(".t3js-submit-file-rename").on("click",this.checkForDuplicate)},a.prototype.checkForDuplicate=function(a){a.preventDefault();var b=c("#"+c(a.currentTarget).attr("form")),f=b.find('input[name="data[rename][0][target]"]'),g=b.find('input[name="data[rename][0][conflictMode]"]'),h=TYPO3.settings.ajaxUrls.file_exists;c.ajax({cache:!1,data:{fileName:f.val(),fileTarget:b.find('input[name="data[rename][0][destination]"]').val()},success:function(a){var c="undefined"!=typeof a.uid,h=f.data("original"),i=f.val();if(c&&h!==i){var j=TYPO3.lang["file_rename.exists.description"].replace("{0}",h).replace("{1}",i),k=d.confirm(TYPO3.lang["file_rename.exists.title"],j,e.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"]}]);k.on("button.clicked",function(a){"cancel"!==a.target.name&&(g.val(a.target.name),b.submit()),d.dismiss()})}else b.submit()},url:h})},a}();return new f});
\ No newline at end of file
+define(["require","exports","jquery","TYPO3/CMS/Backend/Modal","./Severity"],function(a,b,c,d,e){"use strict";var f=function(){function a(){this.initialize()}return a.prototype.initialize=function(){c(".t3js-submit-file-rename").on("click",this.checkForDuplicate)},a.prototype.checkForDuplicate=function(a){a.preventDefault();var b=c("#"+c(a.currentTarget).attr("form")),f=b.find('input[name="data[rename][0][target]"]'),g=b.find('input[name="data[rename][0][conflictMode]"]'),h=TYPO3.settings.ajaxUrls.file_exists;c.ajax({cache:!1,data:{fileName:f.val(),fileTarget:b.find('input[name="data[rename][0][destination]"]').val()},success:function(a){var c="undefined"!=typeof a.uid,h=f.data("original"),i=f.val();if(c&&h!==i){var j=TYPO3.lang["file_rename.exists.description"].replace("{0}",h).replace("{1}",i),k=d.confirm(TYPO3.lang["file_rename.exists.title"],j,e.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"]}]);k.on("button.clicked",function(a){"cancel"!==a.target.name&&(g.val(a.target.name),b.submit()),d.dismiss()})}else b.submit()},url:h})},a}();return new f});
\ No newline at end of file
index cf5288c..c8aaba8 100644 (file)
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-/**
- * Module: TYPO3/CMS/Backend/Severity
- * Severity for the TYPO3 backend
- */
-define(function() {
-  'use strict';
-
-  try {
-    // fetch from opening window
-    if (window.opener && window.opener.TYPO3 && window.opener.TYPO3.Severity) {
-      return window.opener.TYPO3.Severity;
-    }
-
-    // fetch from parent
-    if (parent && parent.window.TYPO3 && parent.window.TYPO3.Severity) {
-      return parent.window.TYPO3.Severity;
-    }
-
-    // fetch object from outer frame
-    if (top && top.TYPO3 && top.TYPO3.Severity) {
-      return top.TYPO3.Severity;
-    }
-  } 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.
-  }
-
-  /**
-   * Severity object
-   *
-   * @type {{notice: number, information: number, info: number, ok: number, warning: number, error: number}}
-   * @exports TYPO3/CMS/Backend/Severity
-   */
-  var Severity = {
-    notice: -2,
-    info: -1,
-    ok: 0,
-    warning: 1,
-    error: 2
-  };
-
-  /**
-   * Gets the CSS class for the severity
-   *
-   * @param {Number} severity
-   * @returns {String}
-   */
-  Severity.getCssClass = function(severity) {
-    var severityClass;
-    switch (severity) {
-      case Severity.notice:
-        severityClass = 'notice';
-        break;
-      case Severity.ok:
-        severityClass = 'success';
-        break;
-      case Severity.warning:
-        severityClass = 'warning';
-        break;
-      case Severity.error:
-        severityClass = 'danger';
-        break;
-      case Severity.info:
-      default:
-        severityClass = 'info';
-    }
-    return severityClass;
-  };
-
-  // attach to global frame
-  if (typeof TYPO3 !== 'undefined') {
-    TYPO3.Severity = Severity;
-  }
-
-  return Severity;
-});
+define(["require","exports"],function(a,b){"use strict";var c;!function(a){a[a.notice=-2]="notice",a[a.info=-1]="info",a[a.ok=0]="ok",a[a.warning=1]="warning",a[a.error=2]="error"}(c||(c={}));var d,e=function(){function a(){}return a.getCssClass=function(a){var b;switch(a){case c.notice:b="notice";break;case c.ok:b="success";break;case c.warning:b="warning";break;case c.error:b="danger";break;case c.info:default:b="info"}return b},a.notice=c.notice,a.info=c.info,a.ok=c.ok,a.warning=c.warning,a.error=c.error,a}();try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Severity&&(d=window.opener.TYPO3.Severity),parent&&parent.window.TYPO3&&parent.window.TYPO3.Severity&&(d=parent.window.TYPO3.Severity),top&&top.TYPO3&&top.TYPO3.Severity&&(d=top.TYPO3.Severity)}catch(a){}return d||(d=e),TYPO3.Storage=d,d});
\ No newline at end of file
index a57825e..e3bad1a 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Severity"],function(a,b,c,d){"use strict";var e=function(){function a(){}return a.wizard=function(a,b){c.advanced({callback:function(a){a.find(".t3js-modal-body").addClass("t3-new-content-element-wizard-window")},content:a,severity:d.notice,size:c.sizes.medium,title:b,type:c.types.ajax})},a}();return e});
\ No newline at end of file
+define(["require","exports","TYPO3/CMS/Backend/Modal","../Severity"],function(a,b,c,d){"use strict";var e=function(){function a(){}return a.wizard=function(a,b){c.advanced({callback:function(a){a.find(".t3js-modal-body").addClass("t3-new-content-element-wizard-window")},content:a,severity:d.notice,size:c.sizes.medium,title:b,type:c.types.ajax})},a}();return e});
\ No newline at end of file