0013868_v5.patch

Administrator Admin, 2010-05-22 18:02

Download (17 KB)

View differences:

NEWS.txt (Arbeitskopie)
45 45

  
46 46
	* The t3editor code completion DB was updated to reflect the latest additions. Also the syntax highlighting engine was now extracted from the system extension so it can be used in other places of the TYPO3 Core as well.
47 47

  
48
	* A donate notice will be shown to admins in the TYPO3 backend after using it for more than three months.
49
	  This behaviour can be disabled completely - see $TYPO3_CONF_VARS[BE][allowDonateWindow].
48 50

  
51

  
49 52
Frontend
50 53
========
51 54

  
t3lib/config_default.php (Arbeitskopie)
260 260
		'elementVersioningOnly' => FALSE,		// If true, only element versioning is allowed in the backend. This is recommended for new installations of TYPO3 4.2+ since "page" and "branch" versioning types are known for the drawbacks of loosing ids and "element" type versions supports moving now.
261 261
		'versionNumberInFilename' => FALSE, // Boolean. If true, included CSS and JS files will have the timestamp embedded in the filename, ie. filename.1269312081.js. This will make browsers and proxies reload the files if they change (thus avoiding caching issues). IMPORTANT: this feature requires this .htaccess rule to work: RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]. If false the filemtime will be appended as a query-string.
262 262
		'spriteIconGenerator_handler' => '', // String: Used to register own/other spriteGenerating Handler, they have to implement the interface t3lib_spriteManager_spriteIconGenerator
263
		'allowDonateWindow' => TRUE,			// Boolean. Defines whether to display a TYPO3 donate window to admin users that have been working with the system for more than three months.
263 264
		'AJAX' => array(				// array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the classes/class.typo3ajax.php for more information.
264 265
			'SC_alt_db_navframe::expandCollapse'                => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse',
265 266
			'SC_alt_file_navframe::expandCollapse'              => 'typo3/alt_file_navframe.php:SC_alt_file_navframe->ajaxExpandCollapse',
......
282 283
			'BackendLogin::refreshLogin'		=> 'typo3/classes/class.ajaxlogin.php:AjaxLogin->refreshLogin',
283 284
			'BackendLogin::isTimedOut'		 	=> 'typo3/classes/class.ajaxlogin.php:AjaxLogin->isTimedOut',
284 285
			'BackendLogin::getChallenge'	 	=> 'typo3/classes/class.ajaxlogin.php:AjaxLogin->getChallenge',
286
			'DonateWindow::disable'				=> 'typo3/classes/class.donatewindow.php:DonateWindow->disable',
287
			'DonateWindow::postpone'			=> 'typo3/classes/class.donatewindow.php:DonateWindow->postpone',
285 288
			'WorkspaceMenu::toggleWorkspacePreview' => 'typo3/classes/class.workspaceselector.php:WorkspaceSelector->toggleWorkspacePreview',
286 289
			'WorkspaceMenu::setWorkspace'           => 'typo3/classes/class.workspaceselector.php:WorkspaceSelector->setWorkspace',
287 290
			'ExtDirect::getAPI' => 't3lib/extjs/class.t3lib_extjs_extdirectapi.php:t3lib_extjs_ExtDirectApi->getAPI',
t3lib/class.t3lib_beuserauth.php (Arbeitskopie)
281 281
			$this->uc['lang']=$this->user['lang'];
282 282
			$U=1;
283 283
		}
284
			// Setting the time of the first login:
285
		if (!isset($this->uc['firstLoginTimeStamp'])) {
286
			$this->uc['firstLoginTimeStamp'] = $GLOBALS['EXEC_TIME'];
287
			$U = TRUE;
288
		}
284 289

  
285 290
			// Saving if updated.
286 291
		if ($U)	{
typo3/js/donate.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
/**
28
 * Donate window appearing in the backend
29
 */
30
Ext.namespace('Ext.ux.TYPO3');
31

  
32
Ext.ux.TYPO3.donate = Ext.extend(Ext.util.Observable, {
33
	isUnloading: false,
34
	logoutButton: null,
35
	ajaxRequestDefault: null,
36
	donateUrl: 'http://typo3.org/donate/',
37

  
38
	constructor: function(config) {
39
		this.ajaxRequestDefault = {
40
			url: TYPO3.configuration.PATH_typo3 + 'ajax.php',
41
			success: function() {},
42
			failure: function() {}
43
		};
44

  
45
		config = config || {};
46
		Ext.apply(this, config);
47

  
48
		this.initComponents();
49
		this.execute.defer(3000, this);
50
		this.logoutButton = Ext.DomQuery.selectNode('#logout-button input');
51

  
52
		Ext.ux.TYPO3.donate.superclass.constructor.call(this, config);
53
	},
54

  
55
	execute: function() {
56
		this.donateWindow.show();
57
	},
58

  
59
	initComponents: function() {
60
		this.donateWindow = new Ext.Window({
61
			width: 450,
62
			autoHeight: true,
63
			closable: false,
64
			resizable: false,
65
			plain: true,
66
			border: false,
67
			modal: true,
68
			draggable: false,
69
			closeAction: 'hide',
70
			id: 'donateWindow',
71
			cls: 't3-window',
72
			title: TYPO3.LLL.core.donateWindow_title,
73
			html: TYPO3.LLL.core.donateWindow_message,
74
			buttons: [{
75
				scope: this,
76
				icon: this.getDonateIcon(),
77
				text: TYPO3.LLL.core.donateWindow_button_donate,
78
				handler: this.donateAction
79
			}, {
80
				scope: this,
81
				text: TYPO3.LLL.core.donateWindow_button_disable,
82
				handler: this.disableAction
83
			}, {
84
				scope: this,
85
				text: TYPO3.LLL.core.donateWindow_button_postpone,
86
				handler: this.postponeAction
87
			}]
88
		});
89
	},
90

  
91
	unloadEventHandler: function(event) {
92
		event.stopEvent();
93
		this.isUnloading = true;
94
		this.donateWindow.show();
95
		this.removeUnloadEventListener();
96
	},
97

  
98
	donateAction: function() {
99
		this.submitDisableAction();
100
		this.donateWindow.hide();
101
		window.open(this.donateUrl).focus();
102
		this.continueUnloading();
103
	},
104

  
105
	disableAction: function() {
106
		this.submitDisableAction();
107
		this.donateWindow.hide();
108
		this.continueUnloading();
109
	},
110

  
111
	postponeAction: function() {
112
		this.submitPostponeAction();
113
		this.donateWindow.hide();
114
		this.addUnloadEventListener();
115
		this.continueUnloading();
116
	},
117

  
118
	submitDisableAction: function() {
119
		Ext.Ajax.request(Ext.apply(
120
			this.ajaxRequestDefault, {
121
				params: { 'ajaxID': 'DonateWindow::disable' }
122
			}
123
		));
124
	},
125

  
126
	submitPostponeAction: function() {
127
		Ext.Ajax.request(Ext.apply(
128
			this.ajaxRequestDefault, {
129
				params: { 'ajaxID': 'DonateWindow::postpone' }
130
			}
131
		));
132
	},
133

  
134
	getDonateIcon: function() {
135
		return TYPO3.configuration.PATH_typo3 + 'sysext/t3skin/images/icons/status/dialog-ok.png';
136
	},
137

  
138
	addUnloadEventListener: function() {
139
		if (!this.isUnloading) {
140
			Ext.EventManager.addListener(this.logoutButton, 'click', this.unloadEventHandler, this);
141
		}
142
	},
143

  
144
	removeUnloadEventListener: function() {
145
		Ext.EventManager.removeListener(this.logoutButton, 'click', this.unloadEventHandler, this);
146
	},
147

  
148
	continueUnloading: function() {
149
		if (this.isUnloading && this.logoutButton) {
150
			this.logoutButton.click();
151
		}
152
	}
153
});
154

  
155

  
156

  
157
/**
158
 * Initialize the donate widget
159
 */
160
Ext.onReady(function() {
161
	TYPO3.donate = new Ext.ux.TYPO3.donate();
162
});
typo3/classes/class.donatewindow.php (Revision 0)
1
<?php
2
/***************************************************************
3
*  Copyright notice
4
*
5
*  (c) 2010 Oliver Hader <oliver@typo3.org>
6
*  All rights reserved
7
*
8
*  This script is part of the TYPO3 project. The TYPO3 project is
9
*  free software; you can redistribute it and/or modify
10
*  it under the terms of the GNU General Public License as published by
11
*  the Free Software Foundation; either version 2 of the License, or
12
*  (at your option) any later version.
13
*
14
*  The GNU General Public License can be found at
15
*  http://www.gnu.org/copyleft/gpl.html.
16
*  A copy is found in the textfile GPL.txt and important notices to the license
17
*  from the author is found in LICENSE.txt distributed with these scripts.
18
*
19
*
20
*  This script is distributed in the hope that it will be useful,
21
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
*  GNU General Public License for more details.
24
*
25
*  This copyright notice MUST APPEAR in all copies of the script!
26
***************************************************************/
27
/**
28
 * AJAX handler for the donate window shown in the TYPO3 backend.
29
 *
30
 * @author Oliver Hader <oliver@typo3.org>
31
 */
32
class DonateWindow implements t3lib_Singleton {
33
	const FLAG_DonateWindowDisabled = 'DonateWindowDisabled';
34
	const FLAG_DonateWindowPostponed = 'DonateWindowPostponed';
35
	const VALUE_DonateWindowAppearsAfterDays = 90;
36
	const VALUE_DonateWindowPostponeDays = 14;
37

  
38
	/**
39
	 * @var t3lib_beUserAuth
40
	 */
41
	protected $backendUser;
42

  
43
	/**
44
	 * Constructs this object.
45
	 */
46
	public function __construct() {
47
		$this->setBackendUser($GLOBALS['BE_USER']);
48
	}
49

  
50
	/**
51
	 * Sets the backend user.
52
	 *
53
	 * @param t3lib_beUserAuth $backendUser
54
	 * @return void
55
	 */
56
	public function setBackendUser(t3lib_beUserAuth $backendUser) {
57
		$this->backendUser = $backendUser;
58
	}
59

  
60
	/**
61
	 * Disables the donate window - thus it won't be shown again for this user.
62
	 *
63
	 * @param	array		$parameters: Parameters (not used)
64
	 * @param	TYPO3AJAX	$ajaxObj: The calling parent AJAX object
65
	 * @return	void
66
	 */
67
	public function disable(array $parameters, TYPO3AJAX $ajaxObj) {
68
		$this->backendUser->uc[self::FLAG_DonateWindowDisabled] = TYPO3_version;
69
		$this->backendUser->writeUC();
70
	}
71

  
72
	/**
73
	 * Postpones the donate window - thus it will be shown again at a later time.
74
	 *
75
	 * @param	array		$parameters: Parameters (not used)
76
	 * @param	TYPO3AJAX	$ajaxObj: The calling parent AJAX object
77
	 * @return	void
78
	 */
79
	public function postpone(array $parameters, TYPO3AJAX $ajaxObj) {
80
		$this->backendUser->uc[self::FLAG_DonateWindowPostponed] = $GLOBALS['EXEC_TIME'];
81
		$this->backendUser->writeUC();
82
	}
83

  
84

  
85
	/**
86
	 * Determines whether the donate window is allowed to be displayed.
87
	 *
88
	 * @return boolean Whether the donate window is allowed to be displayed.
89
	 */
90
	public function isDonateWindowAllowed() {
91
		$uc = $this->backendUser->uc;
92
		$isAdmin = $this->backendUser->isAdmin();
93
		$firstLogin = $this->getFirstLoginTimeStamp();
94
		$isTriggered = ($firstLogin && $GLOBALS['EXEC_TIME'] - $firstLogin > self::VALUE_DonateWindowAppearsAfterDays * 86400);
95
		$isAllowed = (bool) $GLOBALS['TYPO3_CONF_VARS']['BE']['allowDonateWindow'];
96
		$isCancelled = (isset($uc[self::FLAG_DonateWindowDisabled]) && !empty($uc[self::FLAG_DonateWindowDisabled]));
97
		$isPostponed = (isset($uc[self::FLAG_DonateWindowPostponed]) && $uc[self::FLAG_DonateWindowPostponed] > $GLOBALS['EXEC_TIME'] - self::VALUE_DonateWindowPostponeDays * 86400);
98

  
99
		return ($isAdmin && $isAllowed && !$isCancelled && !$isPostponed);
100
	}
101

  
102
	/**
103
	 * Gets the timestamp of the first login of the current backend user.
104
	 *
105
	 * @return integer Timestamp of the first login
106
	 */
107
	public function getFirstLoginTimeStamp() {
108
		$firstLogin = NULL;
109

  
110
		if (isset($this->backendUser->uc['firstLoginTimeStamp'])) {
111
			$firstLogin = $this->backendUser->uc['firstLoginTimeStamp'];
112
		}
113

  
114
		return $firstLogin;
115
	}
116
}
117

  
118
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.donatewindow.php']) {
119
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.donatewindow.php']);
120
}
121

  
122
?>
typo3/backend.php (Arbeitskopie)
31 31

  
32 32
require('classes/class.typo3logo.php');
33 33
require('classes/class.modulemenu.php');
34
require_once('classes/class.donatewindow.php');
34 35

  
35 36
	// core toolbar items
36 37
require('classes/class.workspaceselector.php');
......
78 79
	/**
79 80
	 * Pagerenderer
80 81
	 *
81
	 * @var $pageRenderer t3lib_PageRenderer
82
	 * @var t3lib_PageRenderer
82 83
	 */
83 84
	protected $pageRenderer;
84 85

  
......
185 186
	 */
186 187
	public function render()	{
187 188

  
189
		if (t3lib_div::makeInstance('DonateWindow')->isDonateWindowAllowed()) {
190
			$this->pageRenderer->addJsFile('js/donate.js');
191
		}
192

  
188 193
			// prepare the scaffolding, at this point extension may still add javascript and css
189 194
		$logo         = t3lib_div::makeInstance('TYPO3Logo');
190 195
		$logo->setLogo('gfx/typo3logo_mini.png');
......
393 398
			'tabs_closeAll' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.closeAll'),
394 399
			'tabs_closeOther' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.closeOther'),
395 400
			'tabs_close' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.close'),
401
			'donateWindow_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.title'),
402
			'donateWindow_message' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.message'),
403
			'donateWindow_button_donate' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.button_donate'),
404
			'donateWindow_button_disable' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.button_disable'),
405
			'donateWindow_button_postpone' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.button_postpone'),
396 406
		);
397 407
		$t3LLLfileUpload = array(
398 408
			'windowTitle' => $GLOBALS['LANG']->getLL('fileUpload_windowTitle'),
typo3/sysext/t3skin/extjs/xtheme-t3skin.css (Arbeitskopie)
2205 2205

  
2206 2206
#loginRefreshWindow .x-panel-body.x-panel-body-noheader.x-panel-body-noborder,
2207 2207
#loginRefreshWindow .x-panel-header.x-unselectable,
2208
#loginformWindow .x-panel-header.x-unselectable {
2208
#loginformWindow .x-panel-header.x-unselectable,
2209
.t3-window .x-panel-body.x-panel-body-noheader.x-panel-body-noborder {
2209 2210
	background-image: none;
2210 2211
	background-color: transparent;
2211 2212
	color: #000;
......
2228 2229
#loginformWindow .x-window-ml {
2229 2230
	background-color: #E4E4E4;
2230 2231
}
2232

  
2233
.t3-window .x-window-body.x-window-body-noborder {
2234
	padding: 10px;
2235
}
2236

  
2237
.t3-window .x-btn button {
2238
	padding-left: 3px;
2239
	padding-right: 3px;
2240
}
2241

  
2242
#donateWindow.t3-window .x-window-body.x-window-body-noborder {
2243
	padding-left: 100px;
2244
	background: url(../images/general/donate_teaser.png) no-repeat 25px 10px !important;
2245
}
typo3/sysext/lang/locallang_core.xml (Arbeitskopie)
266 266
			<label index="tabs.closeAll">Close All Tabs</label>
267 267
			<label index="tabs.closeOther">Close Other Tabs</label>
268 268
			<label index="tabs.close">Close Tab</label>
269
			<label index="donateWindow.title">TYPO3 donation notice</label>
270
			<label index="donateWindow.message">&lt;b&gt;You have now used TYPO3 for more than three months.&lt;/b&gt; It would be great if you could donate. TYPO3 is Open Source and relies heavily on donations from its users and supporters.&lt;br/&gt; &lt;b&gt;Thank you&lt;/b&gt; for making this great Content Management System even better with your help!</label>
271
			<label index="donateWindow.button_donate">Donate now</label>
272
			<label index="donateWindow.button_disable">Never show again</label>
273
			<label index="donateWindow.button_postpone">Remind me later</label>
269 274
		</languageKey>
270 275
	</data>
271 276
</T3locallang>