835c97afd26855dcef40e81f6fcbad1f9214ba0e
[Packages/TYPO3.CMS.git] / typo3 / sysext / em / res / js / em_tools.js
1 /***************************************************************
2 * Copyright notice
3 *
4 * (c) 2010 Steffen Kamper <info@sk-typo3.de>
5 * All rights reserved
6 *
7 * This script is part of the TYPO3 project. The TYPO3 project is
8 * free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * The GNU General Public License can be found at
14 * http://www.gnu.org/copyleft/gpl.html.
15 *
16 * This script is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * This copyright notice MUST APPEAR in all copies of the script!
22 ***************************************************************/
23
24 /**
25 * ExtJS for the extension manager.
26 *
27 *
28 * @author Steffen Kamper <info@sk-typo3.de>
29 * @package TYPO3
30 * @subpackage extension manager
31 */
32 Ext.ns('TYPO3.EM');
33
34 TYPO3.EM.Tools = function() {
35 return {
36 displayLocalExtension: function(extKey, reload) {
37 localStore = Ext.StoreMgr.get('localstore');
38 // select local extension list
39 Ext.getCmp('em-main').setActiveTab(0);
40 if (reload === true) {
41 TYPO3.EM.Filters.clearFilters();
42 localStore.showAction = extKey;
43 var search = Ext.getCmp('localSearchField');
44 search.setValue(extKey);
45 search.refreshTrigger();
46 localStore.load();
47 }
48 },
49
50 uploadExtension: function() {
51 if (Ext.isObject(TYPO3.EM.ExtensionUploadWindowInstance)) {
52 TYPO3.EM.ExtensionUploadWindowInstance.show();
53 } else {
54 TYPO3.EM.ExtensionUploadWindowInstance = new TYPO3.EM.ExtensionUploadWindow().show();
55 }
56 },
57
58 renderExtensionTitle: function(record) {
59 var description = record.data.description;
60 var value = record.data.title;
61 if (value == '') {
62 value = '[no title]';
63 }
64 if (record.data.reviewstate < 0) {
65 description += '<br><br><strong>' + TYPO3.l10n.localize('insecureExtension') + '</strong>';
66 }
67 return record.data.icon + ' ' + value + ' (v' + record.data.version + ')';
68 },
69
70 closeImportWindow: function() {
71 TYPO3.EM.ImportWindow.close();
72 },
73
74 refreshMenu: function(record, installAction) {
75 if (installAction == 'import') {
76 Ext.StoreMgr.get('repositoryliststore').getById(record.extkey).set('exists', 1);
77 TYPO3.EM.Tools.displayLocalExtension(record.extkey, true);
78 }
79 if (top.TYPO3ModuleMenu && installAction == 'install') {
80 top.TYPO3ModuleMenu.refreshMenu();
81 }
82 }
83 }
84 }();