<?php include_once '../doc-typo3-funcs.php'; $doxygen_vars = array( "title" => "TYPO3 4.0.1: typo3_src-4.0.1/typo3/alt_shortcut.php Source File", "datetime" => "Sat Dec 2 19:22:20 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?> <!-- Generated by Doxygen 1.4.6 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label> <u>S</u>earch for </label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul></div> <div class="nav"> <a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a> » <a class="el" href="dir_18071ae4545d8b3e0364d30c0659c74a.html">typo3</a></div> <h1>alt_shortcut.php</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <?php <a name="l00002"></a>00002 <span class="comment">/***************************************************************</span> <a name="l00003"></a>00003 <span class="comment">* Copyright notice</span> <a name="l00004"></a>00004 <span class="comment">*</span> <a name="l00005"></a>00005 <span class="comment">* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)</span> <a name="l00006"></a>00006 <span class="comment">* All rights reserved</span> <a name="l00007"></a>00007 <span class="comment">*</span> <a name="l00008"></a>00008 <span class="comment">* This script is part of the TYPO3 project. The TYPO3 project is</span> <a name="l00009"></a>00009 <span class="comment">* free software; you can redistribute it and/or modify</span> <a name="l00010"></a>00010 <span class="comment">* it under the terms of the GNU General Public License as published by</span> <a name="l00011"></a>00011 <span class="comment">* the Free Software Foundation; either version 2 of the License, or</span> <a name="l00012"></a>00012 <span class="comment">* (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment">*</span> <a name="l00014"></a>00014 <span class="comment">* The GNU General Public License can be found at</span> <a name="l00015"></a>00015 <span class="comment">* http://www.gnu.org/copyleft/gpl.html.</span> <a name="l00016"></a>00016 <span class="comment">* A copy is found in the textfile GPL.txt and important notices to the license</span> <a name="l00017"></a>00017 <span class="comment">* from the author is found in LICENSE.txt distributed with these scripts.</span> <a name="l00018"></a>00018 <span class="comment">*</span> <a name="l00019"></a>00019 <span class="comment">*</span> <a name="l00020"></a>00020 <span class="comment">* This script is distributed in the hope that it will be useful,</span> <a name="l00021"></a>00021 <span class="comment">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00022"></a>00022 <span class="comment">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00023"></a>00023 <span class="comment">* GNU General Public License for more details.</span> <a name="l00024"></a>00024 <span class="comment">*</span> <a name="l00025"></a>00025 <span class="comment">* This copyright notice MUST APPEAR in all copies of the script!</span> <a name="l00026"></a>00026 <span class="comment">***************************************************************/</span> <a name="l00068"></a>00068 require('init.php'); <a name="l00069"></a>00069 require('<span class="keyword">template</span>.php'); <a name="l00070"></a>00070 $LANG->includeLLFile('EXT:lang/locallang_misc.xml'); <a name="l00071"></a>00071 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_loadmodules.php'); <a name="l00072"></a>00072 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_basicfilefunc.php'); <a name="l00073"></a>00073 <a name="l00074"></a>00074 <a name="l00075"></a>00075 <a name="l00076"></a>00076 <a name="l00077"></a>00077 <a name="l00078"></a>00078 <a name="l00086"></a><a class="code" href="classSC__alt__shortcut.html">00086</a> <span class="keyword">class </span><a class="code" href="classSC__alt__shortcut.html">SC_alt_shortcut</a> { <a name="l00087"></a>00087 <a name="l00088"></a>00088 <span class="comment">// Internal, static: GPvar</span> <a name="l00089"></a><a class="code" href="classSC__alt__shortcut.html#ef94a6e472181b5a5f85ae044462b649">00089</a> var <a class="code" href="classSC__alt__shortcut.html#ef94a6e472181b5a5f85ae044462b649">$modName</a>; <a name="l00090"></a><a class="code" href="classSC__alt__shortcut.html#1af82b0de65126711c19e10f6ef86878">00090</a> var <a class="code" href="classSC__alt__shortcut.html#1af82b0de65126711c19e10f6ef86878">$M_modName</a>; <a name="l00091"></a><a class="code" href="classSC__alt__shortcut.html#33d46b36a687fb97b6d6c59cbd87e2bd">00091</a> var <a class="code" href="classSC__alt__shortcut.html#33d46b36a687fb97b6d6c59cbd87e2bd">$URL</a>; <a name="l00092"></a><a class="code" href="classSC__alt__shortcut.html#78bb79002af1aa354aa995be6bf4b2bd">00092</a> var <a class="code" href="classSC__alt__shortcut.html#78bb79002af1aa354aa995be6bf4b2bd">$editSC</a>; <a name="l00093"></a><a class="code" href="classSC__alt__shortcut.html#281a199be43b850f551e1d294b82c6a6">00093</a> var <a class="code" href="classSC__alt__shortcut.html#281a199be43b850f551e1d294b82c6a6">$deleteCategory</a>; <a name="l00094"></a><a class="code" href="classSC__alt__shortcut.html#07b318865c02a242dc1bf81627e5ba15">00094</a> var <a class="code" href="classSC__alt__shortcut.html#07b318865c02a242dc1bf81627e5ba15">$editName</a>; <a name="l00095"></a><a class="code" href="classSC__alt__shortcut.html#1f8115824d45a7e8518539a9b9d1a66e">00095</a> var <a class="code" href="classSC__alt__shortcut.html#1f8115824d45a7e8518539a9b9d1a66e">$editGroup</a>; <a name="l00096"></a><a class="code" href="classSC__alt__shortcut.html#8b60a78faa3f7eba15f298ca8cd599ec">00096</a> var <a class="code" href="classSC__alt__shortcut.html#8b60a78faa3f7eba15f298ca8cd599ec">$whichItem</a>; <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="comment">// Internal, static:</span> <a name="l00099"></a><a class="code" href="classSC__alt__shortcut.html#8c0469f6521d2a0031fbf195a11dac65">00099</a> var <a class="code" href="classSC__alt__shortcut.html#8c0469f6521d2a0031fbf195a11dac65">$loadModules</a>; <span class="comment">// Modules object</span> <a name="l00100"></a><a class="code" href="classSC__alt__shortcut.html#dd8263e37832e3bb76a8ac5a40accb15">00100</a> var <a class="code" href="classSC__alt__shortcut.html#dd8263e37832e3bb76a8ac5a40accb15">$doc</a>; <span class="comment">// Document template object</span> <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="comment">// Internal, dynamic:</span> <a name="l00103"></a><a class="code" href="classSC__alt__shortcut.html#ae51d57006a6eb52637e9d6466f13c80">00103</a> var <a class="code" href="classSC__alt__shortcut.html#ae51d57006a6eb52637e9d6466f13c80">$content</a>; <span class="comment">// Accumulation of output HTML (string)</span> <a name="l00104"></a><a class="code" href="classSC__alt__shortcut.html#ba135d1dfe5488c678debe8d8e040e1f">00104</a> var <a class="code" href="classSC__alt__shortcut.html#ba135d1dfe5488c678debe8d8e040e1f">$lines</a>; <span class="comment">// Accumulation of table cells (array)</span> <a name="l00105"></a>00105 <a name="l00106"></a><a class="code" href="classSC__alt__shortcut.html#e33f7dbe2fca6ed076443b1f337914b3">00106</a> var <a class="code" href="classSC__alt__shortcut.html#e33f7dbe2fca6ed076443b1f337914b3">$editLoaded</a>; <span class="comment">// Flag for defining whether we are editing</span> <a name="l00107"></a><a class="code" href="classSC__alt__shortcut.html#fba7afac5a077209f787601153430e05">00107</a> var <a class="code" href="classSC__alt__shortcut.html#fba7afac5a077209f787601153430e05">$editError</a>; <span class="comment">// Can contain edit error message</span> <a name="l00108"></a><a class="code" href="classSC__alt__shortcut.html#61596d2b1ea22593ef94464c295976ee">00108</a> var <a class="code" href="classSC__alt__shortcut.html#61596d2b1ea22593ef94464c295976ee">$editPath</a>; <span class="comment">// Set to the record path of the record being edited.</span> <a name="l00109"></a><a class="code" href="classSC__alt__shortcut.html#eed2496b70c6bb592f347b99b8d449aa">00109</a> var <a class="code" href="classSC__alt__shortcut.html#eed2496b70c6bb592f347b99b8d449aa">$editSC_rec</a>; <span class="comment">// Holds the shortcut record when editing</span> <a name="l00110"></a><a class="code" href="classSC__alt__shortcut.html#28a789356a3633f4145ec722f085d6ea">00110</a> var <a class="code" href="classSC__alt__shortcut.html#28a789356a3633f4145ec722f085d6ea">$theEditRec</a>; <span class="comment">// Page record to be edited</span> <a name="l00111"></a><a class="code" href="classSC__alt__shortcut.html#7cad5631fe020e8bf730ded24c08b51d">00111</a> var <a class="code" href="classSC__alt__shortcut.html#7cad5631fe020e8bf730ded24c08b51d">$editPage</a>; <span class="comment">// Page alias or id to be edited</span> <a name="l00112"></a><a class="code" href="classSC__alt__shortcut.html#ea018c0f90b2defbc666e8749019e59a">00112</a> var <a class="code" href="classSC__alt__shortcut.html#ea018c0f90b2defbc666e8749019e59a">$selOpt</a>; <span class="comment">// Select options.</span> <a name="l00113"></a><a class="code" href="classSC__alt__shortcut.html#0b08aac4b6ed983edea994a5f6ce268e">00113</a> var <a class="code" href="classSC__alt__shortcut.html#0b08aac4b6ed983edea994a5f6ce268e">$searchFor</a>; <span class="comment">// Text to search for...</span> <a name="l00114"></a><a class="code" href="classSC__alt__shortcut.html#10af53393bd30c9f73d3c02caf9fa680">00114</a> var <a class="code" href="classSC__alt__shortcut.html#10af53393bd30c9f73d3c02caf9fa680">$groupLabels</a>=array(); <span class="comment">// Labels of all groups. If value is 1, the system will try to find a label in the locallang array.</span> <a name="l00115"></a>00115 <a name="l00116"></a><a class="code" href="classSC__alt__shortcut.html#299180f9cea377e1f8da4fff1b16ec72">00116</a> var <a class="code" href="classSC__alt__shortcut.html#299180f9cea377e1f8da4fff1b16ec72">$alternativeTableUid</a> = array(); <span class="comment">// Array with key 0/1 being table/uid of record to edit. Internally set.</span> <a name="l00117"></a>00117 <a name="l00118"></a>00118 <a name="l00119"></a>00119 <a name="l00125"></a><a class="code" href="classSC__alt__shortcut.html#bcb9abb4ca8db275ee1dcc0ed7df9631">00125</a> function <a class="code" href="classSC__alt__shortcut.html#bcb9abb4ca8db275ee1dcc0ed7df9631">preinit</a>() { <a name="l00126"></a>00126 global $TBE_MODULES; <a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="comment">// Setting GPvars:</span> <a name="l00129"></a>00129 $this->modName = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('modName'); <a name="l00130"></a>00130 $this->M_modName = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('motherModName'); <a name="l00131"></a>00131 $this->URL = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('URL'); <a name="l00132"></a>00132 $this->editSC = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('editShortcut'); <a name="l00133"></a>00133 <a name="l00134"></a>00134 $this->deleteCategory = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('deleteCategory'); <a name="l00135"></a>00135 $this->editPage = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('editPage'); <a name="l00136"></a>00136 $this->changeWorkspace = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('changeWorkspace'); <a name="l00137"></a>00137 $this->changeWorkspacePreview = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('changeWorkspacePreview'); <a name="l00138"></a>00138 $this->editName = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('editName'); <a name="l00139"></a>00139 $this->editGroup = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('editGroup'); <a name="l00140"></a>00140 $this->whichItem = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('whichItem'); <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">// Creating modules object</span> <a name="l00143"></a>00143 $this->loadModules = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classt3lib__loadModules.html">t3lib_loadModules</a>'); <a name="l00144"></a>00144 $this->loadModules->load($TBE_MODULES); <a name="l00145"></a>00145 } <a name="l00146"></a>00146 <a name="l00152"></a><a class="code" href="classSC__alt__shortcut.html#8219562481666f3ea478a35737ea8eba">00152</a> function <a class="code" href="classSC__alt__shortcut.html#8219562481666f3ea478a35737ea8eba">preprocess</a>() { <a name="l00153"></a>00153 global $BE_USER; <a name="l00154"></a>00154 $description = ''; <span class="comment">// Default description</span> <a name="l00155"></a>00155 $url = urldecode($this->URL); <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="comment">// Lookup the title of this page and use it as default description</span> <a name="l00158"></a>00158 $page_id = $this-><a class="code" href="classSC__alt__shortcut.html#ca14fcd6e41040ca3e745df95af9bbee">getLinkedPageId</a>($url); <a name="l00159"></a>00159 <span class="keywordflow">if</span> (<a class="code" href="classt3lib__div.html#66f511b7e73eb4721804108f79e45fcb">t3lib_div::testInt</a>($page_id)) { <a name="l00160"></a>00160 <span class="keywordflow">if</span> (preg_match('/\&edit\[(.*)\]\[(.*)\]=edit/',$url,$matches)) { <a name="l00161"></a>00161 <span class="comment">// Edit record</span> <a name="l00162"></a>00162 $description = ''; <span class="comment">// TODO: Set something useful</span> <a name="l00163"></a>00163 } <span class="keywordflow">else</span> { <a name="l00164"></a>00164 <span class="comment">// Page listing</span> <a name="l00165"></a>00165 $pageRow = <a class="code" href="classt3lib__BEfunc.html#c0a110679ba0fac9af0d66f34026f378">t3lib_BEfunc::getRecord</a>('pages',$page_id); <a name="l00166"></a>00166 <span class="keywordflow">if</span> (count($pageRow)) { <a name="l00167"></a>00167 <span class="comment">// If $page_id is an integer, set the description to the title of that page</span> <a name="l00168"></a>00168 $description = $pageRow['title']; <a name="l00169"></a>00169 } <a name="l00170"></a>00170 } <a name="l00171"></a>00171 } <span class="keywordflow">else</span> { <a name="l00172"></a>00172 <span class="keywordflow">if</span> (preg_match('/\/$/', $page_id)) { <a name="l00173"></a>00173 <span class="comment">// If $page_id is a string and ends with a slash, assume it is a fileadmin reference and set the description to the basename of that path</span> <a name="l00174"></a>00174 $description = basename($page_id); <a name="l00175"></a>00175 } <a name="l00176"></a>00176 } <a name="l00177"></a>00177 <a name="l00178"></a>00178 <a name="l00179"></a>00179 <span class="comment">// Adding a shortcut being set from another frame</span> <a name="l00180"></a>00180 <span class="keywordflow">if</span> ($this->modName && $this->URL) { <a name="l00181"></a>00181 $fields_values = array( <a name="l00182"></a>00182 'userid' => $BE_USER->user['uid'], <a name="l00183"></a>00183 'module_name' => $this->modName.<span class="charliteral">'|'</span>.$this->M_modName, <a name="l00184"></a>00184 'url' => $this->URL, <a name="l00185"></a>00185 'description' => $description, <a name="l00186"></a>00186 'sorting' => time(), <a name="l00187"></a>00187 ); <a name="l00188"></a>00188 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fields_values); <a name="l00189"></a>00189 } <a name="l00190"></a>00190 <a name="l00191"></a>00191 <span class="comment">// Selection-clause for users - so users can deleted only their own shortcuts (except admins)</span> <a name="l00192"></a>00192 $addUSERWhere = (!$BE_USER->isAdmin()?' AND userid='.intval($BE_USER->user['uid']):''); <a name="l00193"></a>00193 <a name="l00194"></a>00194 <span class="comment">// Deleting shortcuts:</span> <a name="l00195"></a>00195 <span class="keywordflow">if</span> (strcmp($this->deleteCategory,'')) { <a name="l00196"></a>00196 <span class="keywordflow">if</span> (<a class="code" href="classt3lib__div.html#66f511b7e73eb4721804108f79e45fcb">t3lib_div::testInt</a>($this->deleteCategory)) { <a name="l00197"></a>00197 $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'sc_group='.intval($this->deleteCategory).$addUSERWhere); <a name="l00198"></a>00198 } <a name="l00199"></a>00199 } <a name="l00200"></a>00200 <a name="l00201"></a>00201 <span class="comment">// If other changes in post-vars:</span> <a name="l00202"></a>00202 <span class="keywordflow">if</span> (is_array($_POST)) { <a name="l00203"></a>00203 <span class="comment">// Saving:</span> <a name="l00204"></a>00204 <span class="keywordflow">if</span> (isset($_POST['_savedok_x']) || isset($_POST['_saveclosedok_x'])) { <a name="l00205"></a>00205 $fields_values = array( <a name="l00206"></a>00206 'description' => $this->editName, <a name="l00207"></a>00207 'sc_group' => intval($this->editGroup) <a name="l00208"></a>00208 ); <a name="l00209"></a>00209 <span class="keywordflow">if</span> ($fields_values['sc_group']<0 && !$BE_USER->isAdmin()) { <a name="l00210"></a>00210 $fields_values['sc_group']=0; <a name="l00211"></a>00211 } <a name="l00212"></a>00212 <a name="l00213"></a>00213 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_be_shortcuts', 'uid='.intval($this->whichItem).$addUSERWhere, $fields_values); <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <span class="comment">// If save without close, keep the session going...</span> <a name="l00216"></a>00216 <span class="keywordflow">if</span> (isset($_POST['_savedok_x'])) { <a name="l00217"></a>00217 $this->editSC=$this->whichItem; <a name="l00218"></a>00218 } <a name="l00219"></a>00219 <span class="comment">// Deleting a single shortcut ?</span> <a name="l00220"></a>00220 <span class="keywordflow">if</span> (isset($_POST['_deletedok_x'])) { <a name="l00221"></a>00221 $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'uid='.intval($this->whichItem).$addUSERWhere); <a name="l00222"></a>00222 <a name="l00223"></a>00223 <span class="keywordflow">if</span> (!$this->editSC) $this->editSC=-1; <span class="comment">// Just to have the checkbox set...</span> <a name="l00224"></a>00224 } <a name="l00225"></a>00225 } <a name="l00226"></a>00226 <a name="l00227"></a>00227 } <a name="l00228"></a>00228 <a name="l00234"></a><a class="code" href="classSC__alt__shortcut.html#3721783706c9bddec0486dcb023c69b6">00234</a> function <a class="code" href="classSC__alt__shortcut.html#3721783706c9bddec0486dcb023c69b6">init</a>() { <a name="l00235"></a>00235 global $BACK_PATH; <a name="l00236"></a>00236 <a name="l00237"></a>00237 $this->doc = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<span class="keyword">template</span>'); <a name="l00238"></a>00238 $this->doc->backPath = $BACK_PATH; <a name="l00239"></a>00239 $this->doc->form='<form action=<span class="stringliteral">"alt_shortcut.php"</span> name=<span class="stringliteral">"shForm"</span> method=<span class="stringliteral">"post"</span>>'; <a name="l00240"></a>00240 $this->doc->docType='xhtml_trans'; <a name="l00241"></a>00241 $this->doc->divClass='typo3-shortcut'; <a name="l00242"></a>00242 $this->doc->JScode.=$this->doc->wrapScriptTags(' <a name="l00243"></a>00243 function jump(url,modName,mainModName) { <span class="comment">//</span> <a name="l00244"></a>00244 <span class="comment">// Clear information about which entry in nav. tree that might have been highlighted.</span> <a name="l00245"></a>00245 top.fsMod.navFrameHighlightedID = <span class="keyword">new</span> Array(); <a name="l00246"></a>00246 <span class="keywordflow">if</span> (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { <a name="l00247"></a>00247 top.content.nav_frame.refresh_nav(); <a name="l00248"></a>00248 } <a name="l00249"></a>00249 <a name="l00250"></a>00250 top.nextLoadModuleUrl = url; <a name="l00251"></a>00251 top.goToModule(modName); <a name="l00252"></a>00252 } <a name="l00253"></a>00253 function editSh(uid) { <span class="comment">//</span> <a name="l00254"></a>00254 window.location.href=<span class="stringliteral">"alt_shortcut.php?editShortcut="</span>+uid; <a name="l00255"></a>00255 } <a name="l00256"></a>00256 function submitEditPage(<span class="keywordtype">id</span>) { <span class="comment">//</span> <a name="l00257"></a>00257 window.location.href=<span class="stringliteral">"alt_shortcut.php?editPage="</span>+top.rawurlencode(<span class="keywordtype">id</span>); <a name="l00258"></a>00258 } <a name="l00259"></a>00259 function changeWorkspace(workspaceId) { <span class="comment">//</span> <a name="l00260"></a>00260 window.location.href=<span class="stringliteral">"alt_shortcut.php?changeWorkspace="</span>+top.rawurlencode(workspaceId); <a name="l00261"></a>00261 } <a name="l00262"></a>00262 function changeWorkspacePreview(newstate) { <span class="comment">//</span> <a name="l00263"></a>00263 window.location.href=<span class="stringliteral">"alt_shortcut.php?changeWorkspacePreview="</span>+newstate; <a name="l00264"></a>00264 } <a name="l00265"></a>00265 <a name="l00266"></a>00266 '); <a name="l00267"></a>00267 $this->content.=$this->doc->startPage('Shortcut frame'); <a name="l00268"></a>00268 } <a name="l00269"></a>00269 <a name="l00275"></a><a class="code" href="classSC__alt__shortcut.html#a9d99ec753faab78873e92203af1a634">00275</a> function main() { <a name="l00276"></a>00276 global $BE_USER,$LANG,$TCA; <a name="l00277"></a>00277 <a name="l00278"></a>00278 <span class="comment">// By default, 5 groups are set</span> <a name="l00279"></a>00279 $this->groupLabels=array( <a name="l00280"></a>00280 1 => 1, <a name="l00281"></a>00281 2 => 1, <a name="l00282"></a>00282 3 => 1, <a name="l00283"></a>00283 4 => 1, <a name="l00284"></a>00284 5 => 1, <a name="l00285"></a>00285 ); <a name="l00286"></a>00286 <a name="l00287"></a>00287 $shortCutGroups = $BE_USER->getTSConfig('options.shortcutGroups'); <a name="l00288"></a>00288 <span class="keywordflow">if</span> (is_array($shortCutGroups['properties']) && count($shortCutGroups['properties'])) { <a name="l00289"></a>00289 foreach ($shortCutGroups['properties'] as $k=>$v) { <a name="l00290"></a>00290 <span class="keywordflow">if</span> (strcmp('',$v) && strcmp(<span class="charliteral">'0'</span>,$v)) { <a name="l00291"></a>00291 $this->groupLabels[$k] = (string)$v; <a name="l00292"></a>00292 } elseif ($BE_USER->isAdmin()) { <a name="l00293"></a>00293 unset($this->groupLabels[$k]); <a name="l00294"></a>00294 } <a name="l00295"></a>00295 } <a name="l00296"></a>00296 } <a name="l00297"></a>00297 <a name="l00298"></a>00298 <span class="comment">// List of global groups that will be loaded. All global groups have negative IDs.</span> <a name="l00299"></a>00299 $globalGroups = -100; <span class="comment">// Group -100 is kind of superglobal and can't be changed.</span> <a name="l00300"></a>00300 <span class="keywordflow">if</span> (count($this->groupLabels)) { <a name="l00301"></a>00301 $globalGroups .= <span class="charliteral">','</span>.implode(<span class="charliteral">','</span>,array_keys($this->groupLabels)); <a name="l00302"></a>00302 $globalGroups = str_replace(<span class="charliteral">','</span>,',-',$globalGroups); <span class="comment">// Ugly hack to make the UIDs negative - is there any better solution?</span> <a name="l00303"></a>00303 } <a name="l00304"></a>00304 <a name="l00305"></a>00305 <span class="comment">// Fetching shortcuts to display for this user:</span> <a name="l00306"></a>00306 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(<span class="charliteral">'*'</span>, 'sys_be_shortcuts', '((userid='.$BE_USER->user['uid'].' AND sc_group>=0) OR sc_group IN ('.$globalGroups.'))', '', 'sc_group,sorting'); <a name="l00307"></a>00307 <a name="l00308"></a>00308 <span class="comment">// Init vars:</span> <a name="l00309"></a>00309 $this->lines=array(); <a name="l00310"></a>00310 $this->linesPre=array(); <a name="l00311"></a>00311 $this->editSC_rec=''; <a name="l00312"></a>00312 $this->selOpt=array(); <a name="l00313"></a>00313 $formerGr=''; <a name="l00314"></a>00314 <a name="l00315"></a>00315 <span class="comment">// Traverse shortcuts</span> <a name="l00316"></a>00316 <span class="keywordflow">while</span>($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { <a name="l00317"></a>00317 $mParts = explode(<span class="charliteral">'|'</span>,$row['module_name']); <a name="l00318"></a>00318 $row['module_name']=$mParts[0]; <a name="l00319"></a>00319 $row['M_module_name']=$mParts[1]; <a name="l00320"></a>00320 $mParts = explode(<span class="charliteral">'_'</span>,$row['M_module_name']?$row['M_module_name']:$row['module_name']); <a name="l00321"></a>00321 $qParts = parse_url($row['url']); <a name="l00322"></a>00322 <a name="l00323"></a>00323 <span class="keywordflow">if</span> (!$BE_USER->isAdmin()) { <a name="l00324"></a>00324 <span class="comment">// Check for module access</span> <a name="l00325"></a>00325 <span class="keywordflow">if</span> (!isset($LANG->moduleLabels['tabs_images'][implode(<span class="charliteral">'_'</span>,$mParts).'_tab'])) { <span class="comment">// Nice hack to check if the user has access to this module - otherwise the translation label would not have been loaded :-)</span> <a name="l00326"></a>00326 <span class="keywordflow">continue</span>; <a name="l00327"></a>00327 } <a name="l00328"></a>00328 <a name="l00329"></a>00329 $page_id = $this->getLinkedPageId($row['url']); <a name="l00330"></a>00330 <span class="keywordflow">if</span> (<a class="code" href="classt3lib__div.html#66f511b7e73eb4721804108f79e45fcb">t3lib_div::testInt</a>($page_id)) { <a name="l00331"></a>00331 <span class="comment">// Check for webmount access</span> <a name="l00332"></a>00332 <span class="keywordflow">if</span> (!$GLOBALS['BE_USER']->isInWebMount($page_id)) <span class="keywordflow">continue</span>; <a name="l00333"></a>00333 <a name="l00334"></a>00334 <span class="comment">// Check for record access</span> <a name="l00335"></a>00335 $pageRow = <a class="code" href="classt3lib__BEfunc.html#c0a110679ba0fac9af0d66f34026f378">t3lib_BEfunc::getRecord</a>('pages',$page_id); <a name="l00336"></a>00336 <span class="keywordflow">if</span> (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow,$perms=1)) <span class="keywordflow">continue</span>; <a name="l00337"></a>00337 } <a name="l00338"></a>00338 } <a name="l00339"></a>00339 <a name="l00340"></a>00340 <span class="keywordflow">if</span> ($this->editSC && $row['uid']==$this->editSC) { <a name="l00341"></a>00341 $this->editSC_rec=$row; <a name="l00342"></a>00342 } <a name="l00343"></a>00343 <a name="l00344"></a>00344 $sc_group = $row['sc_group']; <a name="l00345"></a>00345 <span class="keywordflow">if</span> ($sc_group && strcmp($formerGr,$sc_group)) { <a name="l00346"></a>00346 <span class="keywordflow">if</span> ($sc_group!=-100) { <a name="l00347"></a>00347 <span class="keywordflow">if</span> ($this->groupLabels[abs($sc_group)] && strcmp(<span class="charliteral">'1'</span>,$this->groupLabels[abs($sc_group)])) { <a name="l00348"></a>00348 $label = $this->groupLabels[abs($sc_group)]; <a name="l00349"></a>00349 } <span class="keywordflow">else</span> { <a name="l00350"></a>00350 $label = $LANG->getLL('shortcut_group_'.abs($sc_group),1); <a name="l00351"></a>00351 <span class="keywordflow">if</span> (!$label) $label = $LANG->getLL('shortcut_group',1).<span class="charliteral">' '</span>.abs($sc_group); <span class="comment">// Fallback label</span> <a name="l00352"></a>00352 } <a name="l00353"></a>00353 <a name="l00354"></a>00354 <span class="keywordflow">if</span> ($sc_group>=0) { <a name="l00355"></a>00355 $onC = '<span class="keywordflow">if</span> (confirm('.$GLOBALS['LANG']->JScharCode($LANG->getLL('shortcut_delAllInCat')).')){window.location.href=\'alt_shortcut.php?deleteCategory='.$sc_group.<span class="charliteral">'\'</span>;}<span class="keywordflow">return</span> <span class="keyword">false</span>;'; <a name="l00356"></a>00356 $this->linesPre[]='<td>&nbsp;</td><td <span class="keyword">class</span>=<span class="stringliteral">"bgColor5"</span>><a href=<span class="stringliteral">"#"</span> onclick=<span class="stringliteral">"'.htmlspecialchars($onC).'"</span> title=<span class="stringliteral">"'.$LANG->getLL('shortcut_delAllInCat',1).'"</span>>'.$label.'</a></td>'; <a name="l00357"></a>00357 } <span class="keywordflow">else</span> { <a name="l00358"></a>00358 $label = $LANG->getLL('shortcut_global',1).': '.($label ? $label : abs($sc_group)); <span class="comment">// Fallback label</span> <a name="l00359"></a>00359 $this->lines[]='<td>&nbsp;</td><td <span class="keyword">class</span>=<span class="stringliteral">"bgColor5"</span>>'.$label.'</td>'; <a name="l00360"></a>00360 } <a name="l00361"></a>00361 unset($label); <a name="l00362"></a>00362 } <a name="l00363"></a>00363 } <a name="l00364"></a>00364 <a name="l00365"></a>00365 $bgColorClass = $row['uid']==$this->editSC ? 'bgColor5' : ($row['sc_group']<0 ? 'bgColor6' : 'bgColor4'); <a name="l00366"></a>00366 <a name="l00367"></a>00367 <span class="keywordflow">if</span> ($row['description']&&($row['uid']!=$this->editSC)) { <a name="l00368"></a>00368 $label = $row['description']; <a name="l00369"></a>00369 } <span class="keywordflow">else</span> { <a name="l00370"></a>00370 $label = <a class="code" href="classt3lib__div.html#6c2adca01abbf533fd2b06d61608fd27">t3lib_div::fixed_lgd</a>(rawurldecode($qParts['query']),150); <a name="l00371"></a>00371 } <a name="l00372"></a>00372 $titleA = $this->itemLabel($label,$row['module_name'],$row['M_module_name']); <a name="l00373"></a>00373 <a name="l00374"></a>00374 $editSH = ($row['sc_group']>=0 || $BE_USER->isAdmin()) ? 'editSh('.intval($row['uid']).');' : <span class="stringliteral">"alert('"</span>.$LANG->getLL('shortcut_onlyAdmin').<span class="stringliteral">"')"</span>; <a name="l00375"></a>00375 $jumpSC = 'jump(unescape(\''.rawurlencode($row['url']).<span class="charliteral">'\'</span>),\''.implode(<span class="charliteral">'_'</span>,$mParts).<span class="charliteral">'\'</span>,\''.$mParts[0].<span class="charliteral">'\'</span>);'; <a name="l00376"></a>00376 $onC = '<span class="keywordflow">if</span> (document.shForm.editShortcut_check && document.shForm.editShortcut_check.checked){'.$editSH.'}<span class="keywordflow">else</span>{'.$jumpSC.'}<span class="keywordflow">return</span> <span class="keyword">false</span>;'; <a name="l00377"></a>00377 <span class="keywordflow">if</span> ($sc_group>=0) { <span class="comment">// user defined groups show up first</span> <a name="l00378"></a>00378 $this->linesPre[]='<td <span class="keyword">class</span>=<span class="stringliteral">"'.$bgColorClass.'"</span>><a href=<span class="stringliteral">"#"</span> onclick=<span class="stringliteral">"'.htmlspecialchars($onC).'"</span>><img src=<span class="stringliteral">"'.$this->getIcon($row['module_name']).'"</span> title=<span class="stringliteral">"'.htmlspecialchars($titleA).'"</span> alt=<span class="stringliteral">""</span> /></a></td>'; <a name="l00379"></a>00379 } <span class="keywordflow">else</span> { <a name="l00380"></a>00380 $this->lines[]='<td <span class="keyword">class</span>=<span class="stringliteral">"'.$bgColorClass.'"</span>><a href=<span class="stringliteral">"#"</span> onclick=<span class="stringliteral">"'.htmlspecialchars($onC).'"</span>><img src=<span class="stringliteral">"'.$this->getIcon($row['module_name']).'"</span> title=<span class="stringliteral">"'.htmlspecialchars($titleA).'"</span> alt=<span class="stringliteral">""</span> /></a></td>'; <a name="l00381"></a>00381 } <a name="l00382"></a>00382 <span class="keywordflow">if</span> (trim($row['description'])) { <a name="l00383"></a>00383 $kkey = strtolower(substr($row['description'],0,20)).<span class="charliteral">'_'</span>.$row['uid']; <a name="l00384"></a>00384 $this->selOpt[$kkey]='<option value=<span class="stringliteral">"'.htmlspecialchars($jumpSC).'"</span>>'.htmlspecialchars(<a class="code" href="classt3lib__div.html#93c658c7682e99d76960c3d670e073e8">t3lib_div::fixed_lgd_cs</a>($row['description'],50)).'</option>'; <a name="l00385"></a>00385 } <a name="l00386"></a>00386 $formerGr=$row['sc_group']; <a name="l00387"></a>00387 } <a name="l00388"></a>00388 ksort($this->selOpt); <a name="l00389"></a>00389 array_unshift($this->selOpt,'<option>['.$LANG->getLL('shortcut_selSC',1).']</option>'); <a name="l00390"></a>00390 <a name="l00391"></a>00391 $this->editLoadedFunc(); <a name="l00392"></a>00392 $this->editPageIdFunc(); <a name="l00393"></a>00393 <a name="l00394"></a>00394 <span class="keywordflow">if</span> (!$this->editLoaded && <a class="code" href="classt3lib__extMgm.html#297116a3b1e17045ff193f170b8c4a29">t3lib_extMgm::isLoaded</a>('cms')) { <a name="l00395"></a>00395 $editIdCode = '<td nowrap=<span class="stringliteral">"nowrap"</span>>'.$LANG->getLL('shortcut_editID',1).': <input type=<span class="stringliteral">"text"</span> value=<span class="stringliteral">"'.($this->editError?htmlspecialchars($this->editPage):'').'"</span> name=<span class="stringliteral">"editPage"</span>'.$this->doc->formWidth(15).' onchange=<span class="stringliteral">"submitEditPage(this.value);"</span> />'. <a name="l00396"></a>00396 ($this->editError?'&nbsp;<strong><span <span class="keyword">class</span>=<span class="stringliteral">"typo3-red"</span>>'.htmlspecialchars($this->editError).'</span></strong><span class="charliteral">':'</span>'). <a name="l00397"></a>00397 (is_array($this->theEditRec)?'&nbsp;<strong>'.$LANG->getLL('shortcut_loadEdit',1).' \''.t3lib_BEfunc::getRecordTitle('pages',$this->theEditRec,1).<span class="charliteral">'\'</span></strong> ('.htmlspecialchars($this->editPath).<span class="charliteral">')'</span>:''). <a name="l00398"></a>00398 ($this->searchFor?'&nbsp;'.$LANG->getLL('shortcut_searchFor',1).' <strong>\''.htmlspecialchars($this->searchFor).<span class="charliteral">'\'</span></strong><span class="charliteral">':'</span>'). <a name="l00399"></a>00399 '</td>'; <a name="l00400"></a>00400 } <span class="keywordflow">else</span> $editIdCode = ''; <a name="l00401"></a>00401 <a name="l00402"></a>00402 <span class="comment">// Adding CSH:</span> <a name="l00403"></a>00403 $editIdCode.= '<td>&nbsp;'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'shortcuts', $GLOBALS['BACK_PATH'],'',TRUE).'</td>'; <a name="l00404"></a>00404 <a name="l00405"></a>00405 <span class="comment">// Compile it all:</span> <a name="l00406"></a>00406 $this->content.=' <a name="l00407"></a>00407 <a name="l00408"></a>00408 <table border=<span class="stringliteral">"0"</span> cellpadding=<span class="stringliteral">"0"</span> cellspacing=<span class="stringliteral">"0"</span> width=<span class="stringliteral">"99%"</span>> <a name="l00409"></a>00409 <tr> <a name="l00410"></a>00410 <td> <a name="l00411"></a>00411 <!-- <a name="l00412"></a>00412 Shortcut Display Table: <a name="l00413"></a>00413 --> <a name="l00414"></a>00414 <table border=<span class="stringliteral">"0"</span> cellpadding=<span class="stringliteral">"0"</span> cellspacing=<span class="stringliteral">"2"</span> <span class="keywordtype">id</span>=<span class="stringliteral">"typo3-shortcuts"</span>> <a name="l00415"></a>00415 <tr> <a name="l00416"></a>00416 '.implode(' <a name="l00417"></a>00417 ',$this->lines).$editIdCode.' <a name="l00418"></a>00418 </tr> <a name="l00419"></a>00419 </table> <a name="l00420"></a>00420 </td> <a name="l00421"></a>00421 <td align=<span class="stringliteral">"right"</span>> <a name="l00422"></a>00422 '.$this->workspaceSelector(). <a name="l00423"></a>00423 <a class="code" href="classt3lib__BEfunc.html#a235b246dec429e439742b1fc76c9d97">t3lib_BEfunc::cshItem</a>('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'],'',TRUE).' <a name="l00424"></a>00424 </td> <a name="l00425"></a>00425 </tr> <a name="l00426"></a>00426 </table> <a name="l00427"></a>00427 '; <a name="l00428"></a>00428 <a name="l00429"></a>00429 <span class="comment">// Launch Edit page:</span> <a name="l00430"></a>00430 <span class="keywordflow">if</span> ($this->theEditRec['uid']) { <a name="l00431"></a>00431 $this->content.=$this->doc->wrapScriptTags('top.loadEditId('.$this->theEditRec['uid'].');'); <a name="l00432"></a>00432 } <a name="l00433"></a>00433 <a name="l00434"></a>00434 <span class="comment">// Load alternative table/uid into editing form.</span> <a name="l00435"></a>00435 <span class="keywordflow">if</span> (count($this->alternativeTableUid)==2 && isset($TCA[$this->alternativeTableUid[0]]) && <a class="code" href="classt3lib__div.html#66f511b7e73eb4721804108f79e45fcb">t3lib_div::testInt</a>($this->alternativeTableUid[1])) { <a name="l00436"></a>00436 $JSaction = <a class="code" href="classt3lib__BEfunc.html#7a0f36e11e40ce7b2b808fe06d7d1f92">t3lib_BEfunc::editOnClick</a>('&edit['.$this->alternativeTableUid[0].']['.$this->alternativeTableUid[1].']=edit<span class="charliteral">','</span><span class="charliteral">','</span>dummy.php'); <a name="l00437"></a>00437 $this->content.=$this->doc->wrapScriptTags('function editArbitraryElement() { top.content.'.$JSaction.'; } editArbitraryElement();'); <a name="l00438"></a>00438 } <a name="l00439"></a>00439 <a name="l00440"></a>00440 <span class="comment">// Load search for something.</span> <a name="l00441"></a>00441 <span class="keywordflow">if</span> ($this->searchFor) { <a name="l00442"></a>00442 $firstMP = intval($GLOBALS['WEBMOUNTS'][0]); <a name="l00443"></a>00443 $this->content.= $this->doc->wrapScriptTags('jump(unescape(<span class="stringliteral">"'.rawurlencode('db_list.php?id='.$firstMP.'&search_field='.rawurlencode($this->searchFor).'&search_levels=4').'"</span>),<span class="stringliteral">"web_list"</span>,<span class="stringliteral">"web"</span>);'); <a name="l00444"></a>00444 } <a name="l00445"></a>00445 } <a name="l00446"></a>00446 <a name="l00452"></a><a class="code" href="classSC__alt__shortcut.html#eb0c009e467dd216d9fa78e7f9b1b581">00452</a> function editLoadedFunc() { <a name="l00453"></a>00453 global $BE_USER,$LANG; <a name="l00454"></a>00454 <a name="l00455"></a>00455 $this->editLoaded=0; <a name="l00456"></a>00456 <span class="keywordflow">if</span> (is_array($this->editSC_rec) && ($this->editSC_rec['sc_group']>=0 || $BE_USER->isAdmin())) { <span class="comment">// sc_group numbers below 0 requires admin to edit those. sc_group numbers above zero must always be owned by the user himself.</span> <a name="l00457"></a>00457 $this->editLoaded=1; <a name="l00458"></a>00458 <a name="l00459"></a>00459 $opt=array(); <a name="l00460"></a>00460 $opt[]='<option value=<span class="stringliteral">"0"</span>></option>'; <a name="l00461"></a>00461 <a name="l00462"></a>00462 foreach($this->groupLabels as $k=>$v) { <a name="l00463"></a>00463 <span class="keywordflow">if</span> ($v && strcmp(<span class="charliteral">'1'</span>,$v)) { <a name="l00464"></a>00464 $label = $v; <a name="l00465"></a>00465 } <span class="keywordflow">else</span> { <a name="l00466"></a>00466 $label = $LANG->getLL('shortcut_group_'.$k,1); <a name="l00467"></a>00467 <span class="keywordflow">if</span> (!$label) $label = $LANG->getLL('shortcut_group',1).<span class="charliteral">' '</span>.$k; <span class="comment">// Fallback label</span> <a name="l00468"></a>00468 } <a name="l00469"></a>00469 $opt[]='<option value=<span class="stringliteral">"'.$k.'"</span>'.(!strcmp($this->editSC_rec['sc_group'],$k)?' selected=<span class="stringliteral">"selected"</span><span class="charliteral">':'</span>').<span class="charliteral">'>'</span>.$label.'</option>'; <a name="l00470"></a>00470 } <a name="l00471"></a>00471 <a name="l00472"></a>00472 <span class="keywordflow">if</span> ($BE_USER->isAdmin()) { <a name="l00473"></a>00473 foreach($this->groupLabels as $k=>$v) { <a name="l00474"></a>00474 <span class="keywordflow">if</span> ($v && strcmp(<span class="charliteral">'1'</span>,$v)) { <a name="l00475"></a>00475 $label = $v; <a name="l00476"></a>00476 } <span class="keywordflow">else</span> { <a name="l00477"></a>00477 $label = $LANG->getLL('shortcut_group_'.$k,1); <a name="l00478"></a>00478 <span class="keywordflow">if</span> (!$label) $label = $LANG->getLL('shortcut_group',1).<span class="charliteral">' '</span>.$k; <span class="comment">// Fallback label</span> <a name="l00479"></a>00479 } <a name="l00480"></a>00480 $label = $LANG->getLL('shortcut_global',1).': '.$label; <span class="comment">// Add a prefix for global groups</span> <a name="l00481"></a>00481 <a name="l00482"></a>00482 $opt[]='<option value=<span class="stringliteral">"-'.$k.'"</span>'.(!strcmp($this->editSC_rec['sc_group'],<span class="charliteral">'-'</span>.$k)?' selected=<span class="stringliteral">"selected"</span><span class="charliteral">':'</span>').<span class="charliteral">'>'</span>.$label.'</option>'; <a name="l00483"></a>00483 } <a name="l00484"></a>00484 $opt[]='<option value=<span class="stringliteral">"-100"</span>'.(!strcmp($this->editSC_rec['sc_group'],'-100')?' selected=<span class="stringliteral">"selected"</span><span class="charliteral">':'</span>').<span class="charliteral">'>'</span>.$LANG->getLL('shortcut_global',1).': '.$LANG->getLL('shortcut_all',1).'</option>'; <a name="l00485"></a>00485 } <a name="l00486"></a>00486 <a name="l00487"></a>00487 <span class="comment">// border="0" hspace="2" width="21" height="16" - not XHTML compliant in <input type="image" ...></span> <a name="l00488"></a>00488 $manageForm=' <a name="l00489"></a>00489 <a name="l00490"></a>00490 <!-- <a name="l00491"></a>00491 Shortcut Editing Form: <a name="l00492"></a>00492 --> <a name="l00493"></a>00493 <table border=<span class="stringliteral">"0"</span> cellpadding=<span class="stringliteral">"0"</span> cellspacing=<span class="stringliteral">"0"</span> <span class="keywordtype">id</span>=<span class="stringliteral">"typo3-shortcuts-editing"</span>> <a name="l00494"></a>00494 <tr> <a name="l00495"></a>00495 <td>&nbsp;&nbsp;</td> <a name="l00496"></a>00496 <td><input type=<span class="stringliteral">"image"</span> <span class="keyword">class</span>=<span class="stringliteral">"c-inputButton"</span> name=<span class="stringliteral">"_savedok"</span>'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedok.gif<span class="charliteral">','</span>').' title=<span class="stringliteral">"'.$LANG->getLL('shortcut_save',1).'"</span> /></td> <a name="l00497"></a>00497 <td><input type=<span class="stringliteral">"image"</span> <span class="keyword">class</span>=<span class="stringliteral">"c-inputButton"</span> name=<span class="stringliteral">"_saveclosedok"</span>'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif<span class="charliteral">','</span>').' title=<span class="stringliteral">"'.$LANG->getLL('shortcut_saveClose',1).'"</span> /></td> <a name="l00498"></a>00498 <td><input type=<span class="stringliteral">"image"</span> <span class="keyword">class</span>=<span class="stringliteral">"c-inputButton"</span> name=<span class="stringliteral">"_closedok"</span>'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/closedok.gif<span class="charliteral">','</span>').' title=<span class="stringliteral">"'.$LANG->getLL('shortcut_close',1).'"</span> /></td> <a name="l00499"></a>00499 <td><input type=<span class="stringliteral">"image"</span> <span class="keyword">class</span>=<span class="stringliteral">"c-inputButton"</span> name=<span class="stringliteral">"_deletedok"</span>'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/deletedok.gif<span class="charliteral">','</span>').' title=<span class="stringliteral">"'.$LANG->getLL('shortcut_delete',1).'"</span> /></td> <a name="l00500"></a>00500 <td><input name=<span class="stringliteral">"editName"</span> type=<span class="stringliteral">"text"</span> value=<span class="stringliteral">"'.htmlspecialchars($this->editSC_rec['description']).'"</span>'.$this->doc->formWidth(15).' /></td> <a name="l00501"></a>00501 <td><select name=<span class="stringliteral">"editGroup"</span>>'.implode('',$opt).'</select></td> <a name="l00502"></a>00502 </tr> <a name="l00503"></a>00503 </table> <a name="l00504"></a>00504 <input type=<span class="stringliteral">"hidden"</span> name=<span class="stringliteral">"whichItem"</span> value=<span class="stringliteral">"'.$this->editSC_rec['uid'].'"</span> /> <a name="l00505"></a>00505 <a name="l00506"></a>00506 '; <a name="l00507"></a>00507 } <span class="keywordflow">else</span> $manageForm=''; <a name="l00508"></a>00508 <a name="l00509"></a>00509 <span class="keywordflow">if</span> (!$this->editLoaded && count($this->selOpt)>1) { <a name="l00510"></a>00510 $this->lines[]='<td>&nbsp;</td>'; <a name="l00511"></a>00511 $this->lines[]='<td><select name=<span class="stringliteral">"_selSC"</span> onchange=<span class="stringliteral">"eval(this.options[this.selectedIndex].value);this.selectedIndex=0;"</span>>'.implode('',$this->selOpt).'</select></td>'; <a name="l00512"></a>00512 } <a name="l00513"></a>00513 <a name="l00514"></a>00514 <span class="comment">// $this->linesPre contains elements with sc_group>=0</span> <a name="l00515"></a>00515 $this->lines = array_merge($this->linesPre,$this->lines); <a name="l00516"></a>00516 <a name="l00517"></a>00517 <span class="keywordflow">if</span> (count($this->lines)) { <a name="l00518"></a>00518 <span class="keywordflow">if</span> (!$BE_USER->getTSConfigVal('options.mayNotCreateEditShortcuts')) { <a name="l00519"></a>00519 $this->lines=array_merge(array('<td><input type=<span class="stringliteral">"checkbox"</span> <span class="keywordtype">id</span>=<span class="stringliteral">"editShortcut_check"</span> name=<span class="stringliteral">"editShortcut_check"</span> value=<span class="stringliteral">"1"</span>'.($this->editSC?' checked=<span class="stringliteral">"checked"</span><span class="charliteral">':'</span>').' /><label <span class="keywordflow">for</span>=<span class="stringliteral">"editShortcut_check"</span>>'.$LANG->getLL('shortcut_edit',1).'</label>&nbsp;</td>'),$this->lines); <a name="l00520"></a>00520 $this->lines[]='<td>'.$manageForm.'</td>'; <a name="l00521"></a>00521 } <a name="l00522"></a>00522 $this->lines[]='<td><img src=<span class="stringliteral">"clear.gif"</span> width=<span class="stringliteral">"10"</span> height=<span class="stringliteral">"1"</span> alt=<span class="stringliteral">""</span> /></td>'; <a name="l00523"></a>00523 } <a name="l00524"></a>00524 } <a name="l00525"></a>00525 <a name="l00532"></a><a class="code" href="classSC__alt__shortcut.html#fd9f86ea37d5b6ec11cfd6e58242d74c">00532</a> function editPageIdFunc() { <a name="l00533"></a>00533 global $BE_USER,$LANG; <a name="l00534"></a>00534 <a name="l00535"></a>00535 <span class="keywordflow">if</span> (!<a class="code" href="classt3lib__extMgm.html#297116a3b1e17045ff193f170b8c4a29">t3lib_extMgm::isLoaded</a>('cms')) <span class="keywordflow">return</span>; <a name="l00536"></a>00536 <a name="l00537"></a>00537 <span class="comment">// EDIT page:</span> <a name="l00538"></a>00538 $this->editPage = trim(strtolower($this->editPage)); <a name="l00539"></a>00539 $this->editError = ''; <a name="l00540"></a>00540 $this->theEditRec = ''; <a name="l00541"></a>00541 $this->searchFor = ''; <a name="l00542"></a>00542 <span class="keywordflow">if</span> ($this->editPage) { <a name="l00543"></a>00543 <a name="l00544"></a>00544 <span class="comment">// First, test alternative value consisting of [table]:[uid] and if not found, proceed with traditional page ID resolve:</span> <a name="l00545"></a>00545 $this->alternativeTableUid = explode(<span class="charliteral">':'</span>,$this->editPage); <a name="l00546"></a>00546 <span class="keywordflow">if</span> (!(count($this->alternativeTableUid)==2 && $BE_USER->isAdmin())) { <span class="comment">// We restrict it to admins only just because I'm not really sure if alt_doc.php properly checks permissions of passed records for editing. If alt_doc.php does that, then we can remove this.</span> <a name="l00547"></a>00547 <a name="l00548"></a>00548 $where = ' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).<span class="charliteral">')'</span>; <a name="l00549"></a>00549 <span class="keywordflow">if</span> (<a class="code" href="classt3lib__div.html#66f511b7e73eb4721804108f79e45fcb">t3lib_div::testInt</a>($this->editPage)) { <a name="l00550"></a>00550 $this->theEditRec = <a class="code" href="classt3lib__BEfunc.html#2921570c91cd2543489c9d850cfec311">t3lib_BEfunc::getRecordWSOL</a>('pages',$this->editPage,<span class="charliteral">'*'</span>,$where); <a name="l00551"></a>00551 } <span class="keywordflow">else</span> { <a name="l00552"></a>00552 $records = <a class="code" href="classt3lib__BEfunc.html#6045d22a85ce9f88660920c99c43e26e">t3lib_BEfunc::getRecordsByField</a>('pages<span class="charliteral">','</span>alias',$this->editPage,$where); <a name="l00553"></a>00553 <span class="keywordflow">if</span> (is_array($records)) { <a name="l00554"></a>00554 reset($records); <a name="l00555"></a>00555 $this->theEditRec = current($records); <a name="l00556"></a>00556 <a class="code" href="classt3lib__BEfunc.html#6325c33f1e88b6ccb8e57e7a267e3b42">t3lib_BEfunc::workspaceOL</a>('pages',$this->theEditRec); <a name="l00557"></a>00557 } <a name="l00558"></a>00558 } <a name="l00559"></a>00559 <span class="keywordflow">if</span> (!is_array($this->theEditRec)) { <a name="l00560"></a>00560 unset($this->theEditRec); <a name="l00561"></a>00561 $this->searchFor = $this->editPage; <a name="l00562"></a>00562 } elseif (!$BE_USER->isInWebMount($this->theEditRec['uid'])) { <a name="l00563"></a>00563 unset($this->theEditRec); <a name="l00564"></a>00564 $this->editError=$LANG->getLL('shortcut_notEditable'); <a name="l00565"></a>00565 } <span class="keywordflow">else</span> { <a name="l00566"></a>00566 <a name="l00567"></a>00567 <span class="comment">// Visual path set:</span> <a name="l00568"></a>00568 $perms_clause = $BE_USER->getPagePermsClause(1); <a name="l00569"></a>00569 $this->editPath = <a class="code" href="classt3lib__BEfunc.html#84b9f7da77c11465b32ecaef4159a80c">t3lib_BEfunc::getRecordPath</a>($this->theEditRec['pid'], $perms_clause, 30); <a name="l00570"></a>00570 <a name="l00571"></a>00571 <span class="keywordflow">if</span>(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) { <a name="l00572"></a>00572 <a name="l00573"></a>00573 <span class="comment">// Expanding page tree:</span> <a name="l00574"></a>00574 <a class="code" href="classt3lib__BEfunc.html#bd7c00158dc22791184eec04f96cb8f5">t3lib_BEfunc::openPageTree</a>($this->theEditRec['pid'],!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded')); <a name="l00575"></a>00575 } <a name="l00576"></a>00576 } <a name="l00577"></a>00577 } <a name="l00578"></a>00578 } <a name="l00579"></a>00579 } <a name="l00580"></a>00580 <a name="l00586"></a><a class="code" href="classSC__alt__shortcut.html#f82686d4e3e318dd0f51057daedd1a3a">00586</a> function printContent() { <a name="l00587"></a>00587 $this->content.= $this->doc->endPage(); <a name="l00588"></a>00588 $this->content = $this->doc->insertStylesAndJS($this->content); <a name="l00589"></a>00589 echo $this->content; <a name="l00590"></a>00590 } <a name="l00591"></a>00591 <a name="l00592"></a>00592 <a name="l00593"></a>00593 <a name="l00594"></a>00594 <a name="l00595"></a>00595 <a name="l00596"></a>00596 <a name="l00597"></a>00597 <a name="l00598"></a>00598 <a name="l00599"></a>00599 <a name="l00600"></a>00600 <span class="comment">/***************************</span> <a name="l00601"></a>00601 <span class="comment"> *</span> <a name="l00602"></a>00602 <span class="comment"> * WORKSPACE FUNCTIONS:</span> <a name="l00603"></a>00603 <span class="comment"> *</span> <a name="l00604"></a>00604 <span class="comment"> ***************************/</span> <a name="l00605"></a>00605 <a name="l00611"></a><a class="code" href="classSC__alt__shortcut.html#c465193666749eaecd2fdec64eb19fed">00611</a> function workspaceSelector() { <a name="l00612"></a>00612 global $TYPO3_DB,$BE_USER,$LANG; <a name="l00613"></a>00613 <a name="l00614"></a>00614 <span class="comment">// Changing workspace and if so, reloading entire backend:</span> <a name="l00615"></a>00615 <span class="keywordflow">if</span> (strlen($this->changeWorkspace)) { <a name="l00616"></a>00616 $BE_USER->setWorkspace($this->changeWorkspace); <a name="l00617"></a>00617 <span class="keywordflow">return</span> $this->doc->wrapScriptTags('top.location.href=<span class="stringliteral">"alt_main.php"</span>;'); <a name="l00618"></a>00618 } <a name="l00619"></a>00619 <span class="comment">// Changing workspace and if so, reloading entire backend:</span> <a name="l00620"></a>00620 <span class="keywordflow">if</span> (strlen($this->changeWorkspacePreview)) { <a name="l00621"></a>00621 $BE_USER->setWorkspacePreview($this->changeWorkspacePreview); <a name="l00622"></a>00622 } <a name="l00623"></a>00623 <a name="l00624"></a>00624 <span class="comment">// Create options array:</span> <a name="l00625"></a>00625 $options = array(); <a name="l00626"></a>00626 <span class="keywordflow">if</span> ($BE_USER->checkWorkspace(array('uid' => 0))) { <a name="l00627"></a>00627 $options[0] = <span class="charliteral">'['</span>.$LANG->getLL('shortcut_onlineWS').<span class="charliteral">']'</span>; <a name="l00628"></a>00628 } <a name="l00629"></a>00629 <span class="keywordflow">if</span> ($BE_USER->checkWorkspace(array('uid' => -1))) { <a name="l00630"></a>00630 $options[-1] = <span class="charliteral">'['</span>.$LANG->getLL('shortcut_offlineWS').<span class="charliteral">']'</span>; <a name="l00631"></a>00631 } <a name="l00632"></a>00632 <a name="l00633"></a>00633 <span class="comment">// Add custom workspaces (selecting all, filtering by BE_USER check):</span> <a name="l00634"></a>00634 $workspaces = $TYPO3_DB->exec_SELECTgetRows('uid,title,adminusers,members,reviewers<span class="charliteral">','</span>sys_workspace<span class="charliteral">','</span>pid=0'.<a class="code" href="classt3lib__BEfunc.html#16c74b2f662fa4157494b0e9caacaefb">t3lib_BEfunc::deleteClause</a>('sys_workspace'),'<span class="charliteral">','</span>title'); <a name="l00635"></a>00635 <span class="keywordflow">if</span> (count($workspaces)) { <a name="l00636"></a>00636 foreach ($workspaces as $rec) { <a name="l00637"></a>00637 <span class="keywordflow">if</span> ($BE_USER->checkWorkspace($rec)) { <a name="l00638"></a>00638 $options[$rec['uid']] = $rec['uid'].': '.$rec['title']; <a name="l00639"></a>00639 } <a name="l00640"></a>00640 } <a name="l00641"></a>00641 } <a name="l00642"></a>00642 <a name="l00643"></a>00643 <span class="comment">// Build selector box:</span> <a name="l00644"></a>00644 <span class="keywordflow">if</span> (count($options)) { <a name="l00645"></a>00645 foreach($options as $value => $label) { <a name="l00646"></a>00646 $selected = ((int)$BE_USER->workspace===$value ? ' selected=<span class="stringliteral">"selected"</span>' : ''); <a name="l00647"></a>00647 $options[$value] = '<option value=<span class="stringliteral">"'.htmlspecialchars($value).'"</span>'.$selected.<span class="charliteral">'>'</span>.htmlspecialchars($label).'</option>'; <a name="l00648"></a>00648 } <a name="l00649"></a>00649 } <span class="keywordflow">else</span> { <a name="l00650"></a>00650 $options[] = '<option value=<span class="stringliteral">"-99"</span>>'.$LANG->getLL('shortcut_noWSfound',1).'</option>'; <a name="l00651"></a>00651 } <a name="l00652"></a>00652 <a name="l00653"></a>00653 $selector = ''; <a name="l00654"></a>00654 <span class="comment">// Preview:</span> <a name="l00655"></a>00655 <span class="keywordflow">if</span> ($BE_USER->workspace!==0) { <a name="l00656"></a>00656 $selector.= 'Frontend Preview: <input type=<span class="stringliteral">"checkbox"</span> onclick=<span class="stringliteral">"changeWorkspacePreview('.($BE_USER->user['workspace_preview'] ? 0 : 1).')"</span>; '.($BE_USER->user['workspace_preview'] ? 'checked=<span class="stringliteral">"checked"</span>' : '').'/>&nbsp;'; <a name="l00657"></a>00657 } <a name="l00658"></a>00658 <a name="l00659"></a>00659 $selector.= '<a href=<span class="stringliteral">"mod/user/ws/index.php"</span> target=<span class="stringliteral">"content"</span>>'. <a name="l00660"></a>00660 <a class="code" href="classt3lib__iconWorks.html#09ccf5c505e700d523bd9c71a43d0fb4">t3lib_iconWorks::getIconImage</a>('sys_workspace',array(),$this->doc->backPath,'align=<span class="stringliteral">"top"</span>'). <a name="l00661"></a>00661 '</a>'. <a name="l00662"></a>00662 '<select name=<span class="stringliteral">"_workspaceSelector"</span> onchange=<span class="stringliteral">"changeWorkspace(this.options[this.selectedIndex].value);"</span>>'.implode('',$options).'</select>'; <a name="l00663"></a>00663 <a name="l00664"></a>00664 <span class="keywordflow">return</span> $selector; <a name="l00665"></a>00665 } <a name="l00666"></a>00666 <a name="l00667"></a>00667 <a name="l00668"></a>00668 <a name="l00669"></a>00669 <a name="l00670"></a>00670 <a name="l00671"></a>00671 <a name="l00672"></a>00672 <a name="l00673"></a>00673 <span class="comment">/***************************</span> <a name="l00674"></a>00674 <span class="comment"> *</span> <a name="l00675"></a>00675 <span class="comment"> * OTHER FUNCTIONS:</span> <a name="l00676"></a>00676 <span class="comment"> *</span> <a name="l00677"></a>00677 <span class="comment"> ***************************/</span> <a name="l00678"></a>00678 <a name="l00686"></a><a class="code" href="classSC__alt__shortcut.html#0fc22c22f21648fb17827d3632487165">00686</a> function mIconFilename($Ifilename,$backPath) { <a name="l00687"></a>00687 <span class="comment">// Change icon of fileadmin references - otherwise it doesn't differ with Web->List</span> <a name="l00688"></a>00688 $Ifilename = str_replace ('mod/file/list/list.gif', 'mod/file/file.gif', $Ifilename); <a name="l00689"></a>00689 <a name="l00690"></a>00690 <span class="keywordflow">if</span> (<a class="code" href="classt3lib__div.html#087c8553dcfca3a0a9aedfd2affd68a0">t3lib_div::isAbsPath</a>($Ifilename)) { <a name="l00691"></a>00691 $Ifilename = '../'.substr($Ifilename,strlen(PATH_site)); <a name="l00692"></a>00692 } <a name="l00693"></a>00693 <span class="keywordflow">return</span> $backPath.$Ifilename; <a name="l00694"></a>00694 } <a name="l00695"></a>00695 <a name="l00702"></a><a class="code" href="classSC__alt__shortcut.html#c72d6485625a203d56833c46a2991d9f">00702</a> function getIcon($modName) { <a name="l00703"></a>00703 global $LANG; <a name="l00704"></a>00704 <span class="keywordflow">if</span> ($LANG->moduleLabels['tabs_images'][$modName.'_tab']) { <a name="l00705"></a>00705 $icon = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$modName.'_tab'],''); <a name="l00706"></a>00706 } elseif ($modName=='xMOD_alt_doc.php') { <a name="l00707"></a>00707 $icon = 'gfx/edit2.gif'; <a name="l00708"></a>00708 } elseif ($modName=='xMOD_file_edit.php') { <a name="l00709"></a>00709 $icon = 'gfx/edit_file.gif'; <a name="l00710"></a>00710 } elseif ($modName=='xMOD_wizard_rte.php') { <a name="l00711"></a>00711 $icon = 'gfx/edit_rtewiz.gif'; <a name="l00712"></a>00712 } <span class="keywordflow">else</span> { <a name="l00713"></a>00713 $icon = 'gfx/dummy_module.gif'; <a name="l00714"></a>00714 } <a name="l00715"></a>00715 <span class="keywordflow">return</span> $icon; <a name="l00716"></a>00716 } <a name="l00717"></a>00717 <a name="l00726"></a><a class="code" href="classSC__alt__shortcut.html#86bcf7ac6dd0c076d061765303e5d22e">00726</a> function itemLabel($inlabel,$modName,$M_modName='') { <a name="l00727"></a>00727 global $LANG; <a name="l00728"></a>00728 <span class="keywordflow">if</span> (substr($modName,0,5)=='xMOD_') { <a name="l00729"></a>00729 $label=substr($modName,5); <a name="l00730"></a>00730 } <span class="keywordflow">else</span> { <a name="l00731"></a>00731 $split = explode(<span class="charliteral">'_'</span>,$modName); <a name="l00732"></a>00732 $label = $LANG->moduleLabels['tabs'][$split[0].'_tab']; <a name="l00733"></a>00733 <span class="keywordflow">if</span> (count($split)>1) { <a name="l00734"></a>00734 $label.=<span class="charliteral">'>'</span>.$LANG->moduleLabels['tabs'][$modName.'_tab']; <a name="l00735"></a>00735 } <a name="l00736"></a>00736 } <a name="l00737"></a>00737 <span class="keywordflow">if</span> ($M_modName) $label.=' ('.$M_modName.<span class="charliteral">')'</span>; <a name="l00738"></a>00738 $label.=': '.$inlabel; <a name="l00739"></a>00739 <span class="keywordflow">return</span> $label; <a name="l00740"></a>00740 } <a name="l00741"></a>00741 <a name="l00748"></a><a class="code" href="classSC__alt__shortcut.html#ca14fcd6e41040ca3e745df95af9bbee">00748</a> function getLinkedPageId($url) { <a name="l00749"></a>00749 <span class="keywordflow">return</span> preg_replace('/.*[\?&]<span class="keywordtype">id</span>=([^&]+).*/', '$1', $url); <a name="l00750"></a>00750 } <a name="l00751"></a>00751 } <a name="l00752"></a>00752 <a name="l00753"></a>00753 <span class="comment">// Include extension?</span> <a name="l00754"></a>00754 <span class="keywordflow">if</span> (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_shortcut.php']) { <a name="l00755"></a>00755 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_shortcut.php']); <a name="l00756"></a>00756 } <a name="l00757"></a>00757 <a name="l00758"></a>00758 <a name="l00759"></a>00759 <a name="l00760"></a>00760 <a name="l00761"></a>00761 <a name="l00762"></a>00762 <a name="l00763"></a>00763 <a name="l00764"></a>00764 <a name="l00765"></a>00765 <a name="l00766"></a>00766 <a name="l00767"></a>00767 <a name="l00768"></a>00768 <span class="comment">// Make instance:</span> <a name="l00769"></a>00769 $SOBE = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classSC__alt__shortcut.html">SC_alt_shortcut</a>'); <a name="l00770"></a>00770 $SOBE->preinit(); <a name="l00771"></a>00771 $SOBE->preprocess(); <a name="l00772"></a>00772 $SOBE->init(); <a name="l00773"></a>00773 $SOBE->main(); <a name="l00774"></a>00774 $SOBE->printContent(); <a name="l00775"></a>00775 ?> </pre></div><?php include_once '../doc-typo3-funcs.php'; get_footer(); ?>