📄 workspaceforms.php
字号:
<?php/**************************************************************** Copyright notice** (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)* All rights reserved** This script is part of the TYPO3 project. The TYPO3 project is* free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** The GNU General Public License can be found at* http://www.gnu.org/copyleft/gpl.html.* A copy is found in the textfile GPL.txt and important notices to the license* from the author is found in LICENSE.txt distributed with these scripts.*** This script is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** This copyright notice MUST APPEAR in all copies of the script!***************************************************************//** * Module: Workspace manager * * $Id: workspaceforms.php 1899 2007-01-09 12:55:52Z kurfuerst $ * * @author Dmitry Dulepov <typo3@accio.lv> *//** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 93: class SC_mod_user_ws_workspaceForms extends t3lib_SCbase * * SECTION: PUBLIC MODULE METHODS * 123: function init() * 158: function main() * 233: function printContent() * * SECTION: PRIVATE FUNCTIONS * 257: function initTCEForms() * 284: function getModuleParameters() * 302: function getTitle() * 321: function buildForm() * 330: function buildEditForm() * 395: function buildNewForm() * 458: function createButtons() * 484: function getOwnerUser($uid) * 510: function processData() * 554: function fixVariousTCAFields() * 566: function fixTCAUserField($fieldName) * 593: function checkWorkspaceAccess() * * * 606: class user_SC_mod_user_ws_workspaceForms * 615: function processUserAndGroups($conf, $tceforms) * * TOTAL FUNCTIONS: 16 * (This index is automatically created/updated by the extension "extdeveval") * */// Initialize module:unset($MCONF);require('conf.php');require($BACK_PATH.'init.php');require($BACK_PATH.'template.php');$BE_USER->modAccess($MCONF,1);// Include libraries of various kinds used inside:$LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');require_once(PATH_t3lib.'class.t3lib_scbase.php');//require_once(PATH_typo3.'mod/user/ws/class.wslib.php');require_once(PATH_t3lib.'class.t3lib_tcemain.php');require_once(PATH_t3lib.'class.t3lib_tceforms.php');require_once (PATH_t3lib.'class.t3lib_transferdata.php');require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');/** * Module: Workspace forms for editing/creating workspaces. * * @author Dmitry Dulepov <typo3@fm-world.ru> * @package TYPO3 * @subpackage core */class SC_mod_user_ws_workspaceForms extends t3lib_SCbase { // Default variables for backend modules var $MCONF = array(); // Module configuration var $MOD_MENU = array(); // Module menu items var $MOD_SETTINGS = array(); // Module session settings var $doc; // Document Template Object var $content; // Accumulated content // internal variables var $isEditAction = false; // true if about to edit workspace var $workspaceId; // ID of the workspace that we will edit. Set only if $isEditAction is true. var $tceforms; // An instance of t3lib_TCEForms /************************* * * PUBLIC MODULE METHODS * *************************/ /** * Initializes the module. See <code>t3lib_SCbase::init()</code> for more information. * * @return void */ function init() { // Setting module configuration: $this->MCONF = $GLOBALS['MCONF']; // Initialize Document Template object: $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->docType = 'xhtml_trans'; $this->doc->form = '<form action="' . t3lib_div::getIndpEnv('SCRIPT_NAME').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; $CMparts = $this->doc->getContextMenuCode(); $this->doc->JScode.= $CMparts[0]; $this->doc->JScode.= $this->doc->getDynTabMenuJScode(); $this->doc->bodyTagAdditions = $CMparts[1]; $this->doc->postCode.= $CMparts[2]; // Parent initialization: t3lib_SCbase::init(); } /** * 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 .= '<img ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/goback.gif', 'width="14" height="14"') . ' alt="' . $goBack . '" align="middle" hspace="2" />' . '<a href="javascript:history.back()">' . $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 header('Location: ' . t3lib_div::locationHeaderUrl('index.php?n=' . uniqid(''))); exit(); } } $this->initTCEForms(); // // start page // $title = $this->getTitle(); $this->content .= $this->doc->startPage($title); $this->content .= $this->doc->header($title); $this->content .= $this->doc->spacer(5); // // page content // $this->content .= $this->tceforms->printNeededJSFunctions_top(); $this->content .= $this->buildForm(); $this->content .= $this->tceforms->printNeededJSFunctions(); // // end page // $this->content .= $this->doc->endPage(); } /** * Outputs module content to the browser. * * @return void */ function printContent() { echo $this->content; } /************************* * * PRIVATE FUNCTIONS * *************************/ /** * Initializes <code>t3lib_TCEform</code> class for use in this module. * * @return void */ function initTCEForms() { $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms'); $this->tceforms->initDefaultBEMode(); $this->tceforms->backPath = $GLOBALS['BACK_PATH']; $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 = $this->MOD_SETTINGS['disableRTE']; $this->tceforms->enableClickMenu = true; $this->tceforms->enableTabMenu = true; // Setting external variables: if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions']) $this->tceforms->edit_showFieldHelp='text'; } /** * Retrieves module parameters from the <code>t3lib_div::_GP</code>. The following arguments are retrieved: <ul><li>action</li><li>workspace id (if action == 'edit')</li></ul> * * @return void */ function getModuleParameters(){ $this->isEditAction = (t3lib_div::_GP('action') == 'edit'); if ($this->isEditAction) { $this->workspaceId = intval(t3lib_div::_GP('wkspId')); } } /** * Retrieves a title of the module according to action. * * @return string A title for the module */ function getTitle() { $label = ($this->isEditAction ? 'edit_workspace_title_edit' : 'edit_workspace_title_new'); return $GLOBALS['LANG']->getLL($label); } /** * Creates form for workspace. This function is a wrapper around <code>buildEditForm()</code> and <code>buildNewForm()</code>. * * @return string Generated form */ function buildForm() { return $this->isEditAction ? $this->buildEditForm() : $this->buildNewForm(); } /** * Creates a form for editing workspace. Parts were adopted from <code>alt_doc.php</code>. * * @return string Generated form */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -