151 $GLOBALS[
'LANG']->includeLLFile(
'EXT:lang/locallang_misc.xlf');
164 $this->perms_clause =
$GLOBALS[
'BE_USER']->getPagePermsClause(1);
166 if ($pidList =
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.hideRecords.pages')) {
167 if ($pidList =
$GLOBALS[
'TYPO3_DB']->cleanIntList($pidList)) {
168 $this->perms_clause .=
' AND pages.uid NOT IN (' . $pidList .
')';
178 $this->doc->backPath =
$GLOBALS[
'BACK_PATH'];
179 $this->doc->setModuleTemplate(
'EXT:backend/Resources/Private/Templates/db_new.html');
180 $this->doc->JScode =
'';
182 $this->doc->getContextMenuCode();
185 $this->content .= $this->doc->header(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
191 if ($this->pageinfo[
'uid']) {
193 $this->pidInfo = BackendUtility::getRecord(
'pages', $this->pageinfo[
'pid']);
195 if (
$GLOBALS[
'BE_USER']->doesUserHaveAccess($this->pageinfo, 8)) {
196 $this->newPagesInto = 1;
198 if (
$GLOBALS[
'BE_USER']->doesUserHaveAccess($this->pageinfo, 16)) {
199 $this->newContentInto = 1;
201 if ((
$GLOBALS[
'BE_USER']->isAdmin() || is_array($this->pidInfo)) &&
$GLOBALS[
'BE_USER']->doesUserHaveAccess($this->pidInfo, 8)) {
202 $this->newPagesAfter = 1;
204 } elseif (
$GLOBALS[
'BE_USER']->isAdmin()) {
206 $this->newPagesInto = 1;
207 $this->newContentInto = 1;
208 $this->newPagesAfter = 0;
211 $this->newPagesInto = 0;
212 $this->newContentInto = 0;
213 $this->newPagesAfter = 0;
224 if ($this->pageinfo[
'uid'] ||
$GLOBALS[
'BE_USER']->isAdmin()) {
231 $this->allowedNewTables_pid =
GeneralUtility::trimExplode(
',', $this->web_list_modTSconfig_pid[
'properties'][
'allowedNewTables'], TRUE);
232 $this->deniedNewTables_pid =
GeneralUtility::trimExplode(
',', $this->web_list_modTSconfig_pid[
'properties'][
'deniedNewTables'], TRUE);
235 $this->newPagesInto = 0;
237 if (!$this->
showNewRecLink(
'pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) {
238 $this->newPagesAfter = 0;
241 if (is_array($this->pageinfo) && $this->pageinfo[
'uid']) {
243 $title = strip_tags($this->pageinfo[
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'label']]);
245 $iconImgTag =
IconUtility::getSpriteIcon(
'apps-pagetree-root', array(
'title' => htmlspecialchars($this->pageinfo[
'_thePath'])));
246 $title =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'];
248 $this->code =
'<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag,
'pages', $this->pageinfo[
'uid']) . htmlspecialchars(
GeneralUtility::fixed_lgd_cs($title, 45)) .
'</span><br />';
252 if (!$this->pagesOnly) {
259 $this->content .= $this->doc->section(
'', $this->code);
262 $markers[
'CSH'] = $docHeaderButtons[
'csh'];
265 $this->content = $this->doc->startPage(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
266 $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
267 $this->content .= $this->doc->endPage();
268 $this->content = $this->doc->insertStylesAndJS($this->content);
285 if (!$this->pagesOnly) {
299 $buttons[
'back'] =
'<a href="' . htmlspecialchars($this->R_URI) .
'" class="typo3-goBack" title="' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) .
'">' .
IconUtility::getSpriteIcon(
'actions-view-go-back') .
'</a>';
301 if (is_array($this->pageinfo) && $this->pageinfo[
'uid']) {
314 public function pagesOnly() {
316 if ($numberOfPages > 0) {
318 <h3>' . htmlspecialchars(
$GLOBALS[
'LANG']->getLL(
'selectPosition')) .
':</h3> 322 $this->code .= $positionMap->positionTree($this->
id, $this->pageinfo, $this->perms_clause, $this->R_URI);
325 $javascript =
BackendUtility::editOnClick(
'returnUrl=%2Ftypo3%2Fdb_new.php%3Fid%3D0%26pagesOnly%3D1&edit[pages][0]=new&returnNewPageId=1');
326 $startPos = strpos($javascript,
'href=\'') + 6;
327 $endPos = strpos($javascript,
'\';
'); 328 $url = substr($javascript, $startPos, $endPos - $startPos); 330 \TYPO3\CMS\Core\Utility\HttpUtility::redirect($url); 340 public function regularNew() { 341 $doNotShowFullDescr = FALSE; 342 // Initialize array for accumulating table rows: 343 $this->tRows = array(); 345 $halfLine = '<img
' . IconUtility::skinImg($this->doc->backPath, 'gfx/ol/line.gif
', 'width=
"18" height=
"16"') . ' alt=
"" />
'; 346 $firstLevel = '<img
' . IconUtility::skinImg($this->doc->backPath, 'gfx/ol/join.gif
', 'width=
"18" height=
"16"') . ' alt=
"" />
'; 347 $secondLevel = '<img
' . IconUtility::skinImg($this->doc->backPath, 'gfx/ol/line.gif
', 'width=
"18" height=
"16"') . ' alt=
"" />
' . 348 '<img
' . IconUtility::skinImg($this->doc->backPath, 'gfx/ol/join.gif
', 'width=
"18" height=
"16"') . ' alt=
"" />
'; 349 $secondLevelLast = '<img
' . IconUtility::skinImg($this->doc->backPath, 'gfx/ol/line.gif
', 'width=
"18" height=
"16"') . ' alt=
"" />
' . 350 '<img
' . IconUtility::skinImg($this->doc->backPath, 'gfx/ol/joinbottom.gif
', 'width=
"18" height=
"16"') . ' alt=
"" />
'; 351 // Get TSconfig for current page 352 $pageTS = BackendUtility::getPagesTSconfig($this->id); 353 // Finish initializing new pages options with TSconfig 354 // Each new page option may be hidden by TSconfig 355 // Enabled option for the position of a new page 356 $this->newPagesSelectPosition = !empty($pageTS['mod.
']['wizards.
']['newRecord.
']['pages.
']['show.
']['pageSelectPosition
']); 357 // Pseudo-boolean (0/1) for backward compatibility 358 $displayNewPagesIntoLink = $this->newPagesInto && !empty($pageTS['mod.
']['wizards.
']['newRecord.
']['pages.
']['show.
']['pageInside
']) ? 1 : 0; 359 $displayNewPagesAfterLink = $this->newPagesAfter && !empty($pageTS['mod.
']['wizards.
']['newRecord.
']['pages.
']['show.
']['pageAfter
']) ? 1 : 0; 360 // Slight spacer from header: 361 $this->code .= '<div
class=
"typo3-newRecord-treeline">
' . $halfLine . '</div>
'; 364 $v = $GLOBALS['TCA
'][$table]; 365 $pageIcon = IconUtility::getSpriteIconForRecord($table, array()); 366 $newPageIcon = IconUtility::getSpriteIcon('actions-page-
new'); 368 // New pages INSIDE this pages 369 $newPageLinks = array(); 370 if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages
') && $this->getBackendUserAuthentication()->check('tables_modify
', 'pages
') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid
'] ?: $this->id), 'pages
')) { 371 // Create link to new page inside: 372 $newPageLinks[] = $this->linkWrap(IconUtility::getSpriteIconForRecord($table, array()) . $GLOBALS['LANG
']->sL($v['ctrl
']['title
'], TRUE) . ' (
' . $GLOBALS['LANG
']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside
', TRUE) . ')
', $table, $this->id); 374 // New pages AFTER this pages 375 if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages
') && $this->getBackendUserAuthentication()->check('tables_modify
', 'pages
') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid
'], 'pages
')) { 376 $newPageLinks[] = $this->linkWrap($pageIcon . $GLOBALS['LANG
']->sL($v['ctrl
']['title
'], TRUE) . ' (
' . $GLOBALS['LANG
']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.after
', TRUE) . ')
', 'pages
', -$this->id); 378 // New pages at selection position 379 if ($this->newPagesSelectPosition) { 380 // Link to page-wizard: 381 $newPageLinks[] = '<a href=
"' . htmlspecialchars(GeneralUtility::linkThisScript(array('pagesOnly' => 1))) . '">
' . $pageIcon . htmlspecialchars($GLOBALS['LANG
']->getLL('pageSelectPosition
')) . '</a>
'; 383 // Assemble all new page links 384 $numPageLinks = count($newPageLinks); 385 for ($i = 0; $i < $numPageLinks; $i++) { 386 // For the last link, use the "branch bottom" icon 387 if ($i == $numPageLinks - 1) { 388 $treeComponent = $secondLevelLast; 390 $treeComponent = $secondLevel; 392 $rowContent .= '<div
class=
"typo3-newRecord-treeline">
' . $treeComponent . $newPageLinks[$i] . '</div>
'; 394 // Add row header and half-line if not empty 395 if (!empty($rowContent)) { 396 $rowContent .= '<div
class=
"typo3-newRecord-treeline">
' . $halfLine . '</div>
'; 397 $rowContent = '<div
class=
"typo3-newRecord-treeline">
' . $firstLevel . $newPageIcon . ' <strong>
' . 398 $GLOBALS['LANG
']->getLL('createNewPage
') . '</strong></div>
' . $rowContent; 400 // Compile table row to show the icon for "new page (select position)" 401 $startRows = array(); 402 if ($this->showNewRecLink('pages
') && !empty($rowContent)) { 405 <td nowrap=
"nowrap">
' . $rowContent . '</td>
406 <td>
' . BackendUtility::wrapInHelp($table, '') . '</td>
410 // New tables (but not pages) INSIDE this pages 411 $isAdmin = $GLOBALS['BE_USER
']->isAdmin(); 412 $newContentIcon = IconUtility::getSpriteIcon('actions-document-
new'); 413 if ($this->newContentInto) { 414 if (is_array($GLOBALS['TCA
'])) { 416 foreach ($GLOBALS['TCA
'] as $table => $v) { 417 $count = count($GLOBALS['TCA
'][$table]); 419 if ($table != 'pages
' 420 && $this->showNewRecLink($table) 421 && $this->isTableAllowedForThisPage($this->pageinfo, $table) 422 && $GLOBALS['BE_USER
']->check('tables_modify
', $table) 423 && (($v['ctrl
']['rootLevel
'] xor $this->id) || $v['ctrl
']['rootLevel
'] == -1) 424 && $GLOBALS['BE_USER
']->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid
'] ? $this->pageinfo['_ORIG_uid
'] : $this->id), $table) 426 $newRecordIcon = IconUtility::getSpriteIconForRecord($table, array()); 428 // Create new link for record: 429 $newLink = $this->linkWrap($newRecordIcon . $GLOBALS['LANG
']->sL($v['ctrl
']['title
'], TRUE), $table, $this->id); 430 // If the table is 'tt_content
' (from "cms" extension), create link to wizard 431 if ($table == 'tt_content
') { 432 $groupName = $GLOBALS['LANG
']->getLL('createNewContent
'); 433 $rowContent = '<div
class=
"typo3-newRecord-treeline">
' . $firstLevel . $newContentIcon . ' <strong>
' . $GLOBALS['LANG
']->getLL('createNewContent
') . '</strong></div>
'; 434 // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's wizard instead:
435 $overrideExt = $this->web_list_modTSconfig[
'properties'][
'newContentWiz.'][
'overrideWithExtension'];
438 $rowContent .=
'<div class="typo3-newRecord-treeline">' . $secondLevel . $newLink .
'</div><div class="typo3-newRecord-treeline">' . $secondLevelLast .
'<a href="' . htmlspecialchars($href) .
'">' . $newContentIcon . htmlspecialchars(
$GLOBALS[
'LANG']->getLL(
'clickForWizard')) .
'</a></div>';
440 $rowContent .=
'<div class="typo3-newRecord-treeline">' . $halfLine .
'</div>';
443 if ($v[
'ctrl'][
'readOnly'] || $v[
'ctrl'][
'hideTable'] || $v[
'ctrl'][
'is_static']) {
446 if ($v[
'ctrl'][
'adminOnly'] && !$isAdmin) {
449 $nameParts = explode(
'_', $table);
451 if ($nameParts[0] ==
'tx' || $nameParts[0] ==
'tt') {
453 if (substr($v[
'ctrl'][
'title'], 0, 8) ==
'LLL:EXT:') {
454 $_EXTKEY = substr($v[
'ctrl'][
'title'], 8);
455 $_EXTKEY = substr($_EXTKEY, 0, strpos($_EXTKEY,
'/'));
456 if ($_EXTKEY !=
'') {
458 $temp = explode(
':', substr($v[
'ctrl'][
'title'], 9 + strlen($_EXTKEY)));
459 $langFile = $temp[0];
460 $thisTitle =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:' . $_EXTKEY .
'/' . $langFile .
':extension.title');
464 $thisTitle =
$EM_CONF[$_EXTKEY][
'title'];
469 if (empty($thisTitle)) {
470 $_EXTKEY = $nameParts[1];
471 $thisTitle = $nameParts[1];
472 $iconFile[$_EXTKEY] =
'';
476 $thisTitle =
$GLOBALS[
'LANG']->getLL(
'system_records');
479 if ($groupName ==
'' || $groupName != $_EXTKEY) {
480 $groupName = empty($v[
'ctrl'][
'groupName']) ? $_EXTKEY : $v[
'ctrl'][
'groupName'];
482 $rowContent .= $newLink;
486 if ($table ==
'tt_content') {
489 <td nowrap="nowrap">' . $rowContent .
'</td> 493 $this->tRows[$groupName][
'title'] = $thisTitle;
494 $this->tRows[$groupName][
'html'][] = $rowContent;
495 $this->tRows[$groupName][
'table'][] = $table;
502 if (isset($pageTS[
'mod.'][
'wizards.'][
'newRecord.'][
'order'])) {
505 uksort($this->tRows, array($this,
'sortNewRecordsByConfig'));
507 $finalRows = array();
508 $finalRows[] = implode(
'', $startRows);
509 foreach ($this->tRows as $key => $value) {
511 <td nowrap="nowrap"><div class="typo3-newRecord-treeline">' . $halfLine .
'</div><div class="typo3-newRecord-treeline">' . $firstLevel .
512 $iconFile[$key] .
' <strong>' . $value[
'title'] .
'</strong></div></td><td> <br />' .
BackendUtility::wrapInHelp($key,
'') .
'</td> 514 $count = count($value[
'html']) - 1;
515 foreach ($value[
'html'] as $recordKey => $record) {
518 <td nowrap="nowrap"><div class="typo3-newRecord-treeline">' . ($recordKey < $count ? $secondLevel : $secondLevelLast) . $record .
'</div></td> 527 <td><img' .
IconUtility::skinImg($this->doc->backPath,
'gfx/ol/stopper.gif',
'width="18" height="16"') .
' alt="" /></td> 533 <table border="0" cellpadding="0" cellspacing="0" id="typo3-newRecord"> 534 ' . implode(
'', $finalRows) .
' 548 if (count($this->newRecordSortList)) {
549 if (in_array($a, $this->newRecordSortList) && in_array($b, $this->newRecordSortList)) {
551 $sub = array_search($a, $this->newRecordSortList) - array_search($b, $this->newRecordSortList);
552 $ret = ($sub < 0 ? -1 : $sub == 0) ? 0 : 1;
553 } elseif (in_array($a, $this->newRecordSortList)) {
556 } elseif (in_array($b, $this->newRecordSortList)) {
561 $ret = strnatcasecmp($this->tRows[$a][
'title'], $this->tRows[$b][
'title']);
566 return strnatcasecmp($this->tRows[$a][
'title'], $this->tRows[$b][
'title']);
589 public function linkWrap($linkText, $table, $pid, $addContentTable = FALSE) {
590 $parameters =
'&edit[' . $table .
'][' . $pid .
']=new';
591 if ($table ==
'pages' &&
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable'] && isset(
$GLOBALS[
'TCA'][
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable']]) && $addContentTable) {
592 $parameters .=
'&edit[' . $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable'] .
'][prev]=new&returnNewPageId=1';
593 } elseif ($table ==
'pages_language_overlay') {
594 $parameters .=
'&overrideVals[pages_language_overlay][doktype]=' . (int)$this->pageinfo[
'doktype'];
597 return '<a href="#" onclick="' . htmlspecialchars($onClick) .
'">' . $linkText .
'</a>';
609 if (!is_array($pid_row)) {
610 if (
$GLOBALS[
'BE_USER']->user[
'admin']) {
617 if ($checkTable ==
'be_users' || $checkTable ==
'be_groups') {
621 $doktype = (int)$pid_row[
'doktype'];
622 if (!($allowedTableList =
$GLOBALS[
'PAGES_TYPES'][$doktype][
'allowedTables'])) {
623 $allowedTableList =
$GLOBALS[
'PAGES_TYPES'][
'default'][
'allowedTables'];
static skinImg($backPath, $src, $wHattribs='', $outputMode=0)
linkWrap($linkText, $table, $pid, $addContentTable=FALSE)
static readPageAccess($id, $perms_clause)
static getModTSconfig($id, $TSref)
getBackendUserAuthentication()
static editOnClick($params, $backPath='', $requestUri='')
static BEgetRootLine($uid, $clause='', $workspaceOL=FALSE)
isTableAllowedForThisPage($pid_row, $checkTable)
sortNewRecordsByConfig($a, $b)
static extPath($key, $script='')
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static getIndpEnv($getEnvName)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static viewOnClick($pageUid, $backPath='', $rootLine='', $anchorSection='', $alternativeUrl='', $additionalGetVars='', $switchFocus=TRUE)
static getSpriteIconForRecord($table, array $row, array $options=array())
static wrapInHelp($table, $field, $text='', array $overloadHelpText=array())
static linkThisScript(array $getParams=array())
showNewRecLink($table, array $allowedNewTables=array(), array $deniedNewTables=array())
static isLoaded($key, $exitOnError=FALSE)
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
$web_list_modTSconfig_pid
static fixed_lgd_cs($string, $chars, $appendString='...')
static sanitizeLocalUrl($url='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)
static deleteClause($table, $tableAlias='')