Example #1
0
 /**
  * Generate the page path for docHeader
  *
  * @return string The page path
  */
 public function getPath()
 {
     $pageRecord = $this->recordArray;
     $title = '';
     // Is this a real page
     if (is_array($pageRecord) && $pageRecord['uid']) {
         $title = substr($pageRecord['_thePathFull'], 0, -1);
         // Remove current page title
         $pos = strrpos($title, $pageRecord['title']);
         if ($pos !== false) {
             $title = substr($title, 0, $pos);
         }
     } elseif (!empty($pageRecord['combined_identifier'])) {
         try {
             $resourceObject = ResourceFactory::getInstance()->getInstance()->getObjectFromCombinedIdentifier($pageRecord['combined_identifier']);
             $title = $resourceObject->getStorage()->getName() . ':';
             $title .= $resourceObject->getParentFolder()->getReadablePath();
         } catch (ResourceDoesNotExistException $e) {
         }
     }
     // Setting the path of the page
     // crop the title to title limit (or 50, if not defined)
     $beUser = $this->getBackendUser();
     $cropLength = empty($beUser->uc['titleLen']) ? 50 : $beUser->uc['titleLen'];
     $croppedTitle = GeneralUtility::fixed_lgd_cs($title, -$cropLength);
     if ($croppedTitle !== $title) {
         $pagePath = '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
     } else {
         $pagePath = htmlspecialchars($title);
     }
     return $pagePath;
 }
 function main(&$backRef, $menuItems, $tableID, $srcId)
 {
     $this->backRef = $backRef;
     $this->beUser = $GLOBALS['BE_USER'];
     $this->LANG = $GLOBALS['LANG'];
     $this->includeLocalLang();
     if (($tableID == 'dragDrop_tt_news_cat' || $tableID == 'tt_news_cat_CM') && $srcId) {
         $table = 'tt_news_cat';
         $rec = BackendUtility::getRecordWSOL($table, $srcId);
         // fetch page record to get editing permissions
         $lCP = $this->beUser->calcPerms(BackendUtility::getRecord('pages', $rec['pid']));
         $doEdit = $lCP & 16;
         //			if ($doEdit && $tableID == 'dragDrop_tt_news_cat') {
         //				$dstId = intval(GeneralUtility::_GP('dstId'));
         //				$menuItems['moveinto'] = $this->dragDrop_moveCategory($srcId,$dstId);
         //				$menuItems['copyinto'] = $this->dragDrop_copyCategory($srcId,$dstId);
         //			}
         if ($tableID == 'tt_news_cat_CM') {
             $menuItems = array();
             if ($doEdit) {
                 $menuItems['edit'] = $this->DB_edit($table, $srcId);
                 $menuItems['new'] = $this->DB_new($table, $rec);
                 $menuItems['newsub'] = $this->DB_new($table, $rec, true);
             }
             $menuItems['info'] = $this->backRef->DB_info($table, $srcId);
             if ($doEdit) {
                 $menuItems['hide'] = $this->DB_hideUnhide($table, $rec, 'hidden');
                 $elInfo = array(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle('tt_news_cat', $rec), $this->beUser->uc['titleLen']));
                 $menuItems['spacer2'] = 'spacer';
                 $menuItems['delete'] = $this->DB_delete($table, $srcId, $elInfo);
             }
         }
     }
     return $menuItems;
 }
 /**
  * Main processing, creating the list of new record tables to select from.
  *
  * @return void
  */
 public function main()
 {
     // if commerce parameter is missing use default controller
     if (!GeneralUtility::_GP('parentCategory')) {
         parent::main();
         return;
     }
     // If there was a page - or if the user is admin
     // (admins has access to the root) we proceed:
     if ($this->pageinfo['uid'] || $this->getBackendUserAuthentication()->isAdmin()) {
         // Acquiring TSconfig for this module/current page:
         $this->web_list_modTSconfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
         // allow only commerce related tables
         $this->allowedNewTables = array('tx_commerce_categories', 'tx_commerce_products');
         $this->deniedNewTables = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['properties']['deniedNewTables'], true);
         // Acquiring TSconfig for this module/parent page:
         $this->web_list_modTSconfig_pid = BackendUtility::getModTSconfig($this->pageinfo['pid'], 'mod.web_list');
         $this->allowedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['allowedNewTables'], true);
         $this->deniedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['deniedNewTables'], true);
         // More init:
         if (!$this->showNewRecLink('pages')) {
             $this->newPagesInto = 0;
         }
         if (!$this->showNewRecLink('pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) {
             $this->newPagesAfter = 0;
         }
         // Set header-HTML and return_url
         if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
             $iconImgTag = IconUtility::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = strip_tags($this->pageinfo[SettingsFactory::getInstance()->getTcaValue('pages.ctrl.label')]);
         } else {
             $iconImgTag = IconUtility::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
         }
         $this->code = '<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag, 'pages', $this->pageinfo['uid']) . htmlspecialchars(GeneralUtility::fixed_lgd_cs($title, 45)) . '</span><br />';
         $this->R_URI = $this->returnUrl;
         // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard)
         // Regular new element:
         if (!$this->pagesOnly) {
             $this->regularNew();
         } elseif ($this->showNewRecLink('pages')) {
             // Pages only wizard
             $this->pagesOnly();
         }
         // Add all the content to an output section
         $this->content .= $this->doc->section('', $this->code);
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers['CSH'] = $docHeaderButtons['csh'];
         $markers['CONTENT'] = $this->content;
         // Build the <body> for the module
         $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
         $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
         $this->content .= $this->doc->endPage();
         $this->content = $this->doc->insertStylesAndJS($this->content);
     }
 }
Example #4
0
 /**
  * Renders a single item displayed in the current folder
  *
  * @param ResourceInterface $fileOrFolderObject
  *
  * @return array
  * @throws \InvalidArgumentException
  */
 protected function renderItem(ResourceInterface $fileOrFolderObject)
 {
     if (!$fileOrFolderObject instanceof Folder) {
         throw new \InvalidArgumentException('Expected Folder object, got "' . get_class($fileOrFolderObject) . '" object.', 1443651369);
     }
     $overlay = null;
     if ($fileOrFolderObject instanceof InaccessibleFolder) {
         $overlay = ['status-overlay-locked' => []];
     }
     return ['icon' => $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL, $overlay)->render(), 'identifier' => $fileOrFolderObject->getCombinedIdentifier(), 'name' => $fileOrFolderObject->getName(), 'url' => GeneralUtility::makeInstance(LinkService::class)->asString(['type' => LinkService::TYPE_FOLDER, 'folder' => $fileOrFolderObject]), 'title' => GeneralUtility::fixed_lgd_cs($fileOrFolderObject->getName(), (int) $this->getBackendUser()->uc['titleLen'])];
 }
    public function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS, $TYPO3_DB;
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        $this->pageId = $this->pageinfo['uid'];
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            // Draw the header.
            $this->doc = GeneralUtility::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->form = '<form action="mod.php?M=web_txvalidateurlsM1" method="POST">';
            // JavaScript
            $this->doc->JScode = '
				<script language="javascript" type="text/javascript">
					script_ended = 0;
					function jumpToUrl(URL)
					{
						document.location = URL;
					}
				</script>
			';
            $this->doc->postCode = '
				<script language="javascript" type="text/javascript">
					script_ended = 1;
					if (top.fsMod) top.fsMod.recentIds["web"] = 0;
				</script>
			';
            $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], 50);
            $this->content .= $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])));
            $this->content .= $this->doc->divider(5);
            // Render content:
            $this->moduleContent();
            // ShortCut
            if ($BE_USER->mayMakeShortcut()) {
                $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']));
            }
            $this->content .= $this->doc->spacer(10);
            $this->content .= '</div>';
        } else {
            // If no access or if ID == zero
            $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
            $this->doc->backPath = $BACK_PATH;
            $this->content .= $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
    }
    /**
     * Main Task center module
     *
     * @return string HTML content.
     * @todo Define visibility
     */
    public function main()
    {
        if ($id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('display')) {
            return $this->urlInIframe($this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id, 1);
        } else {
            // Thumbnail folder and files:
            $tempDir = $this->userTempFolder();
            if ($tempDir) {
                $thumbnails = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempDir, 'png,gif,jpg', 1);
            }
            $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
            $usernames = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
            // Create preset links:
            $presets = $this->getPresets();
            $opt = array();
            $opt[] = '
			<tr class="bgColor5 tableheader">
				<td>Icon:</td>
				<td>Preset Title:</td>
				<td>Public</td>
				<td>Owner:</td>
				<td>Page:</td>
				<td>Path:</td>
				<td>Meta data:</td>
			</tr>';
            if (is_array($presets)) {
                foreach ($presets as $presetCfg) {
                    $configuration = unserialize($presetCfg['preset_data']);
                    $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
                    $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
                    $opt[] = '
					<tr class="bgColor4">
						<td>' . ($thumbnailFile ? '<img src="' . $this->backPath . '../' . substr($tempDir, strlen(PATH_site)) . basename($thumbnailFile) . '" hspace="2" width="70" style="border: solid black 1px;" alt="" /><br />' : '&nbsp;') . '</td>
						<td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display=' . $presetCfg['uid'] . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, 30)) . '</a>&nbsp;</td>
						<td>' . ($presetCfg['public'] ? 'Yes' : '&nbsp;') . '</td>
						<td>' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? 'Own' : '[' . $usernames[$presetCfg['user_uid']]['username'] . ']') . '</td>
						<td>' . ($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : '&nbsp;') . '</td>
						<td>' . htmlspecialchars($configuration['pagetree']['id'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20) : '[Single Records]') . '</td>
						<td>
							<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />' . htmlspecialchars($configuration['meta']['description']) . ($configuration['meta']['notes'] ? '<br /><br /><strong>Notes:</strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>' : '') . '
						</td>
					</tr>';
                }
                $content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">' . implode('', $opt) . '</table>';
            }
        }
        // Output:
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section('Export presets', $content, 0, 1);
        return $theOutput;
    }
Example #7
0
 /**
  * Wrapping $title in a-tags.
  *
  * @param string $title Title
  * @param string $row   Record
  * @param int    $bank  Pointer (which mount point number)
  *
  * @return string
  */
 public function wrapTitle($title, &$row, $bank = 0)
 {
     if (!is_array($row) || !is_numeric($bank)) {
         if (TYPO3_DLOG) {
             GeneralUtility::devLog('wrapTitle (articleview) gets passed invalid parameters.', COMMERCE_EXTKEY, 3);
         }
         return '';
     }
     // Max. size for Title of 255
     $title = trim($title) ? GeneralUtility::fixed_lgd_cs($title, 255) : $this->getLL('leaf.noTitle');
     $aOnClick = 'if(top.content.list_frame){top.content.list_frame.location.href=top.TS.PATH_typo3+\'alt_doc.php?' . 'returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+' . 'top.content.list_frame.document.location.search)+\'&' . $this->getJumpToParam($row) . '\';}';
     $res = $this->noOnclick ? $title : '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . htmlspecialchars(strip_tags($title)) . '</a>';
     return $res;
 }
Example #8
0
    /**
     * Main function of the module.
     * Write the content to $this->content
     */
    function main()
    {
        // Access check!
        // The page will show only if there is a valid page and if this page may be viewed by the user
        $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
            // Draw the header.
            $this->doc->form = '<form action="" method="POST">';
            // JavaScript
            $this->doc->JScode = '
				<script language="javascript" type="text/javascript">
					script_ended = 0;
					function jumpToUrl(URL)	{
						document.location = URL;
					}
				</script>
			';
            $this->doc->postCode = '
				<script language="javascript" type="text/javascript">
					script_ended = 1;
					if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
				</script>
			';
            $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.path') . ': ' . GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], -50);
            $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])));
            $this->content .= $this->doc->divider(5);
            // Render content:
            $this->moduleContent();
            // ShortCut
            if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
                $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']));
            }
            $this->content .= $this->doc->spacer(10);
        } else {
            // If no access or if ID == zero
            $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
    }
 /**
  * Main method
  *
  * @param CLickMenu $backRef
  * @param array $menuItems
  * @param string $table
  * @param int $uid
  *
  * @return array
  */
 public function main($backRef, array $menuItems, $table = '', $uid = 0)
 {
     if ($table === 'tt_content') {
         $this->setLanguageService($GLOBALS['LANG']);
         // add "paste reference after" if user is allowed to use CType shortcut
         if ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', 'explicitAllow')) {
             if ($menuItems['pasteafter']) {
                 unset($menuItems['pasteafter']);
                 $selItem = $backRef->clipObj->getSelectedRecord();
                 $targetItem = BackendUtility::getRecordRaw('tt_content', 'uid = ' . $uid, 'colPos,tx_gridelements_container,tx_gridelements_columns');
                 $elInfo = array(GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $this->getBackendUser()->uc['titleLen']), $backRef->root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $backRef->rec), $this->getBackendUser()->uc['titleLen']), $backRef->clipObj->currentMode());
                 $menuItems['pasteafter'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, false);
                 if ($backRef->clipObj->currentMode() === 'copy') {
                     $menuItems['pastereference'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, true);
                 }
             }
         }
     }
     return $menuItems;
 }
 /**
  * Renders the current page path
  *
  * @return string the rendered page path
  * @see template::getPagePath() Note: can't call this method as it's protected!
  */
 public function render()
 {
     $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     $pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Is this a real page
     if ($pageRecord['uid']) {
         $title = $pageRecord['_thePathFull'];
     } else {
         $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
     }
     // Setting the path of the page
     $pagePath = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path', TRUE) . ': <span class="typo3-docheader-pagePath">';
     // crop the title to title limit (or 50, if not defined)
     $cropLength = empty($GLOBALS['BE_USER']->uc['titleLen']) ? 50 : $GLOBALS['BE_USER']->uc['titleLen'];
     $croppedTitle = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, -$cropLength);
     if ($croppedTitle !== $title) {
         $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
     } else {
         $pagePath .= htmlspecialchars($title);
     }
     $pagePath .= '</span>';
     return $pagePath;
 }
Example #11
0
 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $id = GeneralUtility::_GP('id');
     $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Is this a real page
     if ($pageRecord['uid']) {
         $title = $pageRecord['_thePathFull'];
     } else {
         $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
     }
     // Setting the path of the page
     $pagePath = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.path')) . ': <span class="typo3-docheader-pagePath">';
     // crop the title to title limit (or 50, if not defined)
     $cropLength = empty($GLOBALS['BE_USER']->uc['titleLen']) ? 50 : $GLOBALS['BE_USER']->uc['titleLen'];
     $croppedTitle = GeneralUtility::fixed_lgd_cs($title, -$cropLength);
     if ($croppedTitle !== $title) {
         $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
     } else {
         $pagePath .= htmlspecialchars($title);
     }
     $pagePath .= '</span>';
     return $pagePath;
 }
    /**
     * For TYPO3 Element Browser: Expand folder of files.
     *
     * @param Folder $folder The folder path to expand
     * @param array $extensionList List of fileextensions to show
     * @param bool $noThumbs Whether to show thumbnails or not. If set, no thumbnails are shown.
     * @return string HTML output
     */
    public function renderFilesInFolder(Folder $folder, array $extensionList = [], $noThumbs = false)
    {
        if (!$folder->checkActionPermission('read')) {
            return '';
        }
        $lang = $this->getLanguageService();
        $titleLen = (int) $this->getBackendUser()->uc['titleLen'];
        if ($this->searchWord !== '') {
            $files = $this->fileRepository->searchByName($folder, $this->searchWord);
        } else {
            $extensionList = !empty($extensionList) && $extensionList[0] === '*' ? [] : $extensionList;
            $files = $this->getFilesInFolder($folder, $extensionList);
        }
        $filesCount = count($files);
        $lines = array();
        // Create the header of current folder:
        $folderIcon = $this->iconFactory->getIconForResource($folder, Icon::SIZE_SMALL);
        $lines[] = '
			<tr>
				<th class="col-title" nowrap="nowrap">' . $folderIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($folder->getIdentifier(), $titleLen)) . '</th>
				<th class="col-control" nowrap="nowrap"></th>
				<th class="col-clipboard" nowrap="nowrap">
					<a href="#" class="btn btn-default" id="t3js-importSelection" title="' . $lang->getLL('importSelection', true) . '">' . $this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL) . '</a>
					<a href="#" class="btn btn-default" id="t3js-toggleSelection" title="' . $lang->getLL('toggleSelection', true) . '">' . $this->iconFactory->getIcon('actions-document-select', Icon::SIZE_SMALL) . '</a>
				</th>
				<th nowrap="nowrap">&nbsp;</th>
			</tr>';
        if ($filesCount === 0) {
            $lines[] = '
				<tr>
					<td colspan="4">No files found.</td>
				</tr>';
        }
        foreach ($files as $fileObject) {
            $fileExtension = $fileObject->getExtension();
            // Thumbnail/size generation:
            $imgInfo = array();
            if (!$noThumbs && GeneralUtility::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] . ',' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext']), strtolower($fileExtension))) {
                $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 64, 'height' => 64));
                $imageUrl = $processedFile->getPublicUrl(true);
                $imgInfo = array($fileObject->getProperty('width'), $fileObject->getProperty('height'));
                $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                $clickIcon = '<img src="' . $imageUrl . '"' . ' width="' . $processedFile->getProperty('width') . '"' . ' height="' . $processedFile->getProperty('height') . '"' . ' hspace="5" vspace="5" border="1" />';
            } else {
                $clickIcon = '';
                $pDim = '';
            }
            // Create file icon:
            $size = ' (' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
            $icon = '<span title="' . htmlspecialchars($fileObject->getName() . $size) . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL) . '</span>';
            // Create links for adding the file:
            $filesIndex = count($this->elements);
            $this->elements['file_' . $filesIndex] = array('type' => 'file', 'table' => 'sys_file', 'uid' => $fileObject->getUid(), 'fileName' => $fileObject->getName(), 'filePath' => $fileObject->getUid(), 'fileExt' => $fileExtension, 'fileIcon' => $icon);
            if ($this->fileIsSelectableInFileList($fileObject, $imgInfo)) {
                $ATag = '<a href="#" class="btn btn-default" title="' . htmlspecialchars($fileObject->getName()) . '" data-file-index="' . htmlspecialchars($filesIndex) . '" data-close="0">';
                $ATag_alt = '<a href="#" title="' . htmlspecialchars($fileObject->getName()) . '" data-file-index="' . htmlspecialchars($filesIndex) . '" data-close="1">';
                $ATag_e = '</a>';
                $bulkCheckBox = '<label class="btn btn-default btn-checkbox"><input type="checkbox" class="typo3-bulk-item" name="file_' . $filesIndex . '" value="0" /><span class="t3-icon fa"></span></label>';
            } else {
                $ATag = '';
                $ATag_alt = '';
                $ATag_e = '';
                $bulkCheckBox = '';
            }
            // Create link to showing details about the file in a window:
            $Ahref = BackendUtility::getModuleUrl('show_item', array('type' => 'file', 'table' => '_FILE', 'uid' => $fileObject->getCombinedIdentifier(), 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')));
            // Combine the stuff:
            $filenameAndIcon = $ATag_alt . $icon . htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getName(), $titleLen)) . $ATag_e;
            // Show element:
            $lines[] = '
					<tr class="file_list_normal">
						<td class="col-title" nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
						<td class="col-control">
							<div class="btn-group">' . $ATag . '<span title="' . $lang->getLL('addToList', true) . '">' . $this->iconFactory->getIcon('actions-edit-add', Icon::SIZE_SMALL)->render() . '</span>' . $ATag_e . '
							<a href="' . htmlspecialchars($Ahref) . '" class="btn btn-default" title="' . $lang->getLL('info', true) . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</a>
						</td>
						<td class="col-clipboard" valign="top">' . $bulkCheckBox . '</td>
						<td nowrap="nowrap">&nbsp;' . $pDim . '</td>
					</tr>';
            if ($pDim) {
                $lines[] = '
					<tr>
						<td class="filelistThumbnail" colspan="4">' . $ATag_alt . $clickIcon . $ATag_e . '</td>
					</tr>';
            }
        }
        $out = '<h3>' . $lang->getLL('files', true) . ' ' . $filesCount . ':</h3>';
        $out .= GeneralUtility::makeInstance(FolderUtilityRenderer::class, $this)->getFileSearchField($this->searchWord);
        $out .= '<div id="filelist">';
        $out .= $this->getBulkSelector($filesCount);
        // Wrap all the rows in table tags:
        $out .= '

	<!--
		Filelisting
	-->
			<table class="table table-striped table-hover" id="typo3-filelist">
				' . implode('', $lines) . '
			</table>';
        // Return accumulated content for filelisting:
        $out .= '</div>';
        return $out;
    }
    /**
     * This functions returns the HTML-code that creates the editor-layout of the module.
     *
     * @param 	[type]		$theConstants: ...
     * @param 	[type]		$category: ...
     * @return 	[type]		...
     * @todo Define visibility
     */
    public function ext_printFields($theConstants, $category)
    {
        reset($theConstants);
        $output = '<script type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'js/constantEditor.js"></script>
		';
        $subcat = '';
        if (is_array($this->categories[$category])) {
            $help = $this->helpConfig;
            if (!$this->doNotSortCategoriesBeforeMakingForm) {
                asort($this->categories[$category]);
            }
            foreach ($this->categories[$category] as $name => $type) {
                $params = $theConstants[$name];
                if (is_array($params)) {
                    if ($subcat != $params['subcat_name']) {
                        $subcat = $params['subcat_name'];
                        $subcat_name = $params['subcat_name'] ? $this->subCategories[$params['subcat_name']][0] : 'Others';
                        $output .= '<h3 class="typo3-tstemplate-ceditor-subcat">' . $subcat_name . '</h3>';
                    }
                    $label = $GLOBALS['LANG']->sL($params['label']);
                    $label_parts = explode(':', $label, 2);
                    if (count($label_parts) == 2) {
                        $head = trim($label_parts[0]);
                        $body = trim($label_parts[1]);
                    } else {
                        $head = trim($label_parts[0]);
                        $body = '';
                    }
                    if (strlen($head) > 35) {
                        if (!$body) {
                            $body = $head;
                        }
                        $head = GeneralUtility::fixed_lgd_cs($head, 35);
                    }
                    $typeDat = $this->ext_getTypeData($params['type']);
                    $checked = '';
                    $p_field = '';
                    $raname = substr(md5($params['name']), 0, 10);
                    $aname = '\'' . $raname . '\'';
                    list($fN, $fV, $params) = $this->ext_fNandV($params);
                    switch ($typeDat['type']) {
                        case 'int':
                        case 'int+':
                            $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(5) . ' onChange="uFormUrl(' . $aname . ')" />';
                            if ($typeDat['paramstr']) {
                                $p_field .= ' Range: ' . $typeDat['paramstr'];
                            } elseif ($typeDat['type'] == 'int+') {
                                $p_field .= ' Range: 0 - ';
                            } else {
                                $p_field .= ' (Integer)';
                            }
                            break;
                        case 'color':
                            $colorNames = explode(',', ',' . $this->HTMLcolorList);
                            $p_field = '';
                            foreach ($colorNames as $val) {
                                $sel = '';
                                if ($val == strtolower($params['value'])) {
                                    $sel = ' selected';
                                }
                                $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . '</option>';
                            }
                            $p_field = '<select id="select-' . $fN . '" rel="' . $fN . '" name="C' . $fN . '" class="typo3-tstemplate-ceditor-color-select" onChange="uFormUrl(' . $aname . ');">' . $p_field . '</select>';
                            $p_field .= '<input type="text" id="input-' . $fN . '" rel="' . $fN . '" name="' . $fN . '" class="typo3-tstemplate-ceditor-color-input" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(7) . ' onChange="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'wrap':
                            $wArr = explode('|', $fV);
                            $p_field = '<input type="text" id="' . $fN . '" name="' . $fN . '" value="' . $wArr[0] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(29) . ' onChange="uFormUrl(' . $aname . ')" />';
                            $p_field .= ' | ';
                            $p_field .= '<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(15) . ' onChange="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'offset':
                            $wArr = explode(',', $fV);
                            $labels = GeneralUtility::trimExplode(',', $typeDat['paramstr']);
                            $p_field = ($labels[0] ? $labels[0] : 'x') . ':<input type="text" name="' . $fN . '" value="' . $wArr[0] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
                            $p_field .= ' , ';
                            $p_field .= ($labels[1] ? $labels[1] : 'y') . ':<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
                            $labelsCount = count($labels);
                            for ($aa = 2; $aa < $labelsCount; $aa++) {
                                if ($labels[$aa]) {
                                    $p_field .= ' , ' . $labels[$aa] . ':<input type="text" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
                                } else {
                                    $p_field .= '<input type="hidden" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '" />';
                                }
                            }
                            break;
                        case 'options':
                            if (is_array($typeDat['params'])) {
                                $p_field = '';
                                foreach ($typeDat['params'] as $val) {
                                    $vParts = explode('=', $val, 2);
                                    $label = $vParts[0];
                                    $val = isset($vParts[1]) ? $vParts[1] : $vParts[0];
                                    // option tag:
                                    $sel = '';
                                    if ($val == $params['value']) {
                                        $sel = ' selected';
                                    }
                                    $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $GLOBALS['LANG']->sL($label) . '</option>';
                                }
                                $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
                            }
                            break;
                        case 'boolean':
                            $p_field = '<input type="hidden" name="' . $fN . '" value="0" />';
                            $sel = '';
                            if ($fV) {
                                $sel = ' checked';
                            }
                            $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value="' . ($typeDat['paramstr'] ? $typeDat['paramstr'] : 1) . '"' . $sel . ' onClick="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'comment':
                            $p_field = '<input type="hidden" name="' . $fN . '" value="#" />';
                            $sel = '';
                            if (!$fV) {
                                $sel = ' checked';
                            }
                            $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value=""' . $sel . ' onClick="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'file':
                            $p_field = '<option value=""></option>';
                            $theImage = '';
                            // extensionlist
                            $extList = $typeDat['paramstr'];
                            $p_field = '<option value="">(' . $extList . ')</option>';
                            if ($extList == 'IMAGE_EXT') {
                                $extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
                            }
                            if (trim($params['value'])) {
                                $val = $params['value'];
                                $p_field .= '<option value=""></option>';
                                $p_field .= '<option value="' . htmlspecialchars($val) . '" selected>' . $val . '</option>';
                            }
                            $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
                            $p_field .= $theImage;
                            break;
                        case 'user':
                            $userFunction = $typeDat['paramstr'];
                            $userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV);
                            $p_field = GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this, '');
                            break;
                        case 'small':
                        default:
                            $fwidth = $typeDat['type'] == 'small' ? 10 : 46;
                            $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth($fwidth) . ' onChange="uFormUrl(' . $aname . ')" />';
                    }
                    // Define default names and IDs
                    $userTyposcriptID = 'userTS-' . $params['name'];
                    $defaultTyposcriptID = 'defaultTS-' . $params['name'];
                    $checkboxName = 'check[' . $params['name'] . ']';
                    $checkboxID = $checkboxName;
                    // Handle type=color specially
                    if ($typeDat['type'] == 'color' && substr($params['value'], 0, 2) != '{$') {
                        $color = '<div id="colorbox-' . $fN . '" class="typo3-tstemplate-ceditor-colorblock" style="background-color:' . $params['value'] . ';">&nbsp;</div>';
                    } else {
                        $color = '';
                    }
                    if (!$this->ext_dontCheckIssetValues) {
                        // Set the default styling options
                        if (isset($this->objReg[$params['name']])) {
                            $checkboxValue = 'checked';
                            $userTyposcriptStyle = '';
                            $defaultTyposcriptStyle = 'style="display:none;"';
                        } else {
                            $checkboxValue = '';
                            $userTyposcriptStyle = 'style="display:none;"';
                            $defaultTyposcriptStyle = '';
                        }
                        $deleteIconHTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-undo', array('class' => 'typo3-tstemplate-ceditor-control undoIcon', 'alt' => 'Revert to default Constant', 'title' => 'Revert to default Constant', 'rel' => $params['name']));
                        $editIconHTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('class' => 'typo3-tstemplate-ceditor-control editIcon', 'alt' => 'Edit this Constant', 'title' => 'Edit this Constant', 'rel' => $params['name']));
                        $constantCheckbox = '<input type="hidden" name="' . $checkboxName . '" id="' . $checkboxID . '" value="' . $checkboxValue . '"/>';
                        // If there's no default value for the field, use a static label.
                        if (!$params['default_value']) {
                            $params['default_value'] = '[Empty]';
                        }
                        $constantDefaultRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $defaultTyposcriptID . '" ' . $defaultTyposcriptStyle . '>' . $editIconHTML . htmlspecialchars($params['default_value']) . $color . '</div>';
                    }
                    $constantEditRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $userTyposcriptID . '" ' . $userTyposcriptStyle . '>' . $deleteIconHTML . $p_field . $color . '</div>';
                    $constantLabel = '<dt class="typo3-tstemplate-ceditor-label">' . htmlspecialchars($head) . '</dt>';
                    $constantName = '<dt class="typo3-dimmed">[' . $params['name'] . ']</dt>';
                    $constantDescription = $body ? '<dd>' . htmlspecialchars($body) . '</dd>' : '';
                    $constantData = '<dd>' . $constantCheckbox . $constantEditRow . $constantDefaultRow . '</dd>';
                    $output .= '<a name="' . $raname . '"></a>' . $help['constants'][$params['name']];
                    $output .= '<dl class="typo3-tstemplate-ceditor-constant">' . $constantLabel . $constantName . $constantDescription . $constantData . '</dl>';
                } else {
                    debug('Error. Constant did not exist. Should not happen.');
                }
            }
        }
        return $output;
    }
Example #14
0
    /**
     * Generates the "edit panels" which can be shown for a page or records on a page when the Admin Panel is enabled for a backend users surfing the frontend.
     * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element
     * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"
     *
     * @param string $content A content string containing the content related to the edit panel. For cObject "EDITPANEL" this is empty but not so for the stdWrap property. The edit panel is appended to this string and returned.
     * @param array $conf TypoScript configuration properties for the editPanel
     * @param string $currentRecord The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW
     * @param array $dataArr Alternative data array to use. Default is $this->data
     * @param string $table
     * @param array $allow
     * @param int $newUID
     * @param array $hiddenFields
     * @return string The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned.
     */
    public function editPanel($content, array $conf, $currentRecord = '', array $dataArr = array(), $table = '', array $allow = array(), $newUID = 0, array $hiddenFields = array())
    {
        $hiddenFieldString = $command = '';
        // Special content is about to be shown, so the cache must be disabled.
        $this->frontendController->set_no_cache('Frontend edit panel is shown', TRUE);
        $formName = 'TSFE_EDIT_FORM_' . substr($this->frontendController->uniqueHash(), 0, 4);
        $formTag = '<form name="' . $formName . '" id ="' . $formName . '" action="' . htmlspecialchars(GeneralUtility::getIndpEnv('REQUEST_URI')) . '" method="post" enctype="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype']) . '" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
        $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
        $labelField = $GLOBALS['TCA'][$table]['ctrl']['label'];
        $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
        $panel = '';
        if (isset($allow['toolbar']) && $this->backendUser->adminPanel instanceof AdminPanelView) {
            $panel .= $this->backendUser->adminPanel->ext_makeToolBar();
        }
        if (isset($allow['edit'])) {
            $icon = IconUtility::getSpriteIcon('actions-document-open', array('title' => $this->backendUser->extGetLL('p_editRecord')));
            $panel .= $this->editPanelLinkWrap($icon, $formName, 'edit', $dataArr['_LOCALIZED_UID'] ? $table . ':' . $dataArr['_LOCALIZED_UID'] : $currentRecord);
        }
        // Hiding in workspaces because implementation is incomplete
        if (isset($allow['move']) && $sortField && $this->backendUser->workspace === 0) {
            $icon = IconUtility::getSpriteIcon('actions-move-up', array('title' => $this->backendUser->extGetLL('p_moveUp')));
            $panel .= $this->editPanelLinkWrap($icon, $formName, 'up');
            $icon = IconUtility::getSpriteIcon('actions-move-down', array('title' => $this->backendUser->extGetLL('p_moveDown')));
            $panel .= $this->editPanelLinkWrap($icon, $formName, 'down');
        }
        // Hiding in workspaces because implementation is incomplete
        // Hiding for localizations because it is unknown what should be the function in that case
        if (isset($allow['hide']) && $hideField && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
            if ($dataArr[$hideField]) {
                $icon = IconUtility::getSpriteIcon('actions-edit-unhide', array('title' => $this->backendUser->extGetLL('p_unhide')));
                $panel .= $this->editPanelLinkWrap($icon, $formName, 'unhide');
            } else {
                $icon = IconUtility::getSpriteIcon('actions-edit-hide', array('title' => $this->backendUser->extGetLL('p_hide')));
                $panel .= $this->editPanelLinkWrap($icon, $formName, 'hide', '', $this->backendUser->extGetLL('p_hideConfirm'));
            }
        }
        if (isset($allow['new'])) {
            if ($table === 'pages') {
                $icon = IconUtility::getSpriteIcon('actions-page-new', array('title' => $this->backendUser->extGetLL('p_newSubpage')));
                $panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, '');
            } else {
                $icon = IconUtility::getSpriteIcon('actions-document-new', array('title' => $this->backendUser->extGetLL('p_newRecordAfter')));
                $panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, '', $newUID);
            }
        }
        // Hiding in workspaces because implementation is incomplete
        // Hiding for localizations because it is unknown what should be the function in that case
        if (isset($allow['delete']) && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
            $icon = IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $this->backendUser->extGetLL('p_delete')));
            $panel .= $this->editPanelLinkWrap($icon, $formName, 'delete', '', $this->backendUser->extGetLL('p_deleteConfirm'));
        }
        // Final
        $labelTxt = $this->cObj->stdWrap($conf['label'], $conf['label.']);
        foreach ((array) $hiddenFields as $name => $value) {
            $hiddenFieldString .= '<input type="hidden" name="TSFE_EDIT[' . htmlspecialchars($name) . ']" value="' . htmlspecialchars($value) . '"/>' . LF;
        }
        $panel = '<!-- BE_USER Edit Panel: -->
								' . $formTag . $hiddenFieldString . '
									<input type="hidden" name="TSFE_EDIT[cmd]" value="" />
									<input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />
									<div class="typo3-editPanel">' . $panel . ($labelTxt ? '<div class="typo3-editPanel-label">' . sprintf($labelTxt, htmlspecialchars(GeneralUtility::fixed_lgd_cs($dataArr[$labelField], 50))) . '</div>' : '') . '
									</div>
								</form>';
        // Wrap the panel
        if ($conf['innerWrap']) {
            $panel = $this->cObj->wrap($panel, $conf['innerWrap']);
        }
        if ($conf['innerWrap.']) {
            $panel = $this->cObj->stdWrap($panel, $conf['innerWrap.']);
        }
        // Wrap the complete panel
        if ($conf['outerWrap']) {
            $panel = $this->cObj->wrap($panel, $conf['outerWrap']);
        }
        if ($conf['outerWrap.']) {
            $panel = $this->cObj->stdWrap($panel, $conf['outerWrap.']);
        }
        if ($conf['printBeforeContent']) {
            $finalOut = $panel . $content;
        } else {
            $finalOut = $content . $panel;
        }
        $hidden = $this->isDisabled($table, $dataArr) ? ' typo3-feedit-element-hidden' : '';
        $outerWrapConfig = isset($conf['stdWrap.']) ? $conf['stdWrap.'] : array('wrap' => '<div class="typo3-feedit-element' . $hidden . '">|</div>');
        $finalOut = $this->cObj->stdWrap($finalOut, $outerWrapConfig);
        return $finalOut;
    }
Example #15
0
 /**
  * Wrapping $title in a-tags.
  *
  * @param string $title Title
  * @param string $row   Item record
  * @param int    $bank  Pointer (which mount point number)
  *
  * @return string
  */
 public function wrapTitle($title, $row, $bank = 0)
 {
     if (!is_array($row) || !is_numeric($bank)) {
         if (TYPO3_DLOG) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('wrapTitle (CommerceTeam\\Commerce\\Tree\\Leaf\\View) gets passed invalid parameters.', COMMERCE_EXTKEY, 3);
         }
         return '';
     }
     // Max. size for Title of 255
     $title = '' != $title ? GeneralUtility::fixed_lgd_cs($title, 255) : $this->getLL('leaf.noTitle');
     $aOnClick = 'return jumpTo(\'' . $this->getJumpToParam($row) . '\',this,\'' . $this->domIdPrefix . $row['uid'] . '_' . $bank . '\',\'\');';
     if ($this->noRootOnclick && 0 == $row['uid'] || $this->noOnclick) {
         $res = htmlspecialchars(strip_tags($title));
     } else {
         $res = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . htmlspecialchars(strip_tags($title)) . '</a>';
     }
     return $res;
 }
Example #16
0
 /**
  * Get the list
  *
  * @param array $pArray
  * @param array $lines
  * @param int $c
  * @return array
  */
 public function renderList($pArray, $lines = [], $c = 0)
 {
     if (!is_array($pArray)) {
         return $lines;
     }
     $statusCheckedIcon = $this->moduleTemplate->getIconFactory()->getIcon('status-status-checked', Icon::SIZE_SMALL)->render();
     $i = 0;
     foreach ($pArray as $k => $v) {
         if (MathUtility::canBeInterpretedAsInteger($k)) {
             $line = [];
             $key = $k . '_';
             $line['marginLeft'] = $c * 20;
             $line['class'] = $i++ % 2 === 0 ? 'bgColor4' : 'bgColor6';
             $line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pArray[$k], 30);
             $line['icon'] = $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render();
             if (!empty($pArray[$key])) {
                 $line['href'] = GeneralUtility::linkThisScript(['id' => (int) $k]);
                 $line['title'] = 'ID: ' . (int) $k;
                 $line['count'] = $pArray[$k . '_']['count'];
                 $line['root_max_val'] = $pArray[$key]['root_max_val'] > 0 ? $statusCheckedIcon : '&nbsp;';
                 $line['root_min_val'] = $pArray[$key]['root_min_val'] === 0 ? $statusCheckedIcon : '&nbsp;';
             } else {
                 $line['href'] = '';
                 $line['title'] = '';
                 $line['count'] = '';
                 $line['root_max_val'] = '';
                 $line['root_min_val'] = '';
             }
             $lines[] = $line;
             $lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1);
         }
     }
     return $lines;
 }
 /**
  * Processing of larger amounts of text (usually from RTE/bodytext fields) with word wrapping etc.
  *
  * @param string $input Input string
  * @return string Output string
  */
 public function renderText($input)
 {
     $input = strip_tags($input);
     $input = GeneralUtility::fixed_lgd_cs($input, 1500);
     return nl2br(htmlspecialchars(trim($input), ENT_QUOTES, 'UTF-8', false));
 }
Example #18
0
 /**
  * Returns a human readable output of a value from a record
  * For instance a database record relation would be looked up to display the title-value of that record. A checkbox with a "1" value would be "Yes", etc.
  * $table/$col is tablename and fieldname
  * REMEMBER to pass the output through htmlspecialchars() if you output it to the browser! (To protect it from XSS attacks and be XHTML compliant)
  *
  * @param string $table Table name, present in TCA
  * @param string $col Field name, present in TCA
  * @param string $value The value of that field from a selected record
  * @param integer $fixed_lgd_chars The max amount of characters the value may occupy
  * @param boolean $defaultPassthrough Flag means that values for columns that has no conversion will just be pass through directly (otherwise cropped to 200 chars or returned as "N/A")
  * @param boolean $noRecordLookup If set, no records will be looked up, UIDs are just shown.
  * @param integer $uid Uid of the current record
  * @param boolean $forceResult If BackendUtility::getRecordTitle is used to process the value, this parameter is forwarded.
  * @return string
  */
 public static function getProcessedValue($table, $col, $value, $fixed_lgd_chars = 0, $defaultPassthrough = 0, $noRecordLookup = FALSE, $uid = 0, $forceResult = TRUE)
 {
     if ($col == 'uid') {
         // No need to load TCA as uid is not in TCA-array
         return $value;
     }
     // Check if table and field is configured:
     if (is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'][$col])) {
         // Depending on the fields configuration, make a meaningful output value.
         $theColConf = $GLOBALS['TCA'][$table]['columns'][$col]['config'];
         /*****************
          *HOOK: pre-processing the human readable output from a record
          ****************/
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'])) {
             // Create NULL-reference
             $null = NULL;
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'] as $_funcRef) {
                 GeneralUtility::callUserFunction($_funcRef, $theColConf, $null);
             }
         }
         $l = '';
         switch ((string) $theColConf['type']) {
             case 'radio':
                 $l = self::getLabelFromItemlist($table, $col, $value);
                 $l = $GLOBALS['LANG']->sL($l);
                 break;
             case 'inline':
             case 'select':
                 if ($theColConf['MM']) {
                     if ($uid) {
                         // Display the title of MM related records in lists
                         if ($noRecordLookup) {
                             $MMfield = $theColConf['foreign_table'] . '.uid';
                         } else {
                             $MMfields = array($theColConf['foreign_table'] . '.' . $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label']);
                             foreach (GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label_alt'], TRUE) as $f) {
                                 $MMfields[] = $theColConf['foreign_table'] . '.' . $f;
                             }
                             $MMfield = join(',', $MMfields);
                         }
                         /** @var $dbGroup \TYPO3\CMS\Core\Database\RelationHandler */
                         $dbGroup = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
                         $dbGroup->start($value, $theColConf['foreign_table'], $theColConf['MM'], $uid, $table, $theColConf);
                         $selectUids = $dbGroup->tableArray[$theColConf['foreign_table']];
                         if (is_array($selectUids) && count($selectUids) > 0) {
                             $MMres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, ' . $MMfield, $theColConf['foreign_table'], 'uid IN (' . implode(',', $selectUids) . ')' . self::deleteClause($theColConf['foreign_table']));
                             $mmlA = array();
                             while ($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) {
                                 // Keep sorting of $selectUids
                                 $mmlA[array_search($MMrow['uid'], $selectUids)] = $noRecordLookup ? $MMrow['uid'] : self::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult);
                             }
                             $GLOBALS['TYPO3_DB']->sql_free_result($MMres);
                             if (!empty($mmlA)) {
                                 ksort($mmlA);
                                 $l = implode('; ', $mmlA);
                             } else {
                                 $l = 'N/A';
                             }
                         } else {
                             $l = 'N/A';
                         }
                     } else {
                         $l = 'N/A';
                     }
                 } else {
                     $l = self::getLabelsFromItemsList($table, $col, $value);
                     if ($theColConf['foreign_table'] && !$l && $GLOBALS['TCA'][$theColConf['foreign_table']]) {
                         if ($noRecordLookup) {
                             $l = $value;
                         } else {
                             $rParts = array();
                             if ($uid && isset($theColConf['foreign_field']) && $theColConf['foreign_field'] !== '') {
                                 $records = self::getRecordsByField($theColConf['foreign_table'], $theColConf['foreign_field'], $uid);
                                 if (!empty($records)) {
                                     foreach ($records as $record) {
                                         $rParts[] = $record['uid'];
                                     }
                                 }
                             }
                             if (empty($rParts)) {
                                 $rParts = GeneralUtility::trimExplode(',', $value, TRUE);
                             }
                             $lA = array();
                             foreach ($rParts as $rVal) {
                                 $rVal = (int) $rVal;
                                 if ($rVal > 0) {
                                     $r = self::getRecordWSOL($theColConf['foreign_table'], $rVal);
                                 } else {
                                     $r = self::getRecordWSOL($theColConf['neg_foreign_table'], -$rVal);
                                 }
                                 if (is_array($r)) {
                                     $lA[] = $GLOBALS['LANG']->sL($rVal > 0 ? $theColConf['foreign_table_prefix'] : $theColConf['neg_foreign_table_prefix']) . self::getRecordTitle($rVal > 0 ? $theColConf['foreign_table'] : $theColConf['neg_foreign_table'], $r, FALSE, $forceResult);
                                 } else {
                                     $lA[] = $rVal ? '[' . $rVal . '!]' : '';
                                 }
                             }
                             $l = implode(', ', $lA);
                         }
                     }
                     if (empty($l) && !empty($value)) {
                         // Use plain database value when label is empty
                         $l = $value;
                     }
                 }
                 break;
             case 'group':
                 // resolve the titles for DB records
                 if ($theColConf['internal_type'] === 'db') {
                     $finalValues = array();
                     $relationTableName = $theColConf['allowed'];
                     $explodedValues = GeneralUtility::trimExplode(',', $value, TRUE);
                     foreach ($explodedValues as $explodedValue) {
                         if (MathUtility::canBeInterpretedAsInteger($explodedValue)) {
                             $relationTableNameForField = $relationTableName;
                         } else {
                             list($relationTableNameForField, $explodedValue) = self::splitTable_Uid($explodedValue);
                         }
                         $relationRecord = static::getRecordWSOL($relationTableNameForField, $explodedValue);
                         $finalValues[] = static::getRecordTitle($relationTableNameForField, $relationRecord);
                     }
                     $l = implode(', ', $finalValues);
                 } else {
                     $l = implode(', ', GeneralUtility::trimExplode(',', $value, TRUE));
                 }
                 break;
             case 'check':
                 if (!is_array($theColConf['items']) || count($theColConf['items']) == 1) {
                     $l = $value ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:yes') : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:no');
                 } else {
                     $lA = array();
                     foreach ($theColConf['items'] as $key => $val) {
                         if ($value & pow(2, $key)) {
                             $lA[] = $GLOBALS['LANG']->sL($val[0]);
                         }
                     }
                     $l = implode(', ', $lA);
                 }
                 break;
             case 'input':
                 // Hide value 0 for dates, but show it for everything else
                 if (isset($value)) {
                     if (GeneralUtility::inList($theColConf['eval'], 'date')) {
                         // Handle native date field
                         if (isset($theColConf['dbType']) && $theColConf['dbType'] === 'date') {
                             $dateTimeFormats = $GLOBALS['TYPO3_DB']->getDateTimeFormats($table);
                             $emptyValue = $dateTimeFormats['date']['empty'];
                             $value = $value !== $emptyValue ? strtotime($value) : 0;
                         }
                         if (!empty($value)) {
                             $l = self::date($value) . ' (' . ($GLOBALS['EXEC_TIME'] - $value > 0 ? '-' : '') . self::calcAge(abs($GLOBALS['EXEC_TIME'] - $value), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')) . ')';
                         }
                     } elseif (GeneralUtility::inList($theColConf['eval'], 'time')) {
                         if (!empty($value)) {
                             $l = self::time($value, FALSE);
                         }
                     } elseif (GeneralUtility::inList($theColConf['eval'], 'timesec')) {
                         if (!empty($value)) {
                             $l = self::time($value);
                         }
                     } elseif (GeneralUtility::inList($theColConf['eval'], 'datetime')) {
                         // Handle native date/time field
                         if (isset($theColConf['dbType']) && $theColConf['dbType'] === 'datetime') {
                             $dateTimeFormats = $GLOBALS['TYPO3_DB']->getDateTimeFormats($table);
                             $emptyValue = $dateTimeFormats['datetime']['empty'];
                             $value = $value !== $emptyValue ? strtotime($value) : 0;
                         }
                         if (!empty($value)) {
                             $l = self::datetime($value);
                         }
                     } else {
                         $l = $value;
                     }
                 }
                 break;
             case 'flex':
                 $l = strip_tags($value);
                 break;
             default:
                 if ($defaultPassthrough) {
                     $l = $value;
                 } elseif ($theColConf['MM']) {
                     $l = 'N/A';
                 } elseif ($value) {
                     $l = GeneralUtility::fixed_lgd_cs(strip_tags($value), 200);
                 }
         }
         // If this field is a password field, then hide the password by changing it to a random number of asterisk (*)
         if (stristr($theColConf['eval'], 'password')) {
             $l = '';
             $randomNumber = rand(5, 12);
             for ($i = 0; $i < $randomNumber; $i++) {
                 $l .= '*';
             }
         }
         /*****************
          *HOOK: post-processing the human readable output from a record
          ****************/
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['postProcessValue'])) {
             // Create NULL-reference
             $null = NULL;
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['postProcessValue'] as $_funcRef) {
                 $params = array('value' => $l, 'colConf' => $theColConf);
                 $l = GeneralUtility::callUserFunction($_funcRef, $params, $null);
             }
         }
         if ($fixed_lgd_chars) {
             return GeneralUtility::fixed_lgd_cs($l, $fixed_lgd_chars);
         } else {
             return $l;
         }
     }
 }
Example #19
0
 /**
  * Prepare items from itemArray to be transferred to the TCEforms interface (as a comma list)
  *
  * @return string
  */
 public function readyForInterface()
 {
     if (!is_array($this->itemArray)) {
         return false;
     }
     $output = array();
     $titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen'];
     foreach ($this->itemArray as $val) {
         $theRow = $this->results[$val['table']][$val['id']];
         if ($theRow && is_array($GLOBALS['TCA'][$val['table']])) {
             $label = GeneralUtility::fixed_lgd_cs(strip_tags(BackendUtility::getRecordTitle($val['table'], $theRow)), $titleLen);
             $label = $label ? $label : '[...]';
             $output[] = str_replace(',', '', $val['table'] . '_' . $val['id'] . '|' . rawurlencode($label));
         }
     }
     return implode(',', $output);
 }
 /**
  * Updates the given field with a new text value, may be used to inline update
  * the title field in the new page tree
  *
  * @param stdClass $nodeData
  * @param string $updatedLabel
  * @return array
  */
 public function updateLabel($nodeData, $updatedLabel)
 {
     if ($updatedLabel === '') {
         return array();
     }
     /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */
     $node = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class, (array) $nodeData);
     try {
         Commands::updateNodeLabel($node, $updatedLabel);
         $shortendedText = GeneralUtility::fixed_lgd_cs($updatedLabel, (int) $GLOBALS['BE_USER']->uc['titleLen']);
         $returnValue = array('editableText' => $updatedLabel, 'updatedText' => htmlspecialchars($shortendedText));
     } catch (\Exception $exception) {
         $returnValue = array('success' => false, 'message' => $exception->getMessage());
     }
     return $returnValue;
 }
Example #21
0
 /**
  * Creates a node with the given record information
  *
  * @param array $record
  * @param int $mountPoint
  * @return \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode
  */
 public static function getNewNode($record, $mountPoint = 0)
 {
     if (self::$titleLength === NULL) {
         self::$useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
         self::$addIdAsPrefix = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
         self::$addDomainName = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showDomainNameWithTitle');
         self::$backgroundColors = $GLOBALS['BE_USER']->getTSConfigProp('options.pageTree.backgroundColor');
         self::$titleLength = (int) $GLOBALS['BE_USER']->uc['titleLen'];
     }
     /** @var $subNode \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */
     $subNode = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class);
     $subNode->setRecord($record);
     $subNode->setCls($record['_CSSCLASS']);
     $subNode->setType('pages');
     $subNode->setId($record['uid']);
     $subNode->setMountPoint($mountPoint);
     $subNode->setWorkspaceId($record['_ORIG_uid'] ?: $record['uid']);
     $subNode->setBackgroundColor(self::$backgroundColors[$record['uid']]);
     $field = 'title';
     $text = $record['title'];
     if (self::$useNavTitle && trim($record['nav_title']) !== '') {
         $field = 'nav_title';
         $text = $record['nav_title'];
     }
     if (trim($text) === '') {
         $visibleText = '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', TRUE) . ']';
     } else {
         $visibleText = $text;
     }
     $visibleText = GeneralUtility::fixed_lgd_cs($visibleText, self::$titleLength);
     $suffix = '';
     if (self::$addDomainName) {
         $domain = self::getDomainName($record['uid']);
         $suffix = $domain !== '' ? ' [' . $domain . ']' : '';
     }
     $qtip = str_replace(' - ', '<br />', htmlspecialchars(BackendUtility::titleAttribForPages($record, '', FALSE)));
     $prefix = '';
     $lockInfo = BackendUtility::isRecordLocked('pages', $record['uid']);
     if (is_array($lockInfo)) {
         $qtip .= '<br />' . htmlspecialchars($lockInfo['msg']);
         $prefix .= IconUtility::getSpriteIcon('status-warning-in-use', array('class' => 'typo3-pagetree-status'));
     }
     // Call stats information hook
     $stat = '';
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
         $_params = array('pages', $record['uid']);
         $fakeThis = NULL;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
             $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $fakeThis);
         }
     }
     $prefix .= htmlspecialchars(self::$addIdAsPrefix ? '[' . $record['uid'] . '] ' : '');
     $subNode->setEditableText($text);
     $subNode->setText(htmlspecialchars($visibleText), $field, $prefix, htmlspecialchars($suffix) . $stat);
     $subNode->setQTip($qtip);
     if ((int) $record['uid'] !== 0) {
         $spriteIconCode = IconUtility::getSpriteIconForRecord('pages', $record);
     } else {
         $spriteIconCode = IconUtility::getSpriteIcon('apps-pagetree-root');
     }
     $subNode->setSpriteIconCode($spriteIconCode);
     if (!$subNode->canCreateNewPages() || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
         $subNode->setIsDropTarget(FALSE);
     }
     if (!$subNode->canBeEdited() || !$subNode->canBeRemoved() || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
         $subNode->setDraggable(FALSE);
     }
     return $subNode;
 }
Example #22
0
 /**
  * Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage"
  * Each part of the path will be limited to $titleLimit characters
  * Deleted pages are filtered out.
  *
  * @param int $uid Page uid for which to create record path
  * @param string $clause is additional where clauses, eg.
  * @param int $titleLimit Title limit
  * @param int $fullTitleLimit Title limit of Full title (typ. set to 1000 or so)
  * @return mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set.
  */
 public static function getRecordPath($uid, $clause = '', $titleLimit = 1000, $fullTitleLimit = 0)
 {
     $uid = (int) $uid;
     $output = $fullOutput = '/';
     if ($uid === 0) {
         return $output;
     }
     $databaseConnection = static::getDatabaseConnection();
     $clause = trim($clause) !== '' ? ' AND ' . $clause : '';
     $loopCheck = 100;
     while ($loopCheck > 0) {
         $loopCheck--;
         $res = $databaseConnection->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', 'uid=' . $uid . $clause);
         if ($res !== FALSE) {
             $row = $databaseConnection->sql_fetch_assoc($res);
             $databaseConnection->sql_free_result($res);
             BackendUtility::workspaceOL('pages', $row);
             if (is_array($row)) {
                 BackendUtility::fixVersioningPid('pages', $row);
                 $uid = (int) $row['pid'];
                 $output = '/' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], $titleLimit)) . $output;
                 if ($row['deleted']) {
                     $output = '<span class="text-danger">' . $output . '</span>';
                 }
                 if ($fullTitleLimit) {
                     $fullOutput = '/' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], $fullTitleLimit)) . $fullOutput;
                 }
             } else {
                 break;
             }
         } else {
             break;
         }
     }
     if ($fullTitleLimit) {
         return array($output, $fullOutput);
     } else {
         return $output;
     }
 }
Example #23
0
 /**
  * Returns the title for the input record. If blank, a "no title" label (localized) will be returned.
  * Do NOT htmlspecialchar the string from this function - has already been done.
  *
  * @param array $row The input row array (where the key "title" is used for the title)
  * @param int $titleLen Title length (30)
  * @return string The title.
  */
 public function getTitleStr($row, $titleLen = 30)
 {
     if ($this->ext_showNavTitle && trim($row['nav_title']) !== '') {
         $title = '<span title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:title', TRUE) . ' ' . htmlspecialchars(trim($row['title'])) . '">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['nav_title'], $titleLen)) . '</span>';
     } else {
         $title = htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], $titleLen));
         if (trim($row['nav_title']) !== '') {
             $title = '<span title="' . $GLOBALS['LANG']->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.nav_title', TRUE) . ' ' . htmlspecialchars(trim($row['nav_title'])) . '">' . $title . '</span>';
         }
         $title = trim($row['title']) === '' ? '<em>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', TRUE) . ']</em>' : $title;
     }
     return $title;
 }
Example #24
0
 /**
  * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address.
  *
  * @param string $href HREF value tp analyse
  * @param string $siteUrl The URL of the current website (frontend)
  * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info
  * @todo Define visibility
  */
 public function parseCurUrl($href, $siteUrl)
 {
     $href = trim($href);
     if ($href) {
         $info = array();
         // Default is "url":
         $info['value'] = $href;
         $info['act'] = 'url';
         $specialParts = explode('#_SPECIAL', $href);
         // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
         if (count($specialParts) == 2) {
             $info['value'] = '#_SPECIAL' . $specialParts[1];
             $info['act'] = 'spec';
         } elseif (strpos($href, 'file:') !== FALSE) {
             $rel = substr($href, strpos($href, 'file:') + 5);
             $rel = rawurldecode($rel);
             // resolve FAL-api "file:UID-of-sys_file-record" and "file:combined-identifier"
             $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($rel);
             if ($fileOrFolderObject instanceof Folder) {
                 $info['act'] = 'folder';
                 $info['value'] = $fileOrFolderObject->getCombinedIdentifier();
             } elseif ($fileOrFolderObject instanceof File) {
                 $info['act'] = 'file';
                 $info['value'] = $fileOrFolderObject->getUid();
             } else {
                 $info['value'] = $rel;
             }
         } elseif (GeneralUtility::isFirstPartOfStr($href, $siteUrl)) {
             // If URL is on the current frontend website:
             // URL is a file, which exists:
             if (file_exists(PATH_site . rawurldecode($href))) {
                 $info['value'] = rawurldecode($href);
                 if (@is_dir(PATH_site . $info['value'])) {
                     $info['act'] = 'folder';
                 } else {
                     $info['act'] = 'file';
                 }
             } else {
                 // URL is a page (id parameter)
                 $uP = parse_url($href);
                 $pp = preg_split('/^id=/', $uP['query']);
                 $pp[1] = preg_replace('/&id=[^&]*/', '', $pp[1]);
                 $parameters = explode('&', $pp[1]);
                 $id = array_shift($parameters);
                 if ($id) {
                     // Checking if the id-parameter is an alias.
                     if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
                         list($idPartR) = BackendUtility::getRecordsByField('pages', 'alias', $id);
                         $id = (int) $idPartR['uid'];
                     }
                     $pageRow = BackendUtility::getRecordWSOL('pages', $id);
                     $titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen'];
                     $info['value'] = $GLOBALS['LANG']->getLL('page', TRUE) . ' \'' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($pageRow['title'], $titleLen)) . '\' (ID:' . $id . ($uP['fragment'] ? ', #' . $uP['fragment'] : '') . ')';
                     $info['pageid'] = $id;
                     $info['cElement'] = $uP['fragment'];
                     $info['act'] = 'page';
                     $info['query'] = $parameters[0] ? '&' . implode('&', $parameters) : '';
                 }
             }
         } else {
             // Email link:
             if (strtolower(substr($href, 0, 7)) == 'mailto:') {
                 $info['value'] = trim(substr($href, 7));
                 $info['act'] = 'mail';
             }
         }
         $info['info'] = $info['value'];
     } else {
         // NO value inputted:
         $info = array();
         $info['info'] = $GLOBALS['LANG']->getLL('none');
         $info['value'] = '';
         $info['act'] = 'page';
     }
     // let the hook have a look
     foreach ($this->hookObjects as $hookObject) {
         $info = $hookObject->parseCurrentUrl($href, $siteUrl, $info);
     }
     return $info;
 }
Example #25
0
 /**
  * This returns tablerows for the files in the array $items['sorting'].
  *
  * @param File[] $files File items
  * @return string HTML table rows.
  */
 public function formatFileList(array $files)
 {
     $out = '';
     // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
     $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
     $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) {
         if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) {
             return FALSE;
         } else {
             return TRUE;
         }
     });
     foreach ($files as $fileObject) {
         // Initialization
         $this->counter++;
         $this->totalbytes += $fileObject->getSize();
         $ext = $fileObject->getExtension();
         $fileName = trim($fileObject->getName());
         // The icon with link
         $theIcon = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileName . ' [' . (int) $fileObject->getUid() . ']'));
         if ($this->clickMenus) {
             $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
         }
         // Preparing and getting the data-array
         $theData = array();
         foreach ($this->fieldArray as $field) {
             switch ($field) {
                 case 'size':
                     $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', TRUE));
                     break;
                 case 'rw':
                     $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', TRUE) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', TRUE) . '</strong>');
                     break;
                 case 'fileext':
                     $theData[$field] = strtoupper($ext);
                     break;
                 case 'tstamp':
                     $theData[$field] = BackendUtility::date($fileObject->getModificationTime());
                     break;
                 case '_CONTROL_':
                     $theData[$field] = $this->makeEdit($fileObject);
                     break;
                 case '_CLIPBOARD_':
                     $theData[$field] = $this->makeClip($fileObject);
                     break;
                 case '_LOCALIZATION_':
                     if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
                         $metaDataRecord = $fileObject->_getMetaData();
                         $translations = $this->getTranslationsForMetaData($metaDataRecord);
                         $languageCode = '';
                         foreach ($systemLanguages as $language) {
                             $languageId = $language['uid'];
                             $flagIcon = $language['flagIcon'];
                             if (array_key_exists($languageId, $translations)) {
                                 $flagButtonIcon = IconUtility::getSpriteIcon('actions-document-open', array('title' => sprintf($GLOBALS['LANG']->getLL('editMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array()));
                                 $data = array('sys_file_metadata' => array($translations[$languageId]['uid'] => 'edit'));
                                 $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
                                 $languageCode .= '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '">' . $flagButtonIcon . '</a>';
                             } else {
                                 $parameters = ['justLocalized' => 'sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId, 'returnUrl' => $this->listURL()];
                                 $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters, $this->backPath) . BackendUtility::getUrlToken('editRecord');
                                 $href = $GLOBALS['SOBE']->doc->issueCommand('&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId, $returnUrl);
                                 $flagButtonIcon = IconUtility::getSpriteIcon($flagIcon, array('title' => sprintf($GLOBALS['LANG']->getLL('createMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array()));
                                 $languageCode .= '<a href="' . htmlspecialchars($href) . '" class="btn btn-default">' . $flagButtonIcon . '</a> ';
                             }
                         }
                         // Hide flag button bar when not translated yet
                         $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' . (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
                         $theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' . IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay', array('title' => $GLOBALS['LANG']->getLL('translateMetadata'))) . '</a>';
                     }
                     break;
                 case '_REF_':
                     $theData[$field] = $this->makeRef($fileObject);
                     break;
                 case 'file':
                     // Edit metadata of file
                     $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
                     if ($fileObject->isMissing()) {
                         $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
                         $theData[$field] .= $flashMessage->render();
                         // Thumbnails?
                     } elseif ($this->thumbs && $this->isImage($ext)) {
                         $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                         if ($processedFile) {
                             $thumbUrl = $processedFile->getPublicUrl(TRUE);
                             $theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileName) . '" alt="" />';
                         }
                     }
                     break;
                 default:
                     $theData[$field] = '';
                     if ($fileObject->hasProperty($field)) {
                         $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL));
                     }
             }
         }
         $out .= $this->addelement(1, $theIcon, $theData);
     }
     return $out;
 }
Example #26
0
 /**
  * Crops a title string to a limited length and if it really was cropped,
  * wrap it in a <span title="...">|</span>,
  * which offers a tooltip with the original title when moving mouse over it.
  *
  * @param string $title The title string to be cropped
  * @param integer $titleLength Crop title after this length - if not set, BE_USER->uc['titleLen'] is used
  * @return string The processed title string, wrapped in <span title="...">|</span> if cropped
  */
 public function getRecordTitlePrep($title, $titleLength = 0)
 {
     // If $titleLength is not a valid positive integer, use BE_USER->uc['titleLen']:
     if (!$titleLength || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($titleLength) || $titleLength < 0) {
         $titleLength = $GLOBALS['BE_USER']->uc['titleLen'];
     }
     return htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, $titleLength));
 }
    /**
     * Main function creating the content for the module.
     *
     * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
     */
    public function main()
    {
        $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
        $this->getLanguageService()->includeLLFile('EXT:wizard_crpages/Resources/Private/Language/locallang.xlf');
        $theCode = '';
        $this->tsConfig = BackendUtility::getPagesTSconfig($this->pObj->id);
        $this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array();
        // Create new pages here?
        $pageRecord = BackendUtility::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $this->getBackendUser()->getPagePermsClause(8));
        $pageRepository = GeneralUtility::makeInstance(PageRepository::class);
        $menuItems = $pageRepository->getMenu($this->pObj->id, '*', 'sorting', '', false);
        if (is_array($pageRecord)) {
            $data = GeneralUtility::_GP('data');
            if (is_array($data['pages'])) {
                if (GeneralUtility::_GP('createInListEnd')) {
                    $endI = end($menuItems);
                    $thePid = -(int) $endI['uid'];
                    if (!$thePid) {
                        $thePid = $this->pObj->id;
                    }
                } else {
                    $thePid = $this->pObj->id;
                }
                $firstRecord = true;
                $previousIdentifier = '';
                foreach ($data['pages'] as $identifier => $dat) {
                    if (!trim($dat['title'])) {
                        unset($data['pages'][$identifier]);
                    } else {
                        $data['pages'][$identifier]['hidden'] = GeneralUtility::_GP('hidePages') ? 1 : 0;
                        $data['pages'][$identifier]['nav_hide'] = GeneralUtility::_GP('hidePagesInMenus') ? 1 : 0;
                        if ($firstRecord) {
                            $firstRecord = false;
                            $data['pages'][$identifier]['pid'] = $thePid;
                        } else {
                            $data['pages'][$identifier]['pid'] = '-' . $previousIdentifier;
                        }
                        $previousIdentifier = $identifier;
                    }
                }
                if (!empty($data['pages'])) {
                    reset($data);
                    $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
                    $dataHandler->stripslashes_values = 0;
                    // set default TCA values specific for the user
                    $TCAdefaultOverride = $this->getBackendUser()->getTSConfigProp('TCAdefaults');
                    if (is_array($TCAdefaultOverride)) {
                        $dataHandler->setDefaultsFromUserTS($TCAdefaultOverride);
                    }
                    $dataHandler->start($data, array());
                    $dataHandler->process_datamap();
                    BackendUtility::setUpdateSignal('updatePageTree');
                    $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_create'));
                } else {
                    $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_noCreate'), FlashMessage::ERROR);
                }
                $theCode .= $flashMessage->render();
                // Display result:
                $menuItems = $pageRepository->getMenu($this->pObj->id, '*', 'sorting', '', false);
                $lines = array();
                foreach ($menuItems as $record) {
                    BackendUtility::workspaceOL('pages', $record);
                    if (is_array($record)) {
                        $lines[] = '<span class="text-nowrap" title="' . BackendUtility::titleAttribForPages($record, '', false) . '">' . $this->iconFactory->getIconForRecord('pages', $record, Icon::SIZE_SMALL)->render() . htmlspecialchars(GeneralUtility::fixed_lgd_cs($record['title'], $this->getBackendUser()->uc['titleLen'])) . '</span>';
                    }
                }
                $theCode .= '<h4>' . $this->getLanguageService()->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
            } else {
                // Display create form
                $this->typeSelectHtml = $this->getTypeSelectHtml();
                $tableData = array();
                for ($a = 0; $a < 5; $a++) {
                    $tableData[] = $this->getFormLine($a);
                }
                $theCode .= '
					<h4>' . $this->getLanguageService()->getLL('wiz_newPages') . ':</h4>
					<div class="form-group t3js-wizardcrpages-container">
						' . implode(LF, $tableData) . '
					</div>
					<div class="form-group">
						<input class="btn btn-default t3js-wizardcrpages-createnewfields" type="button" value="' . $this->getLanguageService()->getLL('wiz_newPages_addMoreLines') . '" />
					</div>
					<div class="form-group">
						<div class="checkbox">
							<label for="createInListEnd">
								<input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" />
								' . $this->getLanguageService()->getLL('wiz_newPages_listEnd') . '
							</label>
						</div>
						<div class="checkbox">
							<label for="hidePages">
								<input type="checkbox" name="hidePages" id="hidePages" value="1" />
								' . $this->getLanguageService()->getLL('wiz_newPages_hidePages') . '
							</label>
						</div>
						<div class="checkbox">
							<label for="hidePagesInMenus">
								<input type="checkbox" name="hidePagesInMenus" id="hidePagesInMenus" value="1" />
								' . $this->getLanguageService()->getLL('wiz_newPages_hidePagesInMenus') . '
							</label>
						</div>
					</div>
					<div class="form-group">
						<input class="btn btn-default" type="submit" name="create" value="' . $this->getLanguageService()->getLL('wiz_newPages_lCreate') . '" />
						<input class="btn btn-default" type="reset" value="' . $this->getLanguageService()->getLL('wiz_newPages_lReset') . '" />
					</div>';
                $this->getPageRenderer()->loadJquery();
                $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/WizardCrpages/WizardCreatePages');
                // Add inline code
                $inlineJavaScriptCode = 'var tpl = "' . addslashes(str_replace(array(LF, TAB), array('', ''), $this->getFormLine('#'))) . '", i, line, div, bg, label;';
                $this->getPageRenderer()->addJsInlineCode('wizard_crpages', $inlineJavaScriptCode);
            }
        } else {
            $theCode .= GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_errorMsg1'), FlashMessage::ERROR)->render();
        }
        // CSH
        $theCode .= BackendUtility::cshItem('_MOD_web_func', 'tx_wizardcrpages', null, '<div class="t3-help">|</div>');
        $out = $this->pObj->doc->header($this->getLanguageService()->getLL('wiz_crMany'));
        $out .= $this->pObj->doc->section('', $theCode, false, true);
        return $out;
    }
Example #28
0
 /**
  * Wraps the input content string in green colored span-tags IF the length o fthe input string exceeds $this->printConf['contentLength'] (or $this->printConf['contentLength_FILE'] if $v == "FILE"
  *
  * @param string $c The content string
  * @param string $v Command: If "FILE" then $this->printConf['contentLength_FILE'] is used for content length comparison, otherwise $this->printConf['contentLength']
  * @return string
  */
 protected function fixCLen($c, $v)
 {
     $len = $v == 'FILE' ? $this->printConf['contentLength_FILE'] : $this->printConf['contentLength'];
     if (strlen($c) > $len) {
         $c = '<span style="color:green;">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($c, $len)) . '</span>';
     } else {
         $c = htmlspecialchars($c);
     }
     return $c;
 }
Example #29
0
 /**
  * Add entries for a single record
  *
  * @param string $table Table name
  * @param int $uid Record uid
  * @param array $lines Output lines array (is passed by reference and modified)
  * @param string $preCode Pre-HTML code
  * @param bool $checkImportInPidRecord If you want import validation, you can set this so it checks if the import can take place on the specified page.
  * @return void
  */
 public function singleRecordLines($table, $uid, &$lines, $preCode, $checkImportInPidRecord = false)
 {
     // Get record:
     $record = $this->dat['header']['records'][$table][$uid];
     unset($this->remainHeader['records'][$table][$uid]);
     if (!is_array($record) && !($table === 'pages' && !$uid)) {
         $this->error('MISSING RECORD: ' . $table . ':' . $uid);
     }
     // Begin to create the line arrays information record, pInfo:
     $pInfo = array();
     $pInfo['ref'] = $table . ':' . $uid;
     // Unknown table name:
     $lang = $this->getLanguageService();
     if ($table === '_SOFTREF_') {
         $pInfo['preCode'] = $preCode;
         $pInfo['title'] = '<em>' . $lang->getLL('impexpcore_singlereco_softReferencesFiles', true) . '</em>';
     } elseif (!isset($GLOBALS['TCA'][$table])) {
         // Unknown table name:
         $pInfo['preCode'] = $preCode;
         $pInfo['msg'] = 'UNKNOWN TABLE \'' . $pInfo['ref'] . '\'';
         $pInfo['title'] = '<em>' . htmlspecialchars($record['title']) . '</em>';
     } else {
         // Otherwise, set table icon and title.
         // Import Validation (triggered by $this->display_import_pid_record) will show messages if import is not possible of various items.
         if (is_array($this->display_import_pid_record) && !empty($this->display_import_pid_record)) {
             if ($checkImportInPidRecord) {
                 if (!$this->getBackendUser()->doesUserHaveAccess($this->display_import_pid_record, $table === 'pages' ? 8 : 16)) {
                     $pInfo['msg'] .= '\'' . $pInfo['ref'] . '\' cannot be INSERTED on this page! ';
                 }
                 if (!$this->checkDokType($table, $this->display_import_pid_record['doktype']) && !$GLOBALS['TCA'][$table]['ctrl']['rootLevel']) {
                     $pInfo['msg'] .= '\'' . $table . '\' cannot be INSERTED on this page type (change page type to \'Folder\'.) ';
                 }
             }
             if (!$this->getBackendUser()->check('tables_modify', $table)) {
                 $pInfo['msg'] .= 'You are not allowed to CREATE \'' . $table . '\' tables! ';
             }
             if ($GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' is READ ONLY! ';
             }
             if ($GLOBALS['TCA'][$table]['ctrl']['adminOnly'] && !$this->getBackendUser()->isAdmin()) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' is ADMIN ONLY! ';
             }
             if ($GLOBALS['TCA'][$table]['ctrl']['is_static']) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' is a STATIC TABLE! ';
             }
             if ((int) $GLOBALS['TCA'][$table]['ctrl']['rootLevel'] === 1) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' will be inserted on ROOT LEVEL! ';
             }
             $diffInverse = false;
             $recInf = null;
             if ($this->update) {
                 // In case of update-PREVIEW we swap the diff-sources.
                 $diffInverse = true;
                 $recInf = $this->doesRecordExist($table, $uid, $this->showDiff ? '*' : '');
                 $pInfo['updatePath'] = $recInf ? htmlspecialchars($this->getRecordPath($recInf['pid'])) : '<strong>NEW!</strong>';
                 // Mode selector:
                 $optValues = array();
                 $optValues[] = $recInf ? $lang->getLL('impexpcore_singlereco_update') : $lang->getLL('impexpcore_singlereco_insert');
                 if ($recInf) {
                     $optValues['as_new'] = $lang->getLL('impexpcore_singlereco_importAsNew');
                 }
                 if ($recInf) {
                     if (!$this->global_ignore_pid) {
                         $optValues['ignore_pid'] = $lang->getLL('impexpcore_singlereco_ignorePid');
                     } else {
                         $optValues['respect_pid'] = $lang->getLL('impexpcore_singlereco_respectPid');
                     }
                 }
                 if (!$recInf && $this->getBackendUser()->isAdmin()) {
                     $optValues['force_uid'] = sprintf($lang->getLL('impexpcore_singlereco_forceUidSAdmin'), $uid);
                 }
                 $optValues['exclude'] = $lang->getLL('impexpcore_singlereco_exclude');
                 if ($table === 'sys_file') {
                     $pInfo['updateMode'] = '';
                 } else {
                     $pInfo['updateMode'] = $this->renderSelectBox('tx_impexp[import_mode][' . $table . ':' . $uid . ']', $this->import_mode[$table . ':' . $uid], $optValues);
                 }
             }
             // Diff view:
             if ($this->showDiff) {
                 // For IMPORTS, get new id:
                 if ($newUid = $this->import_mapId[$table][$uid]) {
                     $diffInverse = false;
                     $recInf = $this->doesRecordExist($table, $newUid, '*');
                     BackendUtility::workspaceOL($table, $recInf);
                 }
                 if (is_array($recInf)) {
                     $pInfo['showDiffContent'] = $this->compareRecords($recInf, $this->dat['records'][$table . ':' . $uid]['data'], $table, $diffInverse);
                 }
             }
         }
         $pInfo['preCode'] = $preCode . '<span title="' . htmlspecialchars($table . ':' . $uid) . '">' . $this->iconFactory->getIconForRecord($table, (array) $this->dat['records'][$table . ':' . $uid]['data'], Icon::SIZE_SMALL)->render() . '</span>';
         $pInfo['title'] = htmlspecialchars($record['title']);
         // View page:
         if ($table === 'pages') {
             $viewID = $this->mode === 'export' ? $uid : ($this->doesImport ? $this->import_mapId['pages'][$uid] : 0);
             if ($viewID) {
                 $pInfo['title'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($viewID)) . 'return false;">' . $pInfo['title'] . '</a>';
             }
         }
     }
     $pInfo['class'] = $table == 'pages' ? 'bgColor4-20' : 'bgColor4';
     $pInfo['type'] = 'record';
     $pInfo['size'] = $record['size'];
     $lines[] = $pInfo;
     // File relations:
     if (is_array($record['filerefs'])) {
         $this->addFiles($record['filerefs'], $lines, $preCode);
     }
     // DB relations
     if (is_array($record['rels'])) {
         $this->addRelations($record['rels'], $lines, $preCode);
     }
     // Soft ref
     if (!empty($record['softrefs'])) {
         $preCode_A = $preCode . '&nbsp;&nbsp;&nbsp;&nbsp;';
         $preCode_B = $preCode . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
         foreach ($record['softrefs'] as $info) {
             $pInfo = array();
             $pInfo['preCode'] = $preCode_A . $this->iconFactory->getIcon('status-status-reference-soft', Icon::SIZE_SMALL)->render();
             $pInfo['title'] = '<em>' . $info['field'] . ', "' . $info['spKey'] . '" </em>: <span title="' . htmlspecialchars($info['matchString']) . '">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($info['matchString'], 60)) . '</span>';
             if ($info['subst']['type']) {
                 if (strlen($info['subst']['title'])) {
                     $pInfo['title'] .= '<br/>' . $preCode_B . '<strong>' . $lang->getLL('impexpcore_singlereco_title', true) . '</strong> ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($info['subst']['title'], 60));
                 }
                 if (strlen($info['subst']['description'])) {
                     $pInfo['title'] .= '<br/>' . $preCode_B . '<strong>' . $lang->getLL('impexpcore_singlereco_descr', true) . '</strong> ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($info['subst']['description'], 60));
                 }
                 $pInfo['title'] .= '<br/>' . $preCode_B . ($info['subst']['type'] == 'file' ? $lang->getLL('impexpcore_singlereco_filename', true) . ' <strong>' . $info['subst']['relFileName'] . '</strong>' : '') . ($info['subst']['type'] == 'string' ? $lang->getLL('impexpcore_singlereco_value', true) . ' <strong>' . $info['subst']['tokenValue'] . '</strong>' : '') . ($info['subst']['type'] == 'db' ? $lang->getLL('impexpcore_softrefsel_record', true) . ' <strong>' . $info['subst']['recordRef'] . '</strong>' : '');
             }
             $pInfo['ref'] = 'SOFTREF';
             $pInfo['size'] = '';
             $pInfo['class'] = 'bgColor3';
             $pInfo['type'] = 'softref';
             $pInfo['_softRefInfo'] = $info;
             $pInfo['type'] = 'softref';
             $mode = $this->softrefCfg[$info['subst']['tokenID']]['mode'];
             if ($info['error'] && $mode !== 'editable' && $mode !== 'exclude') {
                 $pInfo['msg'] .= $info['error'];
             }
             $lines[] = $pInfo;
             // Add relations:
             if ($info['subst']['type'] == 'db') {
                 list($tempTable, $tempUid) = explode(':', $info['subst']['recordRef']);
                 $this->addRelations(array(array('table' => $tempTable, 'id' => $tempUid, 'tokenID' => $info['subst']['tokenID'])), $lines, $preCode_B, array(), '');
             }
             // Add files:
             if ($info['subst']['type'] == 'file') {
                 $this->addFiles(array($info['file_ID']), $lines, $preCode_B, '', $info['subst']['tokenID']);
             }
         }
     }
 }
 /**
  * Print the string with the new group of a page record
  *
  * @param integer $page The TYPO3 page id
  * @param integer $groupUid The new page group uid
  * @param string $groupname The TYPO3 BE groupname (used to display in the element)
  * @param boolean $validGroup Must be set to FALSE, if the group has no name or is deleted
  * @return string The new group wrapped in HTML
  */
 public static function renderGroupname($page, $groupUid, $groupname, $validGroup = TRUE)
 {
     $elementId = 'g_' . $page;
     $ret = '<span id="' . $elementId . '"><a class="ug_selector" onclick="WebPermissions.showChangeGroupSelector(' . $page . ', ' . $groupUid . ', \'' . $elementId . '\', \'' . htmlspecialchars($groupname) . '\');">' . ($validGroup ? $groupname == '' ? '<span class=not_set>[' . $GLOBALS['LANG']->getLL('notSet') . ']</span>' : htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupname, 20)) : '<span class=not_set title="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupname, 20)) . '">[' . $GLOBALS['LANG']->getLL('deleted') . ']</span>') . '</a></span>';
     return $ret;
 }