/***************************************************************
* Copyright notice
*
-* (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
+* (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
/**
* Page navigation tree for the Web module
*
- * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
* XHTML compliant
*
- * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
* @author Benjamin Mack <bmack@xnos.org>
*
*
* 146: function wrapTitle($title,$row,$bank=0)
* 165: function printTree($treeArr = '')
* 271: function PMicon($row,$a,$c,$nextCount,$exp)
- * 292: function PMiconATagWrap($icon, $cmd, $isExpand = true)
+ * 292: function PMiconATagWrap($icon, $cmd, $isExpand = TRUE)
* 309: function getBrowsableTree()
* 377: function getTree($uid, $depth=999, $depthData='',$blankLineCode='',$subCSSclass='')
*
*/
-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 <kasperYYYY@typo3.com>
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
* @author Benjamin Mack <bmack@xnos.org>
* @package TYPO3
* @subpackage core
var $ext_IconMode;
var $ext_separateNotinmenuPages;
var $ext_alphasortNotinmenuPages;
- var $ajaxStatus = false; // Indicates, whether the ajax call was successful, i.e. the requested page has been found
+ var $ajaxStatus = FALSE; // Indicates, whether the ajax call was successful, i.e. the requested page has been found
/**
* Calls init functions
*
* @return void
*/
- function webPageTree() {
+ function __construct() {
$this->init();
}
* @param array Data row for element.
* @return string Page icon
*/
- function wrapIcon($icon,&$row) {
+ function wrapIcon($thePageIcon, &$row) {
// If the record is locked, present a warning sign.
if ($lockInfo=t3lib_BEfunc::isRecordLocked('pages',$row['uid'])) {
$aOnClick = 'alert('.$GLOBALS['LANG']->JScharCode($lockInfo['msg']).');return false;';
$lockIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
- '<img'.t3lib_iconWorks::skinImg('','gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
+ t3lib_iconWorks::getSpriteIcon('status-warning-in-use',array('title'=>htmlspecialchars($lockInfo['msg']))).
'</a>';
} else $lockIcon = '';
- // Add title attribute to input icon tag
- $thePageIcon = $this->addTagAttributes($icon, $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"');
-
// Wrap icon in click-menu link.
if (!$this->ext_IconMode) {
$thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon,'pages',$row['uid'],0,'&bank='.$this->bank);
// Add Page ID:
$pageIdStr = '';
- if ($this->ext_showPageId) { $pageIdStr = '['.$row['uid'].'] '; }
+ if ($this->ext_showPageId) {
+ $pageIdStr = '<span class="dragId">[' . $row['uid'] . ']</span> ';
+ }
// Call stats information hook
$stat = '';
* @access private
*/
function wrapTitle($title,$row,$bank=0) {
- $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'\','.$bank.');';
- $CSM = '';
- if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler']) {
- $CSM = ' oncontextmenu="'.htmlspecialchars($GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon('','pages',$row['uid'],0,'&bank='.$this->bank,'',TRUE)).';"';
+ // 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 = ' oncontextmenu="'.htmlspecialchars($GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon('','pages',$row['uid'],0,'&bank='.$this->bank,'',TRUE)).';"';
$thePageTitle='<a href="#" onclick="'.htmlspecialchars($aOnClick).'"'.$CSM.'>'.$title.'</a>';
// Wrap title in a drag/drop span.
// -- evaluate AJAX request
// IE takes anchor as parameter
$PM = t3lib_div::_GP('PM');
- if(($PMpos = strpos($PM, '#')) !== false) { $PM = substr($PM, 0, $PMpos); }
+ if(($PMpos = strpos($PM, '#')) !== FALSE) { $PM = substr($PM, 0, $PMpos); }
$PM = explode('_', $PM);
- if((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) && is_array($PM) && count($PM)==4) {
+ if ((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) && is_array($PM) && count($PM) == 4 && $PM[2] != 0) {
if($PM[1]) {
$expandedPageUid = $PM[2];
$ajaxOutput = '';
$invertedDepthOfAjaxRequestedItem = 0; // We don't know yet. Will be set later.
- $doExpand = true;
+ $doExpand = TRUE;
} else {
$collapsedPageUid = $PM[2];
- $doCollapse = true;
+ $doCollapse = TRUE;
}
}
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>'; }
// ajax request: collapse
if($doCollapse && $collapsedPageUid == $uid) {
- $this->ajaxStatus = true;
+ $this->ajaxStatus = TRUE;
return $itemHTML;
}
if($v['invertedDepth'] < $invertedDepthOfAjaxRequestedItem) {
$ajaxOutput .= $itemHTML;
} else {
- $this->ajaxStatus = true;
+ $this->ajaxStatus = TRUE;
return $ajaxOutput;
}
}
}
if($ajaxOutput) {
- $this->ajaxStatus = true;
+ $this->ajaxStatus = TRUE;
return $ajaxOutput;
}
* @return string Link-wrapped input string
* @access private
*/
- function PMiconATagWrap($icon, $cmd, $isExpand = true) {
+ function PMiconATagWrap($icon, $cmd, $isExpand = TRUE) {
if ($this->thisScript) {
// activate dynamic ajax-based tree
$js = htmlspecialchars('Tree.load(\''.$cmd.'\', '.intval($isExpand).', this);');
// Set first:
$this->bank = $idx;
- $isOpen = $this->stored[$idx][$uid] || $this->expandFirst;
+ $isOpen = $this->stored[$idx][$uid] || $this->expandFirst || $uid === '0';
// Save ids while resetting everything else.
$curIds = $this->ids;
// 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);
+ // only, if not for uid 0
+ if ($uid) {
+ $icon = '<img' . t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/' . ($isOpen ? 'minus' :'plus' ) . 'only.gif') . ' alt="" />';
+ $firstHtml = $this->PMiconATagWrap($icon, $cmd, !$isOpen);
+ }
// Preparing rootRec for the mount
if ($uid) {
$uid = $rootRec['uid'];
// Add the root of the mount to ->tree
- $this->tree[] = array('HTML'=>$firstHtml, 'row'=>$rootRec, 'bank'=>$this->bank, 'hasSub'=>true, 'invertedDepth'=>1000);
+ $this->tree[] = array('HTML'=>$firstHtml, 'row'=>$rootRec, 'bank'=>$this->bank, 'hasSub'=>TRUE, 'invertedDepth'=>1000);
// If the mount is expanded, go down:
if ($isOpen) {
$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'])) {
+ if ($this->ext_separateNotinmenuPages &&
+ ($row['doktype'] == t3lib_pageSelect::DOKTYPE_BE_USER_SECTION ||
+ $row['doktype'] >= 200 || $row['nav_hide'])) {
$outOfMenuPages[] = $row;
$outOfMenuPagesTextIndex[] = ($row['doktype']>=200 ? 'zzz'.$row['doktype'].'_' : '').$row['title'];
} else {
'HTML' => $HTML,
'hasSub' => $nextCount&&$this->expandNext($newID),
'isFirst'=> $a==1,
- 'isLast' => false,
+ 'isLast' => FALSE,
'invertedDepth'=> $depth,
'blankLineCode'=> $blankLineCode,
'bank' => $this->bank
);
}
- if($a) { $this->tree[$treeKey]['isLast'] = true; }
+ if($a) { $this->tree[$treeKey]['isLast'] = TRUE; }
$this->getDataFree($res);
$this->buffer_idH = $idH;
return $c;
}
}
-
-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