Bug #23564 » 0015745v2.patch

Administrator Admin, 2010-09-21 19:18

View differences:

typo3/backend.php (working copy)
131 131
			'../t3lib/js/extjs/ux/flashmessages.js',
132 132
			'../t3lib/js/extjs/ux/ext.ux.tabclosemenu.js',
133 133
			'js/backend.js',
134
			'js/notification.js',
134 135
			'js/loginrefresh.js',
135 136
			'js/extjs/debugPanel.js',
136 137
			'js/extjs/viewport.js',
typo3/js/notification.js (revision 0)
1
/***************************************************************
2
*  Copyright notice
3
*
4
*  (c) 2010 Oliver Hader <oliver@typo3.org>
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
*  A copy is found in the textfile GPL.txt and important notices to the license
16
*  from the author is found in LICENSE.txt distributed with these scripts.
17
*
18
*
19
*  This script is distributed in the hope that it will be useful,
20
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
*  GNU General Public License for more details.
23
*
24
*  This copyright notice MUST APPEAR in all copies of the script!
25
***************************************************************/
26

  
27
Ext.onReady(function() {
28
	Ext.ux.TYPO3.window = Ext.extend(Ext.Window, {
29
		width: 450,
30
		autoHeight: true,
31
		closable: true,
32
		resizable: false,
33
		plain: true,
34
		border: false,
35
		modal: true,
36
		draggable: true,
37
		closeAction: 'close',
38
		id: 'defaultWindow',
39
		cls: 't3-window',
40
		title: '',
41
		html: '',
42
		buttons: [],
43

  
44
		constructor: function(config) {
45
			config = config || {};
46
			Ext.apply(this, config);
47
			Ext.ux.TYPO3.window.superclass.constructor.call(this, config);
48
		},
49

  
50
		listeners: {
51
			close: function(panel) {
52
				var identifier = panel.identifier || panel.id || '';
53
				TYPO3.Window.unsetActiveWindow(identifier);
54
			}
55
		}
56

  
57
	});
58

  
59
	TYPO3.Window = {
60
		activeWindows: {},
61

  
62
		getWindow: function(configuration) {
63
			var identifier = configuration.identifier || configuration.id || '';
64

  
65
			if (!TYPO3.Window.hasActiveWindow(identifier)) {
66
				var window = new Ext.ux.TYPO3.window(configuration).show();
67
				TYPO3.Window.setActiveWindow(identifier, window);
68
				return window;
69
			}
70

  
71
			return false;
72
		},
73

  
74
		setActiveWindow: function(identifier, window) {
75
			if (Ext.isString(identifier) && identifier) {
76
				TYPO3.Window.activeWindows[identifier] = window;
77
			}
78
		},
79

  
80
		unsetActiveWindow: function(identifier) {
81
			if (Ext.isString(identifier) && identifier) {
82
				TYPO3.Window.activeWindows[identifier] = false;
83
			}
84
		},
85

  
86
		getActiveWindow: function(identifier) {
87
			if (TYPO3.Window.hasActiveWindow(identifier)) {
88
				return TYPO3.Window.activeWindows[identifier];
89
			}
90
		},
91

  
92
		hasActiveWindow: function(identifier) {
93
			return (identifier && Ext.isObject(TYPO3.Window.activeWindows[identifier]));
94
		},
95

  
96
		closeAllActiveWindows: function() {
97
			Ext.iterate(TYPO3.Window.activeWindows, function(key, window) {
98
				if (Ext.isObject(window)) {
99
					window.close();
100
				}
101
			});
102
		}
103
	};
104

  
105
	TYPO3.Dialog = {
106
		defaultDialogConfiguration: {
107
			title: '',
108
			msg: '',
109
			buttons: [],
110
			fn: Ext.emptyFn
111
		},
112

  
113
		informationDialogConfiguration: {
114
			buttons: Ext.MessageBox.OK,
115
			icon: Ext.MessageBox.INFO
116
		},
117

  
118
		questionDialogConfiguration: {
119
			buttons: Ext.MessageBox.YESNO,
120
			icon: Ext.MessageBox.QUESTION
121
		},
122

  
123
		warningDialogConfiguration: {
124
			buttons: Ext.MessageBox.OK,
125
			icon: Ext.MessageBox.WARNING
126
		},
127

  
128
		errorDialogConfiguration: {
129
			buttons: Ext.MessageBox.OK,
130
			icon: Ext.MessageBox.ERROR
131
		},
132

  
133
		getInformationDialog: function(configuration) {
134
			configuration = configuration || {};
135
			configuration = Ext.apply(
136
				TYPO3.Dialog.defaultDialogConfiguration,
137
				TYPO3.Dialog.informationDialogConfiguration,
138
				configuration
139
			);
140
			Ext.Msg.show(configuration);
141
		},
142

  
143
		getQuestionDialog: function(configuration) {
144
			configuration = configuration || {};
145
			configuration = Ext.apply(
146
				TYPO3.Dialog.defaultDialogConfiguration,
147
				TYPO3.Dialog.questionDialogConfiguration,
148
				configuration
149
			);
150
			Ext.Msg.show(configuration);
151
		},
152

  
153
		getWarningDialog: function(configuration) {
154
			configuration = configuration || {};
155
			configuration = Ext.apply(
156
				TYPO3.Dialog.defaultDialogConfiguration,
157
				TYPO3.Dialog.warningDialogConfiguration,
158
				configuration
159
			);
160
			Ext.Msg.show(configuration);
161
		},
162

  
163
		getErrorDialog: function(configuration) {
164
			configuration = configuration || {};
165
			configuration = Ext.apply(
166
				TYPO3.Dialog.defaultDialogConfiguration,
167
				TYPO3.Dialog.errorDialogConfiguration,
168
				configuration
169
			);
170
			Ext.Msg.show(configuration);
171
		}
172
	};
173
});
(2-2/2)