Пример #1
0
 /**
  * Outputting the accumulated content to screen
  *
  * @return	void
  */
 function printContent()
 {
     $this->content .= $this->doc->spacer(8);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
     echo $this->content;
 }
Пример #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);
        }
    }
Пример #3
0
 /**
  * Show list references
  *
  * @return	void
  */
 function func_relations()
 {
     global $LANG, $BACK_PATH;
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('relations'));
     $this->content .= $this->doc->spacer(5);
     $admin = t3lib_div::makeInstance('t3lib_admin');
     $admin->genTree_makeHTML = 0;
     $admin->backPath = $BACK_PATH;
     $fkey_arrays = $admin->getGroupFields('');
     $admin->selectNonEmptyRecordsWithFkeys($fkey_arrays);
     $fileTest = $admin->testFileRefs();
     $code = '';
     if (is_array($fileTest['noReferences'])) {
         foreach ($fileTest['noReferences'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong></nobr><br>';
         }
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_ref'), $code, true, true);
     $code = '';
     if (is_array($fileTest['moreReferences'])) {
         foreach ($fileTest['moreReferences'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong>: ' . $val[2] . ' ' . $GLOBALS['LANG']->getLL('references') . '</nobr><br>' . $val[3] . '<br><br>';
         }
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_many_ref'), $code, true, true);
     $code = '';
     if (is_array($fileTest['noFile'])) {
         ksort($fileTest['noFile']);
         foreach ($fileTest['noFile'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong> ' . $GLOBALS['LANG']->getLL('isMissing') . ' </nobr><br>' . $GLOBALS['LANG']->getLL('referencedFrom') . $val[2] . '<br><br>';
         }
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_file'), $code, true, true);
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('select_db'), $admin->testDBRefs($admin->checkSelectDBRefs), true, true);
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('group_db'), $admin->testDBRefs($admin->checkGroupDBRefs), true, true);
 }
Пример #4
0
 /**
  * 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);
 }
Пример #5
0
    /**
     * renders the data for all tabs in the user setup and returns
     * everything that is needed with tabs and dyntab menu
     *
     * @return	ready to use for the dyntabmenu itemarray
     */
    protected function renderUserSetup()
    {
        $result = array();
        $firstTabLabel = '';
        $code = array();
        $i = 0;
        $fieldArray = $this->getFieldsFromShowItem();
        $this->dividers2tabs = isset($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) ? intval($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) : 0;
        $tabLabel = '';
        foreach ($fieldArray as $fieldName) {
            $more = '';
            if (substr($fieldName, 0, 8) == '--div--;') {
                if ($firstTabLabel == '') {
                    // first tab
                    $tabLabel = $this->getLabel(substr($fieldName, 8), '', false);
                    $firstTabLabel = $tabLabel;
                } else {
                    if ($this->dividers2tabs) {
                        $result[] = array('label' => $tabLabel, 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : '');
                        $tabLabel = $this->getLabel(substr($fieldName, 8), '', false);
                        $i = 0;
                        $code = array();
                    }
                }
                continue;
            }
            $config = $GLOBALS['TYPO3_USER_SETTINGS']['columns'][$fieldName];
            // field my be disabled in setup.fields
            if (isset($this->tsFieldConf[$fieldName . '.']['disabled']) && $this->tsFieldConf[$fieldName . '.']['disabled'] == 1) {
                continue;
            }
            if (isset($config['access']) && !$this->checkAccess($config)) {
                continue;
            }
            $label = $this->getLabel($config['label'], $fieldName);
            $label = $this->getCSH($config['csh'] ? $config['csh'] : $fieldName, $label);
            $type = $config['type'];
            $eval = $config['eval'];
            $class = $config['class'];
            $style = $config['style'];
            if ($class) {
                $more .= ' class="' . $class . '"';
            }
            if ($style) {
                $more .= ' style="' . $style . '"';
            }
            if ($this->overrideConf[$fieldName]) {
                $more .= ' disabled="disabled"';
            }
            $value = $config['table'] == 'be_users' ? $GLOBALS['BE_USER']->user[$fieldName] : $GLOBALS['BE_USER']->uc[$fieldName];
            if (!$value && isset($config['default'])) {
                $value = $config['default'];
            }
            switch ($type) {
                case 'text':
                case 'password':
                    $dataAdd = '';
                    if ($config['table'] == 'be_users') {
                        $dataAdd = '[be_users]';
                    }
                    if ($eval == 'md5') {
                        $more .= ' onchange="this.value=this.value?MD5(this.value):\'\';"';
                    }
                    if ($type == 'password') {
                        $value = '';
                    }
                    $noAutocomplete = $type == 'password' ? 'autocomplete="off" ' : '';
                    $html = '<input id="field_' . $fieldName . '"
							type="' . $type . '"
							name="data' . $dataAdd . '[' . $fieldName . ']" ' . $noAutocomplete . 'value="' . htmlspecialchars($value) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . $more . ' />';
                    break;
                case 'check':
                    if (!$class) {
                        $more .= ' class="check"';
                    }
                    $html = '<input id="field_' . $fieldName . '"
									type="checkbox"
									name="data[' . $fieldName . ']"' . ($value ? ' checked="checked"' : '') . $more . ' />';
                    break;
                case 'select':
                    if (!$class) {
                        $more .= ' class="select"';
                    }
                    if ($config['itemsProcFunc']) {
                        $html = t3lib_div::callUserFunction($config['itemsProcFunc'], $config, $this, '');
                    } else {
                        $html = '<select id="field_' . $fieldName . '" name="data[' . $fieldName . ']"' . $more . '>' . LF;
                        foreach ($config['items'] as $key => $optionLabel) {
                            $html .= '<option value="' . $key . '"' . ($value == $key ? ' selected="selected"' : '') . '>' . $this->getLabel($optionLabel, '', false) . '</option>' . LF;
                        }
                        $html .= '</select>';
                    }
                    break;
                case 'user':
                    $html = t3lib_div::callUserFunction($config['userFunc'], $config, $this, '');
                    break;
                default:
                    $html = '';
            }
            $code[$i][1] = $label;
            $code[$i++][2] = $html;
        }
        if ($this->dividers2tabs == 0) {
            $tabLabel = $firstTabLabel;
        }
        $result[] = array('label' => $tabLabel, 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : '');
        return $result;
    }
Пример #6
0
 /**
  * Management of workspace for page ID
  * Called when $this->id is set.
  *
  * @return	void
  */
 function workspaceMgm()
 {
     // Perform workspace publishing action if buttons are pressed:
     $errors = $this->publishAction();
     // Generate workspace overview:
     $WSoverview = $this->displayWorkspaceOverview();
     // Buttons for publish / swap:
     $actionLinks = '<br />';
     if ($GLOBALS['BE_USER']->workspace !== 0) {
         if ($this->publishAccess) {
             $actionLinks .= '<input type="submit" name="_publish" value="' . $GLOBALS['LANG']->getLL('publishPage') . '" onclick="return confirm(\'' . sprintf($GLOBALS['LANG']->getLL('publishPageQuestion'), $GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1 ? $GLOBALS['LANG']->getLL('publishPageQuestionStage') : '') . '\');"/>';
             if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
                 $actionLinks .= '<input type="submit" name="_swap" value="' . $GLOBALS['LANG']->getLL('swapPage') . '" onclick="return confirm(\'' . sprintf($GLOBALS['LANG']->getLL('swapPageQuestion'), $GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1 ? $GLOBALS['LANG']->getLL('publishPageQuestionStage') : '') . '\');" />';
             }
         } else {
             $actionLinks .= $this->doc->icons(1) . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:no_publish_permission');
         }
     }
     $actionLinks .= '<input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('refresh') . '" />';
     $actionLinks .= '<input type="submit" name="_previewLink" value="' . $GLOBALS['LANG']->getLL('previewLink') . '" />';
     $actionLinks .= '<input type="checkbox" class="checkbox" name="_previewLink_wholeWorkspace" id="_previewLink_wholeWorkspace" value="1" /><label for="_previewLink_wholeWorkspace">' . $GLOBALS['LANG']->getLL('allowPreviewOfWholeWorkspace') . '</label>';
     $actionLinks .= $this->displayWorkspaceOverview_allStageCmd();
     if ($actionLinks || count($errors)) {
         $this->content .= $this->doc->section('', $actionLinks . (count($errors) ? '<h3>' . $GLOABLS['LANG']->getLL('errors') . '</h3><br />' . implode('<br />', $errors) . '<hr />' : ''), 0, 1);
     }
     if (t3lib_div::_POST('_previewLink')) {
         $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours'));
         $ttlHours = $ttlHours ? $ttlHours : 24 * 2;
         if (t3lib_div::_POST('_previewLink_wholeWorkspace')) {
             $previewUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php?ADMCMD_prev=' . t3lib_BEfunc::compilePreviewKeyword('', $GLOBALS['BE_USER']->user['uid'], 60 * 60 * $ttlHours, $GLOBALS['BE_USER']->workspace) . '&id=' . intval($this->id);
         } else {
             $params = 'id=' . $this->id . '&ADMCMD_previewWS=' . $GLOBALS['BE_USER']->workspace;
             $previewUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php?ADMCMD_prev=' . t3lib_BEfunc::compilePreviewKeyword($params, $GLOBALS['BE_USER']->user['uid'], 60 * 60 * $ttlHours);
         }
         $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('previewUrl'), sprintf($GLOBALS['LANG']->getLL('previewInstruction'), $ttlHours) . '<br /><br /><a target="_blank" href="' . htmlspecialchars($previewUrl) . '">' . $previewUrl . '</a>', 0, 1);
     }
     // Output overview content:
     $this->content .= $this->doc->spacer(15);
     $this->content .= $this->doc->section($this->details ? $GLOBALS['LANG']->getLL('versionDetails') : $GLOBALS['LANG']->getLL('wsManagement'), $WSoverview, 0, 1);
 }
Пример #7
0
 /**
  * Creates a form for new workspace. Parts are adopted from <code>alt_doc.php</code>.
  *
  * @return	string		Generated form
  */
 function buildNewForm()
 {
     $content = '';
     $table = 'sys_workspace';
     $prevPageID = '';
     $trData = t3lib_div::makeInstance('t3lib_transferData');
     $trData->addRawData = TRUE;
     $trData->defVals = $this->defVals;
     $trData->lockRecords = 1;
     $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
     $trData->prevPageID = $prevPageID;
     $trData->fetchRecord($table, 0, 'new');
     reset($trData->regTableItems_data);
     $rec = current($trData->regTableItems_data);
     $rec['uid'] = uniqid('NEW');
     $rec['pid'] = 0;
     $rec['adminusers'] = $this->getOwnerUser($rec['uid']);
     // Setting variables in TCEforms object:
     $this->tceforms->hiddenFieldList = '';
     // Register default language labels, if any:
     $this->tceforms->registerDefaultLanguageData($table, $rec);
     $this->fixVariousTCAFields();
     if (!$GLOBALS['BE_USER']->isAdmin()) {
         // Non-admins cannot select users from the root. We "fix" it for them.
         $this->fixTCAUserField('adminusers');
         $this->fixTCAUserField('members');
         $this->fixTCAUserField('reviewers');
     }
     // Create form for the record (either specific list of fields or the whole record):
     $form = '';
     $form .= $this->doc->spacer(5);
     $form .= $this->tceforms->getMainFields($table, $rec);
     $form .= '<input type="hidden" name="workspace_form_submited" value="1" />';
     $form .= '<input type="hidden" name="data[' . $table . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />';
     $form .= '<input type="hidden" name="returnUrl" value="index.php" />';
     $form .= '<input type="hidden" name="action" value="new" />';
     $form .= '<input type="hidden" name="closeDoc" value="0" />';
     $form .= '<input type="hidden" name="doSave" value="0" />';
     $form .= '<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />';
     $form .= '<input type="hidden" name="_disableRTE" value="' . $this->tceforms->disableRTE . '" />';
     $form = $this->tceforms->wrapTotal($form, $rec, $table);
     // Combine it all:
     $content .= $form;
     return $content;
 }
    /**
     * Creating the module output.
     *
     * @return	void
     */
    function main()
    {
        global $LANG, $BACK_PATH;
        if ($this->id && $this->access) {
            // Init position map object:
            $posMap = t3lib_div::makeInstance('ext_posMap');
            $posMap->cur_sys_language = $this->sys_language;
            $posMap->backPath = $BACK_PATH;
            if ((string) $this->colPos != '') {
                // If a column is pre-set:
                if ($this->uid_pid < 0) {
                    $row = array();
                    $row['uid'] = abs($this->uid_pid);
                } else {
                    $row = '';
                }
                $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language);
            } else {
                $this->onClickEvent = '';
            }
            // ***************************
            // Creating content
            // ***************************
            // use a wrapper div
            $this->content .= '<div id="user-setup-wrapper">';
            $this->content .= $this->doc->header($LANG->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
            // Wizard
            $code = '';
            $wizardItems = $this->getWizardItems();
            // Wrapper for wizards
            $this->elementWrapper['sectionHeader'] = array('<h3 class="divider">', '</h3>');
            $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>');
            $this->elementWrapper['wizard'] = array('<tr>', '</tr>');
            $this->elementWrapper['wizardPart'] = array('<td>', '</td>');
            // copy wrapper for tabs
            $this->elementWrapperForTabs = $this->elementWrapper;
            // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) {
                    $hookObject = t3lib_div::getUserObj($classData);
                    if (!$hookObject instanceof cms_newContentElementWizardsHook) {
                        throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 1227834741);
                    }
                    $hookObject->manipulateWizardItems($wizardItems, $this);
                }
            }
            if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) {
                // restore wrapper for tabs if they are overwritten in hook
                $this->elementWrapper = $this->elementWrapperForTabs;
            }
            // add document inline javascript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function goToalt_doc()	{	//
					' . $this->onClickEvent . '
				}

				if(top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			');
            // Traverse items for the wizard.
            // An item is either a header or an item rendered with a radio button and title/description and icon:
            $cc = $key = 0;
            $menuItems = array();
            foreach ($wizardItems as $k => $wInfo) {
                if ($wInfo['header']) {
                    $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]);
                    $key = count($menuItems) - 1;
                } else {
                    $content = '';
                    // Radio button:
                    $oC = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : '');
                    $content .= $this->elementWrapper['wizardPart'][0] . '<input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($this->doc->thisBlur() . $oC) . '" />' . $this->elementWrapper['wizardPart'][1];
                    // Onclick action for icon/title:
                    $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $this->doc->thisBlur() . $oC . 'return false;';
                    // Icon:
                    $iInfo = @getimagesize($wInfo['icon']);
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1];
                    // Title + description:
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' . $this->elementWrapper['wizardPart'][1];
                    // Finally, put it together in a container:
                    $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1];
                    $cc++;
                }
            }
            // add closing section-tag
            foreach ($menuItems as $key => $val) {
                $menuItems[$key]['content'] .= $this->elementWrapper['section'][1];
            }
            // Add the wizard table to the content, wrapped in tabs:
            if ($this->config['renderMode'] == 'tabs') {
                $this->doc->inDocStylesArray[] = '
					.typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #adadad; width: 680px; }
					.typo3-dyntabmenu-divs table { margin: 15px; }
					.typo3-dyntabmenu-divs table td { padding: 3px; }
				';
                $code = $LANG->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', false, false, 100);
            } else {
                $code = $LANG->getLL('sel1', 1) . '<br /><br />';
                foreach ($menuItems as $section) {
                    $code .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $section['content'];
                }
            }
            $this->content .= $this->doc->section(!$this->onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1);
            // If the user must also select a column:
            if (!$this->onClickEvent) {
                // Add anchor "sel2"
                $this->content .= $this->doc->section('', '<a name="sel2"></a>');
                $this->content .= $this->doc->spacer(20);
                // Select position
                $code = $LANG->getLL('sel2', 1) . '<br /><br />';
                // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
                $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
                $colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $colPosList)));
                // Removing duplicates, if any
                // Finally, add the content of the column selector to the content:
                $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI);
                $this->content .= $this->doc->section($LANG->getLL('2_selectPosition'), $code, 0, 1);
            }
            // Close wrapper div
            $this->content .= '</div>';
        } else {
            // In case of no access:
            $this->content = '';
            $this->content .= $this->doc->header($LANG->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CSH'] = $docHeaderButtons['csh'];
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage($LANG->getLL('newContentElement'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->sectionEnd();
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Пример #9
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;
 }