*** empty log message ***
[Packages/TYPO3.CMS.git] / typo3 / alt_shortcut.php
index 3e0803c..c450950 100755 (executable)
  */
 
 
-require ('init.php');
-require ('template.php');
-include ('sysext/lang/locallang_misc.php');
-require_once (PATH_t3lib.'class.t3lib_loadmodules.php');
-require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
+require('init.php');
+require('template.php');
+$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
+require_once(PATH_t3lib.'class.t3lib_loadmodules.php');
+require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
 
 
 
@@ -87,7 +87,6 @@ class SC_alt_shortcut {
        var $URL;
        var $editSC;
        var $deleteCategory;
-       var $editPage;
        var $editName;
        var $editGroup;
        var $whichItem;
@@ -104,6 +103,7 @@ class SC_alt_shortcut {
 
        var $editLoaded;                // Flag for defining whether we are editing
        var $editError;                 // Can contain edit error message
+       var $editPath;                  // Set to the record path of the record being edited.
        var $editSC_rec;                // Holds the shortcut record when editing
        var $theEditRec;                // Page record to be edited
        var $editPage;                  // Page alias or id to be edited
@@ -200,10 +200,6 @@ class SC_alt_shortcut {
        function init() {
                global $BACK_PATH;
 
-                       // If another page module was specified, replace the default Page module with the new one
-               $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
-               $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
-
                $this->doc = t3lib_div::makeInstance('template');
                $this->doc->backPath = $BACK_PATH;
                $this->doc->form='<form action="alt_shortcut.php" name="shForm" method="post">';
@@ -226,16 +222,6 @@ class SC_alt_shortcut {
                        function submitEditPage(id)     {       //
                                document.location="alt_shortcut.php?editPage="+top.rawurlencode(id);
                        }
-                       function loadEditId(id) {       //
-                               top.fsMod.recentIds["web"]=id;
-                               top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_0";         // For highlighting
-
-                               if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)  {
-                                       top.content.nav_frame.refresh_nav();
-                               }
-
-                               top.goToModule("'.$pageModule.'");
-                       }
                        ');
                $this->content.=$this->doc->startPage('Shortcut frame');
        }
@@ -301,7 +287,7 @@ class SC_alt_shortcut {
                        $this->lines[]='<td class="'.$bgColorClass.'"><a href="#" onclick="'.htmlspecialchars($onC).'"><img src="'.$this->getIcon($row['module_name']).'" title="'.htmlspecialchars($titleA).'" alt="" /></a></td>';
                        if (trim($row['description']))  {
                                $kkey = strtolower(substr($row['description'],0,20)).'_'.$row['uid'];
-                               $this->selOpt[$kkey]='<option value="'.htmlspecialchars($jumpSC).'">'.htmlspecialchars(t3lib_div::fixed_lgd($row['description'],50)).'</option>';
+                               $this->selOpt[$kkey]='<option value="'.htmlspecialchars($jumpSC).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($row['description'],50)).'</option>';
                        }
                        $formerGr=$row['sc_group'];
                }
@@ -314,9 +300,12 @@ class SC_alt_shortcut {
                if (!$this->editLoaded && t3lib_extMgm::isLoaded('cms'))        {
                                $editIdCode = '<td nowrap="nowrap">'.$LANG->getLL('shortcut_editID',1).': <input type="text" value="'.($this->editError?htmlspecialchars($this->editPage):'').'" name="editPage"'.$this->doc->formWidth(5).' onchange="submitEditPage(this.value);" />'.
                                        ($this->editError?'&nbsp;<strong><span class="typo3-red">'.htmlspecialchars($this->editError).'</span></strong>':'').
-                                       (is_array($this->theEditRec)?'&nbsp;<strong>'.$LANG->getLL('shortcut_loadEdit',1).' \''.t3lib_BEfunc::getRecordTitle('pages',$this->theEditRec,1).'\'</strong>':'').
+                                       (is_array($this->theEditRec)?'&nbsp;<strong>'.$LANG->getLL('shortcut_loadEdit',1).' \''.t3lib_BEfunc::getRecordTitle('pages',$this->theEditRec,1).'\'</strong> ('.htmlspecialchars($this->editPath).')':'').
                                        '</td>';
-               } else $editIdCode='';
+               } else $editIdCode = '';
+
+                       // Adding CSH:
+               $editIdCode.= '<td>&nbsp;'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'shortcuts', $GLOBALS['BACK_PATH'],'',TRUE).'</td>';
 
                $this->content.='
 
@@ -334,7 +323,7 @@ class SC_alt_shortcut {
                        ';
 
                if ($this->theEditRec['uid'])   {
-                       $this->content.=$this->doc->wrapScriptTags('loadEditId('.$this->theEditRec['uid'].');');
+                       $this->content.=$this->doc->wrapScriptTags('top.loadEditId('.$this->theEditRec['uid'].');');
                }
        }
 
@@ -411,10 +400,10 @@ class SC_alt_shortcut {
 
                        // EDIT page:
                $this->editPage = trim(strtolower($this->editPage));
-               $this->editError='';
-               $this->theEditRec='';
+               $this->editError = '';
+               $this->theEditRec = '';
                if ($this->editPage)    {
-                       $where=' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).')';
+                       $where = ' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).')';
                        if (t3lib_div::testInt($this->editPage))        {
                                $this->theEditRec = t3lib_BEfunc::getRecord ('pages',$this->editPage,'*',$where);
                        } else {
@@ -427,17 +416,16 @@ class SC_alt_shortcut {
                        if (!is_array($this->theEditRec) || !$BE_USER->isInWebMount($this->theEditRec['uid']))  {
                                unset($this->theEditRec);
                                $this->editError=$LANG->getLL('shortcut_notEditable');
-                       } elseif(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
-                               $expandedPages=unserialize($BE_USER->uc['browseTrees']['browsePages']);
-                               if (!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'))        $expandedPages=array();
-                               $rL=t3lib_BEfunc::BEgetRootLine($this->theEditRec['pid']);
-                               reset($rL);
-                               while(list(,$rLDat)=each($rL))  {
-                                       $expandedPages[0][$rLDat['uid']]=1;
-               //                      debug($rLDat['uid']);
+                       } else {
+                                       // Visual path set:
+                               $perms_clause = $BE_USER->getPagePermsClause(1);
+                               $this->editPath = t3lib_BEfunc::getRecordPath($this->theEditRec['pid'], $perms_clause, 30);
+
+                               if(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
+
+                                               // Expanding page tree:
+                                       t3lib_BEfunc::openPageTree($this->theEditRec['pid'],!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
                                }
-                               $BE_USER->uc['browseTrees']['browsePages'] = serialize($expandedPages);
-                               $BE_USER->writeUC();
                        }
                }
        }