Alphabetically sorted TS tree in TS Object Browser (by Ingo Renner)
authorIngmar Schlecht <ingmar.schlecht@typo3.org>
Tue, 9 Jan 2007 14:02:41 +0000 (14:02 +0000)
committerIngmar Schlecht <ingmar.schlecht@typo3.org>
Tue, 9 Jan 2007 14:02:41 +0000 (14:02 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1900 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tsparser_ext.php
typo3/sysext/beuser/mod/index.php
typo3/sysext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php
typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php
typo3/wizard_tsconfig.php

index 6ddc1ee..04128e7 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-01-09  Ingmar Schlecht  <ingmar@typo3.org>
+
+       * Alphabetically sorted TS tree in TS Object Browser (Thanks to Ingo Renner)
+
 2007-01-09  Sebastian Kurfuerst  <sebastian@typo3.org> (Thanks to Oliver Hader)
 
        * rewrote TBE_EDITOR Javascript functions to use JS "objects" and outsourced them to an external file
index 0c6d257..6704554 100755 (executable)
@@ -361,13 +361,17 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
         * @param       [type]          $depthData: ...
         * @param       [type]          $parentType: ...
         * @param       [type]          $parentValue: ...
+        * @param       boolean         $alphaSort sorts the array keys / tree by alphabet when set to 1
         * @return      [type]          ...
         */
-       function ext_getObjTree($arr, $depth_in, $depthData, $parentType="",$parentValue="")    {
+       function ext_getObjTree($arr, $depth_in, $depthData, $parentType='',$parentValue='', $alphaSort='0')    {
                $HTML="";
                $a=0;
 
                reset($arr);
+               if($alphaSort == '1')   {
+                       ksort($arr);
+               }
                $keyArr_num=array();
                $keyArr_alpha=array();
                while (list($key,)=each($arr))  {
@@ -447,7 +451,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                                $HTML.="<br />";
 
                                if ($deeper)    {
-                                       $HTML.=$this->ext_getObjTree($arr[$key."."], $depth, $depthData.'<img src="'.$GLOBALS["BACK_PATH"].'gfx/ol/'.$LN.'.gif" width="18" height="16" align="top" alt="" />', '' /* not used: $validate_info[$key] */, $arr[$key]);
+                                       $HTML.=$this->ext_getObjTree($arr[$key."."], $depth, $depthData.'<img src="'.$GLOBALS["BACK_PATH"].'gfx/ol/'.$LN.'.gif" width="18" height="16" align="top" alt="" />', '' /* not used: $validate_info[$key] */, $arr[$key], $alphaSort);
                                }
                        }
                }
index a0d259b..23255de 100755 (executable)
@@ -710,7 +710,7 @@ class local_beUserAuth extends t3lib_beUserAuth {
                                                $tmpl->bType='';
                                                $tmpl->ext_expandAllNotes=1;
                                                $tmpl->ext_noPMicons=1;
-                                               $out[$k] = $tmpl->ext_getObjTree($v,'','');
+                                               $out[$k] = $tmpl->ext_getObjTree($v,'','','','','1');
                                        break;
                                        case 'userTS_hl':
                                                $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
index af97920..2c5f6b5 100755 (executable)
@@ -99,7 +99,8 @@ class tx_infopagetsconfig_webinfo extends t3lib_extobjbase {
                                3 => 'TSFE.',
                                4 => 'user.',
                                99 => $LANG->getLL('tsconf_configFields')
-                       )
+                       ),
+                       'tsconf_alphaSort' => '1',
                );
 
                if (!$GLOBALS['BE_USER']->isAdmin())    unset($modMenuAdd['tsconf_parts'][99]);
@@ -115,6 +116,8 @@ class tx_infopagetsconfig_webinfo extends t3lib_extobjbase {
                global $LANG;
 
                $menu = t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[tsconf_parts]',$this->pObj->MOD_SETTINGS['tsconf_parts'],$this->pObj->MOD_MENU['tsconf_parts']);
+               $menu .= "<br />Sort alphabetically: ".t3lib_BEfunc::getFuncCheck($this->pObj->id,'SET[tsconf_alphaSort]',$this->pObj->MOD_SETTINGS['tsconf_alphaSort']);
+               $menu .= '<br /><br />';
 
                if ($this->pObj->MOD_SETTINGS['tsconf_parts']==99)      {
                        $TSparts = t3lib_BEfunc::getPagesTSconfig($this->pObj->id,'',1);
@@ -240,7 +243,7 @@ class tx_infopagetsconfig_webinfo extends t3lib_extobjbase {
                                        <!-- Page TSconfig Tree: -->
                                        <table border="0" cellpadding="0" cellspacing="0">
                                                <tr>
-                                                       <td nowrap="nowrap">'.$tmpl->ext_getObjTree($modTSconfig,'','').'</td>
+                                                       <td nowrap="nowrap">'.$tmpl->ext_getObjTree($modTSconfig,'','','','',$this->pObj->MOD_SETTINGS['tsconf_alphaSort']).'</td>
                                                </tr>
                                        </table>',
                                0,
index 861316d..367da0c 100644 (file)
@@ -53,6 +53,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                        "ts_browser_regexsearch" => "",
                        "ts_browser_fixedLgd" => "1",
                        "ts_browser_linkObjects" => "1",
+                       'ts_browser_alphaSort' => '1',
                );
 
                foreach(array('setup','const') as $bType)       {
@@ -412,7 +413,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                        $theKey=$this->pObj->MOD_SETTINGS["ts_browser_toplevel_".$bType];
                        if (!$theKey || !str_replace("-","",$theKey))   {$theKey="";}
                        list($theSetup,$theSetupValue) = $tmpl->ext_getSetup($theSetup, ($this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]?$this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]:''));
-                       $tree = $tmpl->ext_getObjTree($theSetup, $theKey, "", "", $theSetupValue);
+                       $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
                        $tree = $tmpl->substituteCMarkers($tree);
 
 
@@ -506,10 +507,11 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                        ';
 
                                // Menu in the bottom:
-                       $menu= "Crop lines".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_browser_fixedLgd]",$this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"]);
+                       $menu = "Crop lines: ".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_browser_fixedLgd]",$this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"]);
                        #$menu.= "&nbsp;&nbsp;Enable object links".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_browser_linkObjects]",$this->pObj->MOD_SETTINGS["ts_browser_linkObjects"]);
+                       $menu .= "<br />Sort alphabetically: ".t3lib_BEfunc::getFuncCheck($this->pObj->id,'SET[ts_browser_alphaSort]',$this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
                        if ($bType=="setup" && !$this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"])       {
-                               $menu.= "<BR>Constants display: ".t3lib_BEfunc::getFuncMenu($this->pObj->id,"SET[ts_browser_const]",$this->pObj->MOD_SETTINGS["ts_browser_const"],$this->pObj->MOD_MENU["ts_browser_const"]);
+                               $menu.= "<br />Constants display: ".t3lib_BEfunc::getFuncMenu($this->pObj->id,"SET[ts_browser_const]",$this->pObj->MOD_SETTINGS["ts_browser_const"],$this->pObj->MOD_MENU["ts_browser_const"]);
                        }
                        $theOutput.=$this->pObj->doc->section("",'<NOBR>'.$menu.'</NOBR>');
 
index 3178456..81bd133 100755 (executable)
@@ -394,7 +394,7 @@ class SC_wizard_tsconfig {
                        -->
                                <table border="0" cellpadding="0" cellspacing="0" id="typo3-objtree">
                                        <tr>
-                                               <td nowrap="nowrap">'.$tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode.'.']),'','').'</td>
+                                               <td nowrap="nowrap">'.$tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode.'.']),'','','','','1').'</td>
                                        </tr>
                                </table>';
                }