本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::editOnClick方法的具体用法?PHP BackendUtility::editOnClick怎么用?PHP BackendUtility::editOnClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::editOnClick方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adminLinks
/**
* Administrative links for a table / record
*
* @param string $table Table name
* @param array $row Record for which administrative links are generated.
*
* @return string HTML link tags.
*/
public function adminLinks($table, array $row)
{
if ($table !== 'tx_commerce_products') {
return parent::adminLinks($table, $row);
} else {
$language = $this->getLanguageService();
// Edit link:
$adminLink = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->doc->backPath)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->sL('LLL:EXT:lang/locallang_core.xml:cm.edit', TRUE))) . '</a>';
// Delete link:
$adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:cm.delete', TRUE))) . '</a>';
if ($row['pid'] == -1) {
// get page TSconfig
$pagesTyposcriptConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']);
if ($pagesTyposcriptConfig['tx_commerce.']['singlePid']) {
$previewPageId = $pagesTyposcriptConfig['tx_commerce.']['singlePid'];
} else {
$previewPageId = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']['previewPageID'];
}
$sysLanguageUid = (int) $row['sys_language_uid'];
/**
* Product
*
* @var $product Tx_Commerce_Domain_Model_Product
*/
$product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $row['t3ver_oid'], $sysLanguageUid);
$product->loadData();
$getVars = ($sysLanguageUid > 0 ? '&L=' . $sysLanguageUid : '') . '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'] . '&no_cache=1&tx_commerce_pi1[showUid]=' . $product->getUid() . '&tx_commerce_pi1[catUid]=' . current($product->getMasterparentCategory());
$adminLink .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($previewPageId, $this->doc->backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>';
}
return $adminLink;
}
}
示例2: getPi1Preview
/**
* Preview of a content element.
*
* @param array $row : Record row of tt_content
* @return string
*/
private function getPi1Preview($row)
{
if ($row['image']) {
$image = \TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode($row, 'tt_content', 'image', $GLOBALS['BACK_PATH']);
}
$previewHtml = '<a href="#" onclick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[tt_content][' . $row['uid'] . ']=edit') . '" />' . $text . '</a>' . $image;
return $previewHtml;
}
示例3: render
/**
* Returns a link with edit on click handler
*
* @see BackendUtility::editOnClick
*
* @param string $parameters
* @param string|int $redirectUrl
* @return string
*/
public function render($parameters, $redirectUrl = '')
{
$onClickAttribute = BackendUtility::editOnClick('&' . $parameters, '', $redirectUrl);
$this->tag->addAttribute('href', '#');
$this->tag->addAttribute('onclick', $onClickAttribute);
$this->tag->setContent($this->renderChildren());
$this->tag->forceClosingTag(TRUE);
return $this->tag->render();
}
示例4: linkEditContent
/**
* Will create a link on the input string and possibly a big button after the string which links to editing in the RTE.
* Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button
*
* @param string $str String to link. Must be prepared for HTML output.
* @param array $row The row.
* @return string If the whole thing was editable ($this->doEdit) $str is return with link around. Otherwise just $str.
* @see getTable_tt_content()
*/
public function linkEditContent($str, $row)
{
$addButton = '';
$onClick = '';
if ($this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
// Setting onclick action for content link:
$onClick = BackendUtility::editOnClick('&edit[tt_content][' . $row['uid'] . ']=edit');
}
// Return link
return $onClick ? '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('edit', TRUE) . '"> ' . $str . '</a>' . $addButton : $str;
}
示例5: linkWrap
/**
* Links the string $code to a create-new form for a record
* in $table created on page $pid
*
* @param string $linkText Link text
* @param string $table Table name (in which to create new record)
* @param int $pid PID value for the
* "&edit['.$table.']['.$pid.']=new" command (positive/negative)
* @param bool $addContentTable If $addContentTable is set,
* then a new contentTable record is created together with pages
*
* @return string The link.
*/
public function linkWrap($linkText, $table, $pid, $addContentTable = FALSE)
{
$parameters = '&edit[' . $table . '][' . $pid . ']=new';
if ($table == 'pages' && $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] && isset($GLOBALS['TCA'][$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']]) && $addContentTable) {
$parameters .= '&edit[' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] . '][prev]=new&returnNewPageId=1';
} elseif ($table == 'pages_language_overlay') {
$parameters .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageinfo['doktype'];
}
$parameters = $this->addCommerceParameter($parameters, $table);
$onClick = BackendUtility::editOnClick($parameters, '', $this->returnUrl);
return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $linkText . '</a>';
}
示例6: getLocalizedRecords
/**
* Creates the localization panel
*
* @param string $table The table
* @param array $row The record for which to make the localization panel.
*
* @return array
*/
public function getLocalizedRecords($table, $row)
{
$records = array();
$translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row);
if (is_array($translations) && is_array($translations['translations'])) {
foreach ($translations['translations'] as $sysLanguageUid => $translationData) {
if (!$GLOBALS['BE_USER']->checkLanguageAccess($sysLanguageUid)) {
continue;
}
if (isset($translations['translations'][$sysLanguageUid])) {
$records[$sysLanguageUid] = array('editIcon' => $this->getLanguageIconLink($sysLanguageUid, BackendUtility::editOnClick('&edit[' . $table . '][' . $translationData['uid'] . ']=edit'), $translationData['uid']), 'uid' => $translations['translations'][$sysLanguageUid]['uid']);
}
}
}
return $records;
}
示例7: makeControl
/**
* Creates the control panel for a single record in the listing.
*
* @param string $table The table
* @param array $row The record for which to make the control panel.
* @return string HTML table with the control panel (unless disabled)
* @todo Define visibility
*/
public function makeControl($table, $row)
{
if ($this->dontShowClipControlPanels) {
return '';
}
$rowUid = $row['uid'];
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version') && isset($row['_ORIG_uid'])) {
$rowUid = $row['_ORIG_uid'];
}
// Initialize:
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
$cells = array();
// If the listed table is 'pages' we have to request the permission settings for each page:
if ($table == 'pages') {
$localCalcPerms = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $row['uid']));
}
// This expresses the edit permissions for this particular element:
$permsEdit = $table == 'pages' && $localCalcPerms & 2 || $table != 'pages' && $this->calcPerms & 16;
// "Show" link (only pages and tt_content elements)
if ($table == 'pages' || $table == 'tt_content') {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$cells['view'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($table == 'tt_content' ? $this->id . '#' . $row['uid'] : $row['uid'], $this->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>';
} elseif (!$this->table) {
$cells['view'] = $this->spaceIcon;
}
// "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
if ($permsEdit) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$cells['edit'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . ($GLOBALS['TCA'][$table]['ctrl']['readOnly'] ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open-read-only') : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open')) . '</a>';
} elseif (!$this->table) {
$cells['edit'] = $this->spaceIcon;
}
// "Move" wizard link for pages/tt_content elements:
if ($table == 'tt_content' && $permsEdit || $table == 'pages') {
$cells['move'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'move_el.php?table=' . $table . '&uid=' . $row['uid'] . '\');') . '" title="' . $GLOBALS['LANG']->getLL('move_' . ($table == 'tt_content' ? 'record' : 'page'), TRUE) . '">' . ($table == 'tt_content' ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-move') : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-move')) . '</a>';
} elseif (!$this->table) {
$cells['move'] = $this->spaceIcon;
}
// If the extended control panel is enabled OR if we are seeing a single table:
if ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] || $this->table) {
// "Info": (All records)
$cells['viewBig'] = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $GLOBALS['LANG']->getLL('showInfo', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-info') . '</a>';
// If the table is NOT a read-only table, then show these links:
if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
// "Revert" link (history/undo)
$cells['history'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'show_rechis.php?element=' . rawurlencode($table . ':' . $row['uid']) . '\',\'#latest\');') . '" title="' . $GLOBALS['LANG']->getLL('history', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
// Versioning:
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version') && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
$vers = \TYPO3\CMS\Backend\Utility\BackendUtility::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace, FALSE, $row);
// If table can be versionized.
if (is_array($vers)) {
$versionIcon = 'no-version';
if (count($vers) > 1) {
$versionIcon = count($vers) - 1;
}
$cells['version'] = '<a href="' . htmlspecialchars($this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('version') . 'cm1/index.php?table=' . rawurlencode($table) . '&uid=' . rawurlencode($row['uid'])) . '" title="' . $GLOBALS['LANG']->getLL('displayVersions', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-version-' . $versionIcon) . '</a>';
} elseif (!$this->table) {
$cells['version'] = $this->spaceIcon;
}
}
// "Edit Perms" link:
if ($table == 'pages' && $GLOBALS['BE_USER']->check('modules', 'web_perm') && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('perm')) {
$cells['perms'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('perm') . 'mod1/index.php' . '?id=' . $row['uid'] . '&return_id=' . $row['uid'] . '&edit=1') . '" title="' . $GLOBALS['LANG']->getLL('permissions', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-locked') . '</a>';
} elseif (!$this->table && $GLOBALS['BE_USER']->check('modules', 'web_perm')) {
$cells['perms'] = $this->spaceIcon;
}
// "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record):
if ($GLOBALS['TCA'][$table]['ctrl']['sortby'] || $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
if ($table != 'pages' && $this->calcPerms & 16 || $table == 'pages' && $this->calcPerms & 8) {
if ($this->showNewRecLink($table)) {
$params = '&edit[' . $table . '][' . -($row['_MOVE_PLH'] ? $row['_MOVE_PLH_uid'] : $row['uid']) . ']=new';
$cells['new'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('new' . ($table == 'pages ' ? 'Page' : 'Record'), TRUE) . '">' . ($table == 'pages' ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-new') : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
}
}
} elseif (!$this->table) {
$cells['new'] = $this->spaceIcon;
}
// "Up/Down" links
if ($permsEdit && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) {
if (isset($this->currentTable['prev'][$row['uid']])) {
// Up
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']];
$cells['moveUp'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('moveUp', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-move-up') . '</a>';
} else {
$cells['moveUp'] = $this->spaceIcon;
}
if ($this->currentTable['next'][$row['uid']]) {
// Down
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
$cells['moveDown'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-move-down') . '</a>';
} else {
$cells['moveDown'] = $this->spaceIcon;
//.........这里部分代码省略.........
示例8: renderModule
/**
* Rendering the information
*
* @param array The Page tree data
* @return string HTML for the information table.
*/
public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree)
{
// Initialize:
$searchPath = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pathPrefixSearch'));
$cmd = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('cmd');
$entry = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('entry');
$searchForm_replace = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_replace');
$searchForm_delete = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_delete');
$trackSameUrl = array();
$this->searchResultCounter = 0;
// Traverse tree:
$output = '';
$cc = 0;
foreach ($tree->tree as $row) {
// Get all pagepath entries for page:
$pathCacheInfo = $this->getPathCache($row['row']['uid']);
// Row title:
$rowTitle = $row['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $row['row'], true);
$cellAttrib = $row['row']['_CSSCLASS'] ? ' class="' . $row['row']['_CSSCLASS'] . '"' : '';
// Add at least one empty element:
if (!count($pathCacheInfo)) {
// Add title:
$tCells = array();
$tCells[] = '<td nowrap="nowrap"' . $cellAttrib . '>' . $rowTitle . '</td>';
// Empty row:
$tCells[] = '<td colspan="10" align="center"> </td>';
// Compile Row:
$output .= '
<tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '">
' . implode('
', $tCells) . '
</tr>';
$cc++;
} else {
foreach ($pathCacheInfo as $c => $inf) {
// Init:
$deletedEntry = false;
$hash = $inf['pagepath'] . '|' . $inf['rootpage_id'] . '|' . $inf['language_id'];
// MP is not a part of this because the path itself should be different simply because the MP makes a different path! (see UriGeneratorAndResolver::pagePathtoID())
// Add icon/title and ID:
$tCells = array();
if (!$c) {
$tCells[] = '<td nowrap="nowrap" rowspan="' . count($pathCacheInfo) . '"' . $cellAttrib . '>' . $rowTitle . '</td>';
$tCells[] = '<td rowspan="' . count($pathCacheInfo) . '">' . $inf['page_id'] . '</td>';
}
// Add values from alternative field used to generate URL:
$baseRow = $row['row'];
// page row as base.
$onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages][' . $row['row']['uid'] . ']=edit&columnsOnly=title,nav_title,alias,tx_realurl_pathsegment', $this->pObj->doc->backPath);
$editIcon = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . '</a>';
$onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $this->pObj->doc->backPath, '', '', '', '');
$editIcon .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $this->pObj->doc->backPath) . '</a>';
if ($inf['language_id'] > 0) {
// For alternative languages, show another list of fields, form page overlay record:
$editIcon = '';
list($olRec) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $row['row']['uid'], ' AND sys_language_uid=' . intval($inf['language_id']));
if (is_array($olRec)) {
$baseRow = array_merge($baseRow, $olRec);
$onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages_language_overlay][' . $olRec['uid'] . ']=edit&columnsOnly=title,nav_title', $this->pObj->doc->backPath);
$editIcon = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . '</a>';
$onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $this->pObj->doc->backPath, '', '', '', '&L=' . $olRec['sys_language_uid']);
$editIcon .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $this->pObj->doc->backPath) . '</a>';
} else {
$baseRow = array();
}
}
$tCells[] = '<td>' . $editIcon . '</td>';
// Sources for segment:
$sources = count($baseRow) ? implode(' | ', array($baseRow['tx_realurl_pathsegment'], $baseRow['alias'], $baseRow['nav_title'], $baseRow['title'])) : '';
$tCells[] = '<td nowrap="nowrap">' . htmlspecialchars($sources) . '</td>';
// Show page path:
if (strcmp($searchPath, '') && \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($inf['pagepath'], $searchPath) && !$inf['expire']) {
// Delete entry:
if ($searchForm_delete) {
$this->deletePathCacheEntry($inf['cache_id']);
$deletedEntry = true;
$pagePath = '[DELETED]';
} elseif ($searchForm_replace) {
$replacePart = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('pathPrefixReplace'));
$this->editPathCacheEntry($inf['cache_id'], $replacePart . substr($inf['pagepath'], strlen($searchPath)));
$pagePath = '<span class="typo3-red">' . htmlspecialchars($replacePart) . '</span>' . htmlspecialchars(substr($inf['pagepath'], strlen($searchPath)));
} else {
$pagePath = '<span class="typo3-red">' . htmlspecialchars(substr($inf['pagepath'], 0, strlen($searchPath))) . '</span>' . htmlspecialchars(substr($inf['pagepath'], strlen($searchPath)));
$this->searchResultCounter++;
}
} else {
// Delete entries:
if ($cmd === 'edit' && (!strcmp($entry, $inf['cache_id']) || !strcmp($entry, 'ALL'))) {
$pagePath = '<input type="text" name="edit[' . $inf['cache_id'] . ']" value="' . htmlspecialchars($inf['pagepath']) . '" size="40" />';
if ($cmd === 'edit' && $entry != 'ALL') {
$pagePath .= $this->saveCancelButtons();
}
} else {
$pagePath = htmlspecialchars($inf['pagepath']);
//.........这里部分代码省略.........
示例9: main
//.........这里部分代码省略.........
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation'), $content, 0, 1);
if ($manyTemplatesMenu) {
$theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
}
$theOutput .= $this->pObj->doc->spacer(10);
$numberOfRows = 35;
// If abort pressed, nothing should be edited:
if ($POST['abort'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) {
unset($e);
}
if ($e['title']) {
$outCode = '<input type="Text" name="data[title]" value="' . htmlspecialchars($tplRow['title']) . '"' . $this->pObj->doc->formWidth() . '>';
$outCode .= '<input type="Hidden" name="e[title]" value="1">';
$theOutput .= $this->pObj->doc->spacer(15);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode, TRUE);
}
if ($e['sitetitle']) {
$outCode = '<input type="Text" name="data[sitetitle]" value="' . htmlspecialchars($tplRow['sitetitle']) . '"' . $this->pObj->doc->formWidth() . '>';
$outCode .= '<input type="Hidden" name="e[sitetitle]" value="1">';
$theOutput .= $this->pObj->doc->spacer(15);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode, TRUE);
}
if ($e['description']) {
$outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, '', '') . '>' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['description']) . '</textarea>';
$outCode .= '<input type="Hidden" name="e[description]" value="1">';
$theOutput .= $this->pObj->doc->spacer(15);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode, TRUE);
}
if ($e['constants']) {
$outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['constants']) . '</textarea>';
$outCode .= '<input type="Hidden" name="e[constants]" value="1">';
// Display "Include TypoScript file content?" checkbox
$outCode .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[constants]=1', 'id="checkIncludeTypoScriptFileContent"');
$outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />';
$theOutput .= $this->pObj->doc->spacer(15);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), '', TRUE);
$theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
}
if ($e['file']) {
$path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $e[file];
$fI = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($e[file]);
if (@is_file($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) {
if (filesize($path) < $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size'] * 1024) {
$fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($path);
$outCode = $GLOBALS['LANG']->getLL('file') . ' <strong>' . $e[file] . '</strong><BR>';
$outCode .= '<textarea name="edit[file]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($fileContent) . '</textarea>';
$outCode .= '<input type="Hidden" name="edit[filename]" value="' . $e[file] . '">';
$outCode .= '<input type="Hidden" name="e[file]" value="' . htmlspecialchars($e[file]) . '">';
$theOutput .= $this->pObj->doc->spacer(15);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), '');
$theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
} else {
$theOutput .= $this->pObj->doc->spacer(15);
$fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']);
$filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']);
$theOutput .= $this->pObj->doc->section('<font color=red>' . $fileToBig . '</font>', $filesizeNotAllowed, 0, 0, 0, 1);
}
}
}
if ($e['config']) {
$outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['config']) . '</textarea>';
$outCode .= '<input type="Hidden" name="e[config]" value="1">';
// Display "Include TypoScript file content?" checkbox
$outCode .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[config]=1', 'id="checkIncludeTypoScriptFileContent"');
$outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />';
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tsconfig_help')) {
$url = $BACK_PATH . 'wizard_tsconfig.php?mode=tsref';
$params = array('formName' => 'editForm', 'itemName' => 'data[config]');
$outCode .= '<a href="#" onClick="vHWin=window.open(\'' . $url . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', array('P' => $params)) . '\',\'popUp' . $md5ID . '\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-typoscript-documentation-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef', TRUE))) . '</a>';
}
$theOutput .= $this->pObj->doc->spacer(15);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), '', TRUE);
$theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
}
// Processing:
$outCode = '';
$outCode .= $this->tableRow($GLOBALS['LANG']->getLL('title'), htmlspecialchars($tplRow['title']), 'title');
$outCode .= $this->tableRow($GLOBALS['LANG']->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle');
$outCode .= $this->tableRow($GLOBALS['LANG']->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description');
$outCode .= $this->tableRow($GLOBALS['LANG']->getLL('constants'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0), 'constants');
$outCode .= $this->tableRow($GLOBALS['LANG']->getLL('setup'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0), 'config');
$outCode = '<table class="t3-table-info">' . $outCode . '</table>';
// Edit all icon:
$outCode .= '<br /><a href="#" onClick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick(rawurlencode('&createExtension=0') . '&edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editTemplateRecord'))) . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>';
$theOutput .= $this->pObj->doc->section('', $outCode);
// hook after compiling the output
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) {
$postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'];
if (is_array($postOutputProcessingHook)) {
$hookParameters = array('theOutput' => &$theOutput, 'POST' => $POST, 'e' => $e, 'tplRow' => $tplRow, 'numberOfRows' => $numberOfRows);
foreach ($postOutputProcessingHook as $hookFunction) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
}
} else {
$theOutput .= $this->pObj->noTemplate(1);
}
return $theOutput;
}
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:101,代码来源:TypoScriptTemplateInformationModuleFunctionController.php
示例10: linkWrapItems
/**
* Returns the title (based on $code) of a record (from table $table) with
* the proper link around (that is for 'tx_commerce_categories'-records
* a link to the level of that record...)
*
* @param string $table Table name
* @param int $uid Item uid
* @param string $code Item title (not htmlspecialchars()'ed yet)
* @param array $row Item row
*
* @return string The item title. Ready for HTML output
*/
public function linkWrapItems($table, $uid, $code, array $row)
{
$language = $this->getLanguageService();
$backendUser = $this->getBackendUser();
// If the title is blank, make a "no title" label:
if (!strcmp($code, '')) {
$code = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.no_title', 1) . ']</i> - ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $row), $backendUser->uc['titleLen']));
} else {
$code = htmlspecialchars(GeneralUtility::fixed_lgd_cs($code, $this->fixedL));
}
switch ((string) $this->clickTitleMode) {
case 'edit':
// If the listed table is 'tx_commerce_categories' we have to
// request the permission settings for each page:
if ($table == 'tx_commerce_categories') {
$localCalcPerms = $backendUser->calcPerms(BackendUtility::getRecord('tx_commerce_categories', $row['uid']));
$permsEdit = $localCalcPerms & 2;
} else {
$permsEdit = $this->calcPerms & 16;
}
// "Edit" link: ( Only if permissions to edit the page-record
// of the content of the parent page ($this->id)
if ($permsEdit) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $language->getLL('edit', 1) . '">' . $code . '</a>';
}
break;
case 'show':
// "Show" link (only tx_commerce_categories and tx_commerce_products elements)
if ($table == 'tx_commerce_categories' || $table == 'tx_commerce_products') {
$code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($table == 'tx_commerce_products' ? $this->id . '#' . $row['uid'] : $row['uid'])) . '" title="' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '">' . $code . '</a>';
}
break;
case 'info':
// "Info": (All records)
$code = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $language->getLL('showInfo', 1) . '">' . $code . '</a>';
break;
default:
// Output the label now:
if ($table == 'tx_commerce_categories') {
$code = '<a href="' . htmlspecialchars($this->listURL($uid, '')) . '">' . $code . '</a>';
}
}
return $code;
}
示例11: newContentElementOnClick
/**
* Creates onclick-attribute content for a new content element
*
* @param int $id Page id where to create the element.
* @param int $colPos Preset: Column position value
* @param int $sys_language Preset: Sys langauge value
* @return string String for onclick attribute.
* @see getTable_tt_content()
*/
public function newContentElementOnClick($id, $colPos, $sys_language)
{
if ($this->option_newWizard) {
$onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('new_content_element') . '&id=' . $id . '&colPos=' . $colPos . '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';';
} else {
$onClick = BackendUtility::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]=' . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language);
}
return $onClick;
}
示例12: linkWrapItems
/**
* 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 Table name
* @param int $uid Item uid
* @param string $code Item title (not htmlspecialchars()'ed yet)
* @param mixed[] $row Item row
* @return string The item title. Ready for HTML output (is htmlspecialchars()'ed)
*/
public function linkWrapItems($table, $uid, $code, $row)
{
$lang = $this->getLanguageService();
$origCode = $code;
// If the title is blank, make a "no title" label:
if ((string) $code === '') {
$code = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', 1) . ']</i> - ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $row), $this->getBackendUserAuthentication()->uc['titleLen']));
} else {
$code = htmlspecialchars(GeneralUtility::fixed_lgd_cs($code, $this->fixedL), ENT_QUOTES, 'UTF-8', false);
if ($code != htmlspecialchars($origCode)) {
$code = '<span title="' . htmlspecialchars($origCode, ENT_QUOTES, 'UTF-8', false) . '">' . $code . '</span>';
}
}
switch ((string) $this->clickTitleMode) {
case 'edit':
// If the listed table is 'pages' we have to request the permission settings for each page:
if ($table == 'pages') {
$localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
$permsEdit = $localCalcPerms & Permission::PAGE_EDIT;
} else {
$permsEdit = $this->calcPerms & Permission::CONTENT_EDIT;
}
// "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
if ($permsEdit) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1)) . '" title="' . $lang->getLL('edit', true) . '">' . $code . '</a>';
}
break;
case 'show':
// "Show" link (only pages and tt_content elements)
if ($table == 'pages' || $table == 'tt_content') {
$code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($table == 'tt_content' ? $this->id . '#' . $row['uid'] : $row['uid'])) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '">' . $code . '</a>';
}
break;
case 'info':
// "Info": (All records)
$code = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $lang->getLL('showInfo', true) . '">' . $code . '</a>';
break;
default:
// Output the label now:
if ($table == 'pages') {
$code = '<a href="' . htmlspecialchars($this->listURL($uid, '', 'firstElementNumber')) . '" onclick="setHighlight(' . $uid . ')">' . $code . '</a>';
} else {
$code = $this->linkUrlMail($code, $origCode);
}
}
return $code;
}
示例13: getButtons
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*
* @param string $function Identifier for function of module
* @return array all available buttons as an assoc. array
*/
protected function getButtons($function = '')
{
$lang = $this->getLanguageService();
$buttons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'edit_language' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'save_close' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => '');
// View page
$buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
// Shortcut
if ($this->getBackendUser()->mayMakeShortcut()) {
$buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
}
// Cache
if (!$this->modTSconfig['properties']['disableAdvanced']) {
$buttons['cache'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_layout', array('id' => $this->pageinfo['uid'], 'clear_cache' => '1'))) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-cache-clear') . '</a>';
}
if (!$this->modTSconfig['properties']['disableIconToolbar']) {
// Move record
if (MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
$urlParameters = ['table' => $this->eRParts[0], 'uid' => $this->eRParts[1], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
$buttons['move_record'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('move_element', $urlParameters)) . '">' . IconUtility::getSpriteIcon('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move', array('class' => 'c-inputButton', 'title' => $lang->getLL('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page'), TRUE))) . '</a>';
}
// Edit page properties and page language overlay icons
if ($this->CALC_PERMS & Permission::PAGE_EDIT) {
// Edit localized page_language_overlay only when one specific language is selected
if ($this->MOD_SETTINGS['function'] == 1 && $this->current_sys_language > 0) {
$overlayRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', 'pid = ' . (int) $this->id . ' ' . 'AND sys_language_uid = ' . (int) $this->current_sys_language . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::versioningPlaceholderClause('pages_language_overlay'), '', '', '', 'sys_language_uid');
$editLanguageOnClick = htmlspecialchars(BackendUtility::editOnClick('&edit[pages_language_overlay][' . $overlayRecord['uid'] . ']=edit'));
$buttons['edit_language'] = '<a href="#" ' . 'onclick="' . $editLanguageOnClick . '"' . 'title="' . $lang->getLL('editPageLanguageOverlayProperties', TRUE) . '">' . IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay') . '</a>';
}
// Edit page properties
$editPageOnClick = htmlspecialchars(BackendUtility::editOnClick('&edit[pages][' . $this->id . ']=edit'));
$buttons['edit_page'] = '<a href="#" ' . 'onclick="' . $editPageOnClick . '"' . 'title="' . $lang->getLL('editPageProperties', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
}
// Add CSH (Context Sensitive Help) icon to tool bar
if ($function == 'quickEdit') {
$buttons['csh'] = BackendUtility::cshItem($this->descrTable, 'quickEdit');
} else {
$buttons['csh'] = BackendUtility::cshItem($this->descrTable, 'columns_' . $this->MOD_SETTINGS['function']);
}
if ($function == 'quickEdit') {
// Save record
$buttons['savedok'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
// Save and close
$buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
// Save record and show page
$buttons['savedokshow'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-save-view') . '</a>';
// Close record
$buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($this->closeUrl) . '); return false;') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
// Delete record
if ($this->deleteButton) {
$buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id) . ');') . '" title="' . $lang->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
}
if ($this->undoButton) {
// Undo button
$buttons['undo'] = '<a href="#"
onclick="' . htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'revert' => 'ALL_FIELDS', 'sumUp' => -1, 'returnUrl' => $this->R_URI))) . '; return false;') . '"
title="' . htmlspecialchars(sprintf($lang->getLL('undoLastChange'), BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>';
// History button
$buttons['history_record'] = '<a href="#"
onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'returnUrl' => $this->R_URI)) . '#latest') . ');return false;') . '"
title="' . $lang->getLL('recordHistory', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
}
}
}
return $buttons;
}
示例14: editOnClick
/**
* Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params.
* REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution)
*
* @param string $params Parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123] = edit' which will show edit form for page record 123.
* @param string $backPath Must point back to the TYPO3_mainDir directory (where alt_doc.php is)
* @param string $requestUri An optional returnUrl you can set - automatically set to REQUEST_URI.
*
* @return string
* @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
*/
public function editOnClick($params, $backPath = '', $requestUri = '')
{
return BackendUtility::editOnClick($params, $backPath, $requestUri);
}
示例15: makeEdit
/**
* Creates the edit control section
*
* @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
* @return string HTML-table
* @todo Define visibility
*/
public function makeEdit($fileOrFolderObject)
{
$cells = array();
$fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
// Edit metadata of file
try {
if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('write')) {
$metaData = $fileOrFolderObject->_getMetaData();
$data = array('sys_file_metadata' => array($metaData['uid'] => 'edit'));
$editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
$title = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
$cells['editmetadata'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $title . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
} else {
$cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty');
}
} catch (\Exception $e) {
$cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty');
}
// Edit file content (if editable)
if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
$editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
$cells['edit'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
} else {
$cells['edit'] = IconUtility::getSpriteIcon('empty-empty');
}
// rename the file
if ($fileOrFolderObject->checkActionPermission('rename')) {
$renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+\'file_rename.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
$cells['rename'] = '<a href="#" onclick="' . $renameOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
} else {
$cells['rename'] = IconUtility::getSpriteIcon('empty-empty');
}
if ($fileOrFolderObject->checkActionPermission('read')) {
if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\Folder')) {
$infoOnClick = 'top.launchView( \'_FOLDER\', \'' . $fullIdentifier . '\');return false;';
} elseif (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File')) {
$infoOnClick = 'top.launchView( \'_FILE\', \'' . $fullIdentifier . '\');return false;';
}
$cells['info'] = '<a href="#" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
} else {
$cells['info'] = IconUtility::getSpriteIcon('empty-empty');
}
// delete the file
if ($fileOrFolderObject->checkActionPermission('delete')) {
$identifier = $fileOrFolderObject->getIdentifier();
if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
$referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)');
} else {
$referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)');
}
if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
$confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
} else {
$confirmationCheck = '1 == 1';
}
$removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
$cells['delete'] = '<a href="#" onclick="' . htmlspecialchars($removeOnClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
} else {
$cells['delete'] = IconUtility::getSpriteIcon('empty-empty');
}
// Hook for manipulating edit icons.
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
$cells['__fileOrFolderObject'] = $fileOrFolderObject;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
if (!$hookObject instanceof \TYPO3\CMS\Filelist\FileListEditIconHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797);
}
$hookObject->manipulateEditIcons($cells, $this);
}
unset($cells['__fileOrFolderObject']);
}
// Compile items into a DIV-element:
return ' <!-- EDIT CONTROLS: -->
<div class="typo3-editCtrl">
' . implode('
', $cells) . '
</div>';
}