Example #1
0
    /**
     * 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);
    }
Example #2
0
    /**
     * 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;
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
            if ($BE_USER->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate('templates/info.html');
            $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), "defCol" => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), "defRow" => array("0" => array('<td valign="top">', '</td>'), "defCol" => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')));
            // 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" name="webinfoForm">';
            $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 = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), '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);
        } 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);
            $this->content .= $this->doc->endPage();
            $this->content = $this->doc->insertStylesAndJS($this->content);
        }
    }
Example #3
0
    /**
     * Rendering the overview of versions in the current workspace
     *
     * @return	string		HTML (table)
     * @see typo3/mod/user/ws/index.php for sister function!
     */
    function displayWorkspaceOverview()
    {
        // Initialize variables:
        $this->showWorkspaceCol = $GLOBALS['BE_USER']->workspace === 0 && $this->MOD_SETTINGS['display'] <= -98;
        // Get usernames and groupnames
        $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
        $groupArray = array_keys($be_group_Array);
        $this->be_user_Array = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1);
        }
        // Initialize Workspace ID and filter-value:
        if ($GLOBALS['BE_USER']->workspace === 0) {
            $wsid = $this->details ? -99 : $this->MOD_SETTINGS['display'];
            // Set wsid to the value from the menu (displaying content of other workspaces)
            $filter = $this->details ? 0 : $this->MOD_SETTINGS['filter'];
        } else {
            $wsid = $GLOBALS['BE_USER']->workspace;
            $filter = 0;
        }
        // Initialize workspace object and request all pending versions:
        $wslibObj = t3lib_div::makeInstance('wslib');
        // Selecting ALL versions belonging to the workspace:
        $versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter, -99, $this->uid);
        // $this->uid is the page id of LIVE record.
        // Traverse versions and build page-display array:
        $pArray = array();
        foreach ($versions as $table => $records) {
            foreach ($records as $rec) {
                $pageIdField = $table === 'pages' ? 't3ver_oid' : 'realpid';
                $this->displayWorkspaceOverview_setInPageArray($pArray, $table, $rec);
            }
        }
        // Make header of overview:
        $tableRows = array();
        if (count($pArray)) {
            $tableRows[] = '
				<tr class="bgColor5 tableheader">
					' . ($this->diffOnly ? '' : '<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('liveVersion') . '</td>') . '
					<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('wsVersions') . '</td>
					<td nowrap="nowrap"' . ($this->diffOnly ? ' colspan="2"' : ' colspan="4"') . '>' . $GLOBALS['LANG']->getLL('controls') . '</td>
				</tr>';
            // Add lines from overview:
            $tableRows = array_merge($tableRows, $this->displayWorkspaceOverview_list($pArray));
            $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">' . implode('', $tableRows) . '</table>';
        } else {
            $table = '';
        }
        $linkBack = t3lib_div::_GP('returnUrl') ? '<a href="' . htmlspecialchars(t3lib_div::_GP('returnUrl')) . '" class="typo3-goBack">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . $GLOBALS['LANG']->getLL('goBack', TRUE) . '</a><br /><br />' : '';
        $resetDiffOnly = $this->diffOnly ? '<a href="index.php?id=' . intval($this->id) . '" class="typo3-goBack">' . $GLOBALS['LANG']->getLL('showAllInformation') . '</a><br /><br />' : '';
        $versionSelector = $GLOBALS['BE_USER']->workspace ? $this->doc->getVersionSelector($this->id) : '';
        return $versionSelector . $linkBack . $resetDiffOnly . $table . $this->markupNewOriginals();
    }
Example #4
0
 /**
  * Rendering all other listings than QuickEdit
  *
  * @return	void
  */
 function renderListContent()
 {
     global $LANG, $BACK_PATH, $TCA;
     // Initialize list object (see "class.db_layout.inc"):
     $dblist = t3lib_div::makeInstance('tx_cms_layout');
     $dblist->backPath = $BACK_PATH;
     $dblist->thumbs = $this->imagemode;
     $dblist->no_noWrap = 1;
     $dblist->descrTable = $this->descrTable;
     $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000);
     $dblist->script = 'db_layout.php';
     $dblist->showIcon = 0;
     $dblist->setLMargin = 0;
     $dblist->doEdit = $this->EDIT_CONTENT;
     $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
     $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
     $dblist->id = $this->id;
     $dblist->nextThree = t3lib_div::intInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
     $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] === '0';
     $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
     $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
     if (!$dblist->nextThree) {
         $dblist->nextThree = 1;
     }
     $dblist->externalTables = $this->externalTables;
     // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
     $h_menu = $dblist->getTableMenu($this->id);
     // Initialize other variables:
     $h_func = '';
     $tableOutput = array();
     $tableJSOutput = array();
     $CMcounter = 0;
     // Traverse the list of table names which has records on this page (that array is populated by the $dblist object during the function getTableMenu()):
     foreach ($dblist->activeTables as $table => $value) {
         // Load full table definitions:
         t3lib_div::loadTCA($table);
         if (!isset($dblist->externalTables[$table])) {
             // Creating special conditions for each table:
             switch ($table) {
                 case 'tt_board':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_board]', $this->MOD_SETTINGS['tt_board'], $this->MOD_MENU['tt_board'], 'db_layout.php', '');
                     break;
                 case 'tt_address':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_address]', $this->MOD_SETTINGS['tt_address'], $this->MOD_MENU['tt_address'], 'db_layout.php', '');
                     break;
                 case 'tt_links':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_links]', $this->MOD_SETTINGS['tt_links'], $this->MOD_MENU['tt_links'], 'db_layout.php', '');
                     break;
                 case 'tt_calender':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_calender]', $this->MOD_SETTINGS['tt_calender'], $this->MOD_MENU['tt_calender'], 'db_layout.php', '');
                     break;
                 case 'tt_products':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_products]', $this->MOD_SETTINGS['tt_products'], $this->MOD_MENU['tt_products'], 'db_layout.php', '');
                     break;
                 case 'tt_guest':
                 case 'tt_news':
                 case 'fe_users':
                     // Nothing
                     break;
                 case 'tt_content':
                     $q_count = $this->getNumberOfHiddenElements();
                     $h_func_b = t3lib_BEfunc::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE')) : $LANG->getLL('hiddenCE') . ' (' . $q_count . ')') . '</label>';
                     $dblist->tt_contentConfig['showCommands'] = 1;
                     // Boolean: Display up/down arrows and edit icons for tt_content records
                     $dblist->tt_contentConfig['showInfo'] = 1;
                     // Boolean: Display info-marks or not
                     $dblist->tt_contentConfig['single'] = 0;
                     // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
                     if ($this->MOD_SETTINGS['function'] == 4) {
                         // grid view
                         $dblist->tt_contentConfig['showAsGrid'] = 1;
                     }
                     // Setting up the tt_content columns to show:
                     if (is_array($TCA['tt_content']['columns']['colPos']['config']['items'])) {
                         $colList = array();
                         $tcaItems = t3lib_div::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed', $this->id, $this);
                         foreach ($tcaItems as $temp) {
                             $colList[] = $temp[1];
                         }
                     } else {
                         // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
                         $colList = array('1', '0', '2', '3');
                     }
                     if (strcmp($this->colPosList, '')) {
                         $colList = array_intersect(t3lib_div::intExplode(',', $this->colPosList), $colList);
                     }
                     // If only one column found, display the single-column view.
                     if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) {
                         $dblist->tt_contentConfig['single'] = 1;
                         // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
                         $dblist->tt_contentConfig['showSingleCol'] = current($colList);
                         // The column(s) to show if single mode (under each other)
                     }
                     $dblist->tt_contentConfig['cols'] = implode(',', $colList);
                     // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
                     $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
                     $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
                     // If the function menu is set to "Language":
                     if ($this->MOD_SETTINGS['function'] == 2) {
                         $dblist->tt_contentConfig['single'] = 0;
                         $dblist->tt_contentConfig['languageMode'] = 1;
                         $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
                         $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
                     }
                     break;
             }
         } else {
             if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
                 $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', '');
             } else {
                 $h_func = '';
             }
         }
         // Start the dblist object:
         $dblist->itemsLimitSingleTable = 1000;
         $dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
         $dblist->counter = $CMcounter;
         $dblist->ext_function = $this->MOD_SETTINGS['function'];
         // Render versioning selector:
         $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
         // Generate the list of elements here:
         $dblist->generateList();
         // Adding the list content to the tableOutput variable:
         $tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dblist->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
         // ... and any accumulated JavaScript goes the same way!
         $tableJSOutput[$table] = $dblist->JScode;
         // Increase global counter:
         $CMcounter += $dblist->counter;
         // Reset variables after operation:
         $dblist->HTMLcode = '';
         $dblist->JScode = '';
         $h_func = '';
         $h_func_b = '';
     }
     // END: traverse tables
     // For Context Sensitive Menus:
     $this->doc->getContextMenuCode();
     // Now, create listing based on which element is selected in the function menu:
     if ($this->MOD_SETTINGS['function'] == 3) {
         // Making page info:
         $content .= $this->doc->spacer(10);
         $content .= $this->doc->section($LANG->getLL('pageInformation'), $dblist->getPageInfoBox($this->pageinfo, $this->CALC_PERMS & 2), 0, 1);
     } else {
         // Add the content for each table we have rendered (traversing $tableOutput variable)
         foreach ($tableOutput as $table => $output) {
             $content .= $this->doc->section('<a name="' . $table . '"></a>' . $dblist->activeTables[$table], $output, TRUE, TRUE, 0, TRUE);
             $content .= $this->doc->spacer(15);
             $content .= $this->doc->sectionEnd();
         }
         // Making search form:
         if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
             $sectionTitle = t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE));
             $content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE);
         }
         // Making display of Sys-notes (from extension "sys_note")
         $dblist->id = $this->id;
         $sysNotes = $dblist->showSysNotesForPage();
         if ($sysNotes) {
             $content .= $this->doc->spacer(10);
             $content .= $this->doc->section($LANG->getLL('internalNotes'), $sysNotes, 0, 1);
         }
         // Add spacer in bottom of page:
         $content .= $this->doc->spacer(10);
     }
     // Ending page:
     $content .= $this->doc->spacer(10);
     return $content;
 }