/**
  * Creates module content.
  *
  * @return	void
  */
 function main()
 {
     global $LANG;
     // see what we have to do and get parameters (call before processing data!!!)
     $this->getModuleParameters();
     $hasAccess = $GLOBALS['BE_USER']->isAdmin() || 0 != ($GLOBALS['BE_USER']->groupData['workspace_perms'] & 4) || $this->isEditAction && $this->checkWorkspaceAccess();
     if (!$hasAccess) {
         $title = $this->getTitle();
         $this->content .= $this->doc->startPage($title);
         $this->content .= $this->doc->header($title);
         $this->content .= $this->doc->spacer(5);
         $this->content .= $LANG->getLL($this->isEditAction ? 'edit_workspace_no_permission' : 'create_workspace_no_permission');
         $this->content .= $this->doc->spacer(5);
         $goBack = $GLOBALS['LANG']->getLL('edit_workspace_go_back');
         $this->content .= t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '<a href="javascript:history.back()" title="' . $goBack . '">' . $goBack . '</a>';
         $this->content .= $this->doc->endPage();
         return;
     }
     // process submission (this may override action and workspace ID!)
     if (t3lib_div::_GP('workspace_form_submited')) {
         $this->processData();
         // if 'Save&Close' was pressed, redirect to main module script
         if (t3lib_div::_GP('_saveandclosedok_x')) {
             // `n` below is to prevent caching
             t3lib_utility_Http::redirect('index.php?n=' . uniqid(''));
         }
     }
     $this->initTCEForms();
     //
     // start page
     //
     $this->content .= $this->doc->header($this->getTitle());
     $this->content .= $this->doc->spacer(5);
     //
     // page content
     //
     $this->content .= $this->tceforms->printNeededJSFunctions_top();
     $this->content .= $this->buildForm();
     $this->content .= $this->tceforms->printNeededJSFunctions();
     // 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($this->getTitle());
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Exemple #2
0
 /**
  * Main module operation
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG;
     // Begin edit:
     if (is_array($this->editconf)) {
         // Initialize TCEforms (rendering the forms)
         $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
         $this->tceforms->initDefaultBEMode();
         $this->tceforms->doSaveFieldName = 'doSave';
         $this->tceforms->localizationMode = t3lib_div::inList('text,media', $this->localizationMode) ? $this->localizationMode : '';
         // text,media is keywords defined in TYPO3 Core API..., see "l10n_cat"
         $this->tceforms->returnUrl = $this->R_URI;
         $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
         $this->tceforms->disableRTE = !$BE_USER->isRTE();
         $this->tceforms->enableClickMenu = TRUE;
         $this->tceforms->enableTabMenu = TRUE;
         // Clipboard is initialized:
         $this->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
         // Start clipboard
         $this->tceforms->clipObj->initializeClipboard();
         // Initialize - reads the clipboard content from the user session
         // Setting external variables:
         $this->tceforms->edit_showFieldHelp = $BE_USER->uc['edit_showFieldHelp'];
         if ($this->editRegularContentFromId) {
             $this->editRegularContentFromId();
         }
         // Creating the editing form, wrap it with buttons, document selector etc.
         $editForm = $this->makeEditForm();
         if ($editForm) {
             $this->firstEl = reset($this->elementsData);
             // Checking if the currently open document is stored in the list of "open documents" - if not, then add it:
             if ((strcmp($this->docDat[1], $this->storeUrlMd5) || !isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
                 $this->docHandler[$this->storeUrlMd5] = array($this->storeTitle, $this->storeArray, $this->storeUrl, $this->firstEl);
                 $BE_USER->pushModuleData('alt_doc.php', array($this->docHandler, $this->storeUrlMd5));
                 t3lib_BEfunc::setUpdateSignal('tx_opendocs::updateNumber', count($this->docHandler));
             }
             // Module configuration
             $this->modTSconfig = $this->viewId ? t3lib_BEfunc::getModTSconfig($this->viewId, 'mod.xMOD_alt_doc') : array();
             $body .= $this->tceforms->printNeededJSFunctions_top();
             $body .= $this->compileForm($editForm);
             $body .= $this->tceforms->printNeededJSFunctions();
             $body .= $this->functionMenus();
             $body .= $this->tceformMessages();
         }
     }
     // 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->viewId, $this->perms_clause);
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers = array('LANGSELECTOR' => $this->langSelector(), 'EXTRAHEADER' => $this->extraFormHeaders(), 'CSH' => $docHeaderButtons['csh'], 'CONTENT' => $body);
     // Build the <body> for the module
     $this->content = $this->doc->startPage('TYPO3 Edit Document');
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }