/** * Initialize internal variables. * * @return void */ function init() { global $BE_USER, $BACK_PATH, $TBE_MODULES_EXT; // Setting class files to include: if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) { $this->include_once = array_merge($this->include_once, $TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']); } // Setting internal vars: $this->id = intval(t3lib_div::GPvar('id')); $this->parentRecord = t3lib_div::GPvar('parentRecord'); $this->altRoot = t3lib_div::GPvar('altRoot'); $this->defVals = t3lib_div::GPvar('defVals'); // Starting the document template object: $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->docType = 'xhtml_trans'; $this->doc->backPath = $BACK_PATH; $this->doc->JScode = ''; # ### Mansoor Ahmad - Dont know why it used # //$this->doc->form='<form action="" name="editForm">'; // Getting the current page and receiving access information (used in main()) $perms_clause = $BE_USER->getPagePermsClause(1); $pageinfo = t3lib_BEfunc::readPageAccess($this->id, $perms_clause); $this->access = is_array($pageinfo) ? 1 : 0; $this->apiObj = t3lib_div::makeInstance('tx_templavoila_api'); // If no parent record was specified, find one: if (!$this->parentRecord) { $mainContentAreaFieldName = $this->apiObj->ds_getFieldNameByColumnPosition($this->id, 0); if ($mainContentAreaFieldName != FALSE) { $this->parentRecord = 'pages:' . $this->id . ':sDEF:lDEF:' . $mainContentAreaFieldName . ':vDEF:0'; } } }
/** * Renders a record list as known from the TYPO3 list module * Note: This feature is experimental! * * @param string $tableName name of the database table * @param array $fieldList list of fields to be displayed. If empty, only the title column (configured in $TCA[$tableName]['ctrl']['title']) is shown * @param integer $storagePid by default, records are fetched from the storage PID configured in persistence.storagePid. With this argument, the storage PID can be overwritten * @param integer $levels corresponds to the level selector of the TYPO3 list module. By default only records from the current storagePid are fetched * @param string $filter corresponds to the "Search String" textbox of the TYPO3 list module. If not empty, only records matching the string will be fetched * @param integer $recordsPerPage amount of records to be displayed at once. Defaults to $TCA[$tableName]['interface']['maxSingleDBListItems'] or (if that's not set) to 100 * @param string $sortField table field to sort the results by * @param boolean $sortDescending if TRUE records will be sorted in descending order * @param boolean $readOnly if TRUE, the edit icons won't be shown. Otherwise edit icons will be shown, if the current BE user has edit rights for the specified table! * @param boolean $enableClickMenu enables context menu * @param string $clickTitleMode one of "edit", "show" (only pages, tt_content), "info" * @param boolean $alternateBackgroundColors if set, rows will have alternate background colors * @return string the rendered record list * @see localRecordList */ public function render($tableName, array $fieldList = array(), $storagePid = NULL, $levels = 0, $filter = '', $recordsPerPage = 0, $sortField = '', $sortDescending = FALSE, $readOnly = FALSE, $enableClickMenu = TRUE, $clickTitleMode = NULL, $alternateBackgroundColors = FALSE) { $pageinfo = t3lib_BEfunc::readPageAccess(t3lib_div::_GP('id'), $GLOBALS['BE_USER']->getPagePermsClause(1)); $dblist = t3lib_div::makeInstance('localRecordList'); $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->pageRow = $pageinfo; if ($readOnly === FALSE) { $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo); } $dblist->showClipboard = FALSE; $dblist->disableSingleTableView = TRUE; $dblist->clickTitleMode = $clickTitleMode; $dblist->alternateBgColors = $alternateBackgroundColors; $dblist->clickMenuEnabled = $enableClickMenu; if ($storagePid === NULL) { $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $storagePid = $frameworkConfiguration['persistence']['storagePid']; } $dblist->start($storagePid, $tableName, (int) t3lib_div::_GP('pointer'), $filter, $levels, $recordsPerPage); $dblist->allFields = TRUE; $dblist->dontShowClipControlPanels = TRUE; $dblist->displayFields = FALSE; $dblist->setFields = array($tableName => $fieldList); $dblist->noControlPanels = TRUE; $dblist->sortField = $sortField; $dblist->sortRev = $sortDescending; $dblist->script = $_SERVER['REQUEST_URI']; $dblist->generateList(); return $dblist->HTMLcode; }
/** * Render javascript in header * * @return string the rendered page info icon * @see template::getPageInfo() Note: can't call this method as it's protected! */ public function render() { $doc = $this->getDocInstance(); $id = t3lib_div::_GP('id'); $pageRecord = t3lib_BEfunc::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Add icon with clickmenu, etc: if ($pageRecord['uid']) { // If there IS a real page $alttext = t3lib_BEfunc::getRecordIconAltText($pageRecord, 'pages'); $iconImg = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext))); // Make Icon: $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); } else { // On root-level of page tree // Make Icon $iconImg = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />'; if ($BE_USER->user['admin']) { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>'; return $pageInfo; }
/** * Initializes the Module * * @return void */ public function initialize() { parent::init(); $this->doc = t3lib_div::makeInstance('template'); $this->doc->setModuleTemplate(t3lib_extMgm::extPath('recycler') . 'mod1/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setExtDirectStateProvider(); $this->pageRenderer = $this->doc->getPageRenderer(); $this->relativePath = t3lib_extMgm::extRelPath('recycler'); $this->pageRecord = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $this->isAccessibleForCurrentUser = $this->id && is_array($this->pageRecord) || !$this->id && $this->isCurrentUserAdmin(); //don't access in workspace if ($GLOBALS['BE_USER']->workspace !== 0) { $this->isAccessibleForCurrentUser = false; } //read configuration $modTS = $GLOBALS['BE_USER']->getTSConfig('mod.recycler'); if ($this->isCurrentUserAdmin()) { $this->allowDelete = true; } else { $this->allowDelete = $modTS['properties']['allowDelete'] == '1'; } if (isset($modTS['properties']['recordsPageLimit']) && intval($modTS['properties']['recordsPageLimit']) > 0) { $this->recordsPageLimit = intval($modTS['properties']['recordsPageLimit']); } }
/** * Initialize module header etc and call extObjContent function * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH; // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; // Template markers $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => ''); $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/func.html'); // ************************** // Main // ************************** if ($this->id && $access) { // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL; } '); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->form = '<form action="index.php" method="post"><input type="hidden" name="id" value="' . $this->id . '" />'; $vContent = $this->doc->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } $this->extObjContent(); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); $markers['CONTENT'] = $this->content; } else { // If no access or if ID == zero $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('clickAPage_content'), $LANG->getLL('title'), t3lib_FlashMessage::INFO); $this->content = $flashMessage->render(); // 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('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the # $this->id parameter which will contain the uid-number of the page # clicked in the page tree * * @return [type] ... */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this // page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user["admin"] && !$this->id) { // Draw the header. $this->doc = t3lib_div::makeInstance("mediumDoc"); $this->doc->backPath = $BACK_PATH; $this->doc->form = '<form action="" method="POST">'; // JavaScript $this->doc->JScode = ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; $headerSection = $this->doc->getHeader("pages", $this->pageinfo, $this->pageinfo["_thePath"]) . "<br />" . $LANG->sL("LLL:EXT:lang/locallang_core.xml:labels.path") . ": " . t3lib_div::fixed_lgd_pre($this->pageinfo["_thePath"], 50); $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->content .= $this->doc->header($LANG->getLL("title")); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section("", $this->doc->funcMenu($headerSection, t3lib_BEfunc::getFuncMenu($this->id, "SET[function]", $this->MOD_SETTINGS["function"], $this->MOD_MENU["function"]))); $this->content .= $this->doc->divider(5); // Render content: $this->moduleContent(); // Backlink $this->content .= $this->doc->spacer(10) . $this->doc->section("", "<a href='index.php' title='Back'>Back</a>"); // ShortCut if ($BE_USER->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section("", $this->doc->makeShortcutIcon("id", implode(",", array_keys($this->MOD_MENU)), $this->MCONF["name"])); } $this->content .= $this->doc->spacer(10); } else { // If no access or if ID == zero $this->doc = t3lib_div::makeInstance("mediumDoc"); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->content .= $this->doc->header($LANG->getLL("title")); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * * @return void */ public function main() { // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) { // Draw the header. $this->doc = t3lib_div::makeInstance('bigDoc'); $this->doc->getPageRenderer()->addCssFile(t3lib_extMgm::extRelPath('medbootstraptools') . 'res/css/bemodul.css'); $this->doc->getPageRenderer()->addCssFile(t3lib_extMgm::extRelPath('medbootstraptools') . 'res/bootstrap/css/bootstrap.min.css'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">'; // JavaScript $this->doc->JScode = ' <script src="../typo3conf/ext/medbootstraptools/res/js/jquery-1.8.3.min.js"></script> <script src="../typo3conf/ext/medbootstraptools/res/js/functions.js"></script> <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -50); $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); //$this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title')); //$this->content .= $this->doc->spacer(5); //$this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']))); //$this->content .= $this->doc->divider(5); // Render content: $this->moduleContent(); // Shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'])); } $this->content .= $this->doc->spacer(10); } else { // If no access or if ID == zero $this->doc = t3lib_div::makeInstance('bigDoc'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * * @return [type] ... */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { // Draw the header. $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">'; // JavaScript $this->doc->JScode = ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -50); $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']))); $this->content .= $this->doc->divider(5); // Render content: $this->moduleContent(); // ShortCut if ($BE_USER->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'])); } $this->content .= $this->doc->spacer(10); } else { // If no access or if ID == zero $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Main function of the module * * Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree */ public function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { // Page template $this->doc = t3lib_div::makeInstance('template'); $this->doc->setModuleTemplate(t3lib_extMgm::extPath('tq_seo') . 'res/backend/template/' . $this->_docTemplate . '.html'); $this->doc->backPath = $BACK_PATH; $this->pageRenderer = $this->doc->getPageRenderer(); // ExtJS $this->pageRenderer->loadExtJS(); $this->pageRenderer->enableExtJSQuickTips(); $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('tq_seo') . 'res/backend/js/Ext.ux.plugin.FitToParent.js'); // ExtJS Debug //$this->pageRenderer->enableExtJsDebug(); // Std javascript $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('tq_seo') . 'res/backend/js/TQSeo.js'); // CSS $this->pageRenderer->addCssFile($BACK_PATH . t3lib_extMgm::extRelPath('tq_seo') . 'res/backend/css/tqseo_backend.css'); // Set the form $this->doc->form = '<form name="tx_seo_form" id="tx_seo_form" method="post" action="">'; // JavaScript for main function menu $this->doc->JScode = ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->moduleContent(); $content = $this->doc->moduleBody(array(), $this->getDocHeaderButtons(), $this->getTemplateMarkers()); // Renders the module page $this->content = $this->doc->render($LANG->getLL('title'), $content); } else { // If no access or if ID == zero $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Initializes sidebar object. Checks if there any tables to display and * adds sidebar item if there are any. * * @param object $pObj Parent object * @return void */ function init(&$pObj) { $this->pObj =& $pObj; $this->tables = t3lib_div::trimExplode(',', $this->pObj->modTSconfig['properties']['recordDisplay_tables'], true); if ($this->tables) { // Get permissions $this->calcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::readPageAccess($this->pObj->id, $this->pObj->perms_clause)); foreach ($this->tables as $table) { if ($this->canDisplayTable($table)) { // At least one displayable table found! $this->pObj->sideBarObj->addItem('records', $this, 'sidebar_renderRecords', $GLOBALS['LANG']->getLL('records'), 25); break; } } } }
/** * Main function of the module. Write the content to $this->content * * @return the wizard */ function main() { global $BE_USER, $BACK_PATH; // Draw the header. $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; // GPvars: $this->P = t3lib_div::_GP('P'); $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user['admin'] && !$this->id || $BE_USER->user['uid'] && !$this->id) { if ($BE_USER->user['admin'] && !$this->id || $BE_USER->user['uid'] && !$this->id) { $this->moduleContent(); } } }
/** * Main function of the module. Write the content to $this->content */ function main() { global $AB, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $HTTP_GET_VARS, $HTTP_POST_VARS, $CLIENT, $TYPO3_CONF_VARS; // Draw the header. $this->doc = t3lib_div::makeInstance("mediumDoc"); $this->doc->backPath = $BACK_PATH; $this->doc->form = '<form action="" method="POST">'; // JavaScript $this->doc->JScode = ' <script language="javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $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); } $headerSection = $this->doc->getHeader("pages", $this->pageinfo, $this->pageinfo["_thePath"]) . "<br>" . $LANG->php3Lang["labels"]["path"] . ": " . t3lib_div::fixed_lgd_pre($this->pageinfo["_thePath"], 50); $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->content .= $this->doc->header($LANG->getLL("title")); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section("", $this->doc->funcMenu($headerSection, t3lib_BEfunc::getFuncMenu($this->id, "SET[function]", $this->MOD_SETTINGS["function"], $this->MOD_MENU["function"]))); $this->content .= $this->doc->divider(5); // Render content: $this->moduleContent(); // ShortCut if ($BE_USER->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section("", $this->doc->makeShortcutIcon("id", implode(",", array_keys($this->MOD_MENU)), $this->MCONF["name"])); } } $this->content .= $this->doc->spacer(10); }
/** * Renders the current page path * * @return string the rendered page path * @see template::getPagePath() Note: can't call this method as it's protected! */ public function render() { $doc = $this->getDocInstance(); $id = t3lib_div::_GP('id'); $pageRecord = t3lib_BEfunc::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Is this a real page if ($pageRecord['uid']) { $title = $pageRecord['_thePathFull']; } else { $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } // Setting the path of the page $pagePath = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.path', 1) . ': <span class="typo3-docheader-pagePath">'; // crop the title to title limit (or 50, if not defined) $cropLength = empty($GLOBALS['BE_USER']->uc['titleLen']) ? 50 : $GLOBALS['BE_USER']->uc['titleLen']; $croppedTitle = t3lib_div::fixed_lgd_cs($title, -$cropLength); if ($croppedTitle !== $title) { $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>'; } else { $pagePath .= htmlspecialchars($title); } $pagePath .= '</span>'; return $pagePath; }
/** * Main function of the module. Write the content to $this->content * * @return void */ public function main() { // Draw the header. $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="" method="post">'; // JavaScript $this->doc->JScode = ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) { if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -50); $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']))); $this->content .= $this->doc->divider(5); // Render content $this->moduleContent(); // Shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'])); } } $this->content .= $this->doc->spacer(10); }
/** * 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); }
/** * Main module function * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH; // Start document template object: $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->bodyTagId = 'imp-exp-mod'; $this->doc->setModuleTemplate(t3lib_extMgm::extRelPath('impexp') . '/app/template.html'); $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL; } '); // Set up JS for dynamic tab menu $this->doc->JScode .= $this->doc->getDynTabMenuJScode(); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); $this->doc->form = '<form action="' . htmlspecialchars($GLOBALS['MCONF']['_']) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"><input type="hidden" name="id" value="' . $this->id . '" />'; $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); // Input data grabbed: $inData = t3lib_div::_GP('tx_impexp'); $this->checkUpload(); switch ((string) $inData['action']) { case 'export': // Finally: If upload went well, set the new file as the thumbnail in the $inData array: if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1]) { $inData['meta']['thumbnail'] = md5($this->fileProcessor->internalUploadMap[1]); } // Call export interface $this->exportData($inData); break; case 'import': // Finally: If upload went well, set the new file as the import file: if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1]) { $fI = pathinfo($this->fileProcessor->internalUploadMap[1]); if (t3lib_div::inList('t3d,xml', strtolower($fI['extension']))) { // Only allowed extensions.... $inData['file'] = $this->fileProcessor->internalUploadMap[1]; } } // Call import interface: $this->importData($inData); break; } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * * @return [type] ... */ public function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; $rootPageId = $this->MOD_SETTINGS['function']; if ($rootPageId) { $this->site = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Solr_Site', $rootPageId); $this->connectionManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Solr_ConnectionManager'); } $docHeaderButtons = $this->getButtons(); if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { // Draw the form $this->doc->form = '<form action="" method="post" name="editform" enctype="multipart/form-data">'; // JavaScript $this->doc->JScode = ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; $this->doc->getPageRenderer()->addCssFile('../typo3conf/ext/solr/Resources/Css/ModAdmin/index.css'); $this->doc->getPageRenderer()->addCssFile('../typo3conf/ext/solr/Resources/Css/Backend/indexingconfigurationselectorfield.css'); // Render content: if ($this->site) { $this->getModuleContent(); } else { $this->getModuleContentNoSiteConfigured(); } } else { // If no access or if ID == zero $docHeaderButtons['save'] = ''; $this->content .= $this->doc->spacer(10); } // compile document $markers['FUNC_MENU'] = $this->getFunctionMenu(); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; $addCmd = ''; if ($this->id && $access) { $addCmd = '&ADMCMD_view=1&ADMCMD_editIcons=1' . t3lib_BEfunc::ADMCMD_previewCmds($this->pageinfo); } $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL')); $dName = t3lib_BEfunc::getDomainStartPage($parts['host'], $parts['path']) ? t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($this->id)) : ''; // preview of mount pages $sys_page = t3lib_div::makeInstance('t3lib_pageSelect'); $sys_page->init(FALSE); $mountPointInfo = $sys_page->getMountPointInfo($this->id); if ($mountPointInfo && $mountPointInfo['overlay']) { $this->id = $mountPointInfo['mount_pid']; $addCmd .= '&MP=' . $mountPointInfo['MPvar']; } $this->url .= ($dName ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://') . $dName : $BACK_PATH . '..') . '/index.php?id=' . $this->id . ($this->type ? '&type=' . $this->type : '') . $addCmd; }
/** * For TYPO3 Element Browser: This lists all content elements from the given list of tables * * @param string Commalist of tables. Set to "*" if you want all tables. * @return string HTML output. */ function TBE_expandPage($tables) { global $TCA, $BE_USER, $BACK_PATH; $out = ''; if ($this->expandPage >= 0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage)) { // Set array with table names to list: if (!strcmp(trim($tables), '*')) { $tablesArr = array_keys($TCA); } else { $tablesArr = t3lib_div::trimExplode(',', $tables, 1); } reset($tablesArr); // Headline for selecting records: $out .= $this->barheader($GLOBALS['LANG']->getLL('selectRecords') . ':'); // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables. $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']); $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages', $this->expandPage); $ATag = ''; $ATag_e = ''; $ATag2 = ''; if (in_array('pages', $tablesArr)) { $ficon = t3lib_iconWorks::getIcon('pages', $mainPageRec); $ATag = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] . "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '" . $ficon . "','',1);\">"; $ATag2 = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] . "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '" . $ficon . "','',0);\">"; $ATag_alt = substr($ATag, 0, -4) . ",'',1);\">"; $ATag_e = '</a>'; } $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec); $pBicon = $ATag2 ? '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />' : ''; $pText = htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'], $titleLen)); $out .= $picon . $ATag2 . $pBicon . $ATag_e . $ATag . $pText . $ATag_e . '<br />'; // Initialize the record listing: $id = $this->expandPage; $pointer = t3lib_div::intInRange($this->pointer, 0, 100000); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $pageinfo = t3lib_BEfunc::readPageAccess($id, $perms_clause); $table = ''; // Generate the record list: $dblist = t3lib_div::makeInstance('TBE_browser_recordList'); $dblist->thisScript = $this->thisScript; $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->thumbs = 0; $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo); $dblist->noControlPanels = 1; $dblist->clickMenuEnabled = 0; $dblist->tableList = implode(',', $tablesArr); $dblist->start($id, t3lib_div::_GP('table'), $pointer, t3lib_div::_GP('search_field'), t3lib_div::_GP('search_levels'), t3lib_div::_GP('showLimit')); $dblist->setDispFields(); $dblist->generateList(); $dblist->writeBottom(); // Add the HTML for the record list to output variable: $out .= $dblist->HTMLcode; // Add support for fieldselectbox in singleTableMode if ($dblist->table) { $out .= $dblist->fieldSelectBox($dblist->table); } $out .= $dblist->getSearchBox(); } // Return accumulated content: return $out; }
/** * Creating the module output. * * @return void * @todo provide position mapping if no position is given already. Like the columns selector but for our cascading element style ... */ function main() { global $LANG, $BACK_PATH; if ($this->id && $this->access) { // Creating content $this->content = $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); $elRow = t3lib_BEfunc::getRecordWSOL('pages', $this->id); $header = t3lib_iconWorks::getSpriteIconForRecord('pages', $elRow); $header .= t3lib_BEfunc::getRecordTitle('pages', $elRow, 1); $this->content .= $this->doc->section('', $header, 0, 1); $this->content .= $this->doc->spacer(10); // Wizard $wizardCode = ''; $tableRows = array(); $wizardItems = $this->getWizardItems(); // Wrapper for wizards $this->elementWrapper['sectionHeader'] = array('<h3 class="bgColor5">', '</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']['templavoila']['db_new_content_el']['wizardItemsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['templavoila']['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 . ' } Event.observe(window, \'load\', function() { if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } if(top.shortcutFrame) { top.shortcutFrame.refreshShortcuts(); } }); '); // Traverse items for the wizard. // An item is either a header or an item rendered with a title/description and icon: $counter = 0; 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 = ''; // href URI for icon/title: $newRecordLink = 'index.php?' . $this->linkParams() . '&createNewRecord=' . rawurlencode($this->parentRecord) . $wInfo['params']; // Icon: $iInfo = @getimagesize($wInfo['icon']); $content .= $this->elementWrapper['wizardPart'][0] . '<a href="' . htmlspecialchars($newRecordLink) . '"> <img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1]; // Title + description: $content .= $this->elementWrapper['wizardPart'][0] . '<a href="' . htmlspecialchars($newRecordLink) . '"><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]; } } // 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 #000; 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); } else { // In case of no access: $this->content = $this->doc->header($LANG->getLL('newContentElement')); } $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $docHeaderButtons = $this->getDocHeaderButtons(); $docContent = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content); $content = $this->doc->startPage($LANG->getLL('newContentElement')); $content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $docContent); $content .= $this->doc->endPage(); // Replace content with templated content $this->content = $content; }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * * @return [type] ... */ public function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; $docHeaderButtons = $this->getButtons(); if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { // Draw the form $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">'; // JavaScript $this->doc->JScode = ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; // Render content: $this->getModuleContent(); } else { // If no access or if ID == zero $docHeaderButtons['save'] = ''; $this->content .= $this->doc->spacer(10); } // compile document $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Returns true if the current backend user has write access to the note specified by $uid * * @param integer $uid: The note UID * @param object &$reference: Reference to the page module * @return boolean true if the current BE user may write / delete the specified note record * @access private */ function internal_checkWriteAccess($uid, &$reference) { $noteRecord = t3lib_beFunc::getRecord('tx_rlmptvnotes_notes', $uid); if (is_array($noteRecord)) { $pageInfoArr = t3lib_BEfunc::readPageAccess($noteRecord['pid'], $reference->perms_clause); return $pageInfoArr['uid'] > 0; } return false; }
/** * Initializes the backend module by setting internal variables * * @return void */ function init() { global $TYPO3_CONF_VARS, $FILEMOUNTS; // name might be set from outside if (!$this->MCONF['name']) { $this->MCONF = $GLOBALS['MCONF']; } tx_dam::config_init(); # tx_dam::config_setValue('setup.devel', '1'); $this->defaultPid = tx_dam_db::getPid(); $this->id = $this->defaultPid; // from parent::init(); $this->CMD = t3lib_div::_GP('CMD'); $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $this->menuConfig(); $this->handleExternalFunctionValue(); // include the default language file $GLOBALS['LANG']->includeLLFile('EXT:dam/lib/locallang.xml'); // // Get current folder // // tx_dam_folder could be set by GP or stored in module conf $SET = t3lib_div::_GP('SET'); $this->path = $this->MOD_SETTINGS['tx_dam_folder']; // check if tx_dam_folder was set by GP which takes precedence, if not use command sent by navframe // order: GP (script), SLCMD (navframe), MOD_SETTINGS (stored) $SLCMD = t3lib_div::_GPmerged('SLCMD'); if (!$SET['tx_dam_folder'] and is_array($SLCMD['SELECT']) and is_array($SLCMD['SELECT']['txdamFolder'])) { $this->path = tx_dam::path_makeRelative(key($SLCMD['SELECT']['txdamFolder'])); } $this->checkOrSetPath(); $this->pageinfo = t3lib_BEfunc::readPageAccess($this->defaultPid, $this->perms_clause); $this->calcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); // // Detect and set forced single function and set params // // remove selection command from any params $this->addParams['SLCMD'] = ''; $this->addParams['SET'] = ''; // forced a module function? $forcedFunction = t3lib_div::_GP('forcedFunction'); if ($this->MOD_MENU['function'][$forcedFunction]) { $this->forcedFunction = $forcedFunction; $this->addParams['forcedFunction'] = $this->forcedFunction; $this->handleExternalFunctionValue('function', $this->forcedFunction); } // // Init selection // $this->selection = t3lib_div::makeInstance('tx_dam_selectionQuery'); $maxPages = $this->config_checkValueEnabled('browserMaxPages', 20); $this->MOD_SETTINGS['tx_dam_resultPointer'] = $this->selection->initPointer($this->MOD_SETTINGS['tx_dam_resultPointer'], $this->MOD_SETTINGS['tx_dam_resultsPerPage'], $maxPages); $this->selection->initSelection($this, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['selectionClasses'], 'tx_dam', 'tx_dam_select'); $this->selection->initQueryGen(); $this->selection->qg->initBESelect('tx_dam', tx_dam_db::getPidList()); $this->selection->addFilemountsToQuerygen(); // debug output if (tx_dam::config_getValue('setup.devel')) { $this->debugContent['MOD_SETTINGS'] = '<h4>MOD_SETTINGS</h4>' . t3lib_div::view_array($this->MOD_SETTINGS); } // BE Info output if (tx_dam::config_getValue('setup.devel') and t3lib_extMgm::isLoaded('cc_beinfo')) { require_once t3lib_extMgm::extPath('cc_beinfo') . 'class.tx_ccbeinfo.php'; $beinfo = t3lib_div::makeInstance('tx_ccbeinfo'); $beinfoContent = $beinfo->makeInfo($this); $this->debugContent['beinfo'] = '<h4>BE Info</h4>' . $beinfoContent; } }
/** * Build a backend edit link based on given record. * * @param string $tableName Record table name * @param array $row Current record row from database. * @return string Link to open an edit window for record. * * @see t3lib_BEfunc::readPageAccess() */ protected function getEditLink($tableName, $row) { $pageInfo = t3lib_BEfunc::readPageAccess($row['pid'], $this->userPermissions); $calcPerms = $GLOBALS['BE_USER']->calcPerms($pageInfo); $editLink = ''; if ($tableName == 'pages') { $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages', $row['uid'])); $permsEdit = $localCalcPerms & 2; } else { $permsEdit = $calcPerms & 16; } // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id) // @todo Is there an existing function to generate this link? if ($permsEdit) { $editLink = 'alt_doc.php?' . '&edit[' . $tableName . '][' . $row['uid'] . ']=edit'; } return $editLink; }
/** * Main function, creating the content for the access editing forms/listings * * @return void */ public function main() { global $BE_USER, $LANG; // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo); // Checking access: if ($this->id && $access || $BE_USER->isAdmin() && !$this->id) { if ($BE_USER->isAdmin() && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } // This decides if the editform can and will be drawn: $this->editingAllowed = $this->pageinfo['perms_userid'] == $BE_USER->user['uid'] || $BE_USER->isAdmin(); $this->edit = $this->edit && $this->editingAllowed; // If $this->edit then these functions are called in the end of the page... if ($this->edit) { $this->doc->postCode .= $this->doc->wrapScriptTags(' setCheck("check[perms_user]","data[pages][' . $this->id . '][perms_user]"); setCheck("check[perms_group]","data[pages][' . $this->id . '][perms_group]"); setCheck("check[perms_everybody]","data[pages][' . $this->id . '][perms_everybody]"); '); } // Draw the HTML page header. $this->content .= $this->doc->header($LANG->getLL('permissions') . ($this->edit ? ': ' . $LANG->getLL('Edit') : '')); $this->content .= $this->doc->spacer(5); $vContent = $this->doc->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } // Main function, branching out: if (!$this->edit) { $this->notEdit(); } else { $this->doEdit(); } $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $this->docHeaderButtons['csh']; $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($LANG->getLL('permissions')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); } else { // If no access or if ID == zero $this->content .= $this->doc->startPage($LANG->getLL('permissions')); $this->content .= $this->doc->header($LANG->getLL('permissions')); } $this->content .= $this->doc->endPage(); }
/** * 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; }
/** * 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); }
/** * Creates the page * * This function creates the basic page in which the module will * take place. * * @return Void * @see addStyles * @see moduleContent */ function main() { // Store variables from TCE $this->P = t3lib_div::_GP('P'); // Draw the header. $this->doc = t3lib_div::makeInstance('bigDoc'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="" method="POST">'; // JavaScript $this->doc->JScode = ' <script type="text/javascript" language="Javascript" charset="iso-8859-1"> <!-- script_ended = 0; function jumpToUrl(URL) { document.location = URL; } //--> </script> <script type="text/javascript" language="Javascript" charset="iso-8859-1"> <!-- // Function for swapping element classes function tx_tscobj_swapClasses(element) { if (document.getElementById) { liClass = document.getElementById(element).className; document.getElementById(element).className = (liClass == "open") ? "closed" : "open"; document.getElementById(element + "-img").src = (liClass == "open") ? "' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/plusbullet.gif', '', 1) . '" : "' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/minusbullet.gif', '', 1) . '"; } } // Function for expanding/collapsing all elements var expanded = 0; function tx_tscobj_expAll() { if (document.getElementsByTagName) { var listItems = document.getElementsByTagName("li"); for (i = 0; i < listItems.length; i++) { listItems[i].className = (expanded) ? "closed" : "open"; id = listItems[i].id; if (id.substr(id.length - 1,id.length) == ".") { var picture = id + "-img"; document.getElementById(picture).src = (expanded) ? "' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/plusbullet.gif', '', 1) . '" : "' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/minusbullet.gif', '', 1) . '"; } } expanded = (expanded == 1) ? 0 : 1; } } --> </script> '; // Add CSS styles for the module $this->doc->inDocStyles = $this->addStyles(); // Access check $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) { // Admin user if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } // Build current path $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -50); // Start page content $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->divider(5); // Render content $this->moduleContent(); } // Spacer $this->content .= $this->doc->spacer(10); }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * * @return [type] ... */ function main() { global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; // Draw the header. $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -50); $this->content.=$this->doc->startPage($LANG->getLL('title')); $this->content.=$this->doc->header($LANG->getLL('title')); $this->content.=$this->doc->divider(5); // Render content: $this->moduleContent(); }
/** * Main function of the module. Write the content to $this->content * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Template markers $markers = array('CSH' => '', 'FUNC_MENU' => '', 'WS_MENU' => '', 'CONTENT' => ''); // Setting module configuration: $this->MCONF = $GLOBALS['MCONF']; $this->REQUEST_URI = str_replace('&sendToReview=1', '', t3lib_div::getIndpEnv('REQUEST_URI')); // Draw the header. $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/version.html'); // Add styles $this->doc->inDocStylesArray[$GLOBALS['MCONF']['name']] = ' .version-diff-1 { background-color: green; } .version-diff-2 { background-color: red; } '; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Getting input data: $this->id = intval(t3lib_div::_GP('id')); // Page id. If set, indicates activation from Web>Versioning module if (!$this->id) { $this->uid = intval(t3lib_div::_GP('uid')); // Record uid. Goes with table name to indicate specific record $this->table = t3lib_div::_GP('table'); // Record table. Goes with uid to indicate specific record } else { $this->uid = $this->id; $this->table = 'pages'; } $this->details = t3lib_div::_GP('details'); // Page id. If set, indicates activation from Web>Versioning module $this->diffOnly = t3lib_div::_GP('diffOnly'); // Flag. If set, shows only the offline version and with diff-view // Force this setting: $this->MOD_SETTINGS['expandSubElements'] = TRUE; $this->MOD_SETTINGS['diff'] = $this->details || $this->MOD_SETTINGS['diff'] ? 1 : 0; // Reading the record: $record = t3lib_BEfunc::getRecord($this->table, $this->uid); if ($record['pid'] == -1) { $record = t3lib_BEfunc::getRecord($this->table, $record['t3ver_oid']); } $this->recordFound = is_array($record); $pidValue = $this->table === 'pages' ? $this->uid : $record['pid']; // Checking access etc. if ($this->recordFound && $TCA[$this->table]['ctrl']['versioningWS']) { $this->doc->form = '<form action="" method="post">'; $this->uid = $record['uid']; // Might have changed if new live record was found! // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($pidValue, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($pidValue && $access || $BE_USER->user['admin'] && !$pidValue) { // JavaScript $this->doc->JScode .= ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { window.location.href = URL; } function hlSubelements(origId, verId, over, diffLayer) { // if (over) { document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\'; document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\'; if (diffLayer) { document.getElementById(\'diff_\'+verId).style.visibility = \'visible\'; } } else { document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\'; document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\'; if (diffLayer) { document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\'; } } } </script> '; // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule')); $this->pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; // Setting publish access permission for workspace: $this->publishAccess = $BE_USER->workspacePublishAccess($BE_USER->workspace); // Render content: if ($this->id) { $this->workspaceMgm(); } else { $this->versioningMgm(); } } $this->content .= $this->doc->spacer(10); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); $markers['WS_MENU'] = $this->workspaceMenu(); $markers['CONTENT'] = $this->content; } else { // If no access or id value, create empty document $this->content = $this->doc->section($LANG->getLL('clickAPage_header'), $LANG->getLL('clickAPage_content'), 0, 1); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CONTENT'] = $this->content; } // Build the <body> for the module $this->content = $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }