Follow-up to #12381: Scheduler: BLOB database fields may not be NOT NULL
[Packages/TYPO3.CMS.git] / typo3 / class.webpagetree.php
old mode 100755 (executable)
new mode 100644 (file)
index e468ae9..9ba5bba
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  */
 
 
-require_once(PATH_t3lib.'class.t3lib_browsetree.php');
-
-
 /**
- * Extension class for the t3lib_browsetree class, specially made 
+ * Extension class for the t3lib_browsetree class, specially made
  * for browsing pages in the Web module
  *
  * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
@@ -157,6 +154,15 @@ class webPageTree extends t3lib_browseTree {
         * @access      private
         */
        function wrapTitle($title,$row,$bank=0) {
+                       // Hook for overriding the page title
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.webpagetree.php']['pageTitleOverlay'])) {
+                       $_params = array('title' => &$title, 'row' => &$row);
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.webpagetree.php']['pageTitleOverlay'] as $_funcRef) {
+                               t3lib_div::callUserFunction($_funcRef, $_params, $this);
+                       }
+                       unset($_params);
+               }
+
                $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'\','.$bank.');';
                $CSM = '';
                if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'])       {
@@ -168,7 +174,7 @@ class webPageTree extends t3lib_browseTree {
                return '<span class="dragTitle" id="dragTitleID_'.$row['uid'].'">'.$thePageTitle.'</span>';
        }
 
-       
+
        /**
         * Compiles the HTML code for displaying the structure found inside the ->tree array
         *
@@ -183,7 +189,7 @@ class webPageTree extends t3lib_browseTree {
 
                $out = '
                        <!-- TYPO3 tree structure. -->
-                       <ul class="tree">
+                       <ul class="tree" id="treeRoot">
                ';
 
                        // -- evaluate AJAX request
@@ -203,7 +209,7 @@ class webPageTree extends t3lib_browseTree {
                        }
                }
 
-               // we need to count the opened <ul>'s every time we dig into another level, 
+               // we need to count the opened <ul>'s every time we dig into another level,
                // so we know how many we have to close when all children are done rendering
                $closeDepth = array();
 
@@ -213,7 +219,7 @@ class webPageTree extends t3lib_browseTree {
                        $idAttr = htmlspecialchars($this->domIdPrefix.$this->getId($v['row']).'_'.$v['bank']);
                        $itemHTML  = '';
 
-                       // if this item is the start of a new level, 
+                       // if this item is the start of a new level,
                        // then a new level <ul> is needed, but not in ajax mode
                        if($v['isFirst'] && !($doCollapse) && !($doExpand && $expandedPageUid == $uid)) {
                                $itemHTML = '<ul>';
@@ -224,9 +230,9 @@ class webPageTree extends t3lib_browseTree {
                        if($v['isLast']) { $classAttr .= ($classAttr) ? ' last' : 'last';        }
 
                        $itemHTML .='
-                               <li id="'.$idAttr.'"'.($classAttr ? ' class="'.$classAttr.'"' : '').'>'.
+                               <li id="'.$idAttr.'"'.($classAttr ? ' class="'.$classAttr.'"' : '').'><div class="treeLinkItem">'.
                                        $v['HTML'].
-                                       $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$v['bank'])."\n";
+                                       $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$v['bank'])."</div>\n";
 
 
                        if(!$v['hasSub']) { $itemHTML .= '</li>'; }
@@ -255,7 +261,7 @@ class webPageTree extends t3lib_browseTree {
                        if($doExpand && $expandedPageUid == $uid) {
                                $ajaxOutput .= $itemHTML;
                                $invertedDepthOfAjaxRequestedItem = $v['invertedDepth'];
-                       } elseif($invertedDepthOfAjaxRequestedItem) { 
+                       } elseif($invertedDepthOfAjaxRequestedItem) {
                                if($v['invertedDepth'] < $invertedDepthOfAjaxRequestedItem) {
                                        $ajaxOutput .= $itemHTML;
                                } else {
@@ -336,7 +342,7 @@ class webPageTree extends t3lib_browseTree {
                        // Init done:
                $titleLen = intval($this->BE_USER->uc['titleLen']);
                $treeArr = array();
-               
+
                        // Traverse mounts:
                foreach($this->MOUNTS as $idx => $uid)  {
 
@@ -352,7 +358,7 @@ class webPageTree extends t3lib_browseTree {
                                // Set PM icon for root of mount:
                        $cmd = $this->bank.'_'.($isOpen? "0_" : "1_").$uid.'_'.$this->treeName;
                        $icon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($isOpen?'minus':'plus').'only.gif').' alt="" />';
-                       $firstHtml = $this->PMiconATagWrap($icon,$cmd);
+                       $firstHtml = $this->PMiconATagWrap($icon,$cmd,!$isOpen);
 
                                // Preparing rootRec for the mount
                        if ($uid)   {
@@ -412,8 +418,9 @@ class webPageTree extends t3lib_browseTree {
                $outOfMenuPagesTextIndex = array();
                while ($crazyRecursionLimiter > 0 && $row = $this->getDataNext($res,$subCSSclass))      {
                        $crazyRecursionLimiter--;
-       
+
                                // Not in menu:
+                               // @TODO: RFC #7370: doktype 2&5 are deprecated since TYPO3 4.2-beta1
                        if ($this->ext_separateNotinmenuPages && (t3lib_div::inList('5,6',$row['doktype']) || $row['doktype']>=200 || $row['nav_hide']))        {
                                $outOfMenuPages[] = $row;
                                $outOfMenuPagesTextIndex[] = ($row['doktype']>=200 ? 'zzz'.$row['doktype'].'_' : '').$row['title'];
@@ -429,11 +436,11 @@ class webPageTree extends t3lib_browseTree {
                        if ($this->ext_alphasortNotinmenuPages) {
                                asort($outOfMenuPagesTextIndex);
                                $label_shownAlphabetically = " (alphabetic)";
-                       } 
+                       }
                        foreach($outOfMenuPagesTextIndex as $idx => $txt)       {
                                $outOfMenuPages_alphabetic[] = $outOfMenuPages[$idx];
                        }
-       
+
                                // Merge:
                        $outOfMenuPages_alphabetic[0]['_FIRST_NOT_IN_MENU']=TRUE;
                        $allRows = array_merge($inMenuPages,$outOfMenuPages_alphabetic);
@@ -444,7 +451,7 @@ class webPageTree extends t3lib_browseTree {
                        // Traverse the records:
                foreach ($allRows as $row)      {
                        $a++;
-                       
+
                        $newID = $row['uid'];
                        $this->tree[]=array();    // Reserve space.
                        end($this->tree);
@@ -480,7 +487,7 @@ class webPageTree extends t3lib_browseTree {
                                } else {
                                        $HTML = '';
                                }
-                               
+
                                $HTML.= $this->PMicon($row,$a,$c,$nextCount,$exp);
                                $HTML.= $this->wrapStop($this->getIcon($row),$row);
                        }
@@ -509,4 +516,5 @@ class webPageTree extends t3lib_browseTree {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.webpagetree.php'])    {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.webpagetree.php']);
 }
-?>
+
+?>
\ No newline at end of file