Small but needed changes to treeview
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_treeview.php
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']);
 }