/** * Render javascript in header * * @return string the rendered page info icon * @see template::getPageInfo() Note: can't call this method as it's protected! */ public function render() { $doc = $this->getDocInstance(); $id = t3lib_div::_GP('id'); $pageRecord = t3lib_BEfunc::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Add icon with clickmenu, etc: if ($pageRecord['uid']) { // If there IS a real page $alttext = t3lib_BEfunc::getRecordIconAltText($pageRecord, 'pages'); $iconImg = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext))); // Make Icon: $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); } else { // On root-level of page tree // Make Icon $iconImg = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />'; if ($BE_USER->user['admin']) { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>'; return $pageInfo; }
/** * Create indentation, icon and title for the page tree identification for the list. * * @param integer Page UID (record will be looked up again) * @param string Page title * @param integer Depth counter from displayWorkspaceOverview_list() used to indent the icon and title * @return string HTML content */ function displayWorkspaceOverview_pageTreeIconTitle($pageUid, $title, $indentCount) { $pRec = t3lib_BEfunc::getRecord('pages', $pageUid); return '<img src="clear.gif" width="1" height="1" hspace="' . $indentCount * $this->pageTreeIndent . '" align="top" alt="" />' . t3lib_iconWorks::getIconImage('pages', $pRec, $this->doc->backPath, ' align="top" title="' . t3lib_BEfunc::getRecordIconAltText($pRec, 'pages') . '"') . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, $this->pageTreeIndent_titleLgd)) . ' '; }
/** * Renders the data columns * * @param array $item item array * @return array */ function getItemColumns($item) { // Columns rendering $columns = array(); foreach ($this->columnList as $field => $descr) { switch ($field) { case 'page': // Create output item for pages record $pageRow = $item[$field]; $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']); $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline); $iconAltText = t3lib_BEfunc::getRecordIconAltText($pageRow, 'pages'); $icon = t3lib_iconWorks::getIconImage('pages', $pageRow, $GLOBALS['BACK_PATH'], 'title="' . $iconAltText . '" align="top"'); if ($this->showRootline) { $title = t3lib_BEfunc::getRecordPath($pageRow['uid'], '1=1', 0); $title = t3lib_div::fixed_lgd_cs($title, -$GLOBALS['BE_USER']->uc['titleLen']); } else { $title = t3lib_BEfunc::getRecordTitle('pages', $pageRow, TRUE); } if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) { if ($this->enableContextMenus) { $columns[$field] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($icon, 'pages', $pageRow['uid'], 1, '', '+view,edit,info') . $title; } else { $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>'; } } else { if ($this->enableContextMenus) { $columns[$field] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($icon, 'pages', $pageRow['uid'], 1, '', '+edit,info') . $title; } else { $columns[$field] = $icon . $title; } } break; case 'content_element': // Create output item for content record $refTable = $item['tablenames']; $refRow = $item[$field]; if ($refTable == 'pages') { // The reference to the media is on a field of a page record if ($GLOBALS['BE_USER']->isInWebMount($refRow['uid']) && $GLOBALS['BE_USER']->doesUserHaveAccess($refRow, 1)) { $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink($refTable, $refRow); } else { $pageRow = $refRow; $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']); $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline); $iconAltText = t3lib_BEfunc::getRecordIconAltText($refRow, $refTable); $icon = t3lib_iconworks::getIconImage($refTable, $refRow, $GLOBALS['BACK_PATH'], 'class="c-recicon" align="top" title="' . $iconAltText . '"'); $title = t3lib_BEfunc::getRecordTitle($refTable, $refRow, 1); if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) { $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>'; } else { $columns[$field] = $icon . $title; } } } else { // The reference to the media is on a field of a content element record if ($GLOBALS['BE_USER']->isInWebMount($pageRow['uid']) && $GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, 1)) { $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink($refTable, $refRow); } else { $pageRow = $item['page']; $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']); $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline); $iconAltText = t3lib_BEfunc::getRecordIconAltText($refRow, $refTable); $icon = t3lib_iconworks::getIconImage($refTable, $refRow, $GLOBALS['BACK_PATH'], 'class="c-recicon" align="top" title="' . $iconAltText . '"'); $title = t3lib_BEfunc::getRecordTitle($refTable, $refRow, 1); if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) { $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>'; } else { $columns[$field] = $icon . $title; } } } break; case 'content_field': // Create output item for reference field $columns[$field] = $item[$field]; break; case 'softref_key': // Create output item for reference key $columns[$field] = $item['softref_key'] ? $GLOBALS['LANG']->sl('LLL:EXT:dam/lib/locallang.xml:softref_key_' . $item['softref_key']) : $GLOBALS['LANG']->sl('LLL:EXT:dam/lib/locallang.xml:softref_key_media'); break; case 'content_age': // Create output text describing the age of the content element $columns[$field] = t3lib_BEfunc::dateTimeAge($item[$field], 1); break; case 'media_element': // Create output item for tx_dam record $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink('tx_dam', $item); break; case 'media_element_age': // Create output text describing the tx_dam record age $columns[$field] = t3lib_BEfunc::dateTimeAge($item['tstamp'], 1); break; case '_CLIPBOARD_': $columns[$field] = $this->clipboard_getItemControl($item); break; case '_CONTROL_': $columns[$field] = $this->getItemControl($item); $this->columnTDAttr[$field] = ' nowrap="nowrap"'; break; default: $content = $item[$field]; $columns[$field] = htmlspecialchars(t3lib_div::fixed_lgd_cs($content, $this->titleLength)); break; } if ($columns[$field] === '') { $columns[$field] = ' '; } } // Thumbsnails? if ($this->showThumbs and $this->thumbnailPossible($item)) { $columns['media_element'] .= '<div style="margin:2px 0 2px 0;">' . $this->getThumbNail($item) . '</div>'; } return $columns; }
/** * Create record header (includes teh record icon, record title etc.) * * @param array Record row. * @return string HTML */ function getRecordHeader($row) { $line = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($row, 'tt_content')))); $line .= t3lib_BEfunc::getRecordTitle('tt_content', $row, TRUE); return $this->wrapRecordTitle($line, $row); }
/** * Create record header (includes teh record icon, record title etc.) * * @param array Record row. * @return string HTML */ function getRecordHeader($row) { $line = t3lib_iconWorks::getIconImage('tt_content', $row, $this->backPath, ' align="top" title="' . htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($row, 'tt_content')) . '"'); $line .= t3lib_BEfunc::getRecordTitle('tt_content', $row, 1); return $this->wrapRecordTitle($line, $row); }
/** * Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc. * Later on the command-icons are inserted here. * * @param string $parentUid: The uid of the parent (embedding) record (uid or NEW...) * @param string $foreign_table: The foreign_table we create a header for * @param array $rec: The current record of that foreign_table * @param array $config: content of $PA['fieldConf']['config'] * @param boolean $isVirtualRecord: * @return string The HTML code of the header */ function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = false) { // Init: $objectId = $this->inlineNames['object'] . self::Structure_Separator . $foreign_table . self::Structure_Separator . $rec['uid']; $expandSingle = $config['appearance']['expandSingle'] ? 1 : 0; // we need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter) $onClick = "return inline.expandCollapseRecord('" . htmlspecialchars($objectId) . "', {$expandSingle}, '" . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "')"; // Pre-Processing: $isOnSymmetricSide = t3lib_loadDBGroup::isOnSymmetricSide($parentUid, $config, $rec); $hasForeignLabel = !$isOnSymmetricSide && $config['foreign_label'] ? true : false; $hasSymmetricLabel = $isOnSymmetricSide && $config['symmetric_label'] ? true : false; // Get the record title/label for a record: // render using a self-defined user function if ($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc']) { $params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'parent' => array('uid' => $parentUid, 'config' => $config)); $null = null; // callUserFunction requires a third parameter, but we don't want to give $this as reference! t3lib_div::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'], $params, $null); $recTitle = $params['title']; // render the special alternative title } elseif ($hasForeignLabel || $hasSymmetricLabel) { $titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label']; $foreignConfig = $this->getPossibleRecordsSelectorConfig($config, $titleCol); // Render title for everything else than group/db: if ($foreignConfig['type'] != 'groupdb') { $recTitle = t3lib_BEfunc::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, false); // Render title for group/db: } else { // $recTitle could be something like: "tx_table_123|...", $valueParts = t3lib_div::trimExplode('|', $rec[$titleCol]); $itemParts = t3lib_div::revExplode('_', $valueParts[0], 2); $recTemp = t3lib_befunc::getRecordWSOL($itemParts[0], $itemParts[1]); $recTitle = t3lib_BEfunc::getRecordTitle($itemParts[0], $recTemp, false); } $recTitle = t3lib_BEfunc::getRecordTitlePrep($recTitle); if (!strcmp(trim($recTitle), '')) { $recTitle = t3lib_BEfunc::getNoRecordTitle(true); } // render the standard } else { $recTitle = t3lib_BEfunc::getRecordTitle($foreign_table, $rec, true); } $altText = t3lib_BEfunc::getRecordIconAltText($rec, $foreign_table); $iconImg = t3lib_iconWorks::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon"')); $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>'; if (!$isVirtualRecord) { $iconImg = $this->wrapWithAnchor($iconImg, '#', array('onclick' => $onClick)); $label = $this->wrapWithAnchor($label, '#', array('onclick' => $onClick, 'style' => 'display: block;')); } $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord); // @TODO: Check the table wrapping and the CSS definitions $header = '<table cellspacing="0" cellpadding="0" border="0" width="100%" style="margin-right: ' . $this->inlineStyles['margin-right'] . 'px;"' . ($this->fObj->borderStyle[2] ? ' background="' . htmlspecialchars($this->backPath . $this->fObj->borderStyle[2]) . '"' : '') . ($this->fObj->borderStyle[3] ? ' class="' . htmlspecialchars($this->fObj->borderStyle[3]) . '"' : '') . '>' . '<tr class="class-main12"><td width="18" id="' . $objectId . '_iconcontainer">' . $iconImg . '</td><td align="left"><strong>' . $label . '</strong></td><td align="right">' . $ctrl . '</td></tr></table>'; return $header; }
/** * Creates the listing of records from a single table * * @param string Table name * @param integer Page id * @param string List of fields to show in the listing. Pseudo fields will be added including the record header. * @return string HTML table with the listing for the record. */ function getTable($table, $rowlist) { global $TCA, $BACK_PATH, $LANG; // Loading all TCA details for this table: t3lib_div::loadTCA($table); // Init $addWhere = ''; $titleCol = $TCA[$table]['ctrl']['label']; $thumbsCol = $TCA[$table]['ctrl']['thumbnail']; $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable']; $selFieldList = $this->getSelFieldList($table, $rowlist); $dbCount = 0; if ($this->pointer->countTotal and $this->res) { $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($this->res); } $shEl = $this->showElements; $out = ''; if ($dbCount) { // half line is drawn $theData = array(); if (!$this->table && !$rowlist) { $theData[$titleCol] = '<img src="clear.gif" width="' . ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] ? '230' : '350') . '" height="1">'; if (in_array('_CONTROL_', $this->fieldArray)) { $theData['_CONTROL_'] = ''; } } # $out.=$this->addelement('', $theData); // Header line is drawn $theData = array(); # $theData[$titleCol] = '<b>'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</b> ('.$this->resCount.')'; $theUpIcon = ' '; // todo csh # $theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;'); # $out.=$this->addelement($theUpIcon, $theData, '', '', 'background-color:'.$this->headLineCol.'; border-bottom:1px solid #000'); // Fixing a order table for sortby tables $this->currentTable = array(); $currentIdList = array(); $doSort = $TCA[$table]['ctrl']['sortby'] && !$this->sortField; $prevUid = 0; $prevPrevUid = 0; $accRows = array(); // Accumulate rows here while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->res)) { $accRows[] = $row; $currentIdList[] = $row['uid']; if ($doSort) { if ($prevUid) { $this->currentTable['prev'][$row['uid']] = $prevPrevUid; $this->currentTable['next'][$prevUid] = '-' . $row['uid']; $this->currentTable['prevUid'][$row['uid']] = $prevUid; } $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid']; $prevUid = $row['uid']; } } $GLOBALS['TYPO3_DB']->sql_free_result($this->res); // items $itemContentTRows = ''; $this->duplicateStack = array(); $this->eCounter = $this->pointer->firstItemNum; $cc = 0; $itemContentTRows .= $this->fwd_rwd_nav('rwd'); foreach ($accRows as $row) { $this->alternateBgColors = false; $cc++; $row_bgColor = $this->alternateBgColors ? $cc % 2 ? ' class="item"' : ' class="item" bgColor="' . t3lib_div::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, +10, +10, +10) . '"' : ' class="item"'; // Initialization $iconfile = t3lib_iconWorks::getIcon($table, $row); $alttext = t3lib_BEfunc::getRecordIconAltText($row, $table); $recTitle = t3lib_BEfunc::getRecordTitle($table, $row, 1); // The icon with link $theIcon = '<img src="' . $this->backPath . $iconfile . '" width="18" height="16" border="0" title="' . $alttext . '" />'; $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $table, $row['uid']); $thumbImg = ''; if ($this->thumbs) { $thumbImg = '<div style="margin:2px 0 2px 0;">' . $this->getThumbNail(tx_dam::path_makeAbsolute($row['file_path']) . $row['file_name']) . '</div>'; } // Preparing and getting the data-array $theData = array(); reset($this->fieldArray); while (list(, $fCol) = each($this->fieldArray)) { if ($fCol == $titleCol) { $theData[$fCol] = $this->linkWrapItems($table, $row['uid'], $recTitle, $row) . $thumbImg; } elseif ($fCol == 'pid') { $theData[$fCol] = $row[$fCol]; } elseif ($fCol == '_CONTROL_') { $theData[$fCol] = $this->makeControl($table, $row); } else { $theData[$fCol] = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 100); } } $actionIcon = ''; $itemContentTRows .= $this->addElement($theIcon, $theData, $actionIcon, $row_bgColor, '', true); // Thumbsnails? // if ($this->thumbs && trim($row[$thumbsCol])) { // $itemContentTRows.=$this->addelement('', Array($titleCol=>$this->thumbCode($row,$table,$thumbsCol)), '', $row_bgColor); // } $this->eCounter++; } if ($this->eCounter > $this->pointer->firstItemNum) { $itemContentTRows .= $this->fwd_rwd_nav('fwd'); } // field header line is drawn: $theData = array(); foreach ($this->fieldArray as $fCol) { $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16); if ($fCol == '_CONTROL_') { if (!$TCA[$table]['ctrl']['readOnly']) { if ($permsEdit && $this->table && is_array($currentIdList) && in_array('editRec', $shEl)) { $editIdList = implode(',', $currentIdList); $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1'; $content = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' vspace="2" border="0" align="top" title="' . $GLOBALS['LANG']->getLL('editShownColumns') . '" />'; $theData[$fCol] .= $this->wrapEditLink($content, $params); } } } else { $theData[$fCol] = ''; # $theData[$fCol].=' '; if ($this->table && is_array($currentIdList) && in_array('editRec', $shEl)) { if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol]) { $editIdList = implode(',', $currentIdList); $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1'; $content = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' vspace="2" border="0" align="top" title="' . sprintf($GLOBALS['LANG']->getLL('editThisColumn'), preg_replace("/:\$/", '', trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fCol))))) . '" />'; $theData[$fCol] .= $this->wrapEditLink($content, $params); } } else { # $theData[$fCol].=' '; } $theData[$fCol] .= $this->addSortLink($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fCol, ' <i>[|]</i> ')), $fCol, $table); } } $out .= $this->addelement($theUpIcon, $theData, '', ' class="c-headLine"', 'border-bottom:1px solid #888'); // The list of records is added after the header: $out .= $itemContentTRows; $out .= $this->addelement('', array(), '', '', 'border-top:1px solid #888'); #TODO $LOISmode = false; // ... and it is all wrapped in a table: $out = ' <!-- DB listing of elements: "' . htmlspecialchars($table) . '" --> <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist' . ($LOISmode ? ' typo3-dblist-overview' : '') . '"> ' . $out . ' </table>'; } // Return content: return $out; }
/** * Setting page icon with clickmenu + uid for docheader * * @param array Current page * @return string Page info */ protected function getPageInfo($pageRecord) { global $BE_USER; // Add icon with clickmenu, etc: if ($pageRecord['uid']) { // If there IS a real page $alttext = t3lib_BEfunc::getRecordIconAltText($pageRecord, 'pages'); $iconImg = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord, array('title' => $alttext)); // Make Icon: $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); $uid = $pageRecord['uid']; $title = t3lib_BEfunc::getRecordTitle('pages', $pageRecord); } else { // On root-level of page tree // Make Icon $iconImg = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root', array('title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])); if ($BE_USER->user['admin']) { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } $uid = '0'; $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '<strong>' . htmlspecialchars($title) . ' [' . $uid . ']</strong>'; return $pageInfo; }
/** * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu. * * @param string Table name * @param array Record array * @param string Record title (NOT USED) * @return string HTML for the icon */ function getIcon($table, $row, $noEdit) { // Initialization $alttext = t3lib_BEfunc::getRecordIconAltText($row, $table); $iconImg = t3lib_iconWorks::getIconImage($table, $row, $this->backPath, 'title="' . $alttext . '"'); $this->counter++; if ($noEdit) { $disableList = '+info,copy'; } // The icon with link $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid'], '', '', $disableList); return $theIcon; }
/** * Make 2nd level clickmenu (only for DBmenus) * * @param string Table name * @param integer UID for the current record. * @return string HTML content */ function printNewDBLevel($table, $uid) { global $TCA, $BE_USER; // Setting internal record to the table/uid : $this->rec = t3lib_BEfunc::getRecordWSOL($table, $uid); $menuItems = array(); $root = 0; if ($table == 'pages' && !strcmp($uid, '0')) { // Rootlevel $root = 1; } // If record was found, check permissions and get menu items. if (is_array($this->rec) || $root) { $lCP = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages', $table == 'pages' ? $this->rec['uid'] : $this->rec['pid'])); // Edit: if (!$root && ($BE_USER->isPSet($lCP, $table, 'edit') || $BE_USER->isPSet($lCP, $table, 'editcontent'))) { $this->editOK = 1; } $menuItems = $this->processingByExtClassArray($menuItems, $table, $uid); } // Return the printed elements: if (!is_array($menuItems)) { $menuItems = array(); } return $this->printItems($menuItems, $root ? t3lib_iconWorks::getSpriteIcon('apps-pagetree-root') . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : t3lib_iconWorks::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec, $table)))) . t3lib_BEfunc::getRecordTitle($table, $this->rec, TRUE)); }
/** * Returns the content tree (based on the data structure) for a certain page or a flexible content element. In case of a page it will contain all the references * to content elements (and some more information) and in case of a FCE, references to its sub-elements. * * @param string $table: Table which contains the (XML) data structure. Only records from table 'pages' or flexible content elements from 'tt_content' are handled * @param array $row: Record of the root element where the tree starts (Possibly overlaid with workspace content) * @param array $tt_content_elementRegister: Register of used tt_content elements, don't mess with it! (passed by reference since data is built up) * @param string $prevRecList: comma separated list of uids, used internally for recursive calls. Don't mess with it! * @param integer $depth: nexting depth * @return array The content tree * @access protected */ function getContentTree_element($table, $row, &$tt_content_elementRegister, $prevRecList='', $depth=0) { global $TCA, $LANG; $alttext = t3lib_BEfunc::getRecordIconAltText($row, $table); $tree = array(); $tree['el'] = array( 'table' => $table, 'uid' => $row['uid'], 'pid' => $row['pid'], '_ORIG_uid' => $row['_ORIG_uid'], 'title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $row),50), 'fullTitle' => t3lib_BEfunc::getRecordTitle($table, $row), 'icon' => t3lib_iconWorks::getIcon($table,$row), // kept because it's not clear if this is used elsewhere 'iconTag' => t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => $alttext)), 'sys_language_uid' => $row['sys_language_uid'], 'l18n_parent' => $row['l18n_parent'], 'CType' => $row['CType'], 'TO' => $row['tx_templavoila_to'], ); if ($this->includePreviewData) { $tree['previewData'] = array( 'fullRow' => $row ); } // If element is a Flexible Content Element (or a page) then look at the content inside: if ($table == 'pages' || $table == $this->rootTable || ($table=='tt_content' && $row['CType']=='templavoila_pi1')) { t3lib_div::loadTCA($table); $rawDataStructureArr = t3lib_BEfunc::getFlexFormDS($TCA[$table]['columns']['tx_templavoila_flex']['config'], $row, $table); $expandedDataStructureArr = $this->ds_getExpandedDataStructure($table, $row); switch ($table) { case 'pages' : $currentTemplateObject = $this->getContentTree_fetchPageTemplateObject($row); break; case 'tt_content': $currentTemplateObject = t3lib_beFunc::getRecordWSOL('tx_templavoila_tmplobj', $row['tx_templavoila_to']); break; default: $currentTemplateObject = FALSE; } if (is_array ($currentTemplateObject)) $templateMappingArr = unserialize($currentTemplateObject['templatemapping']); $tree['ds_is_found'] = is_array($rawDataStructureArr); $tree['ds_meta'] = $rawDataStructureArr['meta']; $flexformContentArr = t3lib_div::xml2array($row['tx_templavoila_flex']); if (!is_array($flexformContentArr)) $flexformContentArr = array(); // Respect the currently selected language, for both concepts - with langChildren enabled and disabled: $langChildren = intval($tree['ds_meta']['langChildren']); $langDisable = intval($tree['ds_meta']['langDisable']); $lKeys = $langDisable ? array('lDEF') : ($langChildren ? array('lDEF') : $this->allSystemWebsiteLanguages['all_lKeys']); $vKeys = $langDisable ? array('vDEF') : ($langChildren ? $this->allSystemWebsiteLanguages['all_vKeys'] : array('vDEF')); // Traverse each sheet in the FlexForm Structure: foreach($expandedDataStructureArr as $sheetKey => $sheetData) { // Add some sheet meta information: $tree['sub'][$sheetKey] = array(); $tree['contentFields'][$sheetKey] = array(); $tree['meta'][$sheetKey] = array( 'title' => (is_array($sheetData) && $sheetData['ROOT']['TCEforms']['sheetTitle'] ? $LANG->sL($sheetData['ROOT']['TCEforms']['sheetTitle']) : ''), 'description' => (is_array($sheetData) && $sheetData['ROOT']['TCEforms']['sheetDescription'] ? $LANG->sL($sheetData['ROOT']['TCEforms']['sheetDescription']) : ''), 'short' => (is_array($sheetData) && $sheetData['ROOT']['TCEforms']['sheetShortDescr'] ? $LANG->sL($sheetData['ROOT']['TCEforms']['sheetShortDescr']) : ''), ); // Traverse the sheet's elements: if (is_array($sheetData) && is_array($sheetData['ROOT']['el'])) { foreach($sheetData['ROOT']['el'] as $fieldKey => $fieldData) { // Compile preview data: if ($this->includePreviewData) { $tree['previewData']['sheets'][$sheetKey][$fieldKey] = array( 'TCEforms' => $fieldData['TCEforms'], 'tx_templavoila' => $fieldData['tx_templavoila'], 'type' => $fieldData['type'], 'section' => $fieldData['section'], 'data' => array(), 'subElements' => array(), 'isMapped' => !empty($templateMappingArr['MappingInfo']['ROOT']['el'][$fieldKey]['MAP_EL']) ); foreach($lKeys as $lKey) { foreach($vKeys as $vKey) { if (is_array($flexformContentArr['data'])) { $tree['previewData']['sheets'][$sheetKey][$fieldKey]['data'][$lKey][$vKey] = $flexformContentArr['data'][$sheetKey][$lKey][$fieldKey][$vKey]; } } if ($fieldData['type'] == 'array') { $tree['previewData']['sheets'][$sheetKey][$fieldKey]['subElements'][$lKey] = $flexformContentArr['data'][$sheetKey][$lKey][$fieldKey]['el']; $tree['previewData']['sheets'][$sheetKey][$fieldKey]['childElements'][$lKey] = $this->getContentTree_processSubFlexFields($table, $row, array($fieldKey=>$fieldData), $tt_content_elementRegister, $flexformContentArr['data'][$sheetKey][$lKey], $vKeys); } } } // If the current field points to other content elements, process them: if ($fieldData['TCEforms']['config']['type'] == 'group' && $fieldData['TCEforms']['config']['internal_type'] == 'db' && $fieldData['TCEforms']['config']['allowed'] == 'tt_content') { foreach($lKeys as $lKey) { foreach($vKeys as $vKey) { $listOfSubElementUids = $flexformContentArr['data'][$sheetKey][$lKey][$fieldKey][$vKey]; $tree['depth'] = $depth; $tree['sub'][$sheetKey][$lKey][$fieldKey][$vKey] = $this->getContentTree_processSubContent($listOfSubElementUids, $tt_content_elementRegister, $prevRecList,$depth); $tree['sub'][$sheetKey][$lKey][$fieldKey][$vKey]['meta']['title'] = $fieldData['TCEforms']['label']; } } } elseif ($fieldData['type']!='array' && $fieldData['TCEforms']['config']) { // If generally there are non-container fields, register them: $tree['contentFields'][$sheetKey][] = $fieldKey; } } } } } // Add localization info for this element: $tree['localizationInfo'] = $this->getContentTree_getLocalizationInfoForElement($tree, $tt_content_elementRegister); return $tree; }
/** * This method gets the title and the icon for a given record of a given table * It returns these as a HTML string * * @param string $table: name of the table * @param integer $uid: primary key of the record * @return string HTML to display */ function getRecordDetails($table, $uid) { global $BACK_PATH; if (empty($table) || empty($uid)) { return ''; } else { $row = array(); if (isset($this->records[$table][$uid])) { $row = $this->records[$table][$uid]; } else { $row = t3lib_BEfunc::getRecord($table, $uid); } $iconAltText = t3lib_BEfunc::getRecordIconAltText($row, $table); $elementTitle = t3lib_BEfunc::getRecordTitle($table, $row, 1); $elementIcon = t3lib_iconworks::getIconImage($table, $row, $BACK_PATH, 'class="c-recicon" title="' . $iconAltText . '"'); return $elementIcon . $elementTitle; } }
/** * Returns a linked icon with title from a page * * @param integer $uid ID of the page * @return string HTML for icon, title and link */ protected function getPageLink($uid) { $string = ''; if (!empty($uid)) { $page = t3lib_BEfunc::getRecord('pages', $uid); // If the page doesn't exist, the result is null, but we need rather an empty array if ($page === NULL) { $page = array(); } $pageTitle = t3lib_BEfunc::getRecordTitle('pages', $page, 1); $iconAltText = t3lib_BEfunc::getRecordIconAltText($page, 'pages'); // Create icon for record $elementIcon = t3lib_iconWorks::getSpriteIconForRecord('pages', $page, array('title' => $iconAltText)); // Return item with link to Web > List $editOnClick = "top.goToModule('web_list', '', '&id=" . $uid . "')"; $string = '<a href="#" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:external_import/Resources/Private/Language/locallang.xml:jump_to_page') . '">' . $elementIcon . $pageTitle . '</a>'; } return $string; }
/** * Creating the module output. * * @return void * @todo provide position mapping if no position is given already. Like the columns selector but for our cascading element style ... */ function main() { global $LANG, $BACK_PATH, $BE_USER; if ($this->id && $this->access) { // Creating content $this->content = ''; $this->content .= $this->doc->startPage($LANG->getLL('newContentElement')); $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); $elRow = t3lib_BEfunc::getRecordWSOL('pages', $this->id); $header = t3lib_iconWorks::getIconImage('pages', $elRow, $BACK_PATH, ' title="' . htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow, 'pages')) . '" align="top"'); $header .= t3lib_BEfunc::getRecordTitle('pages', $elRow, 1); $this->content .= $this->doc->section('', $header, 0, 1); $this->content .= $this->doc->spacer(10); // Wizard $wizardCode = ''; $tableRows = array(); $wizardItems = $this->getWizardItems(); // Traverse items for the wizard. // An item is either a header or an item rendered with a title/description and icon: $counter = 0; // # // ### Mansoor Ahmad @ Gosign media. GmbH - Set it for ... // # $ignoreList = 'list,templavoila_pi1'; foreach ($wizardItems as $key => $wizardItem) { if ($wizardItem['header']) { if ($counter > 0) { $tableRows[] = ' <tr> <td colspan="3"><br /></td> </tr>'; } $tableRows[] = ' <tr class="bgColor5"> <td colspan="3"><strong>' . htmlspecialchars($wizardItem['header']) . '</strong></td> </tr>'; } else { $tableLinks = array(); // href URI for icon/title: $newRecordLink = 'index.php?' . $this->linkParams() . '&createNewRecord=' . rawurlencode($this->parentRecord) . $wizardItem['params']; // Icon: $iInfo = @getimagesize($wizardItem['icon']); $tableLinks[] = '<a href="' . $newRecordLink . '"><img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wizardItem['icon'], '') . ' alt="" /></a>'; // Title + description: $tableLinks[] = '<a href="' . $newRecordLink . '"><strong>' . htmlspecialchars($wizardItem['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wizardItem['description']))) . '</a>'; // Finally, put it together in a table row: // # // ### Mansoor Ahmad @ Gosign media. GmbH - start // # //print_r($wizardItems); $actionForm = 'db_new_content_el.php?' . $this->linkParams() . '&parentRecord=' . t3lib_div::GPvar('parentRecord'); if (t3lib_div::GPvar('count') == $counter && t3lib_div::GPvar('go_backend_layout_edit') == 1) { $tableRows[] = ' <tr> <td valign="top" colspan="3">' . $this->getEditTable($wizardItem, $actionForm) . ' <a name="' . $wizardItem['tt_content_defValues']['CType'] . '" /> </td> </tr>'; } else { $tableRows[] = ' <tr> <td valign="top"><a name="' . $wizardItem['tt_content_defValues']['CType'] . '" />' . implode('</td> <td valign="top">', $tableLinks) . '</td> <td valign="top">' . ($BE_USER->isAdmin() && !in_array($wizardItem['tt_content_defValues']['CType'], explode(',', $ignoreList)) ? '<a href="db_new_content_el.php?' . $this->linkParams() . '&parentRecord=' . t3lib_div::GPvar('parentRecord') . '&go_backend_layout_edit=1&count=' . $counter . '#' . $wizardItem['tt_content_defValues']['CType'] . '"><img src="../../../../typo3/sysext/t3skin/icons/gfx/edit2.gif" /></a>' : '') . '</td> </tr>'; $editData = array('CType' => t3lib_div::GPvar('CType'), 'title' => t3lib_div::GPvar('title'), 'desc' => t3lib_div::GPvar('desc')); if ($editData['CType'] == $wizardItem['tt_content_defValues']['CType']) { $this->saveEditTableData($editData, $wizardItem); } elseif (t3lib_div::GPvar('submit')) { header('location:' . $actionForm . '#' . t3lib_div::GPvar('CType')); } } // # // ### Mansoor Ahmad @ Gosign media. GmbH - end // # $counter++; } } // Add the wizard table to the content: $wizardCode .= $LANG->getLL('sel1', 1) . '<br /><br /> <!-- Content Element wizard table: --> <table border="0" cellpadding="1" cellspacing="2" id="typo3-ceWizardTable" style="float:left;"> ' . implode('', $tableRows) . ' </table> '; $this->content .= $this->doc->section($LANG->getLL('1_selectType'), $wizardCode, 0, 1); } else { // In case of no access: $this->content = ''; $this->content .= $this->doc->startPage($LANG->getLL('newContentElement')); $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); } }
/** * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu. * * @param string Table name * @param array Record array * @param string Record title (NOT USED) * @return string HTML for the icon */ function getIcon($table, $row) { // Initialization $alttext = t3lib_BEfunc::getRecordIconAltText($row, $table); $iconImg = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => $alttext)); $this->counter++; // The icon with link $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']); return $theIcon; }
/** * Renders the item icon * * @param array $item item array * @return string */ function getItemIcon(&$item) { static $iconNotExists; if (!$iconNotExists) { $titleNotExists = 'title="' . $GLOBALS['LANG']->getLL('fileNotExists', true) . '"'; $iconNotExists = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], PATH_txdam_rel . 'i/error_h.gif', 'width="10" height="10"') . ' ' . $titleNotExists . ' alt="" />'; } $titletext = t3lib_BEfunc::getRecordIconAltText($item, $this->table); $itemIcon = tx_dam::icon_getFileTypeImgTag($item, 'title="' . $titletext . '"'); if ($this->enableContextMenus) { $itemIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($itemIcon, $this->table, $item['uid']); } if (!is_file(tx_dam::file_absolutePath($item))) { $item['file_status'] = TXDAM_status_file_missing; $itemIcon .= $iconNotExists; } return $itemIcon; }
/** * Returns a record icon with title and edit link * * @param string Table name (tt_content,...) * @param array Record array * @param boolean For pages records the rootline will be rendered * @return string Rendered icon */ function getRecordInfoEditLink($refTable, $row, $showRootline = FALSE) { global $BACK_PATH, $LANG, $TCA; // Create record title or rootline for pages if option is selected if ($refTable === 'pages' and $showRootline) { $elementTitle = t3lib_BEfunc::getRecordPath($row['uid'], '1=1', 0); $elementTitle = t3lib_div::fixed_lgd_cs($elementTitle, -$BE_USER->uc['titleLen']); } else { $elementTitle = t3lib_BEfunc::getRecordTitle($refTable, $row, 1); } // Create icon for record if ($refTable === 'tx_dam') { $elementIcon = tx_dam_guiFunc::icon_getFileTypeImgTag($row, 'class="c-recicon" align="top"'); } else { $iconAltText = t3lib_BEfunc::getRecordIconAltText($row, $refTable); // Prepend table description for non-pages tables if (!($refTable === 'pages')) { $iconAltText = htmlspecialchars($LANG->sl($TCA[$refTable]['ctrl']['title']) . ': ') . $iconAltText; } $elementIcon = t3lib_iconworks::getIconImage($refTable, $row, $BACK_PATH, 'class="c-recicon" align="top" title="' . $iconAltText . '"'); } // Return item with edit link return tx_dam_SCbase::wrapLink_edit($elementIcon . $elementTitle, $refTable, $row['uid']); }
/** * Creating the module output. * * @return void * @todo provide position mapping if no position is given already. Like the columns selector but for our cascading element style ... */ function main() { global $LANG, $BACK_PATH; if ($this->id && $this->access) { // Creating content $this->content = ''; $this->content .= $this->doc->startPage($LANG->getLL('newContentElement')); $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); $elRow = t3lib_BEfunc::getRecordWSOL('pages', $this->id); $header = t3lib_iconWorks::getIconImage('pages', $elRow, $BACK_PATH, ' title="' . htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow, 'pages')) . '" align="top"'); $header .= t3lib_BEfunc::getRecordTitle('pages', $elRow, 1); $this->content .= $this->doc->section('', $header, 0, 1); $this->content .= $this->doc->spacer(10); // Wizard $wizardCode = ''; $tableRows = array(); $wizardItems = $this->getWizardItems(); // Traverse items for the wizard. // An item is either a header or an item rendered with a title/description and icon: $counter = 0; foreach ($wizardItems as $key => $wizardItem) { if ($wizardItem['header']) { if ($counter > 0) { $tableRows[] = ' <tr> <td colspan="3"><br /></td> </tr>'; } $tableRows[] = ' <tr class="bgColor5"> <td colspan="3"><strong>' . htmlspecialchars($wizardItem['header']) . '</strong></td> </tr>'; } else { $tableLinks = array(); // href URI for icon/title: $newRecordLink = 'index.php?' . $this->linkParams() . '&createNewRecord=' . rawurlencode($this->parentRecord) . $wizardItem['params']; // Icon: $iInfo = @getimagesize($wizardItem['icon']); $tableLinks[] = '<a href="' . $newRecordLink . '"><img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wizardItem['icon'], '') . ' alt="" /></a>'; // Title + description: $tableLinks[] = '<a href="' . $newRecordLink . '"><strong>' . htmlspecialchars($wizardItem['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wizardItem['description']))) . '</a>'; // Finally, put it together in a table row: $tableRows[] = ' <tr> <td valign="top">' . implode('</td> <td valign="top">', $tableLinks) . '</td> </tr>'; $counter++; } } // Add the wizard table to the content: $wizardCode .= $LANG->getLL('sel1', 1) . '<br /><br /> <!-- Content Element wizard table: --> <table border="0" cellpadding="1" cellspacing="2" id="typo3-ceWizardTable"> ' . implode('', $tableRows) . ' </table>'; $this->content .= $this->doc->section($LANG->getLL('1_selectType'), $wizardCode, 0, 1); } else { // In case of no access: $this->content = ''; $this->content .= $this->doc->startPage($LANG->getLL('newContentElement')); $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); } }
/** * Rendering the content for the publish / review overview: * (Made for internal recursive calling) * * @param array Storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray()) * @return array Table rows, see displayWorkspaceOverview() */ function displayWorkspaceOverview_list($pArray) { global $TCA; // If there ARE elements on this level, print them: $warnAboutVersions_nonPages = FALSE; $warnAboutVersions_page = FALSE; if (is_array($pArray)) { foreach ($pArray as $table => $oidArray) { foreach ($oidArray as $oid => $recs) { // Get CURRENT online record and icon based on "t3ver_oid": $rec_on = t3lib_BEfunc::getRecord($table, $oid); $icon = t3lib_iconWorks::getSpriteIconForRecord($table, $rec_on, array('title' => t3lib_BEfunc::getRecordIconAltText($rec_on, $table))); if ($GLOBALS['BE_USER']->workspace === 0) { // Only edit online records if in ONLINE workspace: $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $rec_on['uid'], 1, '', '+edit,view,info,delete'); } // Online version display: // Create the main cells which will span over the number of versions there is. $verLinkUrl = $TCA[$table]['ctrl']['versioningWS']; $origElement = $icon . ($verLinkUrl ? '<a href="' . htmlspecialchars('index.php?table=' . $table . '&uid=' . $rec_on['uid']) . '">' : '') . t3lib_BEfunc::getRecordTitle($table, $rec_on, TRUE) . ($verLinkUrl ? '</a>' : ''); $mainCell_rowSpan = count($recs) > 1 ? ' rowspan="' . count($recs) . '"' : ''; $mainCell = ' <td align="center"' . $mainCell_rowSpan . '>' . $this->formatVerId($rec_on['t3ver_id']) . '</td> <td nowrap="nowrap"' . $mainCell_rowSpan . '>' . $origElement . '###SUB_ELEMENTS###' . '</td>'; // Offline versions display: // Traverse the versions of the element foreach ($recs as $rec) { // Get the offline version record and icon: $rec_off = t3lib_BEfunc::getRecord($table, $rec['uid']); // Prepare swap-mode values: if ($table === 'pages' && $rec_off['t3ver_swapmode'] != -1) { if ($rec_off['t3ver_swapmode'] > 0) { $vType = 'branch'; } else { $vType = 'page'; } } else { $vType = 'element'; } // Get icon $icon = t3lib_iconWorks::getSpriteIconForRecord($table, $rec_off, array('title' => t3lib_BEfunc::getRecordIconAltText($rec_off, $table))); $tempUid = $table != 'pages' || $vType === 'branch' || $GLOBALS['BE_USER']->workspace === 0 ? $rec_off['uid'] : $rec_on['uid']; $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $tempUid, 1, '', '+edit,' . ($table == 'pages' ? 'view,info,' : '') . 'delete'); // Prepare diff-code: if ($this->MOD_SETTINGS['diff'] || $this->diffOnly) { $diffCode = ''; list($diffHTML, $diffPct) = $this->createDiffView($table, $rec_off, $rec_on); if ($rec_on['t3ver_state'] == 1) { // New record: $diffCode .= $this->doc->icons(1) . $GLOBALS['LANG']->getLL('newElement') . '<br />'; $diffCode .= $diffHTML; } elseif ($rec_off['t3ver_state'] == 2) { $diffCode .= $this->doc->icons(2) . $GLOBALS['LANG']->getLL('deletedElement') . '<br />'; } elseif ($rec_on['t3ver_state'] == 3) { $diffCode .= $this->doc->icons(1) . $GLOBALS['LANG']->getLL('moveToPlaceholder') . '<br />'; } elseif ($rec_off['t3ver_state'] == 4) { $diffCode .= $this->doc->icons(1) . $GLOBALS['LANG']->getLL('moveToPointer') . '<br />'; } else { $diffCode .= $diffPct < 0 ? $GLOBALS['LANG']->getLL('notAvailable') : ($diffPct ? $diffPct . '% ' . $GLOBALS['LANG']->getLL('change') : ''); $diffCode .= $diffHTML; } } else { $diffCode = ''; } switch ($vType) { case 'element': $swapLabel = $GLOBALS['LANG']->getLL('element'); $swapClass = 'ver-element'; $warnAboutVersions_nonPages = $warnAboutVersions_page; // Setting this if sub elements are found with a page+content (must be rendered prior to this of course!) break; case 'page': $swapLabel = $GLOBALS['LANG']->getLL('page'); $swapClass = 'ver-page'; $warnAboutVersions_page = !$this->showWorkspaceCol; // This value is true only if multiple workspaces are shown and we need the opposite here. break; case 'branch': $swapLabel = $GLOBALS['LANG']->getLL('branch'); $swapClass = 'ver-branch'; break; } // Modify main cell based on first version shown: $subElements = array(); if ($table === 'pages' && $rec_off['t3ver_swapmode'] != -1 && $mainCell) { // For "Page" and "Branch" swap modes where $mainCell is still carrying content (only first version) $subElements['on'] = $this->subElements($rec_on['uid'], $rec_off['t3ver_swapmode']); $subElements['off'] = $this->subElements($rec_off['uid'], $rec_off['t3ver_swapmode'], $rec_on['uid']); } $mainCell = str_replace('###SUB_ELEMENTS###', $subElements['on'], $mainCell); // Create version element: $versionsInOtherWS = $this->versionsInOtherWS($table, $rec_on['uid']); $versionsInOtherWSWarning = $versionsInOtherWS && $GLOBALS['BE_USER']->workspace !== 0 ? '<br />' . $this->doc->icons(2) . $GLOBALS['LANG']->getLL('otherVersions') . $versionsInOtherWS : ''; $multipleWarning = !$mainCell && $GLOBALS['BE_USER']->workspace !== 0 ? '<br />' . $this->doc->icons(3) . '<strong>' . $GLOBALS['LANG']->getLL('multipleVersions') . '</strong>' : ''; $verWarning = $warnAboutVersions || $warnAboutVersions_nonPages && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages'] ? '<br />' . $this->doc->icons(3) . '<strong>' . $GLOBALS['LANG']->getLL('versionInVersion') . '</strong>' : ''; $verElement = $icon . (!$this->details ? '<a href="' . htmlspecialchars($this->doc->backPath . t3lib_extMgm::extRelPath('version') . 'cm1/index.php?id=' . ($table === 'pages' ? $rec_on['uid'] : $rec_on['pid']) . '&details=' . rawurlencode($table . ':' . $rec_off['uid']) . '&returnUrl=' . rawurlencode($this->REQUEST_URI)) . '">' : '') . t3lib_BEfunc::getRecordTitle($table, $rec_off, TRUE) . (!$this->details ? '</a>' : '') . $versionsInOtherWSWarning . $multipleWarning . $verWarning; $ctrlTable = ' <td nowrap="nowrap">' . $this->showStageChangeLog($table, $rec_off['uid'], $this->displayWorkspaceOverview_stageCmd($table, $rec_off)) . '</td> <td nowrap="nowrap" class="' . $swapClass . '">' . $this->displayWorkspaceOverview_commandLinks($table, $rec_on, $rec_off, $vType) . htmlspecialchars($swapLabel) . ' </td> ' . (!$this->diffOnly ? '<td nowrap="nowrap"><strong>' . $GLOBALS['LANG']->getLL('lifecycle') . ':</strong> ' . htmlspecialchars($this->formatCount($rec_off['t3ver_count'])) . '</td>' . ($this->showWorkspaceCol ? ' <td nowrap="nowrap"> <strong>' . $GLOBALS['LANG']->getLL('workspace') . ':</strong> ' . htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])) . '</td>' : '') : ''); if ($diffCode) { $verElement = $verElement . ' <br /><strong>' . $GLOBALS['LANG']->getLL('diffToLiveElement') . '</strong> <table border="0" cellpadding="0" cellspacing="0" class="ver-verElement"> <tr> <td class="c-diffCell">' . $diffCode . '</td> </tr> </table>'; } // Create version cell: $verCell = ' <td align="center">' . $this->formatVerId($rec_off['t3ver_id']) . '</td> <td nowrap="nowrap">' . $verElement . $subElements['off'] . '</td> '; // Compile table row: $tableRows[] = ' <tr class="bgColor4"> ' . ($this->diffOnly ? '' : $mainCell) . $verCell . $ctrlTable . ' </tr>'; // Reset the main cell: $mainCell = ''; } } } } return $tableRows; }
/** * Print the content on a pad. Called from ->printClipboard() * * @param string Pad reference * @return array Array with table rows for the clipboard. * @access private */ function printContentFromTab($pad) { global $TBE_TEMPLATE; $lines = array(); if (is_array($this->clipData[$pad]['el'])) { foreach ($this->clipData[$pad]['el'] as $k => $v) { if ($v) { list($table, $uid) = explode('|', $k); $bgColClass = $table == '_FILE' && $this->fileMode || $table != '_FILE' && !$this->fileMode ? 'bgColor4-20' : 'bgColor4'; if ($table == '_FILE') { // Rendering files/directories on the clipboard: if (file_exists($v) && t3lib_div::isAllowedAbsPath($v)) { $fI = pathinfo($v); $icon = is_dir($v) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension'])); $size = ' (' . t3lib_div::formatSize(filesize($v)) . 'bytes)'; $icon = t3lib_iconWorks::getSpriteIconForFile(is_dir($v) ? 'folder' : strtolower($fI['extension']), array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars($fI['basename'] . $size))); $thumb = $this->clipData['_setThumb'] ? t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fI['extension']) ? t3lib_BEfunc::getThumbNail($this->backPath . 'thumbs.php', $v, ' vspace="4"') : '' : ''; $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $icon . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($v), $GLOBALS['BE_USER']->uc['titleLen'])), $v) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' ' . ($thumb ? '<br />' . $thumb : '') . '</td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $v . '\', \'\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl('_FILE', t3lib_div::shortmd5($v))) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; } else { // If the file did not exist (or is illegal) then it is removed from the clipboard immediately: unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } else { // Rendering records: $rec = t3lib_BEfunc::getRecordWSOL($table, $uid); if (is_array($rec)) { $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $this->linkItemText(t3lib_iconWorks::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' </td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . intval($uid) . '\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad); if ($localizationData) { $lines[] = $localizationData; } } else { unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } } } } if (!count($lines)) { $lines[] = ' <tr> <td class="bgColor4"><img src="clear.gif" width="56" height="1" alt="" /></td> <td colspan="2" class="bgColor4" nowrap="nowrap" width="95%"> <em>(' . $this->clLabel('clipNoEl') . ')</em> </td> </tr>'; } $this->endClipboard(); return $lines; }
/** * Creating the module output. * * @return void */ function main() { global $LANG, $BACK_PATH, $BE_USER; if ($this->page_id) { // Get record for element: $elRow = t3lib_BEfunc::getRecordWSOL($this->table, $this->moveUid); // Headerline: Icon, record title: $hline = t3lib_iconWorks::getSpriteIconForRecord($this->table, $elRow, array('id' => "c-recIcon", 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow, $this->table)))); $hline .= t3lib_BEfunc::getRecordTitle($this->table, $elRow, TRUE); // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently): $onClick = 'window.location.href=\'' . t3lib_div::linkThisScript(array('makeCopy' => !$this->makeCopy)) . '\';'; $hline .= '<br /><input type="hidden" name="makeCopy" value="0" /><input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy">' . $LANG->getLL('makeCopy', 1) . '</label>'; // Add the header-content to the module content: $this->content .= $this->doc->section($LANG->getLL('moveElement') . ':', $hline, 0, 1); $this->content .= $this->doc->spacer(20); // Reset variable to pick up the module content in: $code = ''; // IF the table is "pages": if ((string) $this->table == 'pages') { // Get page record (if accessible): $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = t3lib_div::makeInstance('ext_posMap_pages'); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). if ($pageinfo['pid']) { $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />'; } else { $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />'; } } } // Create the position tree: $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI); } } // IF the table is "tt_content": if ((string) $this->table == 'tt_content') { // First, get the record: $tt_content_rec = t3lib_BEfunc::getRecord('tt_content', $this->moveUid); // ? if (!$this->input_moveUid) { $this->page_id = $tt_content_rec['pid']; } // Checking if the parent page is readable: $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = t3lib_div::makeInstance('ext_posMap_tt_content'); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; $posMap->cur_sys_language = $this->sys_language; // Headerline for the parent page: Icon, record title: $hline = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageinfo, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($pageinfo, 'pages')))); $hline .= t3lib_BEfunc::getRecordTitle('pages', $pageinfo, TRUE); // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->page_id, 'mod.SHARED'); // SHARED page-TSconfig settings. $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3'; $colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $colPosList))); // Removing duplicates, if any // Adding parent page-header and the content element columns from position-map: $code = $hline . '<br />'; $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI); // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). $code .= '<br />'; $code .= '<br />'; if ($pageinfo['pid']) { $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />'; } else { $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />'; } } } // Create the position tree (for pages): $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI); } } // Add the $code content as a new section to the module: $this->content .= $this->doc->section($LANG->getLL('selectPositionOfElement') . ':', $code, 0, 1); } // 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($LANG->getLL('movingElement')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
function languageRows($languageList, $elementList) { // Initialization: $elements = $this->explodeElement($elementList); $firstEl = current($elements); $hookObj = t3lib_div::makeInstance('tx_l10nmgr_tcemain_hook'); $this->l10nMgrTools = t3lib_div::makeInstance('tx_l10nmgr_tools'); $this->l10nMgrTools->verbose = FALSE; // Otherwise it will show records which has fields but none editable. $inputRecord = t3lib_BEfunc::getRecord($firstEl[0], $firstEl[1], 'pid'); $this->sysLanguages = $this->l10nMgrTools->t8Tools->getSystemLanguages($firstEl[0] == 'pages' ? $firstEl[1] : $inputRecord['pid']); $languages = $this->getLanguages($languageList, $this->sysLanguages); if (count($languages)) { $tRows = array(); // Header: $cells = '<td class="bgColor2 tableheader">Element:</td>'; foreach ($languages as $l) { if ($l >= 1) { $baseRecordFlag = '<img src="' . htmlspecialchars($GLOBALS['BACK_PATH'] . $this->sysLanguages[$l]['flagIcon']) . '" alt="' . htmlspecialchars($this->sysLanguages[$l]['title']) . '" title="' . htmlspecialchars($this->sysLanguages[$l]['title']) . '" />'; $cells .= '<td class="bgColor2 tableheader">' . $baseRecordFlag . '</td>'; } } $tRows[] = $cells; foreach ($elements as $el) { $cells = ''; // Get CURRENT online record and icon based on "t3ver_oid": $rec_on = t3lib_BEfunc::getRecord($el[0], $el[1]); $icon = t3lib_iconWorks::getIconImage($el[0], $rec_on, $this->doc->backPath, ' align="top" title="' . t3lib_BEfunc::getRecordIconAltText($rec_on, $el[0]) . '"'); $icon = $this->doc->wrapClickMenuOnIcon($icon, $el[0], $rec_on['uid'], 2); $linkToIt = '<a href="#" onclick="' . htmlspecialchars('parent.list_frame.location.href="' . $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('l10nmgr') . 'cm2/index.php?table=' . $el[0] . '&uid=' . $el[1] . '"; return false;') . '" target="listframe"> ' . t3lib_BEfunc::getRecordTitle($el[0], $rec_on, TRUE) . ' </a>'; if ($el[0] == 'pages') { // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule')); $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; $path_module_path = t3lib_div::resolveBackPath($GLOBALS['BACK_PATH'] . '../' . substr($GLOBALS['TBE_MODULES']['_PATHS'][$pageModule], strlen(PATH_site))); $onclick = 'parent.list_frame.location.href="' . $path_module_path . '?id=' . $el[1] . '"; return false;'; $pmLink = '<a href="#" onclick="' . htmlspecialchars($onclick) . '" target="listframe"><i>[Edit page]</i></a>'; } else { $pmLink = ''; } $cells = '<td>' . $icon . $linkToIt . $pmLink . '</td>'; foreach ($languages as $l) { if ($l >= 1) { $cells .= '<td align="center">' . $hookObj->calcStat(array($el[0], $el[1]), $l) . '</td>'; } } $tRows[] = $cells; } return '<table border="0" cellpadding="0" cellspacing="0"><tr>' . implode('</tr><tr>', $tRows) . '</tr></table>'; } }