Index: typo3/js/notification.js =================================================================== --- typo3/js/notification.js (Revision 0) +++ typo3/js/notification.js (Revision 0) @@ -0,0 +1,159 @@ +/*************************************************************** +* Copyright notice +* +* (c) 2010 Oliver Hader +* All rights reserved +* +* This script is part of the TYPO3 project. The TYPO3 project is +* free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* A copy is found in the textfile GPL.txt and important notices to the license +* from the author is found in LICENSE.txt distributed with these scripts. +* +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ + +Ext.onReady(function() { + Ext.ux.TYPO3.window = Ext.extend(Ext.Window, { + width: 450, + autoHeight: true, + closable: true, + resizable: false, + plain: true, + border: false, + modal: true, + draggable: true, + closeAction: 'close', + id: 'defaultWindow', + cls: 't3-window', + title: '', + html: '', + buttons: [], + + constructor: function(config) { + config = config || {}; + Ext.apply(this, config); + Ext.ux.TYPO3.window.superclass.constructor.call(this, config); + }, + }); + + TYPO3.Window = { + activeWindows: {}, + + getWindow: function(configuration) { + var identifier = configuration.identifier || configuration.id || ''; + + if (!TYPO3.Window.hasActiveWindow(identifier)) { + var window = new Ext.ux.TYPO3.window(configuration).show(); + TYPO3.Window.setActiveWindow(identifier, window); + return window; + } + + return false; + }, + + setActiveWindow: function(identifier, window) { + if (Ext.isString(identifier) && identifier) { + TYPO3.Window.activeWindows[identifier] = window; + } + }, + + getActiveWindow: function(identifier) { + if (TYPO3.Window.hasActiveWindow(identifier)) { + return TYPO3.Window.activeWindows[identifier]; + } + }, + + hasActiveWindow: function(identifier) { + return (identifier && Ext.isObject(TYPO3.Window.activeWindows[identifier])); + }, + + closeAllActiveWindows: function() { + Ext.iterate(TYPO3.Window.activeWindows, function(key, window) { + if (Ext.isObject(window)) { + window.close(); + } + }); + } + }; + + TYPO3.Dialog = { + defaultDialogConfiguration: { + title: '', + msg: '', + buttons: [], + fn: Ext.emptyFn + }, + + informationDialogConfiguration: { + buttons: Ext.MessageBox.OK, + icon: Ext.MessageBox.INFO + }, + + questionDialogConfiguration: { + buttons: Ext.MessageBox.YESNO, + icon: Ext.MessageBox.QUESTION + }, + + warningDialogConfiguration: { + buttons: Ext.MessageBox.OK, + icon: Ext.MessageBox.WARNING + }, + + errorDialogConfiguration: { + buttons: Ext.MessageBox.OK, + icon: Ext.MessageBox.ERROR + }, + + getInformationDialog: function(configuration) { + configuration = configuration || {}; + configuration = Ext.apply( + TYPO3.Dialog.defaultDialogConfiguration, + TYPO3.Dialog.informationDialogConfiguration, + configuration + ); + Ext.Msg.show(configuration); + }, + + getQuestionDialog: function(configuration) { + configuration = configuration || {}; + configuration = Ext.apply( + TYPO3.Dialog.defaultDialogConfiguration, + TYPO3.Dialog.questionDialogConfiguration, + configuration + ); + Ext.Msg.show(configuration); + }, + + getWarningDialog: function(configuration) { + configuration = configuration || {}; + configuration = Ext.apply( + TYPO3.Dialog.defaultDialogConfiguration, + TYPO3.Dialog.warningDialogConfiguration, + configuration + ); + Ext.Msg.show(configuration); + }, + + getErrorDialog: function(configuration) { + configuration = configuration || {}; + configuration = Ext.apply( + TYPO3.Dialog.defaultDialogConfiguration, + TYPO3.Dialog.errorDialogConfiguration, + configuration + ); + Ext.Msg.show(configuration); + } + }; +}); Index: typo3/backend.php =================================================================== --- typo3/backend.php (Revision 8809) +++ typo3/backend.php (Arbeitskopie) @@ -131,6 +131,7 @@ '../t3lib/js/extjs/ux/flashmessages.js', '../t3lib/js/extjs/ux/ext.ux.tabclosemenu.js', 'js/backend.js', + 'js/notification.js', 'js/loginrefresh.js', 'js/extjs/debugPanel.js', 'js/extjs/viewport.js',