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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 unset($MCONF);
00071 require('conf.php');
00072 require($BACK_PATH.'init.php');
00073 require($BACK_PATH.'template.php');
00074 $LANG->includeLLFile('EXT:cms/layout/locallang.xml');
00075 require_once(PATH_t3lib.'class.t3lib_pagetree.php');
00076 require_once(PATH_t3lib.'class.t3lib_page.php');
00077 require_once(PATH_t3lib.'class.t3lib_recordlist.php');
00078 require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
00079 require_once(PATH_typo3.'class.db_list.inc');
00080 require_once('class.tx_cms_layout.php');
00081 require_once(PATH_t3lib.'class.t3lib_positionmap.php');
00082 $BE_USER->modAccess($MCONF,1);
00083
00084
00085 t3lib_BEfunc::lockRecords();
00086
00087
00088 t3lib_extMgm::isLoaded('cms',1);
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 class ext_posMap extends t3lib_positionMap {
00108 var $dontPrintPageInsertIcons = 1;
00109 var $l_insertNewRecordHere='newContentElement';
00110
00111
00112
00113
00114
00115
00116
00117
00118 function wrapRecordTitle($str,$row) {
00119 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:'.$row['uid'])).'\');return false;';
00120 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
00121 }
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 function wrapColumnHeader($str,$vv) {
00132 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'_EDIT_COL:'.$vv)).'\');return false;';
00133 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
00134 }
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 function onClickInsertRecord($row,$vv,$moveUid,$pid) {
00146 if (is_array($row)) {
00147 $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/-'.$row['uid'].'/'.$row['colPos']));
00148 } else {
00149 $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/'.$pid.'/'.$vv));
00150 }
00151 return 'jumpToUrl(\''.$location.'\');return false;';
00152 }
00153
00154
00155
00156
00157
00158
00159
00160
00161 function wrapRecordHeader($str,$row) {
00162 if ($row['uid']==$this->moveUid) {
00163 return '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/content_client.gif','width="7" height="10"').' alt="" />'.$str;
00164 } else return $str;
00165 }
00166 }
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 class SC_db_layout {
00183
00184
00185 var $id;
00186 var $pointer;
00187 var $imagemode;
00188
00189 var $search_field;
00190 var $search_levels;
00191 var $showLimit;
00192 var $returnUrl;
00193
00194 var $clear_cache;
00195 var $popView;
00196 var $edit_record;
00197 var $new_unique_uid;
00198
00199
00200 var $perms_clause;
00201 var $modTSconfig;
00202 var $pageinfo;
00203
00204
00205
00206
00207
00208
00209 var $doc;
00210 var $backPath;
00211
00212 var $descrTable;
00213 var $colPosList;
00214 var $EDIT_CONTENT;
00215 var $CALC_PERMS;
00216 var $current_sys_language;
00217
00218 var $MCONF=array();
00219 var $MOD_MENU=array();
00220 var $MOD_SETTINGS=array();
00221 var $include_once=array();
00222
00223
00224 var $content;
00225 var $topFuncMenu;
00226 var $editIcon;
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237 function init() {
00238 global $BE_USER;
00239
00240
00241 $this->MCONF = $GLOBALS['MCONF'];
00242 $this->perms_clause = $BE_USER->getPagePermsClause(1);
00243 $this->backPath = $GLOBALS['BACK_PATH'];
00244
00245
00246 $this->id = intval(t3lib_div::_GP('id'));
00247 $this->pointer = t3lib_div::_GP('pointer');
00248 $this->imagemode = t3lib_div::_GP('imagemode');
00249
00250 $this->clear_cache = t3lib_div::_GP('clear_cache');
00251 $this->popView = t3lib_div::_GP('popView');
00252 $this->edit_record = t3lib_div::_GP('edit_record');
00253 $this->new_unique_uid = t3lib_div::_GP('new_unique_uid');
00254 $this->search_field = t3lib_div::_GP('search_field');
00255 $this->search_levels = t3lib_div::_GP('search_levels');
00256 $this->showLimit = t3lib_div::_GP('showLimit');
00257 $this->returnUrl = t3lib_div::_GP('returnUrl');
00258
00259
00260 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
00261
00262
00263 $this->menuConfig();
00264
00265
00266 $this->current_sys_language=intval($this->MOD_SETTINGS['language']);
00267
00268
00269 if ($this->MOD_SETTINGS['function']==0) {
00270 $this->include_once[]=PATH_t3lib.'class.t3lib_tceforms.php';
00271 $this->include_once[]=PATH_t3lib.'class.t3lib_clipboard.php';
00272 $this->include_once[]=PATH_t3lib.'class.t3lib_loaddbgroup.php';
00273 $this->include_once[]=PATH_t3lib.'class.t3lib_transferdata.php';
00274 }
00275
00276
00277 if ($this->clear_cache) {
00278 $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
00279 }
00280
00281
00282 $this->descrTable = '_MOD_'.$this->MCONF['name'];
00283 }
00284
00285
00286
00287
00288
00289
00290 function menuConfig() {
00291 global $BE_USER,$LANG,$TYPO3_CONF_VARS;
00292
00293
00294 $this->MOD_MENU = array(
00295 'tt_board' => array(
00296 0 => $LANG->getLL('m_tt_board_0'),
00297 'expand' => $LANG->getLL('m_tt_board_expand')
00298 ),
00299 'tt_address' => array(
00300 0 => $LANG->getLL('m_tt_address_0'),
00301 1 => $LANG->getLL('m_tt_address_1'),
00302 2 => $LANG->getLL('m_tt_address_2')
00303 ),
00304 'tt_links' => array(
00305 0 => $LANG->getLL('m_default'),
00306 1 => $LANG->getLL('m_tt_links_1'),
00307 2 => $LANG->getLL('m_tt_links_2')
00308 ),
00309 'tt_calender' => array (
00310 0 => $LANG->getLL('m_default'),
00311 'date' => $LANG->getLL('m_tt_calender_date'),
00312 'date_ext' => $LANG->getLL('m_tt_calender_date_ext'),
00313 'todo' => $LANG->getLL('m_tt_calender_todo'),
00314 'todo_ext' => $LANG->getLL('m_tt_calender_todo_ext')
00315 ),
00316 'tt_products' => array (
00317 0 => $LANG->getLL('m_default'),
00318 'ext' => $LANG->getLL('m_tt_products_ext')
00319 ),
00320 'tt_content_showHidden' => '',
00321 'showPalettes' => '',
00322 'showDescriptions' => '',
00323 'disableRTE' => '',
00324 'function' => array(
00325 1 => $LANG->getLL('m_function_1'),
00326 0 => $LANG->getLL('m_function_0'),
00327 2 => $LANG->getLL('m_function_2'),
00328 3 => $LANG->getLL('pageInformation')
00329 ),
00330 'language' => array(
00331 0 => $LANG->getLL('m_default')
00332 )
00333 );
00334
00335
00336 $res = $this->exec_languageQuery($this->id);
00337 while($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00338 if ($GLOBALS['BE_USER']->checkLanguageAccess($lrow['uid'])) {
00339 $this->MOD_MENU['language'][$lrow['uid']]=($lrow['hidden']?'('.$lrow['title'].')':$lrow['title']);
00340 }
00341 }
00342
00343
00344 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'sys_language', ($BE_USER->isAdmin()?'':'hidden=0'));
00345 if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
00346 unset($this->MOD_MENU['function']['2']);
00347 }
00348
00349
00350 $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
00351 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
00352 if ($this->modTSconfig['properties']['QEisDefault']) ksort($this->MOD_MENU['function']);
00353 $this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['function'],'menu.function');
00354
00355
00356 if (!t3lib_div::inList($TYPO3_CONF_VARS['FE']['content_doktypes'].',6',$this->pageinfo['doktype'])) {
00357 unset($this->MOD_MENU['function'][0]);
00358 }
00359
00360
00361 if (($this->modSharedTSconfig['properties']['defaultLanguageLabel'] || $this->modTSconfig['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU['language'][0])) {
00362 $this->MOD_MENU['language'][0] = $this->modTSconfig['properties']['defaultLanguageLabel'] ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig['properties']['defaultLanguageLabel'];
00363 }
00364
00365
00366 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00367
00368
00369 if ($GLOBALS['BE_USER']->workspace!=0) {
00370 $this->MOD_SETTINGS['tt_content_showHidden'] = 1;
00371 }
00372 }
00373
00374
00375
00376
00377
00378
00379 function clearCache() {
00380 if ($this->clear_cache) {
00381 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00382 $tce->stripslashes_values=0;
00383 $tce->start(Array(),Array());
00384 $tce->clear_cacheCmd($this->id);
00385 }
00386 }
00387
00388
00389
00390
00391
00392
00393
00394 function main() {
00395 global $BE_USER,$LANG,$BACK_PATH;
00396
00397
00398
00399 $access = is_array($this->pageinfo) ? 1 : 0;
00400 if ($this->id && $access) {
00401
00402
00403 $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
00404 $this->EDIT_CONTENT = ($this->CALC_PERMS&16) ? 1 : 0;
00405
00406
00407 $this->doc = t3lib_div::makeInstance('template');
00408 $this->doc->backPath = $BACK_PATH;
00409 $this->doc->setModuleTemplate('templates/db_layout.html');
00410
00411
00412 $this->doc->JScode = '<script type="text/javascript" src="'.$BACK_PATH.'../t3lib/jsfunc.updateform.js"></script>';
00413 $this->doc->JScode.= $this->doc->wrapScriptTags('
00414 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00415 if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id).'_"+top.fsMod.currentBank; '.intval($this->id).';
00416 function jumpToUrl(URL,formEl) {
00417 if (document.editform && TBE_EDITOR.isFormChanged) {
00418 if (!TBE_EDITOR.isFormChanged()) {
00419 window.location.href = URL;
00420 } else if (formEl) {
00421 if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
00422 }
00423 } else window.location.href = URL;
00424 }
00425 '.($this->popView ? t3lib_BEfunc::viewOnClick($this->id,$BACK_PATH,t3lib_BEfunc::BEgetRootLine($this->id)) : '').'
00426
00427 function deleteRecord(table,id,url) {
00428 if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) {
00429 window.location.href = "'.$BACK_PATH.'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";
00430 }
00431 return false;
00432 }
00433 ');
00434 $this->doc->JScode.= $this->doc->wrapScriptTags('
00435 var DTM_array = new Array();
00436 var DTM_origClass = new String();
00437
00438
00439 if(!top.DTM_currentTabs) {
00440 top.DTM_currentTabs = new Array();
00441 }
00442
00443 function DTM_activate(idBase,index,doToogle) {
00444
00445 if (DTM_array[idBase]) {
00446 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
00447 if (DTM_array[idBase][cnt] != idBase+"-"+index) {
00448 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
00449 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
00450 }
00451 }
00452 }
00453
00454
00455 if (document.getElementById(idBase+"-"+index+"-DIV")) {
00456 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
00457 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
00458 if(DTM_origClass=="") {
00459 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
00460 } else {
00461 DTM_origClass = "tab";
00462 }
00463 top.DTM_currentTabs[idBase] = -1;
00464 } else {
00465 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
00466 if(DTM_origClass=="") {
00467 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
00468 } else {
00469 DTM_origClass = "tabact";
00470 }
00471 top.DTM_currentTabs[idBase] = index;
00472 }
00473 }
00474 }
00475 function DTM_toggle(idBase,index,isInit) {
00476
00477 if (document.getElementById(idBase+"-"+index+"-DIV")) {
00478 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
00479 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
00480 if(isInit) {
00481 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
00482 } else {
00483 DTM_origClass = "tab";
00484 }
00485 top.DTM_currentTabs[idBase+"-"+index] = 0;
00486 } else {
00487 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
00488 if(isInit) {
00489 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
00490 } else {
00491 DTM_origClass = "tabact";
00492 }
00493 top.DTM_currentTabs[idBase+"-"+index] = 1;
00494 }
00495 }
00496 }
00497
00498 function DTM_mouseOver(obj) {
00499 DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue;
00500 obj.attributes.getNamedItem(\'class\').nodeValue += "_over";
00501 }
00502
00503 function DTM_mouseOut(obj) {
00504 obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass;
00505 DTM_origClass = "";
00506 }
00507 ');
00508
00509
00510 $this->doc->form='<form action="'.htmlspecialchars('db_layout.php?id='.$this->id.'&imagemode='.$this->imagemode).'" method="post">';
00511
00512
00513 $this->topFuncMenu = t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function'],'db_layout.php','');
00514 $this->languageMenu = (count($this->MOD_MENU['language'])>1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language',1) . t3lib_BEfunc::getFuncMenu($this->id,'SET[language]',$this->current_sys_language,$this->MOD_MENU['language'],'db_layout.php','') : '');
00515
00516
00517 $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED');
00518 $this->colPosList = strcmp(trim($this->modTSconfig['properties']['tt_content.']['colPos_list']),'') ? trim($this->modTSconfig['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];
00519 $this->colPosList = strcmp($this->colPosList,'')?$this->colPosList:'1,0,2,3';
00520 $this->colPosList = implode(',',array_unique(t3lib_div::intExplode(',',$this->colPosList)));
00521
00522
00523
00524 if ($this->MOD_SETTINGS['function']==0) {
00525 $body = $this->renderQuickEdit();
00526 } else {
00527 $body = $this->renderListContent();
00528 }
00529
00530
00531 $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function']==0 ? 'quickEdit' : '');
00532 $markers = array(
00533 'CSH' => $docHeaderButtons['csh'],
00534 'TOP_FUNCTION_MENU' => $this->editSelect . $this->topFuncMenu,
00535 'LANGSELECTOR' => $this->languageMenu,
00536 'CONTENT' => $body
00537 );
00538
00539
00540 $this->content = $this->doc->startPage($LANG->getLL('title'));
00541 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00542 $this->content.= $this->doc->endPage();
00543 $this->content = $this->doc->insertStylesAndJS($this->content);
00544
00545 } else {
00546
00547
00548 $this->doc = t3lib_div::makeInstance('template');
00549 $this->doc->backPath = $BACK_PATH;
00550 $this->doc->setModuleTemplate('templates/db_layout.html');
00551
00552 $this->doc->JScode = $this->doc->wrapScriptTags('
00553 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00554 ');
00555
00556 $body = $this->doc->section($LANG->getLL('clickAPage_header'), $LANG->getLL('clickAPage_content'), 0, 1);
00557
00558
00559 $docHeaderButtons = array(
00560 'view' => '',
00561 'history_page' => '',
00562 'new_content' => '',
00563 'move_page' => '',
00564 'move_record' => '',
00565 'new_page' => '',
00566 'edit_page' => '',
00567 'record_list' => '',
00568 'csh' => '',
00569 'shortcut' => '',
00570 'cache' => '',
00571 'savedok' => '',
00572 'savedokshow' => '',
00573 'closedok' => '',
00574 'deletedok' => '',
00575 'undo' => '',
00576 'history_record' => ''
00577 );
00578
00579 $markers = array(
00580 'CSH' => t3lib_BEfunc::cshItem($this->descrTable, '', $BACK_PATH, '', TRUE),
00581 'TOP_FUNCTION_MENU' => '',
00582 'LANGSELECTOR' => '',
00583 'CONTENT' => $body
00584 );
00585
00586 $this->content=$this->doc->startPage($LANG->getLL('title'));
00587 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00588 $this->content.=$this->doc->endPage();
00589 $this->content = $this->doc->insertStylesAndJS($this->content);
00590 }
00591 }
00592
00593
00594
00595
00596
00597
00598 function renderQuickEdit() {
00599 global $LANG,$BE_USER,$BACK_PATH;
00600
00601 $this->doc->setModuleTemplate('templates/db_layout_quickedit.html');
00602
00603
00604 $this->doc->form='<form action="'.htmlspecialchars($BACK_PATH.'tce_db.php?&prErr=1&uPT=1').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
00605
00606
00607 $this->doc->getContextMenuCode();
00608
00609
00610 $edit_record = $this->edit_record;
00611
00612
00613 if (substr($edit_record,0,9)=='_EDIT_COL') {
00614 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00615 '*',
00616 'tt_content',
00617 'pid='.intval($this->id).' AND colPos='.intval(substr($edit_record,10)).' AND sys_language_uid='.intval($this->current_sys_language).
00618 ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).
00619 t3lib_BEfunc::deleteClause('tt_content').
00620 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
00621 '',
00622 'sorting'
00623 );
00624 $idListA = array();
00625 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00626 $idListA[] = $cRow['uid'];
00627 }
00628
00629 $url = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));
00630 header('Location: '.t3lib_div::locationHeaderUrl($url));
00631 exit;
00632 }
00633
00634
00635 if ($this->new_unique_uid) {
00636 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid='.intval($BE_USER->user['uid']).' AND NEWid='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));
00637 $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00638 if (is_array($sys_log_row)) {
00639 $edit_record=$sys_log_row['tablename'].':'.$sys_log_row['recuid'];
00640 }
00641 }
00642
00643
00644
00645 $opt=array();
00646 $is_selected=0;
00647 $languageOverlayRecord='';
00648 if ($this->current_sys_language) {
00649 list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$this->id,'AND sys_language_uid='.intval($this->current_sys_language));
00650 }
00651 if (is_array($languageOverlayRecord)) {
00652 $inValue = 'pages_language_overlay:'.$languageOverlayRecord['uid'];
00653 $is_selected+=intval($edit_record==$inValue);
00654 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editLanguageHeader',1).' ]</option>';
00655 } else {
00656 $inValue = 'pages:'.$this->id;
00657 $is_selected+=intval($edit_record==$inValue);
00658 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editPageProperties',1).' ]</option>';
00659 }
00660
00661
00662 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00663 '*',
00664 'tt_content',
00665 'pid='.intval($this->id).' AND sys_language_uid='.intval($this->current_sys_language).' AND colPos IN ('.$this->colPosList.')'.
00666 ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).
00667 t3lib_Befunc::deleteClause('tt_content').
00668 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
00669 '',
00670 'colPos,sorting'
00671 );
00672 $colPos='';
00673 $first=1;
00674 $prev=$this->id;
00675 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00676 t3lib_BEfunc::workspaceOL('tt_content', $cRow);
00677
00678 if (is_array($cRow)) {
00679 if ($first) {
00680 if (!$edit_record) {
00681 $edit_record='tt_content:'.$cRow['uid'];
00682 }
00683 $first = 0;
00684 }
00685 if (strcmp($cRow['colPos'],$colPos)) {
00686 $colPos=$cRow['colPos'];
00687 $opt[]='<option value=""></option>';
00688 $opt[]='<option value="_EDIT_COL:'.$colPos.'">__'.$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','colPos',$colPos),1).':__</option>';
00689 }
00690 $inValue = 'tt_content:'.$cRow['uid'];
00691 $is_selected+=intval($edit_record==$inValue);
00692 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($cRow['header']?$cRow['header']:'['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.no_title').'] '.strip_tags($cRow['bodytext']),$BE_USER->uc['titleLen'])).'</option>';
00693 $prev=-$cRow['uid'];
00694 }
00695 }
00696
00697
00698 if (!$edit_record) {
00699 $edit_record='tt_content:new/'.$prev.'/'.$colPos;
00700
00701 $inValue = 'tt_content:new/'.$prev.'/'.$colPos;
00702 $is_selected+=intval($edit_record==$inValue);
00703 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('newLabel',1).' ]</option>';
00704 }
00705
00706
00707 if (!$is_selected) {
00708 $opt[]='<option value=""></option>';
00709 $opt[]='<option value="'.$edit_record.'" selected="selected">[ '.$LANG->getLL('newLabel',1).' ]</option>';
00710 }
00711
00712
00713
00714 $this->eRParts = explode(':',$edit_record);
00715
00716
00717
00718
00719 $this->deleteButton = (t3lib_div::testInt($this->eRParts[1]) && $edit_record && (($this->eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($this->eRParts[0]=='pages'&&($this->CALC_PERMS&4))));
00720
00721
00722 $this->undoButton=0;
00723 $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history').' AND recuid='.intval($this->eRParts[1]), '', 'tstamp DESC', '1');
00724 if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
00725 $this->undoButton=1;
00726 }
00727
00728
00729 $R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
00730 $R_URL_getvars = t3lib_div::_GET();
00731
00732 unset($R_URL_getvars['popView']);
00733 unset($R_URL_getvars['new_unique_uid']);
00734 $R_URL_getvars['edit_record']=$edit_record;
00735 $this->R_URI = $R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$R_URL_getvars);
00736
00737
00738 $this->closeUrl = $this->local_linkThisScript(array('SET'=>array('function'=>1)));
00739
00740 if ($BE_USER->uc['condensedMode']) {
00741 $this->closeUrl = $BACK_PATH.'alt_db_navframe.php';
00742 }
00743 if ($this->returnUrl) {
00744 $this->closeUrl = $this->returnUrl;
00745 }
00746
00747 $retUrlStr = $this->returnUrl?"+'&returnUrl='+'".rawurlencode($this->returnUrl)."'":'';
00748
00749
00750 $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>';
00751
00752
00753 if ($BE_USER->check('tables_modify',$this->eRParts[0]) && $edit_record && (($this->eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($this->eRParts[0]=='pages'&&($this->CALC_PERMS&1)))) {
00754
00755
00756 list($uidVal,$ex_pid,$ex_colPos) = explode('/',$this->eRParts[1]);
00757
00758
00759 if ($uidVal!='new') {
00760 if ($draftRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) {
00761 $uidVal = $draftRecord['uid'];
00762 }
00763 }
00764
00765
00766 $trData = t3lib_div::makeInstance('t3lib_transferData');
00767 $trData->addRawData = TRUE;
00768 $trData->defVals[$this->eRParts[0]] = array (
00769 'colPos' => intval($ex_colPos),
00770 'sys_language_uid' => intval($this->current_sys_language)
00771 );
00772 $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00773 $trData->lockRecords=1;
00774 $trData->fetchRecord($this->eRParts[0],($uidVal=='new'?$this->id:$uidVal),$uidVal);
00775
00776
00777 reset($trData->regTableItems_data);
00778 $rec = current($trData->regTableItems_data);
00779 if ($uidVal=='new') {
00780 $new_unique_uid = uniqid('NEW');
00781 $rec['uid'] = $new_unique_uid;
00782 $rec['pid'] = intval($ex_pid)?intval($ex_pid):$this->id;
00783 $recordAccess = TRUE;
00784 } else {
00785 $rec['uid'] = $uidVal;
00786
00787
00788 $recordAccess = $BE_USER->recordEditAccessInternals($this->eRParts[0],$uidVal);
00789 }
00790
00791 if (!$recordAccess) {
00792
00793 $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />'.
00794 ($BE_USER->errorMsg ? 'Reason: '.$BE_USER->errorMsg.'<br/><br/>' : ''),0,1);
00795 } elseif (is_array($rec)) {
00796
00797
00798 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00799 $tceforms->backPath = $BACK_PATH;
00800 $tceforms->initDefaultBEMode();
00801 $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder'];
00802 $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
00803 $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00804 $tceforms->enableClickMenu = TRUE;
00805
00806
00807 $tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
00808 $tceforms->clipObj->initializeClipboard();
00809
00810
00811 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions']) $tceforms->edit_showFieldHelp='text';
00812
00813
00814 $panel='';
00815 $panel.=$tceforms->getMainFields($this->eRParts[0],$rec);
00816 $panel=$tceforms->wrapTotal($panel,$rec,$this->eRParts[0]);
00817
00818
00819 $theCode=$panel;
00820 if ($uidVal=='new') {
00821 $theCode.='<input type="hidden" name="data['.$this->eRParts[0].']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
00822 }
00823 $theCode.='
00824 <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />
00825 <input type="hidden" name="_disableRTE" value="'.$tceforms->disableRTE.'" />
00826 <input type="hidden" name="edit_record" value="'.$edit_record.'" />
00827 <input type="hidden" name="redirect" value="'.htmlspecialchars($uidVal=='new' ? t3lib_extMgm::extRelPath('cms').'layout/db_layout.php?id='.$this->id.'&new_unique_uid='.$new_unique_uid.'&returnUrl='.rawurlencode($this->returnUrl) : $this->R_URI ).'" />
00828 ';
00829
00830
00831 $theCode=$tceforms->printNeededJSFunctions_top().$theCode.$tceforms->printNeededJSFunctions();
00832
00833
00834 if ($lockInfo=t3lib_BEfunc::isRecordLocked($this->eRParts[0],$rec['uid'])) {
00835 $lockIcon='
00836
00837 <!--
00838 Warning box:
00839 -->
00840 <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
00841 <tr>
00842 <td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
00843 <td>'.htmlspecialchars($lockInfo['msg']).'</td>
00844 </tr>
00845 </table>
00846 ';
00847 } else $lockIcon='';
00848
00849
00850 $content.=$this->doc->section('',$lockIcon.$theCode);
00851 }
00852 } else {
00853
00854 $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />',0,1);
00855 }
00856
00857
00858
00859 $q_count = $this->getNumberOfHiddenElements();
00860 $h_func_b= t3lib_BEfunc::getFuncCheck($this->id,'SET[tt_content_showHidden]',$this->MOD_SETTINGS['tt_content_showHidden'],'db_layout.php','','id="checkTt_content_showHidden"').
00861 '<label for="checkTt_content_showHidden">'.(!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE',1)):$LANG->getLL('hiddenCE',1).' ('.$q_count.')').'</label>';
00862
00863 $h_func_b.= '<br />'.
00864 t3lib_BEfunc::getFuncCheck($this->id,'SET[showPalettes]',$this->MOD_SETTINGS['showPalettes'],'db_layout.php','','id="checkShowPalettes"').
00865 '<label for="checkShowPalettes">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes',1).'</label>';
00866
00867 if (t3lib_extMgm::isLoaded('context_help') && $BE_USER->uc['edit_showFieldHelp']!='text') {
00868 $h_func_b.= '<br />'.
00869 t3lib_BEfunc::getFuncCheck($this->id,'SET[showDescriptions]',$this->MOD_SETTINGS['showDescriptions'],'db_layout.php','','id="checkShowDescriptions"').
00870 '<label for="checkShowDescriptions">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions',1).'</label>';
00871 }
00872
00873 if ($BE_USER->isRTE()) {
00874 $h_func_b.= '<br />'.
00875 t3lib_BEfunc::getFuncCheck($this->id,'SET[disableRTE]',$this->MOD_SETTINGS['disableRTE'],'db_layout.php','','id="checkDisableRTE"').
00876 '<label for="checkDisableRTE">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE',1).'</label>';
00877 }
00878
00879
00880 $content.=$this->doc->section('',$h_func_b,0,0);
00881 $content.=$this->doc->spacer(10);
00882
00883
00884
00885 if ($this->eRParts[0]=='tt_content' && t3lib_div::testInt($this->eRParts[1])) {
00886 $posMap = t3lib_div::makeInstance('ext_posMap');
00887 $posMap->backPath = $BACK_PATH;
00888 $posMap->cur_sys_language=$this->current_sys_language;
00889
00890 $HTMLcode = '';
00891
00892
00893 $HTMLcode.= t3lib_BEfunc::cshItem($this->descrTable,'quickEdit_selElement',$BACK_PATH,'|<br/>');
00894
00895 $HTMLcode.=$posMap->printContentElementColumns($this->id,$this->eRParts[1],$this->colPosList,$this->MOD_SETTINGS['tt_content_showHidden'],$this->R_URI);
00896
00897 $content.=$this->doc->spacer(20);
00898 $content.=$this->doc->section($LANG->getLL('CEonThisPage'),$HTMLcode,0,1);
00899 $content.=$this->doc->spacer(20);
00900 }
00901
00902
00903 if (count($tceforms->commentMessages)) {
00904 $content.='
00905 <!-- TCEFORM messages
00906 '.htmlspecialchars(implode(chr(10),$tceforms->commentMessages)).'
00907 -->
00908 ';
00909 }
00910 return $content;
00911 }
00912
00913
00914
00915
00916
00917
00918 function renderListContent() {
00919 global $LANG,$BACK_PATH,$TCA;
00920
00921
00922 $dblist = t3lib_div::makeInstance('tx_cms_layout');
00923 $dblist->backPath = $BACK_PATH;
00924 $dblist->thumbs = $this->imagemode;
00925 $dblist->no_noWrap = 1;
00926 $dblist->descrTable = $this->descrTable;
00927
00928 $this->pointer = t3lib_div::intInRange($this->pointer,0,100000);
00929 $dblist->script = 'db_layout.php';
00930 $dblist->showIcon = 0;
00931 $dblist->setLMargin=0;
00932 $dblist->doEdit = $this->EDIT_CONTENT;
00933 $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
00934
00935 $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
00936 $dblist->id = $this->id;
00937 $dblist->nextThree = t3lib_div::intInRange($this->modTSconfig['properties']['editFieldsAtATime'],0,10);
00938 $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] ? 0 : 1;
00939 $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
00940 $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
00941 if (!$dblist->nextThree) $dblist->nextThree = 1;
00942
00943 $dblist->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
00944
00945
00946
00947 $h_menu = $dblist->getTableMenu($this->id);
00948
00949
00950 $h_func='';
00951 $tableOutput=array();
00952 $tableJSOutput=array();
00953 $CMcounter = 0;
00954
00955
00956 reset($dblist->activeTables);
00957 while(list($table)=each($dblist->activeTables)) {
00958
00959
00960 t3lib_div::loadTCA($table);
00961
00962 if (!isset($dblist->externalTables[$table])) {
00963
00964 switch($table) {
00965 case 'tt_board':
00966 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_board]',$this->MOD_SETTINGS['tt_board'],$this->MOD_MENU['tt_board'],'db_layout.php','');
00967 break;
00968 case 'tt_address':
00969 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_address]',$this->MOD_SETTINGS['tt_address'],$this->MOD_MENU['tt_address'],'db_layout.php','');
00970 break;
00971 case 'tt_links':
00972 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_links]',$this->MOD_SETTINGS['tt_links'],$this->MOD_MENU['tt_links'],'db_layout.php','');
00973 break;
00974 case 'tt_calender':
00975 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_calender]',$this->MOD_SETTINGS['tt_calender'],$this->MOD_MENU['tt_calender'],'db_layout.php','');
00976 break;
00977 case 'tt_products':
00978 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_products]',$this->MOD_SETTINGS['tt_products'],$this->MOD_MENU['tt_products'],'db_layout.php','');
00979 break;
00980 case 'tt_guest':
00981 case 'tt_news':
00982 case 'fe_users':
00983
00984 break;
00985 case 'tt_content':
00986 $q_count = $this->getNumberOfHiddenElements();
00987 $h_func_b= t3lib_BEfunc::getFuncCheck($this->id,'SET[tt_content_showHidden]',$this->MOD_SETTINGS['tt_content_showHidden'],'db_layout.php','','id="checkTt_content_showHidden"').'<label for="checkTt_content_showHidden">'.(!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE')):$LANG->getLL('hiddenCE').' ('.$q_count.')').'</label>';
00988
00989 $dblist->tt_contentConfig['showCommands'] = 1;
00990 $dblist->tt_contentConfig['showInfo'] = 1;
00991 $dblist->tt_contentConfig['single'] = 0;
00992
00993
00994 if (is_array($TCA['tt_content']['columns']['colPos']['config']['items'])) {
00995 $colList = array();
00996 foreach($TCA['tt_content']['columns']['colPos']['config']['items'] as $temp) {
00997 $colList[] = $temp[1];
00998 }
00999 } else {
01000 $colList = array('1','0','2','3');
01001 }
01002 if (strcmp($this->colPosList,'')) {
01003 $colList = array_intersect(t3lib_div::intExplode(',',$this->colPosList),$colList);
01004 }
01005
01006
01007 if (count($colList)==1) {
01008 $dblist->tt_contentConfig['single'] = 1;
01009 $dblist->tt_contentConfig['showSingleCol'] = current($colList);
01010 }
01011 $dblist->tt_contentConfig['cols'] = implode(',',$colList);
01012 $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
01013 $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
01014
01015
01016 if ($this->MOD_SETTINGS['function']==2) {
01017 $dblist->tt_contentConfig['single'] = 0;
01018 $dblist->tt_contentConfig['languageMode'] = 1;
01019 $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
01020 $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
01021 }
01022 break;
01023 }
01024 } else {
01025 $h_func = '';
01026 }
01027
01028
01029 $dblist->itemsLimitSingleTable = 1000;
01030 $dblist->start($this->id,$table,$this->pointer,$this->search_field,$this->search_levels,$this->showLimit);
01031 $dblist->counter = $CMcounter;
01032 $dblist->ext_function = $this->MOD_SETTINGS['function'];
01033
01034
01035 $dblist->HTMLcode.= $this->doc->getVersionSelector($this->id);
01036
01037
01038 $dblist->generateList();
01039
01040
01041 $tableOutput[$table]=
01042 ($h_func?$h_func.'<br /><img src="clear.gif" width="1" height="4" alt="" /><br />':'').
01043 $dblist->HTMLcode.
01044 ($h_func_b?'<img src="clear.gif" width="1" height="10" alt="" /><br />'.$h_func_b:'');
01045
01046
01047 $tableJSOutput[$table] = $dblist->JScode;
01048
01049
01050