80abe121a81f75471a1eec3dfb609f1602f30f17
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Resources / Public / JavaScript / Main.js
1 /*
2 * This file is part of the TYPO3 CMS project.
3 *
4 * It is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License, either version 2
6 * of the License, or any later version.
7 *
8 * For the full copyright and license information, please read the
9 * LICENSE.txt file that was distributed with this source code.
10 *
11 * The TYPO3 project - inspiring people to share!
12 */
13 /**
14 * Module: TYPO3/CMS/Extensionmanager/Main
15 * main logic holding everything together, consists of multiple parts
16 * ExtensionManager => Various functions for displaying the extension list / sorting
17 * Repository => Various AJAX functions for TER downloads
18 * ExtensionManager.Update => Various AJAX functions to display updates
19 * ExtensionManager.uploadForm => helper to show the upload form
20 */
21 define([
22 'jquery',
23 'nprogress',
24 'TYPO3/CMS/Backend/Modal',
25 'TYPO3/CMS/Backend/SplitButtons',
26 'datatables',
27 'TYPO3/CMS/Backend/jquery.clearable'
28 ], function($, NProgress, Modal, SplitButtons) {
29
30 /**
31 *
32 * @type {{identifier: {extensionlist: string, searchField: string, extensionManager: string}}}
33 * @exports TYPO3/CMS/Extensionmanager/Main
34 */
35 var ExtensionManager = {
36 identifier: {
37 extensionlist: '#typo3-extension-list',
38 searchField: '#Tx_Extensionmanager_extensionkey',
39 extensionManager: '.typo3-extension-manager'
40 }
41 };
42
43 /**
44 *
45 * @returns {Object}
46 */
47 ExtensionManager.manageExtensionListing = function() {
48 var $searchField = $(this.identifier.searchField),
49 dataTable = $(this.identifier.extensionlist).DataTable({
50 paging: false,
51 dom: 'lrtip',
52 lengthChange: false,
53 pageLength: 15,
54 stateSave: true,
55 drawCallback: this.bindExtensionListActions,
56 columns: [
57 null,
58 null,
59 {
60 type: 'extension'
61 },
62 null,
63 {
64 type: 'version'
65 }, {
66 orderable: false
67 },
68 null
69 ]
70 });
71
72 $searchField.parents('form').on('submit', function() {
73 return false;
74 });
75
76 var getVars = ExtensionManager.getUrlVars();
77
78 // restore filter
79 var currentSearch = (getVars['search'] ? getVars['search'] : dataTable.search());
80 $searchField.val(currentSearch);
81
82 $searchField.on('input', function(e) {
83 dataTable.search($(this).val()).draw();
84 });
85
86 return dataTable;
87 };
88
89 /**
90 *
91 */
92 ExtensionManager.bindExtensionListActions = function() {
93 $('.removeExtension').not('.transformed').each(function() {
94 var $me = $(this);
95 $me.data('href', $me.attr('href'));
96 $me.attr('href', '#');
97 $me.addClass('transformed');
98 $me.click(function() {
99 Modal.confirm(
100 TYPO3.lang['extensionList.removalConfirmation.title'],
101 TYPO3.lang['extensionList.removalConfirmation.question'],
102 top.TYPO3.Severity.error,
103 [
104 {
105 text: TYPO3.lang['button.cancel'],
106 active: true,
107 btnClass: 'btn-default',
108 trigger: function() {
109 Modal.dismiss();
110 }
111 }, {
112 text: TYPO3.lang['button.remove'],
113 btnClass: 'btn-danger',
114 trigger: function() {
115 ExtensionManager.removeExtensionFromDisk($me);
116 Modal.dismiss();
117 }
118 }
119 ]
120 );
121 });
122 });
123 };
124
125 /**
126 *
127 * @param {Object} $extension
128 */
129 ExtensionManager.removeExtensionFromDisk = function($extension) {
130 var $extManager = $(Repository.identifier.extensionManager);
131 $extManager.mask();
132 $.ajax({
133 url: $extension.data('href'),
134 beforeSend: function() {
135 NProgress.start();
136 },
137 success: function() {
138 location.reload();
139 },
140 error: function() {
141 $extManager.unmask();
142 },
143 complete: function() {
144 NProgress.done();
145 }
146 });
147 };
148
149 /**
150 *
151 * @returns {Array}
152 */
153 ExtensionManager.getUrlVars = function() {
154 var vars = [], hash;
155 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
156 for (var i = 0; i < hashes.length; i++) {
157 hash = hashes[i].split('=');
158 vars.push(hash[0]);
159 vars[hash[0]] = hash[1];
160 }
161 return vars;
162 };
163
164 $.fn.dataTableExt.oSort['extension-asc'] = function(a, b) {
165 return ExtensionManager.extensionCompare(a, b);
166 };
167
168 $.fn.dataTableExt.oSort['extension-desc'] = function(a, b) {
169 var result = ExtensionManager.extensionCompare(a, b);
170 return result * -1;
171 };
172
173 $.fn.dataTableExt.oSort['version-asc'] = function(a, b) {
174 var result = ExtensionManager.versionCompare(a, b);
175 return result * -1;
176 };
177
178 $.fn.dataTableExt.oSort['version-desc'] = function(a, b) {
179 return ExtensionManager.versionCompare(a, b);
180 };
181
182 /**
183 * Special sorting for the extension version column
184 *
185 * @param {String} a
186 * @param {String} b
187 * @returns {Number}
188 */
189 ExtensionManager.versionCompare = function(a, b) {
190 if (a === b) {
191 return 0;
192 }
193
194 var a_components = a.split(".");
195 var b_components = b.split(".");
196
197 var len = Math.min(a_components.length, b_components.length);
198
199 // loop while the components are equal
200 for (var i = 0; i < len; i++) {
201 // A bigger than B
202 if (parseInt(a_components[i]) > parseInt(b_components[i])) {
203 return 1;
204 }
205
206 // B bigger than A
207 if (parseInt(a_components[i]) < parseInt(b_components[i])) {
208 return -1;
209 }
210 }
211
212 // If one's a prefix of the other, the longer one is greaRepository.
213 if (a_components.length > b_components.length) {
214 return 1;
215 }
216
217 if (a_components.length < b_components.length) {
218 return -1;
219 }
220 // Otherwise they are the same.
221 return 0;
222 };
223
224 /**
225 * The extension name column can contain various forms of HTML that
226 * break a direct comparision of values
227 *
228 * @param {String} a
229 * @param {String} b
230 * @returns {Number}
231 */
232 ExtensionManager.extensionCompare = function(a, b) {
233 var div = document.createElement("div");
234 div.innerHTML = a;
235 var aStr = div.textContent || div.innerText || a;
236
237 div.innerHTML = b;
238 var bStr = div.textContent || div.innerText || b;
239
240 return aStr.trim().localeCompare(bStr.trim());
241 }
242
243 /**
244 *
245 * @param {Object} data
246 */
247 ExtensionManager.updateExtension = function(data) {
248 var message = '<h1>' + TYPO3.lang['extensionList.updateConfirmation.title'] + '</h1>';
249 message += '<h2>' + TYPO3.lang['extensionList.updateConfirmation.message'] + '</h2>';
250 message += '<form>';
251 var i = 0;
252 $.each(data.updateComments, function(version, comment) {
253 message += '<h3><input type="radio" ' + (i == 0 ? 'checked="checked" ' : '') + 'name="version" value="' + version + '" /> ' + version + '</h3>';
254 message += '<div>' + comment + '</div>';
255 i++;
256 });
257 message += '</form>';
258
259 var $extManager = $(ExtensionManager.identifier.extensionManager);
260 NProgress.done();
261 $extManager.unmask();
262
263 Modal.confirm(
264 TYPO3.lang['extensionList.updateConfirmation.questionVersionComments'],
265 message,
266 top.TYPO3.Severity.warning,
267 [
268 {
269 text: TYPO3.lang['button.cancel'],
270 active: true,
271 btnClass: 'btn-default',
272 trigger: function() {
273 Modal.dismiss();
274 }
275 }, {
276 text: TYPO3.lang['button.updateExtension'],
277 btnClass: 'btn-warning',
278 trigger: function() {
279 $.ajax({
280 url: data.url,
281 data: {
282 tx_extensionmanager_tools_extensionmanagerextensionmanager: {
283 version: $('input:radio[name=version]:checked', Modal.currentModal).val()
284 }
285 },
286 dataType: 'json',
287 beforeSend: function() {
288 $extManager.mask();
289 NProgress.start();
290 },
291 complete: function() {
292 location.reload();
293 }
294 });
295 Modal.dismiss();
296 }
297 }
298 ]
299 );
300 };
301
302 /**
303 * configuration properties
304 */
305 ExtensionManager.configurationFieldSupport = function() {
306 $('.t3js-emconf-offset').each(function() {
307 var $me = $(this),
308 $parent = $me.parent(),
309 id = $me.attr('id'),
310 val = $me.attr('value'),
311 valArr = val.split(',');
312
313 $me.attr('data-offsetfield-x', '#' + id + '_offset_x')
314 .attr('data-offsetfield-y', '#' + id + '_offset_y')
315 .wrap('<div class="hidden"></div>');
316
317 var elementX = '' +
318 '<div class="form-multigroup-item">' +
319 '<div class="input-group">' +
320 '<div class="input-group-addon">x</div>' +
321 '<input id="' + id + '_offset_x" class="form-control t3js-emconf-offsetfield" data-target="#' + id + '" value="' + $.trim(valArr[0]) + '">' +
322 '</div>' +
323 '</div>';
324 var elementY = '' +
325 '<div class="form-multigroup-item">' +
326 '<div class="input-group">' +
327 '<div class="input-group-addon">y</div>' +
328 '<input id="' + id + '_offset_y" class="form-control t3js-emconf-offsetfield" data-target="#' + id + '" value="' + $.trim(valArr[1]) + '">' +
329 '</div>' +
330 '</div>';
331
332 var offsetGroup = '<div class="form-multigroup-wrap">' + elementX + elementY + '</div>';
333 $parent.append(offsetGroup);
334 $parent.find('.t3js-emconf-offset').keyup(function() {
335 var $target = $($(this).data('target'));
336 $target.attr(
337 'value',
338 $($target.data('offsetfield-x')).val() + ',' + $($target.data('offsetfield-y')).val()
339 );
340 });
341 });
342
343 $('.t3js-emconf-wrap').each(function() {
344 var $me = $(this),
345 $parent = $me.parent(),
346 id = $me.attr('id'),
347 val = $me.attr('value'),
348 valArr = val.split('|');
349
350 $me.attr('data-wrapfield-start', '#' + id + '_wrap_start')
351 .attr('data-wrapfield-end', '#' + id + '_wrap_end')
352 .wrap('<div class="hidden"></div>');
353
354 var elementStart = '' +
355 '<div class="form-multigroup-item">' +
356 '<input id="' + id + '_wrap_start" class="form-control t3js-emconf-wrapfield" data-target="#' + id + '" value="' + $.trim(valArr[0]) + '">' +
357 '</div>';
358 var elementEnd = '' +
359 '<div class="form-multigroup-item">' +
360 '<input id="' + id + '_wrap_end" class="form-control t3js-emconf-wrapfield" data-target="#' + id + '" value="' + $.trim(valArr[1]) + '">' +
361 '</div>';
362
363 var wrapGroup = '<div class="form-multigroup-wrap">' + elementStart + elementEnd + '</div>';
364 $parent.append(wrapGroup);
365 $parent.find('.t3js-emconf-wrapfield').keyup(function() {
366 var $target = $($(this).data('target'));
367 $target.attr(
368 'value',
369 $($target.data('wrapfield-start')).val() + '|' + $($target.data('wrapfield-end')).val()
370 );
371 });
372 });
373 };
374
375 /**
376 *
377 * @type {{downloadPath: string, identifier: {extensionManager: string}}}
378 */
379 var Repository = {
380 downloadPath: '',
381 identifier: {
382 extensionManager: '.typo3-extension-manager'
383 }
384 };
385
386 /**
387 *
388 */
389 Repository.initDom = function() {
390 NProgress.configure({parent: '.t3js-module-body', showSpinner: false});
391
392 $('#terTable').DataTable({
393 lengthChange: false,
394 pageLength: 15,
395 stateSave: false,
396 info: false,
397 paging: false,
398 searching: false,
399 ordering: false,
400 drawCallback: Repository.bindDownload
401 });
402
403 $('#terVersionTable').DataTable({
404 lengthChange: false,
405 pageLength: 15,
406 stateSave: false,
407 info: false,
408 paging: false,
409 searching: false,
410 drawCallback: Repository.bindDownload,
411 order: [
412 [2, 'asc']
413 ],
414 columns: [
415 {orderable: false},
416 null,
417 {type: 'version'},
418 null,
419 null,
420 null
421 ]
422 });
423
424 $('#terSearchTable').DataTable({
425 paging: false,
426 lengthChange: false,
427 stateSave: false,
428 searching: false,
429 language: {
430 search: 'Filter results:'
431 },
432 ordering: false,
433 drawCallback: Repository.bindDownload
434 });
435
436 Repository.bindDownload();
437 Repository.bindSearchFieldResetter();
438 };
439
440 /**
441 *
442 */
443 Repository.bindDownload = function() {
444 var installButtons = $('.downloadFromTer form.download button[type=submit]');
445 installButtons.off('click');
446 installButtons.on('click', function(event) {
447 event.preventDefault();
448 var url = $(event.currentTarget.form).attr('data-href');
449 Repository.downloadPath = $(event.currentTarget.form).find('input.downloadPath:checked').val();
450 $.ajax({
451 url: url,
452 dataType: 'json',
453 beforeSend: function() {
454 $(Repository.identifier.extensionManager).mask();
455 NProgress.start();
456 },
457 success: Repository.getDependencies
458 });
459 });
460 };
461
462 /**
463 *
464 * @param {Object} data
465 * @returns {Boolean}
466 */
467 Repository.getDependencies = function(data) {
468 var $extManager = $(Repository.identifier.extensionManager);
469 NProgress.done();
470 $extManager.unmask();
471 if (data.hasDependencies) {
472 Modal.confirm(data.title, data.message, top.TYPO3.Severity.info, [
473 {
474 text: TYPO3.lang['button.cancel'],
475 active: true,
476 btnClass: 'btn-default',
477 trigger: function() {
478 Modal.dismiss();
479 }
480 }, {
481 text: TYPO3.lang['button.resolveDependencies'],
482 btnClass: 'btn-info',
483 trigger: function() {
484 Repository.getResolveDependenciesAndInstallResult(data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath);
485 Modal.dismiss();
486 }
487 }
488 ]);
489 } else {
490 if(data.hasErrors) {
491 top.TYPO3.Notification.error(data.title, data.message, 15);
492 } else {
493 Repository.getResolveDependenciesAndInstallResult(data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath);
494 }
495 }
496 return false;
497 };
498
499 /**
500 *
501 * @param {String} url
502 */
503 Repository.getResolveDependenciesAndInstallResult = function(url) {
504 var $extManager = $(Repository.identifier.extensionManager);
505 $.ajax({
506 url: url,
507 dataType: 'json',
508 beforeSend: function() {
509 $extManager.mask();
510 NProgress.start();
511 },
512 success: function (data) {
513 if (data.errorCount > 0) {
514 Modal.confirm(data.errorTitle, data.errorMessage, top.TYPO3.Severity.error, [
515 {
516 text: TYPO3.lang['button.cancel'],
517 active: true,
518 btnClass: 'btn-default',
519 trigger: function() {
520 Modal.dismiss();
521 }
522 }, {
523 text: TYPO3.lang['button.resolveDependenciesIgnore'],
524 btnClass: 'btn-danger disabled t3js-dependencies',
525 trigger: function() {
526 Repository.getResolveDependenciesAndInstallResult(data.skipDependencyUri);
527 Modal.dismiss();
528 }
529 }
530 ]);
531 Modal.currentModal.on('shown.bs.modal', function() {
532 var $actionButton = Modal.currentModal.find('.t3js-dependencies');
533 top.TYPO3.jQuery('input[name=unlockDependencyIgnoreButton]').on('change', function() {
534 $actionButton.toggleClass('disabled', !$(this).prop('checked'));
535 });
536 });
537 } else {
538 var successMessage = TYPO3.lang['extensionList.dependenciesResolveDownloadSuccess.message' + data.installationTypeLanguageKey].replace(/\{0\}/g, data.extension);
539
540 successMessage += '\n' + TYPO3.lang['extensionList.dependenciesResolveDownloadSuccess.header'] + ': ';
541 $.each(data.result, function(index, value) {
542 successMessage += '\n\n' + TYPO3.lang['extensionList.dependenciesResolveDownloadSuccess.item'] + ' ' + index + ': ';
543 $.each(value, function(extkey) {
544 successMessage += '\n* ' + extkey
545 });
546 });
547 top.TYPO3.Notification.info(TYPO3.lang['extensionList.dependenciesResolveFlashMessage.title' + data.installationTypeLanguageKey].replace(/\{0\}/g, data.extension), successMessage, 15);
548 top.TYPO3.ModuleMenu.App.refreshMenu();
549 }
550 },
551 complete: function() {
552 NProgress.done();
553 $extManager.unmask();
554 }
555 });
556 };
557
558 /**
559 *
560 */
561 Repository.bindSearchFieldResetter = function() {
562 var $searchFields = $('.typo3-extensionmanager-searchTerForm input[type="text"]');
563 var searchResultShown = ('' !== $searchFields.first().val());
564
565 $searchFields.clearable(
566 {
567 onClear: function() {
568 if (searchResultShown) {
569 $(this).closest('form').submit();
570 }
571 }
572 }
573 );
574 };
575
576 /**
577 *
578 * @type {{identifier: {extensionTable: string, terUpdateAction: string, pagination: string, splashscreen: string, terTableWrapper: string, terTableDataTableWrapper: string}}}
579 */
580 ExtensionManager.Update = {
581 identifier: {
582 extensionTable: '#terTable',
583 terUpdateAction: '.update-from-ter',
584 pagination: '.pagination-wrap',
585 splashscreen: '.splash-receivedata',
586 terTableWrapper: '#terTableWrapper',
587 terTableDataTableWrapper: '#terTableWrapper .dataTables_wrapper'
588 }
589 };
590
591 /**
592 * Register "update from ter" action
593 */
594 ExtensionManager.Update.initializeEvents = function() {
595 $(ExtensionManager.Update.identifier.terUpdateAction).each(function() {
596
597 // "this" is the form which updates the extension list from
598 // TER on submit
599 var $me = $(this),
600 updateURL = $(this).attr('action');
601
602 $me.attr('action', '#');
603 $me.submit(function() {
604 // Force update on click.
605 ExtensionManager.Update.updateFromTer(updateURL, true);
606
607 // Prevent normal submit action.
608 return false;
609 });
610
611 // This might give problems when there are more "update"-buttons,
612 // each one would trigger a TER-ExtensionManager.Update.
613 ExtensionManager.Update.updateFromTer(updateURL, false);
614 });
615 };
616
617 /**
618 *
619 * @param {String} url
620 * @param {Boolean} forceUpdate
621 */
622 ExtensionManager.Update.updateFromTer = function(url, forceUpdate) {
623 if (forceUpdate) {
624 url = url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager%5BforceUpdateCheck%5D=1';
625 }
626
627 // Hide triggers for TER update
628 $(ExtensionManager.Update.identifier.terUpdateAction).addClass('is-hidden');
629
630 // Hide extension table
631 $(ExtensionManager.Update.identifier.extensionTable).hide();
632
633 // Show loaders
634 $(ExtensionManager.Update.identifier.splashscreen).addClass('is-shown');
635 $(ExtensionManager.Update.identifier.terTableDataTableWrapper).addClass('is-loading');
636 $(ExtensionManager.Update.identifier.pagination).addClass('is-loading');
637
638 var reload = false;
639
640 $.ajax({
641 url: url,
642 dataType: 'json',
643 cache: false,
644 beforeSend: function() {
645 NProgress.start();
646 },
647 success: function(data) {
648 // Something went wrong, show message
649 if (data.errorMessage.length) {
650 top.TYPO3.Notification.error(TYPO3.lang['extensionList.updateFromTerFlashMessage.title'], data.errorMessage, 10);
651 }
652
653 // Message with latest updates
654 var $lastUpdate = $(ExtensionManager.Update.identifier.terUpdateAction + ' .time-since-last-update');
655 $lastUpdate.text(data.timeSinceLastUpdate);
656 $lastUpdate.attr(
657 'title',
658 TYPO3.lang['extensionList.updateFromTer.lastUpdate.timeOfLastUpdate'] + data.lastUpdateTime
659 );
660
661 if (data.updated) {
662 // Reload page
663 reload = true;
664 window.location.replace(window.location.href);
665 }
666 },
667 error: function(jqXHR, textStatus, errorThrown) {
668 // Create an error message with diagnosis info.
669 var errorMessage = textStatus + '(' + errorThrown + '): ' + jqXHR.responseText;
670
671 top.TYPO3.Notification.warning(
672 TYPO3.lang['extensionList.updateFromTerFlashMessage.title'],
673 errorMessage,
674 10
675 );
676 },
677 complete: function() {
678 NProgress.done();
679
680 if (!reload) {
681 // Hide loaders
682 $(ExtensionManager.Update.identifier.splashscreen).removeClass('is-shown');
683 $(ExtensionManager.Update.identifier.terTableDataTableWrapper).removeClass('is-loading');
684 $(ExtensionManager.Update.identifier.pagination).removeClass('is-loading');
685
686 // Show triggers for TER-update
687 $(ExtensionManager.Update.identifier.terUpdateAction).removeClass('is-hidden');
688
689 // Show extension table
690 $(ExtensionManager.Update.identifier.extensionTable).show();
691 }
692 }
693 });
694 };
695
696 /**
697 *
698 */
699 ExtensionManager.Update.transformPaginatorToAjax = function () {
700 $(ExtensionManager.Update.identifier.pagination + ' a').each(function() {
701 var $me = $(this);
702 $me.data('href', $(this).attr('href'));
703 $me.attr('href', '#');
704 $me.click(function() {
705 var $terTableWrapper = $(ExtensionManager.Update.identifier.terTableWrapper);
706 $terTableWrapper.mask();
707 NProgress.start();
708 $.ajax({
709 url: $(this).data('href'),
710 dataType: 'json',
711 success: function(data) {
712 $terTableWrapper.html(data);
713 ExtensionManager.Update.transformPaginatorToAjax();
714 },
715 complete: function() {
716 NProgress.done();
717 $terTableWrapper.unmask();
718 }
719 });
720 });
721 });
722 };
723
724 /**
725 * show the uploading form
726 */
727 ExtensionManager.UploadForm = {
728 expandedUploadFormClass: 'transformed'
729 };
730
731 /**
732 *
733 */
734 ExtensionManager.UploadForm.initializeEvents = function() {
735 // Show upload form
736 $(document).on('click', '.t3js-upload', function(event) {
737 var $me = $(this),
738 $uploadForm = $('.uploadForm');
739
740 event.preventDefault();
741 if($me.hasClass(ExtensionManager.UploadForm.expandedUploadFormClass)) {
742 $uploadForm.stop().slideUp();
743 $me.removeClass(ExtensionManager.UploadForm.expandedUploadFormClass);
744 } else {
745 $me.addClass(ExtensionManager.UploadForm.expandedUploadFormClass);
746 $uploadForm.stop().slideDown();
747
748 $.ajax({
749 url: $me.attr('href'),
750 dataType: 'html',
751 success: function (data) {
752 $uploadForm.html(data);
753 }
754 });
755 }
756 });
757 };
758
759 $(function() {
760 var dataTable = ExtensionManager.manageExtensionListing();
761
762 $(document).on('click', '.onClickMaskExtensionManager', function() {
763 $(ExtensionManager.identifier.extensionManager).mask();
764 NProgress.start();
765 }).on('click', 'a[data-action=update-extension]', function(e) {
766 e.preventDefault();
767 $.ajax({
768 url: $(this).attr('href'),
769 dataType: 'json',
770 beforeSend: function() {
771 $(ExtensionManager.identifier.extensionManager).mask();
772 NProgress.start();
773 },
774 success: ExtensionManager.updateExtension
775 });
776 }).on('change', 'input[name=unlockDependencyIgnoreButton]', function() {
777 var $actionButton = TYPO3.jQuery('.t3js-dependencies');
778 $actionButton.toggleClass('disabled', !$(this).prop('checked'));
779 });
780
781 $(ExtensionManager.identifier.searchField).clearable({
782 onClear: function() {
783 dataTable.search('').draw();
784 }
785 });
786
787 $(document).on('click', '.t3-button-action-installdistribution', function() {
788 $(ExtensionManager.identifier.extensionManager).mask();
789 });
790
791 ExtensionManager.configurationFieldSupport();
792 var $validate = $('.validate');
793 $validate.validate();
794
795 SplitButtons.addPreSubmitCallback(function(e) {
796 if ($(e.target).hasClass('t3js-save-close')) {
797 $validate.append($('<input />', {type: 'hidden', name: 'tx_extensionmanager_tools_extensionmanagerextensionmanager[action]', value: 'saveAndClose'}));
798 }
799 });
800
801 // initialize the repository
802 Repository.initDom();
803
804 ExtensionManager.Update.initializeEvents();
805 ExtensionManager.UploadForm.initializeEvents();
806 });
807
808 if (typeof TYPO3.ExtensionManager === 'undefined') {
809 TYPO3.ExtensionManager = ExtensionManager;
810 }
811
812 return ExtensionManager;
813 });