/** * Injects the request object for the current request or subrequest * As this controller goes only through the main() method, it is rather simple for now * * @param ServerRequestInterface $request the current request * @param ResponseInterface $response the prepared response object * @return ResponseInterface the response with the content */ public function mainAction(ServerRequestInterface $request, ResponseInterface $response) { $this->determineScriptUrl($request); $this->initVariables($request); $this->loadLinkHandlers(); $this->initCurrentUrl(); $menuData = $this->buildMenuArray(); $renderLinkAttributeFields = $this->renderLinkAttributeFields(); $browserContent = $this->displayedLinkHandler->render($request); $this->initDocumentTemplate(); $content = $this->doc->startPage('Link Browser'); $content .= $this->doc->getFlashMessages(); if ($this->currentLink) { $content .= '<!-- Print current URL --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl"> <tr> <td>' . $this->getLanguageService()->getLL('currentLink', true) . ': ' . htmlspecialchars($this->currentLinkHandler->formatCurrentUrl()) . '</td> </tr> </table>'; } $content .= $this->doc->getTabMenuRaw($menuData); $content .= $renderLinkAttributeFields; $content .= '<div class="linkBrowser-tabContent">' . $browserContent . '</div>'; $content .= $this->doc->endPage(); $response->getBody()->write($this->doc->insertStylesAndJS($content)); return $response; }
/** * Injects the request object for the current request or subrequest * As this controller goes only through the main() method, it is rather simple for now * * @param ServerRequestInterface $request the current request * @param ResponseInterface $response the prepared response object * @return ResponseInterface the response with the content */ public function mainAction(ServerRequestInterface $request, ResponseInterface $response) { $this->determineScriptUrl($request); $this->initVariables($request); $this->loadLinkHandlers(); $this->initCurrentUrl(); $menuData = $this->buildMenuArray(); $renderLinkAttributeFields = $this->renderLinkAttributeFields(); $browserContent = $this->displayedLinkHandler->render($request); $this->initDocumentTemplate(); $content = $this->doc->startPage('Link Browser'); $content .= $this->doc->getFlashMessages(); if (!empty($this->currentLinkParts)) { $content .= $this->renderCurrentUrl(); } $content .= '<div class="link-browser-section link-browser-tabs">' . $this->doc->getTabMenuRaw($menuData) . '</div>'; $content .= $renderLinkAttributeFields; $content .= $browserContent; $content .= $this->doc->endPage(); $response->getBody()->write($this->doc->insertStylesAndJS($content)); return $response; }
/** * Rich Text Editor (RTE) link selector (MAIN function) * Generates the link selector for the Rich Text Editor. * Can also be used to select links for the TCEforms (see $wiz) * * @param boolean $wiz If set, the "remove link" is not shown in the menu: Used for the "Select link" wizard which is used by the TCEforms * @return string Modified content variable. * @todo Define visibility */ public function main_rte($wiz = FALSE) { // Starting content: $content = $this->doc->startPage('RTE link'); // Initializing the action value, possibly removing blinded values etc: $blindLinkOptions = isset($this->thisConfig['blindLinkOptions']) ? GeneralUtility::trimExplode(',', $this->thisConfig['blindLinkOptions'], TRUE) : array(); $pBlindLinkOptions = isset($this->P['params']['blindLinkOptions']) ? GeneralUtility::trimExplode(',', $this->P['params']['blindLinkOptions']) : array(); $allowedItems = array_diff(array('page', 'file', 'folder', 'url', 'mail', 'spec'), $blindLinkOptions, $pBlindLinkOptions); // Call hook for extra options foreach ($this->hookObjects as $hookObject) { $allowedItems = $hookObject->addAllowedItems($allowedItems); } // Removing link fields if configured $blindLinkFields = isset($this->thisConfig['blindLinkFields']) ? GeneralUtility::trimExplode(',', $this->thisConfig['blindLinkFields'], TRUE) : array(); $pBlindLinkFields = isset($this->P['params']['blindLinkFields']) ? GeneralUtility::trimExplode(',', $this->P['params']['blindLinkFields'], TRUE) : array(); $allowedFields = array_diff(array('target', 'title', 'class', 'params'), $blindLinkFields, $pBlindLinkFields); // If $this->act is not allowed, default to first allowed if (!in_array($this->act, $allowedItems)) { $this->act = reset($allowedItems); } // Making menu in top: $menuDef = array(); if (!$wiz) { $menuDef['removeLink']['isActive'] = $this->act == 'removeLink'; $menuDef['removeLink']['label'] = $GLOBALS['LANG']->getLL('removeLink', TRUE); $menuDef['removeLink']['url'] = '#'; $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"'; } if (in_array('page', $allowedItems)) { $menuDef['page']['isActive'] = $this->act == 'page'; $menuDef['page']['label'] = $GLOBALS['LANG']->getLL('page', TRUE); $menuDef['page']['url'] = '#'; $menuDef['page']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue('?act=page') . ');return false;"'; } if (in_array('file', $allowedItems)) { $menuDef['file']['isActive'] = $this->act == 'file'; $menuDef['file']['label'] = $GLOBALS['LANG']->getLL('file', TRUE); $menuDef['file']['url'] = '#'; $menuDef['file']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue('?act=file') . ');return false;"'; } if (in_array('folder', $allowedItems)) { $menuDef['folder']['isActive'] = $this->act == 'folder'; $menuDef['folder']['label'] = $GLOBALS['LANG']->getLL('folder', TRUE); $menuDef['folder']['url'] = '#'; $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue('?act=folder') . ');return false;"'; } if (in_array('url', $allowedItems)) { $menuDef['url']['isActive'] = $this->act == 'url'; $menuDef['url']['label'] = $GLOBALS['LANG']->getLL('extUrl', TRUE); $menuDef['url']['url'] = '#'; $menuDef['url']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue('?act=url') . ');return false;"'; } if (in_array('mail', $allowedItems)) { $menuDef['mail']['isActive'] = $this->act == 'mail'; $menuDef['mail']['label'] = $GLOBALS['LANG']->getLL('email', TRUE); $menuDef['mail']['url'] = '#'; $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue('?act=mail') . ');return false;"'; } if (is_array($this->thisConfig['userLinks.']) && in_array('spec', $allowedItems)) { $menuDef['spec']['isActive'] = $this->act == 'spec'; $menuDef['spec']['label'] = $GLOBALS['LANG']->getLL('special', TRUE); $menuDef['spec']['url'] = '#'; $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue('?act=spec') . ');return false;"'; } // Call hook for extra options foreach ($this->hookObjects as $hookObject) { $menuDef = $hookObject->modifyMenuDefinition($menuDef); } $content .= $this->doc->getTabMenuRaw($menuDef); // Adding the menu and header to the top of page: $content .= $this->printCurrentUrl($this->curUrlInfo['info']) . '<br />'; // Depending on the current action we will create the actual module content for selecting a link: switch ($this->act) { case 'mail': $extUrl = ' <!-- Enter mail address: --> <form action="" name="lurlform" id="lurlform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail"> <tr> <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('emailAddress', TRUE) . ':</td> <td><input type="text" name="lemail"' . $this->doc->formWidth(20) . ' value="' . htmlspecialchars($this->curUrlInfo['act'] == 'mail' ? $this->curUrlInfo['info'] : '') . '" /> ' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', TRUE) . '" onclick="browse_links_setTarget(\'\');browse_links_setValue(\'mailto:\'+' . 'document.lurlform.lemail.value); return link_current();" /></td> </tr> </table> </form>'; $content .= $extUrl; break; case 'url': $extUrl = ' <!-- Enter External URL: --> <form action="" name="lurlform" id="lurlform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL"> <tr> <td style="width: 96px;">URL:</td> <td><input type="text" name="lurl"' . $this->doc->formWidth(30) . ' value="' . htmlspecialchars($this->curUrlInfo['act'] == 'url' ? $this->curUrlInfo['info'] : 'http://') . '" /> ' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', TRUE) . '" onclick="browse_links_setValue(document.lurlform.lurl.value); return link_current();" /></td> </tr> </table> </form>'; $content .= $extUrl; break; case 'file': case 'folder': $foldertree = GeneralUtility::makeInstance('localFolderTree'); $foldertree->thisScript = $this->thisScript; $tree = $foldertree->getBrowsableTree(); if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act'] != $this->act) { $cmpPath = ''; } else { $cmpPath = $this->curUrlInfo['value']; if (!isset($this->expandFolder)) { $this->expandFolder = $cmpPath; } } // Create upload/create folder forms, if a path is given $selectedFolder = FALSE; if ($this->expandFolder) { $fileOrFolderObject = NULL; try { $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->expandFolder); } catch (\Exception $e) { // No path is selected } if ($fileOrFolderObject instanceof Folder) { // It's a folder $selectedFolder = $fileOrFolderObject; } elseif ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FileInterface) { // it's a file $selectedFolder = $fileOrFolderObject->getParentFolder(); } } // Or get the user's default upload folder if (!$selectedFolder) { try { $selectedFolder = $GLOBALS['BE_USER']->getDefaultUploadFolder(); } catch (\Exception $e) { // The configured default user folder does not exist } } // Build the file upload and folder creation form $uploadForm = ''; $createFolder = ''; if ($selectedFolder) { $uploadForm = $this->act === 'file' ? $this->uploadForm($selectedFolder) : ''; $createFolder = $this->createFolder($selectedFolder); } // Insert the upload form on top, if so configured if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) { $content .= $uploadForm; } // Render the filelist if there is a folder selected if ($selectedFolder) { $allowedExtensions = isset($this->P['params']['allowedExtensions']) ? $this->P['params']['allowedExtensions'] : ''; $files = $this->expandFolder($selectedFolder, $allowedExtensions); } $this->doc->JScode .= $this->doc->wrapScriptTags(' Tree.ajaxID = "SC_alt_file_navframe::expandCollapse"; '); $content .= ' <!-- Wrapper table for folder tree / file/folder list: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles"> <tr> <td class="c-wCell" valign="top">' . $this->barheader($GLOBALS['LANG']->getLL('folderTree') . ':') . $tree . '</td> <td class="c-wCell" valign="top">' . $files . '</td> </tr> </table> <br /> '; // Adding create folder + upload forms if applicable if (!$GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) { $content .= $uploadForm; } $content .= $createFolder . '<br />'; break; case 'spec': if (is_array($this->thisConfig['userLinks.'])) { $subcats = array(); $v = $this->thisConfig['userLinks.']; foreach ($v as $k2 => $value) { $k2i = (int) $k2; if (substr($k2, -1) == '.' && is_array($v[$k2i . '.'])) { // Title: $title = trim($v[$k2i]); if (!$title) { $title = $v[$k2i . '.']['url']; } else { $title = $GLOBALS['LANG']->sL($title); } // Description: $description = $v[$k2i . '.']['description'] ? $GLOBALS['LANG']->sL($v[$k2i . '.']['description'], TRUE) . '<br />' : ''; // URL + onclick event: $onClickEvent = ''; if (isset($v[$k2i . '.']['target'])) { $onClickEvent .= 'browse_links_setTarget(' . GeneralUtility::quoteJSvalue($v[$k2i . '.']['target']) . ');'; } $v[$k2i . '.']['url'] = str_replace('###_URL###', $this->siteURL, $v[$k2i . '.']['url']); if (substr($v[$k2i . '.']['url'], 0, 7) === 'http://' || substr($v[$k2i . '.']['url'], 0, 7) === 'mailto:') { $onClickEvent .= 'cur_href=' . GeneralUtility::quoteJSvalue($v[$k2i . '.']['url']) . ';link_current();'; } else { $onClickEvent .= 'link_spec(' . GeneralUtility::quoteJSvalue($this->siteURL . $v[$k2i . '.']['url']) . ');'; } // Link: $A = array('<a href="#" onclick="' . htmlspecialchars($onClickEvent) . 'return false;">', '</a>'); // Adding link to menu of user defined links: $subcats[$k2i] = ' <tr> <td class="bgColor4">' . $A[0] . '<strong>' . htmlspecialchars($title) . ($this->curUrlInfo['info'] == $v[$k2i . '.']['url'] ? '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"') . ' class="c-blinkArrowR" alt="" />' : '') . '</strong><br />' . $description . $A[1] . '</td> </tr>'; } } // Sort by keys: ksort($subcats); // Add menu to content: $content .= ' <!-- Special userdefined menu: --> <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial"> <tr> <td class="bgColor5" class="c-wCell" valign="top"><strong>' . $GLOBALS['LANG']->getLL('special', TRUE) . '</strong></td> </tr> ' . implode('', $subcats) . ' </table> '; } break; case 'page': $pageTree = GeneralUtility::makeInstance('localPageTree'); $pageTree->thisScript = $this->thisScript; $pageTree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle'); $pageTree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); $pageTree->addField('nav_title'); $tree = $pageTree->getBrowsableTree(); $cElements = $this->expandPage(); $content .= ' <!-- Wrapper table for page tree / record list: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages"> <tr> <td class="c-wCell" valign="top">' . $this->barheader($GLOBALS['LANG']->getLL('pageTree') . ':') . $this->getTemporaryTreeMountCancelNotice() . $tree . '</td> <td class="c-wCell" valign="top">' . $cElements . '</td> </tr> </table> '; break; default: // Call hook foreach ($this->hookObjects as $hookObject) { $content .= $hookObject->getTab($this->act); } } if (in_array('params', $allowedFields, TRUE)) { $content .= ' <!-- Selecting params for link: --> <form action="" name="lparamsform" id="lparamsform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkParams"> <tr> <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('params', TRUE) . '</td> <td><input type="text" name="lparams" class="typo3-link-input" onchange="' . 'browse_links_setParams(this.value);" value="' . htmlspecialchars($this->setParams) . '" /></td> </tr> </table> </form> '; } if (in_array('class', $allowedFields, TRUE)) { $content .= ' <!-- Selecting class for link: --> <form action="" name="lclassform" id="lclassform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass"> <tr> <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', TRUE) . '</td> <td><input type="text" name="lclass" class="typo3-link-input" onchange="' . 'browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '" /></td> </tr> </table> </form> '; } if (in_array('title', $allowedFields, TRUE)) { $content .= ' <!-- Selecting title for link: --> <form action="" name="ltitleform" id="ltitleform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle"> <tr> <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', TRUE) . '</td> <td><input type="text" name="ltitle" class="typo3-link-input" onchange="' . 'browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '" /></td> </tr> </table> </form> '; } // additional fields for page links if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'])) { $conf = array(); $_params = array('conf' => &$conf); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'] as $objRef) { $processor =& GeneralUtility::getUserObj($objRef); $content .= $processor->addFields($_params, $this); } } // Target: if ($this->act != 'mail' && in_array('target', $allowedFields, TRUE)) { $ltarget = ' <!-- Selecting target for link: --> <form action="" name="ltargetform" id="ltargetform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget"> <tr> <td>' . $GLOBALS['LANG']->getLL('target', TRUE) . ':</td> <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="' . htmlspecialchars($this->setTarget) . '"' . $this->doc->formWidth(10) . ' /></td> <td> <select name="ltarget_type" onchange="browse_links_setTarget(' . 'this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=' . 'this.options[this.selectedIndex].value;this.selectedIndex=0;"> <option></option> <option value="_top">' . $GLOBALS['LANG']->getLL('top', TRUE) . '</option> <option value="_blank">' . $GLOBALS['LANG']->getLL('newWindow', TRUE) . '</option> </select> </td> <td>'; if (($this->curUrlInfo['act'] == 'page' || $this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $this->curUrlArray['href'] && $this->curUrlInfo['act'] == $this->act) { $ltarget .= ' <input type="submit" value="' . $GLOBALS['LANG']->getLL('update', TRUE) . '" onclick="return link_current();" />'; } $selectJS = ' if (document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value>0' . ' && document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value>0) { document.ltargetform.ltarget.value = document.ltargetform.popup_width.options[' . 'document.ltargetform.popup_width.selectedIndex].value+"x"' . '+document.ltargetformbrowse_links_setTarget.popup_height.options[' . 'document.ltargetform.popup_height.selectedIndex].value; browse_links_setTarget(document.ltargetform.ltarget.value); browse_links_setClass(document.lclassform.lclass.value); browse_links_setTitle(document.ltitleform.ltitle.value); browse_links_setParams(document.lparamsform.lparams.value); document.ltargetform.popup_width.selectedIndex=0; document.ltargetform.popup_height.selectedIndex=0; } '; $ltarget .= ' </td> </tr> <tr> <td>' . $GLOBALS['LANG']->getLL('target_popUpWindow', TRUE) . ':</td> <td colspan="3"> <select name="popup_width" onchange="' . htmlspecialchars($selectJS) . '"> <option value="0">' . $GLOBALS['LANG']->getLL('target_popUpWindow_width', TRUE) . '</option> <option value="300">300</option> <option value="400">400</option> <option value="500">500</option> <option value="600">600</option> <option value="700">700</option> <option value="800">800</option> </select> x <select name="popup_height" onchange="' . htmlspecialchars($selectJS) . '"> <option value="0">' . $GLOBALS['LANG']->getLL('target_popUpWindow_height', TRUE) . '</option> <option value="200">200</option> <option value="300">300</option> <option value="400">400</option> <option value="500">500</option> <option value="600">600</option> </select> </td> </tr> </table> </form>'; // Add "target selector" box to content: $content .= $ltarget; // Add some space $content .= '<br /><br />'; } // End page, return content: $content .= $this->doc->endPage(); $content = $this->doc->insertStylesAndJS($content); return $content; }
/** * Rich Text Editor (RTE) link selector (MAIN function) * Generates the link selector for the Rich Text Editor. * Can also be used to select links for the TCEforms (see $wiz) * * @param bool $wiz If set, the "remove link" is not shown in the menu: Used for the "Select link" wizard which is used by the TCEforms * @return string Modified content variable. */ public function main_rte($wiz = FALSE) { // Starting content: $content = $this->doc->startPage('RTE link'); // Add the FlashMessages if any $content .= $this->doc->getFlashMessages(); $allowedItems = $this->getAllowedItems('page,file,folder,url,mail,spec'); // Removing link fields if configured $blindLinkFields = isset($this->thisConfig['blindLinkFields']) ? GeneralUtility::trimExplode(',', $this->thisConfig['blindLinkFields'], TRUE) : array(); $pBlindLinkFields = isset($this->P['params']['blindLinkFields']) ? GeneralUtility::trimExplode(',', $this->P['params']['blindLinkFields'], TRUE) : array(); $allowedFields = array_diff(array('target', 'title', 'class', 'params'), $blindLinkFields, $pBlindLinkFields); $content .= $this->doc->getTabMenuRaw($this->buildMenuArray($wiz, $allowedItems)); // Adding the menu and header to the top of page: $content .= $this->printCurrentUrl($this->curUrlInfo['info']) . '<br />'; // Depending on the current action we will create the actual module content for selecting a link: switch ($this->act) { case 'mail': $content .= $this->getEmailSelectorHtml(); break; case 'url': $content .= $this->getExternalUrlSelectorHtml(); break; case 'file': case 'folder': $content .= $this->getFileSelectorHtml(); break; case 'spec': $content .= $this->getUserLinkSelectorHtml(); break; case 'page': $content .= $this->getPageSelectorHtml(); break; default: // Call hook foreach ($this->hookObjects as $hookObject) { $content .= $hookObject->getTab($this->act); } } $lang = $this->getLanguageService(); if (in_array('params', $allowedFields, TRUE)) { $content .= ' <!-- Selecting params for link: --> <form action="" name="lparamsform" id="lparamsform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkParams"> <tr> <td style="width: 96px;">' . $lang->getLL('params', TRUE) . '</td> <td><input type="text" name="lparams" class="typo3-link-input" onchange="' . 'browse_links_setParams(this.value);" value="' . htmlspecialchars($this->setParams) . '" /></td> </tr> </table> </form> '; } if (in_array('class', $allowedFields, TRUE)) { $content .= ' <!-- Selecting class for link: --> <form action="" name="lclassform" id="lclassform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass"> <tr> <td style="width: 96px;">' . $lang->getLL('class', TRUE) . '</td> <td><input type="text" name="lclass" class="typo3-link-input" onchange="' . 'browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '" /></td> </tr> </table> </form> '; } if (in_array('title', $allowedFields, TRUE)) { $content .= ' <!-- Selecting title for link: --> <form action="" name="ltitleform" id="ltitleform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle"> <tr> <td style="width: 96px;">' . $lang->getLL('title', TRUE) . '</td> <td><input type="text" name="ltitle" class="typo3-link-input" onchange="' . 'browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '" /></td> </tr> </table> </form> '; } // additional fields for page links if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'])) { $conf = array(); $_params = array('conf' => &$conf); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'] as $objRef) { $processor =& GeneralUtility::getUserObj($objRef); $content .= $processor->addFields($_params, $this); } } // Target: if ($this->act != 'mail' && in_array('target', $allowedFields, TRUE)) { $ltarget = ' <!-- Selecting target for link: --> <form action="" name="ltargetform" id="ltargetform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget"> <tr> <td>' . $lang->getLL('target', TRUE) . ':</td> <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="' . htmlspecialchars($this->setTarget) . '"' . $this->doc->formWidth(10) . ' /></td> <td> <select name="ltarget_type" onchange="browse_links_setTarget(' . 'this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=' . 'this.options[this.selectedIndex].value;this.selectedIndex=0;"> <option></option> <option value="_top">' . $lang->getLL('top', TRUE) . '</option> <option value="_blank">' . $lang->getLL('newWindow', TRUE) . '</option> </select> </td> <td>'; if (($this->curUrlInfo['act'] == 'page' || $this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $this->curUrlArray['href'] && $this->curUrlInfo['act'] == $this->act) { $ltarget .= ' <input class="btn btn-default" type="submit" value="' . $lang->getLL('update', TRUE) . '" onclick="return link_current();" />'; } $selectJS = ' if (document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value>0' . ' && document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value>0) { document.ltargetform.ltarget.value = document.ltargetform.popup_width.options[' . 'document.ltargetform.popup_width.selectedIndex].value+"x"' . '+document.ltargetformbrowse_links_setTarget.popup_height.options[' . 'document.ltargetform.popup_height.selectedIndex].value; browse_links_setTarget(document.ltargetform.ltarget.value); browse_links_setClass(document.lclassform.lclass.value); browse_links_setTitle(document.ltitleform.ltitle.value); browse_links_setParams(document.lparamsform.lparams.value); document.ltargetform.popup_width.selectedIndex=0; document.ltargetform.popup_height.selectedIndex=0; } '; $ltarget .= ' </td> </tr> <tr> <td>' . $lang->getLL('target_popUpWindow', TRUE) . ':</td> <td colspan="3"> <select name="popup_width" onchange="' . htmlspecialchars($selectJS) . '"> <option value="0">' . $lang->getLL('target_popUpWindow_width', TRUE) . '</option> <option value="300">300</option> <option value="400">400</option> <option value="500">500</option> <option value="600">600</option> <option value="700">700</option> <option value="800">800</option> </select> x <select name="popup_height" onchange="' . htmlspecialchars($selectJS) . '"> <option value="0">' . $lang->getLL('target_popUpWindow_height', TRUE) . '</option> <option value="200">200</option> <option value="300">300</option> <option value="400">400</option> <option value="500">500</option> <option value="600">600</option> </select> </td> </tr> </table> </form>'; // Add "target selector" box to content: $content .= $ltarget; // Add some space $content .= '<br /><br />'; } // End page, return content: $content .= $this->doc->endPage(); $content = $this->doc->insertStylesAndJS($content); return $content; }
/** * Rich Text Editor (RTE) link selector (MAIN function) * Generates the link selector for the Rich Text Editor. * Can also be used to select links for the TCEforms (see $wiz) * * @param bool $wiz If set, the "remove link" is not shown in the menu: Used for the "Select link" wizard which is used by the TCEforms * @return string Modified content variable. */ protected function main_rte($wiz = false) { // needs to be executed before doc->startPage() if (in_array($this->act, array('file', 'folder'))) { $this->doc->getDragDropCode('folders', 'Tree.ajaxID = "sc_alt_file_navframe_expandtoggle"'); } elseif ($this->act === 'page') { $this->doc->getDragDropCode('pages'); } // Starting content: $content = $this->doc->startPage('RTE link'); // Add the FlashMessages if any $content .= $this->doc->getFlashMessages(); $content .= $this->doc->getTabMenuRaw($this->buildMenuArray($wiz, $this->getAllowedItems('page,file,folder,url,mail'))); // Adding the menu and header to the top of page: $content .= $this->printCurrentUrl($this->curUrlInfo['info']) . '<br />'; // Depending on the current action we will create the actual module content for selecting a link: switch ($this->act) { case 'mail': $content .= $this->getEmailSelectorHtml(); break; case 'url': $content .= $this->getExternalUrlSelectorHtml(); break; case 'file': case 'folder': $content .= $this->getFileSelectorHtml(); break; case 'page': $content .= $this->getPageSelectorHtml(); break; default: // Call hook foreach ($this->hookObjects as $hookObject) { $content .= $hookObject->getTab($this->act); } } $lang = $this->getLanguageService(); // Removing link fields if configured $blindLinkFields = isset($this->RTEProperties['default.']['blindLinkFields']) ? GeneralUtility::trimExplode(',', $this->RTEProperties['default.']['blindLinkFields'], true) : array(); $pBlindLinkFields = isset($this->P['params']['blindLinkFields']) ? GeneralUtility::trimExplode(',', $this->P['params']['blindLinkFields'], true) : array(); $allowedFields = array_diff(array('target', 'title', 'class', 'params'), $blindLinkFields, $pBlindLinkFields); if (in_array('params', $allowedFields, true) && $this->act !== 'url') { $content .= ' <!-- Selecting params for link: --> <form action="" name="lparamsform" id="lparamsform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkParams"> <tr> <td style="width: 96px;">' . $lang->getLL('params', true) . '</td> <td><input type="text" name="lparams" class="typo3-link-input" onchange="' . 'browse_links_setParams(this.value);" value="' . htmlspecialchars($this->setParams) . '" /></td> </tr> </table> </form> '; } if (in_array('class', $allowedFields, true)) { $content .= ' <!-- Selecting class for link: --> <form action="" name="lclassform" id="lclassform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass"> <tr> <td style="width: 96px;">' . $lang->getLL('class', true) . '</td> <td><input type="text" name="lclass" class="typo3-link-input" onchange="' . 'browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '" /></td> </tr> </table> </form> '; } if (in_array('title', $allowedFields, true)) { $content .= ' <!-- Selecting title for link: --> <form action="" name="ltitleform" id="ltitleform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle"> <tr> <td style="width: 96px;">' . $lang->getLL('title', true) . '</td> <td><input type="text" name="ltitle" class="typo3-link-input" onchange="' . 'browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '" /></td> </tr> </table> </form> '; } // additional fields for page links if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->hookName]['addFields_PageLink']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->hookName]['addFields_PageLink'])) { $conf = array(); $_params = array('conf' => &$conf); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->hookName]['addFields_PageLink'] as $objRef) { $processor =& GeneralUtility::getUserObj($objRef); $content .= $processor->addFields($_params, $this); } } // Target: if ($this->act !== 'mail' && in_array('target', $allowedFields, true)) { $ltarget = ' <!-- Selecting target for link: --> <form action="" name="ltargetform" id="ltargetform"> <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget"> <tr> <td>' . $lang->getLL('target', true) . ':</td> <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="' . htmlspecialchars($this->setTarget) . '"' . $this->doc->formWidth(10) . ' /></td> <td> <select name="ltarget_type" onchange="browse_links_setTarget(' . 'this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=' . 'this.options[this.selectedIndex].value;this.selectedIndex=0;"> <option></option> <option value="_top">' . $lang->getLL('top', true) . '</option> <option value="_blank">' . $lang->getLL('newWindow', true) . '</option> </select> </td> <td>'; if (($this->curUrlInfo['act'] === 'page' || $this->curUrlInfo['act'] === 'file' || $this->curUrlInfo['act'] === 'folder') && $this->curUrlArray['href'] && $this->curUrlInfo['act'] === $this->act) { $ltarget .= ' <input class="btn btn-default" type="submit" value="' . $lang->getLL('update', true) . '" onclick="return link_current();" />'; } $ltarget .= ' </td> </tr> </table> </form>'; // Add "target selector" box to content: $content .= $ltarget; // Add some space $content .= '<br /><br />'; } // End page, return content: $content .= $this->doc->endPage(); $content = $this->doc->insertStylesAndJS($content); return $content; }