/** * Renders the review module user dependent with all workspaces. * The module will show all records of one workspace. * * @return void */ public function indexAction() { $wsService = t3lib_div::makeInstance('tx_Workspaces_Service_Workspaces'); $this->view->assign('showGrid', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin())); $this->view->assign('showAllWorkspaceTab', $GLOBALS['BE_USER']->isAdmin()); $this->view->assign('pageUid', t3lib_div::_GP('id')); $this->view->assign('showLegend', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin())); $wsList = $wsService->getAvailableWorkspaces(); $activeWorkspace = $GLOBALS['BE_USER']->workspace; $performWorkspaceSwitch = FALSE; if (!$GLOBALS['BE_USER']->isAdmin()) { $wsCur = array($activeWorkspace => true); $wsList = array_intersect_key($wsList, $wsCur); } else { $wsList = $wsService->getAvailableWorkspaces(); if (strlen(t3lib_div::_GP('workspace'))) { $switchWs = (int) t3lib_div::_GP('workspace'); if (in_array($switchWs, array_keys($wsList)) && $activeWorkspace != $switchWs) { $activeWorkspace = $switchWs; $GLOBALS['BE_USER']->setWorkspace($activeWorkspace); $performWorkspaceSwitch = TRUE; t3lib_BEfunc::setUpdateSignal('updatePageTree'); } elseif ($switchWs == tx_Workspaces_Service_Workspaces::SELECT_ALL_WORKSPACES) { $this->redirect('fullIndex'); } } } $this->view->assign('performWorkspaceSwitch', $performWorkspaceSwitch); $this->view->assign('workspaceList', $wsList); $this->view->assign('activeWorkspaceUid', $activeWorkspace); $this->view->assign('activeWorkspaceTitle', tx_Workspaces_Service_Workspaces::getWorkspaceTitle($activeWorkspace)); $this->view->assign('showPreviewLink', $wsService->canCreatePreviewLink(t3lib_div::_GP('id'), $activeWorkspace)); $GLOBALS['BE_USER']->setAndSaveSessionData('tx_workspace_activeWorkspace', $activeWorkspace); }
/** * Main function. Hook from t3lib/class.t3lib_tcemain.php * * @param string $status: Status of the current operation, 'new' or 'update * @param string $table: The table currently processing data for * @param string $id: The record uid currently processing data for, [integer] or [string] (like 'NEW...') * @param array $fieldArray: The field array of a record * @param object $reference: reference to parent object * @return void */ function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, &$reference) { // Return if not the tx_dam_cat table or if status is not "new" or "update". if ($table != 'tx_dam_cat' || !($status == 'new' || $status == 'update')) { return; } // If not returned, update the dam_catedit tree. t3lib_BEfunc::setUpdateSignal('updateFolderTree'); }
/** * Generate the main settings formular: * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TBE_MODULES; // file creation / delete if ($this->isAdmin) { if ($this->installToolFileKeep) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileHasKeep'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::WARNING); $this->content .= $flashMessage->render(); } if (t3lib_div::_POST('deleteInstallToolEnableFile')) { unlink(PATH_typo3conf . 'ENABLE_INSTALL_TOOL'); $this->setInstallToolFileExists(); if ($this->getInstallToolFileExists()) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR); } else { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK); } $this->content .= $flashMessage->render(); } if (t3lib_div::_POST('createInstallToolEnableFile')) { touch(PATH_typo3conf . 'ENABLE_INSTALL_TOOL'); t3lib_div::fixPermissions(PATH_typo3conf . 'ENABLE_INSTALL_TOOL'); $this->setInstallToolFileExists(); if ($this->getInstallToolFileExists()) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK); } else { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR); } $this->content .= $flashMessage->render(); } } if ($this->languageUpdate) { $this->doc->JScodeArray['languageUpdate'] .= ' if (top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } '; } if ($this->pagetreeNeedsRefresh) { t3lib_BEfunc::setUpdateSignal('updatePageTree'); } // Start page: $this->doc->loadJavascriptLib('md5.js'); // use a wrapper div $this->content .= '<div id="user-setup-wrapper">'; // Load available backend modules $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules'); $this->loadModules->observeWorkspaces = true; $this->loadModules->load($TBE_MODULES); $this->content .= $this->doc->header($LANG->getLL('UserSettings') . ' - ' . $BE_USER->user['realName'] . ' [' . $BE_USER->user['username'] . ']'); // show if setup was saved if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('setupWasUpdated'), $LANG->getLL('UserSettings')); $this->content .= $flashMessage->render(); } // Show if temporary data was cleared if ($this->tempDataIsCleared) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('tempDataClearedFlashMessage'), $LANG->getLL('tempDataCleared')); $this->content .= $flashMessage->render(); } // Show if temporary data was cleared if ($this->settingsAreResetToDefault) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('settingsAreReset'), $LANG->getLL('resetConfiguration')); $this->content .= $flashMessage->render(); } // If password is updated, output whether it failed or was OK. if ($this->passwordIsSubmitted) { if ($this->passwordIsUpdated) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_ok'), $LANG->getLL('newPassword')); } else { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_failed'), $LANG->getLL('newPassword'), t3lib_FlashMessage::ERROR); } $this->content .= $flashMessage->render(); } // render the menu items $menuItems = $this->renderUserSetup(); $this->content .= $this->doc->spacer(20) . $this->doc->getDynTabMenu($menuItems, 'user-setup', FALSE, FALSE, 0, 1, FALSE, 1, $this->dividers2tabs); $formToken = $this->formProtection->generateToken('BE user setup', 'edit'); // Submit and reset buttons $this->content .= $this->doc->spacer(20); $this->content .= $this->doc->section('', t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $BACK_PATH) . ' <input type="hidden" name="simUser" value="' . $this->simUser . '" /> <input type="hidden" name="formToken" value="' . $formToken . '" /> <input type="submit" name="data[save]" value="' . $LANG->getLL('save') . '" /> <input type="button" value="' . $LANG->getLL('resetConfiguration') . '" onclick="if(confirm(\'' . $LANG->getLL('setToStandardQuestion') . '\')) {document.getElementById(\'setValuesToDefault\').value=1;this.form.submit();}" /> <input type="button" value="' . $LANG->getLL('clearSessionVars') . '" onclick="if(confirm(\'' . $LANG->getLL('clearSessionVarsQuestion') . '\')){document.getElementById(\'clearSessionVars\').value=1;this.form.submit();}" /> <input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" /> <input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />'); // Notice $this->content .= $this->doc->spacer(30); $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('activateChanges'), '', t3lib_FlashMessage::INFO); $this->content .= $flashMessage->render(); // end of wrapper div $this->content .= '</div>'; // 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->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($LANG->getLL('UserSettings'), $this->content); }
/** * Main function, starting the rendering of the list. * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $CLIENT; // Start document template object: $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/db_list.html'); // Loading current page record and checking access: $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; // Initialize the dblist object: $dblist = t3lib_div::makeInstance('localRecordList'); $dblist->backPath = $BACK_PATH; $dblist->calcPerms = $BE_USER->calcPerms($this->pageinfo); $dblist->thumbs = $BE_USER->uc['thumbnailsByDefault']; $dblist->returnUrl = $this->returnUrl; $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0; $dblist->localizationView = $this->MOD_SETTINGS['localization']; $dblist->showClipboard = 1; $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView']; $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView']; $dblist->hideTables = $this->modTSconfig['properties']['hideTables']; $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.']; $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode']; $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0; $dblist->allowedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], 1); $dblist->deniedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], 1); $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0; $dblist->pageRow = $this->pageinfo; $dblist->counter++; $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => ''); $dblist->modTSconfig = $this->modTSconfig; // Clipboard is initialized: $dblist->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard $dblist->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session // Clipboard actions are handled: $CB = t3lib_div::_GET('CB'); // CB is the clipboard command array if ($this->cmd == 'setCB') { // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. By merging we get a full array of checked/unchecked elements // This is set to the 'el' array of the CB after being parsed so only the table in question is registered. $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array) t3lib_div::_POST('CBH'), (array) t3lib_div::_POST('CBC')), $this->cmd_table); } if (!$this->MOD_SETTINGS['clipBoard']) { $CB['setP'] = 'normal'; } // If the clipboard is NOT shown, set the pad to 'normal'. $dblist->clipObj->setCmd($CB); // Execute commands. $dblist->clipObj->cleanCurrent(); // Clean up pad $dblist->clipObj->endClipboard(); // Save the clipboard content // This flag will prevent the clipboard panel in being shown. // It is set, if the clickmenu-layer is active AND the extended view is not enabled. $dblist->dontShowClipControlPanels = $CLIENT['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$BE_USER->uc['disableCMlayers'] && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers']; // If there is access to the page, then render the list contents and set up the document template object: if ($access) { // Deleting records...: // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table. if ($this->cmd == 'delete') { $items = $dblist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), $this->cmd_table, 1); if (count($items)) { $cmd = array(); foreach ($items as $iK => $value) { $iKParts = explode('|', $iK); $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1; } $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); if (isset($cmd['pages'])) { t3lib_BEfunc::setUpdateSignal('updatePageTree'); } $tce->printLogErrorMessages(t3lib_div::getIndpEnv('REQUEST_URI')); } } // Initialize the listing object, dblist, for rendering the list: $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000); $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit); $dblist->setDispFields(); // Render versioning selector: if (t3lib_extMgm::isLoaded('version')) { $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id); } // Render the list of tables: $dblist->generateList(); // Write the bottom of the page: $dblist->writeBottom(); // Add JavaScript functions to the page: $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL) { // window.location.href = URL; return false; } function jumpExt(URL,anchor) { // var anc = anchor?anchor:""; window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc; return false; } function jumpSelf(URL) { // window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:""); return false; } function setHighlight(id) { // top.fsMod.recentIds["web"]=id; top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } } ' . $this->doc->redirectUrls($dblist->listURL()) . ' ' . $dblist->CBfunctions() . ' function editRecords(table,idList,addParams,CBflag) { // window.location.href="' . $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams; } function editList(table,idList) { // var list=""; // Checking how many is checked, how many is not var pointer=0; var pos = idList.indexOf(","); while (pos!=-1) { if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) { list+=idList.substr(pointer,pos-pointer)+","; } pointer=pos+1; pos = idList.indexOf(",",pointer); } if (cbValue(table+"|"+idList.substr(pointer))) { list+=idList.substr(pointer)+","; } return list ? list : idList; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); } // access // Begin to compile the whole page, starting out with page header: $this->body = ''; $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">'; $this->body .= $dblist->HTMLcode; $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>'; // If a listing was produced, create the page footer with search form etc: if ($dblist->HTMLcode) { // Making field select box (when extended view for a single table is enabled): if ($dblist->table) { $this->body .= $dblist->fieldSelectBox($dblist->table); } // Adding checkbox options for extended listing and clipboard display: $this->body .= ' <!-- Listing options for clipboard and thumbnails --> <div id="typo3-listOptions"> <form action="" method="post">'; $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"') . ' <label for="checkLargeControl">' . $LANG->getLL('largeControl', 1) . '</label><br />'; if ($dblist->showClipboard) { $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"') . ' <label for="checkShowClipBoard">' . $LANG->getLL('showClipBoard', 1) . '</label><br />'; } $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"') . ' <label for="checkLocalization">' . $LANG->getLL('localization', 1) . '</label><br />'; $this->body .= ' </form> </div>'; $this->body .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_options', $GLOBALS['BACK_PATH']); // Printing clipboard if enabled: if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) { $this->body .= $dblist->clipObj->printClipboard(); $this->body .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_clipboard', $GLOBALS['BACK_PATH']); } // Search box: $this->body .= $dblist->getSearchBox(); // Display sys-notes, if any are found: $this->body .= $dblist->showSysNotesForPage(); } // Setting up the buttons and markers for docheader $docHeaderButtons = $dblist->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body); // Build the <body> for the module $this->content = $this->doc->startPage('DB list'); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Import part of module * * @param array Content of POST VAR tx_impexp[].. * @return void Setting content in $this->content */ function importData($inData) { global $TCA, $LANG, $BE_USER; $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { if ($BE_USER->user['admin'] && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } if ($inData['new_import']) { unset($inData['import_mode']); } $import = t3lib_div::makeInstance('tx_impexp'); $import->init(0, 'import'); $import->update = $inData['do_update']; $import->import_mode = $inData['import_mode']; $import->enableLogging = $inData['enableLogging']; $import->global_ignore_pid = $inData['global_ignore_pid']; $import->force_all_UIDS = $inData['force_all_UIDS']; $import->showDiff = !$inData['notShowDiff']; $import->allowPHPScripts = $inData['allowPHPScripts']; $import->softrefInputValues = $inData['softrefInputValues']; // OUTPUT creation: $menuItems = array(); // Make input selector: $path = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']; // must have trailing slash. $filesInDir = t3lib_div::getFilesInDir(PATH_site . $path, 't3d,xml', 1, 1); $userPath = $this->userSaveFolder(); //Files from User-Dir $filesInUserDir = t3lib_div::getFilesInDir($userPath, 't3d,xml', 1, 1); $filesInDir = array_merge($filesInUserDir, $filesInDir); if (is_dir(PATH_site . $path . 'export/')) { $filesInDir = array_merge($filesInDir, t3lib_div::getFilesInDir(PATH_site . $path . 'export/', 't3d,xml', 1, 1)); } $tempFolder = $this->userTempFolder(); if ($tempFolder) { $temp_filesInDir = t3lib_div::getFilesInDir($tempFolder, 't3d,xml', 1, 1); $filesInDir = array_merge($filesInDir, $temp_filesInDir); } // Configuration $row = array(); $opt = array(''); foreach ($filesInDir as $file) { $opt[$file] = substr($file, strlen(PATH_site)); } $row[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_selectFileToImport', 1) . '</strong></td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_file', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'importFile', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $this->renderSelectBox('tx_impexp[file]', $inData['file'], $opt) . '<br />' . sprintf($LANG->getLL('importdata_fromPathS', 1), $path) . (!$import->compress ? '<br /><span class="typo3-red">' . $LANG->getLL('importdata_noteNoDecompressorAvailable', 1) . '</span>' : '') . '</td> </tr>'; $row[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_importOptions', 1) . '</strong></td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_update', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'update', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="checkbox" name="tx_impexp[do_update]" id="checkDo_update" value="1"' . ($inData['do_update'] ? ' checked="checked"' : '') . ' /> <label for="checkDo_update">' . $LANG->getLL('importdata_updateRecords', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_thisOptionRequiresThat', 1) . ')</em>' . ($inData['do_update'] ? ' <hr/> <input type="checkbox" name="tx_impexp[global_ignore_pid]" id="checkGlobal_ignore_pid" value="1"' . ($inData['global_ignore_pid'] ? ' checked="checked"' : '') . ' /> <label for="checkGlobal_ignore_pid">' . $LANG->getLL('importdata_ignorePidDifferencesGlobally', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_ifYouSetThis', 1) . ')</em> ' : '') . '</td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_options', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'options', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="checkbox" name="tx_impexp[notShowDiff]" id="checkNotShowDiff" value="1"' . ($inData['notShowDiff'] ? ' checked="checked"' : '') . ' /> <label for="checkNotShowDiff">' . $LANG->getLL('importdata_doNotShowDifferences', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_greenValuesAreFrom', 1) . ')</em> <br/><br/> ' . ($GLOBALS['BE_USER']->isAdmin() ? ' <input type="checkbox" name="tx_impexp[allowPHPScripts]" id="checkAllowPHPScripts" value="1"' . ($inData['allowPHPScripts'] ? ' checked="checked"' : '') . ' /> <label for="checkAllowPHPScripts">' . $LANG->getLL('importdata_allowToWriteBanned', 1) . '</label><br/>' : '') . (!$inData['do_update'] && $GLOBALS['BE_USER']->isAdmin() ? ' <br/> <input type="checkbox" name="tx_impexp[force_all_UIDS]" id="checkForce_all_UIDS" value="1"' . ($inData['force_all_UIDS'] ? ' checked="checked"' : '') . ' /> <label for="checkForce_all_UIDS"><span class="typo3-red">' . $LANG->getLL('importdata_force_all_UIDS', 1) . '</span></label><br/> <em>(' . $LANG->getLL('importdata_force_all_UIDS_descr', 1) . ')</em>' : '') . ' </td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_action', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'action', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . (!$inData['import_file'] ? '<input type="submit" value="' . $LANG->getLL('importdata_preview', 1) . '" />' . ($inData['file'] ? ' - <input type="submit" value="' . ($inData['do_update'] ? $LANG->getLL('importdata_update_299e', 1) : $LANG->getLL('importdata_import', 1)) . '" name="tx_impexp[import_file]" onclick="return confirm(\'' . $LANG->getLL('importdata_areYouSure', 1) . '\');" />' : '') : '<input type="submit" name="tx_impexp[new_import]" value="' . $LANG->getLL('importdata_newImport', 1) . '" />') . ' <input type="hidden" name="tx_impexp[action]" value="import" /></td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_enableLogging', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'enableLogging', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="checkbox" name="tx_impexp[enableLogging]" id="checkEnableLogging" value="1"' . ($inData['enableLogging'] ? ' checked="checked"' : '') . ' /> <label for="checkEnableLogging">' . $LANG->getLL('importdata_writeIndividualDbActions', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_thisIsDisabledBy', 1) . ')</em> </td> </tr>'; $menuItems[] = array('label' => $LANG->getLL('importdata_import', 1), 'content' => ' <table border="0" cellpadding="1" cellspacing="1"> ' . implode(' ', $row) . ' </table> '); // Upload file: $tempFolder = $this->userTempFolder(); if ($tempFolder) { $row = array(); $row[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_uploadFileFromLocal', 1) . '</strong></td> </tr>'; $row[] = '<tr class="bgColor4"> <td>' . $LANG->getLL('importdata_browse', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'upload', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="file" name="upload_1"' . $this->doc->formWidth(35) . ' size="40" /> <input type="hidden" name="file[upload][1][target]" value="' . htmlspecialchars($tempFolder) . '" /> <input type="hidden" name="file[upload][1][data]" value="1" /><br /> <input type="submit" name="_upload" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit', 1) . '" /> <input type="checkbox" name="overwriteExistingFiles" id="checkOverwriteExistingFiles" value="1" checked="checked" /> <label for="checkOverwriteExistingFiles">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:overwriteExistingFiles', 1) . '</label> </td> </tr>'; if (t3lib_div::_POST('_upload')) { $row[] = '<tr class="bgColor4"> <td>' . $LANG->getLL('importdata_uploadStatus', 1) . '</td> <td>' . ($this->fileProcessor->internalUploadMap[1] ? $LANG->getLL('importdata_success', 1) . ' ' . substr($this->fileProcessor->internalUploadMap[1], strlen(PATH_site)) : '<span class="typo3-red">' . $LANG->getLL('importdata_failureNoFileUploaded', 1) . '</span>') . '</td> </tr>'; } $menuItems[] = array('label' => $LANG->getLL('importdata_upload'), 'content' => ' <table border="0" cellpadding="1" cellspacing="1"> ' . implode(' ', $row) . ' </table> '); } // Perform import or preview depending: $overviewContent = ''; $extensionInstallationMessage = ''; $emURL = ''; $inFile = t3lib_div::getFileAbsFileName($inData['file']); if ($inFile && @is_file($inFile)) { $trow = array(); if ($import->loadFile($inFile, 1)) { // Check extension dependencies: $extKeysToInstall = array(); if (is_array($import->dat['header']['extensionDependencies'])) { foreach ($import->dat['header']['extensionDependencies'] as $extKey) { if (!t3lib_extMgm::isLoaded($extKey)) { $extKeysToInstall[] = $extKey; } } } if (count($extKeysToInstall)) { $passParams = t3lib_div::_POST('tx_impexp'); unset($passParams['import_mode']); unset($passParams['import_file']); $thisScriptUrl = t3lib_div::getIndpEnv('REQUEST_URI') . '?M=xMOD_tximpexp&id=' . $this->id . t3lib_div::implodeArrayForUrl('tx_impexp', $passParams); $emURL = $this->doc->backPath . 'mod/tools/em/index.php?CMD[requestInstallExtensions]=' . implode(',', $extKeysToInstall) . '&returnUrl=' . rawurlencode($thisScriptUrl); $extensionInstallationMessage = 'Before you can install this T3D file you need to install the extensions "' . implode('", "', $extKeysToInstall) . '". Clicking Import will first take you to the Extension Manager so these dependencies can be resolved.'; } if ($inData['import_file']) { if (!count($extKeysToInstall)) { $import->importData($this->id); t3lib_BEfunc::setUpdateSignal('updatePageTree'); } else { t3lib_utility_Http::redirect($emURL); } } $import->display_import_pid_record = $this->pageinfo; $overviewContent = $import->displayContentOverview(); } // Meta data output: $trow[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_metaData', 1) . '</strong></td> </tr>'; $opt = array(''); foreach ($filesInDir as $file) { $opt[$file] = substr($file, strlen(PATH_site)); } $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_title', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['title'])) . '</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_description', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['description'])) . '</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_notes', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])) . '</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_packager', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'] . ' (' . $import->dat['header']['meta']['packager_username'] . ')')) . '<br/> ' . $LANG->getLL('importdata_email', 1) . ' ' . $import->dat['header']['meta']['packager_email'] . '</td> </tr>'; // Thumbnail icon: if (is_array($import->dat['header']['thumbnail'])) { $pI = pathinfo($import->dat['header']['thumbnail']['filename']); if (t3lib_div::inList('gif,jpg,png,jpeg', strtolower($pI['extension']))) { // Construct filename and write it: $fileName = PATH_site . 'typo3temp/importthumb.' . $pI['extension']; t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']); // Check that the image really is an image and not a malicious PHP script... if (getimagesize($fileName)) { // Create icon tag: $iconTag = '<img src="' . $this->doc->backPath . '../' . substr($fileName, strlen(PATH_site)) . '" ' . $import->dat['header']['thumbnail']['imgInfo'][3] . ' vspace="5" style="border: solid black 1px;" alt="" />'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_icon', 1) . '</strong></td> <td>' . $iconTag . '</td> </tr>'; } else { t3lib_div::unlink_tempfile($fileName); } } } $menuItems[] = array('label' => $LANG->getLL('importdata_metaData_1387'), 'content' => ' <table border="0" cellpadding="1" cellspacing="1"> ' . implode(' ', $trow) . ' </table> '); } // Print errors that might be: $errors = $import->printErrorLog(); $menuItems[] = array('label' => $LANG->getLL('importdata_messages'), 'content' => $errors, 'stateIcon' => $errors ? 2 : 0); // Output tabs: $content = $this->doc->getDynTabMenu($menuItems, 'tx_impexp_import', -1); if ($extensionInstallationMessage) { $content = '<div style="border: 1px black solid; margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;">' . $this->doc->icons(1) . htmlspecialchars($extensionInstallationMessage) . '</div>' . $content; } $this->content .= $this->doc->section('', $content, 0, 1); // Print overview: if ($overviewContent) { $this->content .= $this->doc->section($inData['import_file'] ? $LANG->getLL('importdata_structureHasBeenImported', 1) : $LANG->getLL('filterpage_structureToBeImported', 1), $overviewContent, 0, 1); } } }
/** * Will publish workspace if buttons are pressed * * @return void */ function publishAction() { // If "Publish" or "Swap" buttons are pressed: if (t3lib_div::_POST('_publish') || t3lib_div::_POST('_swap')) { if ($this->table === 'pages') { // Making sure ->uid is a page ID! // Initialize workspace object and request all pending versions: $wslibObj = t3lib_div::makeInstance('wslib'); $cmd = $wslibObj->getCmdArrayForPublishWS($GLOBALS['BE_USER']->workspace, t3lib_div::_POST('_swap'), $this->uid); // Execute the commands: $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); t3lib_BEfunc::setUpdateSignal('updatePageTree'); return $tce->errorLog; } } }
/** * Main function of the module. * * @return void * @access public */ function main() { global $BE_USER, $LANG, $BACK_PATH; $this->content = ''; // Access check! The page will show only if there is a valid page and if this page may be viewed by the user if (is_array($this->altRoot)) { $access = true; // get PID of altRoot Element to get pageInfoArr $altRootRecord = t3lib_BEfunc::getRecordWSOL($this->altRoot['table'], $this->altRoot['uid'], 'pid'); $pageInfoArr = t3lib_BEfunc::readPageAccess($altRootRecord['pid'], $this->perms_clause); } else { $pageInfoArr = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = intval($pageInfoArr['uid'] > 0); } if ($access) { if (t3lib_div::_GP('ajaxUnlinkRecord')) { $unlinkDestinationPointer = $this->apiObj->flexform_getPointerFromString(t3lib_div::_GP('ajaxUnlinkRecord')); $this->apiObj->unlinkElement($unlinkDestinationPointer); } $this->calcPerms = $this->getCalcPerms($pageInfoArr['uid']); // Define the root element record: $this->rootElementTable = is_array($this->altRoot) ? $this->altRoot['table'] : 'pages'; $this->rootElementUid = is_array($this->altRoot) ? $this->altRoot['uid'] : $this->id; $this->rootElementRecord = t3lib_BEfunc::getRecordWSOL($this->rootElementTable, $this->rootElementUid, '*'); if ($this->rootElementRecord['t3ver_swapmode'] == 0 && $this->rootElementRecord['_ORIG_uid']) { $this->rootElementUid_pidForContent = $this->rootElementRecord['_ORIG_uid']; } else { if ($this->rootElementRecord['t3ver_swapmode'] == -1 && $this->rootElementRecord['t3ver_oid'] && $this->rootElementRecord['pid'] < 0) { // typo3 lacks a proper API to properly detect Offline versions and extract Live Versions therefore this is done by hand if ($this->rootElementTable == 'pages') { $this->rootElementUid_pidForContent = $this->rootElementRecord['t3ver_oid']; } else { $liveRec = t3lib_beFunc::getLiveRecord($this->rootElementTable, $this->rootElementUid); $this->rootElementUid_pidForContent = $liveRec['pid']; } } else { // If pages use current UID, otherwhise you must use the PID to define the Page ID if ($this->rootElementTable == 'pages') { $this->rootElementUid_pidForContent = $this->rootElementRecord['uid']; } else { $this->rootElementUid_pidForContent = $this->rootElementRecord['pid']; } } } // Check if we have to update the pagetree: if (t3lib_div::_GP('updatePageTree')) { t3lib_BEfunc::setUpdateSignal('updatePageTree'); } // Draw the header. $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('EXT:templavoila/resources/templates/mod1_default.html'); $this->doc->docType = 'xhtml_trans'; $this->doc->bodyTagId = 'typo3-mod-php'; $this->doc->divClass = ''; $this->doc->form = '<form action="' . htmlspecialchars('index.php?' . $this->link_getParameters()) . '" method="post">'; // Add custom styles $styleSheetFile = t3lib_extMgm::extPath($this->extKey) . 'mod1/pagemodule_' . substr(TYPO3_version, 0, 3) . '.css'; if (file_exists($styleSheetFile)) { $styleSheetFile = t3lib_extMgm::extRelPath($this->extKey) . 'mod1/pagemodule_' . substr(TYPO3_version, 0, 3) . '.css'; } else { $styleSheetFile = t3lib_extMgm::extRelPath($this->extKey) . 'mod1/pagemodule.css'; } if (isset($this->modTSconfig['properties']['stylesheet'])) { $styleSheetFile = $this->modTSconfig['properties']['stylesheet']; } $this->doc->getPageRenderer()->addCssFile($GLOBALS['BACK_PATH'] . $styleSheetFile); if (isset($this->modTSconfig['properties']['stylesheet.'])) { foreach ($this->modTSconfig['properties']['stylesheet.'] as $file) { if (substr($file, 0, 4) == 'EXT:') { list($extKey, $local) = explode('/', substr($file, 4), 2); $filename = ''; if (strcmp($extKey, '') && t3lib_extMgm::isLoaded($extKey) && strcmp($local, '')) { $file = t3lib_extMgm::extRelPath($extKey) . $local; } } $this->doc->getPageRenderer()->addCssFile($GLOBALS['BACK_PATH'] . $file); } } // Adding classic jumpToUrl function, needed for the function menu. Also, the id in the parent frameset is configured. $this->doc->JScode = $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; ' . $this->doc->redirectUrls() . ' var T3_TV_MOD1_BACKPATH = "' . $BACK_PATH . '"; var T3_TV_MOD1_RETURNURL = "' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '"; '); $this->doc->getPageRenderer()->loadExtJs(); $this->doc->JScode .= $this->doc->wrapScriptTags(' var typo3pageModule = { /** * Initialization */ init: function() { typo3pageModule.enableHighlighting(); }, /** * This method is used to bind the higlighting function "setActive" * to the mouseenter event and the "setInactive" to the mouseleave event. */ enableHighlighting: function() { Ext.get(\'typo3-docbody\') .on(\'mouseover\', typo3pageModule.setActive,typo3pageModule); }, /** * This method is used as an event handler when the * user hovers the a content element. */ setActive: function(e, t) { Ext.select(\'.active\').removeClass(\'active\').addClass(\'inactive\'); var parent = Ext.get(t).findParent(\'.t3-page-ce\', null, true); if (parent) { parent.removeClass(\'inactive\').addClass(\'active\'); } } } Ext.onReady(function() { typo3pageModule.init(); }); '); // Preparing context menues // this also adds prototype to the list of required libraries $CMparts = $this->doc->getContextMenuCode(); $mod1_file = 'dragdrop' . ($this->debug ? '.js' : '-min.js'); if (method_exists('t3lib_div', 'createVersionNumberedFilename')) { $mod1_file = t3lib_div::createVersionNumberedFilename($mod1_file); } else { $mod1_file .= '?' . filemtime(t3lib_extMgm::extPath('templavoila') . 'mod1/' . $mod1_file); } //Prototype /Scriptaculous // prototype is loaded before, so no need to include twice. $this->doc->JScodeLibArray['scriptaculous'] = '<script src="' . $this->doc->backPath . 'contrib/scriptaculous/scriptaculous.js?load=effects,dragdrop,builder" type="text/javascript"></script>'; $this->doc->JScodeLibArray['templavoila_mod1'] = '<script src="' . $this->doc->backPath . '../' . t3lib_extMgm::siteRelPath('templavoila') . 'mod1/' . $mod1_file . '" type="text/javascript"></script>'; if (isset($this->modTSconfig['properties']['javascript.']) && is_array($this->modTSconfig['properties']['javascript.'])) { // add custom javascript files foreach ($this->modTSconfig['properties']['javascript.'] as $key => $value) { if ($value) { if (substr($value, 0, 4) == 'EXT:') { list($extKey, $local) = explode('/', substr($value, 4), 2); $filename = ''; if (strcmp($extKey, '') && t3lib_extMgm::isLoaded($extKey) && strcmp($local, '')) { $value = t3lib_extMgm::extRelPath($extKey) . $local; } } $this->doc->JScodeLibArray[$key] = '<script src="' . $this->doc->backPath . htmlspecialchars($value) . '" type="text/javascript"></script>'; } } } // Set up JS for dynamic tab menu and side bar if (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000) { $this->doc->JScode .= $this->doc->getDynTabMenuJScode(); } else { $this->doc->loadJavascriptLib('js/tabmenu.js'); } $this->doc->JScode .= $this->modTSconfig['properties']['sideBarEnable'] ? $this->sideBarObj->getJScode() : ''; // Setting up support for context menus (when clicking the items icon) $this->doc->bodyTagAdditions = $CMparts[1]; $this->doc->JScode .= $CMparts[0]; $this->doc->postCode .= $CMparts[2]; // CSS for drag and drop if (t3lib_extMgm::isLoaded('t3skin')) { // Fix padding for t3skin in disabled tabs $this->doc->inDocStyles .= ' table.typo3-dyntabmenu td.disabled, table.typo3-dyntabmenu td.disabled_over, table.typo3-dyntabmenu td.disabled:hover { padding-left: 10px; } '; } $this->handleIncomingCommands(); // Start creating HTML output $render_editPageScreen = true; // Show message if the page is of a special doktype: if ($this->rootElementTable == 'pages') { // Initialize the special doktype class: $specialDoktypesObj =& t3lib_div::getUserObj('&tx_templavoila_mod1_specialdoktypes', ''); $specialDoktypesObj->init($this); $doktype = $this->rootElementRecord['doktype']; // if doktype is configured as editType render normal edit view $docTypesToEdit = $this->modTSconfig['properties']['additionalDoktypesRenderToEditView']; if ($docTypesToEdit && t3lib_div::inList($docTypesToEdit, $doktype)) { //Make sure it is editable by page module $doktype = self::DOKTYPE_NORMAL_EDIT; } $methodName = 'renderDoktype_' . $doktype; if (method_exists($specialDoktypesObj, $methodName)) { $result = $specialDoktypesObj->{$methodName}($this->rootElementRecord); if ($result !== FALSE) { $this->content .= $result; if ($GLOBALS['BE_USER']->isPSet($this->calcPerms, 'pages', 'edit')) { // Edit icon only if page can be modified by user $iconEdit = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage'))); $this->content .= '<br/><br/><strong>' . $this->link_edit($iconEdit . $LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage'), 'pages', $this->id) . '</strong>'; } $render_editPageScreen = false; // Do not output editing code for special doctypes! } } } if ($render_editPageScreen) { $editCurrentPageHTML = ''; // warn if page renders content from other page if ($this->rootElementRecord['content_from_pid']) { $contentPage = t3lib_BEfunc::getRecord('pages', intval($this->rootElementRecord['content_from_pid'])); $title = t3lib_BEfunc::getRecordTitle('pages', $contentPage); $linkToPid = 'index.php?id=' . intval($this->rootElementRecord['content_from_pid']); $link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . intval($this->rootElementRecord['content_from_pid']) . ')</a>'; $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', sprintf($LANG->getLL('content_from_pid_title'), $link), t3lib_FlashMessage::INFO); $editCurrentPageHTML = ''; t3lib_FlashMessageQueue::addMessage($flashMessage); } // Render "edit current page" (important to do before calling ->sideBarObj->render() - otherwise the translation tab is not rendered! $editCurrentPageHTML .= $this->render_editPageScreen(); if (t3lib_div::_GP('ajaxUnlinkRecord')) { $this->render_editPageScreen(); echo $this->render_sidebar(); exit; } $this->content .= $editCurrentPageHTML; // Create sortables if (is_array($this->sortableContainers)) { $script = ''; $sortable_items_json = json_encode($this->sortableItems); $all_items_json = json_encode($this->allItems); $script .= 'var all_items = ' . $all_items_json . ';' . 'var sortable_items = ' . $sortable_items_json . ';' . 'var sortable_removeHidden = ' . ($this->MOD_SETTINGS['tt_content_showHidden'] !== '0' ? 'false;' : 'true;') . 'var sortable_linkParameters = \'' . $this->link_getParameters() . '\';'; $containment = '[' . t3lib_div::csvValues($this->sortableContainers, ',', '"') . ']'; $script .= 'Event.observe(window,"load",function(){'; foreach ($this->sortableContainers as $s) { $script .= 'tv_createSortable(\'' . $s . '\',' . $containment . ');'; } $script .= '});'; $this->content .= t3lib_div::wrapJS($script); } $this->doc->divClass = 'tpm-editPageScreen'; } } else { // No access or no current page uid: $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('EXT:templavoila/resources/templates/mod1_noaccess.html'); $this->doc->docType = 'xhtml_trans'; $this->doc->bodyTagId = 'typo3-mod-php'; $cmd = t3lib_div::_GP('cmd'); switch ($cmd) { // Create a new page case 'crPage': // Output the page creation form $this->content .= $this->wizardsObj->renderWizard_createNewPage(t3lib_div::_GP('positionPid')); break; // If no access or if ID == zero // If no access or if ID == zero default: $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('default_introduction'), $LANG->getLL('title'), t3lib_FlashMessage::INFO); $this->content .= $flashMessage->render(); } } // Place content inside template $content = $this->doc->startPage($GLOBALS['LANG']->getLL('title')); $content .= $this->doc->moduleBody(array(), $this->getDocHeaderButtons(), $this->getBodyMarkers()); $content .= $this->doc->endPage(); // Replace content with templated content $this->content = $content; }
/** * [Describe function...] * * @param [type] $table: ... * @param [type] $uid: ... * @return [type] ... */ function moduleContent($table, $uid) { if ($GLOBALS['TCA'][$table]) { $this->l10nMgrTools = GeneralUtility::makeInstance(\Localizationteam\L10nmgr\Model\Tools\Tools::class); $this->l10nMgrTools->verbose = false; // Otherwise it will show records which has fields but none editable. $output = ''; if (GeneralUtility::_POST('_updateIndex')) { $output .= $this->l10nMgrTools->updateIndexForRecord($table, $uid); t3lib_BEfunc::setUpdateSignal('updatePageTree'); } $inputRecord = t3lib_BEfunc::getRecord($table, $uid, 'pid'); $pathShown = t3lib_BEfunc::getRecordPath($table == 'pages' ? $uid : $inputRecord['pid'], '', 20); $this->sysLanguages = $this->l10nMgrTools->t8Tools->getSystemLanguages($table == 'pages' ? $uid : $inputRecord['pid']); $languageListArray = explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages'] ? $GLOBALS['BE_USER']->groupData['allowed_languages'] : implode(',', array_keys($this->sysLanguages))); $limitLanguageList = trim(GeneralUtility::_GP('languageList')); foreach ($languageListArray as $kkk => $val) { if ($limitLanguageList && !GeneralUtility::inList($limitLanguageList, $val)) { unset($languageListArray[$kkk]); } } if (!count($languageListArray)) { $languageListArray[] = 0; } $languageList = implode(',', $languageListArray); // Fetch translation index records: if ($table != 'pages') { $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_l10nmgr_index', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'tx_l10nmgr_index') . ' AND recuid=' . (int) $uid . ' AND translation_lang IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($languageList) . ')' . ' AND workspace=' . (int) $GLOBALS['BE_USER']->workspace . ' AND (flag_new>0 OR flag_update>0 OR flag_noChange>0 OR flag_unknown>0)', '', 'translation_lang, tablename, recuid'); } else { $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_l10nmgr_index', 'recpid=' . (int) $uid . ' AND translation_lang IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($languageList) . ')' . ' AND workspace=' . (int) $GLOBALS['BE_USER']->workspace . ' AND (flag_new>0 OR flag_update>0 OR flag_noChange>0 OR flag_unknown>0)', '', 'translation_lang, tablename, recuid'); } # \TYPO3\CMS\Core\Utility\GeneralUtility::debugRows($records,'Index entries for '.$table.':'.$uid); $tRows = array(); $tRows[] = '<tr class="bgColor2 tableheader"> <td colspan="2">Base element:</td> <td colspan="2">Translation:</td> <td>Action:</td> <td><img src="../flags_new.png" width="10" height="16" alt="New" title="New" /></td> <td><img src="../flags_unknown.png" width="10" height="16" alt="Unknown" title="Unknown" /></td> <td><img src="../flags_update.png" width="10" height="16" alt="Update" title="Update" /></td> <td><img src="../flags_ok.png" width="10" height="16" alt="OK" title="OK" /></td> <td>Diff:</td> </tr>'; //\TYPO3\CMS\Core\Utility\GeneralUtility::debugRows($records); foreach ($records as $rec) { if ($rec['tablename'] == 'pages') { $tRows[] = $this->makeTableRow($rec); } } if (count($tRows) > 1) { $tRows[] = '<tr><td colspan="8"> </td></tr>'; } foreach ($records as $rec) { if ($rec['tablename'] != 'pages') { $tRows[] = $this->makeTableRow($rec); } } $output .= 'Path: <i>' . $pathShown . '</i><br><table border="0" cellpadding="1" cellspacing="1">' . implode('', $tRows) . '</table>'; // Updating index if ($GLOBALS['BE_USER']->isAdmin()) { $output .= '<br><br>Functions for "' . $table . ':' . $uid . '":<br/> <input type="submit" name="_updateIndex" value="Update Index" /><br> <input type="submit" name="_" value="Flush Translations" onclick="' . htmlspecialchars('document.location="../cm3/index.php?table=' . htmlspecialchars($table) . '&id=' . (int) $uid . '&cmd=flushTranslations";return false;') . '"/><br> <input type="submit" name="_" value="Create priority" onclick="' . htmlspecialchars('document.location="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode('db_list.php?id=0&table=tx_l10nmgr_priorities') . '&edit[tx_l10nmgr_priorities][0]=new&defVals[tx_l10nmgr_priorities][element]=' . rawurlencode($table . '_' . $uid) . '";return false;') . '"/><br> '; } return $output; } }
/** * Main function creating the content for the module. * * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj */ function main() { global $SOBE, $LANG; $theCode = ''; $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8); // create new pages here? $pRec = t3lib_BEfunc::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause); $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect'); $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0); if (is_array($pRec)) { $data = t3lib_div::_GP('data'); if (is_array($data['pages'])) { if (t3lib_div::_GP('createInListEnd')) { $endI = end($menuItems); $thePid = -intval($endI['uid']); if (!$thePid) { $thePid = $this->pObj->id; } } else { $thePid = $this->pObj->id; } $firstRecord = true; foreach ($data['pages'] as $identifier => $dat) { if (!trim($dat['title'])) { unset($data['pages'][$identifier]); } else { $data['pages'][$identifier]['hidden'] = t3lib_div::_GP('hidePages') ? 1 : 0; if ($firstRecord) { $firstRecord = false; $data['pages'][$identifier]['pid'] = $thePid; } else { $data['pages'][$identifier]['pid'] = '-' . $previousIdentifier; } $previousIdentifier = $identifier; } } if (count($data['pages'])) { reset($data); $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; // set default TCA values specific for the user $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults'); if (is_array($TCAdefaultOverride)) { $tce->setDefaultsFromUserTS($TCAdefaultOverride); } $tce->start($data, array()); $tce->process_datamap(); t3lib_BEfunc::setUpdateSignal('updatePageTree'); $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create')); } else { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), t3lib_FlashMessage::ERROR); } $theCode .= $flashMessage->render(); // Display result: $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0); $lines = array(); foreach ($menuItems as $rec) { t3lib_BEfunc::workspaceOL('pages', $rec); if (is_array($rec)) { $lines[] = '<nobr>' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>'; } } $theCode .= '<h4>' . $LANG->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines); } else { // Create loremIpsum code: if (t3lib_extMgm::isLoaded('lorem_ipsum')) { $loremIpsumObj = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz'); } // Display create form $lines = array(); for ($a = 0; $a < 9; $a++) { $lines[] = '<label for="page_new_' . $a . '"> ' . $LANG->getLL('wiz_newPages_page') . ' ' . ($a + 1) . ': </label><input type="text" id="page_new_' . $a . '" name="data[pages][NEW' . $a . '][title]"' . $this->pObj->doc->formWidth(35) . ' />' . (is_object($loremIpsumObj) ? '<a href="#" onclick="' . htmlspecialchars($loremIpsumObj->getHeaderTitleJS('document.forms[0][\'data[pages][NEW' . $a . '][title]\'].value', 'title')) . '">' . $loremIpsumObj->getIcon('', $this->pObj->doc->backPath) . '</a>' : ''); } $theCode .= '<h4>' . $LANG->getLL('wiz_newPages') . ':</h4>' . implode('<br />', $lines) . '<br /><br /> <input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> <label for="createInListEnd">' . $LANG->getLL('wiz_newPages_listEnd') . '</label><br /> <input type="checkbox" name="hidePages" id="hidePages" value="1" /> <label for="hidePages">' . $LANG->getLL('wiz_newPages_hidePages') . '</label><br /><br /> <input type="submit" name="create" value="' . $LANG->getLL('wiz_newPages_lCreate') . '" onclick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')) . ')" /> <input type="reset" value="' . $LANG->getLL('wiz_newPages_lReset') . '" /><br />'; } } else { $theCode .= $GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_errorMsg1')); } // CSH $theCode .= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardcrpages', $GLOBALS['BACK_PATH'], '<br />|'); $out = $this->pObj->doc->section($LANG->getLL('wiz_crMany'), $theCode, 0, 1); return $out; }
/** * Handling the closing of a document * * @param integer Close code: 0/1 will redirect to $this->retUrl, 3 will clear the docHandler (thus closing all documents) and otehr values will call setDocument with ->retUrl * @return void */ function closeDocument($code = 0) { global $BE_USER; // If current document is found in docHandler, // then unset it, possibly unset it ALL and finally, write it to the session data if (isset($this->docHandler[$this->storeUrlMd5])) { // add the closing document to the recent documents $recentDocs = $BE_USER->getModuleData('opendocs::recent'); if (!is_array($recentDocs)) { $recentDocs = array(); } $closedDoc = $this->docHandler[$this->storeUrlMd5]; $recentDocs = array_merge(array($this->storeUrlMd5 => $closedDoc), $recentDocs); if (count($recentDocs) > 8) { $recentDocs = array_slice($recentDocs, 0, 8); } // remove it from the list of the open documents unset($this->docHandler[$this->storeUrlMd5]); if ($code == '3') { $recentDocs = array_merge($this->docHandler, $recentDocs); $this->docHandler = array(); } $BE_USER->pushModuleData('opendocs::recent', $recentDocs); $BE_USER->pushModuleData('alt_doc.php', array($this->docHandler, $this->docDat[1])); t3lib_BEfunc::setUpdateSignal('tx_opendocs::updateNumber', count($this->docHandler)); } // If ->returnEditConf is set, then add the current content of editconf to the ->retUrl variable: (used by other scripts, like wizard_add, to know which records was created or so...) if ($this->returnEditConf && $this->retUrl != 'dummy.php') { $this->retUrl .= '&returnEditConf=' . rawurlencode(serialize($this->editconf)); } // If code is NOT set OR set to 1, then make a header location redirect to $this->retUrl if (!$code || $code == 1) { t3lib_utility_Http::redirect($this->retUrl); } else { $this->setDocument('', $this->retUrl); } }
/** * Step 3: Begin template mapping * * @return void */ function wizard_step3() { // Save session data with filename: $cfg = t3lib_div::_POST('CFG'); if (isset($cfg['sitetitle'])) { $this->wizardData['sitetitle'] = trim($cfg['sitetitle']); } if (isset($cfg['siteurl'])) { $this->wizardData['siteurl'] = trim($cfg['siteurl']); } if (isset($cfg['username'])) { $this->wizardData['username'] = trim($cfg['username']); } // If the create-site button WAS clicked: if (t3lib_div::_POST('_create_site')) { // Show selected template file: if ($this->wizardData['file'] && $this->wizardData['sitetitle'] && $this->wizardData['username']) { // DO import: $import = $this->getImportObj(); if (isset($this->modTSconfig['properties']['newTvSiteFile'])) { $inFile = t3lib_div::getFileAbsFileName($this->modTSconfig['properties']['newTVsiteTemplate']); } else { $inFile = t3lib_extMgm::extPath('templavoila') . 'mod2/new_tv_site.xml'; } if (@is_file($inFile) && $import->loadFile($inFile,1)) { $import->importData($this->importPageUid); // Update various fields (the index values, eg. the "1" in "$import->import_mapId['pages'][1]]..." are the UIDs of the original records from the import file!) $data = array(); $data['pages'][t3lib_BEfunc::wsMapId('pages',$import->import_mapId['pages'][1])]['title'] = $this->wizardData['sitetitle']; $data['sys_template'][t3lib_BEfunc::wsMapId('sys_template',$import->import_mapId['sys_template'][1])]['title'] = $GLOBALS['LANG']->getLL('newsitewizard_maintemplate', 1) . ' ' . $this->wizardData['sitetitle']; $data['sys_template'][t3lib_BEfunc::wsMapId('sys_template',$import->import_mapId['sys_template'][1])]['sitetitle'] = $this->wizardData['sitetitle']; $data['tx_templavoila_tmplobj'][t3lib_BEfunc::wsMapId('tx_templavoila_tmplobj',$import->import_mapId['tx_templavoila_tmplobj'][1])]['fileref'] = $this->wizardData['file']; $data['tx_templavoila_tmplobj'][t3lib_BEfunc::wsMapId('tx_templavoila_tmplobj',$import->import_mapId['tx_templavoila_tmplobj'][1])]['templatemapping'] = serialize( array( 'MappingInfo' => array( 'ROOT' => array( 'MAP_EL' => 'body[1]/INNER' ) ), 'MappingInfo_head' => array( 'headElementPaths' => array('link[1]','link[2]','link[3]','style[1]','style[2]','style[3]'), 'addBodyTag' => 1 ) ) ); // Update user settings $newUserID = t3lib_BEfunc::wsMapId('be_users',$import->import_mapId['be_users'][2]); $newGroupID = t3lib_BEfunc::wsMapId('be_groups',$import->import_mapId['be_groups'][1]); $data['be_users'][$newUserID]['username'] = $this->wizardData['username']; $data['be_groups'][$newGroupID]['title'] = $this->wizardData['username']; foreach($import->import_mapId['pages'] as $newID) { $data['pages'][$newID]['perms_userid'] = $newUserID; $data['pages'][$newID]['perms_groupid'] = $newGroupID; } // Set URL if applicable: if (strlen($this->wizardData['siteurl'])) { $data['sys_domain']['NEW']['pid'] = t3lib_BEfunc::wsMapId('pages',$import->import_mapId['pages'][1]); $data['sys_domain']['NEW']['domainName'] = $this->wizardData['siteurl']; } // Execute changes: $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->dontProcessTransformations = 1; $tce->start($data,Array()); $tce->process_datamap(); // Setting environment: $this->wizardData['rootPageId'] = $import->import_mapId['pages'][1]; $this->wizardData['templateObjectId'] = t3lib_BEfunc::wsMapId('tx_templavoila_tmplobj',$import->import_mapId['tx_templavoila_tmplobj'][1]); $this->wizardData['typoScriptTemplateID'] = t3lib_BEfunc::wsMapId('sys_template',$import->import_mapId['sys_template'][1]); t3lib_BEfunc::setUpdateSignal('updatePageTree'); $outputString .= $GLOBALS['LANG']->getLL('newsitewizard_maintemplate', 1) . '<hr/>'; } } else { $outputString .= $GLOBALS['LANG']->getLL('newsitewizard_maintemplate', 1); } } // If a template Object id was found, continue with mapping: if ($this->wizardData['templateObjectId']) { $url = '../cm1/index.php?table=tx_templavoila_tmplobj&uid='.$this->wizardData['templateObjectId'].'&SET[selectHeaderContent]=0&_reload_from=1&id=' . $this->id . '&returnUrl='.rawurlencode('../mod2/index.php?SET[wiz_step]=4'); $outputString.= $GLOBALS['LANG']->getLL('newsitewizard_step3ready') . ' <br/> <br/> <img src="mapbody_animation.gif" style="border: 2px black solid;" alt=""><br/> <br/> <br/><input type="submit" value="' . $GLOBALS['LANG']->getLL('newsitewizard_startmapping', 1) . '" onclick="'.htmlspecialchars('document.location=\''.$url.'\'; return false;').'" /> '; } // Add output: $this->content.= $this->doc->section($GLOBALS['LANG']->getLL('newsitewizard_beginmapping', 1), $outputString, 0, 1); }
/** * Redirecting the user after the processing has been done. * Might also display error messages directly, if any. * * @return void */ public function finish() { // Prints errors, if there are any $this->fileProcessor->printLogErrorMessages($this->redirect); t3lib_BEfunc::setUpdateSignal('updateFolderTree'); if ($this->redirect) { t3lib_utility_Http::redirect($this->redirect); } }
/** * Executing the posted actions ... * * @return void */ function main() { global $BE_USER, $TYPO3_CONF_VARS; // LOAD TCEmain with data and cmd arrays: $this->tce->start($this->data, $this->cmd); if (is_array($this->mirror)) { $this->tce->setMirror($this->mirror); } // Checking referer / executing $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER')); $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY'); if ($httpHost != $refInfo['host'] && $this->vC != $BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) { $this->tce->log('', 0, 0, 0, 1, 'Referer host "%s" and server host "%s" did not match and veriCode was not valid either!', 1, array($refInfo['host'], $httpHost)); } else { // Register uploaded files $this->tce->process_uploads($_FILES); // Execute actions: $this->tce->process_datamap(); $this->tce->process_cmdmap(); // Clearing cache: $this->tce->clear_cacheCmd($this->cacheCmd); // Update page tree? if ($this->uPT && (isset($this->data['pages']) || isset($this->cmd['pages']))) { t3lib_BEfunc::setUpdateSignal('updatePageTree'); } } }
/** * Main function creating the content for the module. * * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj */ function main() { global $SOBE, $LANG; if ($GLOBALS['BE_USER']->workspace === 0) { $theCode = ''; // check if user has modify permissions to $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect'); $sortByField = t3lib_div::_GP('sortByField'); if ($sortByField) { $menuItems = array(); if (t3lib_div::inList('title,subtitle,crdate,tstamp', $sortByField)) { $menuItems = $sys_pages->getMenu($this->pObj->id, 'uid,pid,title', $sortByField, '', 0); } elseif ($sortByField == 'REV') { $menuItems = $sys_pages->getMenu($this->pObj->id, 'uid,pid,title', 'sorting', '', 0); $menuItems = array_reverse($menuItems); } if (count($menuItems)) { $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $menuItems = array_reverse($menuItems); $cmd = array(); foreach ($menuItems as $r) { $cmd['pages'][$r['uid']]['move'] = $this->pObj->id; } $tce->start(array(), $cmd); $tce->process_cmdmap(); t3lib_BEfunc::setUpdateSignal('updatePageTree'); } } // $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0); $lines = array(); $lines[] = '<tr class="t3-row-header"> <td>' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'), 'title') . '</td> ' . (t3lib_extMgm::isLoaded('cms') ? '<td> ' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_subtitle'), 'subtitle') . '</td>' : '') . ' <td>' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tChange'), 'tstamp') . '</td> <td>' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tCreate'), 'crdate') . '</td> </tr>'; foreach ($menuItems as $rec) { $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(2); // edit permissions for that page! $pRec = t3lib_BEfunc::getRecord('pages', $rec['uid'], 'uid', ' AND ' . $m_perms_clause); $lines[] = '<tr><td nowrap="nowrap">' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec) . (!is_array($pRec) ? $GLOBALS['TBE_TEMPLATE']->rfw('<strong>' . $LANG->getLL('wiz_W', 1) . '</strong> ') : '') . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . ' </td> ' . (t3lib_extMgm::isLoaded('cms') ? '<td nowrap="nowrap">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['subtitle'], $GLOBALS['BE_USER']->uc['titleLen'])) . ' </td>' : '') . ' <td nowrap="nowrap">' . t3lib_Befunc::datetime($rec['tstamp']) . ' </td> <td nowrap="nowrap">' . t3lib_Befunc::datetime($rec['crdate']) . ' </td> </tr>'; } $theCode .= '<h4>' . $LANG->getLL('wiz_currentPageOrder', TRUE) . '</h4> <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">' . implode('', $lines) . '</table><br />'; if (count($menuItems)) { // Menu: $lines = array(); $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'), 'title'); if (t3lib_extMgm::isLoaded('cms')) { $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_subtitle'), 'subtitle'); } $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tChange'), 'tstamp'); $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tCreate'), 'crdate'); $lines[] = ''; $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_REVERSE'), 'REV'); $theCode .= '<h4>' . $LANG->getLL('wiz_changeOrder') . '</h4>' . implode('<br />', $lines); } // CSH: $theCode .= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardsortpages', $GLOBALS['BACK_PATH'], '<br />|'); $out = $this->pObj->doc->section($LANG->getLL('wiz_sort'), $theCode, 0, 1); } else { $out = $this->pObj->doc->section($LANG->getLL('wiz_sort'), 'Sorry, this function is not available in the current draft workspace!', 0, 1, 1); } return $out; }
/** * [Describe function...] * * @param [type] $table: ... * @param [type] $uid: ... * @return [type] ... */ function moduleContent($table, $uid, $cmd) { if ($GLOBALS['TCA'][$table]) { $output = ''; $this->l10nMgrTools = t3lib_div::makeInstance('tx_l10nmgr_tools'); $this->l10nMgrTools->verbose = FALSE; // Otherwise it will show records which has fields but none editable. switch ((string) $cmd) { case 'updateIndex': $output = $this->l10nMgrTools->updateIndexForRecord($table, $uid); t3lib_BEfunc::setUpdateSignal('updatePageTree'); break; case 'flushTranslations': if ($GLOBALS['BE_USER']->isAdmin()) { $res = $this->l10nMgrTools->flushTranslations($table, $uid, t3lib_div::_POST('_flush') ? TRUE : FALSE); if (!t3lib_div::_POST('_flush')) { $output .= 'To flush the translations shown below, press the "Flush" button below:<br/><input type="submit" name="_flush" value="FLUSH" /><br/><br/>'; } else { $output .= 'Translations below were flushed!'; } $output .= t3lib_utility_Debug::viewArray($res[0]); if (t3lib_div::_POST('_flush')) { $output .= $this->l10nMgrTools->updateIndexForRecord($table, $uid); t3lib_BEfunc::setUpdateSignal('updatePageTree'); } } break; case 'createPriority': header('Location: ' . t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode('db_list.php?id=0&table=tx_l10nmgr_priorities') . '&edit[tx_l10nmgr_priorities][0]=new&defVals[tx_l10nmgr_priorities][element]=' . rawurlencode($table . '_' . $uid))); break; case 'managePriorities': header('Location: ' . t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'] . 'db_list.php?id=0&table=tx_l10nmgr_priorities')); break; } return $output; } }
/** * Main function creating the content for the module. * * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj */ function main() { global $SOBE, $LANG; $theCode = ''; $this->tsConfig = t3lib_BEfunc::getPagesTSconfig($this->pObj->id); $this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array(); // Create loremIpsum code: if (t3lib_extMgm::isLoaded('lorem_ipsum')) { $this->loremIpsumObject = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz'); } $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8); // create new pages here? $pRec = t3lib_BEfunc::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause); $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect'); $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0); if (is_array($pRec)) { $data = t3lib_div::_GP('data'); if (is_array($data['pages'])) { if (t3lib_div::_GP('createInListEnd')) { $endI = end($menuItems); $thePid = -intval($endI['uid']); if (!$thePid) { $thePid = $this->pObj->id; } } else { $thePid = $this->pObj->id; } $firstRecord = true; $previousIdentifier = ''; foreach ($data['pages'] as $identifier => $dat) { if (!trim($dat['title'])) { unset($data['pages'][$identifier]); } else { $data['pages'][$identifier]['hidden'] = t3lib_div::_GP('hidePages') ? 1 : 0; if ($firstRecord) { $firstRecord = false; $data['pages'][$identifier]['pid'] = $thePid; } else { $data['pages'][$identifier]['pid'] = '-' . $previousIdentifier; } $previousIdentifier = $identifier; } } if (count($data['pages'])) { reset($data); $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; // set default TCA values specific for the user $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults'); if (is_array($TCAdefaultOverride)) { $tce->setDefaultsFromUserTS($TCAdefaultOverride); } $tce->start($data, array()); $tce->process_datamap(); t3lib_BEfunc::setUpdateSignal('updatePageTree'); $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create')); } else { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), t3lib_FlashMessage::ERROR); } $theCode .= $flashMessage->render(); // Display result: $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0); $lines = array(); foreach ($menuItems as $rec) { t3lib_BEfunc::workspaceOL('pages', $rec); if (is_array($rec)) { $lines[] = '<nobr>' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>'; } } $theCode .= '<h4>' . $LANG->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines); } else { // Display create form $lines = array(); for ($a = 0; $a < 9; $a++) { $lines[] = $this->getFormLine($a); } $theCode .= '<h4>' . $LANG->getLL('wiz_newPages') . ':</h4>' . '<div id="formFieldContainer">' . implode('', $lines) . '</div>' . '<br class="clearLeft" />' . '<input type="button" id="createNewFormFields" value="' . $LANG->getLL('wiz_newPages_addMoreLines') . '" />' . '<br /><br /> <input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> <label for="createInListEnd">' . $LANG->getLL('wiz_newPages_listEnd') . '</label><br /> <input type="checkbox" name="hidePages" id="hidePages" value="1" /> <label for="hidePages">' . $LANG->getLL('wiz_newPages_hidePages') . '</label><br /><br /> <input type="submit" name="create" value="' . $LANG->getLL('wiz_newPages_lCreate') . '" onclick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')) . ')" /> <input type="reset" value="' . $LANG->getLL('wiz_newPages_lReset') . '" /><br />'; // Add ExtJS inline code $extCode = ' var tpl = "' . addslashes(str_replace(array(LF, TAB), array('', ''), $this->getFormLine('#'))) . '", i, line, div, bg, label; var lineCounter = 9; Ext.get("createNewFormFields").on("click", function() { div = Ext.get("formFieldContainer"); for (i = 0; i < 5; i++) { label = lineCounter + i + 1; bg = label % 2 === 0 ? 6 : 4; line = String.format(tpl, (lineCounter + i), label, bg); div.insertHtml("beforeEnd", line); } lineCounter += 5; }); '; /** @var t3lib_pageRenderer **/ $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer(); $pageRenderer->loadExtJS(); $pageRenderer->addExtOnReadyCode($extCode); $pageRenderer->addCssInlineBlock('tx_wizardcrpages_webfunc_2', ' #formFieldContainer {float: left; margin: 0 0 10px 0;} .clearLeft {clear: left;} #formFieldContainer label {width: 70px; display: inline-block;} #formFieldContainer input {margin:4px 2px; padding:1px; vertical-align:middle} #formFieldContainer span {padding: 0 3px;} '); } } else { $theCode .= $GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_errorMsg1')); } // CSH $theCode .= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardcrpages', $GLOBALS['BACK_PATH'], '<br />|'); $out = $this->pObj->doc->section($LANG->getLL('wiz_crMany'), $theCode, 0, 1); return $out; }