*/
class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
/**
* whether the page ID should be shown next to the title, activate through
* userTSconfig (options.pageTree.showPageIdWithTitle)
*
* @boolean
*/
public $ext_showPageId = FALSE;
/**
* Constructor. Just calling init()
*/
public function __construct() {
$this->determineScriptUrl();
$this->init();
$this->clause = ' AND doktype!=' . \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER . $this->clause;
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, (must be ready for output, that means it must be htmlspecialchars()'ed).
* @param array $v The record
* @param bool $ext_pArrPages (Ignore)
* @return string Wrapping title string.
*/
public function wrapTitle($title, $v, $ext_pArrPages = '') {
if ($this->ext_isLinkable($v['doktype'], $v['uid'])) {
$aOnClick = 'return link_typo3Page(\'' . $v['uid'] . '\');';
return '' . $title . '';
} else {
return '' . $title . '';
}
}
/**
* Create the page navigation tree in HTML
*
* @param array $treeArr Tree array
* @return string HTML output.
*/
public function printTree($treeArr = '') {
$titleLen = (int)$GLOBALS['BE_USER']->uc['titleLen'];
if (!is_array($treeArr)) {
$treeArr = $this->tree;
}
$out = '';
$c = 0;
foreach ($treeArr as $k => $v) {
$c++;
$bgColorClass = ($c + 1) % 2 ? 'bgColor' : 'bgColor-10';
if ($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'] == $v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
$arrCol = '
![]() | ';
$bgColorClass = 'bgColor4';
} else {
$arrCol = ' | ';
}
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid']) . ');';
$cEbullet = $this->ext_isLinkable($v['row']['doktype'], $v['row']['uid']) ? '
' : '';
$out .= '
' . $v['HTML'] . $this->wrapTitle($this->getTitleStr($v['row'], $titleLen), $v['row'], $this->ext_pArrPages) . ' | ' . $arrCol . '' . $cEbullet . ' |
';
}
$out = '
';
return $out;
}
/**
* Returns TRUE if a doktype can be linked.
*
* @param int $doktype Doktype value to test
* @param int $uid uid to test.
* @return bool
*/
public function ext_isLinkable($doktype, $uid) {
if ($uid && $doktype < 199) {
return TRUE;
}
}
/**
* Wrap the plus/minus icon in a link
*
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param bool $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
* @return string Link-wrapped input string
*/
public function PM_ATagWrap($icon, $cmd, $bMark = '') {
$name = '';
if ($bMark) {
$anchor = '#' . $bMark;
$name = ' name="' . $bMark . '"';
}
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'PM=' . $cmd) . ',' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($anchor) . ');';
return '' . $icon . '';
}
/**
* Wrapping the image tag, $icon, for the row, $row
*
* @param string $icon The image tag for the icon
* @param array $row The row for the current element
* @return string The processed icon input value.
*/
public function wrapIcon($icon, $row) {
$content = $this->addTagAttributes($icon, ' title="id=' . $row['uid'] . '"');
if ($this->ext_showPageId) {
$content .= '[' . $row['uid'] . '] ';
}
return $content;
}
}
/**
* For TBE record browser
*
* @author Kasper Skårhøj
*/
class TBE_PageTree extends localPageTree {
/**
* Returns TRUE if a doktype can be linked (which is always the case here).
*
* @param int $doktype Doktype value to test
* @param int $uid uid to test.
* @return bool
*/
public function ext_isLinkable($doktype, $uid) {
return TRUE;
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param array $v The record
* @param bool $ext_pArrPages If set, pages clicked will return immediately, otherwise reload page.
* @return string Wrapping title string.
*/
public function wrapTitle($title, $v, $ext_pArrPages) {
if ($ext_pArrPages) {
$ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $v);
$onClick = 'return insertElement(\'pages\', \'' . $v['uid'] . '\', \'db\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($v['title']) . ', \'\', \'\', \'' . $ficon . '\',\'\',1);';
} else {
$onClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid']) . ');';
}
return '' . $title . '';
}
}
/**
* Base extension class which generates the folder tree.
* Used directly by the RTE.
* also used for the linkpicker on files
*
* @author Kasper Skårhøj
*/
class localFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
/**
* @var int
*/
public $ext_IconMode = 1;
/**
* Initializes the script path
*/
public function __construct() {
$this->determineScriptUrl();
parent::__construct();
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record
* @return string Wrapping title string.
*/
public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
if ($this->ext_isLinkable($folderObject)) {
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
return '' . $title . '';
} else {
return '' . $title . '';
}
}
/**
* Returns TRUE if the input "record" contains a folder which can be linked.
*
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject Object with information about the folder element. Contains keys like title, uid, path, _title
* @return bool TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
*/
public function ext_isLinkable(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
if (strstr($folderObject->getIdentifier(), '_recycler_') || strstr($folderObject->getIdentifier(), '_temp_')) {
return FALSE;
} else {
return TRUE;
}
}
/**
* Wrap the plus/minus icon in a link
*
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param bool $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
* @return string Link-wrapped input string
* @access private
*/
public function PM_ATagWrap($icon, $cmd, $bMark = '') {
$name = $anchor = '';
if ($bMark) {
$anchor = '#' . $bMark;
$name = ' name="' . $bMark . '"';
}
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'PM=' . $cmd) . ',' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($anchor) . ');';
return '' . $icon . '';
}
}
/**
* For TBE File Browser
*
* @author Kasper Skårhøj
*/
class TBE_FolderTree extends localFolderTree {
/**
* If file-drag mode is set, temp and recycler folders are filtered out.
*
* @var int
*/
public $ext_noTempRecyclerDirs = 0;
/**
* Returns TRUE if the input "record" contains a folder which can be linked.
*
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject object with information about the folder element. Contains keys like title, uid, path, _title
* @return bool TRUE is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
*/
public function ext_isLinkable($folderObject) {
if ($this->ext_noTempRecyclerDirs && (substr($folderObject->getIdentifier(), -7) == '_temp_/' || substr($folderObject->getIdentifier(), -11) == '_recycler_/')) {
return FALSE;
} else {
return TRUE;
}
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folderObject 'record'
* @return string Wrapping title string.
*/
public function wrapTitle($title, $folderObject) {
if ($this->ext_isLinkable($folderObject)) {
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
return '' . $title . '';
} else {
return '' . $title . '';
}
}
}