"TYPO3 4.0.1: typo3_src-4.0.1/typo3/db_list.php Source File", "datetime" => "Sat Dec 2 19:22:21 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00060 unset($MCONF); 00061 require ('mod/web/list/conf.php'); 00062 require ('init.php'); 00063 require ('template.php'); 00064 $LANG->includeLLFile('EXT:lang/locallang_mod_web_list.xml'); 00065 require_once (PATH_t3lib.'class.t3lib_page.php'); 00066 require_once (PATH_t3lib.'class.t3lib_pagetree.php'); 00067 require_once (PATH_t3lib.'class.t3lib_recordlist.php'); 00068 require_once (PATH_t3lib.'class.t3lib_clipboard.php'); 00069 require_once ('class.db_list.inc'); 00070 require_once ('class.db_list_extra.inc'); 00071 $BE_USER->modAccess($MCONF,1); 00072 00073 t3lib_BEfunc::lockRecords(); 00074 00075 00076 00077 00078 00079 00080 00081 00089 class SC_db_list { 00090 00091 // Internal, GPvars: 00092 var $id; // Page Id for which to make the listing 00093 var $pointer; // Pointer - for browsing list of records. 00094 var $imagemode; // Thumbnails or not 00095 var $table; // Which table to make extended listing for 00096 var $search_field; // Search-fields 00097 var $search_levels; // Search-levels 00098 var $showLimit; // Show-limit 00099 var $returnUrl; // Return URL 00100 00101 var $clear_cache; // Clear-cache flag - if set, clears page cache for current id. 00102 var $cmd; // Command: Eg. "delete" or "setCB" (for TCEmain / clipboard operations) 00103 var $cmd_table; // Table on which the cmd-action is performed. 00104 00105 // Internal, static: 00106 var $perms_clause; // Page select perms clause 00107 var $modTSconfig; // Module TSconfig 00108 var $pageinfo; // Current ids page record 00109 var $doc; // Document template object 00110 00111 var $MCONF=array(); // Module configuration 00112 var $MOD_MENU=array(); // Menu configuration 00113 var $MOD_SETTINGS=array(); // Module settings (session variable) 00114 var $include_once=array(); // Array, where files to include is accumulated in the init() function 00115 00116 // Internal, dynamic: 00117 var $content; // Module output accumulation 00118 00119 00125 function init() { 00126 global $BE_USER; 00127 00128 // Setting module configuration / page select clause 00129 $this->MCONF = $GLOBALS['MCONF']; 00130 $this->perms_clause = $BE_USER->getPagePermsClause(1); 00131 00132 // GPvars: 00133 $this->id = t3lib_div::_GP('id'); 00134 $this->pointer = t3lib_div::_GP('pointer'); 00135 $this->imagemode = t3lib_div::_GP('imagemode'); 00136 $this->table = t3lib_div::_GP('table'); 00137 $this->search_field = t3lib_div::_GP('search_field'); 00138 $this->search_levels = t3lib_div::_GP('search_levels'); 00139 $this->showLimit = t3lib_div::_GP('showLimit'); 00140 $this->returnUrl = t3lib_div::_GP('returnUrl'); 00141 00142 $this->clear_cache = t3lib_div::_GP('clear_cache'); 00143 $this->cmd = t3lib_div::_GP('cmd'); 00144 $this->cmd_table = t3lib_div::_GP('cmd_table'); 00145 00146 // Initialize menu 00147 $this->menuConfig(); 00148 00149 // Inclusions? 00150 if ($this->clear_cache || $this->cmd=='delete') { 00151 $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php'; 00152 } 00153 } 00154 00160 function menuConfig() { 00161 00162 // MENU-ITEMS: 00163 $this->MOD_MENU = array( 00164 'bigControlPanel' => '', 00165 'clipBoard' => '', 00166 'localization' => '' 00167 ); 00168 00169 // Loading module configuration: 00170 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']); 00171 00172 // Clean up settings: 00173 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']); 00174 } 00175 00181 function clearCache() { 00182 if ($this->clear_cache) { 00183 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 00184 $tce->stripslashes_values=0; 00185 $tce->start(Array(),Array()); 00186 $tce->clear_cacheCmd($this->id); 00187 } 00188 } 00189 00195 function main() { 00196 global $BE_USER,$LANG,$BACK_PATH,$CLIENT; 00197 00198 // Start document template object: 00199 $this->doc = t3lib_div::makeInstance('template'); 00200 $this->doc->backPath = $BACK_PATH; 00201 $this->doc->docType='xhtml_trans'; 00202 00203 // Loading current page record and checking access: 00204 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause); 00205 $access = is_array($this->pageinfo) ? 1 : 0; 00206 00207 // Initialize the dblist object: 00208 $dblist = t3lib_div::makeInstance('localRecordList'); 00209 $dblist->backPath = $BACK_PATH; 00210 $dblist->calcPerms = $BE_USER->calcPerms($this->pageinfo); 00211 $dblist->thumbs = $BE_USER->uc['thumbnailsByDefault']; 00212 $dblist->returnUrl=$this->returnUrl; 00213 $dblist->allFields = ($this->MOD_SETTINGS['bigControlPanel'] || $this->table) ? 1 : 0; 00214 $dblist->localizationView = $this->MOD_SETTINGS['localization']; 00215 $dblist->showClipboard = 1; 00216 $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView']; 00217 $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView']; 00218 $dblist->hideTables = $this->modTSconfig['properties']['hideTables']; 00219 $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode']; 00220 $dblist->alternateBgColors=$this->modTSconfig['properties']['alternateBgColors']?1:0; 00221 $dblist->allowedNewTables = t3lib_div::trimExplode(',',$this->modTSconfig['properties']['allowedNewTables'],1); 00222 $dblist->newWizards=$this->modTSconfig['properties']['newWizards']?1:0; 00223 00224 00225 00226 // Clipboard is initialized: 00227 $dblist->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard 00228 $dblist->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session 00229 00230 // Clipboard actions are handled: 00231 $CB = t3lib_div::_GET('CB'); // CB is the clipboard command array 00232 if ($this->cmd=='setCB') { 00233 // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. By merging we get a full array of checked/unchecked elements 00234 // This is set to the 'el' array of the CB after being parsed so only the table in question is registered. 00235 $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array)t3lib_div::_POST('CBH'),(array)t3lib_div::_POST('CBC')),$this->cmd_table); 00236 } 00237 if (!$this->MOD_SETTINGS['clipBoard']) $CB['setP']='normal'; // If the clipboard is NOT shown, set the pad to 'normal'. 00238 $dblist->clipObj->setCmd($CB); // Execute commands. 00239 $dblist->clipObj->cleanCurrent(); // Clean up pad 00240 $dblist->clipObj->endClipboard(); // Save the clipboard content 00241 00242 // This flag will prevent the clipboard panel in being shown. 00243 // It is set, if the clickmenu-layer is active AND the extended view is not enabled. 00244 $dblist->dontShowClipControlPanels = $CLIENT['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current=='normal' && !$BE_USER->uc['disableCMlayers'] && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers']; 00245 00246 00247 00248 // If there is access to the page, then render the list contents and set up the document template object: 00249 if ($access) { 00250 00251 // Deleting records...: 00252 // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table. 00253 if ($this->cmd=='delete') { 00254 $items = $dblist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'),$this->cmd_table,1); 00255 if (count($items)) { 00256 $cmd=array(); 00257 reset($items); 00258 while(list($iK)=each($items)) { 00259 $iKParts = explode('|',$iK); 00260 $cmd[$iKParts[0]][$iKParts[1]]['delete']=1; 00261 } 00262 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 00263 $tce->stripslashes_values=0; 00264 $tce->start(array(),$cmd); 00265 $tce->process_cmdmap(); 00266 00267 if (isset($cmd['pages'])) { 00268 t3lib_BEfunc::getSetUpdateSignal('updatePageTree'); 00269 } 00270 00271 $tce->printLogErrorMessages(t3lib_div::getIndpEnv('REQUEST_URI')); 00272 } 00273 } 00274 00275 // Initialize the listing object, dblist, for rendering the list: 00276 $this->pointer = t3lib_div::intInRange($this->pointer,0,100000); 00277 $dblist->start($this->id,$this->table,$this->pointer,$this->search_field,$this->search_levels,$this->showLimit); 00278 $dblist->setDispFields(); 00279 00280 // Render the page header: 00281 $dblist->writeTop($this->pageinfo); 00282 00283 // Render versioning selector: 00284 $dblist->HTMLcode.= $this->doc->getVersionSelector($this->id); 00285 00286 // Render the list of tables: 00287 $dblist->generateList(); 00288 00289 // Write the bottom of the page: 00290 $dblist->writeBottom(); 00291 00292 // Add JavaScript functions to the page: 00293 $this->doc->JScode=$this->doc->wrapScriptTags(' 00294 function jumpToUrl(URL) { // 00295 window.location.href = URL; 00296 return false; 00297 } 00298 function jumpExt(URL,anchor) { // 00299 var anc = anchor?anchor:""; 00300 window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc; 00301 return false; 00302 } 00303 function jumpSelf(URL) { // 00304 window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:""); 00305 return false; 00306 } 00307 00308 function setHighlight(id) { // 00309 top.fsMod.recentIds["web"]=id; 00310 top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting 00311 00312 if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { 00313 top.content.nav_frame.refresh_nav(); 00314 } 00315 } 00316 '.$this->doc->redirectUrls($dblist->listURL()).' 00317 '.$dblist->CBfunctions().' 00318 function editRecords(table,idList,addParams,CBflag) { // 00319 window.location.href="'.$BACK_PATH.'alt_doc.php?returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')). 00320 '&edit["+table+"]["+idList+"]=edit"+addParams; 00321 } 00322 function editList(table,idList) { // 00323 var list=""; 00324 00325 // Checking how many is checked, how many is not 00326 var pointer=0; 00327 var pos = idList.indexOf(","); 00328 while (pos!=-1) { 00329 if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) { 00330 list+=idList.substr(pointer,pos-pointer)+","; 00331 } 00332 pointer=pos+1; 00333 pos = idList.indexOf(",",pointer); 00334 } 00335 if (cbValue(table+"|"+idList.substr(pointer))) { 00336 list+=idList.substr(pointer)+","; 00337 } 00338 00339 return list ? list : idList; 00340 } 00341 00342 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).'; 00343 '); 00344 00345 // Setting up the context sensitive menu: 00346 $CMparts=$this->doc->getContextMenuCode(); 00347 $this->doc->bodyTagAdditions = $CMparts[1]; 00348 $this->doc->JScode.=$CMparts[0]; 00349 $this->doc->postCode.= $CMparts[2]; 00350 } // access 00351 00352 00353 00354 // Begin to compile the whole page, starting out with page header: 00355 $this->content=''; 00356 $this->content.=$this->doc->startPage('DB list'); 00357 $this->content.= '<form action="'.htmlspecialchars($dblist->listURL()).'" method="post" name="dblistForm">'; 00358 00359 // List Module CSH: 00360 if (!strlen($this->id)) { 00361 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module_noId', $GLOBALS['BACK_PATH'],'<br/>|'); 00362 } elseif (!$this->id) { // zero...: 00363 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module_root', $GLOBALS['BACK_PATH'],'<br/>|'); 00364 } 00365 00366 // Add listing HTML code: 00367 $this->content.= $dblist->HTMLcode; 00368 $this->content.= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>'; 00369 00370 // List Module CSH: 00371 if ($this->id) { 00372 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module', $GLOBALS['BACK_PATH'],'<br/>|'); 00373 } 00374 00375 00376 // If a listing was produced, create the page footer with search form etc: 00377 if ($dblist->HTMLcode) { 00378 00379 // Making field select box (when extended view for a single table is enabled): 00380 if ($dblist->table) { 00381 $this->content.=$dblist->fieldSelectBox($dblist->table); 00382 } 00383 00384 // Adding checkbox options for extended listing and clipboard display: 00385 $this->content.=' 00386 00387 <!-- 00388 Listing options for clipboard and thumbnails 00389 --> 00390 <div id="typo3-listOptions"> 00391 <form action="" method="post">'; 00392 00393 $this->content.=t3lib_BEfunc::getFuncCheck($this->id,'SET[bigControlPanel]',$this->MOD_SETTINGS['bigControlPanel'],'db_list.php',($this->table?'&table='.$this->table:'')).' '.$LANG->getLL('largeControl',1).'<br />'; 00394 if ($dblist->showClipboard) { 00395 $this->content.=t3lib_BEfunc::getFuncCheck($this->id,'SET[clipBoard]',$this->MOD_SETTINGS['clipBoard'],'db_list.php',($this->table?'&table='.$this->table:'')).' '.$LANG->getLL('showClipBoard',1).'<br />'; 00396 } 00397 $this->content.=t3lib_BEfunc::getFuncCheck($this->id,'SET[localization]',$this->MOD_SETTINGS['localization'],'db_list.php',($this->table?'&table='.$this->table:'')).' '.$LANG->getLL('localization',1).'<br />'; 00398 $this->content.=' 00399 </form> 00400 </div>'; 00401 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_options', $GLOBALS['BACK_PATH']); 00402 00403 // Printing clipboard if enabled: 00404 if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) { 00405 $this->content.= $dblist->clipObj->printClipboard(); 00406 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_clipboard', $GLOBALS['BACK_PATH']); 00407 } 00408 00409 // Link for creating new records: 00410 if (!$this->modTSconfig['properties']['noCreateRecordsLink']) { 00411 $this->content.=' 00412 00413 <!-- 00414 Link for creating a new record: 00415 --> 00416 <div id="typo3-newRecordLink"> 00417 <a href="'.htmlspecialchars('db_new.php?id='.$this->id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'. 00418 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/new_el.gif','width="11" height="12"').' alt="" />'. 00419 $LANG->getLL('newRecordGeneral',1). 00420 '</a> 00421 </div>'; 00422 } 00423 00424 // Search box: 00425 $this->content.=$dblist->getSearchBox(); 00426 00427 // Display sys-notes, if any are found: 00428 $this->content.=$dblist->showSysNotesForPage(); 00429 00430 // ShortCut: 00431 if ($BE_USER->mayMakeShortcut()) { 00432 $this->content.='<br/>'.$this->doc->makeShortcutIcon('id,imagemode,pointer,table,search_field,search_levels,showLimit,sortField,sortRev',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']); 00433 } 00434 } 00435 00436 // Finally, close off the page: 00437 $this->content.= $this->doc->endPage(); 00438 } 00439 00445 function printContent() { 00446 echo $this->content; 00447 } 00448 } 00449 00450 // Include extension? 00451 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/db_list.php']) { 00452 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/db_list.php']); 00453 } 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 // Make instance: 00467 $SOBE = t3lib_div::makeInstance('SC_db_list'); 00468 $SOBE->init(); 00469 00470 // Include files? 00471 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE); 00472 00473 $SOBE->clearCache(); 00474 $SOBE->main(); 00475 $SOBE->printContent(); 00476 ?>