[TYPO3-core] RFC #11773: Integrate an option to deactivate shortcuts completely

Christopher Stelmaszyk christopher at yahoo.de
Wed Sep 2 17:24:45 CEST 2009


Hi Rupert,

first of all sorry for the long text, but it is needed here...
And I hope it is well structured.

"Rupert Germann" schrieb:
>
> I had a look to the patch and I have some remarks:
>
> now we have two options for hiding shortcuts:
> "enableShortcuts" and "shortcutFrame"

> for showing the shortcut-menu only "enableShortcuts" is needed.
I also introduced options.enableShortcuts in the old BE. So you can turn 
shortcuts off separately (and not only with the workspace-selector etc. 
together by disabling the whole shortcutFrame).
So to see the shortcut menu you will have to have enableShortcuts and 
shortcutFrame set, because the shortcuts will be displayed in that frame.
What you say is correct for the new BE.
After all, the menu is displayed/hidden correctly in the old BE and in the 
new one; here is no problem.
But it comes now...



> but for showing "create shortcut" buttons "enableShortcuts" and
> "shortcutFrame" has to be set.
I see, you are right. That is not correct. But somehow your proposed 
solution - use a logical OR - also is not correct. ;-)

In the old BE the shortcuts are in the shortcutFrame.
So you must have set
shortcutFrame = 1 AND(!)
enableShortcuts = 1
to see the shortcuts you created. It does not make sense to be able to 
create shortcuts which you then cannot see...

In the new BE, shortcuts are independent from shortcutFrame.
So there it is enough to have enableShortcuts = 1.
The value of shortcutFrame should not matter at all and should therefore not 
be checked at all.
(But if we used your proposal, you would see the "create shortcuts" buttons 
also if shortcutFrame = 1 and enableShortcuts = 0. That is wrong.)

So here is the solution:
We differentiate which version of the BE is used and set up the check 
accordingly:
In the old BE, check if enableShortcuts AND shortcutFrame are set.
In the new BE, only check if enableShortcuts is set; do not check 
shortcutFrame.


>
> And of course "shortcutFrame" has to be marked (documented) as deprecated.
Yes, tell the people that it only has an effect, if you set 
auth.BE.redirectToURL = alt_main.php (maybe with parameters), that means if 
you still use the old BE. And tell them, that there it will disable the 
whole frame, that is the shortcut menu, the search and the workspace 
selector.

Christopher




Index: typo3/classes/class.shortcutmenu.php
===================================================================
--- typo3/classes/class.shortcutmenu.php	(revision 5881)
+++ typo3/classes/class.shortcutmenu.php	(working copy)
@@ -99,8 +99,10 @@
 	 * @return  boolean  true if user has access, false if not
 	 */
 	public function checkAccess() {
-			// Shortcut module is enabled for everybody
-		return true;
+		if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShortcuts')) {
+			return true;
+		}
+		return false;
 	}

 	/**
Index: t3lib/class.t3lib_userauthgroup.php
===================================================================
--- t3lib/class.t3lib_userauthgroup.php	(revision 5881)
+++ t3lib/class.t3lib_userauthgroup.php	(working copy)
@@ -656,7 +656,19 @@
 	 * @return	boolean
 	 */
 	function mayMakeShortcut()	{
-		return $this->getTSConfigVal('options.shortcutFrame') && 
!$this->getTSConfigVal('options.mayNotCreateEditShortcuts');
+			// If the old BE is used (maybe with some parameters),
+			// check for options.enableShortcuts and options.shortcutFrame being 
set.
+		if (substr($this->getTSConfigVal('auth.BE.redirectToURL'), 0, 12) == 
'alt_main.php') {
+			return $this->getTSConfigVal('options.enableShortcuts') &&
+				$this->getTSConfigVal('options.shortcutFrame') &&
+				!$this->getTSConfigVal('options.mayNotCreateEditShortcuts');
+		}
+			// If the new BE is used, don't check options.shortcutFrame,
+			// because this is not used there anymore.
+		else {
+			return $this->getTSConfigVal('options.enableShortcuts') &&
+				!$this->getTSConfigVal('options.mayNotCreateEditShortcuts');
+		}
 	}

 	/**
Index: typo3/alt_shortcut.php
===================================================================
--- typo3/alt_shortcut.php	(revision 5881)
+++ typo3/alt_shortcut.php	(working copy)
@@ -426,8 +426,12 @@
 						-->
 						<table border="0" cellpadding="0" cellspacing="2" 
id="typo3-shortcuts">
 							<tr>
-							'.implode('
-							',$this->lines).$editIdCode.'
+							';
+							if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShortcuts')) 
{
+								$this->content .= implode('
+								', $this->lines);
+							}
+							$this->content .= $editIdCode . '
 							</tr>
 						</table>
 					</td>
Index: t3lib/config_default.php
===================================================================
--- t3lib/config_default.php	(revision 5881)
+++ t3lib/config_default.php	(working copy)
@@ -203,7 +203,8 @@
 		'forceCharset' => '',					// String. Normally the charset of the backend 
users language selection is used. If you set this value to a charset found 
in t3lib/csconvtbl/ (or "utf-8") the backend (and database) will ALWAYS use 
this charset. Always use a lowercase value.
 		'installToolPassword' => '',			// String. This is the md5-hashed password 
for the Install Tool. Set this to '' and access will be totally denied. 
PLEASE consider to externally password protect the typo3/install/ folder, 
eg. with a .htaccess file.
 		'trackBeUser' => 0,						// Boolean. If set, every invokation of a 
backend script is logged in sys_trackbeuser. This is used to get a view of 
the backend users behaviour. Mostly for debugging, support and user 
interaction analysis. Requires 'beuser_tracking' extension.
- 		'defaultUserTSconfig' => 'options.shortcutFrame=1',			// String. Enter 
lines of default backend user/group TSconfig.
+ 		'defaultUserTSconfig' => 'options.shortcutFrame=1
+			options.enableShortcuts=1',			// String. Enter lines of default backend 
user/group TSconfig.
 		'defaultPageTSconfig' => '',			// Enter lines of default Page TSconfig.
 		'defaultPermissions' => array (			// Default permissions set for new 
pages in t3lib/tce_main.php. Keys are 'show,edit,delete,new,editcontent'. 
Enter as comma-list
 //			'user' => '',						// default in tce_main is 
'show,edit,delete,new,editcontent'. If this is set (uncomment), this value 
is used instead.
 


begin 666 11773_enableShortcuts_v4.patch
M26YD97 at Z('1Y<&\S+V-L87-S97,O8VQA<W,N<VAO<G1C=71M96YU+G!H< T*
M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]
M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/0T*+2TM('1Y<&\S+V-L87-S97,O8VQA
M<W,N<VAO<G1C=71M96YU+G!H< DH<F5V:7-I;VX at -3@X,2D-"BLK*R!T>7!O
M,R]C;&%S<V5S+V-L87-S+G-H;W)T8W5T;65N=2YP:' )*'=O<FMI;F<@8V]P
M>2D-"D! ("TY.2PX("LY.2PQ,"! 0 T*( D@*B! <F5T=7)N("!B;V]L96%N
M("!T<G5E(&EF('5S97(@:&%S(&%C8V5S<RP at 9F%L<V4@:68@;F]T"B )("HO
M"B )<'5B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L:6YE<R!O9B!D
M969A=6QT(&)A8VME;F0@=7-E<B]G<F]U<"!44V-O;F9I9RX*( D))V1E9F%U
M;'1086=E5%-C;VYF:6<G(#T^("<G+ D)"2\O($5N=&5R(&QI;F5S(&]F(&1E
M9F%U;'0 at 4&%G92!44V-O;F9I9RX*( D))V1E9F%U;'1097)M:7-S:6]N<R<@
M/3X at 87)R87D@* D)"2\O($1E9F%U;'0@<&5R;6ES<VEO;G,@<V5T(&9O<B!N
M97<@<&%G97,@:6X@=#-L:6(O=&-E7VUA:6XN<&AP+B!+97ES(&%R92 G<VAO
M=RQE9&ET+&1E;&5T92QN97<L961I=&-O;G1E;G0G+B!%;G1E<B!A<R!C;VUM
M82UL:7-T"B O+PD)"2=U<V5R)R ]/B G)RP)"0D)"0DO+R!D969A=6QT(&EN
M('1C95]M86EN(&ES("=S:&]W+&5D:70L9&5L971E+&YE=RQE9&ET8V]N=&5N
M="<N($EF('1H:7,@:7,@<V5T("AU;F-O;6UE;G0I+"!T:&ES('9A;'5E(&ES
/('5S960@:6YS=&5A9"X*
`
end



More information about the TYPO3-team-core mailing list