Documentation TYPO3 par Ameos

class.db_list_extra.inc

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 ***************************************************************/
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 "Export" link, if a specific table is shown:
00232                 if ($this->table && t3lib_extMgm::isLoaded('impexp'))   {
00233                         $theData['up'][]='<a href="'.htmlspecialchars($this->backPath.t3lib_extMgm::extRelPath('impexp').'app/index.php?tx_impexp[action]=export&tx_impexp[list][]='.rawurlencode($this->table.':'.$this->id)).'">'.
00234                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,t3lib_extMgm::extRelPath('impexp').'export.gif',' width="18" height="16"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.export',1).'" alt="" />'.
00235                                                         '</a>';
00236                 }
00237 
00238                         // Add "refresh" link:
00239                 $theData['up'][]='<a href="'.htmlspecialchars($this->listURL()).'">'.
00240                                                 '<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="" />'.
00241                                                 '</a>';
00242 
00243 
00244                         // Add icon with clickmenu, etc:
00245                 if ($this->id)  {       // If there IS a real page...:
00246 
00247                                 // Setting title of page + the "Go up" link:
00248                         $theData[$titleCol].='<br /><span title="'.htmlspecialchars($row['_thePathFull']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($row['_thePath'],-$this->fixedL)).'</span>';
00249                         $theData['up'][]='<a href="'.htmlspecialchars($this->listURL($row['pid'])).'">'.
00250                                                         '<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="" />'.
00251                                                         '</a>';
00252 
00253                                 // Make Icon:
00254                         $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,'pages',$this->id) : $iconImg;
00255                 } else {        // On root-level of page tree:
00256 
00257                                 // Setting title of root (sitename):
00258                         $theData[$titleCol].='<br />'.htmlspecialchars(t3lib_div::fixed_lgd_cs($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],-$this->fixedL));
00259 
00260                                 // Make Icon:
00261                         $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' alt="" />';
00262                 }
00263 
00264                         // If there is a returnUrl given, add a back-link:
00265                 if ($this->returnUrl)   {
00266                         $theData['up'][]='<a href="'.htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl,array('id'=>$this->id))).'" class="typo3-goBack">'.
00267                                                         '<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="" />'.
00268                                                         '</a>';
00269                 }
00270 
00271                         // Finally, the "up" pseudo field is compiled into a table - has been accumulated in an array:
00272                 $theData['up']='
00273                         <table border="0" cellpadding="0" cellspacing="0">
00274                                 <tr>
00275                                         <td>'.implode('</td>
00276                                         <td>',$theData['up']).'</td>
00277                                 </tr>
00278                         </table>';
00279 
00280                         // ... and the element row is created:
00281                 $out.=$this->addelement(1,$theIcon,$theData,'',$this->leftMargin);
00282 
00283                         // ... and wrapped into a table and added to the internal ->HTMLcode variable:
00284                 $this->HTMLcode.='
00285 
00286 
00287                 <!--
00288                         Page header for db_list:
00289                 -->
00290                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-dblist-top">
00291                                 '.$out.'
00292                         </table>';
00293         }
00294 
00303         function getTable($table,$id,$rowlist)  {
00304                 global $TCA;
00305 
00306                         // Loading all TCA details for this table:
00307                 t3lib_div::loadTCA($table);
00308 
00309                         // Init
00310                 $addWhere = '';
00311                 $titleCol = $TCA[$table]['ctrl']['label'];
00312                 $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
00313                 $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
00314 
00315                         // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
00316                 $this->fieldArray=array();
00317                 $this->fieldArray[] = $titleCol;        // Add title column
00318                 if ($this->localizationView && $l10nEnabled)    {
00319                         $this->fieldArray[] = '_LOCALIZATION_';
00320                         $this->fieldArray[] = '_LOCALIZATION_b';
00321                         $addWhere.=' AND '.$TCA[$table]['ctrl']['languageField'].'<=0';
00322                 }
00323                 if (!t3lib_div::inList($rowlist,'_CONTROL_'))   {
00324                         $this->fieldArray[] = '_CONTROL_';
00325                 }
00326                 if ($this->showClipboard)       {
00327                         $this->fieldArray[] = '_CLIPBOARD_';
00328                 }
00329                 if ($this->searchLevels)        {
00330                         $this->fieldArray[]='_PATH_';
00331                 }
00332                         // Cleaning up:
00333                 $this->fieldArray=array_unique(array_merge($this->fieldArray,t3lib_div::trimExplode(',',$rowlist,1)));
00334                 if ($this->noControlPanels)     {
00335                         $tempArray = array_flip($this->fieldArray);
00336                         unset($tempArray['_CONTROL_']);
00337                         unset($tempArray['_CLIPBOARD_']);
00338                         $this->fieldArray = array_keys($tempArray);
00339                 }
00340 
00341                         // Creating the list of fields to include in the SQL query:
00342                 $selectFields = $this->fieldArray;
00343                 $selectFields[] = 'uid';
00344                 $selectFields[] = 'pid';
00345                 if ($thumbsCol) $selectFields[] = $thumbsCol;   // adding column for thumbnails
00346                 if ($table=='pages')    {
00347                         if (t3lib_extMgm::isLoaded('cms'))      {
00348                                 $selectFields[] = 'module';
00349                                 $selectFields[] = 'extendToSubpages';
00350                         }
00351                         $selectFields[] = 'doktype';
00352                 }
00353                 if (is_array($TCA[$table]['ctrl']['enablecolumns']))    {
00354                         $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
00355                 }
00356                 if ($TCA[$table]['ctrl']['type'])       {
00357                         $selectFields[] = $TCA[$table]['ctrl']['type'];
00358                 }
00359                 if ($TCA[$table]['ctrl']['typeicon_column'])    {
00360                         $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
00361                 }
00362                 if ($TCA[$table]['ctrl']['versioning']) {
00363                         $selectFields[] = 't3ver_id';
00364                 }
00365                 if ($l10nEnabled)       {
00366                         $selectFields[] = $TCA[$table]['ctrl']['languageField'];
00367                         $selectFields[] = $TCA[$table]['ctrl']['transOrigPointerField'];
00368                 }
00369                 if ($TCA[$table]['ctrl']['label_alt'])  {
00370                         $selectFields = array_merge($selectFields,t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1));
00371                 }
00372                 $selectFields = array_unique($selectFields);            // Unique list!
00373                 $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1));          // Making sure that the fields in the field-list ARE in the field-list from TCA!
00374                 $selFieldList = implode(',',$selectFields);             // implode it into a list of fields for the SQL-statement.
00375 
00376                         // Create the SQL query for selecting the elements in the listing:
00377                 $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList);       // (API function from class.db_list.inc)
00378                 $this->setTotalItems($queryParts);              // Finding the total amount of records on the page (API function from class.db_list.inc)
00379 
00380                         // Init:
00381                 $dbCount = 0;
00382                 $out = '';
00383 
00384                         // If the count query returned any number of records, we perform the real query, selecting records.
00385                 if ($this->totalItems)  {
00386                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00387                         $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00388                 }
00389 
00390                 $LOISmode = $this->listOnlyInSingleTableMode && !$this->table;
00391 
00392                         // If any records was selected, render the list:
00393                 if ($dbCount)   {
00394 
00395                                 // Half line is drawn between tables:
00396                         if (!$LOISmode) {
00397                                 $theData = Array();
00398                                 if (!$this->table && !$rowlist) {
00399                                         $theData[$titleCol] = '<img src="clear.gif" width="'.($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel']?'230':'350').'" height="1" alt="" />';
00400                                         if (in_array('_CONTROL_',$this->fieldArray))    $theData['_CONTROL_']='';
00401                                         if (in_array('_CLIPBOARD_',$this->fieldArray))  $theData['_CLIPBOARD_']='';
00402                                 }
00403                                 $out.=$this->addelement(0,'',$theData,'',$this->leftMargin);
00404                         }
00405 
00406                                 // Header line is drawn
00407                         $theData = Array();
00408                         if ($this->disableSingleTableView)      {
00409                                 $theData[$titleCol] = '<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.')';
00410                         } else {
00411                                 $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="" />');
00412                         }
00413 
00414                                 // CSH:
00415                         $theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
00416 
00417                         if ($LOISmode)  {
00418                                 $out.='
00419                                         <tr>
00420                                                 <td class="c-headLineTable" style="width:95%;">'.$theData[$titleCol].'</td>
00421                                         </tr>';
00422 
00423                                 if ($GLOBALS['BE_USER']->uc["edit_showFieldHelp"])      {
00424                                         $GLOBALS['LANG']->loadSingleTableDescription($table);
00425                                         if (isset($GLOBALS['TCA_DESCR'][$table]['columns']['']))        {
00426                                                 $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$table.'.\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
00427                                                 $out.='
00428                                         <tr>
00429                                                 <td class="c-tableDescription">'.t3lib_BEfunc::helpTextIcon($table,'',$this->backPath,TRUE).$GLOBALS['TCA_DESCR'][$table]['columns']['']['description'].'</td>
00430                                         </tr>';
00431                                         }
00432                                 }
00433                         } else {
00434                                 $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>':'';
00435                                 $out.=$this->addelement(1,$theUpIcon,$theData,' class="c-headLineTable"','');
00436                         }
00437 
00438                         If (!$LOISmode) {
00439                                         // Fixing a order table for sortby tables
00440                                 $this->currentTable = array();
00441                                 $currentIdList = array();
00442                                 $doSort = ($TCA[$table]['ctrl']['sortby'] && !$this->sortField);
00443 
00444                                 $prevUid = 0;
00445                                 $prevPrevUid = 0;
00446                                 $accRows = array();     // Accumulate rows here
00447                                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))    {
00448                                         $accRows[] = $row;
00449                                         $currentIdList[] = $row['uid'];
00450                                         if ($doSort)    {
00451                                                 if ($prevUid)   {
00452                                                         $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
00453                                                         $this->currentTable['next'][$prevUid] = '-'.$row['uid'];
00454                                                         $this->currentTable['prevUid'][$row['uid']] = $prevUid;
00455                                                 }
00456                                                 $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
00457                                                 $prevUid=$row['uid'];
00458                                         }
00459                                 }
00460                                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
00461 
00462                                         // CSV initiated
00463                                 if ($this->csvOutput) $this->initCSV();
00464 
00465                                         // Render items:
00466                                 $this->CBnames=array();
00467                                 $this->duplicateStack=array();
00468                                 $this->eCounter=$this->firstElementNumber;
00469 
00470                                 $iOut = '';
00471                                 $cc = 0;
00472                                 foreach($accRows as $row)       {
00473 
00474                                                 // Forward/Backwards navigation links:
00475                                         list($flag,$code) = $this->fwd_rwd_nav($table);
00476                                         $iOut.=$code;
00477 
00478                                                 // If render item, increment counter and call function
00479                                         if ($flag)      {
00480                                                 $cc++;
00481                                                 $iOut.=$this->renderListRow($table,$row,$cc,$titleCol,$thumbsCol);
00482 
00483                                                         // 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:
00484                                                 if ($this->localizationView && $l10nEnabled)    {
00485 
00486                                                                 // Look for translations of this record:
00487                                                         $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00488                                                                 $selFieldList,
00489                                                                 $table,
00490                                                                 'pid='.$row['pid'].
00491                                                                         ' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
00492                                                                         ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
00493                                                                         t3lib_BEfunc::deleteClause($table)
00494                                                         );
00495 
00496                                                                 // For each available translation, render the record:
00497                                                         foreach($translations as $lRow) {
00498                                                                 $iOut.=$this->renderListRow($table,$lRow,$cc,$titleCol,$thumbsCol,18);
00499                                                         }
00500                                                 }
00501                                         }
00502 
00503                                                 // Counter of total rows incremented:
00504                                         $this->eCounter++;
00505                                 }
00506 
00507                                         // The header row for the table is now created:
00508                                 $out.=$this->renderListHeader($table,$currentIdList);
00509                         }
00510 
00511                                 // The list of records is added after the header:
00512                         $out.=$iOut;
00513 
00514                                 // ... and it is all wrapped in a table:
00515                         $out='
00516 
00517 
00518 
00519                         <!--
00520                                 DB listing of elements: "'.htmlspecialchars($table).'"
00521                         -->
00522                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist'.($LOISmode?' typo3-dblist-overview':'').'">
00523                                         '.$out.'
00524                                 </table>';
00525 
00526                                 // Output csv if...
00527                         if ($this->csvOutput)   $this->outputCSV($table);       // This ends the page with exit.
00528                 }
00529 
00530                         // Return content:
00531                 return $out;
00532         }
00533 
00547         function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)  {
00548                 $iOut = '';
00549 
00550                         // Background color, if any:
00551                 $row_bgColor=
00552                         $this->alternateBgColors ?
00553                         (($cc%2)?'' :' bgcolor="'.t3lib_div::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4,+10,+10,+10).'"') :
00554                         '';
00555 
00556                         // Initialization
00557                 $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
00558                 $recTitle = t3lib_BEfunc::getRecordTitle($table,$row);
00559 
00560                         // Incr. counter.
00561                 $this->counter++;
00562 
00563                         // The icon with link
00564                 $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($alttext).'"'.($indent ? ' style="margin-left: '.$indent.'px;"' : ''));
00565                 $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']) : $iconImg;
00566 
00567                         // Preparing and getting the data-array
00568                 $theData = Array();
00569                 foreach($this->fieldArray as $fCol)     {
00570                         if ($fCol==$titleCol)   {
00571                                 if ($GLOBALS['TCA'][$table]['ctrl']['label_alt'] && ($GLOBALS['TCA'][$table]['ctrl']['label_alt_force'] || !strcmp($row[$fCol],'')))    {
00572                                         $altFields=t3lib_div::trimExplode(',',$GLOBALS['TCA'][$table]['ctrl']['label_alt'],1);
00573                                         $tA=array();
00574                                         if ($row[$fCol])        { $tA[]=$row[$fCol]; }
00575                                         while(list(,$fN)=each($altFields))      {
00576                                                 $t = t3lib_BEfunc::getProcessedValueExtra($table,$fN,$row[$fN],$GLOBALS['BE_USER']->uc['titleLen'],$row['uid']);
00577                                                 if($t)  { $tA[] = $t; }
00578                                         }
00579                                         if ($GLOBALS['TCA'][$table]['ctrl']['label_alt_force']) { $t=implode(', ',$tA); }
00580                                         if ($t) { $recTitle = $t; }
00581                                 } else {
00582                                         $recTitle = t3lib_BEfunc::getProcessedValueExtra($table,$fCol,$row[$fCol],$GLOBALS['BE_USER']->uc['titleLen'],$row['uid']);
00583                                 }
00584                                 $theData[$fCol] = $this->linkWrapItems($table,$row['uid'],$recTitle,$row);
00585                         } elseif ($fCol=='pid') {
00586                                 $theData[$fCol]=$row[$fCol];
00587                         } elseif ($fCol=='_PATH_') {
00588                                 $theData[$fCol]=$this->recPath($row['pid']);
00589                         } elseif ($fCol=='_CONTROL_') {
00590                                 $theData[$fCol]=$this->makeControl($table,$row);
00591                         } elseif ($fCol=='_CLIPBOARD_') {
00592                                 $theData[$fCol]=$this->makeClip($table,$row);
00593                         } elseif ($fCol=='_LOCALIZATION_') {
00594                                 list($lC1, $lC2) = $this->makeLocalizationPanel($table,$row);
00595                                 $theData[$fCol] = $lC1;
00596                                 $theData[$fCol.'b'] = $lC2;
00597                         } elseif ($fCol=='_LOCALIZATION_b') {
00598                                 // Do nothing, has been done above.
00599                         } else {
00600                                 $theData[$fCol]=htmlspecialchars(t3lib_BEfunc::getProcessedValueExtra($table,$fCol,$row[$fCol],100,$row['uid']));
00601                         }
00602                 }
00603 
00604                         // Add row to CSV list:
00605                 if ($this->csvOutput) $this->addToCSV($row);
00606 
00607                         // Create element in table cells:
00608                 $iOut.=$this->addelement(1,$theIcon,$theData,$row_bgColor);
00609 
00610                         // Render thumbsnails if a thumbnail column exists and there is content in it:
00611                 if ($this->thumbs && trim($row[$thumbsCol]))    {
00612                         $iOut.=$this->addelement(4,'', Array($titleCol=>$this->thumbCode($row,$table,$thumbsCol)),$row_bgColor);
00613                 }
00614 
00615                         // Finally, return table row element:
00616                 return $iOut;
00617         }
00618 
00628         function renderListHeader($table,$currentIdList)        {
00629                 global $TCA, $LANG;
00630 
00631                         // Init:
00632                 $theData = Array();
00633 
00634                         // Traverse the fields:
00635                 foreach($this->fieldArray as $fCol)     {
00636 
00637                                 // Calculate users permissions to edit records in the table:
00638                         $permsEdit = $this->calcPerms & ($table=='pages'?2:16);
00639 
00640                         switch((string)$fCol)   {
00641                                 case '_PATH_':                  // Path
00642                                         $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_',1).']</i>';
00643                                 break;
00644                                 case '_LOCALIZATION_':                  // Path
00645                                         $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_',1).']</i>';
00646                                 break;
00647                                 case '_LOCALIZATION_b':                 // Path
00648                                         $theData[$fCol] = $LANG->getLL('Localize',1);
00649                                 break;
00650                                 case '_CLIPBOARD_':             // Clipboard:
00651                                         $cells=array();
00652 
00653                                                 // If there are elements on the clipboard for this table, then display the "paste into" icon:
00654                                         $elFromTable = $this->clipObj->elFromTable($table);
00655                                         if (count($elFromTable))        {
00656                                                 $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,$this->id)).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg('pages',$this->pageRow,'into',$elFromTable)).'">'.
00657                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_paste',1).'" alt="" />'.
00658                                                                 '</a>';
00659                                         }
00660 
00661                                                 // If the numeric clipboard pads are enabled, display the control icons for that:
00662                                         if ($this->clipObj->current!='normal')  {
00663 
00664                                                         // The "select" link:
00665                                                 $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg('','gfx/clip_copy.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_selectMarked',1).'" alt="" />',$table,'setCB');
00666 
00667                                                         // The "edit marked" link:
00668                                                 $editIdList = implode(',',$currentIdList);
00669                                                 $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00670                                                 $params='&edit['.$table.']['.$editIdList.']=edit&disHelp=1';
00671                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00672                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('clip_editMarked',1).'" alt="" />'.
00673                                                                 '</a>';
00674 
00675                                                         // The "Delete marked" link:
00676                                                 $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'])));
00677 
00678                                                         // The "Select all" link:
00679                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('checkOffCB(\''.implode(',',$this->CBnames).'\'); return false;').'">'.
00680                                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_select.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_markRecords',1).'" alt="" />'.
00681                                                                 '</a>';
00682                                         } else {
00683                                                 $cells[]='';
00684                                         }
00685                                         $theData[$fCol]=implode('',$cells);
00686                                 break;
00687                                 case '_CONTROL_':               // Control panel:
00688                                         if (!$TCA[$table]['ctrl']['readOnly'])  {
00689 
00690                                                         // If new records can be created on this page, add links:
00691                                                 if ($this->calcPerms&($table=='pages'?8:16) && $this->showNewRecLink($table))   {
00692                                                         if ($table=="tt_content" && $this->newWizards)  {
00693                                                                         //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00694                                                                 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00695                                                                 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00696                                                                 $newContentWizScriptPath = t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
00697 
00698                                                                 $theData[$fCol]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$newContentWizScriptPath.'?id='.$this->id.'\');').'">'.
00699                                                                                                 '<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="" />'.
00700                                                                                                 '</a>';
00701                                                         } elseif ($table=='pages' && $this->newWizards) {
00702                                                                 $theData[$fCol]='<a href="'.htmlspecialchars('db_new.php?id='.$this->id.'&pagesOnly=1returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00703                                                                                                 '<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="" />'.
00704                                                                                                 '</a>';
00705                                                         } else {
00706                                                                 $params='&edit['.$table.']['.$this->id.']=new';
00707                                                                 $theData[$fCol]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00708                                                                                                 '<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="" />'.
00709                                                                                                 '</a>';
00710                                                         }
00711                                                 }
00712 
00713                                                         // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
00714                                                 if ($permsEdit && $this->table && is_array($currentIdList))     {
00715                                                         $editIdList = implode(',',$currentIdList);
00716                                                         if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00717                                                         $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.implode(',',$this->fieldArray).'&disHelp=1';
00718                                                         $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00719                                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('editShownColumns',1).'" alt="" />'.
00720                                                                                         '</a>';
00721                                                 }
00722                                         }
00723                                 break;
00724                                 default:                        // Regular fields header:
00725                                         $theData[$fCol]='';
00726                                         if ($this->table && is_array($currentIdList))   {
00727 
00728                                                         // If the numeric clipboard pads are selected, show duplicate sorting link:
00729                                                 if ($this->clipNumPane()) {
00730                                                         $theData[$fCol].='<a href="'.htmlspecialchars($this->listURL('',-1).'&duplicateField='.$fCol).'">'.
00731                                                                                         '<img'.t3lib_iconWorks::skinImg('','gfx/select_duplicates.gif','width="11" height="11"').' title="'.$LANG->getLL('clip_duplicates',1).'" alt="" />'.
00732                                                                                         '</a>';
00733                                                 }
00734 
00735                                                         // If the table can be edited, add link for editing THIS field for all listed records:
00736                                                 if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol])  {
00737                                                         $editIdList = implode(',',$currentIdList);
00738                                                         if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00739                                                         $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.$fCol.'&disHelp=1';
00740                                                         $iTitle = sprintf($LANG->getLL('editThisColumn'),ereg_replace(':$','',trim($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol)))));
00741                                                         $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00742                                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
00743                                                                                         '</a>';
00744                                                 }
00745                                         }
00746                                         $theData[$fCol].=$this->addSortLink($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol,'<i>[|]</i>')),$fCol,$table);
00747                                 break;
00748                         }
00749                 }
00750 
00751                         // Create and return header table row:
00752                 return $this->addelement(1,'',$theData,' class="c-headLine"','');
00753         }
00754 
00755 
00756 
00757 
00758 
00759 
00760         /*********************************
00761          *
00762          * Rendering of various elements
00763          *
00764          *********************************/
00765 
00773         function makeControl($table,$row)       {
00774                 global $TCA, $LANG, $SOBE;
00775 
00776                         // Return blank, if disabled:
00777                 if ($this->dontShowClipControlPanels)   return '';
00778 
00779                         // Initialize:
00780                 t3lib_div::loadTCA($table);
00781                 $cells=array();
00782 
00783                         // If the listed table is 'pages' we have to request the permission settings for each page:
00784                 if ($table=='pages')    {
00785                         $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$row['uid']));
00786                 }
00787 
00788                         // This expresses the edit permissions for this particular element:
00789                 $permsEdit = ($table=='pages' && ($localCalcPerms&2)) || ($table!='pages' && ($this->calcPerms&16));
00790 
00791                         // "Show" link (only pages and tt_content elements)
00792                 if ($table=='pages' || $table=='tt_content')    {
00793                         $params='&edit['.$table.']['.$row['uid'].']=edit';
00794                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($table=='tt_content'?$this->id.'#'.$row['uid']:$row['uid'])).'">'.
00795                                         '<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="" />'.
00796                                         '</a>';
00797                 }
00798 
00799                         // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
00800                 if ($permsEdit) {
00801                         $params='&edit['.$table.']['.$row['uid'].']=edit';
00802                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00803                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2'.(!$TCA[$table]['ctrl']['readOnly']?'':'_d').'.gif','width="11" height="12"').' title="'.$LANG->getLL('edit',1).'" alt="" />'.
00804                                         '</a>';
00805                 }
00806 
00807                         // "Move" wizard link for pages/tt_content elements:
00808                 if (($table=="tt_content" && $permsEdit) || ($table=='pages'))  {
00809                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\'move_el.php?table='.$table.'&uid='.$row['uid'].'\');').'">'.
00810                                         '<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="" />'.
00811                                         '</a>';
00812                 }
00813 
00814                         // If the extended control panel is enabled OR if we are seeing a single table:
00815                 if ($SOBE->MOD_SETTINGS['bigControlPanel'] || $this->table)     {
00816 
00817                                 // "Info": (All records)
00818                         $cells[]='<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$row['uid'].'\'); return false;').'">'.
00819                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('showInfo',1).'" alt="" />'.
00820                                         '</a>';
00821 
00822                                 // If the table is NOT a read-only table, then show these links:
00823                         if (!$TCA[$table]['ctrl']['readOnly'])  {
00824 
00825                                         // "Revert" link (history/undo)
00826                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\'show_rechis.php?element='.rawurlencode($table.':'.$row['uid']).'\',\'#latest\');').'">'.
00827                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/history2.gif','width="13" height="12"').' title="'.$LANG->getLL('history',1).'" alt="" />'.
00828                                                 '</a>';
00829 
00830                                         // Versioning:
00831                                 if (t3lib_extMgm::isLoaded('version'))  {
00832                                         $vers = t3lib_BEfunc::selectVersionsOfRecord($table, $row['uid'], $fields='uid');
00833                                         if (is_array($vers))    {       // If table can be versionized.
00834                                                 if (count($vers)>1)     {
00835                                                         $st = 'background-color: #FFFF00; font-weight: bold;';
00836                                                         $lab = count($vers)-1;
00837                                                 } else {
00838                                                         $st = 'background-color: #9999cc; font-weight: bold;';
00839                                                         $lab = 'V';
00840                                                 }
00841 
00842                                                 $cells[]='<a href="'.htmlspecialchars(t3lib_extMgm::extRelPath('version')).'cm1/index.php?table='.rawurlencode($table).'&uid='.rawurlencode($row['uid']).'" style="'.htmlspecialchars($st).'">'.
00843                                                                 $lab.
00844                                                                 '</a>';
00845                                         }
00846                                 }
00847 
00848                                         // "Edit Perms" link:
00849                                 if ($table=='pages' && $GLOBALS['BE_USER']->check('modules','web_perm'))        {
00850                                         $cells[]='<a href="'.htmlspecialchars('mod/web/perm/index.php?id='.$row['uid'].'&return_id='.$row['uid'].'&edit=1').'">'.
00851                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/perm.gif','width="7" height="12"').' title="'.$LANG->getLL('permissions',1).'" alt="" />'.
00852                                                         '</a>';
00853                                 }
00854 
00855                                         // "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):
00856                                 if ($TCA[$table]['ctrl']['sortby'] || $TCA[$table]['ctrl']['useColumnsForDefaultValues'])       {
00857                                         if (
00858                                                 ($table!='pages' && ($this->calcPerms&16)) ||   // For NON-pages, must have permission to edit content on this parent page
00859                                                 ($table=='pages' && ($this->calcPerms&8))               // For pages, must have permission to create new pages here.
00860                                                 )       {
00861                                                 if ($this->showNewRecLink($table))      {
00862                                                         $params='&edit['.$table.']['.(-$row['uid']).']=new';
00863                                                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'">'.
00864                                                                         '<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="" />'.
00865                                                                         '</a>';
00866                                                 }
00867                                         }
00868                                 }
00869 
00870                                         // "Up/Down" links
00871                                 if ($permsEdit && $TCA[$table]['ctrl']['sortby']  && !$this->sortField && !$this->searchLevels) {
00872                                         if (isset($this->currentTable['prev'][$row['uid']]))    {       // Up
00873                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prev'][$row['uid']];
00874                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00875                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"').' title="'.$LANG->getLL('moveUp',1).'" alt="" />'.
00876                                                                 '</a>';
00877                                         } else {
00878                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"',2).' alt="" />';
00879                                         }
00880                                         if ($this->currentTable['next'][$row['uid']])   {       // Down
00881                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['next'][$row['uid']];
00882                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00883                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"').' title="'.$LANG->getLL('moveDown',1).'" alt="" />'.
00884                                                                 '</a>';
00885                                         } else {
00886                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"',2).' alt="" />';
00887                                         }
00888                                 }
00889 
00890                                         // "Hide/Unhide" links:
00891                                 $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
00892                                 if ($permsEdit && $hiddenField && $TCA[$table]['columns'][$hiddenField] && (!$TCA[$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$table.':'.$hiddenField)))     {
00893                                         if ($row[$hiddenField]) {
00894                                                 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
00895                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00896                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$LANG->getLL('unHide'.($table=='pages'?'Page':''),1).'" alt="" />'.
00897                                                                 '</a>';
00898                                         } else {
00899                                                 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
00900                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00901                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$LANG->getLL('hide'.($table=='pages'?'Page':''),1).'" alt="" />'.
00902                                                                 '</a>';
00903                                         }
00904                                 }
00905 
00906                                         // "Delete" link:
00907                                 if (
00908                                         ($table=='pages' && ($localCalcPerms&4)) || ($table!='pages' && ($this->calcPerms&16))
00909                                         )       {
00910                                         $params='&cmd['.$table.']['.$row['uid'].'][delete]=1';
00911                                         $cells[]='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) {jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');} return false;').'">'.
00912                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('delete',1).'" alt="" />'.
00913                                                         '</a>';
00914                                 }
00915 
00916                                         // "Levels" links: Moving pages into new levels...
00917                                 if ($permsEdit && $table=='pages' && !$this->searchLevels)      {
00918 
00919                                                 // Up (Paste as the page right after the current parent page)
00920                                         if ($this->calcPerms&8) {
00921                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.-$this->id;
00922                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00923                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_left.gif','width="11" height="10"').' title="'.$LANG->getLL('prevLevel',1).'" alt="" />'.
00924                                                                 '</a>';
00925                                         }
00926                                                 // Down (Paste as subpage to the page right above)
00927                                         if ($this->currentTable['prevUid'][$row['uid']])        {
00928                                                 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$this->currentTable['prevUid'][$row['uid']]));
00929                                                 if ($localCalcPerms&8)  {
00930                                                         $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prevUid'][$row['uid']];
00931                                                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00932                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"').' title="'.$LANG->getLL('nextLevel',1).'" alt="" />'.
00933                                                                         '</a>';
00934                                                 } else {
00935                                                         $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"',2).' alt="" />';
00936                                                 }
00937                                         } else {
00938                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"',2).' alt="" />';
00939                                         }
00940                                 }
00941                         }
00942                 }
00943 
00944                         // If the record is edit-locked by another user, we will show a little warning sign:
00945                 if ($lockInfo=t3lib_BEfunc::isRecordLocked($table,$row['uid'])) {
00946                         $cells[]='<a href="#" onclick="'.htmlspecialchars('alert('.$LANG->JScharCode($lockInfo['msg']).');return false;').'">'.
00947                                         '<img'.t3lib_iconWorks::skinImg('','gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
00948                                         '</a>';
00949                 }
00950 
00951 
00952                         // Compile items into a DIV-element:
00953                 return '
00954                                                                                         <!-- CONTROL PANEL: '.$table.':'.$row['uid'].' -->
00955                                                                                         <div class="typo3-DBctrl">'.implode('',$cells).'</div>';
00956         }
00957 
00965         function makeClip($table,$row)  {
00966                 global $TCA, $LANG;
00967 
00968                         // Return blank, if disabled:
00969                 if ($this->dontShowClipControlPanels)   return '';
00970                 $cells=array();
00971 
00972                         // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
00973                 if ($this->clipObj->current=='normal')  {       // For the "Normal" pad:
00974 
00975                                 // Show copy/cut icons:
00976                         $isSel = (string)$this->clipObj->isSelected($table,$row['uid']);
00977                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'">'.
00978                                         '<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="" />'.
00979                                         '</a>';
00980                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'">'.
00981                                         '<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="" />'.
00982                                         '</a>';
00983 
00984                 } else {        // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
00985 
00986                                 // Setting name of the element in ->CBnames array:
00987                         $n=$table.'|'.$row['uid'];
00988                         $this->CBnames[]=$n;
00989 
00990                                 // Check if the current element is selected and if so, prepare to set the checkbox as selected:
00991                         $checked = ($this->clipObj->isSelected($table,$row['uid'])?' checked="checked"':'');
00992 
00993                                 // If the "duplicateField" value is set then select all elements which are duplicates...
00994                         if ($this->duplicateField && isset($row[$this->duplicateField]))        {
00995                                 $checked='';
00996                                 if (in_array($row[$this->duplicateField], $this->duplicateStack))       {
00997                                         $checked=' checked="checked"';
00998                                 }
00999                                 $this->duplicateStack[] = $row[$this->duplicateField];
01000                         }
01001 
01002                                 // Adding the checkbox to the panel:
01003                         $cells[]='<input type="hidden" name="CBH['.$n.']" value="0" /><input type="checkbox" name="CBC['.$n.']" value="1" class="smallCheckboxes"'.$checked.' />';
01004                 }
01005 
01006                         // Now, looking for selected elements from the current table:
01007                 $elFromTable = $this->clipObj->elFromTable($table);
01008                 if (count($elFromTable) && $TCA[$table]['ctrl']['sortby'])      {       // IF elements are found and they can be individually ordered, then add a "paste after" icon:
01009                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'">'.
01010                                         '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteAfter',1).'" alt="" />'.
01011                                         '</a>';
01012                 }
01013 
01014                         // Now, looking for elements in general:
01015                 $elFromTable = $this->clipObj->elFromTable('');
01016                 if ($table=='pages' && count($elFromTable))     {
01017                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('',$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'into',$elFromTable)).'">'.
01018                                         '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteinto.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteInto',1).'" alt="" />'.
01019                                         '</a>';
01020                 }
01021 
01022                         // Compile items into a DIV-element:
01023                 return '                                                        <!-- CLIPBOARD PANEL: '.$table.':'.$row['uid'].' -->
01024                                                                                         <div class="typo3-clipCtrl">'.implode('',$cells).'</div>';
01025         }
01026 
01034         function makeLocalizationPanel($table,$row)     {
01035                 global $TCA,$LANG;
01036 
01037                 $out = array(
01038                         0 => '',
01039                         1 => '',
01040                 );
01041                 if ($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'])   {
01042 
01043                                 // Language title and icon:
01044                         $out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
01045 
01046                                 // Create new localizations links:
01047                         if ($row[$TCA[$table]['ctrl']['languageField']] <=0)    {
01048 
01049                                         // Look for translations of this record, index by language field value:
01050                                 $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01051                                         'uid,'.$TCA[$table]['ctrl']['languageField'],
01052                                         $table,
01053                                         'pid='.intval($this->id).
01054                                                 ' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
01055                                                 ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
01056                                                 t3lib_BEfunc::deleteClause($table),
01057                                         '',
01058                                         '',
01059                                         '',
01060                                         $TCA[$table]['ctrl']['languageField']
01061                                 );
01062 
01063                                         // Traverse page translations and add icon for each language that does NOT yet exist:
01064                                 $lNew = '';
01065                                 foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)        {
01066                                         if (!isset($translations[$lUid_OnPage]))        {
01067                                                 $href = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,$rUrl='');
01068 
01069                                                 $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
01070                                                 $lC = '<a href="'.htmlspecialchars($href).'">'.$lC.'</a> ';
01071 
01072                                                 $lNew.=$lC;
01073                                         }
01074                                 }
01075 
01076                                 if ($lNew)      $out[1].= $lNew;
01077                         } else {
01078                                 $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;'.$out[0];
01079                         }
01080                 }
01081 
01082                 return $out;
01083         }
01084 
01092         function fieldSelectBox($table,$formFields=1)   {
01093                 global $TCA, $LANG;
01094 
01095                         // Init:
01096                 t3lib_div::loadTCA($table);
01097                 $formElements=array('','');
01098                 if ($formFields)        {
01099                         $formElements=array('<form action="'.htmlspecialchars($this->listURL()).'" method="post">','</form>');
01100                 }
01101 
01102                         // Load already selected fields, if any:
01103                 $setFields=is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
01104 
01105                         // Request fields from table:
01106                 $fields = $this->makeFieldList($table);
01107 
01108                         // Add pseudo "control" fields
01109                 $fields[]='_PATH_';
01110                 $fields[]='_LOCALIZATION_';
01111                 $fields[]='_CONTROL_';
01112                 $fields[]='_CLIPBOARD_';
01113 
01114                         // Create an option for each field:
01115                 $opt=array();
01116                 $opt[] = '<option value=""></option>';
01117                 foreach($fields as $fN) {
01118                         $fL = is_array($TCA[$table]['columns'][$fN]) ? ereg_replace(':$','',$LANG->sL($TCA[$table]['columns'][$fN]['label'])) : '['.$fN.']';    // Field label
01119                         $opt[] = '
01120                                                                                         <option value="'.$fN.'"'.(in_array($fN,$setFields)?' selected="selected"':'').'>'.htmlspecialchars($fL).'</option>';
01121                 }
01122 
01123                         // Compile the options into a multiple selector box:
01124                 $lMenu = '
01125                                                                                 <select size="'.t3lib_div::intInRange(count($fields)+1,3,20).'" multiple="multiple" name="displayFields['.$table.'][]">'.implode('',$opt).'
01126                                                                                 </select>
01127                                 ';
01128 
01129                         // Table with the field selector::
01130                 $content.= '
01131                         '.$formElements[0].'
01132 
01133                                 <!--
01134                                         Field selector for extended table view:
01135                                 -->
01136                                 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-fieldSelect">
01137                                         <tr>
01138                                                 <td>'.$lMenu.'</td>
01139                                                 <td><input type="submit" name="search" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.setFields',1).'" /></td>
01140                                         </tr>
01141                                 </table>
01142                         '.$formElements[1];
01143                 return $content;
01144         }
01145 
01146 
01147 
01148 
01149 
01150 
01151 
01152 
01153 
01154 
01155 
01156         /*********************************
01157          *
01158          * Helper functions
01159          *
01160          *********************************/
01161 
01172         function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')       {
01173                 $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.cmd_table.value=\''.$table.'\';document.dblistForm.submit();';
01174                 if ($warning)   $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
01175                 return '<a href="#" onclick="'.htmlspecialchars($onClickEvent.'return false;').'">'.$string.'</a>';
01176         }
01177 
01183         function clipNumPane()  {
01184                 return in_Array('_CLIPBOARD_',$this->fieldArray) && $this->clipObj->current!='normal';
01185         }
01186 
01197         function addSortLink($code,$field,$table)       {
01198 
01199                         // Certain circumstances just return string right away (no links):
01200                 if ($field=='_CONTROL_' || $field=='_LOCALIZATION_' || $field=='_CLIPBOARD_' || $this->disableSingleTableView)  return $code;
01201 
01202                         // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
01203                 if ($field=='_PATH_')   $field=pid;
01204 
01205                         //       Create the sort link:
01206                 $sortUrl = $this->listURL('',-1,'sortField,sortRev,table').'&table='.$table.'&sortField='.$field.'&sortRev='.($this->sortRev || ($this->sortField!=$field)?0:1);
01207                 $sortArrow = ($this->sortField==$field?'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/red'.($this->sortRev?'up':'down').'.gif','width="7" height="4"').' alt="" />':'');
01208 
01209                         // Return linked field:
01210                 return '<a href="'.htmlspecialchars($sortUrl).'">'.$code.
01211                                 $sortArrow.
01212                                 '</a>';
01213         }
01214 
01222         function recPath($pid)  {
01223                 if (!isset($this->recPath_cache[$pid])) {
01224                         $this->recPath_cache[$pid] = t3lib_BEfunc::getRecordPath($pid,$this->perms_clause,20);
01225                 }
01226                 return $this->recPath_cache[$pid];
01227         }
01228 
01235         function showNewRecLink($table) {
01236                 return !count($this->allowedNewTables) || in_array($table,$this->allowedNewTables);
01237         }
01238 
01245         function makeReturnUrl()        {
01246                 return '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
01247         }
01248 
01249 
01250 
01251 
01252 
01253 
01254 
01255 
01256 
01257 
01258 
01259         /************************************
01260          *
01261          * CSV related functions
01262          *
01263          ************************************/
01264 
01270         function initCSV()      {
01271 
01272                         // Reset:
01273                 $this->csvLines=array();
01274 
01275                         // Getting header line with field names:
01276                 $csvRow=array();
01277                 foreach($this->fieldArray as $fN)       {
01278                         $csvRow[]=$fN;
01279                 }
01280 
01281                         // Set the header + an empty row:
01282                 $this->setCsvRow($csvRow);
01283                 $this->csvLines[]='';
01284         }
01285 
01292         function addToCSV($row) {
01293 
01294                         // Traversing fields, adding values from $row:
01295                 $csvRow=array();
01296                 foreach($this->fieldArray as $fN)       {
01297                         if ($fN=='_PATH_')      {
01298                                 $csvRow[]=$this->recPath($row['pid']);
01299                         } else {
01300                                 $csvRow[]=$row[$fN];
01301                         }
01302                 }
01303 
01304                         // Set the values in the CSV list
01305                 $this->setCsvRow($csvRow);
01306         }
01307 
01314         function setCsvRow($csvRow)     {
01315                 $this->csvLines[] = t3lib_div::csvValues($csvRow);
01316         }
01317 
01325         function outputCSV($prefix)     {
01326 
01327                         // Setting filename:
01328                 $filename=$prefix.'_'.date('dmy-Hi').'.csv';
01329 
01330                         // Creating output header:
01331                 $mimeType = 'application/octet-stream';
01332                 Header('Content-Type: '.$mimeType);
01333                 Header('Content-Disposition: attachment; filename='.$filename);
01334 
01335                         // Printing the content of the CSV lines:
01336                 echo implode(chr(13).chr(10),$this->csvLines);
01337 
01338                         // Exits:
01339                 exit;
01340         }
01341 }
01342 
01343 
01344 
01345 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc'])   {
01346         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
01347 }
01348 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6