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
00142 var $doc;
00143 var $content;
00144
00145 var $retUrl;
00146 var $R_URL_parts;
00147 var $R_URL_getvars;
00148 var $R_URI;
00149
00150 var $storeTitle;
00151 var $storeArray;
00152 var $storeUrl;
00153 var $storeUrlMd5;
00154
00155 var $docDat;
00156 var $docHandler;
00157
00158
00159
00160 var $elementsData;
00161 var $firstEl;
00162 var $errorC;
00163 var $newC;
00164 var $viewId;
00165 var $viewId_addParams;
00166 var $modTSconfig;
00167
00173 var $tceforms;
00174 var $generalPathOfForm;
00175
00176
00177
00178 var $dontStoreDocumentRef;
00179
00180
00181
00182
00183
00184
00185
00191 function preInit() {
00192 global $BE_USER;
00193
00194 if (t3lib_div::_GP('justLocalized')) {
00195 $this->localizationRedirect(t3lib_div::_GP('justLocalized'));
00196 }
00197
00198
00199 $this->editconf = t3lib_div::_GP('edit');
00200 $this->defVals = t3lib_div::_GP('defVals');
00201 $this->overrideVals = t3lib_div::_GP('overrideVals');
00202 $this->columnsOnly = t3lib_div::_GP('columnsOnly');
00203 $this->returnUrl = t3lib_div::_GP('returnUrl');
00204 $this->closeDoc = t3lib_div::_GP('closeDoc');
00205 $this->doSave = t3lib_div::_GP('doSave');
00206 $this->returnEditConf = t3lib_div::_GP('returnEditConf');
00207 $this->localizationMode = t3lib_div::_GP('localizationMode');
00208 $this->uc = t3lib_div::_GP('uc');
00209
00210
00211
00212 if (!is_array($this->defVals) && is_array($this->overrideVals)) {
00213 $this->defVals = $this->overrideVals;
00214 }
00215
00216
00217 $this->retUrl = $this->returnUrl ? $this->returnUrl : 'dummy.php';
00218
00219
00220 $this->fixWSversioningInEditConf();
00221
00222
00223 $this->R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
00224 $this->R_URL_getvars = t3lib_div::_GET();
00225 $this->R_URL_getvars['edit'] = $this->editconf;
00226
00227
00228 $this->compileStoreDat();
00229
00230
00231 $this->dontStoreDocumentRef=0;
00232 $this->storeTitle='';
00233
00234
00235 $this->docDat = $BE_USER->getModuleData('alt_doc.php','ses');
00236 $this->docHandler = $this->docDat[0];
00237
00238
00239 if ($this->closeDoc>0) {
00240 $this->closeDocument($this->closeDoc);
00241 }
00242
00243
00244 if (is_array($this->R_URL_getvars) && count($this->R_URL_getvars)<2 && !is_array($this->editconf)) {
00245 $this->setDocument($this->docDat[1]);
00246 }
00247 }
00248
00254 function doProcessData() {
00255 $out = $this->doSave || isset($_POST['_savedok_x']) || isset($_POST['_saveandclosedok_x']) || isset($_POST['_savedokview_x']) || isset($_POST['_savedoknew_x']);
00256 return $out;
00257 }
00258
00264 function processData() {
00265 global $BE_USER,$TYPO3_CONF_VARS;
00266
00267
00268 $this->data = t3lib_div::_GP('data');
00269 $this->cmd = t3lib_div::_GP('cmd');
00270 $this->mirror = t3lib_div::_GP('mirror');
00271 $this->cacheCmd = t3lib_div::_GP('cacheCmd');
00272 $this->redirect = t3lib_div::_GP('redirect');
00273 $this->disableRTE = t3lib_div::_GP('_disableRTE');
00274 $this->returnNewPageId = t3lib_div::_GP('returnNewPageId');
00275 $this->vC = t3lib_div::_GP('vC');
00276
00277
00278
00279 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00280 $tce->stripslashes_values=0;
00281
00282
00283 $TCAdefaultOverride = $BE_USER->getTSConfigProp('TCAdefaults');
00284 if (is_array($TCAdefaultOverride)) {
00285 $tce->setDefaultsFromUserTS($TCAdefaultOverride);
00286 }
00287
00288
00289 if ($BE_USER->uc['neverHideAtCopy']) { $tce->neverHideAtCopy = 1; }
00290 $tce->debug=0;
00291 $tce->disableRTE = $this->disableRTE;
00292
00293
00294 $tce->start($this->data,$this->cmd);
00295 if (is_array($this->mirror)) { $tce->setMirror($this->mirror); }
00296
00297
00298 if (isset($this->data['pages'])) {
00299 t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
00300 }
00301
00302
00303
00304 $refInfo=parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
00305 $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
00306 if ($httpHost!=$refInfo['host'] && $this->vC!=$BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
00307 $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));
00308 debug('Error: Referer host did not match with server host.');
00309 } else {
00310
00311
00312 $tce->process_uploads($_FILES);
00313 $tce->process_datamap();
00314 $tce->process_cmdmap();
00315
00316
00317 if (count($tce->substNEWwithIDs_table)) {
00318
00319 t3lib_TCEforms_inline::updateInlineView($this->uc, $tce);
00320
00321 $newEditConf = array();
00322
00323 foreach($this->editconf as $tableName => $tableCmds) {
00324 $keys = array_keys($tce->substNEWwithIDs_table, $tableName);
00325 if(count($keys) > 0) {
00326 foreach($keys as $key) {
00327 $editId = $tce->substNEWwithIDs[$key];
00328
00329 if (!(is_array($tce->newRelatedIDs[$tableName]) && in_array($editId, $tce->newRelatedIDs[$tableName]))) {
00330
00331 if ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $tableName, $editId,'uid')) {
00332 $editId = $versionRec['uid'];
00333 }
00334 $newEditConf[$tableName][$editId] = 'edit';
00335 }
00336
00337
00338 if ($tableName=='pages' && $this->retUrl!='dummy.php' && $this->returnNewPageId) {
00339 $this->retUrl.='&id='.$tce->substNEWwithIDs[$key];
00340 }
00341 }
00342 } else {
00343 $newEditConf[$tableName] = $tableCmds;
00344 }
00345 }
00346
00347
00348 if (count($newEditConf)) {
00349 $this->editconf = $newEditConf;
00350 }
00351
00352
00353 $this->R_URL_getvars['edit']=$this->editconf;
00354
00355
00356 unset($this->R_URL_getvars['defVals']);
00357
00358
00359 $this->compileStoreDat();
00360 }
00361
00362
00363 if (count($tce->autoVersionIdMap)) {
00364 $this->fixWSversioningInEditConf($tce->autoVersionIdMap);
00365 }
00366
00367
00368 if (isset($_POST['_savedoknew_x']) && is_array($this->editconf)) {
00369
00370
00371 reset($this->editconf);
00372 $nTable=key($this->editconf);
00373
00374
00375 reset($this->editconf[$nTable]);
00376 $nUid=key($this->editconf[$nTable]);
00377 $nRec = t3lib_BEfunc::getRecord($nTable,$nUid,'pid,uid');
00378
00379
00380 $this->editconf=array();
00381 if ($this->getNewIconMode($nTable)=='top') {
00382 $this->editconf[$nTable][$nRec['pid']]='new';
00383 } else {
00384 $this->editconf[$nTable][-$nRec['uid']]='new';
00385 }
00386
00387
00388 $this->R_URL_getvars['edit']=$this->editconf;
00389
00390
00391 $this->compileStoreDat();
00392 }
00393
00394 $tce->printLogErrorMessages(
00395 isset($_POST['_saveandclosedok_x']) ?
00396 $this->retUrl :
00397 $this->R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$this->R_URL_getvars)
00398 );
00399 }
00400 if (isset($_POST['_saveandclosedok_x']) || $this->closeDoc<0) {
00401 $this->closeDocument(abs($this->closeDoc));
00402 }
00403 }
00404
00410 function init() {
00411 global $BE_USER,$LANG,$BACK_PATH;
00412
00413
00414 $this->popViewId = t3lib_div::_GP('popViewId');
00415 $this->popViewId_addParams = t3lib_div::_GP('popViewId_addParams');
00416 $this->viewUrl = t3lib_div::_GP('viewUrl');
00417 $this->editRegularContentFromId = t3lib_div::_GP('editRegularContentFromId');
00418 $this->recTitle = t3lib_div::_GP('recTitle');
00419 $this->disHelp = t3lib_div::_GP('disHelp');
00420 $this->noView = t3lib_div::_GP('noView');
00421
00422
00423 $this->R_URL_getvars['returnUrl']=$this->retUrl;
00424 $this->R_URI = $this->R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$this->R_URL_getvars);
00425
00426
00427
00428
00429
00430 $this->MOD_MENU = array(
00431 'showPalettes' => '',
00432 'showDescriptions' => '',
00433 'disableRTE' => ''
00434 );
00435
00436
00437 $this->MCONF['name']='xMOD_alt_doc.php';
00438
00439
00440 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00441
00442
00443 $this->doc = t3lib_div::makeInstance('mediumDoc');
00444 $this->doc->bodyTagMargins['x']=5;
00445 $this->doc->bodyTagMargins['y']=5;
00446 $this->doc->backPath = $BACK_PATH;
00447 $this->doc->docType = 'xhtml_trans';
00448
00449 $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);">';
00450
00451 $this->doc->JScode = $this->doc->wrapScriptTags('
00452 function jumpToUrl(URL,formEl) {
00453 if (!TBE_EDITOR.isFormChanged()) {
00454 window.location.href = URL;
00455 } else if (formEl && formEl.type=="checkbox") {
00456 formEl.checked = formEl.checked ? 0 : 1;
00457 }
00458 }
00459
00460
00461 function typoSetup () {
00462 this.uniqueID = "";
00463 }
00464 var TS = new typoSetup();
00465
00466
00467 function launchView(table,uid,bP) {
00468 var backPath= bP ? bP : "";
00469 var thePreviewWindow="";
00470 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");
00471 if (thePreviewWindow && thePreviewWindow.focus) {
00472 thePreviewWindow.focus();
00473 }
00474 }
00475 function deleteRecord(table,id,url) {
00476 if (
00477 '.($GLOBALS['BE_USER']->jsConfirmation(4)?'confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')':'1==1').'
00478 ) {
00479 window.location.href = "tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";
00480 }
00481 return false;
00482 }
00483 '.(isset($_POST['_savedokview_x']) && $this->popViewId ?
00484 'if (window.opener) { '.
00485 t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl,$this->popViewId_addParams,FALSE).
00486 ' } else { '.
00487 t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl,$this->popViewId_addParams).
00488 ' } '
00489 : '')
00490 ).$this->doc->getDynTabMenuJScode();
00491
00492
00493 $CMparts = $this->doc->getContextMenuCode();
00494 $this->doc->JScode.= $CMparts[0];
00495 $this->doc->bodyTagAdditions = $CMparts[1];
00496 $this->doc->postCode.= $CMparts[2];
00497 }
00498
00504 function main() {
00505 global $BE_USER,$LANG;
00506
00507
00508 $this->content='';
00509 $this->content.=$this->doc->startPage('TYPO3 Edit Document');
00510
00511
00512 if (is_array($this->editconf)) {
00513
00514
00515 $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00516 $this->tceforms->initDefaultBEMode();
00517 $this->tceforms->doSaveFieldName = 'doSave';
00518 $this->tceforms->localizationMode = t3lib_div::inList('text,media',$this->localizationMode) ? $this->localizationMode : '';
00519 $this->tceforms->returnUrl = $this->R_URI;
00520 $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
00521 $this->tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00522 $this->tceforms->enableClickMenu = TRUE;
00523 $this->tceforms->enableTabMenu = TRUE;
00524
00525
00526 $this->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
00527 $this->tceforms->clipObj->initializeClipboard();
00528
00529
00530 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions']) $this->tceforms->edit_showFieldHelp='text';
00531
00532 if ($this->editRegularContentFromId) {
00533 $this->editRegularContentFromId();
00534 }
00535
00536
00537 $editForm = $this->makeEditForm();
00538
00539 if ($editForm) {
00540 reset($this->elementsData);
00541 $this->firstEl = current($this->elementsData);
00542
00543
00544
00545 if (count($this->elementsData)==1) {
00546 $languageSwitch = $this->languageSwitch($this->firstEl['table'], $this->firstEl['uid'], $this->firstEl['pid']);
00547 }
00548
00549
00550 if ($this->viewId) {
00551
00552 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->viewId,'mod.xMOD_alt_doc');
00553 } else $this->modTSconfig=array();
00554
00555 $panel = $this->makeButtonPanel();
00556 $docSel = $this->makeDocSel();
00557 $cMenu = $this->makeCmenu();
00558
00559 $formContent = $this->compileForm($panel,$docSel,$cMenu,$editForm,$languageSwitch);
00560
00561 $this->content.= $this->tceforms->printNeededJSFunctions_top().
00562 $formContent.
00563 $this->tceforms->printNeededJSFunctions();
00564 $this->content.= $this->functionMenus();
00565
00566
00567 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'],'<br/>|',FALSE,'margin-top: 20px;');
00568
00569 $this->content.= $this->shortCutLink();
00570
00571 $this->tceformMessages();
00572 }
00573 }
00574 }
00575
00576
00582 function printContent() {
00583 $this->content.= $this->doc->endPage();
00584 $this->content = $this->doc->insertStylesAndJS($this->content);
00585 echo $this->content;
00586 }
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00618 function makeEditForm() {
00619 global $BE_USER,$LANG,$TCA;
00620
00621
00622 $this->elementsData=array();
00623 $this->errorC=0;
00624 $this->newC=0;
00625 $thePrevUid='';
00626 $editForm='';
00627
00628
00629 foreach($this->editconf as $table => $conf) {
00630 if (is_array($conf) && $TCA[$table] && $BE_USER->check('tables_modify',$table)) {
00631
00632
00633 foreach($conf as $cKey => $cmd) {
00634 if ($cmd=='edit' || $cmd=='new') {
00635
00636
00637 $ids = t3lib_div::trimExplode(',',$cKey,1);
00638
00639
00640 foreach($ids as $theUid) {
00641
00642
00643
00644 $hasAccess = 1;
00645 $deniedAccessReason = '';
00646 $deleteAccess = 0;
00647 $this->viewId = 0;
00648
00649
00650 if ($cmd=='new') {
00651 if (intval($theUid)) {
00652
00653
00654 if ($theUid<0) {
00655 $calcPRec=t3lib_BEfunc::getRecord($table,abs($theUid));
00656 $calcPRec=t3lib_BEfunc::getRecord('pages',$calcPRec['pid']);
00657 } else {
00658 $calcPRec=t3lib_BEfunc::getRecord('pages',abs($theUid));
00659 }
00660
00661
00662 if (is_array($calcPRec)) {
00663 $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
00664 if ($table=='pages') {
00665 $hasAccess = $CALC_PERMS&8 ? 1 : 0;
00666 $this->viewId = $calcPRec['pid'];
00667 } else {
00668 $hasAccess = $CALC_PERMS&16 ? 1 : 0;
00669 $this->viewId = $calcPRec['uid'];
00670 }
00671 }
00672 }
00673 $this->dontStoreDocumentRef=1;
00674 } else {
00675 $calcPRec = t3lib_BEfunc::getRecord($table,$theUid);
00676 t3lib_BEfunc::fixVersioningPid($table,$calcPRec);
00677 if (is_array($calcPRec)) {
00678 if ($table=='pages') {
00679 $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
00680 $hasAccess = $CALC_PERMS&2 ? 1 : 0;
00681 $deleteAccess = $CALC_PERMS&4 ? 1 : 0;
00682 $this->viewId = $calcPRec['uid'];
00683 } else {
00684 $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid']));
00685 $hasAccess = $CALC_PERMS&16 ? 1 : 0;
00686 $deleteAccess = $CALC_PERMS&16 ? 1 : 0;
00687 $this->viewId = $calcPRec['pid'];
00688
00689
00690 if ($TCA[$table]['ctrl']['languageField'] && $calcPRec[$TCA[$table]['ctrl']['languageField']]>0) {
00691 $this->viewId_addParams = '&L='.$calcPRec[$TCA[$table]['ctrl']['languageField']];
00692 }
00693 }
00694
00695
00696 if ($hasAccess) {
00697 $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec);
00698 $deniedAccessReason = $BE_USER->errorMsg;
00699 }
00700 } else $hasAccess = 0;
00701 }
00702
00703
00704
00705 if ($hasAccess) {
00706 $prevPageID = is_object($trData)?$trData->prevPageID:'';
00707 $trData = t3lib_div::makeInstance('t3lib_transferData');
00708 $trData->addRawData = TRUE;
00709 $trData->defVals = $this->defVals;
00710 $trData->lockRecords=1;
00711 $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00712 $trData->prevPageID = $prevPageID;
00713 $trData->fetchRecord($table,$theUid,$cmd=='new'?'new':'');
00714 reset($trData->regTableItems_data);
00715 $rec = current($trData->regTableItems_data);
00716 $rec['uid'] = $cmd=='new' ? uniqid('NEW') : $theUid;
00717 if ($cmd=='new') {
00718 $rec['pid'] = $theUid=='prev'?$thePrevUid:$theUid;
00719 }
00720 $this->elementsData[]=array(
00721 'table' => $table,
00722 'uid' => $rec['uid'],
00723 'pid' => $rec['pid'],
00724 'cmd' => $cmd,
00725 'deleteAccess' => $deleteAccess
00726 );
00727
00728
00729 if (is_array($rec)) {
00730
00731
00732 $this->generalPathOfForm = $this->tceforms->getRecordPath($table,$rec);
00733 if (!$this->storeTitle) {
00734 $this->storeTitle = $this->recTitle ? htmlspecialchars($this->recTitle) : t3lib_BEfunc::getRecordTitle($table,$rec,TRUE);
00735 }
00736
00737
00738 $this->tceforms->hiddenFieldList = '';
00739 $this->tceforms->globalShowHelp = $this->disHelp ? 0 : 1;
00740 if (is_array($this->overrideVals[$table])) {
00741 $this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]);
00742 }
00743
00744
00745 $this->tceforms->registerDefaultLanguageData($table,$rec);
00746
00747
00748 $panel = '';
00749 if ($this->columnsOnly) {
00750 if(is_array($this->columnsOnly)){
00751 $panel.= $this->tceforms->getListedFields($table,$rec,$this->columnsOnly[$table]);
00752 } else {
00753 $panel.= $this->tceforms->getListedFields($table,$rec,$this->columnsOnly);
00754 }
00755 } else {
00756 $panel.= $this->tceforms->getMainFields($table,$rec);
00757 }
00758 $panel = $this->tceforms->wrapTotal($panel,$rec,$table);
00759
00760
00761 if ($cmd=='new') {
00762 $panel.= '<input type="hidden" name="data['.$table.']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
00763 $this->newC++;
00764 }
00765
00766
00767 if ($lockInfo = t3lib_BEfunc::isRecordLocked($table,$rec['uid'])) {
00768 $lockIcon = '
00769
00770 <!--
00771 Warning box:
00772 -->
00773 <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
00774 <tr>
00775 <td><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
00776 <td>'.htmlspecialchars($lockInfo['msg']).'</td>
00777 </tr>
00778 </table>
00779 ';
00780 } else $lockIcon = '';
00781
00782
00783 $editForm.= $lockIcon.$panel;
00784 }
00785
00786 $thePrevUid = $rec['uid'];
00787 } else {
00788 $this->errorC++;
00789 $editForm.=$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.noEditPermission',1).'<br /><br />'.
00790 ($deniedAccessReason ? 'Reason: '.htmlspecialchars($deniedAccessReason).'<br/><br/>' : '');
00791 }
00792 }
00793 }
00794 }
00795 }
00796 }
00797
00798 return $editForm;
00799 }
00800
00806 function makeButtonPanel() {
00807 global $TCA,$LANG;
00808
00809 $panel='';
00810
00811
00812
00813 if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly']) {
00814
00815
00816 $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).'" />';
00817
00818
00819 if ($this->viewId && !$this->noView && t3lib_extMgm::isLoaded('cms')) {
00820 $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).'" />';
00821 }
00822
00823
00824 if (count($this->elementsData)==1 && $this->getNewIconMode($this->firstEl['table'])) {
00825 $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).'" />';
00826 }
00827
00828
00829 $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).'" />';
00830 }
00831
00832
00833 $panel.= '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;">'.
00834 '<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="" />'.
00835 '</a>';
00836
00837
00838 if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData)==1) {
00839 if ($this->firstEl['cmd']!='new' && t3lib_div::testInt($this->firstEl['uid'])) {
00840
00841
00842 if ($this->firstEl['deleteAccess'] && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'],'disableDelete')) {
00843 $aOnClick = 'return deleteRecord(\''.$this->firstEl['table'].'\',\''.$this->firstEl['uid'].'\',unescape(\''.rawurlencode($this->retUrl).'\'));';
00844 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00845 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/deletedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->getLL('deleteItem',1).'" alt="" />'.
00846 '</a>';
00847 }
00848
00849
00850 $undoButton = 0;
00851 $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');
00852 if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
00853 $undoButton = 1;
00854 }
00855 if ($undoButton) {
00856 $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;';
00857 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00858 '<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="" />'.
00859 '</a>';
00860 }
00861 if ($this->getNewIconMode($this->firstEl['table'],'showHistory')) {
00862 $aOnClick = 'window.location.href=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
00863 $panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00864 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/history2.gif','width="13" height="12"').' class="c-inputButton" alt="" />'.
00865 '</a>';
00866 }
00867
00868
00869 if ($this->columnsOnly) {
00870 $panel.= '<a href="'.htmlspecialchars($this->R_URI.'&columnsOnly=').'">'.
00871 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="11" height="12"').' class="c-inputButton" title="'.$LANG->getLL('editWholeRecord',1).'" alt="" />'.
00872 '</a>';
00873 }
00874 }
00875 }
00876 return $panel;
00877 }
00878
00885 function makeDocSel() {
00886 global $BE_USER,$LANG;
00887
00888
00889 if (!$this->modTSconfig['properties']['disableDocSelector']) {
00890
00891
00892 if ((strcmp($this->docDat[1],$this->storeUrlMd5)||!isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
00893 $this->docHandler[$this->storeUrlMd5]=array($this->storeTitle,$this->storeArray,$this->storeUrl);
00894 $BE_USER->pushModuleData('alt_doc.php',array($this->docHandler,$this->storeUrlMd5));
00895 }
00896
00897
00898 $docSel='';
00899 if (is_array($this->docHandler)) {
00900 $opt = array();
00901 $opt[] = '<option>[ '.$LANG->getLL('openDocs',1).': ]</option>';
00902
00903
00904 foreach($this->docHandler as $md5k => $setupArr) {
00905 $theValue = 'alt_doc.php?'.$setupArr[2].'&returnUrl='.rawurlencode($this->retUrl);
00906 $opt[]='<option value="'.htmlspecialchars($theValue).'"'.(!strcmp($md5k,$this->storeUrlMd5)?' selected="selected"':'').'>'.htmlspecialchars(strip_tags(t3lib_div::htmlspecialchars_decode($setupArr[0]))).'</option>';
00907 }
00908
00909
00910 $onChange = 'if(this.options[this.selectedIndex].value && !TBE_EDITOR.isFormChanged()){window.location.href=(this.options[this.selectedIndex].value);}';
00911 $docSel='<select name="_docSelector" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>';
00912
00913
00914 $docSel.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_docSelector', $GLOBALS['BACK_PATH'],'', TRUE);
00915 }
00916 } else $docSel='';
00917 return $docSel;
00918 }
00919
00927 function makeCmenu() {
00928
00929
00930 if (!$this->modTSconfig['properties']['disableCacheSelector']) {
00931 $cMenu = $this->doc->clearCacheMenu(intval($this->viewId),!$this->modTSconfig['properties']['disableDocSelector']);
00932
00933
00934 $cMenu.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_cacheSelector', $GLOBALS['BACK_PATH'],'', TRUE);
00935 } else $cMenu ='';
00936 return $cMenu;
00937 }
00938
00949 function compileForm($panel,$docSel,$cMenu,$editForm, $langSelector='') {
00950 global $LANG;
00951
00952
00953 $formContent='';
00954 $formContent.='
00955
00956 <!--
00957 Header of the editing page.
00958 Contains the buttons for saving/closing, the document selector and menu selector.
00959 Shows the path of the editing operation as well.
00960 -->
00961 <table border="0" cellpadding="0" cellspacing="1" width="470" id="typo3-altdoc-header">
00962 <tr>
00963 <td nowrap="nowrap" valign="top">'.$panel.'</td>
00964 <td nowrap="nowrap" valign="top" align="right">'.$docSel.$cMenu.'</td>
00965 </tr>';
00966
00967 if ($langSelector) {
00968 $langSelector ='<div id="typo3-altdoc-lang-selector">'.$langSelector.'</div>';
00969 }
00970
00971 if (is_array($this->tceforms->extraFormHeaders)) {
00972 $formContent .= implode(chr(10), $this->tceforms->extraFormHeaders);
00973 }
00974
00975 $pagePath = '<div id="typo3-altdoc-page-path">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path',1).': '.htmlspecialchars($this->generalPathOfForm).'</div>';
00976
00977 $formContent.='
00978 <tr>
00979 <td colspan="2"><div id="typo3-altdoc-header-info-options">'.$pagePath.$langSelector.'</div></td>
00980 </tr>
00981 </table>
00982
00983
00984
00985
00986 <!--
00987 EDITING FORM:
00988 -->
00989
00990 '.$editForm.'
00991
00992
00993
00994 <!--
00995 Saving buttons (same as in top)
00996 -->
00997
00998 '.$panel.
00999 '<input type="hidden" name="returnUrl" value="'.htmlspecialchars($this->retUrl).'" />
01000 <input type="hidden" name="viewUrl" value="'.htmlspecialchars($this->viewUrl).'" />';
01001
01002 if ($this->returnNewPageId) {
01003 $formContent.='<input type="hidden" name="returnNewPageId" value="1" />';
01004 }
01005 $formContent.='<input type="hidden" name="popViewId" value="'.htmlspecialchars($this->viewId).'" />';
01006 if ($this->viewId_addParams) {
01007 $formContent.='<input type="hidden" name="popViewId_addParams" value="'.htmlspecialchars($this->viewId_addParams).'" />';
01008 }
01009 $formContent.='<input type="hidden" name="closeDoc" value="0" />';
01010 $formContent.='<input type="hidden" name="doSave" value="0" />';
01011 $formContent.='<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
01012 $formContent.='<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
01013
01014 return $formContent;
01015 }
01016
01022 function functionMenus() {
01023 global $BE_USER,$LANG;
01024
01025 $funcMenus = '';
01026
01027
01028 $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>';
01029
01030
01031 if ($BE_USER->uc['edit_showFieldHelp']!='text') {
01032 $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>';
01033 }
01034
01035
01036 if ($BE_USER->isRTE()) {
01037 $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>';
01038 }
01039
01040 return '
01041
01042 <!--
01043 Function menus (checkboxes for selecting options):
01044 -->
01045 '.$funcMenus;
01046 }
01047
01053 function shortCutLink() {
01054 global $BE_USER,$LANG;
01055
01056
01057 if ($this->returnUrl!='close.html') {
01058 $content.='<br /><br />';
01059
01060
01061 if ($BE_USER->mayMakeShortcut()) {
01062 $content.=$this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,disHelp,noView',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'],1);
01063 }
01064
01065
01066 $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;';
01067 $content.='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
01068 '<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="" />'.
01069 '</a>';
01070 }
01071 return '
01072
01073 <!--
01074 Shortcut link:
01075 -->
01076 '.$content;
01077 }
01078
01084 function tceformMessages() {
01085 if (count($this->tceforms->commentMessages)) {
01086 $this->content.='
01087
01088 <!-- TCEFORM messages
01089 '.htmlspecialchars(implode(chr(10),$this->tceforms->commentMessages)).'
01090 -->
01091
01092 ';
01093 }
01094 }
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01123 function languageSwitch($table, $uid, $pid=NULL) {
01124 global $TCA;
01125
01126 $content = '';
01127
01128 $languageField = $TCA[$table]['ctrl']['languageField'];
01129 $transOrigPointerField = $TCA[$ta