* Added option "mod.web_list.clickTitleMode = edit/info/show" to determine alternativ...
authorKasper Skårhøj <kasper@typo3.org>
Fri, 23 Apr 2004 13:19:56 +0000 (13:19 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Fri, 23 Apr 2004 13:19:56 +0000 (13:19 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@223 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/class.db_list.inc
typo3/class.db_list_extra.inc
typo3/db_list.php

index 51f573d..4bc6156 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
 
+       * Added option "mod.web_list.clickTitleMode = edit/info/show" to determine alternative behaviours of title links in the Web > List module.
+
+2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
+
        * Added Page TSconfig option "mod.web_list.listOnlyInSingleTableView = 1" which makes the List module list only the table names by default. You have to click the table name to get the single-table view before records show up. This is useful for pages containing many records from many tables.
 
 2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
index 33faaea..3a72887 100755 (executable)
@@ -111,6 +111,7 @@ class recordList extends t3lib_recordList {
        var $pidSelect='';                              // List of ids from which to select/search etc. (when search-levels are set high). See start()
        var $perms_clause='';                   // Page select permissions
        var $calcPerms=0;                               // Some permissions...
+       var $clickTitleMode = '';               // Mode for what happens when a user clicks the title of a record.
 
                // Internal, dynamic:
        var $JScode = '';                               // JavaScript code accumulation
@@ -504,20 +505,57 @@ class recordList extends t3lib_recordList {
         * @return      string          The item title. Ready for HTML output (is htmlspecialchars()'ed)
         */
        function linkWrapItems($table,$uid,$code,$row)  {
+               global $TCA, $LANG;
 
                        // If the title is blank, make a "no title" label:
                if (!strcmp($code,'')) {
-                       $code='<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i> - '.htmlspecialchars(t3lib_BEfunc::getRecordTitle($table,$row));
+                       $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i> - '.htmlspecialchars(t3lib_BEfunc::getRecordTitle($table,$row));
                } else {
-                       $code=htmlspecialchars(t3lib_div::fixed_lgd($code,$this->fixedL));
+                       $code = htmlspecialchars(t3lib_div::fixed_lgd($code,$this->fixedL));
                }
 
-                       // Output the label now:
-               if ($table=='pages')    {
-                       return '<a href="'.htmlspecialchars($this->listURL($uid,'')).'">'.$code.'</a>';
-               } else {
-                       return $code;
+               switch((string)$this->clickTitleMode)   {
+                       case 'edit':
+                                       // If the listed table is 'pages' we have to request the permission settings for each page:
+                               if ($table=='pages')    {
+                                       $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$row['uid']));
+                                       $permsEdit = $localCalcPerms&2;
+                               } else {
+                                       $permsEdit = $this->calcPerms&16;
+                               }
+
+                                       // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
+                               if ($permsEdit) {
+                                       $params='&edit['.$table.']['.$row['uid'].']=edit';
+                                       $code = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'" title="'.$LANG->getLL('edit',1).'">'.
+                                                       $code.
+                                                       '</a>';
+                               }
+                       break;
+                       case 'show':
+                                       // "Show" link (only pages and tt_content elements)
+                               if ($table=='pages' || $table=='tt_content')    {
+                                       $params = '&edit['.$table.']['.$row['uid'].']=edit';
+                                       $code = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($table=='tt_content'?$this->id.'#'.$row['uid']:$row['uid'])).'" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'">'.
+                                                       $code.
+                                                       '</a>';
+                               }
+                       break;
+                       case 'info':
+                               // "Info": (All records)
+                               $code = '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$row['uid'].'\'); return false;').'" title="'.$LANG->getLL('showInfo',1).'">'.
+                                       $code.
+                                       '</a>';
+                       break;
+                       default:
+                                       // Output the label now:
+                               if ($table=='pages')    {
+                                       $code = '<a href="'.htmlspecialchars($this->listURL($uid,'')).'">'.$code.'</a>';
+                               }
+                       break;
                }
+
+               return $code;
        }
 
        /**
index 29bb89a..3e80e81 100755 (executable)
@@ -520,8 +520,7 @@ class localRecordList extends recordList {
 
                        // Preparing and getting the data-array
                $theData = Array();
-               reset($this->fieldArray);
-               while(list(,$fCol)=each($this->fieldArray))     {
+               foreach($this->fieldArray as $fCol)     {
                        if ($fCol==$titleCol)   {
                                $theData[$fCol] = $this->linkWrapItems($table,$row['uid'],$recTitle,$row);
                        } elseif ($fCol=='pid') {
index e655ab2..652a3b6 100755 (executable)
@@ -213,6 +213,7 @@ class SC_db_list {
                $dblist->showClipboard = 1;
                $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
                $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
+               $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode'];
                $dblist->alternateBgColors=$this->modTSconfig['properties']['alternateBgColors']?1:0;
                $dblist->allowedNewTables = t3lib_div::trimExplode(',',$this->modTSconfig['properties']['allowedNewTables'],1);
                $dblist->newWizards=$this->modTSconfig['properties']['newWizards']?1:0;