Beispiel #1
0
    /**
     * Rendering the content for the publish / review overview:
     * (Made for internal recursive calling)
     *
     * @param	array		Storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray())
     * @return	array		Table rows, see displayWorkspaceOverview()
     */
    function displayWorkspaceOverview_list($pArray)
    {
        global $TCA;
        // If there ARE elements on this level, print them:
        $warnAboutVersions_nonPages = FALSE;
        $warnAboutVersions_page = FALSE;
        if (is_array($pArray)) {
            foreach ($pArray as $table => $oidArray) {
                foreach ($oidArray as $oid => $recs) {
                    // Get CURRENT online record and icon based on "t3ver_oid":
                    $rec_on = t3lib_BEfunc::getRecord($table, $oid);
                    $icon = t3lib_iconWorks::getSpriteIconForRecord($table, $rec_on, array('title' => t3lib_BEfunc::getRecordIconAltText($rec_on, $table)));
                    if ($GLOBALS['BE_USER']->workspace === 0) {
                        // Only edit online records if in ONLINE workspace:
                        $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $rec_on['uid'], 1, '', '+edit,view,info,delete');
                    }
                    // Online version display:
                    // Create the main cells which will span over the number of versions there is.
                    $verLinkUrl = $TCA[$table]['ctrl']['versioningWS'];
                    $origElement = $icon . ($verLinkUrl ? '<a href="' . htmlspecialchars('index.php?table=' . $table . '&uid=' . $rec_on['uid']) . '">' : '') . t3lib_BEfunc::getRecordTitle($table, $rec_on, TRUE) . ($verLinkUrl ? '</a>' : '');
                    $mainCell_rowSpan = count($recs) > 1 ? ' rowspan="' . count($recs) . '"' : '';
                    $mainCell = '
								<td align="center"' . $mainCell_rowSpan . '>' . $this->formatVerId($rec_on['t3ver_id']) . '</td>
								<td nowrap="nowrap"' . $mainCell_rowSpan . '>' . $origElement . '###SUB_ELEMENTS###' . '</td>';
                    // Offline versions display:
                    // Traverse the versions of the element
                    foreach ($recs as $rec) {
                        // Get the offline version record and icon:
                        $rec_off = t3lib_BEfunc::getRecord($table, $rec['uid']);
                        // Prepare swap-mode values:
                        if ($table === 'pages' && $rec_off['t3ver_swapmode'] != -1) {
                            if ($rec_off['t3ver_swapmode'] > 0) {
                                $vType = 'branch';
                            } else {
                                $vType = 'page';
                            }
                        } else {
                            $vType = 'element';
                        }
                        // Get icon
                        $icon = t3lib_iconWorks::getSpriteIconForRecord($table, $rec_off, array('title' => t3lib_BEfunc::getRecordIconAltText($rec_off, $table)));
                        $tempUid = $table != 'pages' || $vType === 'branch' || $GLOBALS['BE_USER']->workspace === 0 ? $rec_off['uid'] : $rec_on['uid'];
                        $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $tempUid, 1, '', '+edit,' . ($table == 'pages' ? 'view,info,' : '') . 'delete');
                        // Prepare diff-code:
                        if ($this->MOD_SETTINGS['diff'] || $this->diffOnly) {
                            $diffCode = '';
                            list($diffHTML, $diffPct) = $this->createDiffView($table, $rec_off, $rec_on);
                            if ($rec_on['t3ver_state'] == 1) {
                                // New record:
                                $diffCode .= $this->doc->icons(1) . $GLOBALS['LANG']->getLL('newElement') . '<br />';
                                $diffCode .= $diffHTML;
                            } elseif ($rec_off['t3ver_state'] == 2) {
                                $diffCode .= $this->doc->icons(2) . $GLOBALS['LANG']->getLL('deletedElement') . '<br />';
                            } elseif ($rec_on['t3ver_state'] == 3) {
                                $diffCode .= $this->doc->icons(1) . $GLOBALS['LANG']->getLL('moveToPlaceholder') . '<br />';
                            } elseif ($rec_off['t3ver_state'] == 4) {
                                $diffCode .= $this->doc->icons(1) . $GLOBALS['LANG']->getLL('moveToPointer') . '<br />';
                            } else {
                                $diffCode .= $diffPct < 0 ? $GLOBALS['LANG']->getLL('notAvailable') : ($diffPct ? $diffPct . '% ' . $GLOBALS['LANG']->getLL('change') : '');
                                $diffCode .= $diffHTML;
                            }
                        } else {
                            $diffCode = '';
                        }
                        switch ($vType) {
                            case 'element':
                                $swapLabel = $GLOBALS['LANG']->getLL('element');
                                $swapClass = 'ver-element';
                                $warnAboutVersions_nonPages = $warnAboutVersions_page;
                                // Setting this if sub elements are found with a page+content (must be rendered prior to this of course!)
                                break;
                            case 'page':
                                $swapLabel = $GLOBALS['LANG']->getLL('page');
                                $swapClass = 'ver-page';
                                $warnAboutVersions_page = !$this->showWorkspaceCol;
                                // This value is true only if multiple workspaces are shown and we need the opposite here.
                                break;
                            case 'branch':
                                $swapLabel = $GLOBALS['LANG']->getLL('branch');
                                $swapClass = 'ver-branch';
                                break;
                        }
                        // Modify main cell based on first version shown:
                        $subElements = array();
                        if ($table === 'pages' && $rec_off['t3ver_swapmode'] != -1 && $mainCell) {
                            // For "Page" and "Branch" swap modes where $mainCell is still carrying content (only first version)
                            $subElements['on'] = $this->subElements($rec_on['uid'], $rec_off['t3ver_swapmode']);
                            $subElements['off'] = $this->subElements($rec_off['uid'], $rec_off['t3ver_swapmode'], $rec_on['uid']);
                        }
                        $mainCell = str_replace('###SUB_ELEMENTS###', $subElements['on'], $mainCell);
                        // Create version element:
                        $versionsInOtherWS = $this->versionsInOtherWS($table, $rec_on['uid']);
                        $versionsInOtherWSWarning = $versionsInOtherWS && $GLOBALS['BE_USER']->workspace !== 0 ? '<br />' . $this->doc->icons(2) . $GLOBALS['LANG']->getLL('otherVersions') . $versionsInOtherWS : '';
                        $multipleWarning = !$mainCell && $GLOBALS['BE_USER']->workspace !== 0 ? '<br />' . $this->doc->icons(3) . '<strong>' . $GLOBALS['LANG']->getLL('multipleVersions') . '</strong>' : '';
                        $verWarning = $warnAboutVersions || $warnAboutVersions_nonPages && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages'] ? '<br />' . $this->doc->icons(3) . '<strong>' . $GLOBALS['LANG']->getLL('versionInVersion') . '</strong>' : '';
                        $verElement = $icon . (!$this->details ? '<a href="' . htmlspecialchars($this->doc->backPath . t3lib_extMgm::extRelPath('version') . 'cm1/index.php?id=' . ($table === 'pages' ? $rec_on['uid'] : $rec_on['pid']) . '&details=' . rawurlencode($table . ':' . $rec_off['uid']) . '&returnUrl=' . rawurlencode($this->REQUEST_URI)) . '">' : '') . t3lib_BEfunc::getRecordTitle($table, $rec_off, TRUE) . (!$this->details ? '</a>' : '') . $versionsInOtherWSWarning . $multipleWarning . $verWarning;
                        $ctrlTable = '
								<td nowrap="nowrap">' . $this->showStageChangeLog($table, $rec_off['uid'], $this->displayWorkspaceOverview_stageCmd($table, $rec_off)) . '</td>
								<td nowrap="nowrap" class="' . $swapClass . '">' . $this->displayWorkspaceOverview_commandLinks($table, $rec_on, $rec_off, $vType) . htmlspecialchars($swapLabel) . '&nbsp;&nbsp;</td>
								' . (!$this->diffOnly ? '<td nowrap="nowrap"><strong>' . $GLOBALS['LANG']->getLL('lifecycle') . ':</strong> ' . htmlspecialchars($this->formatCount($rec_off['t3ver_count'])) . '</td>' . ($this->showWorkspaceCol ? '
								<td nowrap="nowrap">&nbsp;&nbsp;<strong>' . $GLOBALS['LANG']->getLL('workspace') . ':</strong> ' . htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])) . '</td>' : '') : '');
                        if ($diffCode) {
                            $verElement = $verElement . '
							<br /><strong>' . $GLOBALS['LANG']->getLL('diffToLiveElement') . '</strong>
							<table border="0" cellpadding="0" cellspacing="0" class="ver-verElement">
								<tr>
									<td class="c-diffCell">' . $diffCode . '</td>
								</tr>
							</table>';
                        }
                        // Create version cell:
                        $verCell = '
								<td align="center">' . $this->formatVerId($rec_off['t3ver_id']) . '</td>
								<td nowrap="nowrap">' . $verElement . $subElements['off'] . '</td>
								';
                        // Compile table row:
                        $tableRows[] = '
							<tr class="bgColor4">
								' . ($this->diffOnly ? '' : $mainCell) . $verCell . $ctrlTable . '
							</tr>';
                        // Reset the main cell:
                        $mainCell = '';
                    }
                }
            }
        }
        return $tableRows;
    }
Beispiel #2
0
 /**
  * Main processing, creating the list of new record tables to select from
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG;
     // If there was a page - or if the user is admin (admins has access to the root) we proceed:
     if ($this->pageinfo['uid'] || $BE_USER->isAdmin()) {
         // Acquiring TSconfig for this module/current page:
         $this->web_list_modTSconfig = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
         $this->allowedNewTables = t3lib_div::trimExplode(',', $this->web_list_modTSconfig['properties']['allowedNewTables'], 1);
         $this->deniedNewTables = t3lib_div::trimExplode(',', $this->web_list_modTSconfig['properties']['deniedNewTables'], 1);
         // Acquiring TSconfig for this module/parent page:
         $this->web_list_modTSconfig_pid = t3lib_BEfunc::getModTSconfig($this->pageinfo['pid'], 'mod.web_list');
         $this->allowedNewTables_pid = t3lib_div::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['allowedNewTables'], 1);
         $this->deniedNewTables_pid = t3lib_div::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['deniedNewTables'], 1);
         // More init:
         if (!$this->showNewRecLink('pages')) {
             $this->newPagesInto = 0;
         }
         if (!$this->showNewRecLink('pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) {
             $this->newPagesAfter = 0;
         }
         // Set header-HTML and return_url
         if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
             $iconImgTag = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]);
         } else {
             $iconImgTag = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
         }
         $this->code = '<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag, 'pages', $this->pageinfo['uid']) . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, 45)) . '</span><br />';
         $this->R_URI = $this->returnUrl;
         // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard)
         if (!$this->pagesOnly) {
             // Regular new element:
             $this->regularNew();
         } elseif ($this->showNewRecLink('pages')) {
             // Pages only wizard
             $this->pagesOnly();
         }
         // Add all the content to an output section
         $this->content .= $this->doc->section('', $this->code);
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers['CSH'] = $docHeaderButtons['csh'];
         $markers['CONTENT'] = $this->content;
         // Build the <body> for the module
         $this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle'));
         $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
         $this->content .= $this->doc->endPage();
         $this->content = $this->doc->insertStylesAndJS($this->content);
     }
 }