[TASK] Migrate TYPO3/CMS/Impexp/* to TypeScript 50/60250/4
authorFrank Naegler <frank.naegler@typo3.org>
Thu, 14 Mar 2019 17:46:56 +0000 (18:46 +0100)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 12 Apr 2019 06:47:15 +0000 (08:47 +0200)
Resolves: #87915
Releases: master
Change-Id: I4a7fa727c47b85bfae728f0a1dab0e6e833063ce
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60250
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Steffen Frese <steffenf14@gmail.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Steffen Frese <steffenf14@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ContextMenuActions.ts [new file with mode: 0644]
Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ImportExport.ts [new file with mode: 0644]
typo3/sysext/impexp/Resources/Public/JavaScript/ContextMenuActions.js
typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js

diff --git a/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ContextMenuActions.ts b/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ContextMenuActions.ts
new file mode 100644 (file)
index 0000000..8c1cc9e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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/Impexp/ContextMenuActions
+ *
+ * JavaScript to handle import/export actions from context menu
+ * @exports TYPO3/CMS/Impexp/ContextMenuActions
+ */
+class ContextMenuActions {
+
+  public exportT3d(table: string, uid: number): void {
+    if (table === 'pages') {
+      top.TYPO3.Backend.ContentContainer.setUrl(
+        top.TYPO3.settings.ImportExport.moduleUrl +
+        '&tx_impexp[action]=export&' +
+        'id=0&tx_impexp[pagetree][id]=' + uid +
+        '&tx_impexp[pagetree][levels]=0' +
+        '&tx_impexp[pagetree][tables][]=_ALL',
+      );
+    } else {
+      top.TYPO3.Backend.ContentContainer.setUrl(
+        top.TYPO3.settings.ImportExport.moduleUrl +
+        '&tx_impexp[action]=export' +
+        '&tx_impexp[record][]=' + table + ':' + uid +
+        '&tx_impexp[external_ref][tables][]=_ALL',
+      );
+    }
+  }
+
+  public importT3d(table: string, uid: number): void {
+    top.TYPO3.Backend.ContentContainer.setUrl(
+      top.TYPO3.settings.ImportExport.moduleUrl +
+      '&id=' + uid +
+      '&table=' + table + '&tx_impexp[action]=import',
+    );
+  }
+}
+
+
+export = new ContextMenuActions();
diff --git a/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ImportExport.ts b/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ImportExport.ts
new file mode 100644 (file)
index 0000000..1268c84
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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!
+ */
+
+import * as $ from 'jquery';
+import Modal = require('TYPO3/CMS/Backend/Modal');
+
+/**
+ * Module: TYPO3/CMS/Impexp/ImportExport
+ * JavaScript to handle confirm windows in the Import/Export module
+ * @exports TYPO3/CMS/Impexp/ImportExport
+ */
+class ImportExport {
+  constructor() {
+    $((): void => {
+      $(document).on('click', '.t3js-confirm-trigger', (e: JQueryEventObject): void => {
+        const $button = $(e.currentTarget);
+        Modal.confirm($button.data('title'), $button.data('message'))
+          .on('confirm.button.ok', (): void => {
+            $('#t3js-submit-field')
+              .attr('name', $button.attr('name'))
+              .closest('form').submit();
+            Modal.currentModal.trigger('modal-dismiss');
+          })
+          .on('confirm.button.cancel', (): void => {
+            Modal.currentModal.trigger('modal-dismiss');
+          });
+      });
+
+      $('.t3js-impexp-toggledisabled').on('click', (): void => {
+        const $checkboxes = $('table.t3js-impexp-preview tr[data-active="hidden"] input.t3js-exclude-checkbox');
+        if ($checkboxes.length) {
+          const $firstCheckbox = $checkboxes.get(0) as HTMLInputElement;
+          $checkboxes.prop('checked', !$firstCheckbox.checked);
+        }
+      });
+    });
+  }
+}
+
+export = new ImportExport();
index 02c0ac5..58c30ba 100644 (file)
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-/**
- * Module: TYPO3/CMS/Impexp/ContextMenuActions
- *
- * JavaScript to handle import/export actions from context menu
- * @exports TYPO3/CMS/Impexp/ContextMenuActions
- */
-define(function() {
-  'use strict';
-
-  /**
-   * @exports TYPO3/CMS/Impexp/ContextMenuActions
-   */
-  var ContextMenuActions = {};
-
-  ContextMenuActions.exportT3d = function(table, uid) {
-    if (table === 'pages') {
-      top.TYPO3.Backend.ContentContainer.setUrl(
-        top.TYPO3.settings.ImportExport.moduleUrl +
-        '&tx_impexp[action]=export&' +
-        'id=0&tx_impexp[pagetree][id]=' + uid +
-        '&tx_impexp[pagetree][levels]=0' +
-        '&tx_impexp[pagetree][tables][]=_ALL'
-      );
-    } else {
-      top.TYPO3.Backend.ContentContainer.setUrl(
-        top.TYPO3.settings.ImportExport.moduleUrl +
-        '&tx_impexp[action]=export' +
-        '&tx_impexp[record][]=' + table + ':' + uid +
-        '&tx_impexp[external_ref][tables][]=_ALL'
-      );
-    }
-  };
-
-  ContextMenuActions.importT3d = function(table, uid) {
-    top.TYPO3.Backend.ContentContainer.setUrl(
-      top.TYPO3.settings.ImportExport.moduleUrl +
-      '&id=' + uid +
-      '&table=' + table + '&tx_impexp[action]=import'
-    );
-  };
-
-  return ContextMenuActions;
-});
+define(["require","exports"],function(t,e){"use strict";return new(function(){function t(){}return t.prototype.exportT3d=function(t,e){"pages"===t?top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.ImportExport.moduleUrl+"&tx_impexp[action]=export&id=0&tx_impexp[pagetree][id]="+e+"&tx_impexp[pagetree][levels]=0&tx_impexp[pagetree][tables][]=_ALL"):top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.ImportExport.moduleUrl+"&tx_impexp[action]=export&tx_impexp[record][]="+t+":"+e+"&tx_impexp[external_ref][tables][]=_ALL")},t.prototype.importT3d=function(t,e){top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.ImportExport.moduleUrl+"&id="+e+"&table="+t+"&tx_impexp[action]=import")},t}())});
\ No newline at end of file
index a1643a0..408465f 100644 (file)
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-/**
- * Module: TYPO3/CMS/Impexp/ImportExport
- * JavaScript to handle confirm windows in the Import/Export module
- * @exports TYPO3/CMS/Impexp/ImportExport
- */
-define(['jquery', 'TYPO3/CMS/Backend/Modal'], function($, Modal) {
-  'use strict';
-
-  $(function() {
-    $(document).on('click', '.t3js-confirm-trigger', function() {
-      var $button = $(this);
-      Modal.confirm($button.data('title'), $button.data('message'))
-        .on('confirm.button.ok', function() {
-          $('#t3js-submit-field')
-            .attr('name', $button.attr('name'))
-            .closest('form').submit();
-          Modal.currentModal.trigger('modal-dismiss');
-        })
-        .on('confirm.button.cancel', function() {
-          Modal.currentModal.trigger('modal-dismiss');
-        });
-    });
-
-    $('.t3js-impexp-toggledisabled').on('click', function() {
-      var $checkboxes = $('table.t3js-impexp-preview tr[data-active="hidden"] input.t3js-exclude-checkbox');
-      if ($checkboxes.length) {
-        $checkboxes.prop('checked', !$checkboxes.get(0).checked);
-      }
-    });
-  });
-});
+define(["require","exports","jquery","TYPO3/CMS/Backend/Modal"],function(t,e,n,i){"use strict";return new function(){n(function(){n(document).on("click",".t3js-confirm-trigger",function(t){var e=n(t.currentTarget);i.confirm(e.data("title"),e.data("message")).on("confirm.button.ok",function(){n("#t3js-submit-field").attr("name",e.attr("name")).closest("form").submit(),i.currentModal.trigger("modal-dismiss")}).on("confirm.button.cancel",function(){i.currentModal.trigger("modal-dismiss")})}),n(".t3js-impexp-toggledisabled").on("click",function(){var t=n('table.t3js-impexp-preview tr[data-active="hidden"] input.t3js-exclude-checkbox');if(t.length){var e=t.get(0);t.prop("checked",!e.checked)}})})}});
\ No newline at end of file