/** * Helper function for editPanel() which wraps icons in the panel in a link with the action of the panel. * The links are for some of them not simple hyperlinks but onclick-actions which submits a little form which the panel is wrapped in. * * @param string $string The string to wrap in a link, typ. and image used as button in the edit panel. * @param string $formName The name of the form wrapping the edit panel. * @param string $cmd The command of the link. There is a predefined list available: edit, new, up, down etc. * @param string $currentRecord The "table:uid" of the record being processed by the panel. * @param string $confirm Text string with confirmation message; If set a confirm box will be displayed before carrying out the action (if Yes is pressed) * @param int|string $nPid "New pid" - for new records * @return string A <a> tag wrapped string. */ protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord = '', $confirm = '', $nPid = '') { $nV = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0; if ($cmd == 'edit') { $rParts = explode(':', $currentRecord); $out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', array('edit[' . $rParts[0] . '][' . $rParts[1] . ']' => 'edit', 'noView=' . $nV)), $currentRecord); } elseif ($cmd == 'new') { $rParts = explode(':', $currentRecord); if ($rParts[0] == 'pages') { $out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('db_new', ['id' => $rParts[1], 'pagesOnly' => 1]), $currentRecord); } else { if (!(int) $nPid) { $nPid = MathUtility::canBeInterpretedAsInteger($rParts[1]) ? -$rParts[1] : $this->frontendController->id; } $out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', array('edit[' . $rParts[0] . '][' . $nPid . ']' => 'new', 'noView' => $nV)), $currentRecord); } } else { if ($confirm && $this->backendUser->jsConfirmation(JsConfirmation::FE_EDIT)) { // Gets htmlspecialchared later $cf1 = 'if (confirm(' . GeneralUtility::quoteJSvalue($confirm, TRUE) . ')) {'; $cf2 = '}'; } else { $cf1 = $cf2 = ''; } $out = '<a href="#" onclick="' . htmlspecialchars($cf1 . 'document.' . $formName . '[\'TSFE_EDIT[cmd]\'].value=\'' . $cmd . '\'; document.' . $formName . '.submit();' . $cf2 . ' return false;') . '">' . $string . '</a>'; } return $out; }
/** * Creates a link to a script (eg. EditDocumentController or NewRecordController) which either opens in the current frame OR in a pop-up window. * * @param string $string The string to wrap in a link, typ. and image used as button in the edit panel. * @param string $url The URL of the link. Should be absolute if supposed to work with <base> path set. * @param string $additionalClasses Additional CSS classes * @return string A <a> tag wrapped string. * @see editPanelLinkWrap() */ protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '') { $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupWidth'), 690, 5000, 690); $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupHeight'), 500, 5000, 500); $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=' . PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::siteRelPath('backend') . 'Resources/Private/Templates/Close.html')) . ',\'FEquickEditWindow\',\'width=' . $width . ',height=' . $height . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;'; return '<a href="#" class="btn btn-default btn-sm ' . htmlspecialchars($additionalClasses) . '" onclick="' . htmlspecialchars($onclick) . '" class="frontEndEditIconLinks">' . $string . '</a>'; }
/** * Calls t3lib_tsfeBeUserAuth::extGetTreeList. * Although this duplicates the function t3lib_tsfeBeUserAuth::extGetTreeList * this is necessary to create the object that is used recursively by the original function. * * Generates a list of Page-uid's from $id. List does not include $id itself * The only pages excluded from the list are deleted pages. * * @param integer Start page id * @param integer Depth to traverse down the page tree. * @param integer $begin is an optional integer that determines at which level in the tree to start collecting uid's. Zero means 'start right away', 1 = 'next level and out' * @param string Perms clause * @return string Returns the list with a comma in the end (if any pages selected!) * @todo Define visibility */ public function extGetTreeList($id, $depth, $begin = 0, $perms_clause) { // TODO: Fix this as this calls a non-static method return \TYPO3\CMS\Backend\FrontendBackendUserAuthentication::extGetTreeList($id, $depth, $begin, $perms_clause); }