Beispiel #1
0
 /**
  * Generates the module content (TYPO3 6.2).
  *
  * @param array $row
  * @return void
  */
 protected function moduleContentLegacy(array $row)
 {
     // TCE forms methods *must* be invoked before $this->doc->startPage()
     $wizard = $this->tceforms->printNeededJSFunctions_top();
     $wizard .= $this->buildFormLegacy($row);
     $wizard .= $this->tceforms->printNeededJSFunctions();
     $this->content .= $wizard;
 }
 /**
  * @param string $table
  * @param array|string $data
  * @return string
  */
 public function render($table = NULL, $data = NULL)
 {
     if (!$data) {
         $data = array();
     }
     if ($table) {
         if (!$data['uid']) {
             $data['uid'] = "none";
         }
         if (!$data['pid']) {
             $data['pid'] = "0";
         }
         $this->pageRenderer->loadPrototype();
         $this->pageRenderer->loadExtJS();
         $this->tceforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
         $this->tceforms->initDefaultBEMode();
         // EXTBASE FORMS
         $this->tceforms->prependFormFieldNames = $this->getFieldNamePrefix();
         $this->tceforms->formName = $table;
         $this->tceforms->totalWrap = '<div class="typo3-TCEforms"> |  </div>';
         $this->tceforms->doSaveFieldName = 'doSave';
         $this->tceforms->localizationMode = GeneralUtility::inList('text,media', $this->localizationMode) ? $this->localizationMode : '';
         $this->tceforms->returnUrl = $this->R_URI;
         $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
         $this->tceforms->disableRTE = !$GLOBALS['BE_USER']->isRTE();
         $this->tceforms->enableClickMenu = TRUE;
         $this->tceforms->enableTabMenu = TRUE;
         $panel = $this->tceforms->getMainFields($table, $data);
         $body = $this->tceforms->printNeededJSFunctions_top();
         $body .= $this->tceforms->wrapTotal($panel, $data, $table);
         $body .= $this->tceforms->printNeededJSFunctions();
         if (count($this->tceforms->commentMessages)) {
             $body .= '
                 <!-- TCEFORM messages
                 ' . htmlspecialchars(implode(LF, $this->tceforms->commentMessages)) . '
                 -->
             ';
         }
     } else {
         return "Tabelle wurde nicht angegeben.";
     }
     return $body;
 }
 /**
  * Main module operation
  *
  * @return void
  */
 public function main()
 {
     $body = '';
     // Begin edit:
     if (is_array($this->editconf)) {
         // Initialize TCEforms (rendering the forms)
         $this->tceforms = GeneralUtility::makeInstance(FormEngine::class);
         $this->tceforms->doSaveFieldName = 'doSave';
         $this->tceforms->localizationMode = GeneralUtility::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;
         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 (($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);
                 $this->getBackendUser()->pushModuleData('FormEngine', array($this->docHandler, $this->storeUrlMd5));
                 BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
             }
             // Module configuration
             $this->modTSconfig = $this->viewId ? BackendUtility::getModTSconfig($this->viewId, 'mod.xMOD_alt_doc') : array();
             $body = $this->tceforms->printNeededJSFunctions_top();
             $body .= $this->compileForm($editForm);
             $body .= $this->tceforms->printNeededJSFunctions();
         }
     }
     // 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 = BackendUtility::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);
 }
 /**
  * Main module operation
  *
  * @return void
  */
 public function main()
 {
     // Begin edit:
     if (is_array($this->editconf)) {
         // Initialize TCEforms (rendering the forms)
         $this->tceforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
         $this->tceforms->initDefaultBEMode();
         $this->tceforms->doSaveFieldName = 'doSave';
         $this->tceforms->localizationMode = GeneralUtility::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 = !$GLOBALS['BE_USER']->isRTE();
         $this->tceforms->enableClickMenu = TRUE;
         $this->tceforms->enableTabMenu = TRUE;
         // Clipboard is initialized:
         // Start clipboard
         $this->tceforms->clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard');
         // Initialize - reads the clipboard content from the user session
         $this->tceforms->clipObj->initializeClipboard();
         // Setting external variables:
         $this->tceforms->edit_showFieldHelp = $GLOBALS['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 (($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);
                 $GLOBALS['BE_USER']->pushModuleData('alt_doc.php', array($this->docHandler, $this->storeUrlMd5));
                 BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
             }
             // Module configuration
             $this->modTSconfig = $this->viewId ? BackendUtility::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 = BackendUtility::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);
 }
Beispiel #5
0
    /**
     * Action to create a new BE user
     *
     * @param array $record sys_action record
     * @return string form to create a new user
     */
    protected function viewNewBackendUser($record)
    {
        $content = '';
        $beRec = BackendUtility::getRecord('be_users', (int) $record['t1_copy_of_user']);
        // A record is need which is used as copy for the new user
        if (!is_array($beRec)) {
            $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('action_notReady', TRUE), $GLOBALS['LANG']->getLL('action_error'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
            $content .= $flashMessage->render();
            return $content;
        }
        $vars = GeneralUtility::_POST('data');
        $key = 'NEW';
        if ($vars['sent'] == 1) {
            $errors = array();
            // Basic error checks
            if (!empty($vars['email']) && !GeneralUtility::validEmail($vars['email'])) {
                $errors[] = $GLOBALS['LANG']->getLL('error-wrong-email');
            }
            if (empty($vars['username'])) {
                $errors[] = $GLOBALS['LANG']->getLL('error-username-empty');
            }
            if ($vars['key'] === 'NEW' && empty($vars['password'])) {
                $errors[] = $GLOBALS['LANG']->getLL('error-password-empty');
            }
            if ($vars['key'] !== 'NEW' && !$this->isCreatedByUser($vars['key'], $record)) {
                $errors[] = $GLOBALS['LANG']->getLL('error-wrong-user');
            }
            foreach ($this->hookObjects as $hookObject) {
                if (method_exists($hookObject, 'viewNewBackendUser_Error')) {
                    $errors = $hookObject->viewNewBackendUser_Error($vars, $errors, $this);
                }
            }
            // Show errors if there are any
            if (count($errors) > 0) {
                $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', implode('<br />', $errors), $GLOBALS['LANG']->getLL('action_error'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                $content .= $flashMessage->render() . '<br />';
            } else {
                // Save user
                $key = $this->saveNewBackendUser($record, $vars);
                // Success message
                $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $vars['key'] === 'NEW' ? $GLOBALS['LANG']->getLL('success-user-created') : $GLOBALS['LANG']->getLL('success-user-updated'), $GLOBALS['LANG']->getLL('success'), \TYPO3\CMS\Core\Messaging\FlashMessage::OK);
                $content .= $flashMessage->render() . '<br />';
            }
        }
        // Load BE user to edit
        if ((int) GeneralUtility::_GP('be_users_uid') > 0) {
            $tmpUserId = (int) GeneralUtility::_GP('be_users_uid');
            // Check if the selected user is created by the current user
            $rawRecord = $this->isCreatedByUser($tmpUserId, $record);
            if ($rawRecord) {
                // Delete user
                if (GeneralUtility::_GP('delete') == 1) {
                    $this->deleteUser($tmpUserId, $record['uid']);
                }
                $key = $tmpUserId;
                $vars = $rawRecord;
            }
        }
        $this->JScode();
        $loadDB = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
        $loadDB->start($vars['db_mountpoints'], 'pages');
        $this->t3lib_TCEforms->printNeededJSFunctions();
        $content .= '<form action="" method="post" enctype="multipart/form-data" name="' . $this->t3lib_TCEforms->formName . '">
						<fieldset class="fields">
							<legend>' . $GLOBALS['LANG']->getLL('action_t1_legend_generalFields') . '</legend>
							<div class="row">
								<label for="field_disable">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.disable') . '</label>
								<input type="checkbox" id="field_disable" name="data[disable]" value="1" class="checkbox" ' . ($vars['disable'] == 1 ? ' checked="checked" ' : '') . ' />
							</div>
							<div class="row">
								<label for="field_realname">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.name') . '</label>
								<input type="text" id="field_realname" name="data[realName]" value="' . htmlspecialchars($vars['realName']) . '" />
							</div>
							<div class="row">
								<label for="field_username">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:be_users.username') . '</label>
								<input type="text" id="field_username" name="data[username]" value="' . htmlspecialchars($vars['username']) . '" />
							</div>
							<div class="row">
								<label for="field_password">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:be_users.password') . '</label>
								<input type="password" id="field_password" name="data[password]" value="" />
							</div>
							<div class="row">
								<label for="field_email">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.email') . '</label>
								<input type="text" id="field_email" name="data[email]" value="' . htmlspecialchars($vars['email']) . '" />
							</div>
						</fieldset>
						<fieldset class="fields">
							<legend>' . $GLOBALS['LANG']->getLL('action_t1_legend_configuration') . '</legend>

							<div class="row">
								<label for="field_usergroup">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:be_users.usergroup') . '</label>
								<select id="field_usergroup" name="data[usergroup][]" multiple="multiple">
									' . $this->getUsergroups($record, $vars) . '
								</select>
							</div>
							<div class="row">
								<label for="field_db_mountpoints">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:be_users.options_db_mounts') . '</label>
								' . $this->t3lib_TCEforms->dbFileIcons('data[db_mountpoints]', 'db', 'pages', $loadDB->itemArray, '', array('size' => 3)) . '
							</div>
							<div class="row">
								<input type="hidden" name="data[key]" value="' . $key . '" />
								<input type="hidden" name="data[sent]" value="1" />
								<input type="submit" value="' . ($key === 'NEW' ? $GLOBALS['LANG']->getLL('action_Create') : $GLOBALS['LANG']->getLL('action_Update')) . '" />
							</div>
						</fieldset>
					</form>';
        $content .= $this->getCreatedUsers($record, $key);
        return $content;
    }