Documentation TYPO3 par Ameos

alt_doc_ajax.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2006 Oliver Hader <oh@inpublica.de>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00051 require('init.php');
00052 require('template.php');
00053 $LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml');
00054 require_once (PATH_t3lib.'class.t3lib_tceforms.php');
00055         // @TODO: Do we really need this here?
00056 require_once (PATH_t3lib.'class.t3lib_clipboard.php');
00057 
00058 require_once (PATH_t3lib.'class.t3lib_tcemain.php');
00059 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
00060 require_once (PATH_t3lib.'class.t3lib_transferdata.php');
00061 
00062 
00063 t3lib_BEfunc::lockRecords();
00064 
00065 
00066 
00067 class SC_alt_doc_ajax {
00068         var $content;                           // Content accumulation
00069         var $retUrl;                            // Return URL script, processed. This contains the script (if any) that we should RETURN TO from the alt_doc.php script IF we press the close button. Thus this variable is normally passed along from the calling script so we can properly return if needed.
00070         var $R_URL_parts;                       // Contains the parts of the REQUEST_URI (current url). By parts we mean the result of resolving REQUEST_URI (current url) by the parse_url() function. The result is an array where eg. "path" is the script path and "query" is the parameters...
00071         var $R_URL_getvars;                     // Contains the current GET vars array; More specifically this array is the foundation for creating the R_URI internal var (which becomes the "url of this script" to which we submit the forms etc.)
00072         var $R_URI;                                     // Set to the URL of this script including variables which is needed to re-display the form. See main()
00073         var $tceforms;                          // Contains the instance of TCEforms class.
00074         var $localizationMode;          // GP var, localization mode for TCEforms (eg. "text")
00075         var $ajax = array();            // the AJAX paramerts from get/post
00076 
00077         function init() {
00078                 global $BE_USER;
00079 
00080                         // get AJAX parameters
00081                 $this->ajax = t3lib_div::_GP('ajax');
00082 
00083                         // MENU-ITEMS:
00084                         // If array, then it's a selector box menu
00085                         // If empty string it's just a variable, that'll be saved.
00086                         // Values NOT in this array will not be saved in the settings-array for the module.
00087                         // @TODO: showPalettes etc. should be stored on client side and submitted via each ajax call
00088                 $this->MOD_MENU = array(
00089                         'showPalettes' => '',
00090                         'showDescriptions' => '',
00091                         'disableRTE' => ''
00092                 );
00093                         // Setting virtual document name
00094                 $this->MCONF['name']='xMOD_alt_doc.php';
00095                         // CLEANSE SETTINGS
00096                 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00097 
00098                 $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00099                 $this->tceforms->initDefaultBEMode();
00100                 $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
00101                 $this->tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00102                 $this->tceforms->enableClickMenu = TRUE;
00103                 $this->tceforms->enableTabMenu = TRUE;
00104 
00105                         // Clipboard is initialized:
00106                 $this->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');          // Start clipboard
00107                 $this->tceforms->clipObj->initializeClipboard();        // Initialize - reads the clipboard content from the user session
00108 
00109                         // Setting external variables:
00110                 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions'])      $this->tceforms->edit_showFieldHelp='text';
00111         }
00112 
00120         function main() {
00121                 header('Expires: Fri, 27 Nov 1981 09:04:00 GMT');
00122                 header('Last-Modified: '.gmdate("D, d M Y H:i:s").' GMT');
00123                 header('Cache-Control: no-cache, must-revalidate');
00124                 header('Pragma: no-cache');
00125                 header('Content-type: text/javascript; charset=utf-8');
00126 
00127                 $this->content = '';
00128 
00129                 if (is_array($this->ajax) && count($this->ajax)) {
00130                                 // the first argument is the method that should handle the AJAX call
00131                         $method = array_shift($this->ajax);
00132 
00133                                 // Security check
00134                         if(!in_array($method, array('createNewRecord', 'setExpandedCollapsedState'))) return false;
00135 
00136                         $this->content = call_user_func_array(
00137                                 array(&$this->tceforms->inline, $method),
00138                                 $this->ajax
00139                         );
00140                 }
00141         }
00142 
00148         function printContent() {
00149                 echo $this->content;
00150         }
00151 }
00152 
00153 // Include extension?
00154 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc_ajax.php'])  {
00155         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc_ajax.php']);
00156 }
00157 
00158 
00159 
00160 
00161 
00162 
00163 // Make instance:
00164 $SOBE = t3lib_div::makeInstance('SC_alt_doc_ajax');
00165 
00166 // Main:
00167 $SOBE->init();
00168 $SOBE->main();
00169 $SOBE->printContent();
00170 
00171 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6