00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00081 require('init.php');
00082 require('template.php');
00083 $LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml');
00084 require_once (PATH_t3lib.'class.t3lib_tceforms.php');
00085 require_once (PATH_t3lib.'class.t3lib_clipboard.php');
00086
00087 require_once (PATH_t3lib.'class.t3lib_tcemain.php');
00088 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
00089 require_once (PATH_t3lib.'class.t3lib_transferdata.php');
00090
00091
00092 t3lib_BEfunc::lockRecords();
00093
00094
00095
00096
00105 class SC_alt_doc {
00106
00107
00108 var $editconf;
00109 var $columnsOnly;
00110 var $defVals;
00111 var $overrideVals;
00112 var $returnUrl;
00113 var $closeDoc;
00114 var $doSave;
00115
00116 var $data;
00117 var $mirror;
00118 var $cacheCmd;
00119 var $redirect;
00120 var $disableRTE;
00121 var $returnNewPageId;
00122 var $vC;
00123 var $uc;
00124
00125 var $popViewId;
00126 var $popViewId_addParams;
00127 var $viewUrl;
00128 var $editRegularContentFromId;
00129 var $recTitle;
00130 var $disHelp;
00131 var $noView;
00132 var $returnEditConf;
00133 var $localizationMode;
00134
00135
00136
00137 var $doc;
00138 var $content;
00139
00140 var $retUrl;
00141 var $R_URL_parts;
00142 var $R_URL_getvars;
00143 var $R_URI;
00144
00145 var $storeTitle;
00146 var $storeArray;
00147 var $storeUrl;
00148 var $storeUrlMd5;
00149
00150 var $docDat;
00151 var $docHandler;
00152
00153
00154
00155 var $elementsData;
00156 var $firstEl;
00157 var $errorC;
00158 var $newC;
00159 var $viewId;
00160 var $viewId_addParams;
00161 var $modTSconfig;
00162 var $tceforms;
00163 var $generalPathOfForm;
00164
00165
00166
00167 var $dontStoreDocumentRef;
00168
00169
00170
00171
00172
00173
00174
00180 function preInit() {
00181 global $BE_USER;
00182
00183 if (t3lib_div::_GP('justLocalized')) {
00184 $this->localizationRedirect(t3lib_div::_GP('justLocalized'));
00185 }
00186
00187
00188 $this->editconf = t3lib_div::_GP('edit');
00189 $this->defVals = t3lib_div::_GP('defVals');
00190 $this->overrideVals = t3lib_div::_GP('overrideVals');
00191 $this->columnsOnly = t3lib_div::_GP('columnsOnly');
00192 $this->returnUrl = t3lib_div::_GP('returnUrl');
00193 $this->closeDoc = t3lib_div::_GP('closeDoc');
00194 $this->doSave = t3lib_div::_GP('doSave');
00195 $this->returnEditConf = t3lib_div::_GP('returnEditConf');
00196 $this->localizationMode = t3lib_div::_GP('localizationMode');
00197 $this->uc = t3lib_div::_GP('uc');
00198
00199
00200
00201 if (!is_array($this->defVals) && is_array($this->overrideVals)) {
00202 $this->defVals = $this->overrideVals;
00203 }
00204
00205
00206 $this->retUrl = $this->returnUrl ? $this->returnUrl : 'dummy.php';
00207
00208
00209 $this->fixWSversioningInEditConf();
00210
00211
00212 $this->R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
00213 $this->R_URL_getvars = t3lib_div::_GET();
00214 $this->R_URL_getvars['edit'] = $this->editconf;
00215
00216
00217 $this->compileStoreDat();
00218
00219
00220 $this->dontStoreDocumentRef=0;
00221 $this->storeTitle='';
00222
00223
00224 $this->docDat = $BE_USER->getModuleData('alt_doc.php','ses');
00225 $this->docHandler = $this->docDat[0];
00226
00227
00228 if ($this->closeDoc>0) {
00229 $this->closeDocument($this->closeDoc);
00230 }
00231
00232
00233 if (is_array($this->R_URL_getvars) && count($this->R_URL_getvars)<2 && !is_array($this->editconf)) {
00234 $this->setDocument($this->docDat[1]);
00235 }
00236 }
00237
00243 function doProcessData() {
00244 $out = $this->doSave || isset($_POST['_savedok_x']) || isset($_POST['_saveandclosedok_x']) || isset($_POST['_savedokview_x']) || isset($_POST['_savedoknew_x']);
00245 return $out;
00246 }
00247
00253 function processData() {
00254 global $BE_USER,$TYPO3_CONF_VARS;
00255
00256
00257 $this->data = t3lib_div::_GP('data');
00258 $this->cmd = t3lib_div::_GP('cmd');
00259 $this->mirror = t3lib_div::_GP('mirror');
00260 $this->cacheCmd = t3lib_div::_GP('cacheCmd');
00261 $this->redirect = t3lib_div::_GP('redirect');
00262 $this->disableRTE = t3lib_div::_GP('_disableRTE');
00263 $this->returnNewPageId = t3lib_div::_GP('returnNewPageId');
00264 $this->vC = t3lib_div::_GP('vC');
00265
00266
00267
00268 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00269 $tce->stripslashes_values=0;
00270
00271
00272 $TCAdefaultOverride = $BE_USER->getTSConfigProp('TCAdefaults');
00273 if (is_array($TCAdefaultOverride)) {
00274 $tce->setDefaultsFromUserTS($TCAdefaultOverride);
00275 }
00276
00277
00278 if ($BE_USER->uc['neverHideAtCopy']) { $tce->neverHideAtCopy = 1; }
00279 $tce->debug=0;
00280 $tce->disableRTE = $this->disableRTE;
00281
00282
00283 $tce->start($this->data,$this->cmd);
00284 if (is_array($this->mirror)) { $tce->setMirror($this->mirror); }
00285
00286
00287 if (isset($this->data['pages'])) {
00288 t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
00289 }
00290
00291
00292
00293 $refInfo=parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
00294 $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
00295 if ($httpHost!=$refInfo['host'] && $this->vC!=$BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
00296 $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));
00297 debug('Error: Referer host did not match with server host.');
00298 } else {
00299
00300
00301 $tce->process_uploads($_FILES);
00302 $tce->process_datamap();
00303 $tce->process_cmdmap();
00304
00305
00306 if (count($tce->substNEWwithIDs_table)) {
00307
00308 t3lib_TCEforms_inline::updateInlineView($this->uc, $tce);
00309
00310 $newEditConf = array();
00311
00312 foreach($this->editconf as $tableName => $tableCmds) {
00313 $keys = array_keys($tce->substNEWwithIDs_table, $tableName);
00314 if(count($keys) > 0) {
00315 foreach($keys as $key) {
00316 $editId = $tce->substNEWwithIDs[$key];
00317
00318 if (!(is_array($tce->newRelatedIDs[$tableName]) && in_array($editId, $tce->newRelatedIDs[$tableName]))) {
00319
00320 if ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $tableName, $editId,'uid')) {
00321 $editId = $versionRec['uid'];
00322 }
00323 $newEditConf[$tableName][$editId] = 'edit';
00324 }
00325
00326
00327 if ($tableName=='pages' && $this->retUrl!='dummy.php' && $this->returnNewPageId) {
00328 $this->retUrl.='&id='.$tce->substNEWwithIDs[$key];
00329 }
00330 }
00331 } else {
00332 $newEditConf[$tableName] = $tableCmds;
00333 }
00334 }
00335
00336
00337 if (count($newEditConf)) {
00338 $this->editconf = $newEditConf;
00339 }
00340
00341
00342 $this->R_URL_getvars['edit']=$this->editconf;
00343
00344
00345 unset($this->R_URL_getvars['defVals']);
00346
00347
00348 $this->compileStoreDat();
00349 }
00350
00351
00352 if (count($tce->autoVersionIdMap)) {
00353 $this->fixWSversioningInEditConf($tce->autoVersionIdMap);
00354 }
00355
00356
00357 if (isset($_POST['_savedoknew_x']) && is_array($this->editconf)) {
00358
00359
00360 reset($this->editconf);
00361 $nTable=key($this->editconf);
00362
00363
00364 reset($this->editconf[$nTable]);
00365 $nUid=key($this->editconf[$nTable]);
00366 $nRec = t3lib_BEfunc::getRecord($nTable,$nUid,'pid,uid');
00367
00368
00369 $this->editconf=array();
00370 if ($this->getNewIconMode($nTable)=='top') {
00371 $this->editconf[$nTable][$nRec['pid']]='new';
00372 } else {
00373 $this->editconf[$nTable][-$nRec['uid']]='new';
00374 }
00375
00376
00377 $this->R_URL_getvars['edit']=$this->editconf;
00378
00379
00380 $this->compileStoreDat();
00381 }
00382
00383 $tce->printLogErrorMessages(
00384 isset($_POST['_saveandclosedok_x']) ?
00385 $this->retUrl :
00386 $this->R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$this->R_URL_getvars)
00387 );
00388 }
00389 if (isset($_POST['_saveandclosedok_x']) || $this->closeDoc<0) {
00390 $this->closeDocument(abs($this->closeDoc));
00391 }
00392 }
00393
00399 function init() {
00400 global $BE_USER,$LANG,$BACK_PATH;
00401
00402
00403 $this->popViewId = t3lib_div::_GP('popViewId');
00404 $this->popViewId_addParams = t3lib_div::_GP('popViewId_addParams');
00405 $this->viewUrl = t3lib_div::_GP('viewUrl');
00406 $this->editRegularContentFromId = t3lib_div::_GP('editRegularContentFromId');
00407 $this->recTitle = t3lib_div::_GP('recTitle');
00408 $this->disHelp = t3lib_div::_GP('disHelp');
00409 $this->noView = t3lib_div::_GP('noView');
00410
00411
00412 $this->R_URL_getvars['returnUrl']=$this->retUrl;
00413 $this->R_URI = $this->R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$this->R_URL_getvars);
00414
00415
00416
00417
00418
00419 $this->MOD_MENU = array(
00420 'showPalettes' => '',
00421 'showDescriptions' => '',
00422 'disableRTE' => ''
00423 );
00424
00425
00426 $this->MCONF['name']='xMOD_alt_doc.php';
00427
00428
00429 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00430
00431
00432 $this->doc = t3lib_div::makeInstance('mediumDoc');
00433 $this->doc->bodyTagMargins['x']=5;
00434 $this->doc->bodyTagMargins['y']=5;
00435 $this->doc->backPath = $BACK_PATH;
00436 $this->doc->docType = 'xhtml_trans';
00437
00438 $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);">';
00439
00440 $this->doc->JScode = $this->doc->wrapScriptTags('
00441 function jumpToUrl(URL,formEl) {
00442 if (!TBE_EDITOR.isFormChanged()) {
00443 window.location.href = URL;
00444 } else if (formEl && formEl.type=="checkbox") {
00445 formEl.checked = formEl.checked ? 0 : 1;
00446 }
00447 }
00448
00449
00450 function typoSetup () {
00451 this.uniqueID = "";
00452 }
00453 var TS = new typoSetup();
00454
00455
00456 function launchView(table,uid,bP) {
00457 var backPath= bP ? bP : "";
00458 var thePreviewWindow="";
00459 thePreviewWindow = window.open(backPath+"show_item.php?table="+encodeURIComponent(table)+"&uid="+encodeURIComponent(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
00460 if (thePreviewWindow && thePreviewWindow.focus) {
00461 thePreviewWindow.focus();
00462 }
00463 }
00464 function deleteRecord(table,id,url) {
00465 if (
00466 '.($GLOBALS['BE_USER']->jsConfirmation(4)?'confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')':'1==1').'
00467 ) {
00468 window.location.href = "tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";
00469 }
00470 return false;
00471 }
00472 '.(isset($_POST['_savedokview_x']) && $this->popViewId ?
00473 'if (window.opener) { '.
00474 t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl,$this->popViewId_addParams,FALSE).
00475 ' } else { '.
00476 t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl,$this->popViewId_addParams).
00477 ' } '
00478 : '')
00479 ).$this->doc->getDynTabMenuJScode();
00480
00481
00482 $CMparts = $this->doc->getContextMenuCode();
00483 $this->doc->JScode.= $CMparts[0];
00484 $this->doc->bodyTagAdditions = $CMparts[1];
00485 $this->doc->postCode.= $CMparts[2];
00486 }
00487
00493 function main() {
00494 global $BE_USER,$LANG;
00495
00496
00497 $this->content='';
00498 $this->content.=$this->doc->startPage('TYPO3 Edit Document');
00499
00500
00501 if (is_array($this->editconf)) {
00502
00503
00504 $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00505 $this->tceforms->initDefaultBEMode();
00506 $this->tceforms->doSaveFieldName = 'doSave';
00507 $this->tceforms->localizationMode = t3lib_div::inList('text,media',$this->localizationMode) ? $this->localizationMode : '';
00508 $this->tceforms->returnUrl = $this->R_URI;
00509 $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
00510 $this->tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00511 $this->tceforms->enableClickMenu = TRUE;
00512 $this->tceforms->enableTabMenu = TRUE;
00513
00514
00515 $this->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
00516 $this->tceforms->clipObj->initializeClipboard();
00517
00518
00519 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions']) $this->tceforms->edit_showFieldHelp='text';
00520
00521 if ($this->editRegularContentFromId) {
00522 $this->editRegularContentFromId();
00523 }
00524
00525
00526 $editForm = $this->makeEditForm();
00527
00528 if ($editForm) {
00529 reset($this->elementsData);
00530 $this->firstEl = current($this->elementsData);
00531
00532
00533
00534 if (count($this->elementsData)==1) {
00535 $languageSwitch = $this->languageSwitch($this->firstEl['table'], $this->firstEl['uid'], $this->firstEl['pid']);
00536 }
00537
00538
00539 if ($this->viewId) {
00540
00541 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->viewId,'mod.xMOD_alt_doc');
00542 } else $this->modTSconfig=array();
00543
00544 $panel = $this->makeButtonPanel();
00545 $docSel = $this->makeDocSel();
00546 $cMenu = $this->makeCmenu();
00547
00548 $formContent = $this->compileForm($panel,$docSel,$cMenu,$editForm,$languageSwitch);
00549
00550 $this->content.= $this->tceforms->printNeededJSFunctions_top().
00551 $formContent.
00552 $this->tceforms->printNeededJSFunctions();
00553 $this->content.= $this->functionMenus();
00554
00555
00556 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'],'<br/>|',FALSE,'margin-top: 20px;');
00557
00558 $this->content.= $this->shortCutLink();
00559
00560 $this->tceformMessages();
00561 }
00562 }
00563 }
00564
00565
00571 function printContent() {
00572 $this->content.= $this->doc->endPage();
00573 $this->content = $this->doc->insertStylesAndJS($this->content);
00574 echo $this->content;
00575 }
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00607 function makeEditForm() {
00608 global $BE_USER,$LANG,$TCA;
00609
00610
00611 $this->elementsData=array();
00612 $this->errorC=0;
00613 $this->newC=0;
00614 $thePrevUid='';
00615 $editForm='';
00616
00617
00618 foreach($this->editconf as $table => $conf) {
00619 if (is_array($conf) && $TCA[$table] && $BE_USER->check('tables_modify',$table)) {
00620
00621
00622 foreach($conf as $cKey => $cmd) {
00623 if ($cmd=='edit' || $cmd=='new') {
00624
00625
00626 $ids = t3lib_div::trimExplode(',',$cKey,1);
00627
00628
00629 foreach($ids as $theUid) {
00630
00631
00632
00633 $hasAccess = 1;
00634 $deniedAccessReason = '';
00635 $deleteAccess = 0;
00636 $this->viewId = 0;
00637
00638
00639 if ($cmd=='new') {
00640 if (intval($theUid)) {
00641
00642
00643 if ($theUid<0) {
00644 $calcPRec=t3lib_BEfunc::getRecord($table,abs($theUid));
00645 $calcPRec=t3lib_BEfunc::getRecord('pages',$calcPRec['pid']);
00646 } else {
00647 $calcPRec=t3lib_BEfunc::getRecord('pages',abs($theUid));
00648 }
00649
00650
00651 if (is_array($calcPRec)) {
00652 $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
00653 if ($table=='pages') {
00654 $hasAccess = $CALC_PERMS&8 ? 1 : 0;
00655 $this->viewId = $calcPRec['pid'];
00656 } else {
00657 $hasAccess = $CALC_PERMS&16 ? 1 : 0;
00658 $this->viewId = $calcPRec['uid'];
00659 }
00660 }
00661 }
00662 $this->dontStoreDocumentRef=1;
00663 } else {
00664 $calcPRec = t3lib_BEfunc::getRecord($table,$theUid);
00665 t3lib_BEfunc::fixVersioningPid($table,$calcPRec);
00666 if (is_array($calcPRec)) {
00667 if ($table=='pages') {
00668 $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
00669 $hasAccess = $CALC_PERMS&2 ? 1 : 0;
00670 $deleteAccess = $CALC_PERMS&4 ? 1 : 0;
00671 $this->viewId = $calcPRec['uid'];
00672 } else {
00673 $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid']));
00674 $hasAccess = $CALC_PERMS&16 ? 1 : 0;
00675 $deleteAccess = $CALC_PERMS&16 ? 1 : 0;
00676 $this->viewId = $calcPRec['pid'];
00677
00678
00679 if ($TCA[$table]['ctrl']['languageField'] && $calcPRec[$TCA[$table]['ctrl']['languageField']]>0) {
00680 $this->viewId_addParams = '&L='.$calcPRec[$TCA[$table]['ctrl']['languageField']];
00681 }
00682 }
00683
00684
00685 if ($hasAccess) {
00686 $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec);
00687 $deniedAccessReason = $BE_USER->errorMsg;
00688 }
00689 } else $hasAccess = 0;
00690 }
00691
00692
00693
00694 if ($hasAccess) {
00695 $prevPageID = is_object($trData)?$trData->prevPageID:'';
00696 $trData = t3lib_div::makeInstance('t3lib_transferData');
00697 $trData->addRawData = TRUE;
00698 $trData->defVals = $this->defVals;
00699 $trData->lockRecords=1;
00700 $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00701 $trData->prevPageID = $prevPageID;
00702 $trData->fetchRecord($table,$theUid,$cmd=='new'?'new':'');
00703 reset($trData->regTableItems_data);
00704 $rec = current($trData->regTableItems_data);
00705 $rec['uid'] = $cmd=='new' ? uniqid('NEW') : $theUid;
00706 if ($cmd=='new') {
00707 $rec['pid'] = $theUid=='prev'?$thePrevUid:$theUid;
00708 }
00709 $this->elementsData[]=array(
00710 'table' => $table,
00711 'uid' => $rec['uid'],
00712 'pid' => $rec['pid'],
00713 'cmd' => $cmd,
00714 'deleteAccess' => $deleteAccess
00715 );
00716
00717
00718 if (is_array($rec)) {
00719
00720
00721 $this->generalPathOfForm = $this->tceforms->getRecordPath($table,$rec);
00722 if (!$this->storeTitle) {
00723 $this->storeTitle = $this->recTitle ? htmlspecialchars($this->recTitle) : t3lib_BEfunc::getRecordTitle($table,$rec,TRUE);
00724 }
00725
00726
00727 $this->tceforms->hiddenFieldList = '';
00728 $this->tceforms->globalShowHelp = $this->disHelp ? 0 : 1;
00729 if (is_array($this->overrideVals[$table])) {
00730 $this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]);
00731 }
00732
00733
00734 $this->tceforms->registerDefaultLanguageData($table,$rec);
00735
00736
00737 $panel = '';
00738 if ($this->columnsOnly) {
00739 if(is_array($this->columnsOnly)){
00740 $panel.= $this->tceforms->getListedFields($table,$rec,$this->columnsOnly[$table]);
00741 } else {
00742 $panel.= $this->tceforms->getListedFields($table,$rec,$this->columnsOnly);
00743 }
00744 } else {
00745 $panel.= $this->tceforms->getMainFields($table,$rec);
00746 }
00747 $panel = $this->tceforms->wrapTotal($panel,$rec,$table);
00748
00749
00750 if ($cmd=='new') {
00751 $panel.= '<input type="hidden" name="data['.$table.']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
00752 $this->newC++;
00753 }
00754
00755
00756 if ($lockInfo = t3lib_BEfunc::isRecordLocked($table,$rec['uid'])) {
00757 $lockIcon = '
00758
00759 <!--
00760 Warning box:
00761 -->
00762 <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
00763 <tr>
00764 <td><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
00765 <td>'.htmlspecialchars($lockInfo['msg']).'</td>
00766 </tr>
00767 </table>
00768 ';
00769 } else $lockIcon = '';
00770
00771
00772 $editForm.= $lockIcon.$panel;
00773 }
00774
00775 $thePrevUid = $rec['uid'];
00776 } else {
00777 $this->errorC++;
00778 $editForm.=$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.noEditPermission',1).'<br /><br />'.
00779 ($deniedAccessReason ? 'Reason: '.htmlspecialchars($deniedAccessReason).'<br/><br/>' : '');
00780 }
00781 }
00782 }
00783 }
00784 }
00785 }
00786
00787 return $editForm;
00788 }
00789
00795 function makeButtonPanel() {
00796 global $TCA,$LANG;
00797
00798 $panel='';
00799
00800
00801
00802 if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly']) {
00803
00804
00805 $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).'" />';
00806
00807
00808 if ($this->viewId && !$this->noView && t3lib_extMgm::isLoaded('cms')) {
00809 $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).'" />';
00810 }
00811
00812
00813 if (count($this->elementsData)==1 && $this->getNewIconMode($this->firstEl['table'])) {
00814 $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).'" />';
00815 }
00816
00817
00818 $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).'" />';
00819 }
00820
00821
00822 $panel.= '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;">'.
00823 '<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="" />'.
00824 '</a>';
00825
00826
00827 if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData)==1) {
00828 if ($this->firstEl['cmd']!='new' && t3lib_div::testInt($this->firstEl['uid'])) {
00829
00830
00831 if ($this->firstEl['deleteAccess'] && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'],'disableDelete')) {
00832 $aOnClick = 'return deleteRecord(\''.$this->firstEl['table'].'\',\''.$this->firstEl['uid'].'\',unescape(\''.rawurlencode($this->retUrl).'\'));';
00833 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00834 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/deletedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->getLL('deleteItem',1).'" alt="" />'.
00835 '</a>';
00836 }
00837
00838
00839 $undoButton = 0;
00840 $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->firstEl['table'], 'sys_history').' AND recuid='.intval($this->firstEl['uid']), '', 'tstamp DESC', '1');
00841 if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
00842 $undoButton = 1;
00843 }
00844 if ($undoButton) {
00845 $aOnClick = 'window.location.href=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&revert=ALL_FIELDS&sumUp=-1&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
00846 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00847 '<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="" />'.
00848 '</a>';
00849 }
00850 if ($this->getNewIconMode($this->firstEl['table'],'showHistory')) {
00851 $aOnClick = 'window.location.href=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
00852 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00853 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/history2.gif','width="13" height="12"').' class="c-inputButton" alt="" />'.
00854 '</a>';
00855 }
00856
00857
00858 if ($this->columnsOnly) {
00859 $panel.= '<a href="'.htmlspecialchars($this->R_URI.'&columnsOnly=').'">'.
00860 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="11" height="12"').' class="c-inputButton" title="'.$LANG->getLL('editWholeRecord',1).'" alt="" />'.
00861 '</a>';
00862 }
00863 }
00864 }
00865 return $panel;
00866 }
00867
00874 function makeDocSel() {
00875 global $BE_USER,$LANG;
00876
00877
00878 if (!$this->modTSconfig['properties']['disableDocSelector']) {
00879
00880
00881 if ((strcmp($this->docDat[1],$this->storeUrlMd5)||!isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
00882 $this->docHandler[$this->storeUrlMd5]=array($this->storeTitle,$this->storeArray,$this->storeUrl);
00883 $BE_USER->pushModuleData('alt_doc.php',array($this->docHandler,$this->storeUrlMd5));
00884 }
00885
00886
00887 $docSel='';
00888 if (is_array($this->docHandler)) {
00889 $opt = array();
00890 $opt[] = '<option>[ '.$LANG->getLL('openDocs',1).': ]</option>';
00891
00892
00893 foreach($this->docHandler as $md5k => $setupArr) {
00894 $theValue = 'alt_doc.php?'.$setupArr[2].'&returnUrl='.rawurlencode($this->retUrl);
00895 $opt[]='<option value="'.htmlspecialchars($theValue).'"'.(!strcmp($md5k,$this->storeUrlMd5)?' selected="selected"':'').'>'.htmlspecialchars(strip_tags(t3lib_div::htmlspecialchars_decode($setupArr[0]))).'</option>';
00896 }
00897
00898
00899 $onChange = 'if(this.options[this.selectedIndex].value && !TBE_EDITOR.isFormChanged()){window.location.href=(this.options[this.selectedIndex].value);}';
00900 $docSel='<select name="_docSelector" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>';
00901
00902
00903 $docSel.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_docSelector', $GLOBALS['BACK_PATH'],'', TRUE);
00904 }
00905 } else $docSel='';
00906 return $docSel;
00907 }
00908
00916 function makeCmenu() {
00917
00918
00919 if (!$this->modTSconfig['properties']['disableCacheSelector']) {
00920 $cMenu = $this->doc->clearCacheMenu(intval($this->viewId),!$this->modTSconfig['properties']['disableDocSelector']);
00921
00922
00923 $cMenu.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_cacheSelector', $GLOBALS['BACK_PATH'],'', TRUE);
00924 } else $cMenu ='';
00925 return $cMenu;
00926 }
00927
00938 function compileForm($panel,$docSel,$cMenu,$editForm, $langSelector='') {
00939 global $LANG;
00940
00941
00942 $formContent='';
00943 $formContent.='
00944
00945 <!--
00946 Header of the editing page.
00947 Contains the buttons for saving/closing, the document selector and menu selector.
00948 Shows the path of the editing operation as well.
00949 -->
00950 <table border="0" cellpadding="0" cellspacing="1" width="470" id="typo3-altdoc-header">
00951 <tr>
00952 <td nowrap="nowrap" valign="top">'.$panel.'</td>
00953 <td nowrap="nowrap" valign="top" align="right">'.$docSel.$cMenu.'</td>
00954 </tr>';
00955
00956 if ($langSelector) {
00957 $langSelector ='<div id="typo3-altdoc-lang-selector">'.$langSelector.'</div>';
00958 }
00959
00960 if (is_array($this->tceforms->extraFormHeaders)) {
00961 $formContent .= implode(chr(10), $this->tceforms->extraFormHeaders);
00962 }
00963
00964 $pagePath = '<div id="typo3-altdoc-page-path">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path',1).': '.htmlspecialchars($this->generalPathOfForm).'</div>';
00965
00966 $formContent.='
00967 <tr>
00968 <td colspan="2"><div id="typo3-altdoc-header-info-options">'.$pagePath.$langSelector.'</div></td>
00969 </tr>
00970 </table>
00971
00972
00973
00974
00975 <!--
00976 EDITING FORM:
00977 -->
00978
00979 '.$editForm.'
00980
00981
00982
00983 <!--
00984 Saving buttons (same as in top)
00985 -->
00986
00987 '.$panel.
00988 '<input type="hidden" name="returnUrl" value="'.htmlspecialchars($this->retUrl).'" />
00989 <input type="hidden" name="viewUrl" value="'.htmlspecialchars($this->viewUrl).'" />';
00990
00991 if ($this->returnNewPageId) {
00992 $formContent.='<input type="hidden" name="returnNewPageId" value="1" />';
00993 }
00994 $formContent.='<input type="hidden" name="popViewId" value="'.htmlspecialchars($this->viewId).'" />';
00995 if ($this->viewId_addParams) {
00996 $formContent.='<input type="hidden" name="popViewId_addParams" value="'.htmlspecialchars($this->viewId_addParams).'" />';
00997 }
00998 $formContent.='<input type="hidden" name="closeDoc" value="0" />';
00999 $formContent.='<input type="hidden" name="doSave" value="0" />';
01000 $formContent.='<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
01001 $formContent.='<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
01002
01003 return $formContent;
01004 }
01005
01011 function functionMenus() {
01012 global $BE_USER,$LANG;
01013
01014 $funcMenus = '';
01015
01016
01017 $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'=>''))),'id="checkShowPalettes"').'<label for="checkShowPalettes">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes',1).'</label>';
01018
01019
01020 if ($BE_USER->uc['edit_showFieldHelp']!='text') {
01021 $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'=>''))),'id="checkShowDescriptions"').'<label for="checkShowDescriptions">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions',1).'</label>';
01022 }
01023
01024
01025 if ($BE_USER->isRTE()) {
01026 $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'=>''))),'id="checkDisableRTE"').'<label for="checkDisableRTE">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE',1).'</label>';
01027 }
01028
01029 return '
01030
01031 <!--
01032 Function menus (checkboxes for selecting options):
01033 -->
01034 '.$funcMenus;
01035 }
01036
01042 function shortCutLink() {
01043 global $BE_USER,$LANG;
01044
01045
01046 if ($this->returnUrl!='close.html') {
01047 $content.='<br /><br />';
01048
01049
01050 if ($BE_USER->mayMakeShortcut()) {
01051 $content.=$this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,disHelp,noView',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'],1);
01052 }
01053
01054
01055 $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;';
01056 $content.='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
01057 '<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="" />'.
01058 '</a>';
01059 }
01060 return '
01061
01062 <!--
01063 Shortcut link:
01064 -->
01065 '.$content;
01066 }
01067
01073 function tceformMessages() {
01074 if (count($this->tceforms->commentMessages)) {
01075 $this->content.='
01076
01077 <!-- TCEFORM messages
01078 '.htmlspecialchars(implode(chr(10),$this->tceforms->commentMessages)).'
01079 -->
01080
01081 ';
01082 }
01083 }
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01112 function languageSwitch($table, $uid, $pid=NULL) {
01113 global $TCA;
01114
01115 $content = '';
01116
01117 $languageField = $TCA[$table]['ctrl']['languageField'];
01118 $transOrigPointerField = $TCA[$table]['ctrl']['transOrigPointerField'];
01119
01120
01121 if ($GLOBALS['BE_USER']->check('tables_modify',$table) && $languageField && $transOrigPointerField && !$TCA[$table]['ctrl']['transOrigPointerTable']) {
01122
01123 if(is_null($pid)) {
01124 $row = t3lib_befunc::getRecord($table, $uid, 'pid');
01125 $pid = $row['pid'];
01126 }
01127
01128
01129 $langRows = $this->getLanguages($pid);
01130
01131
01132 if (is_array($langRows) && count($langRows)>1) {
01133
01134 $rowsByLang = array();
01135 $fetchFields = 'uid,'.$languageField.','.$transOrigPointerField;
01136
01137
01138 $rowCurrent = t3lib_befunc::getRecord($table, $uid, $fetchFields);
01139 $currentLanguage = $rowCurrent[$languageField];
01140
01141 if ($currentLanguage>-1) {
01142
01143 if ($currentLanguage) {
01144 $rowsByLang[0] = t3lib_befunc::getRecord($table, $rowCurrent[$transOrigPointerField], $fetchFields);
01145 } else {
01146 $rowsByLang[0] = $rowCurrent;
01147 }
01148
01149
01150 $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01151 $fetchFields,
01152 $table,
01153 'pid='.intval($pid).
01154 ' AND '.$languageField.'>0'.
01155 ' AND '.$transOrigPointerField.'='.intval($rowsByLang[0]['uid']).
01156 t3lib_BEfunc::deleteClause($table).
01157 t3lib_BEfunc::versioningPlaceholderClause($table)
01158 );
01159 foreach ($translations as $row) {
01160 $rowsByLang[$row[$languageField]] = $row;
01161 }
01162
01163 $langSelItems=array();
01164 foreach ($langRows as $lang) {
01165 if ($GLOBALS['BE_USER']->checkLanguageAccess($lang['uid'])) {
01166
01167 $newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' ['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.new',1).']';
01168
01169
01170 if($newTranslation) {
01171 $href = $this->doc->issueCommand(
01172 '&cmd['.$table.']['.$rowsByLang[0]['uid'].'][localize]='.$lang['uid'],
01173 $this->backPath.'alt_doc.php?justLocalized='.rawurlencode($table.':'.$rowsByLang[0]['uid'].':'.$lang['uid']).'&returnUrl='.rawurlencode($this->retUrl)
01174 );
01175
01176
01177 } else {
01178 $href = $this->backPath.'alt_doc.php?';
01179 $href .= '&edit['.$table.']['.$rowsByLang[$lang['uid']]['uid'].']=edit';
01180 $href .= '&returnUrl='.rawurlencode($this->retUrl);
01181 }
01182
01183 $langSelItems[$lang['uid']]='
01184 <option value="'.htmlspecialchars($href).'"'.($currentLanguage==$lang['uid']?' selected="selected"':'').'>'.htmlspecialchars($lang['title'].$newTranslation).'</option>';
01185 }
01186 }
01187
01188
01189 if (count($langSelItems)>1) {
01190 $onChange = 'if(this.options[this.selectedIndex].value){window.location.href=(this.options[this.selectedIndex].value);}';
01191 $content = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language',1).' <select name="_langSelector" onchange="'.htmlspecialchars($onChange).'">
01192 '.implode('',$langSelItems).'
01193 </select>';
01194 }
01195 }
01196 }
01197 }
01198 return $content;
01199 }
01200
01201
01208 function localizationRedirect($justLocalized) {
01209 global $TCA;
01210
01211 list($table,$orig_uid,$language) = explode(':',$justLocalized);
01212
01213 if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
01214 list($localizedRecord) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01215 'uid',
01216 $table,
01217 $TCA[$table]['ctrl']['languageField'].'='.intval($language).' AND '.
01218 $TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($orig_uid).
01219 t3lib_BEfunc::deleteClause($table).
01220 t3lib_BEfunc::versioningPlaceholderClause($table)
01221 );
01222
01223 if (is_array($localizedRecord)) {
01224
01225 $params = '&edit['.$table.']['.$localizedRecord['uid'].']=edit';
01226 $returnUrl = '&returnUrl='.rawurlencode(t3lib_div::_GP('returnUrl'));
01227 $location = $GLOBALS['BACK_PATH'].'alt_doc.php?'.$params.$returnUrl;
01228
01229 header('Location: '.t3lib_div::locationHeaderUrl($location));
01230 exit;
01231 }
01232 }
01233 }
01234
01235
01242 function getLanguages($id) {
01243 global $LANG;
01244
01245 $modSharedTSconfig = t3lib_BEfunc::getModTSconfig($id, 'mod.SHARED');
01246
01247 $languages = array(
01248 0 => array(
01249 'uid' => 0,
01250 'pid' => 0,
01251 'hidden' => 0,
01252 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'].' ('.$GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage').')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'),
01253 'flag' => $modSharedTSconfig['properties']['defaultLanguageFlag'],
01254 )
01255 );
01256
01257 $exQ = $GLOBALS['BE_USER']->isAdmin() ? '' : ' AND sys_language.hidden=0';
01258 if ($id) {
01259 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01260 'sys_language.*',
01261 'pages_language_overlay,sys_language',
01262 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid='.intval($id).$exQ,
01263 'pages_language_overlay.sys_language_uid,sys_language.uid,sys_language.pid,sys_language.tstamp,sys_language.hidden,sys_language.title,sys_language.static_lang_isocode,sys_language.flag',
01264 'sys_language.title'
01265 );
01266 } else {
01267 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01268 'sys_language.*',
01269 'sys_language',
01270 'sys_language.hidden=0',
01271 '',
01272 'sys_language.title'
01273 );
01274 }
01275 if ($rows) {
01276 foreach ($rows as $row) {
01277 $languages[$row['uid']] = $row;
01278 }
01279 }
01280 return $languages;
01281 }
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01304 function fixWSversioningInEditConf($mapArray=FALSE) {
01305 global $TCA,$BE_USER;
01306
01307
01308 if (is_array($this->editconf)) {
01309 foreach($this->editconf as $table => $conf) {
01310 if (is_array($conf) && $TCA[$table]) {
01311
01312
01313 $newConf = array();
01314 foreach($conf as $cKey => $cmd) {
01315 if ($cmd=='edit') {
01316
01317 $ids = t3lib_div::trimExplode(',', $cKey, 1);
01318 foreach($ids as $idKey => $theUid) {
01319 if (is_array($mapArray)) {
01320 if ($mapArray[$table][$theUid]) {
01321 $ids[$idKey] = $mapArray[$table][$theUid];
01322 }
01323 } else {
01324 $calcPRec = $this->getRecordForEdit($table,$theUid);
01325 if (is_array($calcPRec)) {
01326
01327 $ids[$idKey] = $calcPRec['uid'];
01328 }
01329 }
01330 #else unset($ids[$idKey]);
01331 }
01332
01333
01334 $newConf[implode(',',$ids)] = $cmd;
01335 } else {
01336 $newConf[$cKey] = $cmd;
01337 }
01338 }
01339
01340 $this->editconf[$table] = $newConf;
01341 }
01342 }
01343 }
01344 }
01345
01353 function getRecordForEdit($table,$theUid) {
01354 global $TCA;
01355
01356
01357 $reqRecord = t3lib_BEfunc::getRecord($table,$theUid,'uid,pid');
01358
01359 if (is_array($reqRecord)) {
01360
01361 if ($GLOBALS['BE_USER']->workspace!=0) {
01362
01363
01364 if ($TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) {
01365
01366
01367 if ($reqRecord['pid']==-1) {
01368
01369
01370 return $reqRecord;
01371 } else {
01372
01373
01374 $versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $reqRecord['uid'],'uid,pid,t3ver_oid');
01375 return is_array($versionRec) ? $versionRec : $reqRecord;
01376 }
01377 } else return FALSE;
01378 } else return $reqRecord;
01379 } else return FALSE;
01380 }
01381
01387 function editRegularContentFromId() {
01388 if (t3lib_extMgm::isLoaded('cms')) {
01389 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01390 'uid',
01391 'tt_content',
01392 'pid='.intval($this->editRegularContentFromId).
01393 t3lib_BEfunc::deleteClause('tt_content').
01394 t3lib_BEfunc::versioningPlaceholderClause('tt_content').
01395 ' AND colPos=0 AND sys_language_uid=0',
01396 '',
01397 'sorting'
01398 );
01399 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
01400 $ecUids=array();
01401 while($ecRec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01402 $ecUids[]=$ecRec['uid'];
01403 }
01404 $this->editconf['tt_content'][implode(',',$ecUids)]='edit';
01405 }
01406 }
01407 }
01408
01415 function compileStoreDat() {
01416 $this->storeArray = t3lib_div::compileSelectedGetVarsFromArray('edit,defVals,overrideVals,columnsOnly,disHelp,noView,editRegularContentFromId',$this->R_URL_getvars);
01417 $this->storeUrl = t3lib_div::implodeArrayForUrl('',$this->storeArray);
01418 $this->storeUrlMd5 = md5($this->storeUrl);
01419 }
01420
01428 function getNewIconMode($table,$key='saveDocNew') {
01429 global $BE_USER;
01430 $TSconfig = $BE_USER->getTSConfig('options.'.$key);
01431 $output = trim(isset($TSconfig['properties'][$table]) ? $TSconfig['properties'][$table] : $TSconfig['value']);
01432 return $output;
01433 }
01434
01441 function closeDocument($code=0) {
01442 global $BE_USER;
01443
01444
01445 if (isset($this->docHandler[$this->storeUrlMd5])) {
01446 unset($this->docHandler[$this->storeUrlMd5]);
01447 if ($code=='3') $this->docHandler=array();
01448 $BE_USER->pushModuleData('alt_doc.php',array($this->docHandler,$this->docDat[1]));
01449 }
01450
01451
01452 if ($this->returnEditConf && $this->retUrl!='dummy.php') {
01453 $this->retUrl.='&returnEditConf='.rawurlencode(serialize($this->editconf));
01454 }
01455
01456
01457 if (!$code || $code==1) {
01458 Header('Location: '.t3lib_div::locationHeaderUrl($this->retUrl));
01459 exit;
01460 } else {
01461 $this->setDocument('',$this->retUrl);
01462 }
01463 }
01464
01473 function setDocument($currentDocFromHandlerMD5='',$retUrl='alt_doc_nodoc.php') {
01474 if (!t3lib_extMgm::isLoaded('cms') && !strcmp($retUrl,'alt_doc_nodoc.php')) return;
01475
01476 if (!$this->modTSconfig['properties']['disableDocSelector'] && is_array($this->docHandler) && count($this->docHandler)) {
01477 if (isset($this->docHandler[$currentDocFromHandlerMD5])) {
01478 $setupArr=$this->docHandler[$currentDocFromHandlerMD5];
01479 } else {
01480 reset($this->docHandler);
01481 $setupArr=current($this->docHandler);
01482 }
01483 if ($setupArr[2]) {
01484 $sParts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
01485 $retUrl = $sParts['path'].'?'.$setupArr[2].'&returnUrl='.rawurlencode($retUrl);
01486 }
01487 }
01488 Header('Location: '.t3lib_div::locationHeaderUrl($retUrl));
01489 exit;
01490 }
01491 }
01492
01493
01494 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc.php']) {
01495 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc.php']);
01496 }
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514 $SOBE = t3lib_div::makeInstance('SC_alt_doc');
01515
01516
01517 $SOBE->preInit();
01518 if ($SOBE->doProcessData()) {
01519 $SOBE->processData();
01520 }
01521
01522
01523
01524 $SOBE->init();
01525 $SOBE->main();
01526 $SOBE->printContent();
01527 ?>