72 public function main() {
73 $GLOBALS[
'LANG']->includeLLFile(
'EXT:wizard_crpages/locallang.xlf');
76 $this->pagesTsConfig = isset($this->tsConfig[
'TCEFORM.'][
'pages.']) ? $this->tsConfig[
'TCEFORM.'][
'pages.'] : array();
78 if (\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'lorem_ipsum')) {
82 $m_perms_clause =
$GLOBALS[
'BE_USER']->getPagePermsClause(8);
83 $pRec = BackendUtility::getRecord(
'pages', $this->pObj->id,
'uid',
' AND ' . $m_perms_clause);
85 $menuItems = $sys_pages->getMenu($this->pObj->id,
'*',
'sorting',
'', 0);
86 if (is_array($pRec)) {
88 if (is_array($data[
'pages'])) {
90 $endI = end($menuItems);
91 $thePid = -(int)$endI[
'uid'];
93 $thePid = $this->pObj->id;
96 $thePid = $this->pObj->id;
99 $previousIdentifier =
'';
100 foreach ($data[
'pages'] as $identifier => $dat) {
101 if (!trim($dat[
'title'])) {
102 unset($data[
'pages'][$identifier]);
107 $firstRecord = FALSE;
108 $data[
'pages'][$identifier][
'pid'] = $thePid;
110 $data[
'pages'][$identifier][
'pid'] =
'-' . $previousIdentifier;
112 $previousIdentifier = $identifier;
115 if (count($data[
'pages'])) {
118 $tce->stripslashes_values = 0;
120 $TCAdefaultOverride =
$GLOBALS[
'BE_USER']->getTSConfigProp(
'TCAdefaults');
121 if (is_array($TCAdefaultOverride)) {
122 $tce->setDefaultsFromUserTS($TCAdefaultOverride);
124 $tce->start($data, array());
125 $tce->process_datamap();
131 $theCode .= $flashMessage->render();
133 $menuItems = $sys_pages->getMenu($this->pObj->id,
'*',
'sorting',
'', 0);
135 foreach ($menuItems as $rec) {
137 if (is_array($rec)) {
141 $theCode .=
'<h4>' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_currentMenu') .
'</h4>' . implode(
'<br />', $lines);
145 $tableData = array();
146 for ($a = 0; $a < 9; $a++) {
149 $lines[] =
'<table id="formFieldContainer" class="t3-table"><tbody id="formFieldContainerBody">' . implode(LF, $tableData) .
'</tbody></table>';
150 $theCode .=
'<h4>' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages') .
':</h4>' . implode(
'', $lines) .
'<br class="clearLeft" />' .
'<input type="button" id="createNewFormFields" value="' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_addMoreLines') .
'" />' .
'<br /><br /> 151 <input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> <label for="createInListEnd">' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_listEnd') .
'</label><br /> 152 <input type="checkbox" name="hidePages" id="hidePages" value="1" /> <label for="hidePages">' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_hidePages') .
'</label><br /> 153 <input type="checkbox" name="hidePagesInMenus" id="hidePagesInMenus" value="1" /> <label for="hidePagesInMenus">' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_hidePagesInMenus') .
'</label><br /><br /> 154 <input type="submit" name="create" value="' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_lCreate') .
'" /> <input type="reset" value="' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_lReset') .
'" /><br />';
157 var tpl = "' . addslashes(str_replace(array(LF, TAB), array(
'',
''), $this->
getFormLine(
'#'))) .
'", i, line, div, bg, label; 159 Ext.get("createNewFormFields").on("click", function() { 160 div = Ext.get("formFieldContainerBody"); 161 for (i = 0; i < 5; i++) { 162 label = lineCounter + i + 1; 163 line = String.format(tpl, (lineCounter + i), label); 164 div.insertHtml("beforeEnd", line); 170 $pageRenderer =
$GLOBALS[
'TBE_TEMPLATE']->getPageRenderer();
171 $pageRenderer->loadExtJS();
172 $pageRenderer->addExtOnReadyCode($extCode);
173 $pageRenderer->addCssInlineBlock(
'TYPO3\CMS\WizardCrpages\Controller\CreatePagesWizardModuleFunctionController',
' 174 #formFieldContainer {float: left; margin: 0 0 10px 0;} 175 .clearLeft {clear: left;} 176 #formFieldContainer label {width: 70px; display: inline-block;} 177 #formFieldContainer span {padding: 0 3px;} 185 $out = $this->pObj->doc->header(
$GLOBALS[
'LANG']->getLL(
'wiz_crMany'));
186 $out .= $this->pObj->doc->section(
'', $theCode, 0, 1);
198 if (is_numeric($index)) {
205 $content =
'<label for="page_new_' . $index .
'"> ' .
$GLOBALS[
'LANG']->getLL(
'wiz_newPages_page') .
' ' . $label;
206 $content .=
': </label>';
208 $content .=
'<input type="text" id="page_new_' . $index .
'" name="data[pages][NEW' . $index .
'][title]"' . $this->pObj->doc->formWidth(35) .
' /> ';
210 $content .= is_object($this->loremIpsumObject) ?
'<a href="#" onclick="' . htmlspecialchars($this->loremIpsumObject->getHeaderTitleJS((
'document.forms[0][\'data[pages][NEW' . $index .
'][title]\'].value'),
'title')) .
'">' . $this->loremIpsumObject->getIcon(
'', $this->pObj->doc->backPath) .
'</a>' :
'';
212 $content .=
'<span>' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.type') .
'</span>';
213 $content .=
'<select onchange="this.style.backgroundImage=this.options[this.selectedIndex].style.backgroundImage;if (this.options[this.selectedIndex].value==\'--div--\') {this.selectedIndex=1;}" ';
214 $content .=
'class="select icon-select" name="data[pages][NEW' . $index .
'][doktype]" style="background: url("' . $backPath .
'sysext/t3skin/icons/gfx/i/pages.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); padding: 1px 1px 1px 24px;">';
217 unset($types[
'default']);
218 $types = array_keys($types);
220 if (!
$GLOBALS[
'BE_USER']->isAdmin() && isset(
$GLOBALS[
'BE_USER']->groupData[
'pagetypes_select'])) {
223 $removeItems = isset($this->pagesTsConfig[
'doktype.'][
'removeItems']) ?
GeneralUtility::trimExplode(
',', $this->pagesTsConfig[
'doktype.'][
'removeItems'], TRUE) : array();
225 if (in_array(1, $types) && !in_array(1, $removeItems)) {
226 $group .=
'<option style="background: url("' . $backPath .
'sysext/t3skin/icons/gfx/i/pages.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" selected="selected" value="1">Standard</option>';
228 if (in_array(6, $types) && !in_array(6, $removeItems)) {
229 $group .=
'<option style="background: url("' . $backPath .
'gfx/i/be_users_section.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" value="6">Backend User Section</option>';
231 $content .= $group ?
'<optgroup class="c-divider" label="Page">' . $group .
'</optgroup>' :
'';
233 if (in_array(4, $types) && !in_array(4, $removeItems)) {
234 $group .=
'<option style="background: url("' . $backPath .
'sysext/t3skin/icons/gfx/i/pages_shortcut.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" value="4">Shortcut</option>';
236 if (in_array(7, $types) && !in_array(7, $removeItems)) {
237 $group .=
'<option style="background: url("' . $backPath .
'gfx/i/pages_mountpoint.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" value="7">Mount Point</option>';
239 if (in_array(3, $types) && !in_array(3, $removeItems)) {
240 $group .=
'<option style="background: url("' . $backPath .
'sysext/t3skin/icons/gfx/i/pages_link.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" value="3">Link to external URL</option>';
242 $content .= $group ?
'<optgroup class="c-divider" label="Link">' . $group .
'</optgroup>' :
'';
244 if (in_array(254, $types) && !in_array(254, $removeItems)) {
245 $group .=
'<option style="background: url("' . $backPath .
'sysext/t3skin/icons/gfx/i/sysf.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" value="254">Folder</option>';
247 if (in_array(255, $types) && !in_array(255, $removeItems)) {
248 $group .=
'<option style="background: url("' . $backPath .
'sysext/t3skin/icons/gfx/i/recycler.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" value="255">Recycler</option>';
250 if (in_array(199, $types) && !in_array(199, $removeItems)) {
251 $group .=
'<option style="background: url("' . $backPath .
'sysext/t3skin/icons/gfx/i/spacer_icon.gif") no-repeat scroll 0% 50% rgb(255, 255, 255); height: 16px; padding-top: 2px; padding-left: 22px;" value="199">Visual menu separator</option>';
253 $content .= $group ?
'<optgroup class="c-divider" label="Special">' . $group .
'</optgroup>' :
'';
254 $content .=
'</select>';
255 return '<tr id="form-line-' . $index .
'"><td>' . $content .
'</td></tr>';
static workspaceOL($table, &$row, $wsid=-99, $unsetMovePointers=FALSE)
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static getSpriteIconForRecord($table, array $row, array $options=array())
static titleAttribForPages($row, $perms_clause='', $includeAttrib=1)
static setUpdateSignal($set='', $params='')
static fixed_lgd_cs($string, $chars, $appendString='...')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getPagesTSconfig($id, $rootLine=NULL, $returnPartArray=FALSE)