Small but needed changes to treeview
authorRené Fritz <r.fritz@colorcube.de>
Sun, 16 May 2004 14:47:32 +0000 (14:47 +0000)
committerRené Fritz <r.fritz@colorcube.de>
Sun, 16 May 2004 14:47:32 +0000 (14:47 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@296 709f56b5-9817-0410-a4d7-c38de5d9e867

t3lib/class.t3lib_browsetree.php
t3lib/class.t3lib_foldertree.php
t3lib/class.t3lib_treeview.php
typo3/alt_db_navframe.php

index 4a5f682..7b95067 100755 (executable)
@@ -123,7 +123,7 @@ class t3lib_browseTree extends t3lib_treeView {
                if (!$this->ext_IconMode)       {
                        $theIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($theIcon,$this->treeName,$this->getId($row),0);
                } elseif (!strcmp($this->ext_IconMode,'titlelink'))     {
-                       $aOnClick = 'return jumpTo('.$this->getJumpToParm($row).',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$this->bank.'\');';
+                       $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$this->bank.'\');';
                        $theIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$theIcon.'</a>';
                }
                return $theIcon;
index c682538..b0ae951 100755 (executable)
@@ -42,7 +42,7 @@
  *   88:     function t3lib_folderTree()
  *  106:     function wrapIcon($icon,$row)
  *  126:     function getId($v)
- *  136:     function getJumpToParm($v)
+ *  136:     function getJumpToParam($v)
  *  148:     function getTitleStr($row,$titleLen=30)
  *  158:     function getBrowsableTree()
  *  221:     function getFolderTree($files_path, $depth=999, $depthData='')
@@ -111,7 +111,7 @@ class t3lib_folderTree extends t3lib_treeView  {
                if (!$this->ext_IconMode)       {
                        $theFolderIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($theFolderIcon,$row['path'],'',0);
                } elseif (!strcmp($this->ext_IconMode,'titlelink'))     {
-                       $aOnClick = 'return jumpTo('.$this->getJumpToParm($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$this->bank.'\');';
+                       $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$this->bank.'\');';
                        $theFolderIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$theFolderIcon.'</a>';
                }
                return $theFolderIcon;
@@ -133,8 +133,8 @@ class t3lib_folderTree extends t3lib_treeView  {
         * @param       array           The record array.
         * @return      string          The jump-url parameter.
         */
-       function getJumpToParm($v) {
-               return "'".rawurlencode($v['path'])."'";
+       function getJumpToParam($v) {
+               return rawurlencode($v['path']);
        }
 
        /**
index 702fae2..a053924 100755 (executable)
@@ -67,7 +67,7 @@
  *  664:     function getTitleStr($row,$titleLen=30)
  *  676:     function getTitleAttrib($row)
  *  686:     function getId($row)
- *  696:     function getJumpToParm($row)
+ *  696:     function getJumpToParam($row)
  *
  *              SECTION: tree data buidling
  *  729:     function getTree($uid, $depth=999, $depthData='',$blankLineCode='')
@@ -324,10 +324,10 @@ class t3lib_treeView {
                $this->recs = array();
                $this->ids = array();
                $this->ids_hierarchy = array();
-
-       # These lines should be removed; The first one does not do anything since $This is not $this; The second makes tree generation based on an array impossible...
-#              $This->data = false;
-#              $this->dataLookup = false;
+       
+                       // setting this to false disables the use of array-trees by default
+               $this->data = false;
+               $this->dataLookup = false;
        }
 
 
@@ -502,7 +502,7 @@ class t3lib_treeView {
         * @access private
         */
        function wrapTitle($title,$row,$bank=0) {
-               $aOnClick = 'return jumpTo('.$this->getJumpToParm($row).',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$bank.'\');';
+               $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$bank.'\');';
                return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
        }
 
@@ -695,8 +695,8 @@ class t3lib_treeView {
         * @param       array           The record array.
         * @return      string          The jump-url parameter.
         */
-       function getJumpToParm($row) {
-               return "'".$this->getId($row)."'";
+       function getJumpToParam($row) {
+               return $this->getId($row);
        }
 
 
@@ -1057,6 +1057,32 @@ class t3lib_treeView {
 
 
 
+// temporary code by r.fritz
+// will be removed if better solution is available
+
+class t3lib_TCEforms_SelectTreeView extends t3lib_treeview {
+
+       var $TCEforms_itemFormElName='';
+       var $TCEforms_nonSelectableItemsArray=array();
+       
+       function wrapTitle($title,$v)   {
+               if($v['uid']>0) {
+                       if (in_array($v['uid'],$this->TCEforms_nonSelectableItemsArray)) {
+                               return '<span style="color:grey">'.$title.'</span>';
+                       } else {
+                               $aOnClick = 'setFormValueFromBrowseWin(\''.$this->TCEforms_itemFormElName.'\','.$v['uid'].',\''.$title.'\'); return false;';
+                               return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
+                       }
+               } else {
+                       return $title;
+               }
+       }
+}
+                       
+                       
+                       
+
+
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_treeview.php']) {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_treeview.php']);
 }
index a6c177e..3c3962b 100755 (executable)
@@ -1,19 +1,19 @@
 <?php
 /***************************************************************
 *  Copyright notice
-*
+*  
 *  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
 *  All rights reserved
 *
-*  This script is part of the TYPO3 project. The TYPO3 project is
+*  This script is part of the TYPO3 project. The TYPO3 project is 
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
-*
+* 
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
+*  A copy is found in the textfile GPL.txt and important notices to the license 
 *  from the author is found in LICENSE.txt distributed with these scripts.
 *
 *
  *
  *
  *
- *   72: class localPageTree extends t3lib_browseTree
- *   79:     function localPageTree()
- *   90:     function wrapIcon($icon,&$row)
+ *   72: class localPageTree extends t3lib_browseTree 
+ *   79:     function localPageTree() 
+ *   90:     function wrapIcon($icon,&$row)    
  *
  *
- *  131: class SC_alt_db_navframe
- *  147:     function init()
+ *  131: class SC_alt_db_navframe 
+ *  147:     function init()   
  *  235:     function main()
  *  263:     function printContent()
  *
@@ -63,7 +63,7 @@ require_once (PATH_t3lib.'class.t3lib_browsetree.php');
 
 /**
  * Extension class for the t3lib_browsetree class, specially made for browsing pages in the Web module
- *
+ * 
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -76,8 +76,8 @@ class localPageTree extends t3lib_browseTree {
 
        /**
         * Calls init functions
-        *
-        * @return      void
+        * 
+        * @return      void            
         */
        function localPageTree() {
                $this->init();
@@ -85,7 +85,7 @@ class localPageTree extends t3lib_browseTree {
 
        /**
         * Wrapping icon in browse tree
-        *
+        * 
         * @param       string          Icon IMG code
         * @param       array           Data row for element.
         * @return      string          Page icon
@@ -106,7 +106,7 @@ class localPageTree extends t3lib_browseTree {
                if (!$this->ext_IconMode)       {
                        $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon,'pages',$row['uid'],0);
                } elseif (!strcmp($this->ext_IconMode,'titlelink'))     {
-                       $aOnClick = 'return jumpTo('.$this->getJumpToParm($row).',this,\''.$this->treeName.'\');';
+                       $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->treeName.'\');';
                        $thePageIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$thePageIcon.'</a>';
                }
 
@@ -134,7 +134,7 @@ class localPageTree extends t3lib_browseTree {
 
 /**
  * Main script class for the page tree navigation frame
- *
+ * 
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -144,16 +144,16 @@ class SC_alt_db_navframe {
                // Internal:
        var $content;
        var $pagetree;
-       var $doc;
-
+       var $doc;       
+       
                // Internal, static: GPvar:
        var $currentSubScript;
        var $cMR;
 
        /**
         * Initialiation of the class
-        *
-        * @return      void
+        * 
+        * @return      void            
         */
        function init() {
                global $BE_USER,$BACK_PATH;
@@ -161,7 +161,7 @@ class SC_alt_db_navframe {
                        // Setting GPvars:
                $this->currentSubScript = t3lib_div::_GP('currentSubScript');
                $this->cMR = t3lib_div::_GP('cMR');
-
+               
                        // Create page tree object:
                $this->pagetree = t3lib_div::makeInstance('localPageTree');
                $this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
@@ -188,7 +188,7 @@ class SC_alt_db_navframe {
                        // Setting JavaScript for menu.
                $this->doc->JScode=$this->doc->wrapScriptTags(
        ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
-
+       
                // Function, loading the list frame from navigation tree:
        function jumpTo(id,linkObj,highLightID) {       //
                var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
@@ -198,13 +198,13 @@ class SC_alt_db_navframe {
                } else {
                        parent.list_frame.document.location=theUrl;
                }
-
+               
                '.($this->doHighlight?'hilight_row("web",highLightID);':'').'
-
+               
                '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
                return false;
        }
-
+       
                // Call this function, refresh_nav(), from another script in the backend if you want to refresh the navigation frame (eg. after having changed a page title or moved pages etc.)
                // See t3lib_BEfunc::getSetUpdateSignal()
        function refresh_nav()  {       //
@@ -213,7 +213,7 @@ class SC_alt_db_navframe {
        function _refresh_nav() {       //
                document.location="'.$this->pagetree->thisScript.'?unique='.time().'";
        }
-
+       
                // Highlighting rows in the page tree:
        function hilight_row(frameSetModule,highLightID) {      //
 
@@ -222,7 +222,7 @@ class SC_alt_db_navframe {
                if (theObj)     {
                        theObj.style.backgroundColor="";
                }
-
+               
                        // Set new:
                top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;
                theObj = document.getElementById(highLightID);
@@ -230,7 +230,7 @@ class SC_alt_db_navframe {
                        theObj.style.backgroundColor="'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'";
                }
        }
-
+       
        '.($this->cMR?"jumpTo(top.fsMod.recentIds['web'],'');":'').';
                ');
 
@@ -243,8 +243,8 @@ class SC_alt_db_navframe {
 
        /**
         * Main function, rendering the browsable page tree
-        *
-        * @return      void
+        * 
+        * @return      void            
         */
        function main() {
                global $LANG,$CLIENT;
@@ -271,8 +271,8 @@ class SC_alt_db_navframe {
 
        /**
         * Outputting the accumulated content to screen
-        *
-        * @return      void
+        * 
+        * @return      void            
         */
        function printContent() {
                $this->content.= $this->doc->endPage();