Documentation TYPO3 par Ameos

class.db_list_extra.inc

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 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 ***************************************************************/
00090 class localRecordList extends recordList {
00091 
00092                 // External:
00093         var $alternateBgColors=FALSE;                   // If true, table rows in the list will alternate in background colors (and have background colors at all!)
00094         var $allowedNewTables=array();                  // Used to indicate which tables (values in the array) that can have a create-new-record link. If the array is empty, all tables are allowed.
00095         var $newWizards=FALSE;                                  // If true, the control panel will contain links to the create-new wizards for pages and tt_content elements (normally, the link goes to just creating a new element without the wizards!).
00096 
00097         var $dontShowClipControlPanels=FALSE;   // If true, will disable the rendering of clipboard + control panels.
00098         var $showClipboard=FALSE;                               // If true, will show the clipboard in the field list.
00099         var $noControlPanels = FALSE;                   // If true, will DISABLE all control panels in lists. (Takes precedence)
00100         var $clickMenuEnabled = TRUE;                   // If true, clickmenus will be rendered
00101 
00102 
00103 
00104 
00105                 // Internal:
00106         var $pageRow=array();                                   // Set to the page record (see writeTop())
00107 
00108         var $csvLines=array();                                  // Used to accumulate CSV lines in for CSV export.
00109         var $csvOutput=FALSE;                                   // If set, the listing is returned as CSV instead.
00110 
00111         var $clipObj;                                                   // Clipboard object
00112         var $CBnames=array();                                   // Tracking names of elements (for clipboard use)
00113         var $duplicateStack=array();                    // Used to track which elements has duplicates and how many
00114 
00115 
00122         function writeTop($row) {
00123                 global $LANG;
00124 
00125                         // Makes the code for the pageicon in the top
00126                 $this->pageRow = $row;
00127                 $this->counter++;
00128                 $alttext = t3lib_BEfunc::getRecordIconAltText($row,'pages');
00129                 $iconImg = t3lib_iconWorks::getIconImage('pages',$row,$this->backPath,'class="absmiddle" title="'.htmlspecialchars($alttext).'"');
00130                 $titleCol = 'test';     // pseudo title column name
00131                 $this->fieldArray = Array($titleCol,'up');              // Setting the fields to display in the list (this is of course "pseudo fields" since this is the top!)
00132 
00133 
00134                         // Filling in the pseudo data array:
00135                 $theData = Array();
00136                 $theData[$titleCol] = $this->widthGif;
00137 
00138                         // Get users permissions for this row:
00139                 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms($row);
00140 
00141                 $theData['up']=array();
00142 
00143                         // Initialize control panel for currect page ($this->id):
00144                         // Some of the controls are added only if $this->id is set - since they make sense only on a real page, not root level.
00145                 $theCtrlPanel =array();
00146 
00147                         // "View page" icon is added:
00148                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id,'',t3lib_BEfunc::BEgetRootLine($this->id))).'">'.
00149                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'" alt="" />'.
00150                                                 '</a>';
00151 
00152                         // If edit permissions are set (see class.t3lib_userauthgroup.php)
00153                 if ($localCalcPerms&2)  {
00154 
00155                                 // Adding "Edit page" icon:
00156                         if ($this->id)  {
00157                                 $params='&edit[pages]['.$row['uid'].']=edit';
00158                                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00159                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('editPage',1).'" alt="" />'.
00160                                                                 '</a>';
00161                         }
00162 
00163                                 // Adding "New record" icon:
00164                         if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink'])        {
00165                                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\'db_new.php?id='.$this->id.'\');').'">'.
00166                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/new_el.gif','width="11" height="12"').' title="'.$LANG->getLL('newRecordGeneral',1).'" alt="" />'.
00167                                                                 '</a>';
00168                         }
00169 
00170                                 // Adding "Hide/Unhide" icon:
00171                         if ($this->id)  {
00172                                 if ($row['hidden'])     {
00173                                         $params='&data[pages]['.$row['uid'].'][hidden]=0';
00174                                         $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$GLOBALS['SOBE']->doc->issueCommand($params,-1).'\');').'">'.
00175                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$LANG->getLL('unHidePage',1).'" alt="" />'.
00176                                                                         '</a>';
00177                                 } else {
00178                                         $params='&data[pages]['.$row['uid'].'][hidden]=1';
00179                                         $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$GLOBALS['SOBE']->doc->issueCommand($params,-1).'\');').'">'.
00180                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$LANG->getLL('hidePage',1).'" alt="" />'.
00181                                                                         '</a>';
00182                                 }
00183                         }
00184 
00185                                 // Adding "move page" button:
00186                         if ($this->id)  {
00187                                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\'move_el.php?table=pages&uid='.$row['uid'].'\');').'">'.
00188                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/move_'.($table=='tt_content'?'record':'page').'.gif','width="11" height="12"').' title="'.$LANG->getLL('move_page',1).'" alt="" />'.
00189                                                                 '</a>';
00190                         }
00191                 }
00192 
00193                         // "Paste into page" link:
00194                 if (($localCalcPerms&8) || ($localCalcPerms&16))        {
00195                         $elFromTable = $this->clipObj->elFromTable('');
00196                         if (count($elFromTable))        {
00197                                 $theCtrlPanel[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('',$this->id)).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg('pages',$this->pageRow,'into',$elFromTable)).'">'.
00198                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_paste',1).'" alt="" />'.
00199                                                                 '</a>';
00200                         }
00201                 }
00202 
00203                         // Finally, compile all elements of the control panel into table cells:
00204                 if (count($theCtrlPanel))       {
00205                         $theData['up'][]='
00206 
00207                                 <!--
00208                                         Control panel for page
00209                                 -->
00210                                 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-ctrltop">
00211                                         <tr>
00212                                                 <td>'.implode('</td>
00213                                                 <td>',$theCtrlPanel).'</td>
00214                                         </tr>
00215                                 </table>';
00216                 }
00217 
00218 
00219                         // Add "clear-cache" link:
00220                 $theData['up'][]='<a href="'.htmlspecialchars($this->listURL().'&clear_cache=1').'">'.
00221                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clear_cache.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache',1).'" alt="" />'.
00222                                                 '</a>';
00223 
00224                         // Add "CSV" link, if a specific table is shown:
00225                 if ($this->table)       {
00226                         $theData['up'][]='<a href="'.htmlspecialchars($this->listURL().'&csv=1').'">'.
00227                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/csv.gif','width="27" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.csv',1).'" alt="" />'.
00228                                                         '</a>';
00229                 }
00230 
00231                         // Add "refresh" link:
00232                 $theData['up'][]='<a href="'.htmlspecialchars($this->listURL()).'">'.
00233                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/refresh_n.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.reload',1).'" alt="" />'.
00234                                                 '</a>';
00235 
00236 
00237                         // Add icon with clickmenu, etc:
00238                 if ($this->id)  {       // If there IS a real page...:
00239 
00240                                 // Setting title of page + the "Go up" link:
00241                         $theData[$titleCol].='<br /><span title="'.htmlspecialchars($row['_thePathFull']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($row['_thePath'],-$this->fixedL)).'</span>';
00242                         $theData['up'][]='<a href="'.htmlspecialchars($this->listURL($row['pid'])).'">'.
00243                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/pages_up.gif','width="18" height="16"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" />'.
00244                                                         '</a>';
00245 
00246                                 // Make Icon:
00247                         $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,'pages',$this->id) : $iconImg;
00248                 } else {        // On root-level of page tree:
00249 
00250                                 // Setting title of root (sitename):
00251                         $theData[$titleCol].='<br />'.htmlspecialchars(t3lib_div::fixed_lgd_cs($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],-$this->fixedL));
00252 
00253                                 // Make Icon:
00254                         $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' alt="" />';
00255                 }
00256 
00257                         // If there is a returnUrl given, add a back-link:
00258                 if ($this->returnUrl)   {
00259                         $theData['up'][]='<a href="'.htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl,array('id'=>$this->id))).'" class="typo3-goBack">'.
00260                                                         '<img'.t3lib_iconWorks::skinImg($GLOBALS["BACK_PATH"],'gfx/goback.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack',1).'" alt="" />'.
00261                                                         '</a>';
00262                 }
00263 
00264                         // Finally, the "up" pseudo field is compiled into a table - has been accumulated in an array:
00265                 $theData['up']='
00266                         <table border="0" cellpadding="0" cellspacing="0">
00267                                 <tr>
00268                                         <td>'.implode('</td>
00269                                         <td>',$theData['up']).'</td>
00270                                 </tr>
00271                         </table>';
00272 
00273                         // ... and the element row is created:
00274                 $out.=$this->addelement(1,$theIcon,$theData,'',$this->leftMargin);
00275 
00276                         // ... and wrapped into a table and added to the internal ->HTMLcode variable:
00277                 $this->HTMLcode.='
00278 
00279 
00280                 <!--
00281                         Page header for db_list:
00282                 -->
00283                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-dblist-top">
00284                                 '.$out.'
00285                         </table>';
00286         }
00287 
00296         function getTable($table,$id,$rowlist)  {
00297                 global $TCA;
00298 
00299                         // Loading all TCA details for this table:
00300                 t3lib_div::loadTCA($table);
00301 
00302                         // Init
00303                 $addWhere = '';
00304                 $titleCol = $TCA[$table]['ctrl']['label'];
00305                 $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
00306                 $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
00307 
00308                         // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
00309                 $this->fieldArray=array();
00310                 $this->fieldArray[] = $titleCol;        // Add title column
00311                 if ($this->localizationView && $l10nEnabled)    {
00312                         $this->fieldArray[] = '_LOCALIZATION_';
00313                         $addWhere.=' AND '.$TCA[$table]['ctrl']['languageField'].'<=0';
00314                 }
00315                 if (!t3lib_div::inList($rowlist,'_CONTROL_'))   {
00316                         $this->fieldArray[] = '_CONTROL_';
00317                 }
00318                 if ($this->showClipboard)       {
00319                         $this->fieldArray[] = '_CLIPBOARD_';
00320                 }
00321                 if ($this->searchLevels)        {
00322                         $this->fieldArray[]='_PATH_';
00323                 }
00324                         // Cleaning up:
00325                 $this->fieldArray=array_unique(array_merge($this->fieldArray,t3lib_div::trimExplode(',',$rowlist,1)));
00326                 if ($this->noControlPanels)     {
00327                         $tempArray = array_flip($this->fieldArray);
00328                         unset($tempArray['_CONTROL_']);
00329                         unset($tempArray['_CLIPBOARD_']);
00330                         $this->fieldArray = array_keys($tempArray);
00331                 }
00332 
00333                         // Creating the list of fields to include in the SQL query:
00334                 $selectFields = $this->fieldArray;
00335                 $selectFields[] = 'uid';
00336                 $selectFields[] = 'pid';
00337                 if ($thumbsCol) $selectFields[] = $thumbsCol;   // adding column for thumbnails
00338                 if ($table=='pages')    {
00339                         if (t3lib_extMgm::isLoaded('cms'))      {
00340                                 $selectFields[] = 'module';
00341                                 $selectFields[] = 'extendToSubpages';
00342                         }
00343                         $selectFields[] = 'doktype';
00344                 }
00345                 if (is_array($TCA[$table]['ctrl']['enablecolumns']))    {
00346                         $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
00347                 }
00348                 if ($TCA[$table]['ctrl']['type'])       {
00349                         $selectFields[] = $TCA[$table]['ctrl']['type'];
00350                 }
00351                 if ($TCA[$table]['ctrl']['typeicon_column'])    {
00352                         $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
00353                 }
00354                 if ($TCA[$table]['ctrl']['versioning']) {
00355                         $selectFields[] = 't3ver_id';
00356                 }
00357                 if ($l10nEnabled)       {
00358                         $selectFields[] = $TCA[$table]['ctrl']['languageField'];
00359                         $selectFields[] = $TCA[$table]['ctrl']['transOrigPointerField'];
00360                 }
00361                 if ($TCA[$table]['ctrl']['label_alt'])  {
00362                         $selectFields = array_merge($selectFields,t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1));
00363                 }
00364                 $selectFields = array_unique($selectFields);            // Unique list!
00365                 $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1));          // Making sure that the fields in the field-list ARE in the field-list from TCA!
00366                 $selFieldList = implode(',',$selectFields);             // implode it into a list of fields for the SQL-statement.
00367 
00368                         // Create the SQL query for selecting the elements in the listing:
00369                 $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList);       // (API function from class.db_list.inc)
00370                 $this->setTotalItems($queryParts);              // Finding the total amount of records on the page (API function from class.db_list.inc)
00371 
00372                         // Init:
00373                 $dbCount = 0;
00374                 $out = '';
00375 
00376                         // If the count query returned any number of records, we perform the real query, selecting records.
00377                 if ($this->totalItems)  {
00378                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00379                         $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00380                 }
00381 
00382                 $LOISmode = $this->listOnlyInSingleTableMode && !$this->table;
00383 
00384                         // If any records was selected, render the list:
00385                 if ($dbCount)   {
00386 
00387                                 // Half line is drawn between tables:
00388                         if (!$LOISmode) {
00389                                 $theData = Array();
00390                                 if (!$this->table && !$rowlist) {
00391                                         $theData[$titleCol] = '<img src="clear.gif" width="'.($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel']?'230':'350').'" height="1" alt="" />';
00392                                         if (in_array('_CONTROL_',$this->fieldArray))    $theData['_CONTROL_']='';
00393                                         if (in_array('_CLIPBOARD_',$this->fieldArray))  $theData['_CLIPBOARD_']='';
00394                                 }
00395                                 $out.=$this->addelement(0,'',$theData,'',$this->leftMargin);
00396                         }
00397 
00398                                 // Header line is drawn
00399                         $theData = Array();
00400                         if ($this->disableSingleTableView)      {
00401                                 $theData[$titleCol] = '<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.')';
00402                         } else {
00403                                 $theData[$titleCol] = $this->linkWrapTable($table,'<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.') <img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/'.($this->table?'minus':'plus').'bullet_list.gif','width="18" height="12"').' hspace="10" class="absmiddle" title="'.$GLOBALS['LANG']->getLL(!$this->table?'expandView':'contractView',1).'" alt="" />');
00404                         }
00405 
00406                                 // CSH:
00407                         $theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
00408 
00409                         if ($LOISmode)  {
00410                                 $out.='
00411                                         <tr>
00412                                                 <td class="c-headLineTable" style="width:95%;">'.$theData[$titleCol].'</td>
00413                                         </tr>';
00414 
00415                                 if ($GLOBALS['BE_USER']->uc["edit_showFieldHelp"])      {
00416                                         $GLOBALS['LANG']->loadSingleTableDescription($table);
00417                                         if (isset($GLOBALS['TCA_DESCR'][$table]['columns']['']))        {
00418                                                 $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$table.'.\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
00419                                                 $out.='
00420                                         <tr>
00421                                                 <td class="c-tableDescription">'.t3lib_BEfunc::helpTextIcon($table,'',$this->backPath,TRUE).$GLOBALS['TCA_DESCR'][$table]['columns']['']['description'].'</td>
00422                                         </tr>';
00423                                         }
00424                                 }
00425                         } else {
00426                                 $theUpIcon = ($table=='pages'&&$this->id&&isset($this->pageRow['pid'])) ? '<a href="'.htmlspecialchars($this->listURL($this->pageRow['pid'])).'"><img'.t3lib_iconWorks::skinImg('','gfx/i/pages_up.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" /></a>':'';
00427                                 $out.=$this->addelement(1,$theUpIcon,$theData,' class="c-headLineTable"','');
00428                         }
00429 
00430                         If (!$LOISmode) {
00431                                         // Fixing a order table for sortby tables
00432                                 $this->currentTable = array();
00433                                 $currentIdList = array();
00434                                 $doSort = ($TCA[$table]['ctrl']['sortby'] && !$this->sortField);
00435 
00436                                 $prevUid = 0;
00437                                 $prevPrevUid = 0;
00438                                 $accRows = array();     // Accumulate rows here
00439                                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))    {
00440                                         $accRows[] = $row;
00441                                         $currentIdList[] = $row['uid'];
00442                                         if ($doSort)    {
00443                                                 if ($prevUid)   {
00444                                                         $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
00445                                                         $this->currentTable['next'][$prevUid] = '-'.$row['uid'];
00446                                                         $this->currentTable['prevUid'][$row['uid']] = $prevUid;
00447                                                 }
00448                                                 $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
00449                                                 $prevUid=$row['uid'];
00450                                         }
00451                                 }
00452                                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
00453 
00454                                         // CSV initiated
00455                                 if ($this->csvOutput) $this->initCSV();
00456 
00457                                         // Render items:
00458                                 $this->CBnames=array();
00459                                 $this->duplicateStack=array();
00460                                 $this->eCounter=$this->firstElementNumber;
00461 
00462                                 $iOut = '';
00463                                 $cc = 0;
00464                                 foreach($accRows as $row)       {
00465 
00466                                                 // Forward/Backwards navigation links:
00467                                         list($flag,$code) = $this->fwd_rwd_nav($table);
00468                                         $iOut.=$code;
00469 
00470                                                 // If render item, increment counter and call function
00471                                         if ($flag)      {
00472                                                 $cc++;
00473                                                 $iOut.=$this->renderListRow($table,$row,$cc,$titleCol,$thumbsCol);
00474 
00475                                                         // If localization view is enabled it means that the selected records are either default or All language and here we will not select translations which point to the main record:
00476                                                 if ($this->localizationView && $l10nEnabled)    {
00477 
00478                                                                 // Look for translations of this record:
00479                                                         $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00480                                                                 $selFieldList,
00481                                                                 $table,
00482                                                                 'pid='.$row['pid'].
00483                                                                         ' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
00484                                                                         ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
00485                                                                         t3lib_BEfunc::deleteClause($table)
00486                                                         );
00487 
00488                                                                 // For each available translation, render the record:
00489                                                         foreach($translations as $lRow) {
00490                                                                 $iOut.=$this->renderListRow($table,$lRow,$cc,$titleCol,$thumbsCol,18);
00491                                                         }
00492                                                 }
00493                                         }
00494 
00495                                                 // Counter of total rows incremented:
00496                                         $this->eCounter++;
00497                                 }
00498 
00499                                         // The header row for the table is now created:
00500                                 $out.=$this->renderListHeader($table,$currentIdList);
00501                         }
00502 
00503                                 // The list of records is added after the header:
00504                         $out.=$iOut;
00505 
00506                                 // ... and it is all wrapped in a table:
00507                         $out='
00508 
00509 
00510 
00511                         <!--
00512                                 DB listing of elements: "'.htmlspecialchars($table).'"
00513                         -->
00514                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist'.($LOISmode?' typo3-dblist-overview':'').'">
00515                                         '.$out.'
00516                                 </table>';
00517 
00518                                 // Output csv if...
00519                         if ($this->csvOutput)   $this->outputCSV($table);       // This ends the page with exit.
00520                 }
00521 
00522                         // Return content:
00523                 return $out;
00524         }
00525 
00539         function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)  {
00540                 $iOut = '';
00541 
00542                         // Background color, if any:
00543                 $row_bgColor=
00544                         $this->alternateBgColors ?
00545                         (($cc%2)?'' :' bgcolor="'.t3lib_div::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4,+10,+10,+10).'"') :
00546                         '';
00547 
00548                         // Initialization
00549                 $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
00550                 $recTitle = t3lib_BEfunc::getRecordTitle($table,$row);
00551 
00552                         // Incr. counter.
00553                 $this->counter++;
00554 
00555                         // The icon with link
00556                 $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($alttext).'"'.($indent ? ' style="margin-left: '.$indent.'px;"' : ''));
00557                 $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']) : $iconImg;
00558 
00559                         // Preparing and getting the data-array
00560                 $theData = Array();
00561                 foreach($this->fieldArray as $fCol)     {
00562                         if ($fCol==$titleCol)   {
00563                                 $theData[$fCol] = $this->linkWrapItems($table,$row['uid'],$recTitle,$row);
00564                         } elseif ($fCol=='pid') {
00565                                 $theData[$fCol]=$row[$fCol];
00566                         } elseif ($fCol=='_PATH_') {
00567                                 $theData[$fCol]=$this->recPath($row['pid']);
00568                         } elseif ($fCol=='_CONTROL_') {
00569                                 $theData[$fCol]=$this->makeControl($table,$row);
00570                         } elseif ($fCol=='_CLIPBOARD_') {
00571                                 $theData[$fCol]=$this->makeClip($table,$row);
00572                         } elseif ($fCol=='_LOCALIZATION_') {
00573                                 $theData[$fCol]=$this->makeLocalizationPanel($table,$row);
00574                         } else {
00575                                 $theData[$fCol]=htmlspecialchars(t3lib_BEfunc::getProcessedValueExtra($table,$fCol,$row[$fCol],100));
00576                         }
00577                 }
00578 
00579                         // Add row to CSV list:
00580                 if ($this->csvOutput) $this->addToCSV($row);
00581 
00582                         // Create element in table cells:
00583                 $iOut.=$this->addelement(1,$theIcon,$theData,$row_bgColor);
00584 
00585                         // Render thumbsnails if a thumbnail column exists and there is content in it:
00586                 if ($this->thumbs && trim($row[$thumbsCol]))    {
00587                         $iOut.=$this->addelement(4,'', Array($titleCol=>$this->thumbCode($row,$table,$thumbsCol)),$row_bgColor);
00588                 }
00589 
00590                         // Finally, return table row element:
00591                 return $iOut;
00592         }
00593 
00603         function renderListHeader($table,$currentIdList)        {
00604                 global $TCA, $LANG;
00605 
00606                         // Init:
00607                 $theData = Array();
00608 
00609                         // Traverse the fields:
00610                 foreach($this->fieldArray as $fCol)     {
00611 
00612                                 // Calculate users permissions to edit records in the table:
00613                         $permsEdit = $this->calcPerms & ($table=='pages'?2:16);
00614 
00615                         switch((string)$fCol)   {
00616                                 case '_PATH_':                  // Path
00617                                         $theData[$fCol]='<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_',1).']</i>';
00618                                 break;
00619                                 case '_LOCALIZATION_':                  // Path
00620                                         $theData[$fCol]='<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_',1).']</i>';
00621                                 break;
00622                                 case '_CLIPBOARD_':             // Clipboard:
00623                                         $cells=array();
00624 
00625                                                 // If there are elements on the clipboard for this table, then display the "paste into" icon:
00626                                         $elFromTable = $this->clipObj->elFromTable($table);
00627                                         if (count($elFromTable))        {
00628                                                 $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,$this->id)).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg('pages',$this->pageRow,'into',$elFromTable)).'">'.
00629                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_paste',1).'" alt="" />'.
00630                                                                 '</a>';
00631                                         }
00632 
00633                                                 // If the numeric clipboard pads are enabled, display the control icons for that:
00634                                         if ($this->clipObj->current!='normal')  {
00635 
00636                                                         // The "select" link:
00637                                                 $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg('','gfx/clip_copy.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_selectMarked',1).'" alt="" />',$table,'setCB');
00638 
00639                                                         // The "edit marked" link:
00640                                                 $editIdList = implode(',',$currentIdList);
00641                                                 $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00642                                                 $params='&edit['.$table.']['.$editIdList.']=edit&disHelp=1';
00643                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00644                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('clip_editMarked',1).'" alt="" />'.
00645                                                                 '</a>';
00646 
00647                                                         // The "Delete marked" link:
00648                                                 $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg('','gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('clip_deleteMarked',1).'" alt="" />',$table,'delete',sprintf($LANG->getLL('clip_deleteMarkedWarning'),$LANG->sL($TCA[$table]['ctrl']['title'])));
00649 
00650                                                         // The "Select all" link:
00651                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('checkOffCB(\''.implode(',',$this->CBnames).'\'); return false;').'">'.
00652                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_select.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_markRecords',1).'" alt="" />'.
00653                                                                 '</a>';
00654                                         } else {
00655                                                 $cells[]='';
00656                                         }
00657                                         $theData[$fCol]=implode('',$cells);
00658                                 break;
00659                                 case '_CONTROL_':               // Control panel:
00660                                         if (!$TCA[$table]['ctrl']['readOnly'])  {
00661 
00662                                                         // If new records can be created on this page, add links:
00663                                                 if ($this->calcPerms&($table=='pages'?8:16) && $this->showNewRecLink($table))   {
00664                                                         if ($table=="tt_content" && $this->newWizards)  {
00665                                                                         //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00666                                                                 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00667                                                                 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00668                                                                 $newContentWizScriptPath = t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
00669 
00670                                                                 $theData[$fCol]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$newContentWizScriptPath.'?id='.$this->id.'\');').'">'.
00671                                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
00672                                                                                                 '</a>';
00673                                                         } elseif ($table=='pages' && $this->newWizards) {
00674                                                                 $theData[$fCol]='<a href="'.htmlspecialchars('db_new.php?id='.$this->id.'&pagesOnly=1returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00675                                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
00676                                                                                                 '</a>';
00677                                                         } else {
00678                                                                 $params='&edit['.$table.']['.$this->id.']=new';
00679                                                                 $theData[$fCol]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00680                                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
00681                                                                                                 '</a>';
00682                                                         }
00683                                                 }
00684 
00685                                                         // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
00686                                                 if ($permsEdit && $this->table && is_array($currentIdList))     {
00687                                                         $editIdList = implode(',',$currentIdList);
00688                                                         if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00689                                                         $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.implode(',',$this->fieldArray).'&disHelp=1';
00690                                                         $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00691                                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('editShownColumns',1).'" alt="" />'.
00692                                                                                         '</a>';
00693                                                 }
00694                                         }
00695                                 break;
00696                                 default:                        // Regular fields header:
00697                                         $theData[$fCol]='';
00698                                         if ($this->table && is_array($currentIdList))   {
00699 
00700                                                         // If the numeric clipboard pads are selected, show duplicate sorting link:
00701                                                 if ($this->clipNumPane()) {
00702                                                         $theData[$fCol].='<a href="'.htmlspecialchars($this->listURL('',-1).'&duplicateField='.$fCol).'">'.
00703                                                                                         '<img'.t3lib_iconWorks::skinImg('','gfx/select_duplicates.gif','width="11" height="11"').' title="'.$LANG->getLL('clip_duplicates',1).'" alt="" />'.
00704                                                                                         '</a>';
00705                                                 }
00706 
00707                                                         // If the table can be edited, add link for editing THIS field for all listed records:
00708                                                 if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol])  {
00709                                                         $editIdList = implode(',',$currentIdList);
00710                                                         if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00711                                                         $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.$fCol.'&disHelp=1';
00712                                                         $iTitle = sprintf($LANG->getLL('editThisColumn'),ereg_replace(':$','',trim($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol)))));
00713                                                         $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00714                                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
00715                                                                                         '</a>';
00716                                                 }
00717                                         }
00718                                         $theData[$fCol].=$this->addSortLink($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol,'<i>[|]</i>')),$fCol,$table);
00719                                 break;
00720                         }
00721                 }
00722 
00723                         // Create and return header table row:
00724                 return $this->addelement(1,'',$theData,' class="c-headLine"','');
00725         }
00726 
00727 
00728 
00729 
00730 
00731 
00732         /*********************************
00733          *
00734          * Rendering of various elements
00735          *
00736          *********************************/
00737 
00745         function makeControl($table,$row)       {
00746                 global $TCA, $LANG, $SOBE;
00747 
00748                         // Return blank, if disabled:
00749                 if ($this->dontShowClipControlPanels)   return '';
00750 
00751                         // Initialize:
00752                 t3lib_div::loadTCA($table);
00753                 $cells=array();
00754 
00755                         // If the listed table is 'pages' we have to request the permission settings for each page:
00756                 if ($table=='pages')    {
00757                         $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$row['uid']));
00758                 }
00759 
00760                         // This expresses the edit permissions for this particular element:
00761                 $permsEdit = ($table=='pages' && ($localCalcPerms&2)) || ($table!='pages' && ($this->calcPerms&16));
00762 
00763                         // "Show" link (only pages and tt_content elements)
00764                 if ($table=='pages' || $table=='tt_content')    {
00765                         $params='&edit['.$table.']['.$row['uid'].']=edit';
00766                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($table=='tt_content'?$this->id.'#'.$row['uid']:$row['uid'])).'">'.
00767                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'" alt="" />'.
00768                                         '</a>';
00769                 }
00770 
00771                         // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
00772                 if ($permsEdit) {
00773                         $params='&edit['.$table.']['.$row['uid'].']=edit';
00774                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00775                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2'.(!$TCA[$table]['ctrl']['readOnly']?'':'_d').'.gif','width="11" height="12"').' title="'.$LANG->getLL('edit',1).'" alt="" />'.
00776                                         '</a>';
00777                 }
00778 
00779                         // "Move" wizard link for pages/tt_content elements:
00780                 if (($table=="tt_content" && $permsEdit) || ($table=='pages'))  {
00781                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\'move_el.php?table='.$table.'&uid='.$row['uid'].'\');').'">'.
00782                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/move_'.($table=='tt_content'?'record':'page').'.gif','width="11" height="12"').' title="'.$LANG->getLL('move_'.($table=='tt_content'?'record':'page'),1).'" alt="" />'.
00783                                         '</a>';
00784                 }
00785 
00786                         // If the extended control panel is enabled OR if we are seeing a single table:
00787                 if ($SOBE->MOD_SETTINGS['bigControlPanel'] || $this->table)     {
00788 
00789                                 // "Info": (All records)
00790                         $cells[]='<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$row['uid'].'\'); return false;').'">'.
00791                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('showInfo',1).'" alt="" />'.
00792                                         '</a>';
00793 
00794                                 // If the table is NOT a read-only table, then show these links:
00795                         if (!$TCA[$table]['ctrl']['readOnly'])  {
00796 
00797                                         // "Revert" link (history/undo)
00798                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\'show_rechis.php?element='.rawurlencode($table.':'.$row['uid']).'\',\'#latest\');').'">'.
00799                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/history2.gif','width="13" height="12"').' title="'.$LANG->getLL('history',1).'" alt="" />'.
00800                                                 '</a>';
00801 
00802                                         // Versioning:
00803                                 if (t3lib_extMgm::isLoaded('version'))  {
00804                                         $vers = t3lib_BEfunc::selectVersionsOfRecord($table, $row['uid'], $fields='uid');
00805                                         if (is_array($vers))    {       // If table can be versionized.
00806                                                 if (count($vers)>1)     {
00807                                                         $st = 'background-color: #FFFF00; font-weight: bold;';
00808                                                         $lab = count($vers)-1;
00809                                                 } else {
00810                                                         $st = 'background-color: #9999cc; font-weight: bold;';
00811                                                         $lab = 'V';
00812                                                 }
00813 
00814                                                 $cells[]='<a href="'.htmlspecialchars(t3lib_extMgm::extRelPath('version')).'cm1/index.php?table='.rawurlencode($table).'&uid='.rawurlencode($row['uid']).'" style="'.htmlspecialchars($st).'">'.
00815                                                                 $lab.
00816                                                                 '</a>';
00817                                         }
00818                                 }
00819 
00820                                         // "Edit Perms" link:
00821                                 if ($table=='pages' && $GLOBALS['BE_USER']->check('modules','web_perm'))        {
00822                                         $cells[]='<a href="'.htmlspecialchars('mod/web/perm/index.php?id='.$row['uid'].'&return_id='.$row['uid'].'&edit=1').'">'.
00823                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/perm.gif','width="7" height="12"').' title="'.$LANG->getLL('permissions',1).'" alt="" />'.
00824                                                         '</a>';
00825                                 }
00826 
00827                                         // "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record):
00828                                 if ($TCA[$table]['ctrl']['sortby'] || $TCA[$table]['ctrl']['useColumnsForDefaultValues'])       {
00829                                         if (
00830                                                 ($table!='pages' && ($this->calcPerms&16)) ||   // For NON-pages, must have permission to edit content on this parent page
00831                                                 ($table=='pages' && ($this->calcPerms&8))               // For pages, must have permission to create new pages here.
00832                                                 )       {
00833                                                 if ($this->showNewRecLink($table))      {
00834                                                         $params='&edit['.$table.']['.(-$row['uid']).']=new';
00835                                                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00836                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new'.($table=='pages'?'Page':'Record'),1).'" alt="" />'.
00837                                                                         '</a>';
00838                                                 }
00839                                         }
00840                                 }
00841 
00842                                         // "Up/Down" links
00843                                 if ($permsEdit && $TCA[$table]['ctrl']['sortby']  && !$this->sortField && !$this->searchLevels) {
00844                                         if (isset($this->currentTable['prev'][$row['uid']]))    {       // Up
00845                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prev'][$row['uid']];
00846                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00847                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"').' title="'.$LANG->getLL('moveUp',1).'" alt="" />'.
00848                                                                 '</a>';
00849                                         } else {
00850                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"',2).' alt="" />';
00851                                         }
00852                                         if ($this->currentTable['next'][$row['uid']])   {       // Down
00853                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['next'][$row['uid']];
00854                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00855                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"').' title="'.$LANG->getLL('moveDown',1).'" alt="" />'.
00856                                                                 '</a>';
00857                                         } else {
00858                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"',2).' alt="" />';
00859                                         }
00860                                 }
00861 
00862                                         // "Hide/Unhide" links:
00863                                 $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
00864                                 if ($permsEdit && $hiddenField && $TCA[$table]['columns'][$hiddenField] && (!$TCA[$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$table.':'.$hiddenField)))     {
00865                                         if ($row[$hiddenField]) {
00866                                                 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
00867                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00868                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$LANG->getLL('unHide'.($table=='pages'?'Page':''),1).'" alt="" />'.
00869                                                                 '</a>';
00870                                         } else {
00871                                                 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
00872                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00873                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$LANG->getLL('hide'.($table=='pages'?'Page':''),1).'" alt="" />'.
00874                                                                 '</a>';
00875                                         }
00876                                 }
00877 
00878                                         // "Delete" link:
00879                                 if (
00880                                         ($table=='pages' && ($localCalcPerms&4)) || ($table!='pages' && ($this->calcPerms&16))
00881                                         )       {
00882                                         $params='&cmd['.$table.']['.$row['uid'].'][delete]=1';
00883                                         $cells[]='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) {jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');} return false;').'">'.
00884                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('delete',1).'" alt="" />'.
00885                                                         '</a>';
00886                                 }
00887 
00888                                         // "Levels" links: Moving pages into new levels...
00889                                 if ($permsEdit && $table=='pages' && !$this->searchLevels)      {
00890 
00891                                                 // Up (Paste as the page right after the current parent page)
00892                                         if ($this->calcPerms&8) {
00893                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.-$this->id;
00894                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00895                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_left.gif','width="11" height="10"').' title="'.$LANG->getLL('prevLevel',1).'" alt="" />'.
00896                                                                 '</a>';
00897                                         }
00898                                                 // Down (Paste as subpage to the page right above)
00899                                         if ($this->currentTable['prevUid'][$row['uid']])        {
00900                                                 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$this->currentTable['prevUid'][$row['uid']]));
00901                                                 if ($localCalcPerms&8)  {
00902                                                         $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prevUid'][$row['uid']];
00903                                                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00904                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"').' title="'.$LANG->getLL('nextLevel',1).'" alt="" />'.
00905                                                                         '</a>';
00906                                                 } else {
00907                                                         $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"',2).' alt="" />';
00908                                                 }
00909                                         } else {
00910                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"',2).' alt="" />';
00911                                         }
00912                                 }
00913                         }
00914                 }
00915 
00916                         // If the record is edit-locked by another user, we will show a little warning sign:
00917                 if ($lockInfo=t3lib_BEfunc::isRecordLocked($table,$row['uid'])) {
00918                         $cells[]='<a href="#" onclick="'.htmlspecialchars('alert('.$LANG->JScharCode($lockInfo['msg']).');return false;').'">'.
00919                                         '<img'.t3lib_iconWorks::skinImg('','gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
00920                                         '</a>';
00921                 }
00922 
00923 
00924                         // Compile items into a DIV-element:
00925                 return '
00926                                                                                         <!-- CONTROL PANEL: '.$table.':'.$row['uid'].' -->
00927                                                                                         <div class="typo3-DBctrl">'.implode('',$cells).'</div>';
00928         }
00929 
00937         function makeClip($table,$row)  {
00938                 global $TCA, $LANG;
00939 
00940                         // Return blank, if disabled:
00941                 if ($this->dontShowClipControlPanels)   return '';
00942                 $cells=array();
00943 
00944                         // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
00945                 if ($this->clipObj->current=='normal')  {       // For the "Normal" pad:
00946 
00947                                 // Show copy/cut icons:
00948                         $isSel = (string)$this->clipObj->isSelected($table,$row['uid']);
00949                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'">'.
00950                                         '<img'.t3lib_iconWorks::skinImg('','gfx/clip_copy'.($isSel=='copy'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.copy',1).'" alt="" />'.
00951                                         '</a>';
00952                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'">'.
00953                                         '<img'.t3lib_iconWorks::skinImg('','gfx/clip_cut'.($isSel=='cut'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.cut',1).'" alt="" />'.
00954                                         '</a>';
00955 
00956                 } else {        // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
00957 
00958                                 // Setting name of the element in ->CBnames array:
00959                         $n=$table.'|'.$row['uid'];
00960                         $this->CBnames[]=$n;
00961 
00962                                 // Check if the current element is selected and if so, prepare to set the checkbox as selected:
00963                         $checked = ($this->clipObj->isSelected($table,$row['uid'])?' checked="checked"':'');
00964 
00965                                 // If the "duplicateField" value is set then select all elements which are duplicates...
00966                         if ($this->duplicateField && isset($row[$this->duplicateField]))        {
00967                                 $checked='';
00968                                 if (in_array($row[$this->duplicateField], $this->duplicateStack))       {
00969                                         $checked=' checked="checked"';
00970                                 }
00971                                 $this->duplicateStack[] = $row[$this->duplicateField];
00972                         }
00973 
00974                                 // Adding the checkbox to the panel:
00975                         $cells[]='<input type="hidden" name="CBH['.$n.']" value="0" /><input type="checkbox" name="CBC['.$n.']" value="1" class="smallCheckboxes"'.$checked.' />';
00976                 }
00977 
00978                         // Now, looking for selected elements from the current table:
00979                 $elFromTable = $this->clipObj->elFromTable($table);
00980                 if (count($elFromTable) && $TCA[$table]['ctrl']['sortby'])      {       // IF elements are found and they can be individually ordered, then add a "paste after" icon:
00981                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'">'.
00982                                         '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteAfter',1).'" alt="" />'.
00983                                         '</a>';
00984                 }
00985 
00986                         // Now, looking for elements in general:
00987                 $elFromTable = $this->clipObj->elFromTable('');
00988                 if ($table=='pages' && count($elFromTable))     {
00989                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('',$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'into',$elFromTable)).'">'.
00990                                         '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteinto.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteInto',1).'" alt="" />'.
00991                                         '</a>';
00992                 }
00993 
00994                         // Compile items into a DIV-element:
00995                 return '                                                        <!-- CLIPBOARD PANEL: '.$table.':'.$row['uid'].' -->
00996                                                                                         <div class="typo3-clipCtrl">'.implode('',$cells).'</div>';
00997         }
00998 
01006         function makeLocalizationPanel($table,$row)     {
01007                 global $TCA,$LANG;
01008 
01009                 $out = '';
01010                 if ($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'])   {
01011 
01012                                 // Language title and icon:
01013                         $out = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
01014 
01015                                 // Create new localizations links:
01016                         if ($row[$TCA[$table]['ctrl']['languageField']] <=0)    {
01017 
01018                                         // Look for translations of this record, index by language field value:
01019                                 $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01020                                         'uid,'.$TCA[$table]['ctrl']['languageField'],
01021                                         $table,
01022                                         'pid='.intval($this->id).
01023                                                 ' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
01024                                                 ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
01025                                                 t3lib_BEfunc::deleteClause($table),
01026                                         '',
01027                                         '',
01028                                         '',
01029                                         $TCA[$table]['ctrl']['languageField']
01030                                 );
01031 
01032                                         // Traverse page translations and add icon for each language that does NOT yet exist:
01033                                 $lNew = '';
01034                                 foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)        {
01035                                         if (!isset($translations[$lUid_OnPage]))        {
01036                                                 $href = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,$rUrl='');
01037 
01038                                                 $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
01039                                                 $lC = '<a href="'.htmlspecialchars($href).'">'.$lC.'</a> ';
01040 
01041                                                 $lNew.=$lC;
01042                                         }
01043                                 }
01044 
01045                                 if ($lNew)      $out.=' - '.$LANG->getLL('Localize',1).': '.$lNew;
01046                         } else {
01047                                 $out = '&nbsp;&nbsp;&nbsp;&nbsp;'.$out;
01048                         }
01049                 }
01050 
01051                 return $out;
01052         }
01053 
01061         function fieldSelectBox($table,$formFields=1)   {
01062                 global $TCA, $LANG;
01063 
01064                         // Init:
01065                 t3lib_div::loadTCA($table);
01066                 $formElements=array('','');
01067                 if ($formFields)        {
01068                         $formElements=array('<form action="'.htmlspecialchars($this->listURL()).'" method="post">','</form>');
01069                 }
01070 
01071                         // Load already selected fields, if any:
01072                 $setFields=is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
01073 
01074                         // Request fields from table:
01075                 $fields = $this->makeFieldList($table);
01076 
01077                         // Add pseudo "control" fields
01078                 $fields[]='_PATH_';
01079                 $fields[]='_LOCALIZATION_';
01080                 $fields[]='_CONTROL_';
01081                 $fields[]='_CLIPBOARD_';
01082 
01083                         // Create an option for each field:
01084                 $opt=array();
01085                 $opt[] = '<option value=""></option>';
01086                 foreach($fields as $fN) {
01087                         $fL = is_array($TCA[$table]['columns'][$fN]) ? ereg_replace(':$','',$LANG->sL($TCA[$table]['columns'][$fN]['label'])) : '['.$fN.']';    // Field label
01088                         $opt[] = '
01089                                                                                         <option value="'.$fN.'"'.(in_array($fN,$setFields)?' selected="selected"':'').'>'.htmlspecialchars($fL).'</option>';
01090                 }
01091 
01092                         // Compile the options into a multiple selector box:
01093                 $lMenu = '
01094                                                                                 <select size="'.t3lib_div::intInRange(count($fields)+1,3,20).'" multiple="multiple" name="displayFields['.$table.'][]">'.implode('',$opt).'
01095                                                                                 </select>
01096                                 ';
01097 
01098                         // Table with the field selector::
01099                 $content.= '
01100                         '.$formElements[0].'
01101 
01102                                 <!--
01103                                         Field selector for extended table view:
01104                                 -->
01105                                 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-fieldSelect">
01106                                         <tr>
01107                                                 <td>'.$lMenu.'</td>
01108                                                 <td><input type="submit" name="search" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.setFields',1).'" /></td>
01109                                         </tr>
01110                                 </table>
01111                         '.$formElements[1];
01112                 return $content;
01113         }
01114 
01115 
01116 
01117 
01118 
01119 
01120 
01121 
01122 
01123 
01124 
01125         /*********************************
01126          *
01127          * Helper functions
01128          *
01129          *********************************/
01130 
01141         function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')       {
01142                 $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.cmd_table.value=\''.$table.'\';document.dblistForm.submit();';
01143                 if ($warning)   $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
01144                 return '<a href="#" onclick="'.htmlspecialchars($onClickEvent.'return false;').'">'.$string.'</a>';
01145         }
01146 
01152         function clipNumPane()  {
01153                 return in_Array('_CLIPBOARD_',$this->fieldArray) && $this->clipObj->current!='normal';
01154         }
01155 
01166         function addSortLink($code,$field,$table)       {
01167 
01168                         // Certain circumstances just return string right away (no links):
01169                 if ($field=='_CONTROL_' || $field=='_LOCALIZATION_' || $field=='_CLIPBOARD_' || $this->disableSingleTableView)  return $code;
01170 
01171                         // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
01172                 if ($field=='_PATH_')   $field=pid;
01173 
01174                         //       Create the sort link:
01175                 $sortUrl = $this->listURL('',-1,'sortField,sortRev,table').'&table='.$table.'&sortField='.$field.'&sortRev='.($this->sortRev || ($this->sortField!=$field)?0:1);
01176                 $sortArrow = ($this->sortField==$field?'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/red'.($this->sortRev?'up':'down').'.gif','width="7" height="4"').' alt="" />':'');
01177 
01178                         // Return linked field:
01179                 return '<a href="'.htmlspecialchars($sortUrl).'">'.$code.
01180                                 $sortArrow.
01181                                 '</a>';
01182         }
01183 
01191         function recPath($pid)  {
01192                 if (!isset($this->recPath_cache[$pid])) {
01193                         $this->recPath_cache[$pid] = t3lib_BEfunc::getRecordPath($pid,$this->perms_clause,20);
01194                 }
01195                 return $this->recPath_cache[$pid];
01196         }
01197 
01204         function showNewRecLink($table) {
01205                 return !count($this->allowedNewTables) || in_array($table,$this->allowedNewTables);
01206         }
01207 
01214         function makeReturnUrl()        {
01215                 return '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
01216         }
01217 
01218 
01219 
01220 
01221 
01222 
01223 
01224 
01225 
01226 
01227 
01228         /************************************
01229          *
01230          * CSV related functions
01231          *
01232          ************************************/
01233 
01239         function initCSV()      {
01240 
01241                         // Reset:
01242                 $this->csvLines=array();
01243 
01244                         // Getting header line with field names:
01245                 $csvRow=array();
01246                 foreach($this->fieldArray as $fN)       {
01247                         $csvRow[]=$fN;
01248                 }
01249 
01250                         // Set the header + an empty row:
01251                 $this->setCsvRow($csvRow);
01252                 $this->csvLines[]='';
01253         }
01254 
01261         function addToCSV($row) {
01262 
01263                         // Traversing fields, adding values from $row:
01264                 $csvRow=array();
01265                 foreach($this->fieldArray as $fN)       {
01266                         if ($fN=='_PATH_')      {
01267                                 $csvRow[]=$this->recPath($row['pid']);
01268                         } else {
01269                                 $csvRow[]=$row[$fN];
01270                         }
01271                 }
01272 
01273                         // Set the values in the CSV list
01274                 $this->setCsvRow($csvRow);
01275         }
01276 
01283         function setCsvRow($csvRow)     {
01284                 $this->csvLines[] = t3lib_div::csvValues($csvRow);
01285         }
01286 
01294         function outputCSV($prefix)     {
01295 
01296                         // Setting filename:
01297                 $filename=$prefix.'_'.date('dmy-Hi').'.csv';
01298 
01299                         // Creating output header:
01300                 $mimeType = 'application/octet-stream';
01301                 Header('Content-Type: '.$mimeType);
01302                 Header('Content-Disposition: attachment; filename='.$filename);
01303 
01304                         // Printing the content of the CSV lines:
01305                 echo implode(chr(13).chr(10),$this->csvLines);
01306 
01307                         // Exits:
01308                 exit;
01309         }
01310 }
01311 
01312 
01313 
01314 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc'])   {
01315         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
01316 }
01317 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6