/** * Outputting the accumulated content to screen * * @return void */ function printContent() { $this->content .= $this->doc->spacer(8); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); echo $this->content; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array all available buttons as an assoc. array */ protected function getButtons() { $buttons = array('close' => '', 'save' => '', 'save_view' => '', 'save_close' => '', 'shortcut' => '', 'undo' => ''); if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) { $closeUrl = t3lib_div::sanitizeLocalUrl($this->P['returnUrl']); // Getting settings for the undo button: $undoButton = 0; $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->P['table'], 'sys_history') . ' AND recuid=' . intval($this->P['uid']), '', 'tstamp DESC', '1'); if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $undoButton = 1; } // Close $buttons['close'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($closeUrl) . '\')); return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/closedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '" alt="" />' . '</a>'; // Save $buttons['save'] = '<a href="#" onclick="TBE_EDITOR.checkAndDoSubmit(1); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" alt="" />' . '</a>'; // Save & View if (t3lib_extMgm::isLoaded('cms')) { $buttons['save_view'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedokshow.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', 1) . '" alt="" />' . '</a>'; } // Save & Close $buttons['save_close'] = '<input type="image" class="c-inputButton" onclick="' . htmlspecialchars('document.editform.redirect.value=\'' . $closeUrl . '\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" name="_saveandclosedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" />'; // Undo/Revert: if ($undoButton) { $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars('window.location.href=\'show_rechis.php?element=' . rawurlencode($this->P['table'] . ':' . $this->P['uid']) . '&revert=' . rawurlencode('field:' . $this->P['field']) . '&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/undo.gif') . ' class="c-inputButton" title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('rte_undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '" alt="" />' . '</a>'; } // Shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('P', '', $this->MCONF['name'], 1); } } return $buttons; }
/** * Searching for files with a specific pattern * * @return void */ function func_filesearch() { $pattern = t3lib_div::_GP('pattern'); $pcontent = $GLOBALS['LANG']->getLL('enterRegexPattern') . ' <input type="text" name="pattern" value="' . htmlspecialchars($pattern ? $pattern : $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern']) . '"> <input type="submit" name="' . $GLOBALS['LANG']->getLL('SearchButton') . '">'; $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('pattern'), $pcontent, false, true); if (strcmp($pattern, '')) { $dirs = t3lib_div::get_dirs(PATH_site); $lines = array(); $depth = 10; foreach ($dirs as $key => $value) { $matching_files = array(); $info = ''; if (!t3lib_div::inList('typo3,typo3conf,tslib,media,t3lib', $value)) { $info = $this->findFile(PATH_site . $value . '/', $pattern, $matching_files, $depth); } if (is_array($info)) { $lines[] = '<hr><strong>' . $value . '/</strong> ' . $GLOBALS['LANG']->getLL('beingChecked'); $lines[] = $GLOBALS['LANG']->getLL('directories') . ' ' . $info[0]; if ($info[2]) { $lines[] = '<span class="typo3-red">' . $GLOBALS['LANG']->getLL('directoriesTooDeep') . ' ' . $depth . '</span>'; } $lines[] = $GLOBALS['LANG']->getLL('files') . ' ' . $info[1]; $lines[] = $GLOBALS['LANG']->getLL('matchingFiles') . '<br><nobr><span class="typo3-red">' . implode('<br>', $matching_files) . '</span></nobr>'; } else { $lines[] = $GLOBALS['TBE_TEMPLATE']->dfw('<hr><strong>' . $value . '/</strong> ' . $GLOBALS['LANG']->getLL('notChecked')); } } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('searchingForFilenames'), implode('<br>', $lines), false, true); } }
/** * Creates module content. * * @return void */ function main() { $this->title = $GLOBALS['LANG']->getLL($this->isSwap ? 'swap_title' : 'publish_title'); $content = $this->getContent(); // sets body parts to doc! $this->content .= $this->doc->startPage($this->title); $this->content .= $content; $this->content .= $this->doc->endPage(); }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array all available buttons as an assoc. array */ protected function getButtons() { global $TCA, $LANG, $BACK_PATH, $BE_USER; $buttons = array('csh' => '', 'view' => '', 'record_list' => '', 'shortcut' => ''); // CSH $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE); // View page $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>'; // Shortcut if ($BE_USER->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']); } // If access to Web>List for user, then link to that module. $buttons['record_list'] = t3lib_BEfunc::getListViewLink(array('id' => $this->pageinfo['uid'], 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI')), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')); return $buttons; }
/** * 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 data for all tabs in the user setup and returns * everything that is needed with tabs and dyntab menu * * @return ready to use for the dyntabmenu itemarray */ protected function renderUserSetup() { $result = array(); $firstTabLabel = ''; $code = array(); $i = 0; $fieldArray = $this->getFieldsFromShowItem(); $this->dividers2tabs = isset($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) ? intval($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) : 0; $tabLabel = ''; foreach ($fieldArray as $fieldName) { $more = ''; if (substr($fieldName, 0, 8) == '--div--;') { if ($firstTabLabel == '') { // first tab $tabLabel = $this->getLabel(substr($fieldName, 8), '', false); $firstTabLabel = $tabLabel; } else { if ($this->dividers2tabs) { $result[] = array('label' => $tabLabel, 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : ''); $tabLabel = $this->getLabel(substr($fieldName, 8), '', false); $i = 0; $code = array(); } } continue; } $config = $GLOBALS['TYPO3_USER_SETTINGS']['columns'][$fieldName]; // field my be disabled in setup.fields if (isset($this->tsFieldConf[$fieldName . '.']['disabled']) && $this->tsFieldConf[$fieldName . '.']['disabled'] == 1) { continue; } if (isset($config['access']) && !$this->checkAccess($config)) { continue; } $label = $this->getLabel($config['label'], $fieldName); $label = $this->getCSH($config['csh'] ? $config['csh'] : $fieldName, $label); $type = $config['type']; $eval = $config['eval']; $class = $config['class']; $style = $config['style']; if ($class) { $more .= ' class="' . $class . '"'; } if ($style) { $more .= ' style="' . $style . '"'; } if ($this->overrideConf[$fieldName]) { $more .= ' disabled="disabled"'; } $value = $config['table'] == 'be_users' ? $GLOBALS['BE_USER']->user[$fieldName] : $GLOBALS['BE_USER']->uc[$fieldName]; if (!$value && isset($config['default'])) { $value = $config['default']; } switch ($type) { case 'text': case 'password': $dataAdd = ''; if ($config['table'] == 'be_users') { $dataAdd = '[be_users]'; } if ($eval == 'md5') { $more .= ' onchange="this.value=this.value?MD5(this.value):\'\';"'; } if ($type == 'password') { $value = ''; } $noAutocomplete = $type == 'password' ? 'autocomplete="off" ' : ''; $html = '<input id="field_' . $fieldName . '" type="' . $type . '" name="data' . $dataAdd . '[' . $fieldName . ']" ' . $noAutocomplete . 'value="' . htmlspecialchars($value) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . $more . ' />'; break; case 'check': if (!$class) { $more .= ' class="check"'; } $html = '<input id="field_' . $fieldName . '" type="checkbox" name="data[' . $fieldName . ']"' . ($value ? ' checked="checked"' : '') . $more . ' />'; break; case 'select': if (!$class) { $more .= ' class="select"'; } if ($config['itemsProcFunc']) { $html = t3lib_div::callUserFunction($config['itemsProcFunc'], $config, $this, ''); } else { $html = '<select id="field_' . $fieldName . '" name="data[' . $fieldName . ']"' . $more . '>' . LF; foreach ($config['items'] as $key => $optionLabel) { $html .= '<option value="' . $key . '"' . ($value == $key ? ' selected="selected"' : '') . '>' . $this->getLabel($optionLabel, '', false) . '</option>' . LF; } $html .= '</select>'; } break; case 'user': $html = t3lib_div::callUserFunction($config['userFunc'], $config, $this, ''); break; default: $html = ''; } $code[$i][1] = $label; $code[$i++][2] = $html; } if ($this->dividers2tabs == 0) { $tabLabel = $firstTabLabel; } $result[] = array('label' => $tabLabel, 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : ''); return $result; }
/** * Links to publishing etc of a version * * @param string Table name * @param array Online record * @param array Offline record (version) * @param string Swap type, "branch", "page" or "element" * @return string HTML content, mainly link tags and images. */ function displayWorkspaceOverview_commandLinks($table, &$rec_on, &$rec_off, $vType) { if ($this->publishAccess && (!($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1) || (int) $rec_off['t3ver_stage'] === 10)) { $actionLinks = '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $rec_on['uid'] . '][version][action]=swap' . '&cmd[' . $table . '][' . $rec_on['uid'] . '][version][swapWith]=' . $rec_off['uid'])) . '" title="' . $GLOBALS['LANG']->getLL('publish', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-version-swap-versions') . '</a>'; if ($GLOBALS['BE_USER']->workspaceSwapAccess()) { $actionLinks .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $rec_on['uid'] . '][version][action]=swap' . '&cmd[' . $table . '][' . $rec_on['uid'] . '][version][swapWith]=' . $rec_off['uid'] . '&cmd[' . $table . '][' . $rec_on['uid'] . '][version][swapIntoWS]=1')) . '" title="' . $GLOBALS['LANG']->getLL('swap', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-version-swap-workspace') . '</a>'; } } if (!$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table, $rec_off)) { // Release $actionLinks .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $rec_off['uid'] . '][version][action]=clearWSID')) . '" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('removeFromWorkspace', TRUE) . '?\');" title="' . $GLOBALS['LANG']->getLL('removeFromWorkspace', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-version-document-remove') . '</a>'; // Edit if ($table === 'pages' && $vType !== 'element') { $tempUid = $vType === 'branch' || $GLOBALS['BE_USER']->workspace === 0 ? $rec_off['uid'] : $rec_on['uid']; $actionLinks .= '<a href="#" onclick="top.loadEditId(' . $tempUid . ');top.goToModule(\'' . $this->pageModule . '\'); return false;" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_page', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-version-page-open') . '</a>'; } else { $params = '&edit[' . $table . '][' . $rec_off['uid'] . ']=edit'; $actionLinks .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->doc->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_element', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; } } // History/Log $actionLinks .= '<a href="' . htmlspecialchars($this->doc->backPath . 'show_rechis.php?element=' . rawurlencode($table . ':' . $rec_off['uid']) . '&returnUrl=' . rawurlencode($this->REQUEST_URI)) . '" title="' . $GLOBALS['LANG']->getLL('showLog', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>'; // View if ($table === 'pages') { $tempUid = $vType === 'branch' || $GLOBALS['BE_USER']->workspace === 0 ? $rec_off['uid'] : $rec_on['uid']; $actionLinks .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($tempUid, $this->doc->backPath, t3lib_BEfunc::BEgetRootLine($tempUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>'; } return $actionLinks; }
/** * Create the content of the module: * * @param string Object string * @param integer Pointing to an entry in static_tsconfig_help to show. * @return string HTML */ function browseTSprop($mode, $show) { global $LANG; // Get object tree: $objTree = $this->getObjTree(); // Show single element, if show is set. $out = ''; if ($show) { // Get the entry data: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_tsconfig_help', 'uid=' . intval($show)); $rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $table = unserialize($rec['appdata']); $obj_string = strtr($this->objString, '()', '[]'); // Title: // Title and description: $out .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('show' => ''))) . '" class="typo3-goBack">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . htmlspecialchars($obj_string) . '</a><br />'; if ($rec['title']) { $out .= '<strong>' . htmlspecialchars($rec['title']) . ': </strong>'; } if ($rec['description']) { $out .= nl2br(htmlspecialchars(trim($rec['description']))) . '<br />'; } // Printing the content: $out .= '<br />' . $this->printTable($table, $obj_string, $objTree[$mode . '.']); $out .= '<hr />'; // Printing the "mixer-field": if (!$this->onlyProperty) { $links = array(); $links[] = '<a href="#" onclick="mixerField(\'Indent\');return false;">' . $LANG->getLL('tsprop_mixer_indent', 1) . '</a>'; $links[] = '<a href="#" onclick="mixerField(\'Outdent\');return false;">' . $LANG->getLL('tsprop_mixer_outdent', 1) . '</a>'; $links[] = '<a href="#" onclick="mixerField(\'Wrap\',unescape(\'' . rawurlencode($obj_string) . '\'));return false;">' . $LANG->getLL('tsprop_mixer_wrap', 1) . '</a>'; $links[] = '<a href="#" onclick="mixerField(\'Transfer\');return false;">' . $LANG->getLL('tsprop_mixer_transfer', 1) . '</a>'; $out .= '<textarea rows="5" name="mixer" wrap="off"' . $this->doc->formWidthText(48, '', 'off') . ' class="fixed-font enable-tab"></textarea>'; $out .= '<br /><strong>' . implode(' | ', $links) . '</strong>'; $out .= '<hr />'; } } // SECTION: Showing property tree: $tmpl = t3lib_div::makeInstance('ext_TSparser'); $tmpl->tt_track = 0; // Do not log time-performance information $tmpl->fixedLgd = 0; $tmpl->linkObjects = 0; $tmpl->bType = ''; $tmpl->ext_expandAllNotes = 1; $tmpl->ext_noPMicons = 1; $tmpl->ext_noSpecialCharsOnLabels = 1; if (is_array($objTree[$mode . '.'])) { $out .= ' <!-- TSconfig, object tree: --> <table border="0" cellpadding="0" cellspacing="0" class="t3-tree t3-tree-config" id="typo3-objtree"> <tr class="t3-row-header"><td>TSref</td></tr> <tr> <td nowrap="nowrap">' . $tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode . '.']), '', '', '', '', '1') . '</td> </tr> </table>'; } return $out; }
/** * Creates a form for new workspace. Parts are adopted from <code>alt_doc.php</code>. * * @return string Generated form */ function buildNewForm() { $content = ''; $table = 'sys_workspace'; $prevPageID = ''; $trData = t3lib_div::makeInstance('t3lib_transferData'); $trData->addRawData = TRUE; $trData->defVals = $this->defVals; $trData->lockRecords = 1; $trData->disableRTE = $this->MOD_SETTINGS['disableRTE']; $trData->prevPageID = $prevPageID; $trData->fetchRecord($table, 0, 'new'); reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); $rec['uid'] = uniqid('NEW'); $rec['pid'] = 0; $rec['adminusers'] = $this->getOwnerUser($rec['uid']); // Setting variables in TCEforms object: $this->tceforms->hiddenFieldList = ''; // Register default language labels, if any: $this->tceforms->registerDefaultLanguageData($table, $rec); $this->fixVariousTCAFields(); if (!$GLOBALS['BE_USER']->isAdmin()) { // Non-admins cannot select users from the root. We "fix" it for them. $this->fixTCAUserField('adminusers'); $this->fixTCAUserField('members'); $this->fixTCAUserField('reviewers'); } // Create form for the record (either specific list of fields or the whole record): $form = ''; $form .= $this->doc->spacer(5); $form .= $this->tceforms->getMainFields($table, $rec); $form .= '<input type="hidden" name="workspace_form_submited" value="1" />'; $form .= '<input type="hidden" name="data[' . $table . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; $form .= '<input type="hidden" name="returnUrl" value="index.php" />'; $form .= '<input type="hidden" name="action" value="new" />'; $form .= '<input type="hidden" name="closeDoc" value="0" />'; $form .= '<input type="hidden" name="doSave" value="0" />'; $form .= '<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />'; $form .= '<input type="hidden" name="_disableRTE" value="' . $this->tceforms->disableRTE . '" />'; $form = $this->tceforms->wrapTotal($form, $rec, $table); // Combine it all: $content .= $form; return $content; }
/** * Make selector box for creating new translation for a record or switching to edit the record in an existing language. * Displays only languages which are available for the current page. * * @param string Table name * @param integer uid for which to create a new language * @param integer pid of the record * @return string <select> HTML element (if there were items for the box anyways...) */ function languageSwitch($table, $uid, $pid = NULL) { global $TCA; $content = ''; $languageField = $TCA[$table]['ctrl']['languageField']; $transOrigPointerField = $TCA[$table]['ctrl']['transOrigPointerField']; // table editable and activated for languages? if ($GLOBALS['BE_USER']->check('tables_modify', $table) && $languageField && $transOrigPointerField && !$TCA[$table]['ctrl']['transOrigPointerTable']) { if (is_null($pid)) { $row = t3lib_befunc::getRecord($table, $uid, 'pid'); $pid = $row['pid']; } // get all avalibale languages for the page $langRows = $this->getLanguages($pid); // page available in other languages than default language? if (is_array($langRows) && count($langRows) > 1) { $rowsByLang = array(); $fetchFields = 'uid,' . $languageField . ',' . $transOrigPointerField; // get record in current language $rowCurrent = t3lib_befunc::getLiveVersionOfRecord($table, $uid, $fetchFields); if (!is_array($rowCurrent)) { $rowCurrent = t3lib_befunc::getRecord($table, $uid, $fetchFields); } $currentLanguage = $rowCurrent[$languageField]; if ($currentLanguage > -1) { // Disabled for records with [all] language! // get record in default language if needed if ($currentLanguage) { $rowsByLang[0] = t3lib_befunc::getLiveVersionOfRecord($table, $rowCurrent[$transOrigPointerField], $fetchFields); if (!is_array($rowsByLang[0])) { $rowsByLang[0] = t3lib_befunc::getRecord($table, $rowCurrent[$transOrigPointerField], $fetchFields); } } else { $rowsByLang[0] = $rowCurrent; } // get record in other languages to see what's already available $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fetchFields, $table, 'pid=' . intval($pid) . ' AND ' . $languageField . '>0' . ' AND ' . $transOrigPointerField . '=' . intval($rowsByLang[0]['uid']) . t3lib_BEfunc::deleteClause($table) . t3lib_BEfunc::versioningPlaceholderClause($table)); foreach ($translations as $row) { $rowsByLang[$row[$languageField]] = $row; } $langSelItems = array(); foreach ($langRows as $lang) { if ($GLOBALS['BE_USER']->checkLanguageAccess($lang['uid'])) { $newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' [' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.new', 1) . ']'; // create url for creating a localized record if ($newTranslation) { $href = $this->doc->issueCommand('&cmd[' . $table . '][' . $rowsByLang[0]['uid'] . '][localize]=' . $lang['uid'], $this->backPath . 'alt_doc.php?justLocalized=' . rawurlencode($table . ':' . $rowsByLang[0]['uid'] . ':' . $lang['uid']) . '&returnUrl=' . rawurlencode($this->retUrl) . t3lib_BEfunc::getUrlToken('editRecord')); // create edit url } else { $href = $this->backPath . 'alt_doc.php?'; $href .= '&edit[' . $table . '][' . $rowsByLang[$lang['uid']]['uid'] . ']=edit'; $href .= '&returnUrl=' . rawurlencode($this->retUrl) . t3lib_BEfunc::getUrlToken('editRecord'); } $langSelItems[$lang['uid']] = ' <option value="' . htmlspecialchars($href) . '"' . ($currentLanguage == $lang['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($lang['title'] . $newTranslation) . '</option>'; } } // If any languages are left, make selector: if (count($langSelItems) > 1) { $onChange = 'if(this.options[this.selectedIndex].value){window.location.href=(this.options[this.selectedIndex].value);}'; $content = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language', 1) . ' <select name="_langSelector" onchange="' . htmlspecialchars($onChange) . '"> ' . implode('', $langSelItems) . ' </select>'; } } } } return $content; }
/** * Creating the module output. * * @return void */ function main() { global $LANG, $BACK_PATH; if ($this->id && $this->access) { // Init position map object: $posMap = t3lib_div::makeInstance('ext_posMap'); $posMap->cur_sys_language = $this->sys_language; $posMap->backPath = $BACK_PATH; if ((string) $this->colPos != '') { // If a column is pre-set: if ($this->uid_pid < 0) { $row = array(); $row['uid'] = abs($this->uid_pid); } else { $row = ''; } $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language); } else { $this->onClickEvent = ''; } // *************************** // Creating content // *************************** // use a wrapper div $this->content .= '<div id="user-setup-wrapper">'; $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); // Wizard $code = ''; $wizardItems = $this->getWizardItems(); // Wrapper for wizards $this->elementWrapper['sectionHeader'] = array('<h3 class="divider">', '</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']['cms']['db_new_content_el']['wizardItemsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['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 . ' } if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } '); // Traverse items for the wizard. // An item is either a header or an item rendered with a radio button and title/description and icon: $cc = $key = 0; $menuItems = array(); 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 = ''; // Radio button: $oC = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : ''); $content .= $this->elementWrapper['wizardPart'][0] . '<input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($this->doc->thisBlur() . $oC) . '" />' . $this->elementWrapper['wizardPart'][1]; // Onclick action for icon/title: $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $this->doc->thisBlur() . $oC . 'return false;'; // Icon: $iInfo = @getimagesize($wInfo['icon']); $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> <img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1]; // Title + description: $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><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]; $cc++; } } // 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 #adadad; 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); // If the user must also select a column: if (!$this->onClickEvent) { // Add anchor "sel2" $this->content .= $this->doc->section('', '<a name="sel2"></a>'); $this->content .= $this->doc->spacer(20); // Select position $code = $LANG->getLL('sel2', 1) . '<br /><br />'; // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED'); $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 // Finally, add the content of the column selector to the content: $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI); $this->content .= $this->doc->section($LANG->getLL('2_selectPosition'), $code, 0, 1); } // Close wrapper div $this->content .= '</div>'; } else { // In case of no access: $this->content = ''; $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); } // 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('newContentElement')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->sectionEnd(); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Creates the HTML for the Form Wizard: * * @param string Form config array * @param array Current parent record array * @return string HTML for the form wizard * @access private */ function getFormHTML($formCfgArray, $row) { global $LANG; // Initialize variables: $specParts = array(); $hiddenFields = array(); $tRows = array(); // Set header row: $cells = array($LANG->getLL('forms_preview', 1) . ':', $LANG->getLL('forms_element', 1) . ':', $LANG->getLL('forms_config', 1) . ':'); $tRows[] = ' <tr class="bgColor2" id="typo3-formWizardHeader"> <td> </td> <td>' . implode('</td> <td>', $cells) . '</td> </tr>'; // Traverse the number of form elements: $k = 0; foreach ($formCfgArray as $confData) { // Initialize: $cells = array(); // If there is a configuration line which is active, then render it: if (!isset($confData['comment'])) { // Special parts: if ($this->special == 'formtype_mail' && t3lib_div::inList('formtype_mail,subject,html_enabled', $confData['fieldname'])) { $specParts[$confData['fieldname']] = $confData['default']; } else { // Render title/field preview COLUMN $cells[] = $confData['type'] != 'hidden' ? '<strong>' . htmlspecialchars($confData['label']) . '</strong>' : ''; // Render general type/title COLUMN: $temp_cells = array(); // Field type selector: $opt = array(); $opt[] = '<option value=""></option>'; $types = explode(',', 'input,textarea,select,check,radio,password,file,hidden,submit,property,label'); foreach ($types as $t) { $opt[] = ' <option value="' . $t . '"' . ($confData['type'] == $t ? ' selected="selected"' : '') . '>' . $LANG->getLL('forms_type_' . $t, 1) . '</option>'; } $temp_cells[$LANG->getLL('forms_type')] = ' <select name="FORMCFG[c][' . ($k + 1) * 2 . '][type]"> ' . implode(' ', $opt) . ' </select>'; // Title field: if (!t3lib_div::inList('hidden,submit', $confData['type'])) { $temp_cells[$LANG->getLL('forms_label')] = '<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][label]" value="' . htmlspecialchars($confData['label']) . '" />'; } // Required checkbox: if (!t3lib_div::inList('check,hidden,submit,label', $confData['type'])) { $temp_cells[$LANG->getLL('forms_required')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][required]" value="1"' . ($confData['required'] ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_required', 1) . '" />'; } // Put sub-items together into table cell: $cells[] = $this->formatCells($temp_cells); // Render specific field configuration COLUMN: $temp_cells = array(); // Fieldname if ($this->special == 'formtype_mail' && $confData['type'] == 'file') { $confData['fieldname'] = 'attachment' . ++$this->attachmentCounter; } if (!t3lib_div::inList('label', $confData['type'])) { $temp_cells[$LANG->getLL('forms_fieldName')] = '<input type="text"' . $this->doc->formWidth(10) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][fieldname]" value="' . htmlspecialchars($confData['fieldname']) . '" title="' . $LANG->getLL('forms_fieldName', 1) . '" />'; } // Field configuration depending on the fields type: switch ((string) $confData['type']) { case 'textarea': $temp_cells[$LANG->getLL('forms_cols')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][cols]" value="' . htmlspecialchars($confData['cols']) . '" title="' . $LANG->getLL('forms_cols', 1) . '" />'; $temp_cells[$LANG->getLL('forms_rows')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][rows]" value="' . htmlspecialchars($confData['rows']) . '" title="' . $LANG->getLL('forms_rows', 1) . '" />'; $temp_cells[$LANG->getLL('forms_extra')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][extra]" value="OFF"' . ($confData['extra'] == 'OFF' ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_extra', 1) . '" />'; break; case 'input': case 'password': $temp_cells[$LANG->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $LANG->getLL('forms_size', 1) . '" />'; $temp_cells[$LANG->getLL('forms_max')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][max]" value="' . htmlspecialchars($confData['max']) . '" title="' . $LANG->getLL('forms_max', 1) . '" />'; break; case 'file': $temp_cells[$LANG->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $LANG->getLL('forms_size', 1) . '" />'; break; case 'select': $temp_cells[$LANG->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $LANG->getLL('forms_size', 1) . '" />'; $temp_cells[$LANG->getLL('forms_autosize')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][autosize]" value="1"' . ($confData['autosize'] ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_autosize', 1) . '" />'; $temp_cells[$LANG->getLL('forms_multiple')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][multiple]" value="1"' . ($confData['multiple'] ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_multiple', 1) . '" />'; break; } // Field configuration depending on the fields type: switch ((string) $confData['type']) { case 'textarea': case 'input': case 'password': if (strlen(trim($confData['specialEval']))) { $hiddenFields[] = '<input type="hidden" name="FORMCFG[c][' . ($k + 1) * 2 . '][specialEval]" value="' . htmlspecialchars($confData['specialEval']) . '" />'; } break; } // Default data if ($confData['type'] == 'select' || $confData['type'] == 'radio') { $temp_cells[$LANG->getLL('forms_options')] = '<textarea ' . $this->doc->formWidthText(15) . ' rows="4" name="FORMCFG[c][' . ($k + 1) * 2 . '][options]" title="' . $LANG->getLL('forms_options', 1) . '">' . t3lib_div::formatForTextarea($confData['default']) . '</textarea>'; } elseif ($confData['type'] == 'check') { $temp_cells[$LANG->getLL('forms_checked')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][default]" value="1"' . (trim($confData['default']) ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_checked', 1) . '" />'; } elseif ($confData['type'] && $confData['type'] != 'file') { $temp_cells[$LANG->getLL('forms_default')] = '<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][default]" value="' . htmlspecialchars($confData['default']) . '" title="' . $LANG->getLL('forms_default', 1) . '" />'; } $cells[] = $confData['type'] ? $this->formatCells($temp_cells) : ''; // CTRL panel for an item (move up/down/around): $ctrl = ''; $onClick = "document.wizardForm.action+='#ANC_" . (($k + 1) * 2 - 2) . "';"; $onClick = ' onclick="' . htmlspecialchars($onClick) . '"'; // FIXME $inputStyle undefined $brTag = $inputStyle ? '' : '<br />'; if ($k != 0) { $ctrl .= '<input type="image" name="FORMCFG[row_up][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2up.gif', '') . $onClick . ' title="' . $LANG->getLL('table_up', 1) . '" />' . $brTag; } else { $ctrl .= '<input type="image" name="FORMCFG[row_bottom][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_up.gif', '') . $onClick . ' title="' . $LANG->getLL('table_bottom', 1) . '" />' . $brTag; } $ctrl .= '<input type="image" name="FORMCFG[row_remove][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/garbage.gif', '') . $onClick . ' title="' . $LANG->getLL('table_removeRow', 1) . '" />' . $brTag; // FIXME $tLines undefined if ($k + 1 != count($tLines)) { $ctrl .= '<input type="image" name="FORMCFG[row_down][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2down.gif', '') . $onClick . ' title="' . $LANG->getLL('table_down', 1) . '" />' . $brTag; } else { $ctrl .= '<input type="image" name="FORMCFG[row_top][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_down.gif', '') . $onClick . ' title="' . $LANG->getLL('table_top', 1) . '" />' . $brTag; } $ctrl .= '<input type="image" name="FORMCFG[row_add][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/add.gif', '') . $onClick . ' title="' . $LANG->getLL('table_addRow', 1) . '" />' . $brTag; $ctrl = '<span class="c-wizButtonsV">' . $ctrl . '</span>'; // Finally, put together the full row from the generated content above: $bgC = $confData['type'] ? ' class="bgColor5"' : ''; $tRows[] = ' <tr' . $bgC . '> <td><a name="ANC_' . ($k + 1) * 2 . '"></a>' . $ctrl . '</td> <td class="bgColor4">' . implode('</td> <td valign="top">', $cells) . '</td> </tr>'; } } else { $hiddenFields[] = '<input type="hidden" name="FORMCFG[c][' . ($k + 1) * 2 . '][comment]" value="' . htmlspecialchars($confData['comment']) . '" />'; } // Increment counter: $k++; } // If the form is of the special type "formtype_mail" (used for tt_content elements): if ($this->special == 'formtype_mail') { // Blank spacer: $tRows[] = ' <tr> <td colspan="4"> </td> </tr>'; // Header: $tRows[] = ' <tr> <td colspan="2" class="bgColor2"> </td> <td colspan="2" class="bgColor2"><strong>' . $LANG->getLL('forms_special_eform', 1) . ':</strong>' . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_forms_wiz_formmail_info', $GLOBALS['BACK_PATH'], '') . '</td> </tr>'; // "FORM type": $tRows[] = ' <tr class="bgColor5"> <td> </td> <td class="bgColor4"> </td> <td>' . $LANG->getLL('forms_eform_formtype_mail', 1) . ':</td> <td> <input type="hidden" name="FORMCFG[c][' . 1000 * 2 . '][fieldname]" value="formtype_mail" /> <input type="hidden" name="FORMCFG[c][' . 1000 * 2 . '][type]" value="submit" /> <input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . 1000 * 2 . '][default]" value="' . htmlspecialchars($specParts['formtype_mail']) . '" /> </td> </tr>'; // "Send HTML mail": $tRows[] = ' <tr class="bgColor5"> <td> </td> <td class="bgColor4"> </td> <td>' . $LANG->getLL('forms_eform_html_enabled', 1) . ':</td> <td> <input type="hidden" name="FORMCFG[c][' . 1001 * 2 . '][fieldname]" value="html_enabled" /> <input type="hidden" name="FORMCFG[c][' . 1001 * 2 . '][type]" value="hidden" /> <input type="checkbox" name="FORMCFG[c][' . 1001 * 2 . '][default]" value="1"' . ($specParts['html_enabled'] ? ' checked="checked"' : '') . ' /> </td> </tr>'; // "Subject": $tRows[] = ' <tr class="bgColor5"> <td> </td> <td class="bgColor4"> </td> <td>' . $LANG->getLL('forms_eform_subject', 1) . ':</td> <td> <input type="hidden" name="FORMCFG[c][' . 1002 * 2 . '][fieldname]" value="subject" /> <input type="hidden" name="FORMCFG[c][' . 1002 * 2 . '][type]" value="hidden" /> <input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . 1002 * 2 . '][default]" value="' . htmlspecialchars($specParts['subject']) . '" /> </td> </tr>'; // Recipient: $tRows[] = ' <tr class="bgColor5"> <td> </td> <td class="bgColor4"> </td> <td>' . $LANG->getLL('forms_eform_recipient', 1) . ':</td> <td> <input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[recipient]" value="' . htmlspecialchars($row['subheader']) . '" /> </td> </tr>'; } $content = ''; // Implode all table rows into a string, wrapped in table tags. $content .= ' <!-- Form wizard --> <table border="0" cellpadding="1" cellspacing="1" id="typo3-formwizard"> ' . implode('', $tRows) . ' </table>'; // Add hidden fields: $content .= implode('', $hiddenFields); // Return content: return $content; }
/** * Main processing, creating the list of new record tables to select from * * @return void */ function main() { global $BE_USER, $LANG; // If there was a page - or if the user is admin (admins has access to the root) we proceed: if ($this->pageinfo['uid'] || $BE_USER->isAdmin()) { // Acquiring TSconfig for this module/current page: $this->web_list_modTSconfig = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'], 'mod.web_list'); $this->allowedNewTables = t3lib_div::trimExplode(',', $this->web_list_modTSconfig['properties']['allowedNewTables'], 1); $this->deniedNewTables = t3lib_div::trimExplode(',', $this->web_list_modTSconfig['properties']['deniedNewTables'], 1); // Acquiring TSconfig for this module/parent page: $this->web_list_modTSconfig_pid = t3lib_BEfunc::getModTSconfig($this->pageinfo['pid'], 'mod.web_list'); $this->allowedNewTables_pid = t3lib_div::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['allowedNewTables'], 1); $this->deniedNewTables_pid = t3lib_div::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['deniedNewTables'], 1); // More init: if (!$this->showNewRecLink('pages')) { $this->newPagesInto = 0; } if (!$this->showNewRecLink('pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) { $this->newPagesAfter = 0; } // Set header-HTML and return_url if (is_array($this->pageinfo) && $this->pageinfo['uid']) { $iconImgTag = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath']))); $title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]); } else { $iconImgTag = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($this->pageinfo['_thePath']))); $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } $this->code = '<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag, 'pages', $this->pageinfo['uid']) . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, 45)) . '</span><br />'; $this->R_URI = $this->returnUrl; // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard) if (!$this->pagesOnly) { // Regular new element: $this->regularNew(); } elseif ($this->showNewRecLink('pages')) { // Pages only wizard $this->pagesOnly(); } // Add all the content to an output section $this->content .= $this->doc->section('', $this->code); // 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->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); } }
/** * Creates the HTML for the Table Wizard: * * @param array Table config array * @param array Current parent record array * @return string HTML for the table wizard * @access private */ function getTableHTML($cfgArr, $row) { global $LANG; // Traverse the rows: $tRows = array(); $k = 0; foreach ($cfgArr as $cellArr) { if (is_array($cellArr)) { // Initialize: $cells = array(); $a = 0; // Traverse the columns: foreach ($cellArr as $cellContent) { if ($this->inputStyle) { $cells[] = '<input type="text"' . $this->doc->formWidth(20) . ' name="TABLE[c][' . ($k + 1) * 2 . '][' . ($a + 1) * 2 . ']" value="' . htmlspecialchars($cellContent) . '" />'; } else { $cellContent = preg_replace('/<br[ ]?[\\/]?>/i', LF, $cellContent); $cells[] = '<textarea ' . $this->doc->formWidth(20) . ' rows="5" name="TABLE[c][' . ($k + 1) * 2 . '][' . ($a + 1) * 2 . ']">' . t3lib_div::formatForTextarea($cellContent) . '</textarea>'; } // Increment counter: $a++; } // CTRL panel for a table row (move up/down/around): $onClick = "document.wizardForm.action+='#ANC_" . (($k + 1) * 2 - 2) . "';"; $onClick = ' onclick="' . htmlspecialchars($onClick) . '"'; $ctrl = ''; $brTag = $this->inputStyle ? '' : '<br />'; if ($k != 0) { $ctrl .= '<input type="image" name="TABLE[row_up][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2up.gif', '') . $onClick . ' title="' . $LANG->getLL('table_up', 1) . '" />' . $brTag; } else { $ctrl .= '<input type="image" name="TABLE[row_bottom][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_up.gif', '') . $onClick . ' title="' . $LANG->getLL('table_bottom', 1) . '" />' . $brTag; } $ctrl .= '<input type="image" name="TABLE[row_remove][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/garbage.gif', '') . $onClick . ' title="' . $LANG->getLL('table_removeRow', 1) . '" />' . $brTag; // FIXME what is $tLines? See wizard_forms.php for the same. if ($k + 1 != count($tLines)) { $ctrl .= '<input type="image" name="TABLE[row_down][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2down.gif', '') . $onClick . ' title="' . $LANG->getLL('table_down', 1) . '" />' . $brTag; } else { $ctrl .= '<input type="image" name="TABLE[row_top][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_down.gif', '') . $onClick . ' title="' . $LANG->getLL('table_top', 1) . '" />' . $brTag; } $ctrl .= '<input type="image" name="TABLE[row_add][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/add.gif', '') . $onClick . ' title="' . $LANG->getLL('table_addRow', 1) . '" />' . $brTag; $tRows[] = ' <tr class="bgColor4"> <td class="bgColor5"><a name="ANC_' . ($k + 1) * 2 . '"></a><span class="c-wizButtonsV">' . $ctrl . '</span></td> <td>' . implode('</td> <td>', $cells) . '</td> </tr>'; // Increment counter: $k++; } } // CTRL panel for a table column (move left/right/around/delete) $cells = array(); $cells[] = ''; // Finding first row: reset($cfgArr); $firstRow = current($cfgArr); if (is_array($firstRow)) { // Init: $a = 0; $cols = count($firstRow); // Traverse first row: foreach ($firstRow as $temp) { $ctrl = ''; if ($a != 0) { $ctrl .= '<input type="image" name="TABLE[col_left][' . ($a + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2left.gif', '') . ' title="' . $LANG->getLL('table_left', 1) . '" />'; } else { $ctrl .= '<input type="image" name="TABLE[col_end][' . ($a + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_left.gif', '') . ' title="' . $LANG->getLL('table_end', 1) . '" />'; } $ctrl .= '<input type="image" name="TABLE[col_remove][' . ($a + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/garbage.gif', '') . ' title="' . $LANG->getLL('table_removeColumn', 1) . '" />'; if ($a + 1 != $cols) { $ctrl .= '<input type="image" name="TABLE[col_right][' . ($a + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2right.gif', '') . ' title="' . $LANG->getLL('table_right', 1) . '" />'; } else { $ctrl .= '<input type="image" name="TABLE[col_start][' . ($a + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_right.gif', '') . ' title="' . $LANG->getLL('table_start', 1) . '" />'; } $ctrl .= '<input type="image" name="TABLE[col_add][' . ($a + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/add.gif', '') . ' title="' . $LANG->getLL('table_addColumn', 1) . '" />'; $cells[] = '<span class="c-wizButtonsH">' . $ctrl . '</span>'; // Incr. counter: $a++; } $tRows[] = ' <tr class="bgColor5"> <td align="center">' . implode('</td> <td align="center">', $cells) . '</td> </tr>'; } $content = ''; // Implode all table rows into a string, wrapped in table tags. $content .= ' <!-- Table wizard --> <table border="0" cellpadding="0" cellspacing="1" id="typo3-tablewizard"> ' . implode('', $tRows) . ' </table>'; // Input type checkbox: $content .= ' <!-- Input mode check box: --> <div id="c-inputMode"> ' . '<input type="hidden" name="TABLE[textFields]" value="0" />' . '<input type="checkbox" name="TABLE[textFields]" id="textFields" value="1"' . ($this->inputStyle ? ' checked="checked"' : '') . ' /> <label for="textFields">' . $LANG->getLL('table_smallFields') . '</label> </div> <br /><br /> '; // Return content: return $content; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @param string Identifier for function of module * @return array all available buttons as an assoc. array */ protected function getButtons($function = '') { global $TCA, $LANG, $BACK_PATH, $BE_USER; $buttons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'record_list' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => ''); // View page $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>'; // Shortcut if ($BE_USER->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('db_layout.php?id=' . $this->pageinfo['uid'] . '&clear_cache=1') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear') . '</a>'; } // If access to Web>List for user, then link to that module. $buttons['record_list'] = t3lib_BEfunc::getListViewLink(array('id' => $this->pageinfo['uid'], 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI')), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')); if (!$this->modTSconfig['properties']['disableIconToolbar']) { // Page history $buttons['history_page'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode('pages:' . $this->id) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '#latest\');return false;') . '" title="' . $LANG->getLL('recordHistory', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>'; // New content element $buttons['new_content'] = '<a href="' . htmlspecialchars('db_new_content_el.php?id=' . $this->id . '&sys_language_uid=' . $this->current_sys_language . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '" title="' . $LANG->getLL('newContentElement', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-new') . '</a>'; // Move page $buttons['move_page'] = '<a href="' . htmlspecialchars($BACK_PATH . 'move_el.php?table=pages&uid=' . $this->id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '" title="' . $LANG->getLL('move_page', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-move') . '</a>'; // Move record if (t3lib_div::testInt($this->eRParts[1])) { $buttons['move_record'] = '<a href="' . htmlspecialchars($BACK_PATH . 'move_el.php?table=' . $this->eRParts[0] . '&uid=' . $this->eRParts[1] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' . t3lib_iconWorks::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'), 1))) . '</a>'; } // Create new page (wizard) $buttons['new_page'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '\');return false;') . '" title="' . $LANG->getLL('newPage', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-new') . '</a>'; // Edit page properties if ($this->CALC_PERMS & 2) { $params = '&edit[pages][' . $this->id . ']=edit'; $buttons['edit_page'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $BACK_PATH)) . '" title="' . $LANG->getLL('editPageProperties', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-open') . '</a>'; } // Add CSH (Context Sensitive Help) icon to tool bar if ($function == 'quickEdit') { $buttons['csh'] = t3lib_BEfunc::cshItem($this->descrTable, 'quickEdit', $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;'); } else { $buttons['csh'] = t3lib_BEfunc::cshItem($this->descrTable, 'columns_' . $this->MOD_SETTINGS['function'], $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;'); } if ($function == 'quickEdit') { // Save record $buttons['savedok'] = '<input class="c-inputButton" type="image" name="savedok"' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/savedok.gif', '') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" alt="" />'; // 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.php:rm.saveDocShow', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-save-view') . '</a>'; // Close record $buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($this->closeUrl) . '\')); return false;') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>'; // Delete record if ($this->deleteButton) { $buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(\'' . $this->eRParts[0] . '\',\'' . $this->eRParts[1] . '\',\'' . t3lib_div::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id . '\');') . '" title="' . $LANG->getLL('deleteItem', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete') . '</a>'; } if ($this->undoButton) { // Undo button $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars('window.location.href=\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode($this->eRParts[0] . ':' . $this->eRParts[1]) . '&revert=ALL_FIELDS&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;') . '" title="' . htmlspecialchars(sprintf($LANG->getLL('undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . '</a>'; // History button $buttons['history_record'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode($this->eRParts[0] . ':' . $this->eRParts[1]) . '&returnUrl=' . rawurlencode($this->R_URI) . '#latest\');return false;') . '" title="' . $LANG->getLL('recordHistory', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>'; } } } return $buttons; }