* Fixed an error for form wizard (and others...) where the return URL would be wrong...
[Packages/TYPO3.CMS.git] / typo3 / alt_doc.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Main form rendering script
29 * By sending certain parameters to this script you can bring up a form
30 * which allows the user to edit the content of one or more database records.
31 *
32 * $Id$
33 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
34 * XHTML compliant
35 *
36 * @author Kasper Skaarhoj <kasper@typo3.com>
37 */
38 /**
39 * [CLASS/FUNCTION INDEX of SCRIPT]
40 *
41 *
42 *
43 * 93: class SC_alt_doc
44 * 164: function preInit()
45 * 216: function doProcessData()
46 * 228: function processData()
47 * 345: function init()
48 * 424: function main()
49 * 481: function printContent()
50 *
51 * SECTION: Sub-content functions, rendering specific parts of the module content.
52 * 516: function makeEditForm()
53 * 680: function makeButtonPanel()
54 * 759: function makeDocSel()
55 * 798: function makeCmenu()
56 * 816: function compileForm($panel,$docSel,$cMenu,$editForm)
57 * 875: function functionMenus()
58 * 906: function shortCutLink()
59 * 937: function tceformMessages()
60 *
61 * SECTION: Other functions
62 * 975: function editRegularContentFromId()
63 * 1002: function compileStoreDat()
64 * 1015: function getNewIconMode($table,$key='saveDocNew')
65 * 1028: function closeDocument($code=0)
66 * 1060: function setDocument($currentDocFromHandlerMD5='',$retUrl='alt_doc_nodoc.php')
67 *
68 * TOTAL FUNCTIONS: 19
69 * (This index is automatically created/updated by the extension "extdeveval")
70 *
71 */
72
73
74 require ('init.php');
75 require ('template.php');
76 include ('sysext/lang/locallang_alt_doc.php');
77 require_once (PATH_t3lib.'class.t3lib_tceforms.php');
78
79
80 t3lib_BEfunc::lockRecords();
81
82
83
84
85 /**
86 * Script Class: Drawing the editing form for editing records in TYPO3.
87 * Notice: It does NOT use tce_db.php to submit data to, rather it handles submissions itself
88 *
89 * @author Kasper Skaarhoj <kasper@typo3.com>
90 * @package TYPO3
91 * @subpackage core
92 */
93 class SC_alt_doc {
94
95 // Internal, static: GPvars:
96 var $editconf; // GPvar "edit": Is an array looking approx like [tablename][list-of-ids]=command, eg. "&edit[pages][123]=edit". See t3lib_BEfunc::editOnClick(). Value can be seen modified internally.
97 var $columnsOnly; // Commalist of fieldnames to edit. The point is IF you specify this list, only those fields will be rendered in the form. Otherwise all (available) fields in the record is shown according to the types configuration in $TCA
98 var $defVals; // Default values for fields (array with tablenames, fields etc. as keys). Can be seen modified internally.
99 var $overrideVals; // Array of values to force being set (as hidden fields). Will be set as $this->defVals IF defVals does not exist.
100 var $returnUrl; // If set, this value will be set in $this->retUrl (which is used quite many places as the return URL). If not set, "dummy.php" will be set in $this->retUrl
101 var $closeDoc; // Close-document command. Not really sure of all options...
102 var $doSave; // Quite simply, if this variable is set, then the processing of incoming data will be performed - as if a save-button is pressed. Used in the forms as a hidden field which can be set through JavaScript if the form is somehow submitted by JavaScript).
103
104 var $data; // GPvar (for processing only) : The data array from which the data comes...
105 var $mirror; // GPvar (for processing only) : ?
106 var $cacheCmd; // GPvar (for processing only) : Clear-cache cmd.
107 var $redirect; // GPvar (for processing only) : Redirect (not used???)
108 var $disableRTE; // GPvar (for processing only) : If set, the rich text editor is disabled in the forms.
109 var $returnNewPageId; // GPvar (for processing only) : Boolean: If set, then the GET var "&id=" will be added to the retUrl string so that the NEW id of something is returned to the script calling the form.
110 var $vC; // GPvar (for processing only) : Verification code, internal stuff.
111
112 var $popViewId; // GPvar (module) : ID for displaying the page in the frontend (used for SAVE/VIEW operations)
113 var $viewUrl; // GPvar (module) : Alternative URL for viewing the frontend pages.
114 var $editRegularContentFromId; // If this is pointing to a page id it will automatically load all content elements (NORMAL column/default language) from that page into the form!
115 var $recTitle; // Alternative title for the document handler.
116 var $disHelp; // Disable help... ?
117 var $noView; // If set, then no SAVE/VIEW button is printed
118 var $returnEditConf; // If set, the $this->editconf array is returned to the calling script (used by wizard_add.php for instance)
119
120
121 // Internal, static:
122 var $doc; // Document template object
123 var $content; // Content accumulation
124
125 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.
126 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...
127 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.)
128 var $R_URI; // Set to the URL of this script including variables which is needed to re-display the form. See main()
129
130 var $storeTitle; // Is loaded with the "title" of the currently "open document" - this is used in the Document Selector box. (see makeDocSel())
131 var $storeArray; // Contains an array with key/value pairs of GET parameters needed to reach the current document displayed - used in the Document Selector box. (see compileStoreDat())
132 var $storeUrl; // Contains storeArray, but imploded into a GET parameter string (see compileStoreDat())
133 var $storeUrlMd5; // Hashed value of storeURL (see compileStoreDat())
134
135 var $docDat; // Module session data
136 var $docHandler; // An array of the "open documents" - keys are md5 hashes (see $storeUrlMd5) identifying the various documents on the GET parameter list needed to open it. The values are arrays with 0,1,2 keys with information about the document (see compileStoreDat()). The docHandler variable is stored in the $docDat session data, key "0".
137
138
139 // Internal: Related to the form rendering:
140 var $elementsData; // Array of the elements to create edit forms for.
141 var $firstEl; // Pointer to the first element in $elementsData
142 var $errorC; // Counter, used to count the number of errors (when users do not have edit permissions)
143 var $newC; // Counter, used to count the number of new record forms displayed
144 var $viewId; // Is set the the pid value of the last shown record - thus indicating which page to show when clicking the SAVE/VIEW button
145 var $modTSconfig; // Module TSconfig, loaded from main() based on the page id value of viewId
146 var $tceforms; // Contains the instance of TCEforms class.
147 var $generalPathOfForm; // Contains the root-line path of the currently edited record(s) - for display.
148
149
150 // Internal, dynamic:
151 var $dontStoreDocumentRef; // Used internally to disable the storage of the document reference (eg. new records)
152
153
154
155
156
157
158
159 /**
160 * First initialization.
161 *
162 * @return void
163 */
164 function preInit() {
165 global $BE_USER;
166
167 // Setting GPvars:
168 $this->editconf = t3lib_div::_GP('edit');
169 $this->defVals = t3lib_div::_GP('defVals');
170 $this->overrideVals = t3lib_div::_GP('overrideVals');
171 $this->columnsOnly = t3lib_div::_GP('columnsOnly');
172 $this->returnUrl = t3lib_div::_GP('returnUrl');
173 $this->closeDoc = t3lib_div::_GP('closeDoc');
174 $this->doSave = t3lib_div::_GP('doSave');
175 $this->returnEditConf = t3lib_div::_GP('returnEditConf');
176
177 // Setting override values as default if defVals does not exist.
178 if (!is_array($this->defVals) && is_array($this->overrideVals)) {
179 $this->defVals = $this->overrideVals;
180 }
181
182 // Setting return URL
183 $this->retUrl = $this->returnUrl ? $this->returnUrl : 'dummy.php';
184
185 // Make R_URL (request url) based on input GETvars:
186 $this->R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
187 $this->R_URL_getvars = t3lib_div::_GET();
188
189 // MAKE url for storing
190 $this->compileStoreDat();
191
192 // Initialize more variables.
193 $this->dontStoreDocumentRef=0;
194 $this->storeTitle='';
195
196 // Get session data for the module:
197 $this->docDat = $BE_USER->getModuleData('alt_doc.php','ses');
198 $this->docHandler = $this->docDat[0];
199
200 // If a request for closing the document has been sent, act accordingly:
201 if ($this->closeDoc>0) {
202 $this->closeDocument($this->closeDoc);
203 }
204
205 // If NO vars are sent to the script, try to read first document:
206 if (is_array($this->R_URL_getvars) && count($this->R_URL_getvars)<2 && !is_array($this->editconf)) { // Added !is_array($this->editconf) because editConf must not be set either. Anyways I can't figure out when this situation here will apply...
207 $this->setDocument($this->docDat[1]);
208 }
209 }
210
211 /**
212 * Detects, if a save command has been triggered.
213 *
214 * @return boolean True, then save the document (data submitted)
215 */
216 function doProcessData() {
217 global $HTTP_POST_VARS;
218
219 $out = $this->doSave || isset($HTTP_POST_VARS['_savedok_x']) || isset($HTTP_POST_VARS['_saveandclosedok_x']) || isset($HTTP_POST_VARS['_savedokview_x']) || isset($HTTP_POST_VARS['_savedoknew_x']);
220 return $out;
221 }
222
223 /**
224 * Do processing of data, submitting it to TCEmain.
225 *
226 * @return void
227 */
228 function processData() {
229 global $BE_USER,$HTTP_POST_VARS,$TYPO3_CONF_VARS;
230
231 // GPvars specifically for processing:
232 $this->data = t3lib_div::_GP('data');
233 $this->mirror = t3lib_div::_GP('mirror');
234 $this->cacheCmd = t3lib_div::_GP('cacheCmd');
235 $this->redirect = t3lib_div::_GP('redirect');
236 $this->disableRTE = t3lib_div::_GP('_disableRTE');
237 $this->returnNewPageId = t3lib_div::_GP('returnNewPageId');
238 $this->vC = t3lib_div::_GP('vC');
239
240 // See tce_db.php for relevate options here:
241 // Only options related to $this->data submission are included here.
242 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
243 $tce->stripslashes_values=0;
244
245 // Setting default values specific for the user:
246 $TCAdefaultOverride = $BE_USER->getTSConfigProp('TCAdefaults');
247 if (is_array($TCAdefaultOverride)) {
248 $tce->setDefaultsFromUserTS($TCAdefaultOverride);
249 }
250
251 // Setting internal vars:
252 if ($BE_USER->uc['neverHideAtCopy']) { $tce->neverHideAtCopy = 1; }
253 $tce->debug=0;
254 $tce->disableRTE = $this->disableRTE;
255
256 // Loading TCEmain with data:
257 $tce->start($this->data,array());
258 if (is_array($this->mirror)) { $tce->setMirror($this->mirror); }
259
260 // If pages are being edited, we set an instruction about updating the page tree after this operation.
261 if (isset($this->data['pages'])) {
262 t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
263 }
264
265
266 // Checking referer / executing
267 $refInfo=parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
268 $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
269 if ($httpHost!=$refInfo['host'] && $this->vC!=$BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
270 $tce->log('',0,0,0,1,"Referer host '%s' and server host '%s' did not match and veriCode was not valid either!",1,array($refInfo['host'],$httpHost));
271 debug('Error: Referer host did not match with server host.');
272 } else {
273
274 // Perform the saving operation with TCEmain:
275 $tce->process_uploads($GLOBALS['HTTP_POST_FILES']);
276 $tce->process_datamap();
277
278 // If there was saved any new items, load them:
279 if (count($tce->substNEWwithIDs_table)) {
280
281 // Resetting editconf:
282 $this->editconf = array();
283
284 // Traverse all new records and forge the content of ->editconf so we can continue to EDIT these records!
285 foreach($tce->substNEWwithIDs_table as $nKey => $nTable) {
286 $this->editconf[$nTable][$tce->substNEWwithIDs[$nKey]]='edit';
287 if ($nTable=='pages' && $this->retUrl!='dummy.php' && $this->returnNewPageId) {
288 $this->retUrl.='&id='.$tce->substNEWwithIDs[$nKey];
289 }
290 }
291
292 // Finally, set the editconf array in the "getvars" so they will be passed along in URLs as needed.
293 $this->R_URL_getvars['edit']=$this->editconf;
294
295 // Unsetting default values since we don't need them anymore.
296 unset($this->R_URL_getvars['defVals']);
297
298 // Re-compile the store* values since editconf changed...
299 $this->compileStoreDat();
300 }
301
302 // If a document is saved and a new one is created right after.
303 if (isset($HTTP_POST_VARS['_savedoknew_x']) && is_array($this->editconf)) {
304
305 // Finding the current table:
306 reset($this->editconf);
307 $nTable=key($this->editconf);
308
309 // Finding the first id, getting the records pid+uid
310 reset($this->editconf[$nTable]);
311 $nUid=key($this->editconf[$nTable]);
312 $nRec = t3lib_BEfunc::getRecord($nTable,$nUid,'pid,uid');
313
314 // Setting a blank editconf array for a new record:
315 $this->editconf=array();
316 if ($this->getNewIconMode($nTable)=='top') {
317 $this->editconf[$nTable][$nRec['pid']]='new';
318 } else {
319 $this->editconf[$nTable][-$nRec['uid']]='new';
320 }
321
322 // Finally, set the editconf array in the "getvars" so they will be passed along in URLs as needed.
323 $this->R_URL_getvars['edit']=$this->editconf;
324
325 // Re-compile the store* values since editconf changed...
326 $this->compileStoreDat();
327 }
328
329 $tce->printLogErrorMessages(
330 isset($HTTP_POST_VARS['_saveandclosedok_x']) ?
331 $this->retUrl :
332 $this->R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$this->R_URL_getvars) // popView will not be invoked here, because the information from the submit button for save/view will be lost .... But does it matter if there is an error anyways?
333 );
334 }
335 if (isset($HTTP_POST_VARS['_saveandclosedok_x']) || $this->closeDoc<0) { // || count($tce->substNEWwithIDs)... If any new items has been save, the document is CLOSED because if not, we just get that element re-listed as new. And we don't want that!
336 $this->closeDocument(abs($this->closeDoc));
337 }
338 }
339
340 /**
341 * Initialize the normal module operation
342 *
343 * @return void
344 */
345 function init() {
346 global $BE_USER,$LANG,$BACK_PATH,$HTTP_POST_VARS;
347
348 // Setting more GPvars:
349 $this->popViewId = t3lib_div::_GP('popViewId');
350 $this->viewUrl = t3lib_div::_GP('viewUrl');
351 $this->editRegularContentFromId = t3lib_div::_GP('editRegularContentFromId');
352 $this->recTitle = t3lib_div::_GP('recTitle');
353 $this->disHelp = t3lib_div::_GP('disHelp');
354 $this->noView = t3lib_div::_GP('noView');
355
356 // Set other internal variables:
357 $this->R_URL_getvars['returnUrl']=$this->retUrl;
358 $this->R_URI = $this->R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$this->R_URL_getvars);
359
360 // MENU-ITEMS:
361 // If array, then it's a selector box menu
362 // If empty string it's just a variable, that'll be saved.
363 // Values NOT in this array will not be saved in the settings-array for the module.
364 $this->MOD_MENU = array(
365 'showPalettes' => '',
366 'showDescriptions' => '',
367 'disableRTE' => ''
368 );
369
370 // Setting virtual document name
371 $this->MCONF['name']='xMOD_alt_doc.php';
372
373 // CLEANSE SETTINGS
374 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
375
376 // Create an instance of the document template object
377 $this->doc = t3lib_div::makeInstance('bigDoc');
378 $this->doc->bodyTagMargins['x']=5;
379 $this->doc->bodyTagMargins['y']=5;
380 $this->doc->backPath = $BACK_PATH;
381 $this->doc->docType = 'xhtml_trans';
382
383 $this->doc->form='<form action="'.htmlspecialchars($this->R_URI).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR_checkSubmit(1);">';
384
385 $this->doc->JScode = $this->doc->wrapScriptTags('
386 function jumpToUrl(URL,formEl) { //
387 if (!TBE_EDITOR_isFormChanged()) {
388 document.location = URL;
389 } else if (formEl && formEl.type=="checkbox") {
390 formEl.checked = formEl.checked ? 0 : 1;
391 }
392 }
393
394 // Object: TS:
395 function typoSetup () { //
396 this.uniqueID = "";
397 }
398 var TS = new typoSetup();
399
400 // Info view:
401 function launchView(table,uid,bP) { //
402 var backPath= bP ? bP : "";
403 var thePreviewWindow="";
404 thePreviewWindow = window.open(backPath+"show_item.php?table="+escape(table)+"&uid="+escape(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
405 if (thePreviewWindow && thePreviewWindow.focus) {
406 thePreviewWindow.focus();
407 }
408 }
409 function deleteRecord(table,id,url) { //
410 if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) {
411 document.location = "tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";
412 }
413 return false;
414 }
415 '.(isset($HTTP_POST_VARS['_savedokview_x']) && $this->popViewId ? t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl) : '')
416 );
417 }
418
419 /**
420 * Main module operation
421 *
422 * @return void
423 */
424 function main() {
425 global $BE_USER,$LANG;
426
427 // Starting content accumulation:
428 $this->content='';
429 $this->content.=$this->doc->startPage('TYPO3 Edit Document');
430
431 // Begin edit:
432 if (is_array($this->editconf)) {
433
434 // Initialize TCEforms (rendering the forms)
435 $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
436 $this->tceforms->initDefaultBEMode();
437 $this->tceforms->doSaveFieldName = 'doSave';
438 $this->tceforms->returnUrl = $this->R_URI;
439 $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
440 $this->tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
441
442 // Setting external variables:
443 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions']) $this->tceforms->edit_showFieldHelp='text';
444
445 if ($this->editRegularContentFromId) {
446 $this->editRegularContentFromId();
447 }
448
449 // Creating the editing form, wrap it with buttons, document selector etc.
450 $editForm = $this->makeEditForm();
451 if ($editForm) {
452 reset($this->elementsData);
453 $this->firstEl = current($this->elementsData);
454
455 if ($this->viewId) {
456 // Module configuration:
457 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->viewId,'mod.xMOD_alt_doc');
458 } else $this->modTSconfig=array();
459
460 $panel = $this->makeButtonPanel();
461 $docSel = $this->makeDocSel();
462 $cMenu = $this->makeCmenu();
463
464 $formContent = $this->compileForm($panel,$docSel,$cMenu,$editForm);
465
466 $this->content.=$this->tceforms->printNeededJSFunctions_top().
467 $formContent.
468 $this->tceforms->printNeededJSFunctions();
469 $this->content.=$this->functionMenus();
470 $this->content.=$this->shortCutLink();
471
472 $this->tceformMessages();
473 }
474 }
475 }
476
477 /**
478 * Outputting the accumulated content to screen
479 *
480 * @return void
481 */
482 function printContent() {
483
484 echo $this->content.$this->doc->endPage();
485 }
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506 /***************************
507 *
508 * Sub-content functions, rendering specific parts of the module content.
509 *
510 ***************************/
511
512 /**
513 * Creates the editing form with TCEforms, based on the input from GPvars.
514 *
515 * @return string HTML form elements wrapped in tables
516 */
517 function makeEditForm() {
518 global $BE_USER,$LANG,$TCA;
519
520 // Initialize variables:
521 $this->elementsData=array();
522 $this->errorC=0;
523 $this->newC=0;
524 $thePrevUid='';
525 $editForm='';
526
527 // Traverse the GPvar edit array
528 foreach($this->editconf as $table => $conf) { // Tables:
529 if (is_array($conf) && $TCA[$table] && $BE_USER->check('tables_modify',$table)) {
530
531 // Traverse the keys/comments of each table (keys can be a commalist of uids)
532 foreach($conf as $cKey => $cmd) {
533 if ($cmd=='edit' || $cmd=='new') {
534
535 // Get the ids:
536 $ids = t3lib_div::trimExplode(',',$cKey,1);
537
538 // Traverse the ids:
539 foreach($ids as $theUid) {
540
541 // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
542 // First, resetting flags.
543 $hasAccess = 1;
544 $deleteAccess=0;
545 $this->viewId=0;
546
547 // If the command is to create a NEW record...:
548 if ($cmd=='new') {
549 if (intval($theUid)) { // NOTICE: the id values in this case points to the page uid onto which the record should be create OR (if the id is negativ) to a record from the same table AFTER which to create the record.
550
551 // Find parent page on which the new record reside
552 if ($theUid<0) { // Less than zero - find parent page
553 $calcPRec=t3lib_BEfunc::getRecord($table,abs($theUid));
554 $calcPRec=t3lib_BEfunc::getRecord('pages',$calcPRec['pid']);
555 } else { // always a page
556 $calcPRec=t3lib_BEfunc::getRecord('pages',abs($theUid));
557 }
558
559 // Now, calculate whether the user has access to creating new records on this position:
560 if (is_array($calcPRec)) {
561 $CALC_PERMS = $BE_USER->calcPerms($calcPRec); // Permissions for the parent page
562 if ($table=='pages') { // If pages:
563 $hasAccess = $CALC_PERMS&8 ? 1 : 0;
564 $this->viewId = $calcPRec['pid'];
565 } else {
566 $hasAccess = $CALC_PERMS&16 ? 1 : 0;
567 $this->viewId = $calcPRec['uid'];
568 }
569 }
570 }
571 $this->dontStoreDocumentRef=1; // Don't save this document title in the document selector if the document is new.
572 } else { // Edit:
573 $calcPRec=t3lib_BEfunc::getRecord($table,$theUid);
574 if (is_array($calcPRec)) {
575 if ($table=='pages') { // If pages:
576 $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
577 $hasAccess = $CALC_PERMS&2 ? 1 : 0;
578 $deleteAccess = $CALC_PERMS&4 ? 1 : 0;
579 $this->viewId = $calcPRec['uid'];
580 } else {
581 $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid'])); // Fetching pid-record first.
582 $hasAccess = $CALC_PERMS&16 ? 1 : 0;
583 $deleteAccess = $CALC_PERMS&16 ? 1 : 0;
584 $this->viewId = $calcPRec['pid'];
585 }
586 } else $hasAccess=0;
587 }
588
589 // AT THIS POINT we have checked the access status of the editing/creation of records and we can now proceed with creating the form elements:
590
591 if ($hasAccess) {
592 $prevPageID = is_object($trData)?$trData->prevPageID:'';
593 $trData = t3lib_div::makeInstance('t3lib_transferData');
594 $trData->defVals = $this->defVals;
595 $trData->lockRecords=1;
596 $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
597 $trData->prevPageID = $prevPageID;
598 $trData->fetchRecord($table,$theUid,$cmd=='new'?'new':''); // 'new'
599 reset($trData->regTableItems_data);
600 $rec = current($trData->regTableItems_data);
601 $rec['uid'] = $cmd=='new'?uniqid('NEW'):$theUid;
602 $this->elementsData[]=array(
603 'table' => $table,
604 'uid' => $rec['uid'],
605 'cmd' => $cmd,
606 'deleteAccess' => $deleteAccess
607 );
608 if ($cmd=='new') {
609 $rec['pid'] = $theUid=='prev'?$thePrevUid:$theUid;
610 }
611
612 // Now, render the form:
613 if (is_array($rec)) {
614
615 // Setting visual path / title of form:
616 $this->generalPathOfForm = $this->tceforms->getRecordPath($table,$rec);
617 if (!$this->storeTitle) {
618 $this->storeTitle = $this->recTitle ? htmlspecialchars($this->recTitle) : t3lib_BEfunc::getRecordTitle($table,$rec,1);
619 }
620
621 // Setting variables in TCEforms object:
622 $this->tceforms->hiddenFieldList = '';
623 $this->tceforms->globalShowHelp = $this->disHelp ? 0 : 1;
624 if (is_array($this->overrideVals[$table])) {
625 $this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]);
626 }
627
628 // Create form for the record (either specific list of fields or the whole record):
629 $panel = '';
630 if ($this->columnsOnly) {
631 $panel.= $this->tceforms->getListedFields($table,$rec,$this->columnsOnly);
632 } else {
633 $panel.= $this->tceforms->getMainFields($table,$rec);
634 }
635 $panel = $this->tceforms->wrapTotal($panel,$rec,$table);
636
637 // Setting the pid value for new records:
638 if ($cmd=='new') {
639 $panel.= '<input type="hidden" name="data['.$table.']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
640 $this->newC++;
641 }
642
643 // Display "is-locked" message:
644 if ($lockInfo = t3lib_BEfunc::isRecordLocked($table,$rec['uid'])) {
645 $lockIcon = '
646
647 <!--
648 Warning box:
649 -->
650 <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
651 <tr>
652 <td><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
653 <td>'.htmlspecialchars($lockInfo['msg']).'</td>
654 </tr>
655 </table>
656 ';
657 } else $lockIcon = '';
658
659 // Combine it all:
660 $editForm.= $lockIcon.$panel;
661 }
662
663 $thePrevUid = $rec['uid'];
664 } else {
665 $this->errorC++;
666 $editForm.=$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.noEditPermission',1).'<br /><br />';
667 }
668 }
669 }
670 }
671 }
672 }
673 return $editForm;
674 }
675
676 /**
677 * Create the panel of buttons for submitting the form or otherwise perform operations.
678 *
679 * @return string HTML code, comprised of images linked to various actions.
680 */
681 function makeButtonPanel() {
682 global $TCA,$LANG;
683
684 $panel='';
685
686 // Render SAVE type buttons:
687 // The action of each button is decided by its name attribute. (See doProcessData())
688 if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly']) {
689
690 // SAVE button:
691 $panel.= '<input type="image" class="c-inputButton" name="_savedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" />';
692
693 // SAVE / VIEW button:
694 if ($this->viewId && !$this->noView && t3lib_extMgm::isLoaded('cms')) {
695 $panel.= '<input type="image" class="c-inputButton" name="_savedokview"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedokshow.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow',1).'" />';
696 }
697
698 // SAVE / NEW button:
699 if (count($this->elementsData)==1 && $this->getNewIconMode($this->firstEl['table'])) {
700 $panel.= '<input type="image" class="c-inputButton" name="_savedoknew"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedoknew.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveNewDoc',1).'" />';
701 }
702
703 // SAVE / CLOSE
704 $panel.= '<input type="image" class="c-inputButton" name="_saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
705 }
706
707 // CLOSE button:
708 $panel.= '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;">'.
709 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/closedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'" alt="" />'.
710 '</a>';
711
712 // DELETE + UNDO buttons:
713 if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData)==1) {
714 if ($this->firstEl['cmd']!='new' && t3lib_div::testInt($this->firstEl['uid'])) {
715
716 // Delete:
717 if ($this->firstEl['deleteAccess'] && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'],'disableDelete')) {
718 $aOnClick = 'return deleteRecord(\''.$this->firstEl['table'].'\',\''.$this->firstEl['uid'].'\',unescape(\''.rawurlencode($this->retUrl).'\'));';
719 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
720 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/deletedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->getLL('deleteItem',1).'" alt="" />'.
721 '</a>';
722 }
723
724 // Undo:
725 $undoButton = 0;
726 $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename="'.$GLOBALS['TYPO3_DB']->quoteStr($this->firstEl['table'], 'sys_history').'" AND recuid="'.intval($this->firstEl['uid']).'"', '', 'tstamp DESC', '1');
727 if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
728 $undoButton = 1;
729 }
730 if ($undoButton) {
731 $aOnClick = 'document.location=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&revert=ALL_FIELDS&sumUp=-1&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
732 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
733 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/undo.gif','width="21" height="16"').' class="c-inputButton" title="'.htmlspecialchars(sprintf($LANG->getLL('undoLastChange'),t3lib_BEfunc::calcAge(time()-$undoButtonR['tstamp'],$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))).'" alt="" />'.
734 '</a>';
735 }
736 if ($this->getNewIconMode($this->firstEl['table'],'showHistory')) {
737 $aOnClick = 'document.location=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
738 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
739 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/history2.gif','width="13" height="12"').' class="c-inputButton" alt="" />'.
740 '</a>';
741 }
742
743 // If only SOME fields are shown in the form, this will link the user to the FULL form:
744 if ($this->columnsOnly) {
745 $panel.= '<a href="'.htmlspecialchars($this->R_URI.'&columnsOnly=').'">'.
746 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="11" height="12"').' class="c-inputButton" title="'.$LANG->getLL('editWholeRecord',1).'" alt="" />'.
747 '</a>';
748 }
749 }
750 }
751 return $panel;
752 }
753
754 /**
755 * Create the selector box form element which allows to select between open documents.
756 * Can be disabled through Page TSconfig.
757 *
758 * @return string HTML <select> element (if applicable)
759 */
760 function makeDocSel() {
761 global $BE_USER,$LANG;
762
763 // Render the selector ONLY if it has not been disabled:
764 if (!$this->modTSconfig['properties']['disableDocSelector']) {
765
766 // Checking if the currently open document is stored in the list of "open documents" - if not, then add it:
767 if ((strcmp($this->docDat[1],$this->storeUrlMd5)||!isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
768 $this->docHandler[$this->storeUrlMd5]=array($this->storeTitle,$this->storeArray,$this->storeUrl);
769 $BE_USER->pushModuleData('alt_doc.php',array($this->docHandler,$this->storeUrlMd5));
770 }
771
772 // Now, create the document selector box:
773 $docSel='';
774 if (is_array($this->docHandler)) {
775 $opt = array();
776 $opt[] = '<option>[ '.$LANG->getLL('openDocs',1).': ]</option>';
777
778 // Traverse the list of open documents:
779 foreach($this->docHandler as $md5k => $setupArr) {
780 $theValue = 'alt_doc.php?'.$setupArr[2].'&returnUrl='.rawurlencode($this->retUrl);
781 $opt[]='<option value="'.htmlspecialchars($theValue).'"'.(!strcmp($md5k,$this->storeUrlMd5)?' selected="selected"':'').'>'.htmlspecialchars(strip_tags(t3lib_div::htmlspecialchars_decode($setupArr[0]))).'</option>';
782 }
783
784 // Compile the selector box finally:
785 $onChange = 'if(this.options[this.selectedIndex].value && !TBE_EDITOR_isFormChanged()){document.location=(this.options[this.selectedIndex].value);}';
786 $docSel='<select name="_docSelector" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>';
787 }
788 } else $docSel='';
789 return $docSel;
790 }
791
792 /**
793 * Create the selector box form element which allows to select a clear-cache operation.
794 * Can be disabled through Page TSconfig.
795 *
796 * @return string HTML <select> element (if applicable)
797 * @see template::clearCacheMenu()
798 */
799 function makeCmenu() {
800
801 // Generate the menu if NOT disabled:
802 if (!$this->modTSconfig['properties']['disableCacheSelector']) {
803 $cMenu = $this->doc->clearCacheMenu(intval($this->viewId),!$this->modTSconfig['properties']['disableDocSelector']);
804 } else $cMenu ='';
805 return $cMenu;
806 }
807
808 /**
809 * Put together the various elements (buttons, selectors, form) into a table
810 *
811 * @param string The button panel HTML
812 * @param string Document selector HTML
813 * @param string Clear-cache menu HTML
814 * @param string HTML form.
815 * @return string Composite HTML
816 */
817 function compileForm($panel,$docSel,$cMenu,$editForm) {
818 global $LANG;
819
820
821 $formContent='';
822 $formContent.='
823
824 <!--
825 Header of the editing page.
826 Contains the buttons for saving/closing, the document selector and menu selector.
827 Shows the path of the editing operation as well.
828 -->
829 <table border="0" cellpadding="0" cellspacing="1" width="470" id="typo3-altdoc-header">
830 <tr>
831 <td nowrap="nowrap" valign="top">'.$panel.'</td>
832 <td nowrap="nowrap" valign="top" align="right">'.$docSel.$cMenu.'</td>
833 </tr>
834 <tr>
835 <td colspan="2">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path',1).': '.htmlspecialchars($this->generalPathOfForm).'</td>
836 </tr>
837 </table>
838 <img src="clear.gif" width="1" height="4" alt="" /><br />
839
840
841
842
843 <!--
844 EDITING FORM:
845 -->
846
847 '.$editForm.'
848
849
850
851 <!--
852 Saving buttons (same as in top)
853 -->
854
855 '.$panel.
856 '<input type="hidden" name="returnUrl" value="'.htmlspecialchars($this->retUrl).'" />
857 <input type="hidden" name="viewUrl" value="'.htmlspecialchars($this->viewUrl).'" />';
858
859 if ($this->returnNewPageId) {
860 $formContent.='<input type="hidden" name="returnNewPageId" value="1" />';
861 }
862 $formContent.='<input type="hidden" name="popViewId" value="'.htmlspecialchars($this->viewId).'" />';
863 $formContent.='<input type="hidden" name="closeDoc" value="0" />';
864 $formContent.='<input type="hidden" name="doSave" value="0" />';
865 $formContent.='<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
866 $formContent.='<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
867
868 return $formContent;
869 }
870
871 /**
872 * Create the checkbox buttons in the bottom of the pages.
873 *
874 * @return string HTML for function menus.
875 */
876 function functionMenus() {
877 global $BE_USER,$LANG;
878
879 $funcMenus = '';
880
881 // Show palettes:
882 $funcMenus.= '<br /><br />'.t3lib_BEfunc::getFuncCheck('','SET[showPalettes]',$this->MOD_SETTINGS['showPalettes'],'alt_doc.php',t3lib_div::implodeArrayForUrl('',array_merge($this->R_URL_getvars,array('SET'=>'')))).$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes',1);
883
884 // Show descriptions/help texts:
885 if ($BE_USER->uc['edit_showFieldHelp']!='text') {
886 $funcMenus.= '<br />'.t3lib_BEfunc::getFuncCheck('','SET[showDescriptions]',$this->MOD_SETTINGS['showDescriptions'],'alt_doc.php',t3lib_div::implodeArrayForUrl('',array_merge($this->R_URL_getvars,array('SET'=>'')))).$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions',1);
887 }
888
889 // Show disable RTE checkbox:
890 if ($BE_USER->isRTE()) {
891 $funcMenus.= '<br />'.t3lib_BEfunc::getFuncCheck('','SET[disableRTE]',$this->MOD_SETTINGS['disableRTE'],'alt_doc.php',t3lib_div::implodeArrayForUrl('',array_merge($this->R_URL_getvars,array('SET'=>'')))).$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE',1);
892 }
893
894 return '
895
896 <!--
897 Function menus (checkboxes for selecting options):
898 -->
899 '.$funcMenus;
900 }
901
902 /**
903 * Create shortcut and open-in-window link in the bottom of the page
904 *
905 * @return string
906 */
907 function shortCutLink() {
908 global $BE_USER,$LANG;
909
910 // ShortCut
911 if ($this->returnUrl!='close.html') {
912 $content.='<br /><br />';
913
914 // Shortcut:
915 if ($BE_USER->mayMakeShortcut()) {
916 $content.=$this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,popViewId,returnNewPageId,editRegularContentFromId,disHelp,noView',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'],1);
917 }
918
919 // Open in new window:
920 $aOnClick = 'vHWin=window.open(\''.t3lib_div::linkThisScript(array('returnUrl'=>'close.html')).'\',\''.md5($this->R_URI).'\',\''.($BE_USER->uc['edit_wideDocument']?'width=670,height=500':'width=600,height=400').',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
921 $content.='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
922 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/open_in_new_window.gif','width="19" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.openInNewWindow',1).'" alt="" />'.
923 '</a>';
924 }
925 return '
926
927 <!--
928 Shortcut link:
929 -->
930 '.$content;
931 }
932
933 /**
934 * Reads comment messages from TCEforms and prints them in a HTML comment in the buttom of the page.
935 *
936 * @return void
937 */
938 function tceformMessages() {
939 if (count($this->tceforms->commentMessages)) {
940 $this->content.='
941
942 <!-- TCEFORM messages
943 '.htmlspecialchars(implode(chr(10),$this->tceforms->commentMessages)).'
944 -->
945
946 ';
947 }
948 }
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965 /***************************
966 *
967 * Other functions
968 *
969 ***************************/
970
971 /**
972 * Function, which populates the internal editconf array with editing commands for all tt_content elements from the normal column in normal language from the page pointed to by $this->editRegularContentFromId
973 *
974 * @return void
975 */
976 function editRegularContentFromId() {
977 if (t3lib_extMgm::isLoaded('cms')) {
978 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
979 'uid',
980 'tt_content',
981 'pid='.intval($this->editRegularContentFromId).
982 t3lib_BEfunc::deleteClause('tt_content').
983 ' AND colPos=0 AND sys_language_uid=0',
984 '',
985 'sorting'
986 );
987 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
988 $ecUids=array();
989 while($ecRec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
990 $ecUids[]=$ecRec['uid'];
991 }
992 $this->editconf['tt_content'][implode(',',$ecUids)]='edit';
993 }
994 }
995 }
996
997 /**
998 * Populates the variables $this->storeArray, $this->storeUrl, $this->storeUrlMd5
999 *
1000 * @return void
1001 * @see makeDocSel()
1002 */
1003 function compileStoreDat() {
1004 $this->storeArray = t3lib_div::compileSelectedGetVarsFromArray('edit,defVals,overrideVals,columnsOnly,disHelp,noView,editRegularContentFromId',$this->R_URL_getvars);
1005 $this->storeUrl = t3lib_div::implodeArrayForUrl('',$this->storeArray);
1006 $this->storeUrlMd5 = md5($this->storeUrl);
1007 }
1008
1009 /**
1010 * Function used to look for configuration of buttons in the form: Fx. disabling buttons or showing them at various positions.
1011 *
1012 * @param string The table for which the configuration may be specific
1013 * @param string The option for look for. Default is checking if the saveDocNew button should be displayed.
1014 * @return string Return value fetched from USER TSconfig
1015 */
1016 function getNewIconMode($table,$key='saveDocNew') {
1017 global $BE_USER;
1018 $TSconfig = $BE_USER->getTSConfig('options.'.$key);
1019 $output = trim(isset($TSconfig['properties'][$table]) ? $TSconfig['properties'][$table] : $TSconfig['value']);
1020 return $output;
1021 }
1022
1023 /**
1024 * Handling the closing of a document
1025 *
1026 * @param integer Close code: 0/1 will redirect to $this->retUrl, 3 will clear the docHandler (thus closing all documents) and otehr values will call setDocument with ->retUrl
1027 * @return void
1028 */
1029 function closeDocument($code=0) {
1030 global $BE_USER;
1031
1032 // If current document is found in docHandler, then unset it, possibly unset it ALL and finally, write it to the session data:
1033 if (isset($this->docHandler[$this->storeUrlMd5])) {
1034 unset($this->docHandler[$this->storeUrlMd5]);
1035 if ($code=='3') $this->docHandler=array();
1036 $BE_USER->pushModuleData('alt_doc.php',array($this->docHandler,$this->docDat[1]));
1037 }
1038
1039 // If ->returnEditConf is set, then add the current content of editconf to the ->retUrl variable: (used by other scripts, like wizard_add, to know which records was created or so...)
1040 if ($this->returnEditConf && $this->retUrl!='dummy.php') {
1041 $this->retUrl.='&returnEditConf='.rawurlencode(serialize($this->editconf));
1042 }
1043
1044 // If code is NOT set OR set to 1, then make a header location redirect to $this->retUrl
1045 if (!$code || $code==1) {
1046 Header('Location: '.t3lib_div::locationHeaderUrl($this->retUrl));
1047 exit;
1048 } else {
1049 $this->setDocument('',$this->retUrl);
1050 }
1051 }
1052
1053 /**
1054 * Redirects to the document pointed to by $currentDocFromHandlerMD5 OR $retUrl (depending on some internal calculations).
1055 * Most likely you will get a header-location redirect from this function.
1056 *
1057 * @param string Pointer to the document in the docHandler array
1058 * @param string Alternative/Default retUrl
1059 * @return void
1060 */
1061 function setDocument($currentDocFromHandlerMD5='',$retUrl='alt_doc_nodoc.php') {
1062 if (!t3lib_extMgm::isLoaded('cms') && !strcmp($retUrl,'alt_doc_nodoc.php')) return;
1063
1064 if (!$this->modTSconfig['properties']['disableDocSelector'] && is_array($this->docHandler) && count($this->docHandler)) {
1065 if (isset($this->docHandler[$currentDocFromHandlerMD5])) {
1066 $setupArr=$this->docHandler[$currentDocFromHandlerMD5];
1067 } else {
1068 reset($this->docHandler);
1069 $setupArr=current($this->docHandler);
1070 }
1071 if ($setupArr[2]) {
1072 $sParts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
1073 $retUrl = $sParts['path'].'?'.$setupArr[2].'&returnUrl='.rawurlencode($retUrl);
1074 }
1075 }
1076 Header('Location: '.t3lib_div::locationHeaderUrl($retUrl));
1077 exit;
1078 }
1079 }
1080
1081 // Include extension?
1082 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc.php']) {
1083 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc.php']);
1084 }
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101 // Make instance:
1102 $SOBE = t3lib_div::makeInstance('SC_alt_doc');
1103
1104 // Preprocessing, storing data if submitted to
1105 $SOBE->preInit();
1106 if ($SOBE->doProcessData()) { // Checks, if a save button has been clicked (or the doSave variable is sent)
1107 require_once (PATH_t3lib.'class.t3lib_tcemain.php');
1108 $SOBE->processData();
1109 }
1110
1111 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
1112 require_once (PATH_t3lib.'class.t3lib_transferdata.php');
1113
1114
1115 // Main:
1116 $SOBE->init();
1117 $SOBE->main();
1118 $SOBE->printContent();
1119 ?>