46 parent::__construct();
57 public function wrapIcon($thePageIcon, $row)
60 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
63 $aOnClick =
'alert(' . GeneralUtility::quoteJSvalue($lockInfo[
'msg']) .
');return false;';
64 $lockIcon =
'<a href="#" onclick="' . htmlspecialchars($aOnClick) .
'">'
65 .
'<span title="' . htmlspecialchars($lockInfo[
'msg']) .
'">' . $iconFactory->getIcon(
'warning-in-use',
Icon::SIZE_SMALL)->render() .
'</span></a>';
70 if (!$this->ext_IconMode) {
72 } elseif ($this->ext_IconMode ===
'titlelink') {
73 $aOnClick =
'return jumpTo(' . GeneralUtility::quoteJSvalue($this->
getJumpToParam($row)) .
',this,' . GeneralUtility::quoteJSvalue($this->treeName) .
');';
74 $thePageIcon =
'<a href="#" onclick="' . htmlspecialchars($aOnClick) .
'">' . $thePageIcon .
'</a>';
77 $dragDropIcon =
'<span class="list-tree-icon dragIcon" id="dragIconID_' . $row[
'uid'] .
'">' . $thePageIcon .
'</span> ';
80 if ($this->ext_showPageId) {
81 $pageIdStr =
'<span class="dragId">[' . $row[
'uid'] .
']</span> ';
85 $_params = [
'pages', $row[
'uid']];
86 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'GLOBAL'][
'recStatInfoHooks'] ?? [] as $_funcRef) {
87 $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
89 return $dragDropIcon . $lockIcon . $pageIdStr . $stat;
105 $_params = [
'title' => &
$title,
'row' => &$row];
106 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/class.webpagetree.php'][
'pageTitleOverlay'] ?? [] as $_funcRef) {
107 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
110 $aOnClick =
'return jumpTo(' . GeneralUtility::quoteJSvalue($this->
getJumpToParam($row)) .
',this,' . GeneralUtility::quoteJSvalue($this->domIdPrefix . $this->
getId($row)) .
',' .
$bank .
');';
113 $thePageTitle =
'<a href="#" onclick="' . htmlspecialchars($aOnClick) .
'" ' . GeneralUtility::implodeAttributes($clickMenuParts) .
'>' .
$title .
'</a>';
115 return '<span class="list-tree-title dragTitle" id="dragTitleID_' . $row[
'uid'] .
'">' . $thePageTitle .
'</span>';
126 $titleLen = (int)$this->BE_USER->uc[
'titleLen'];
127 if (!is_array($treeArr)) {
130 $out =
'<ul class="list-tree list-tree-root">';
133 $PM = GeneralUtility::_GP(
'PM');
134 if (($PMpos = strpos($PM,
'#')) !==
false) {
135 $PM = substr($PM, 0, $PMpos);
137 $PM = explode(
'_', $PM);
141 $expandedPageUid =
null;
142 $collapsedPageUid =
null;
143 if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX && is_array($PM) && count($PM) === 4 && $PM[2] != 0) {
145 $expandedPageUid = $PM[2];
148 $collapsedPageUid = $PM[2];
156 $invertedDepthOfAjaxRequestedItem = 0;
157 foreach ($treeArr as $k => $treeItem) {
158 $classAttr = $treeItem[
'row'][
'_CSSCLASS'];
159 $uid = $treeItem[
'row'][
'uid'];
160 $idAttr = htmlspecialchars($this->domIdPrefix . $this->
getId($treeItem[
'row']) .
'_' . $treeItem[
'bank']);
164 if ($treeItem[
'isFirst'] && !$doCollapse && (!$doExpand || (
int)$expandedPageUid !== (
int)$uid)) {
165 $itemHTML =
'<ul class="list-tree">';
169 if ($treeItem[
'hasSub']) {
170 $classAttr .=
' list-tree-control-open';
172 $itemHTML .=
'<li id="' . $idAttr .
'" ' . ($classAttr ?
' class="' . trim($classAttr) .
'"' :
'')
173 .
'><span class="list-tree-group">' . $treeItem[
'HTML']
174 . $this->
wrapTitle($this->
getTitleStr($treeItem[
'row'], $titleLen), $treeItem[
'row'], $treeItem[
'bank']) .
'</span>';
175 if (!$treeItem[
'hasSub']) {
176 $itemHTML .=
'</li>';
181 if ($treeItem[
'isLast'] && !($doExpand && $expandedPageUid == $uid)) {
182 $closeDepth[$treeItem[
'invertedDepth']] = 1;
186 if ($treeItem[
'isLast'] && !$treeItem[
'hasSub'] && !$doCollapse && !($doExpand && $expandedPageUid == $uid)) {
187 for ($i = $treeItem[
'invertedDepth']; $closeDepth[$i] == 1; $i++) {
189 $itemHTML .=
'</ul></li>';
193 if ($doCollapse && (
int)$collapsedPageUid === (int)$uid) {
194 $this->ajaxStatus =
true;
198 if ($doExpand && (
int)$expandedPageUid === (int)$uid) {
199 $ajaxOutput .= $itemHTML;
200 $invertedDepthOfAjaxRequestedItem = $treeItem[
'invertedDepth'];
201 } elseif ($invertedDepthOfAjaxRequestedItem) {
202 if ($treeItem[
'invertedDepth'] < $invertedDepthOfAjaxRequestedItem) {
203 $ajaxOutput .= $itemHTML;
205 $this->ajaxStatus =
true;
212 $this->ajaxStatus =
true;
232 public function PMicon($row, $a, $c, $nextCount, $exp)
236 $cmd = $this->bank .
'_' . ($exp ?
'0_' :
'1_') . $row[
'uid'] .
'_' . $this->treeName;
253 if ($this->thisScript) {
255 $js = htmlspecialchars(
'Tree.load(' . GeneralUtility::quoteJSvalue($cmd) .
', ' . (
int)$isExpand .
', this);');
256 return '<a class="list-tree-control' . (!$isExpand ?
' list-tree-control-open' :
' list-tree-control-closed') .
'" onclick="' . $js .
'"><i class="fa"></i></a>';
275 foreach ($this->MOUNTS as $idx => $uid) {
278 $isOpen = $this->stored[$idx][$uid] || $this->expandFirst || $uid ===
'0';
282 $this->ids = $curIds;
286 $cmd = $this->bank .
'_' . ($isOpen ?
'0_' :
'1_') . $uid .
'_' . $this->treeName;
287 $firstHtml =
'<a class="list-tree-control list-tree-control-' . ($isOpen ?
'open' :
'closed')
288 .
'" href="' . htmlspecialchars($this->
getThisScript() .
'PM=' . $cmd) .
'"><i class="fa"></i></a>';
293 $firstHtml .= $this->
getIcon($rootRec);
299 if (is_array($rootRec)) {
301 $uid = $rootRec[
'uid'];
303 $this->tree[] = [
'HTML' => $firstHtml,
'row' => $rootRec,
'bank' =>
$this->bank,
'hasSub' =>
true,
'invertedDepth' => 1000];
307 if ($this->addSelfId) {
313 $treeArr = array_merge($treeArr, $this->tree);