/** * Entry function that hooks into the main typo3/alt_clickmenu.php, * see ext_tables.php of this extension for more info * * @param $backRef the clickMenu object * @param $menuItems the menuItems as an array that are already filled from the main clickmenu * @param $table the table that is worked on (tx_dam_cat only) * @param $uid the item UID that is worked on * @return unknown */ function main(&$backRef, $menuItems, $table, $uid) { if ($table != 'tx_dam_cat') { return $menuItems; } $this->backRef =& $backRef; // Get record $this->rec = t3lib_BEfunc::getRecordWSOL($table, $uid); $menuItems = array(); $root = !strcmp($uid, '0') ? true : false; if (is_array($this->rec) || $root) { $lCP = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages', $root ? tx_dam_db::getPid() : $this->rec['pid'])); // Edit if (!$root && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') && !in_array('edit', $this->backRef->disabledItems)) { $menuItems['edit'] = $this->DAMcatEdit($table, $uid); } // New Category if (!in_array('new', $this->backRef->disabledItems) && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'new')) { $menuItems['new'] = $this->DAMnewSubCat($table, $uid); } // Info if (!in_array('info', $this->backRef->disabledItems) && !$root) { $menuItems['info'] = $this->DAMcatInfo($table, $uid); } // Delete $elInfo = array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen'])); if (!in_array('delete', $this->backRef->disabledItems) && !$root && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'delete')) { $menuItems['spacer2'] = 'spacer'; $menuItems['delete'] = $this->DAMcatDelete($table, $uid, $elInfo); } } return $menuItems; }
/** * Main function * * @return void */ function main() { switch ((string) t3lib_div::_GET('cmd')) { case 'menuitem': echo ' <img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />'; $menuItems = array(array('title' => 'About TYPO3', 'xurl' => 'http://typo3.com/', 'subitems' => array(array('title' => 'License', 'xurl' => 'http://typo3.com/License.1625.0.html'), array('title' => 'Support', 'subitems' => array(array('title' => 'Mailing lists', 'xurl' => 'http://lists.netfielders.de/cgi-bin/mailman/listinfo'), array('title' => 'Documentation', 'xurl' => 'http://typo3.org/documentation/'), array('title' => 'Find consultancy', 'xurl' => 'http://typo3.com/Consultancies.1248.0.html'))), array('title' => 'Contribute', 'xurl' => 'http://typo3.org/community/participate/'), array('title' => 'Donate', 'xurl' => 'http://typo3.com/Donations.1261.0.html', 'icon' => '1'))), array('title' => 'Extensions', 'url' => 'mod/tools/em/index.php'), array('title' => 'Menu preferences and such things', 'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();', 'state' => 'checked'), array('title' => '--div--'), array('title' => 'Recent Items', 'id' => $this->id . '_recent', 'subitems' => array(), 'html' => $this->menuItemObject($this->id . '_recent', ' fetched: false, onActivate: function() { // if (!this.fetched) { //Element.update("' . $this->id . '_recent-layer","asdfasdf"); getElementContent("' . $this->id . '_recent-layer", 0, "logomenu.php?cmd=recent") this.fetched = true; // } } ')), array('title' => '--div--'), array('title' => 'View frontend', 'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')), array('title' => 'Log out', 'onclick' => "top.document.location='logout.php';")); echo $this->menuLayer($menuItems); break; case 'recent': $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX', 'sys_log,pages', 'pages.uid=sys_log.event_pid AND sys_log.userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0', 'tablename,recuid', 'tstamp_MAX DESC', 20); $items = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $elRow = t3lib_BEfunc::getRecord($row['tablename'], $row['recuid']); if (is_array($elRow)) { $items[] = array('title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($row['tablename'], $elRow), $GLOBALS['BE_USER']->uc['titleLen']) . ' - ' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $row['tstamp_MAX']), 'icon' => array(t3lib_iconworks::getIcon($row['tablename'], $elRow), 'width="18" height="16"'), 'onclick' => 'content.' . t3lib_BEfunc::editOnClick('&edit[' . $row['tablename'] . '][' . $row['recuid'] . ']=edit', '', 'dummy.php')); } } echo $this->menuItems($items); break; } }
/** * Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader * * @param array $rows Array with table as key and array with all deleted rows * @param integer $totalDeleted: Number of deleted records in total, for PagingToolbar * @return string JSON Array **/ public function transform($deletedRowsArray, $totalDeleted) { $total = 0; $jsonArray = array('rows' => array()); // iterate if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) { foreach ($deletedRowsArray as $table => $rows) { $total += count($deletedRowsArray[$table]); foreach ($rows as $row) { $backendUser = t3lib_BEfunc::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE); $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'table' => $table, 'crdate' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => $backendUser['username'], 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => tx_recycler_helper::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => tx_recycler_helper::getUtf8String(t3lib_BEfunc::getRecordTitle($table, $row)), 'path' => tx_recycler_helper::getRecordPath($row['pid'])); } } } $jsonArray['total'] = $totalDeleted; return json_encode($jsonArray); }
function main(&$backRef, $menuItems, $tableID, $srcId) { $this->includeLocalLang(); $this->backRef =& $backRef; /** * TODO * * FIXME * backpath will not work in global installations */ if (($tableID == 'dragDrop_tt_news_cat' || $tableID == 'tt_news_cat_CM') && $srcId) { $table = 'tt_news_cat'; $rec = t3lib_BEfunc::getRecordWSOL($table, $srcId); // fetch page record to get editing permissions $lCP = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages', $rec['pid'])); $doEdit = $lCP & 16; //print_r( array($lCP)); if ($doEdit && $tableID == 'dragDrop_tt_news_cat') { $this->backRef->backPath = '../../../'; $dstId = intval(t3lib_div::_GP('dstId')); $menuItems['moveinto'] = $this->dragDrop_moveCategory($srcId, $dstId); $menuItems['copyinto'] = $this->dragDrop_copyCategory($srcId, $dstId); } if ($tableID == 'tt_news_cat_CM') { $this->backRef->backPath = '../../../../typo3/'; $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'] = $backRef->DB_info($table, $srcId); if ($doEdit) { $menuItems['hide'] = $this->DB_hideUnhide($table, $rec, 'hidden'); $elInfo = array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle('tt_news_cat', $rec), $GLOBALS['BE_USER']->uc['titleLen'])); $menuItems['spacer2'] = 'spacer'; $menuItems['delete'] = $this->DB_delete($table, $srcId, $elInfo); } } } return $menuItems; }
/** * Main function, creating content in the frame * * @return void */ function main() { global $BE_USER, $LANG, $TCA; // By default, 5 groups are set $this->groupLabels = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1); $shortCutGroups = $BE_USER->getTSConfig('options.shortcutGroups'); if (is_array($shortCutGroups['properties']) && count($shortCutGroups['properties'])) { foreach ($shortCutGroups['properties'] as $k => $v) { if (strcmp('', $v) && strcmp('0', $v)) { $this->groupLabels[$k] = (string) $v; } elseif ($BE_USER->isAdmin()) { unset($this->groupLabels[$k]); } } } // List of global groups that will be loaded. All global groups have negative IDs. $globalGroups = -100; // Group -100 is kind of superglobal and can't be changed. if (count($this->groupLabels)) { $globalGroups .= ',' . implode(',', array_keys($this->groupLabels)); $globalGroups = str_replace(',', ',-', $globalGroups); // Ugly hack to make the UIDs negative - is there any better solution? } // Fetching shortcuts to display for this user: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_be_shortcuts', '((userid=' . $BE_USER->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . $globalGroups . '))', '', 'sc_group,sorting'); // Init vars: $this->lines = array(); $this->linesPre = array(); $this->editSC_rec = ''; $this->selOpt = array(); $formerGr = ''; // Traverse shortcuts while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $mParts = explode('|', $row['module_name']); $row['module_name'] = $mParts[0]; $row['M_module_name'] = $mParts[1]; $mParts = explode('_', $row['M_module_name'] ? $row['M_module_name'] : $row['module_name']); $qParts = parse_url($row['url']); if (!$BE_USER->isAdmin()) { // Check for module access if (!isset($LANG->moduleLabels['tabs_images'][implode('_', $mParts) . '_tab'])) { // Nice hack to check if the user has access to this module - otherwise the translation label would not have been loaded :-) continue; } $page_id = $this->getLinkedPageId($row['url']); if (t3lib_div::testInt($page_id)) { // Check for webmount access if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) { continue; } // Check for record access $pageRow = t3lib_BEfunc::getRecord('pages', $page_id); if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) { continue; } } } if ($this->editSC && $row['uid'] == $this->editSC) { $this->editSC_rec = $row; } $sc_group = $row['sc_group']; if ($sc_group && strcmp($formerGr, $sc_group)) { if ($sc_group != -100) { if ($this->groupLabels[abs($sc_group)] && strcmp('1', $this->groupLabels[abs($sc_group)])) { $label = $this->groupLabels[abs($sc_group)]; } else { $label = $LANG->getLL('shortcut_group_' . abs($sc_group), 1); if (!$label) { $label = $LANG->getLL('shortcut_group', 1) . ' ' . abs($sc_group); } // Fallback label } if ($sc_group >= 0) { $onC = 'if (confirm(' . $GLOBALS['LANG']->JScharCode($LANG->getLL('shortcut_delAllInCat')) . ')){window.location.href=\'alt_shortcut.php?deleteCategory=' . $sc_group . '\';}return false;'; $this->linesPre[] = '<td> </td><td class="bgColor5"><a href="#" onclick="' . htmlspecialchars($onC) . '" title="' . $LANG->getLL('shortcut_delAllInCat', 1) . '">' . $label . '</a></td>'; } else { $label = $LANG->getLL('shortcut_global', 1) . ': ' . ($label ? $label : abs($sc_group)); // Fallback label $this->lines[] = '<td> </td><td class="bgColor5">' . $label . '</td>'; } unset($label); } } $bgColorClass = $row['uid'] == $this->editSC ? 'bgColor5' : ($row['sc_group'] < 0 ? 'bgColor6' : 'bgColor4'); if ($row['description'] && $row['uid'] != $this->editSC) { $label = $row['description']; } else { $label = t3lib_div::fixed_lgd_cs(rawurldecode($qParts['query']), 150); } $titleA = $this->itemLabel($label, $row['module_name'], $row['M_module_name']); $editSH = $row['sc_group'] >= 0 || $BE_USER->isAdmin() ? 'editSh(' . intval($row['uid']) . ');' : "alert('" . $LANG->getLL('shortcut_onlyAdmin') . "')"; $jumpSC = 'jump(unescape(\'' . rawurlencode($row['url']) . '\'),\'' . implode('_', $mParts) . '\',\'' . $mParts[0] . '\');'; $onC = 'if (document.shForm.editShortcut_check && document.shForm.editShortcut_check.checked){' . $editSH . '}else{' . $jumpSC . '}return false;'; if ($sc_group >= 0) { // user defined groups show up first $this->linesPre[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>'; } else { $this->lines[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>'; } if (trim($row['description'])) { $kkey = strtolower(substr($row['description'], 0, 20)) . '_' . $row['uid']; $this->selOpt[$kkey] = '<option value="' . htmlspecialchars($jumpSC) . '">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($row['description'], 50)) . '</option>'; } $formerGr = $row['sc_group']; } ksort($this->selOpt); array_unshift($this->selOpt, '<option>[' . $LANG->getLL('shortcut_selSC', 1) . ']</option>'); $this->editLoadedFunc(); $this->editPageIdFunc(); if (!$this->editLoaded && t3lib_extMgm::isLoaded('cms')) { $editIdCode = '<td nowrap="nowrap">' . $LANG->getLL('shortcut_editID', 1) . ': <input type="text" value="' . ($this->editError ? htmlspecialchars($this->editPage) : '') . '" name="editPage"' . $this->doc->formWidth(15) . ' onchange="submitEditPage(this.value);" />' . ($this->editError ? ' <strong><span class="typo3-red">' . htmlspecialchars($this->editError) . '</span></strong>' : '') . (is_array($this->theEditRec) ? ' <strong>' . $LANG->getLL('shortcut_loadEdit', 1) . ' \'' . t3lib_BEfunc::getRecordTitle('pages', $this->theEditRec, TRUE) . '\'</strong> (' . htmlspecialchars($this->editPath) . ')' : '') . ($this->searchFor ? ' ' . $LANG->getLL('shortcut_searchFor', 1) . ' <strong>\'' . htmlspecialchars($this->searchFor) . '\'</strong>' : '') . '</td>'; } else { $editIdCode = ''; } // Adding CSH: $editIdCode .= '<td> ' . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'shortcuts', $GLOBALS['BACK_PATH'], '', TRUE) . '</td>'; // Compile it all: $this->content .= ' <table border="0" cellpadding="0" cellspacing="0" width="99%"> <tr> <td> <!-- Shortcut Display Table: --> <table border="0" cellpadding="0" cellspacing="2" id="typo3-shortcuts"> <tr> '; if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShortcuts')) { $this->content .= implode(' ', $this->lines); } $this->content .= $editIdCode . ' </tr> </table> </td> <td align="right">'; if ($this->hasWorkspaceAccess()) { $this->content .= $this->workspaceSelector() . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'], '', TRUE); } $this->content .= ' </td> </tr> </table> '; // Launch Edit page: if ($this->theEditRec['uid']) { $this->content .= $this->doc->wrapScriptTags('top.loadEditId(' . $this->theEditRec['uid'] . ');'); } // Load alternative table/uid into editing form. if (count($this->alternativeTableUid) == 2 && isset($TCA[$this->alternativeTableUid[0]]) && t3lib_div::testInt($this->alternativeTableUid[1])) { $JSaction = t3lib_BEfunc::editOnClick('&edit[' . $this->alternativeTableUid[0] . '][' . $this->alternativeTableUid[1] . ']=edit', '', 'dummy.php'); $this->content .= $this->doc->wrapScriptTags('function editArbitraryElement() { top.content.' . $JSaction . '; } editArbitraryElement();'); } // Load search for something. if ($this->searchFor) { $firstMP = intval($GLOBALS['WEBMOUNTS'][0]); $this->content .= $this->doc->wrapScriptTags('jump(unescape("' . rawurlencode('db_list.php?id=' . $firstMP . '&search_field=' . rawurlencode($this->searchFor) . '&search_levels=4') . '"),"web_list","web");'); } }
/** * Displays the edit page screen if the currently selected page is of the doktype "Sysfolder" * * @param array $pageRecord: The current page record * @return mixed HTML output from this submodule or FALSE if this submodule doesn't feel responsible * @access public */ function renderDoktype_254($pageRecord) { global $LANG, $BE_USER, $TYPO3_CONF_VARS; // Prepare the record icon including a content sensitive menu link wrapped around it: $pageTitle = htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle('pages', $pageRecord), 50)); $recordIcon = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord); $iconEdit = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage')))); $editButton = $this->pObj->link_edit($iconEdit, 'pages', $pageRecord['uid']); if ($this->userHasAccessToListModule()) { if (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000) { $listModuleURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'db_list.php?id=' . intval($this->pObj->id); } else { $listModuleURL = t3lib_BEfunc::getModuleUrl('web_list', array('id' => intval($this->pObj->id)), ''); } $onClick = "top.nextLoadModuleUrl='" . $listModuleURL . "';top.fsMod.recentIds['web']=" . intval($this->pObj->id) . ";top.goToModule('web_list',1);"; $listModuleLink = '<br /><br />' . t3lib_iconWorks::getSpriteIcon('actions-system-list-open') . '<strong><a href="#" onClick="' . $onClick . '">' . $LANG->getLL('editpage_sysfolder_switchtolistview', '', 1) . '</a></strong> '; } else { $listModuleLink = $LANG->getLL('editpage_sysfolder_listview_noaccess', '', 1); } $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('editpage_sysfolder_intro', '', 1), '', t3lib_FlashMessage::INFO); $content = $flashMessage->render() . $listModuleLink; return $content; }
/** * Create configuration form * * @param array Form configurat data * @param array Table row accumulation variable. This is filled with table rows. * @return void Sets content in $this->content */ function makeConfigurationForm($inData, &$row) { global $LANG; $nameSuggestion = ''; // Page tree export options: if (isset($inData['pagetree']['id'])) { $nameSuggestion .= 'tree_PID' . $inData['pagetree']['id'] . '_L' . $inData['pagetree']['levels']; $row[] = ' <tr class="tableheader bgColor5"> <td colspan="2">' . $LANG->getLL('makeconfig_exportPagetreeConfiguration', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeCfg', $GLOBALS['BACK_PATH'], '') . '</td> </tr>'; $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_pageId', 1) . '</strong></td> <td>' . htmlspecialchars($inData['pagetree']['id']) . '<input type="hidden" value="' . htmlspecialchars($inData['pagetree']['id']) . '" name="tx_impexp[pagetree][id]" /></td> </tr>'; $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_tree', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeDisplay', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . ($this->treeHTML ? $this->treeHTML : $LANG->getLL('makeconfig_noTreeExportedOnly', 1)) . '</td> </tr>'; $opt = array('-2' => $LANG->getLL('makeconfig_tablesOnThisPage'), '-1' => $LANG->getLL('makeconfig_expandedTree'), '0' => $LANG->getLL('makeconfig_onlyThisPage'), '1' => $LANG->getLL('makeconfig_1Level'), '2' => $LANG->getLL('makeconfig_2Levels'), '3' => $LANG->getLL('makeconfig_3Levels'), '4' => $LANG->getLL('makeconfig_4Levels'), '999' => $LANG->getLL('makeconfig_infinite')); $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_levels', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeMode', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $this->renderSelectBox('tx_impexp[pagetree][levels]', $inData['pagetree']['levels'], $opt) . '</td> </tr>'; $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_includeTables', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeRecordLimit', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $this->tableSelector('tx_impexp[pagetree][tables]', $inData['pagetree']['tables'], 'pages') . '<br/> ' . $LANG->getLL('makeconfig_maxNumberOfRecords', 1) . '<br/> <input type="text" name="tx_impexp[pagetree][maxNumber]" value="' . htmlspecialchars($inData['pagetree']['maxNumber']) . '"' . $this->doc->formWidth(10) . ' /><br/> </td> </tr>'; } // Single record export: if (is_array($inData['record'])) { $row[] = ' <tr class="tableheader bgColor5"> <td colspan="2">' . $LANG->getLL('makeconfig_exportSingleRecord', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'singleRecord', $GLOBALS['BACK_PATH'], '') . '</td> </tr>'; foreach ($inData['record'] as $ref) { $rParts = explode(':', $ref); $tName = $rParts[0]; $rUid = $rParts[1]; $nameSuggestion .= $tName . '_' . $rUid; $rec = t3lib_BEfunc::getRecordWSOL($tName, $rUid); $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_record', 1) . '</strong></td> <td>' . t3lib_iconworks::getSpriteIconForRecord($tName, $rec) . t3lib_BEfunc::getRecordTitle($tName, $rec, TRUE) . '<input type="hidden" name="tx_impexp[record][]" value="' . htmlspecialchars($tName . ':' . $rUid) . '" /></td> </tr>'; } } // Single tables/pids: if (is_array($inData['list'])) { $row[] = ' <tr class="tableheader bgColor5"> <td colspan="2">' . $LANG->getLL('makeconfig_exportTablesFromPages', 1) . '</td> </tr>'; $tblList = ''; foreach ($inData['list'] as $ref) { $rParts = explode(':', $ref); $tName = $rParts[0]; if ($GLOBALS['BE_USER']->check('tables_select', $tName)) { $rec = t3lib_BEfunc::getRecordWSOL('pages', $rParts[1]); $tblList .= 'Table "' . $tName . '" from ' . t3lib_iconworks::getSpriteIconForRecord('pages', $rec) . t3lib_BEfunc::getRecordTitle('pages', $rec, TRUE) . '<input type="hidden" name="tx_impexp[list][]" value="' . htmlspecialchars($ref) . '" /><br/>'; } } $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_tablePids', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableList', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $tblList . '</td> </tr>'; $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_maxNumberOfRecords', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableListMaxNumber', $GLOBALS['BACK_PATH'], '') . '</strong></td> <td> <input type="text" name="tx_impexp[listCfg][maxNumber]" value="' . htmlspecialchars($inData['listCfg']['maxNumber']) . '"' . $this->doc->formWidth(10) . ' /><br/> </td> </tr>'; } $row[] = ' <tr class="tableheader bgColor5"> <td colspan="2">' . $LANG->getLL('makeconfig_relationsAndExclusions', 1) . '</td> </tr>'; // Add relation selector: $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_includeRelationsToTables', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'inclRelations', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $this->tableSelector('tx_impexp[external_ref][tables]', $inData['external_ref']['tables']) . '</td> </tr>'; // Add static relation selector: $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_useStaticRelationsFor', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'staticRelations', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $this->tableSelector('tx_impexp[external_static][tables]', $inData['external_static']['tables']) . '<br/> <label for="checkShowStaticRelations">' . $LANG->getLL('makeconfig_showStaticRelations', 1) . '</label> <input type="checkbox" name="tx_impexp[showStaticRelations]" id="checkShowStaticRelations" value="1"' . ($inData['showStaticRelations'] ? ' checked="checked"' : '') . ' /> </td> </tr>'; // Exclude: $excludeHiddenFields = ''; if (is_array($inData['exclude'])) { foreach ($inData['exclude'] as $key => $value) { $excludeHiddenFields .= '<input type="hidden" name="tx_impexp[exclude][' . $key . ']" value="1" />'; } } $row[] = ' <tr class="bgColor4"> <td><strong>' . $LANG->getLL('makeconfig_excludeElements', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'excludedElements', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $excludeHiddenFields . ' ' . (count($inData['exclude']) ? '<em>' . implode(', ', array_keys($inData['exclude'])) . '</em><hr/><label for="checkExclude">' . $LANG->getLL('makeconfig_clearAllExclusions', 1) . '</label> <input type="checkbox" name="tx_impexp[exclude]" id="checkExclude" value="1" />' : $LANG->getLL('makeconfig_noExcludedElementsYet', 1)) . ' </td> </tr>'; // Add buttons: $row[] = ' <tr class="bgColor4"> <td> </td> <td> <input type="submit" value="' . $LANG->getLL('makeadvanc_update', 1) . '" /> <input type="hidden" name="tx_impexp[download_export_name]" value="' . substr($nameSuggestion, 0, 30) . '" /> </td> </tr>'; }
/** * Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for 'pages'-records a link to the level of that record...) * * @param string Table name * @param integer Item uid * @param string Item title (not htmlspecialchars()'ed yet) * @param array Item row * @return string The item title. Ready for HTML output (is htmlspecialchars()'ed) */ function linkWrapItems($table, $uid, $code, $row) { // Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record...) if (!strcmp($code, '')) { $code = '<i>[' . $GLOBALS['LANG']->php3Lang['labels']['no_title'] . ']</i> - ' . t3lib_BEfunc::getRecordTitle($table, $row); } if ($table == 'pages') { return '<a href="' . $this->listURL($uid) . '">' . $code . '</a>'; } else { return $code; // return '<a href="javascript:top.launchView(\''.$table.'\','.$uid.');">'.$code.'</a>'; // This launches the show_item-windows } }
/** * Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record...) * * @param string Table name * @param integer UID (not used here) * @param string Title string * @param array Records array (from table name) * @return string */ function linkWrapItems($table, $uid, $code, $row) { global $TCA, $BACK_PATH; if (!$code) { $code = '<i>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title', 1) . ']</i>'; } else { $code = t3lib_BEfunc::getRecordTitlePrep($code, $this->fixedL); } $title = t3lib_BEfunc::getRecordTitle($table, $row, FALSE, TRUE); $ficon = t3lib_iconWorks::getIcon($table, $row); $aOnClick = "return insertElement('" . $table . "', '" . $row['uid'] . "', 'db', " . t3lib_div::quoteJSvalue($title) . ", '', '', '" . $ficon . "');"; $ATag = '<a href="#" onclick="' . $aOnClick . '">'; $ATag_alt = substr($ATag, 0, -4) . ',\'\',1);">'; $ATag_e = '</a>'; return $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' . $ATag_e . $ATag_alt . $code . $ATag_e; }
/** * Adds the record $row from $table. * No checking for relations done here. Pure data. * * @param string Table name * @param array Record row. * @param integer (Internal) if the record is added as a relation, this is set to the "level" it was on. * @return void */ function export_addRecord($table, $row, $relationLevel = 0) { t3lib_BEfunc::workspaceOL($table, $row); if (strcmp($table, '') && is_array($row) && $row['uid'] > 0 && !$this->excludeMap[$table . ':' . $row['uid']]) { if ($this->checkPID($table === 'pages' ? $row['uid'] : $row['pid'])) { if (!isset($this->dat['records'][$table . ':' . $row['uid']])) { // Prepare header info: $headerInfo = array(); $headerInfo['uid'] = $row['uid']; $headerInfo['pid'] = $row['pid']; $headerInfo['title'] = t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $row), 40); $headerInfo['size'] = strlen(serialize($row)); if ($relationLevel) { $headerInfo['relationLevel'] = $relationLevel; } // If record content is not too large in size, set the header content and add the rest: if ($headerInfo['size'] < $this->maxRecordSize) { // Set the header summary: $this->dat['header']['records'][$table][$row['uid']] = $headerInfo; // Create entry in the PID lookup: $this->dat['header']['pid_lookup'][$row['pid']][$table][$row['uid']] = 1; // Initialize reference index object: $refIndexObj = t3lib_div::makeInstance('t3lib_refindex'); $refIndexObj->WSOL = TRUE; // Yes to workspace overlays for exporting.... // Data: $this->dat['records'][$table . ':' . $row['uid']] = array(); $this->dat['records'][$table . ':' . $row['uid']]['data'] = $row; $this->dat['records'][$table . ':' . $row['uid']]['rels'] = $refIndexObj->getRelations($table, $row); $this->errorLog = array_merge($this->errorLog, $refIndexObj->errorLog); // Merge error logs. // Add information about the relations in the record in the header: $this->dat['header']['records'][$table][$row['uid']]['rels'] = $this->flatDBrels($this->dat['records'][$table . ':' . $row['uid']]['rels']); // Add information about the softrefs to header: $this->dat['header']['records'][$table][$row['uid']]['softrefs'] = $this->flatSoftRefs($this->dat['records'][$table . ':' . $row['uid']]['rels']); } else { $this->error('Record ' . $table . ':' . $row['uid'] . ' was larger than maxRecordSize (' . t3lib_div::formatSize($this->maxRecordSize) . ')'); } } else { $this->error('Record ' . $table . ':' . $row['uid'] . ' already added.'); } } else { $this->error('Record ' . $table . ':' . $row['uid'] . ' was outside your DB mounts!'); } } }
/** * Creates the editing form with TCEforms, based on the input from GPvars. * * @return string HTML form elements wrapped in tables */ function makeEditForm() { global $BE_USER, $LANG, $TCA; // Initialize variables: $this->elementsData = array(); $this->errorC = 0; $this->newC = 0; $thePrevUid = ''; $editForm = ''; $trData = NULL; // Traverse the GPvar edit array foreach ($this->editconf as $table => $conf) { // Tables: if (is_array($conf) && $TCA[$table] && $BE_USER->check('tables_modify', $table)) { // Traverse the keys/comments of each table (keys can be a commalist of uids) foreach ($conf as $cKey => $cmd) { if ($cmd == 'edit' || $cmd == 'new') { // Get the ids: $ids = t3lib_div::trimExplode(',', $cKey, 1); // Traverse the ids: foreach ($ids as $theUid) { // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...) // First, resetting flags. $hasAccess = 1; $deniedAccessReason = ''; $deleteAccess = 0; $this->viewId = 0; // If the command is to create a NEW record...: if ($cmd == 'new') { if (intval($theUid)) { // NOTICE: the id values in this case points to the page uid onto which the record should be create OR (if the id is negativ) to a record from the same table AFTER which to create the record. // Find parent page on which the new record reside if ($theUid < 0) { // Less than zero - find parent page $calcPRec = t3lib_BEfunc::getRecord($table, abs($theUid)); $calcPRec = t3lib_BEfunc::getRecord('pages', $calcPRec['pid']); } else { // always a page $calcPRec = t3lib_BEfunc::getRecord('pages', abs($theUid)); } // Now, calculate whether the user has access to creating new records on this position: if (is_array($calcPRec)) { $CALC_PERMS = $BE_USER->calcPerms($calcPRec); // Permissions for the parent page if ($table == 'pages') { // If pages: $hasAccess = $CALC_PERMS & 8 ? 1 : 0; #$this->viewId = $calcPRec['pid']; $this->viewId = 0; } else { $hasAccess = $CALC_PERMS & 16 ? 1 : 0; $this->viewId = $calcPRec['uid']; } } } $this->dontStoreDocumentRef = 1; // Don't save this document title in the document selector if the document is new. } else { // Edit: $calcPRec = t3lib_BEfunc::getRecord($table, $theUid); t3lib_BEfunc::fixVersioningPid($table, $calcPRec); if (is_array($calcPRec)) { if ($table == 'pages') { // If pages: $CALC_PERMS = $BE_USER->calcPerms($calcPRec); $hasAccess = $CALC_PERMS & 2 ? 1 : 0; $deleteAccess = $CALC_PERMS & 4 ? 1 : 0; $this->viewId = $calcPRec['uid']; } else { $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages', $calcPRec['pid'])); // Fetching pid-record first. $hasAccess = $CALC_PERMS & 16 ? 1 : 0; $deleteAccess = $CALC_PERMS & 16 ? 1 : 0; $this->viewId = $calcPRec['pid']; // Adding "&L=xx" if the record being edited has a languageField with a value larger than zero! if ($TCA[$table]['ctrl']['languageField'] && $calcPRec[$TCA[$table]['ctrl']['languageField']] > 0) { $this->viewId_addParams = '&L=' . $calcPRec[$TCA[$table]['ctrl']['languageField']]; } } // Check internals regarding access: if ($hasAccess) { $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec); $deniedAccessReason = $BE_USER->errorMsg; } } else { $hasAccess = 0; } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'] as $_funcRef) { $_params = array('table' => $table, 'uid' => $theUid, 'cmd' => $cmd, 'hasAccess' => $hasAccess); $hasAccess = t3lib_div::callUserFunction($_funcRef, $_params, $this); } } // AT THIS POINT we have checked the access status of the editing/creation of records and we can now proceed with creating the form elements: if ($hasAccess) { $prevPageID = is_object($trData) ? $trData->prevPageID : ''; $trData = t3lib_div::makeInstance('t3lib_transferData'); $trData->addRawData = TRUE; $trData->defVals = $this->defVals; $trData->lockRecords = 1; $trData->disableRTE = !$BE_USER->isRTE(); $trData->prevPageID = $prevPageID; $trData->fetchRecord($table, $theUid, $cmd == 'new' ? 'new' : ''); // 'new' reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); $rec['uid'] = $cmd == 'new' ? uniqid('NEW') : $theUid; if ($cmd == 'new') { $rec['pid'] = $theUid == 'prev' ? $thePrevUid : $theUid; } $this->elementsData[] = array('table' => $table, 'uid' => $rec['uid'], 'pid' => $rec['pid'], 'cmd' => $cmd, 'deleteAccess' => $deleteAccess); // Now, render the form: if (is_array($rec)) { // Setting visual path / title of form: $this->generalPathOfForm = $this->tceforms->getRecordPath($table, $rec); if (!$this->storeTitle) { $this->storeTitle = $this->recTitle ? htmlspecialchars($this->recTitle) : t3lib_BEfunc::getRecordTitle($table, $rec, TRUE); } // Setting variables in TCEforms object: $this->tceforms->hiddenFieldList = ''; $this->tceforms->globalShowHelp = $this->disHelp ? 0 : 1; if (is_array($this->overrideVals[$table])) { $this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]); } // Register default language labels, if any: $this->tceforms->registerDefaultLanguageData($table, $rec); // Create form for the record (either specific list of fields or the whole record): $panel = ''; if ($this->columnsOnly) { if (is_array($this->columnsOnly)) { $panel .= $this->tceforms->getListedFields($table, $rec, $this->columnsOnly[$table]); } else { $panel .= $this->tceforms->getListedFields($table, $rec, $this->columnsOnly); } } else { $panel .= $this->tceforms->getMainFields($table, $rec); } $panel = $this->tceforms->wrapTotal($panel, $rec, $table); // Setting the pid value for new records: if ($cmd == 'new') { $panel .= '<input type="hidden" name="data[' . $table . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; $this->newC++; } // Display "is-locked" message: if ($lockInfo = t3lib_BEfunc::isRecordLocked($table, $rec['uid'])) { $lockedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($lockInfo['msg']), '', t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($lockedMessage); } // Combine it all: $editForm .= $panel; } $thePrevUid = $rec['uid']; } else { $this->errorC++; $editForm .= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.noEditPermission', 1) . '<br /><br />' . ($deniedAccessReason ? 'Reason: ' . htmlspecialchars($deniedAccessReason) . '<br /><br />' : ''); } } } } } } return $editForm; }
/** * Main function * * @return string Output HTML for the module. * @access public */ function main() { global $BACK_PATH, $LANG, $SOBE, $BE_USER, $TYPO3_DB; $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id, 'mod.SHARED'); $this->allAvailableLanguages = $this->getAvailableLanguages(0, true, true, true); $output = ''; $this->templavoilaAPIObj = t3lib_div::makeInstance('tx_templavoila_api'); // Showing the tree: // Initialize starting point of page tree: $treeStartingPoint = intval($this->pObj->id); $treeStartingRecord = t3lib_BEfunc::getRecord('pages', $treeStartingPoint); $depth = $this->pObj->MOD_SETTINGS['depth']; // Initialize tree object: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1)); // Creating top icon; the current page $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $treeStartingRecord); $tree->tree[] = array('row' => $treeStartingRecord, 'HTML' => $HTML); // Create the tree from starting point: if ($depth > 0) { $tree->getTree($treeStartingPoint, $depth, ''); } // Set CSS styles specific for this document: $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/', ' TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; } ', $this->pObj->content); // Process commands: if (t3lib_div::_GP('createReferencesForPage')) { $this->createReferencesForPage(t3lib_div::_GP('createReferencesForPage')); } if (t3lib_div::_GP('createReferencesForTree')) { $this->createReferencesForTree($tree); } // Traverse tree: $output = ''; $counter = 0; foreach ($tree->tree as $row) { $unreferencedElementRecordsArr = $this->getUnreferencedElementsRecords($row['row']['uid']); if (count($unreferencedElementRecordsArr)) { $createReferencesLink = '<a href="index.php?id=' . $this->pObj->id . '&createReferencesForPage=' . $row['row']['uid'] . '">Reference elements</a>'; } else { $createReferencesLink = ''; } $rowTitle = $row['HTML'] . t3lib_BEfunc::getRecordTitle('pages', $row['row'], TRUE); $cellAttrib = $row['row']['_CSSCLASS'] ? ' class="' . $row['row']['_CSSCLASS'] . '"' : ''; $tCells = array(); $tCells[] = '<td nowrap="nowrap"' . $cellAttrib . '>' . $rowTitle . '</td>'; $tCells[] = '<td>' . count($unreferencedElementRecordsArr) . '</td>'; $tCells[] = '<td nowrap="nowrap">' . $createReferencesLink . '</td>'; $output .= ' <tr class="bgColor' . ($counter % 2 ? '-20' : '-10') . '"> ' . implode(' ', $tCells) . ' </tr>'; $counter++; } // Create header: $tCells = array(); $tCells[] = '<td>Page:</td>'; $tCells[] = '<td>No. of unreferenced elements:</td>'; $tCells[] = '<td> </td>'; // Depth selector: $depthSelectorBox = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php'); $finalOutput = ' <br /> ' . $depthSelectorBox . ' <a href="index.php?id=' . $this->pObj->id . '&createReferencesForTree=1">Reference elements for whole tree</a><br /> <br /> <table border="0" cellspacing="1" cellpadding="0" class="lrPadding c-list"> <tr class="bgColor5 tableheader"> ' . implode(' ', $tCells) . ' </tr>' . $output . ' </table> '; return $finalOutput; }
/** * @param string $table Table name, present in TCA * @param array $row Row from table * @param bool $prep If set, result is prepared for output: The output is cropped to a limited length (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '<em>[No title]</em>' is returned (localized). Further, the output is htmlspecialchars()'ed * @param bool $forceResult If set, the function always returns an output. If no value is found for the title, '[No title]' is returned (localized). * @return string */ public function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE) { /** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */ return t3lib_BEfunc::getRecordTitle($table, $row, $prep, $forceResult); }
/** * Renders the display of Template Objects. * * @return void */ function renderTO() { if (intval($this->displayUid)>0) { $row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj',$this->displayUid); if (is_array($row)) { $tRows=array(); $tRows[]=' <tr class="bgColor5"> <td colspan="2"><strong>' . $GLOBALS['LANG']->getLL('renderTO_toDetails') . ':</strong>'. $this->cshItem('xMOD_tx_templavoila','mapping_to',$this->doc->backPath,''). '</td> </tr>'; // Get title and icon: $icon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_tmplobj', $row); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_tmplobj', $row); $title = t3lib_BEFunc::getRecordTitlePrep($GLOBALS['LANG']->sL($title)); $tRows[]=' <tr class="bgColor4"> <td>'.$GLOBALS['LANG']->getLL('templateObject').':</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_tmplobj', $row['uid'], 1) . $title . '</td> </tr>'; // Session data $sessionKey = $this->MCONF['name'] . '_validatorInfo:' . $row['uid']; $sesDat = array('displayFile' => $row['fileref']); $GLOBALS['BE_USER']->setAndSaveSessionData($sessionKey, $sesDat); // Find the file: $theFile = t3lib_div::getFileAbsFileName($row['fileref'],1); if ($theFile && @is_file($theFile)) { $relFilePath = substr($theFile,strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\''.t3lib_div::getIndpEnv('TYPO3_SITE_URL').$relFilePath.'\',\'FileView\');'; $tRows[]=' <tr class="bgColor4"> <td rowspan="2">'.$GLOBALS['LANG']->getLL('templateFile').':</td> <td><a href="#" onclick="'.htmlspecialchars($onCl).'">'.htmlspecialchars($relFilePath).'</a></td> </tr> <tr class="bgColor4"> <td> <a href="#" onclick ="openValidator(\'' . $sessionKey . '\');return false;"> ' . t3lib_iconWorks::getSpriteIcon('extensions-templavoila-htmlvalidate') . ' ' . $GLOBALS['LANG']->getLL('validateTpl') . ' </a> </td> </tr>'; // Finding Data Structure Record: $DSOfile=''; $dsValue = $row['datastructure']; if ($row['parent']) { $parentRec = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj',$row['parent'],'datastructure'); $dsValue=$parentRec['datastructure']; } if (tx_templavoila_div::canBeInterpretedAsInteger($dsValue)) { $DS_row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_datastructure',$dsValue); } else { $DSOfile = t3lib_div::getFileAbsFileName($dsValue); } if (is_array($DS_row) || @is_file($DSOfile)) { // Get main DS array: if (is_array($DS_row)) { // Get title and icon: $icon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_datastructure',$DS_row); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_datastructure', $DS_row); $title = t3lib_BEFunc::getRecordTitlePrep($GLOBALS['LANG']->sL($title)); $tRows[]=' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('renderTO_dsRecord') . ':</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_datastructure', $DS_row['uid'] , 1) . $title . '</td> </tr>'; // Link to updating DS/TO: $onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid'] . '&uid=' . $DS_row['uid'] . '&returnUrl=' . $this->returnUrl; $onClMsg = ' if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('renderTO_updateWarningConfirm')) . ')) { document.location=\''.$onCl.'\'; } return false; '; $tRows[]=' <tr class="bgColor4"> <td> </td> <td><input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('renderTO_editDSTO') . '" onclick="'.htmlspecialchars($onClMsg).'"/>'. $this->cshItem('xMOD_tx_templavoila','mapping_to_modifyDSTO',$this->doc->backPath,''). '</td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO($DS_row['dataprot']); } else { // Show filepath of external XML file: $relFilePath = substr($DSOfile,strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\''.t3lib_div::getIndpEnv('TYPO3_SITE_URL').$relFilePath.'\',\'FileView\');'; $tRows[]=' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('renderTO_dsFile') . ':</td> <td><a href="#" onclick="'.htmlspecialchars($onCl).'">'.htmlspecialchars($relFilePath).'</a></td> </tr>'; $onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid'] . '&uid=' . rawurlencode($DSOfile) . '&returnUrl=' . $this->returnUrl; $onClMsg = ' if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('renderTO_updateWarningConfirm')) . ')) { document.location=\''.$onCl.'\'; } return false; '; $tRows[]=' <tr class="bgColor4"> <td> </td> <td><input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('renderTO_editDSTO') . '" onclick="'.htmlspecialchars($onClMsg).'"/>'. $this->cshItem('xMOD_tx_templavoila','mapping_to_modifyDSTO',$this->doc->backPath,''). '</td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO('',$DSOfile); } // Write header of page: $content.= ' <!-- Template Object Header: --> <h3>' . $GLOBALS['LANG']->getLL('renderTO_toInfo') . ':</h3> <table border="0" cellpadding="2" cellspacing="1" id="c-toHeader"> '.implode('',$tRows).' </table> '; // If there is a valid data structure, draw table: if (is_array($dataStruct)) { // Working on Header and Body of HTML source: // -- Processing the header editing -- list($editContent,$currentHeaderMappingInfo) = $this->renderTO_editProcessing($dataStruct,$row,$theFile, 1); // Determine if DS is a template record and if it is a page template: $showBodyTag = !is_array($DS_row) || $DS_row['scope']==1 ? TRUE : FALSE; $parts = array(); $parts[] = array( 'label' => $GLOBALS['LANG']->getLL('tabTODetails'), 'content' => $content ); // -- Processing the head editing $headerContent.=' <!-- HTML header parts selection: --> <h3>'.$GLOBALS['LANG']->getLL('mappingHeadParts').': '.$this->cshItem('xMOD_tx_templavoila','mapping_to_headerParts',$this->doc->backPath,'').'</h3> '.$this->renderHeaderSelection($theFile,$currentHeaderMappingInfo,$showBodyTag,$editContent); $parts[] = array( 'label' => $GLOBALS['LANG']->getLL('tabHeadParts'), 'content' => $headerContent ); // -- Processing the body editing -- list($editContent,$currentMappingInfo) = $this->renderTO_editProcessing($dataStruct,$row,$theFile, 0); $bodyContent.=' <!-- Data Structure mapping table: --> <h3>'.$GLOBALS['LANG']->getLL('mappingBodyParts').':</h3> '.$this->renderTemplateMapper($theFile,$this->displayPath,$dataStruct,$currentMappingInfo,$editContent); $parts[] = array( 'label' => $GLOBALS['LANG']->getLL('tabBodyParts'), 'content' => $bodyContent ); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoDSfound'), $dsValue); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoDSfound'), $dsValue); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorFileNotFound'), $row['fileref']); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoTOfound'), $this->displayUid); $parts[0]['content'] = $content; } else { $this->content.=$this->doc->section($GLOBALS['LANG']->getLL('templateObject').' '.$GLOBALS['LANG']->getLL('error'), $GLOBALS['LANG']->getLL('errorNoUidFound'),0,1,3); } // show tab menu if (is_array($parts)) { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('mappingTitle'), ''. $this->doc->getDynTabMenu($parts,'TEMPLAVOILA:templateModule:'.$this->id, 0,0,300) ,0,1); } }
/** * Renders Content Elements from the tt_content table from page id * * @param integer Page id * @return string HTML for the listing */ function getTable_tt_content($id) { global $TCA; $this->initializeLanguages(); // Initialize: $RTE = $GLOBALS['BE_USER']->isRTE(); $lMarg = 1; $showHidden = $this->tt_contentConfig['showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content'); $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(t3lib_BEfunc::getRecordTitle('pages', t3lib_BEfunc::getRecordWSOL('pages', $id), TRUE)); $GLOBALS['SOBE']->doc->getPageRenderer()->loadExtJs(); $GLOBALS['SOBE']->doc->getPageRenderer()->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js'); // Get labels for CTypes and tt_content element fields in general: $this->CType_labels = array(); foreach ($TCA['tt_content']['columns']['CType']['config']['items'] as $val) { $this->CType_labels[$val[1]] = $GLOBALS['LANG']->sL($val[0]); } $this->itemLabels = array(); foreach ($TCA['tt_content']['columns'] as $name => $val) { $this->itemLabels[$name] = $GLOBALS['LANG']->sL($val['label']); } // Select display mode: if (!$this->tt_contentConfig['single']) { // MULTIPLE column display mode, side by side: // Setting language list: $langList = $this->tt_contentConfig['sys_language_uid']; if ($this->tt_contentConfig['languageMode']) { if ($this->tt_contentConfig['languageColsPointer']) { $langList = '0,' . $this->tt_contentConfig['languageColsPointer']; } else { $langList = implode(',', array_keys($this->tt_contentConfig['languageCols'])); } $languageColumn = array(); } $langListArr = explode(',', $langList); $defLanguageCount = array(); $defLangBinding = array(); // For EACH languages... : foreach ($langListArr as $lP) { // If NOT languageMode, then we'll only be through this once. $showLanguage = $this->defLangBinding && $lP == 0 ? ' AND sys_language_uid IN (0,-1)' : ' AND sys_language_uid=' . $lP; $cList = explode(',', $this->tt_contentConfig['cols']); $content = array(); $head = array(); // For EACH column, render the content into a variable: foreach ($cList as $key) { if (!$lP) { $defLanguageCount[$key] = array(); } // Select content elements from this column/language: $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage); $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script: if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $onClick = "window.location.href='db_new_content_el.php?id=" . $id . '&colPos=' . intval($key) . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';"; $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent')); $content[$key] .= '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton; } // Traverse any selected elements and render their display code: $rowArr = $this->getResult($result); foreach ($rowArr as $rKey => $row) { if (is_array($row) && (int) $row['t3ver_state'] != 2) { $singleElementHTML = ''; if (!$lP) { $defLanguageCount[$key][] = $row['uid']; } $editUidList .= $row['uid'] . ','; $singleElementHTML .= $this->tt_content_drawHeader($row, $this->tt_contentConfig['showInfo'] ? 15 : 5, $this->defLangBinding && $lP > 0, TRUE); $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext'); $singleElementHTML .= '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>' . $this->tt_content_drawItem($row, $isRTE) . '</div>'; // NOTE: this is the end tag for <div class="t3-page-ce-body"> // because of bad (historic) conception, starting tag has to be placed inside tt_content_drawHeader() $singleElementHTML .= '</div>'; $statusHidden = $this->isDisabled('tt_content', $row) ? ' t3-page-ce-hidden' : ''; $singleElementHTML = '<div class="t3-page-ce' . $statusHidden . '">' . $singleElementHTML . '</div>'; if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) { $defLangBinding[$key][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML; } else { $content[$key] .= $singleElementHTML; } } else { unset($rowArr[$rKey]); } } // Add new-icon link, header: $newP = $this->newContentElementOnClick($id, $key, $lP); $head[$key] .= $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key), $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '', $newP); $editUidList = ''; } // For EACH column, fit the rendered content into a table cell: $out = ''; foreach ($cList as $k => $key) { if (!$k) { $out .= ' <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td>'; } else { $out .= ' <td><img src="clear.gif" width="4" height="1" alt="" /></td> <td bgcolor="#cfcfcf"><img src="clear.gif" width="1" height="1" alt="" /></td> <td><img src="clear.gif" width="4" height="1" alt="" /></td>'; } $out .= ' <td class="t3-page-column t3-page-column-' . $key . '">' . $head[$key] . $content[$key] . '</td>'; // Storing content for use if languageMode is set: if ($this->tt_contentConfig['languageMode']) { $languageColumn[$key][$lP] = $head[$key] . $content[$key]; if (!$this->defLangBinding) { $languageColumn[$key][$lP] .= '<br /><br />' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP); } } } // Wrap the cells into a table row: $out = ' <table border="0" cellpadding="0" cellspacing="0" class="t3-page-columns"> <tr>' . $out . ' </tr> </table>'; // CSH: $out .= t3lib_BEfunc::cshItem($this->descrTable, 'columns_multi', $GLOBALS['BACK_PATH']); } // If language mode, then make another presentation: // Notice that THIS presentation will override the value of $out! But it needs the code above to execute since $languageColumn is filled with content we need! if ($this->tt_contentConfig['languageMode']) { // Get language selector: $languageSelector = $this->languageSelector($id); // Reset out - we will make new content here: $out = ''; // Separator between language columns (black thin line) $midSep = ' <td><img src="clear.gif" width="4" height="1" alt="" /></td> <td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td> <td><img src="clear.gif" width="4" height="1" alt="" /></td>'; // Traverse languages found on the page and build up the table displaying them side by side: $cCont = array(); $sCont = array(); foreach ($langListArr as $lP) { // Header: $cCont[$lP] = ' <td valign="top" align="center" class="bgColor6"><strong>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</strong></td>'; // "View page" icon is added: $viewLink = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id, $this->backPath, t3lib_BEfunc::BEgetRootLine($this->id), '', '', '&L=' . $lP)) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>'; // Language overlay page header: if ($lP) { list($lpRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($lP)); t3lib_BEfunc::workspaceOL('pages_language_overlay', $lpRecord); $params = '&edit[pages_language_overlay][' . $lpRecord['uid'] . ']=edit&overrideVals[pages_language_overlay][sys_language_uid]=' . $lP; $lPLabel = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getSpriteIconForRecord('pages_language_overlay', $lpRecord), $lpRecord['uid']) . $viewLink . ($GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay') ? '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>' : '') . htmlspecialchars(t3lib_div::fixed_lgd_cs($lpRecord['title'], 20)); } else { $lPLabel = $viewLink; } $sCont[$lP] = ' <td nowrap="nowrap">' . $lPLabel . '</td>'; } // Add headers: $out .= ' <tr class="bgColor5">' . implode($midSep, $cCont) . ' </tr>'; $out .= ' <tr class="bgColor5">' . implode($midSep, $sCont) . ' </tr>'; // Traverse previously built content for the columns: foreach ($languageColumn as $cKey => $cCont) { $out .= ' <tr> <td valign="top">' . implode('</td>' . $midSep . ' <td valign="top">', $cCont) . '</td> </tr>'; if ($this->defLangBinding) { // "defLangBinding" mode foreach ($defLanguageCount[$cKey] as $defUid) { $cCont = array(); foreach ($langListArr as $lP) { $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . '<br/>' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid), $id, $lP), $lP); } $out .= ' <tr> <td valign="top">' . implode('</td>' . $midSep . ' <td valign="top">', $cCont) . '</td> </tr>'; } // Create spacer: $cCont = array(); foreach ($langListArr as $lP) { $cCont[] = ' '; } $out .= ' <tr> <td valign="top">' . implode('</td>' . $midSep . ' <td valign="top">', $cCont) . '</td> </tr>'; } } // Finally, wrap it all in a table and add the language selector on top of it: $out = $languageSelector . ' <table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-langMode"> ' . $out . ' </table>'; // CSH: $out .= t3lib_BEfunc::cshItem($this->descrTable, 'language_list', $GLOBALS['BACK_PATH']); } } else { // SINGLE column mode (columns shown beneath each other): #debug('single column'); if ($this->tt_contentConfig['sys_language_uid'] == 0 || !$this->defLangBinding) { // Initialize: if ($this->defLangBinding && $this->tt_contentConfig['sys_language_uid'] == 0) { $showLanguage = ' AND sys_language_uid IN (0,-1)'; $lP = 0; } else { $showLanguage = ' AND sys_language_uid=' . $this->tt_contentConfig['sys_language_uid']; $lP = $this->tt_contentConfig['sys_language_uid']; } $cList = explode(',', $this->tt_contentConfig['showSingleCol']); $content = array(); $out = ''; // Expand the table to some preset dimensions: $out .= ' <tr> <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td> <td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td> <td><img src="clear.gif" width="10" height="1" alt="" /></td> <td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td> </tr>'; // Traverse columns to display top-on-top foreach ($cList as $counter => $key) { // Select content elements: $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage); $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); $c = 0; $rowArr = $this->getResult($result); $rowOut = ''; // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script: if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $onClick = "window.location.href='db_new_content_el.php?id=" . $id . '&colPos=' . intval($key) . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';"; $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent')); $theNewButton = '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton; } else { $theNewButton = ''; } // Traverse any selected elements: foreach ($rowArr as $rKey => $row) { if (is_array($row) && (int) $row['t3ver_state'] != 2) { $c++; $editUidList .= $row['uid'] . ','; $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext'); // Create row output: $rowOut .= ' <tr> <td></td> <td valign="top">' . $this->tt_content_drawHeader($row) . '</td> <td> </td> <td' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . ' valign="top">' . $this->tt_content_drawItem($row, $isRTE) . '</td> </tr>'; // If the element was not the last element, add a divider line: if ($c != $GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $rowOut .= ' <tr> <td></td> <td colspan="3"><img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/stiblet_medium2.gif', 'width="468" height="1"') . ' class="c-divider" alt="" /></td> </tr>'; } } else { unset($rowArr[$rKey]); } } // Add spacer between sections in the vertical list if ($counter) { $out .= ' <tr> <td></td> <td colspan="3"><br /><br /><br /><br /></td> </tr>'; } // Add section header: $newP = $this->newContentElementOnClick($id, $key, $this->tt_contentConfig['sys_language_uid']); $out .= ' <!-- Column header: --> <tr> <td></td> <td valign="top" colspan="3">' . $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key), $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '', $newP) . $theNewButton . '<br /></td> </tr>'; // Finally, add the content from the records in this column: $out .= $rowOut; } // Finally, wrap all table rows in one, big table: $out = ' <table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode"> ' . $out . ' </table>'; // CSH: $out .= t3lib_BEfunc::cshItem($this->descrTable, 'columns_single', $GLOBALS['BACK_PATH']); } else { $out = '<br/><br/>' . $GLOBALS['SOBE']->doc->icons(1) . 'Sorry, you cannot view a single language in this localization mode (Default Language Binding is enabled)<br/><br/>'; } } // Add the big buttons to page: if ($this->option_showBigButtons) { $bArray = array(); if (!$GLOBALS['SOBE']->current_sys_language) { if ($this->ext_CALC_PERMS & 2) { $bArray[0] = $GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages][' . $id . "]=edit", $this->backPath, ''), $GLOBALS['LANG']->getLL('editPageProperties')); } } else { if ($this->doEdit && $GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay')) { list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($GLOBALS['SOBE']->current_sys_language)); $bArray[0] = $GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages_language_overlay][' . $languageOverlayRecord['uid'] . "]=edit", $this->backPath, ''), $GLOBALS['LANG']->getLL('editPageProperties_curLang')); } } if ($this->ext_CALC_PERMS & 4 || $this->ext_CALC_PERMS & 2) { $bArray[1] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='" . $this->backPath . "move_el.php?table=pages&uid=" . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('move_page')); } if ($this->ext_CALC_PERMS & 8) { $bArray[2] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='" . $this->backPath . "db_new.php?id=" . $id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('newPage2')); } if ($this->doEdit && $this->ext_function == 1) { $bArray[3] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='db_new_content_el.php?id=" . $id . '&sys_language_uid=' . $GLOBALS['SOBE']->current_sys_language . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('newPageContent2')); } $out = ' <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons"> <tr> <td>' . implode('</td> <td>', $bArray) . '</td> <td>' . t3lib_BEfunc::cshItem($this->descrTable, 'button_panel', $GLOBALS['BACK_PATH']) . '</td> </tr> </table> <br /> ' . $out; } // Return content: return $out; }
/** * Render a single item in a subelement list into a table row: * * @param array Table rows, passed by reference * @param string Table name * @param integer Page uid for which the subelements are selected/shown * @param array Row of element in list * @param integer The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version. * @param integer Mode of icon display: 0=not the last, 1= is the last in list (make joinbottom icon then), 2=do not shown icons are all (for pages from the page tree already rendered) * @param string Prefix HTML data (icons for tree rendering) * @return void (Content accumulated in $tCell!) */ function subElements_renderItem(&$tCell, $tN, $uid, $rec, $origId, $iconMode, $HTMLdata) { global $TCA; // Initialize: $origUidFields = $TCA[$tN]['ctrl']['origUid']; $diffCode = ''; if ($origUidFields) { // If there is a field for this table with original uids we will use that to connect records: if (!$origId) { // In case we are displaying the online originals: $this->targets['orig_' . $uid . '_' . $tN . '_' . $rec['uid']] = $rec; // Build up target array (important that $tdParams = ' id="orig_' . $uid . '_' . $tN . '_' . $rec['uid'] . '" class="typo3-ver"'; // Setting ID of the table row } else { // Version branch: if ($this->targets['orig_' . $origId . '_' . $tN . '_' . $rec[$origUidFields]]) { // If there IS a corresponding original record...: // Prepare Table row parameters: $tdParams = ' onmouseover="hlSubelements(\'' . $origId . '_' . $tN . '_' . $rec[$origUidFields] . '\', \'' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '\', 1, ' . ($this->MOD_SETTINGS['diff'] == 2 ? 1 : 0) . ');"' . ' onmouseout="hlSubelements(\'' . $origId . '_' . $tN . '_' . $rec[$origUidFields] . '\', \'' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '\', 0, ' . ($this->MOD_SETTINGS['diff'] == 2 ? 1 : 0) . ');"' . ' id="ver_' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '" class="typo3-ver"'; // Create diff view: if ($this->MOD_SETTINGS['diff']) { list($diffHTML, $diffPct) = $this->createDiffView($tN, $rec, $this->targets['orig_' . $origId . '_' . $tN . '_' . $rec[$origUidFields]]); if ($this->MOD_SETTINGS['diff'] == 2) { $diffCode = ($diffPct ? '<span class="nobr">' . $diffPct . '% change</span>' : '-') . '<div style="visibility: hidden; position: absolute;" id="diff_' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '" class="diffLayer">' . $diffHTML . '</div>'; } else { $diffCode = ($diffPct < 0 ? $GLOBALS['LANG']->getLL('notAvailable') : ($diffPct ? $diffPct . '% ' . $GLOBALS['LANG']->getLL('change') : '')) . $diffHTML; } } // Unsetting the target fields allows us to mark all originals without a version in the subtree (see ->markupNewOriginals()) unset($this->targets['orig_' . $origId . '_' . $tN . '_' . $rec[$origUidFields]]); } else { // No original record, so must be new: $tdParams = ' class="typo3-ver-new"'; } } } else { // If no original uid column is supported for this table we are forced NOT to display any diff or highlighting. $tdParams = ' class="typo3-ver-noComp"'; } // Compile the cell: $tCell[] = ' <tr' . $tdParams . '> <td class="iconTitle">' . $HTMLdata . ($iconMode < 2 ? '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/join' . ($iconMode ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . t3lib_iconWorks::getSpriteIconForRecord($tN, $rec) : '') . t3lib_BEfunc::getRecordTitle($tN, $rec, TRUE) . '</td> <td class="cmdCell">' . $this->displayWorkspaceOverview_commandLinksSub($tN, $rec, $origId) . '</td>' . ($origId ? '<td class="diffCell">' . $diffCode . '</td>' : '') . ' </tr>'; }
/** * Rendering the encode-cache content * * @param array The Page tree data * @return string HTML for the information table. */ function encodeView(t3lib_pageTree $tree) { // Delete entries: $cmd = t3lib_div::_GP('cmd'); $subcmd = ''; if ($cmd === 'deleteEC') { $subcmd = t3lib_div::_GP('entry'); $this->clearDEncodeCache($subcmd); } // Traverse tree: $cc = 0; $countDisplayed = 0; $output = ''; $duplicates = array(); foreach($tree->tree as $row) { // Select rows: $displayRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_realurl_urlencodecache','page_id='.intval($row['row']['uid']),'','content'); // Row title: $rowTitle = $row['HTML'].t3lib_BEfunc::getRecordTitle('pages',$row['row'],TRUE); // Add at least one empty element: if (!count($displayRows) || $subcmd==='displayed') { // Add title: $tCells = array(); $tCells[]='<td nowrap="nowrap">'.$rowTitle.'</td>'; $tCells[]='<td nowrap="nowrap"> </td>'; // Empty row: $tCells[]='<td colspan="7" align="center"> </td>'; // Compile Row: $output.= ' <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> '.implode(' ',$tCells).' </tr>'; $cc++; if ($subcmd==='displayed') { foreach($displayRows as $c => $inf) { $this->clearDEncodeCache('urlhash_'.$inf['url_hash']); } } } else { foreach($displayRows as $c => $inf) { // Add icon/title and ID: $tCells = array(); if (!$c) { $tCells[]='<td nowrap="nowrap" rowspan="'.count($displayRows).'">'.$rowTitle.'</td>'; $tCells[]='<td nowrap="nowrap" rowspan="'.count($displayRows).'">'.$row['row']['uid'].'</td>'; $tCells[]='<td rowspan="'.count($displayRows).'">'. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=page_'.intval($row['row']['uid'])).'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete entries for page" alt="" />'. '</a>'. '</td>'; } // Get vars: $tCells[]='<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($inf['origparams'], 100)).'</td>'; // Internal Extras: $tCells[]='<td>'.($inf['internalExtras'] ? t3lib_div::arrayToLogString(unserialize($inf['internalExtras'])) : ' ').'</td>'; // Path: $tCells[]='<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($inf['content'],100)).'</td>'; // Delete: $tCells[]='<td>'. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=urlhash_'.intval($inf['url_hash'])).'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete entry" alt="" />'. '</a>'. '</td>'; // Error: $eMsg = ($duplicates[$inf['content']] && $duplicates[$inf['content']] !== $row['row']['uid'] ? $this->pObj->doc->icons(2).'Already used on page ID '.$duplicates[$inf['content']].'<br/>' : ''); if (count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('url_hash','tx_realurl_redirects','url_hash='.intval(t3lib_div::md5int($inf['content']))))) { $eMsg.= $this->pObj->doc->icons(3).'Also a redirect!'; } $tCells[]='<td>'.$eMsg.'</td>'; // Timestamp: $tCells[]='<td>'.htmlspecialchars(t3lib_BEfunc::datetime($inf['tstamp'])).' / '.htmlspecialchars(t3lib_BEfunc::calcAge(time()-$inf['tstamp'])).'</td>'; // Compile Row: $output.= ' <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> '.implode(' ',$tCells).' </tr>'; $cc++; $countDisplayed++; if (!isset($duplicates[$inf['content']])) { $duplicates[$inf['content']] = $row['row']['uid']; } } } } list($count_allInTable) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('count(*) AS count','tx_realurl_urlencodecache',''); // Create header: $tCells = array(); $tCells[]='<td>Title:</td>'; $tCells[]='<td>ID:</td>'; $tCells[]='<td> </td>'; $tCells[]='<td>Host | GET variables:</td>'; $tCells[]='<td>Internal Extras:</td>'; $tCells[]='<td>Path:</td>'; $tCells[]='<td> </td>'; $tCells[]='<td>Errors:</td>'; $tCells[]='<td>Timestamp:</td>'; $output = ' <tr class="bgColor5 tableheader"> '.implode(' ',$tCells).' </tr>'.$output; // Compile final table and return: $output = ' <br/> <br/> Displayed entries: <b>'.$countDisplayed.'</b> '. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=displayed').'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete displayed entries" alt="" />'. '</a>'. '<br/> Total entries in encode cache: <b>'.$count_allInTable['count'].'</b> '. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=all').'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete WHOLE encode cache!" alt="" />'. '</a>'. '<br/> <table border="0" cellspacing="1" cellpadding="0" id="tx-realurl-pathcacheTable" class="lrPadding c-list">'.$output.' </table>'; return $output; }
/** * Shows the log of indexed URLs * * @return string HTML output */ function drawLog() { global $BACK_PATH; $output = ''; // Init: $this->crawlerObj = t3lib_div::makeInstance('tx_crawler_lib'); $this->crawlerObj->setAccessMode('gui'); $this->crawlerObj->setID = t3lib_div::md5int(microtime()); $this->CSVExport = t3lib_div::_POST('_csv'); // Read URL: if (t3lib_div::_GP('qid_read')) { $this->crawlerObj->readUrl(intval(t3lib_div::_GP('qid_read')), TRUE); } // Look for set ID sent - if it is, we will display contents of that set: $showSetId = intval(t3lib_div::_GP('setID')); // Show details: if (t3lib_div::_GP('qid_details')) { // Get entry record: list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid=' . intval(t3lib_div::_GP('qid_details'))); // Explode values: $resStatus = $this->getResStatus($q_entry); $q_entry['parameters'] = unserialize($q_entry['parameters']); $q_entry['result_data'] = unserialize($q_entry['result_data']); if (is_array($q_entry['result_data'])) { $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); } if (!$this->pObj->MOD_SETTINGS['log_resultLog']) { unset($q_entry['result_data']['content']['log']); } // Print rudimentary details: $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> Current server time: ' . date('H:i:s', time()) . '<br />' . 'Status: ' . $resStatus . '<br />' . (version_compare(TYPO3_version, '4.5.0', '<') ? t3lib_div::view_array($q_entry) : t3lib_utility_Debug::viewArray($q_entry)); } else { // Show list: // If either id or set id, show list: if ($this->pObj->id || $showSetId) { if ($this->pObj->id) { // Drawing tree: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $tree->init('AND ' . $perms_clause); // Set root row: $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML); // Get branch beneath: if ($this->pObj->MOD_SETTINGS['depth']) { $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); } // Traverse page tree: $code = ''; $count = 0; foreach ($tree->tree as $data) { $code .= $this->drawLog_addRows($data['row'], $data['HTML'] . t3lib_BEfunc::getRecordTitle('pages', $data['row'], TRUE), intval($this->pObj->MOD_SETTINGS['itemsPerPage'])); if (++$count == 1000) { break; } } } else { $code = ''; $code .= $this->drawLog_addRows($showSetId, 'Set ID: ' . $showSetId); } if ($code) { $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist') . '" name="_reload" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv') . '" name="_csv" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushvisiblequeue') . '" name="_flush" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushfullqueue') . '" name="_flush_all" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> ' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime') . ': ' . date('H:i:s', time()) . ' <br /><br /> <table class="lrPadding c-list crawlerlog">' . $this->drawLog_printTableHeader() . $code . '</table>'; } } else { // Otherwise show available sets: $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('set_id, count(*) as count_value, scheduled', 'tx_crawler_queue', '', 'set_id, scheduled', 'scheduled DESC'); $code = ' <tr class="bgColor5 tableheader"> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid') . ':</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count') . 't:</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time') . ':</td> </tr> '; $cc = 0; foreach ($setList as $set) { $code .= ' <tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '"> <td><a href="' . htmlspecialchars('index.php?setID=' . $set['set_id']) . '">' . $set['set_id'] . '</a></td> <td>' . $set['count_value'] . '</td> <td>' . t3lib_BEfunc::dateTimeAge($set['scheduled']) . '</td> </tr> '; $cc++; } $output .= ' <br /><br /> <table class="lrPadding c-list">' . $code . '</table>'; } } if ($this->CSVExport) { $this->outputCsvFile(); } // Return output return $output; }
/** * [Describe function...] * * @return [type] ... */ function setDefVals() { if (!is_int($this->row['uid'])) { // defVals only for new records $defVals = t3lib_div::_GP('defVals'); if (is_array($defVals) && $defVals[$this->table][$this->field]) { $defCat = intval($defVals[$this->table][$this->field]); /** * TODO: * check for allowed categories */ if ($defCat) { $row = t3lib_BEfunc::getRecord('tt_news_cat', $defCat); $title = t3lib_BEfunc::getRecordTitle($this->table, $row); $this->PA['itemFormElValue'] = $defCat . '|' . $title; $this->row['category'] = $this->PA['itemFormElValue']; } } } }
/** * [Describe function...] * * @param [type] $rec: ... * @return [type] ... */ function makeTableRow($rec) { //Render information for base record: $baseRecord = t3lib_BEfunc::getRecordWSOL($rec['tablename'], $rec['recuid']); $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($rec['tablename'], $baseRecord); $title = t3lib_BEfunc::getRecordTitle($rec['tablename'], $baseRecord, 1); $baseRecordFlag = '<img src="' . htmlspecialchars($GLOBALS['BACK_PATH'] . $this->sysLanguages[$rec['sys_language_uid']]['flagIcon']) . '" alt="" title="" />'; $tFlag = '<img src="' . htmlspecialchars($GLOBALS['BACK_PATH'] . $this->sysLanguages[$rec['translation_lang']]['flagIcon']) . '" alt="' . htmlspecialchars($this->sysLanguages[$rec['translation_lang']]['title']) . '" title="' . htmlspecialchars($this->sysLanguages[$rec['translation_lang']]['title']) . '" />'; $baseRecordStr = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[' . $rec['tablename'] . '][' . $rec['recuid'] . ']=edit', $this->doc->backPath)) . '">' . $icon . $title . '</a>'; // Render for translation if any: $translationRecord = false; if ($rec['translation_recuid']) { $translationTable = $this->l10nMgrTools->t8Tools->getTranslationTable($rec['tablename']); $translationRecord = t3lib_BEfunc::getRecordWSOL($translationTable, $rec['translation_recuid']); $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($translationTable, $translationRecord); $title = t3lib_BEfunc::getRecordTitle($translationTable, $translationRecord, 1); $translationRecStr = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[' . $translationTable . '][' . $translationRecord['uid'] . ']=edit', $this->doc->backPath)) . '">' . $icon . $title . '</a>'; } else { $translationRecStr = ''; } // Action: if (is_array($translationRecord)) { $action = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[' . $translationTable . '][' . $translationRecord['uid'] . ']=edit', $this->doc->backPath)) . '"><em>[Edit]</em></a>'; } elseif ($rec['sys_language_uid'] == -1) { $action = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[' . $rec['tablename'] . '][' . $rec['recuid'] . ']=edit', $this->doc->backPath)) . '"><em>[Edit]</em></a>'; } else { $action = '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $rec['tablename'] . '][' . $rec['recuid'] . '][localize]=' . $rec['translation_lang'])) . '"><em>[Localize]</em></a>'; } return '<tr class="bgColor4-20"> <td valign="top">' . $baseRecordFlag . '</td> <td valign="top" nowrap="nowrap">' . $baseRecordStr . '</td> <td valign="top">' . $tFlag . '</td> <td valign="top" nowrap="nowrap">' . $translationRecStr . '</td> <td valign="top">' . $action . '</td> <td align="center"' . ($rec['flag_new'] ? ' bgcolor="#91B5FF"' : '') . '>' . ($rec['flag_new'] ? $rec['flag_new'] : '') . '</td> <td align="center"' . ($rec['flag_unknown'] ? ' bgcolor="#FEFF5A"' : '') . '>' . ($rec['flag_unknown'] ? $rec['flag_unknown'] : '') . '</td> <td align="center"' . ($rec['flag_update'] ? ' bgcolor="#FF7161"' : '') . '>' . ($rec['flag_update'] ? $rec['flag_update'] : '') . '</td> <td align="center"' . ($rec['flag_noChange'] ? ' bgcolor="#78FF82"' : '') . '>' . ($rec['flag_noChange'] ? $rec['flag_noChange'] : '') . '</td> <td>' . implode('<br/>', unserialize($rec['serializedDiff'])) . '</td> </tr>'; }
/** * Adds the foreign record elements to $dataAcc, if any * * @param array Array with numeric keys, containing values for the selector box, prepared for interface. We are going to add elements to this array as needed. * @param array The array of original elements - basically the field value exploded by "," * @param array Field configuration from TCA * @param string The field name * @param array TSconfig for the record * @param array The record * @param array The current table * @return array Modified $dataAcc array * @access private * @see renderRecord_selectProc() */ function selectAddForeign($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row, $table) { global $TCA; // Init: $recordList = array(); // foreign_table $subres = t3lib_BEfunc::exec_foreign_table_where_query($fieldConfig, $field, $TSconfig); while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres)) { $recordList[$subrow['uid']] = t3lib_BEfunc::getRecordTitle($fieldConfig['config']['foreign_table'], $subrow); } // neg_foreign_table if (is_array($TCA[$fieldConfig['config']['neg_foreign_table']])) { $subres = t3lib_BEfunc::exec_foreign_table_where_query($fieldConfig, $field, $TSconfig, 'neg_'); while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres)) { $recordList[-$subrow['uid']] = t3lib_BEfunc::getRecordTitle($fieldConfig['config']['neg_foreign_table'], $subrow); } } // At this point all records that CAN be selected is found in $recordList // Now, get the data from loadDBgroup based on the input list of values. $dataIds = $this->getDataIdList($elements, $fieldConfig, $row, $table); if ($fieldConfig['config']['MM']) { $dataAcc = array(); } // Reset, if MM (which cannot bear anything but real relations!) // After this we can traverse the loadDBgroup values and match values with the list of possible values in $recordList: foreach ($dataIds as $theId) { if (isset($recordList[$theId])) { $lPrefix = $this->sL($fieldConfig['config'][($theId > 0 ? '' : 'neg_') . 'foreign_table_prefix']); if ($fieldConfig['config']['MM'] || $fieldConfig['config']['foreign_field']) { $dataAcc[] = rawurlencode($theId) . '|' . rawurlencode(t3lib_div::fixed_lgd_cs($lPrefix . strip_tags($recordList[$theId]), $GLOBALS['BE_USER']->uc['titleLen'])); } else { foreach ($elements as $eKey => $value) { if (!strcmp($theId, $value)) { $dataAcc[$eKey] = rawurlencode($theId) . '|' . rawurlencode(t3lib_div::fixed_lgd_cs($lPrefix . strip_tags($recordList[$theId]), $GLOBALS['BE_USER']->uc['titleLen'])); } } } } } return $dataAcc; }
/** * 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 */ 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); }
/** * Renders the display of Template Objects. * * @return void */ function renderTO() { if (intval($this->displayUid) > 0) { $row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj', $this->displayUid); if (is_array($row)) { $tRows = array(); $tRows[] = ' <tr class="bgColor5"> <td colspan="2"><strong>Template Object Details:</strong>' . $this->cshItem('xMOD_tx_templavoila', 'mapping_to', $this->doc->backPath, '') . '</td> </tr>'; // Get title and icon: $icon = t3lib_iconworks::getIconImage('tx_templavoila_tmplobj', $row, $GLOBALS['BACK_PATH'], ' align="top" title="UID: ' . $this->displayUid . '"'); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_tmplobj', $row, 1); $tRows[] = ' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('templateObject') . ':</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_tmplobj', $row['uid'], 1) . $title . '</td> </tr>'; // Find the file: $theFile = t3lib_div::getFileAbsFileName($row['fileref'], 1); if ($theFile && @is_file($theFile)) { $relFilePath = substr($theFile, strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\'' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $relFilePath . '\',\'FileView\');'; $tRows[] = ' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('templateFile') . ':</td> <td><a href="#" onclick="' . htmlspecialchars($onCl) . '">' . htmlspecialchars($relFilePath) . '</a></td> </tr>'; // Finding Data Structure Record: $DSOfile = ''; $dsValue = $row['datastructure']; if ($row['parent']) { $parentRec = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj', $row['parent'], 'datastructure'); $dsValue = $parentRec['datastructure']; } if (t3lib_div::testInt($dsValue)) { $DS_row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_datastructure', $dsValue); } else { $DSOfile = t3lib_div::getFileAbsFileName($dsValue); } if (is_array($DS_row) || @is_file($DSOfile)) { // Get main DS array: if (is_array($DS_row)) { // Get title and icon: $icon = t3lib_iconworks::getIconImage('tx_templavoila_datastructure', $DS_row, $GLOBALS['BACK_PATH'], ' align="top" title="UID: ' . $DS_row['uid'] . '"'); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_datastructure', $DS_row, 1); $tRows[] = ' <tr class="bgColor4"> <td>Data Structure Record:</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_datastructure', $DS_row['uid'], 1) . $title . '</td> </tr>'; // Link to updating DS/TO: $onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid']; $onClMsg = ' if (confirm(unescape(\'' . rawurlencode('Warning: You should only modify Data Structures and Template Objects which have not been manually edited.' . chr(10) . 'You risk that manual changes will be removed without further notice!') . '\'))) { document.location=\'' . $onCl . '\'; } return false; '; $tRows[] = ' <tr class="bgColor4"> <td> </td> <td><input type="submit" name="_" value="Modify DS / TO" onclick="' . htmlspecialchars($onClMsg) . '"/>' . $this->cshItem('xMOD_tx_templavoila', 'mapping_to_modifyDSTO', $this->doc->backPath, '') . '</td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO($DS_row['dataprot']); } else { // Show filepath of external XML file: $relFilePath = substr($DSOfile, strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\'' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $relFilePath . '\',\'FileView\');'; $tRows[] = ' <tr class="bgColor4"> <td>Data Structure File:</td> <td><a href="#" onclick="' . htmlspecialchars($onCl) . '">' . htmlspecialchars($relFilePath) . '</a></td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO('', $DSOfile); } // Write header of page: $content .= ' <!-- Template Object Header: --> <h3>Template Object Information:</h3> <table border="0" cellpadding="2" cellspacing="1" id="c-toHeader"> ' . implode('', $tRows) . ' </table> '; // If there is a valid data structure, draw table: if (is_array($dataStruct)) { // Working on Header and Body of HTML source: // -- Processing the header editing -- list($editContent, $currentHeaderMappingInfo) = $this->renderTO_editProcessing($dataStruct, $row, $theFile, 1); // Determine if DS is a template record and if it is a page template: $showBodyTag = !is_array($DS_row) || $DS_row['scope'] == 1 ? TRUE : FALSE; $parts = array(); $parts[] = array('label' => $GLOBALS['LANG']->getLL('tabTODetails'), 'content' => $content); // -- Processing the head editing $headerContent .= ' <!-- HTML header parts selection: --> <h3>' . $GLOBALS['LANG']->getLL('mappingHeadParts') . ': ' . $this->cshItem('xMOD_tx_templavoila', 'mapping_to_headerParts', $this->doc->backPath, '') . '</h3> ' . $this->renderHeaderSelection($theFile, $currentHeaderMappingInfo, $showBodyTag, $editContent); $parts[] = array('label' => $GLOBALS['LANG']->getLL('tabHeadParts'), 'content' => $headerContent); // -- Processing the body editing -- list($editContent, $currentMappingInfo) = $this->renderTO_editProcessing($dataStruct, $row, $theFile, 0); $bodyContent .= ' <!-- Data Structure mapping table: --> <h3>' . $GLOBALS['LANG']->getLL('mappingBodyParts') . ':</h3> ' . $this->renderTemplateMapper($theFile, $this->displayPath, $dataStruct, $currentMappingInfo, $editContent); $parts[] = array('label' => $GLOBALS['LANG']->getLL('tabBodyParts'), 'content' => $bodyContent); } else { $content .= $GLOBALS['LANG']->getLL('error') . ': No Data Structure Record could be found with UID "' . $dsValue . '"'; } } else { $content .= $GLOBALS['LANG']->getLL('error') . ': No Data Structure Record could be found with UID "' . $dsValue . '"'; } } else { $content .= $GLOBALS['LANG']->getLL('error') . ': The file "' . $row['fileref'] . '" could not be found!'; } } else { $content .= $GLOBALS['LANG']->getLL('error') . ': No Template Object Record with the UID ' . $this->displayUid; } $parts[0]['content'] = $content; } else { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('templateObject') . ' ' . $GLOBALS['LANG']->getLL('error'), $GLOBALS['LANG']->getLL('errorNoUidFound'), 0, 1, 3); } // show tab menu if (is_array($parts)) { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('mappingTitle'), '' . $this->doc->getDynTabMenu($parts, 'TEMPLAVOILA:templateModule:' . $this->id, 0, 0, 300), 0, 1); } }
/** * 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->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); $elRow = t3lib_BEfunc::getRecordWSOL('pages', $this->id); $header = t3lib_iconWorks::getSpriteIconForRecord('pages', $elRow); $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(); // Wrapper for wizards $this->elementWrapper['sectionHeader'] = array('<h3 class="bgColor5">', '</h3>'); $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>'); $this->elementWrapper['wizard'] = array('<tr>', '</tr>'); $this->elementWrapper['wizardPart'] = array('<td>', '</td>'); // copy wrapper for tabs $this->elementWrapperForTabs = $this->elementWrapper; // Hook for manipulating wizardItems, wrapper, onClickEvent etc. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['templavoila']['db_new_content_el']['wizardItemsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['templavoila']['db_new_content_el']['wizardItemsHook'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); if (!$hookObject instanceof cms_newContentElementWizardsHook) { throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 1227834741); } $hookObject->manipulateWizardItems($wizardItems, $this); } } if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) { // restore wrapper for tabs if they are overwritten in hook $this->elementWrapper = $this->elementWrapperForTabs; } // add document inline javascript $this->doc->JScode = $this->doc->wrapScriptTags(' function goToalt_doc() { // ' . $this->onClickEvent . ' } Event.observe(window, \'load\', function() { if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } if(top.shortcutFrame) { top.shortcutFrame.refreshShortcuts(); } }); '); // 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 $k => $wInfo) { if ($wInfo['header']) { $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]); $key = count($menuItems) - 1; } else { $content = ''; // href URI for icon/title: $newRecordLink = 'index.php?' . $this->linkParams() . '&createNewRecord=' . rawurlencode($this->parentRecord) . $wInfo['params']; // Icon: $iInfo = @getimagesize($wInfo['icon']); $content .= $this->elementWrapper['wizardPart'][0] . '<a href="' . htmlspecialchars($newRecordLink) . '"> <img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1]; // Title + description: $content .= $this->elementWrapper['wizardPart'][0] . '<a href="' . htmlspecialchars($newRecordLink) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' . $this->elementWrapper['wizardPart'][1]; // Finally, put it together in a container: $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1]; } } // add closing section-tag foreach ($menuItems as $key => $val) { $menuItems[$key]['content'] .= $this->elementWrapper['section'][1]; } // Add the wizard table to the content, wrapped in tabs: if ($this->config['renderMode'] == 'tabs') { $this->doc->inDocStylesArray[] = ' .typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #000; width: 680px; } .typo3-dyntabmenu-divs table { margin: 15px; } .typo3-dyntabmenu-divs table td { padding: 3px; } '; $code = $LANG->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', false, false, 100); } else { $code = $LANG->getLL('sel1', 1) . '<br /><br />'; foreach ($menuItems as $section) { $code .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $section['content']; } } $this->content .= $this->doc->section(!$this->onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1); } else { // In case of no access: $this->content = $this->doc->header($LANG->getLL('newContentElement')); } $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $docHeaderButtons = $this->getDocHeaderButtons(); $docContent = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content); $content = $this->doc->startPage($LANG->getLL('newContentElement')); $content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $docContent); $content .= $this->doc->endPage(); // Replace content with templated content $this->content = $content; }
/** * 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! * @return array The content tree * @access protected */ function getContentTree_element($table, $row, &$tt_content_elementRegister, $prevRecList = '') { global $TCA, $LANG; $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), 'icon' => t3lib_iconWorks::getIcon($table, $row), 'sys_language_uid' => $row['sys_language_uid'], 'l18n_parent' => $row['l18n_parent'], 'CType' => $row['CType']); 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'], 'type' => $fieldData['type'], 'section' => $fieldData['section'], 'data' => array(), 'subElements' => array(), 'isMapped' => is_array($templateMappingArr['MappingInfo']['ROOT']['el'][$fieldKey])); 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']; } } } // 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['sub'][$sheetKey][$lKey][$fieldKey][$vKey] = $this->getContentTree_processSubContent($listOfSubElementUids, $tt_content_elementRegister, $prevRecList); $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; }
/** * Prepare items from itemArray to be transferred to the TCEforms interface (as a comma list) * * @return string * @see t3lib_transferdata::renderRecord() */ function readyForInterface() { global $TCA; if (!is_array($this->itemArray)) { return false; } $output = array(); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); // For use when getting the paths.... $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']); foreach ($this->itemArray as $key => $val) { $theRow = $this->results[$val['table']][$val['id']]; if ($theRow && is_array($TCA[$val['table']])) { $label = t3lib_div::fixed_lgd_cs(strip_tags(t3lib_BEfunc::getRecordTitle($val['table'], $theRow)), $titleLen); $label = $label ? $label : '[...]'; $output[] = str_replace(',', '', $val['table'] . '_' . $val['id'] . '|' . rawurlencode($label)); } } return implode(',', $output); }
/** * Renders localized elements of a record * * @param array $contentTreeArr: Part of the contentTreeArr for the element * @param array $entries: Entries accumulated in this array (passed by reference) * @param integer $indentLevel: Indentation level * @return string HTML * @access protected * @see render_framework_singleSheet() */ function render_outline_localizations($contentTreeArr, &$entries, $indentLevel) { global $LANG, $BE_USER; if ($contentTreeArr['el']['table'] == 'tt_content' && $contentTreeArr['el']['sys_language_uid'] <= 0) { // Traverse the available languages of the page (not default and [All]) foreach ($this->translatedLanguagesArr as $sys_language_uid => $sLInfo) { if ($sys_language_uid > 0 && $BE_USER->checkLanguageAccess($sys_language_uid)) { switch ((string) $contentTreeArr['localizationInfo'][$sys_language_uid]['mode']) { case 'exists': // Get localized record: $olrow = t3lib_BEfunc::getRecordWSOL('tt_content', $contentTreeArr['localizationInfo'][$sys_language_uid]['localization_uid']); // Put together the records icon including content sensitive menu link wrapped around it: $recordIcon_l10n = $this->getRecordStatHookValue('tt_content', $olrow['uid']) . t3lib_iconWorks::getSpriteIconForRecord('tt_content', $olrow); if (!$this->translatorMode) { $recordIcon_l10n = $this->doc->wrapClickMenuOnIcon($recordIcon_l10n, 'tt_content', $olrow['uid'], 1, '&callingScriptId=' . rawurlencode($this->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter'); } list($flagLink_begin, $flagLink_end) = explode('|*|', $this->link_edit('|*|', 'tt_content', $olrow['uid'], TRUE)); // Create entry for this element: $entries[] = array('indentLevel' => $indentLevel, 'icon' => $recordIcon_l10n, 'title' => t3lib_BEfunc::getRecordTitle('tt_content', $olrow), 'table' => 'tt_content', 'uid' => $olrow['uid'], 'flag' => $flagLink_begin . tx_templavoila_icons::getFlagIconForLanguage($sLInfo['flagIcon'], array('title' => $sLInfo['title'], 'alt' => $sLInfo['title'])) . $flagLink_end, 'isNewVersion' => $olrow['_ORIG_uid'] ? TRUE : FALSE); break; } } } } }
/** * Prints the selector box form-field for the db/file/select elements (multiple) * * @param string Form element name * @param string Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type). Seperated with '|' a user defined mode can be set to be passed as param to the EB. * @param string Commalist of "allowed" * @param array The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs. * @param string Alternative selector box. * @param array An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails" * @param string On focus attribute string * @param string $user_el_param Additional parameter for the EB * @return string The form fields for the selection. */ function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $userEBParam = '') { list($mode, $modeEB) = explode('|', $mode); $modeEB = $modeEB ? $modeEB : $mode; $disabled = ''; if ($this->tceforms->renderReadonly || $params['readOnly']) { $disabled = ' disabled="disabled"'; } // Sets a flag which means some JavaScript is included on the page to support this element. $this->tceforms->printNeededJS['dbFileIcons'] = 1; // INIT $uidList = array(); $opt = array(); $itemArrayC = 0; // Creating <option> elements: if (is_array($itemArray)) { $itemArrayC = count($itemArray); reset($itemArray); switch ($mode) { case 'db': while (list(, $pp) = each($itemArray)) { if ($pp['title']) { $pTitle = $pp['title']; } else { if (function_exists('t3lib_BEfunc::getRecordWSOL')) { $pRec = t3lib_BEfunc::getRecordWSOL($pp['table'], $pp['id']); } else { $pRec = t3lib_BEfunc::getRecord($pp['table'], $pp['id']); } $pTitle = is_array($pRec) ? $pRec[$GLOBALS['TCA'][$pp['table']]['ctrl']['label']] : NULL; } if ($pTitle) { $pTitle = $pTitle ? t3lib_div::fixed_lgd_cs($pTitle, $this->tceforms->titleLen) : t3lib_BEfunc::getNoRecordTitle(); $pUid = $pp['table'] . '_' . $pp['id']; $uidList[] = $pUid; $opt[] = '<option value="' . htmlspecialchars($pUid) . '">' . htmlspecialchars($pTitle) . '</option>'; } } break; case 'folder': case 'file': while (list(, $pp) = each($itemArray)) { $pParts = explode('|', $pp); $uidList[] = $pUid = $pTitle = $pParts[0]; $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pParts[0])) . '">' . htmlspecialchars(rawurldecode($pParts[0])) . '</option>'; } break; default: while (list(, $pp) = each($itemArray)) { $pParts = explode('|', $pp, 2); $uidList[] = $pUid = $pParts[0]; $pTitle = $pParts[1] ? $pParts[1] : $pParts[0]; $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pUid)) . '">' . htmlspecialchars(rawurldecode($pTitle)) . '</option>'; } break; } } // Create selector box of the options $sSize = $params['autoSizeMax'] ? t3lib_div::intInRange($itemArrayC + 1, t3lib_div::intInRange($params['size'], 1), $params['autoSizeMax']) : $params['size']; if (!$selector) { $selector = '<select size="' . $sSize . '"' . $this->tceforms->insertDefStyle('group') . ' multiple="multiple" name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt) . '</select>'; } $icons = array('L' => array(), 'R' => array()); if (!$params['readOnly']) { if (!$params['noBrowser']) { $aOnClick = 'setFormValueOpenBrowser(\'' . $modeEB . '\',\'' . ($fName . '|||' . $allowed . '|' . $userEBParam . '|') . '\'); return false;'; $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert3.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_browse_' . ($mode === 'file' ? 'file' : 'db'))) . ' />' . '</a>'; } if (!$params['dontShowMoveIcons']) { if ($sSize >= 5) { $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Top\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_totop.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_top')) . ' />' . '</a>'; } $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Up\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/up.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_up')) . ' />' . '</a>'; $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Down\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/down.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_down')) . ' />' . '</a>'; if ($sSize >= 5) { $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Bottom\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_tobottom.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_bottom')) . ' />' . '</a>'; } } // todo Clipboard $clipElements = $this->tceforms->getClipboardElements($allowed, $mode); if (count($clipElements)) { $aOnClick = ''; # $counter = 0; foreach ($clipElements as $elValue) { if ($mode === 'file' or $mode === 'folder') { $itemTitle = 'unescape(\'' . rawurlencode(tx_dam::file_basename($elValue)) . '\')'; } else { // 'db' mode assumed list($itemTable, $itemUid) = explode('|', $elValue); if (function_exists('t3lib_BEfunc::getRecordWSOL')) { $rec = t3lib_BEfunc::getRecordWSOL($itemTable, $itemUid); } else { $rec = t3lib_BEfunc::getRecord($itemTable, $itemUid); } $itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, $rec)); $elValue = $itemTable . '_' . $itemUid; } $aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',\'' . t3lib_div::slashJS(t3lib_div::rawUrlEncodeJS($elValue)) . '\',' . t3lib_div::slashJS($itemTitle) . ');'; #$aOnClick .= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20', ' ', $elValue)).'\'),'.$itemTitle.');'; # $counter++; # if ($params['maxitems'] && $counter >= $params['maxitems']) { break; } // Makes sure that no more than the max items are inserted... for convenience. } $aOnClick .= 'return false;'; $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert5.png', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib(sprintf($this->tceforms->getLL('l_clipInsert_' . ($mode === 'file' ? 'file' : 'db')), count($clipElements))) . ' />' . '</a>'; } $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_clear.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_remove_selected')) . ' />' . '</a>'; } $str = '<table border="0" cellpadding="0" cellspacing="0" width="1"> ' . ($params['headers'] ? ' <tr> <td>' . $this->tceforms->wrapLabels($params['headers']['selector']) . '</td> <td></td> <td></td> <td></td> <td>' . ($params['thumbnails'] ? $this->tceforms->wrapLabels($params['headers']['items']) : '') . '</td> </tr>' : '') . ' <tr> <td valign="top">' . $selector . '<br />' . $this->tceforms->wrapLabels($params['info']) . '</td> <td valign="top">' . implode('<br />', $icons['L']) . '</td> <td valign="top">' . implode('<br />', $icons['R']) . '</td> <td style="height:5px;"><span></span></td> <td valign="top">' . $this->tceforms->wrapLabels($params['thumbnails']) . '</td> </tr> </table>'; // Creating the hidden field which contains the actual value as a comma list. $str .= '<input type="hidden" name="' . $fName . '" value="' . htmlspecialchars(implode(',', $uidList)) . '" />'; return $str; }
/** * 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; }