Project

General

Profile

Bug #22410 » 14050_cleaning_t3lib_browsetree.patch

Administrator Admin, 2010-11-24 09:53

View differences:

t3lib/class.t3lib_browsetree.php (revision )
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (kasperYYYY@typo3.com)
* All rights reserved
*
* 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
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (kasperYYYY@typo3.com)
* All rights reserved
*
* 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
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Generate a page-tree, browsable.
*
......
*
*
* 74: class t3lib_browseTree extends t3lib_treeView
* 83: function init($clause='')
* 83: function init($clause='')
* 116: function getTitleAttrib($row)
* 116: function getTitleAttrib($row)
* 128: function wrapIcon($icon,$row)
* 128: function wrapIcon($icon,$row)
* 150: function getTitleStr($row,$titleLen=30)
* 150: function getTitleStr($row,$titleLen=30)
*
* TOTAL FUNCTIONS: 4
* (This index is automatically created/updated by the extension "extdeveval")
......
*/
/**
* Extension class for the t3lib_treeView class, specially made for browsing pages
*
......
* @param string Additional clause for selecting pages.
* @return void
*/
function init($clause='') {
function init($clause = '') {
// this will hide records from display - it has nothing todo with user rights!!
$clauseExludePidList = '';
if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) {
if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) {
$clauseExludePidList = ' AND pages.uid NOT IN ('.$pidList.')';
$clauseExludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
}
}
// This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
parent::init(' AND '.$GLOBALS['BE_USER']->getPagePermsClause(1).' '.$clause.$clauseExludePidList, 'sorting');
parent::init(' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1) . ' ' . $clause . $clauseExludePidList, 'sorting');
$this->table = 'pages';
$this->setTreeName('browsePages');
......
$this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
$this->MOUNTS = $GLOBALS['WEBMOUNTS'];
if ($pidList) {
if ($pidList) {
// Remove mountpoint if explicitely set in options.hideRecords.pages (see above)
$hideList = explode(',',$pidList);
$hideList = explode(',', $pidList);
$this->MOUNTS = array_diff($this->MOUNTS,$hideList);
$this->MOUNTS = array_diff($this->MOUNTS, $hideList);
}
$this->fieldArray = array_merge($this->fieldArray,array('doktype','php_tree_stop','t3ver_id','t3ver_state','t3ver_wsid','t3ver_swapmode','t3ver_state','t3ver_move_id'));
$this->fieldArray = array_merge(
$this->fieldArray,
array('doktype', 'php_tree_stop', 't3ver_id', 't3ver_state', 't3ver_wsid', 't3ver_swapmode', 't3ver_state', 't3ver_move_id')
);
if (t3lib_extMgm::isLoaded('cms')) {
if (t3lib_extMgm::isLoaded('cms')) {
$this->fieldArray = array_merge(
$this->fieldArray,
array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'is_siteroot', 'nav_hide')
......
* @return string
*/
function getTitleAttrib($row) {
return t3lib_BEfunc::titleAttribForPages($row,'1=1 '.$this->clause,0);
return t3lib_BEfunc::titleAttribForPages($row, '1=1 ' . $this->clause, 0);
}
/**
......
* @return string The processed icon input value.
* @access private
*/
function wrapIcon($icon,$row) {
function wrapIcon($icon, $row) {
// Add title attribute to input icon tag
$theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"' : ''));
$theIcon = $this->addTagAttributes($icon, ($this->titleAttrib ? $this->titleAttrib . '="' . $this->getTitleAttrib($row) . '"' : ''));
// Wrap icon in click-menu link.
if (!$this->ext_IconMode) {
if (!$this->ext_IconMode) {
$theIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($theIcon,$this->treeName,$this->getId($row),0);
$theIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($theIcon, $this->treeName, $this->getId($row), 0);
} elseif (!strcmp($this->ext_IconMode,'titlelink')) {
} elseif (!strcmp($this->ext_IconMode, 'titlelink')) {
$aOnClick = 'return jumpTo(\''.$this->getJumpToParam($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>';
$theIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $theIcon . '</a>';
}
return $theIcon;
}
......
* @param integer Title length (30)
* @return string The title.
*/
function getTitleStr($row,$titleLen=30) {
function getTitleStr($row, $titleLen = 30) {
// get the basic title from the parent implementation in t3lib_treeview
$title = parent::getTitleStr($row,$titleLen);
$title = parent::getTitleStr($row, $titleLen);
if (isset($row['is_siteroot']) && $row['is_siteroot'] != 0 && $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showDomainNameWithTitle')) {
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('domainName,sorting', 'sys_domain',
'pid=' . $GLOBALS['TYPO3_DB']->quoteStr($row['uid'] . t3lib_BEfunc::deleteClause('sys_domain') . t3lib_BEfunc::BEenableFields('sys_domain'), 'sys_domain'), '', 'sorting', 1);
'pid=' . $GLOBALS['TYPO3_DB']->quoteStr($row['uid'] . t3lib_BEfunc::deleteClause('sys_domain') . t3lib_BEfunc::BEenableFields('sys_domain'), 'sys_domain'), '', 'sorting', 1);
if (is_array($rows) && count($rows) > 0) {
$title = sprintf('%s [%s]', $title, htmlspecialchars($rows[0]['domainName']));
}
......
return $title;
}
/**
/**
* Adds a red "+" to the input string, $str, if the field "php_tree_stop" in the $row (pages) is set
*
* @param string Input string, like a page title for the tree
......
* @return string Modified string
* @access private
*/
function wrapStop($str, $row) {
function wrapStop($str, $row) {
if ($row['php_tree_stop']) {
$str .= '<span class="typo3-red">
<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => $row['uid']))).'" class="typo3-red">+</a>
<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => $row['uid']))) . '" class="typo3-red">+</a>
</span>';
}
return $str;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_browsetree.php']) {
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_browsetree.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_browsetree.php']);
}
(11-11/93)