[TYPO3-core] RFC: #10515: extend Filelist with icon block according to list view

Niels Pardon mail at niels-pardon.de
Sat Feb 21 14:09:02 CET 2009


Hi Steffen!

Steffen Kamper schrieb:
> i used CGL for new lines, i doesn't change old lines.

Let's have a closer look at the patch:


Index: typo3/class.file_list.inc

@@ -110,7 +111,7 @@
 	 * @param	boolean		Show clipboard flag
 	 * @return	void
 	 */
-	function start($path,$pointer,$sort,$sortRev,$clipBoard=0)	{
+	function
start($path,$pointer,$sort,$sortRev,$clipBoard=0,$bigControlPanel=0)	{
 		$this->counter=0;
 		$this->totalbytes=0;
 		$this->JScode='';

What about adding spaces after commas in the function parameters? And
what about replacing the tab with a space between ) and {?

@@ -221,13 +223,17 @@
 	function getTable($files,$dirs,$rowlist)	{
 			// Adds the code of files/dirs
 		$out='';
-		$titleCol = 'file';
+		$titleCol = 'file';
+		$upLevelDir = dirname(substr($files['files'][0]['path'], 0, -1)) . '/';
+		$levelUp =
$GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($upLevelDir) ?
$this->linkWrapDir('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/folder_up.gif','width="18"
height="16"').'
title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'"
alt="" />', $upLevelDir) : '';

There are no spaces around the dots for concatenation within this
$levelUp line.

@@ -247,13 +253,13 @@

 			// Header line is drawn
 		$theData = Array();
-		reset($this->fieldArray);
-		while(list(,$v)=each($this->fieldArray))	{
-			if ($v=='_CLIPBOARD_')	{
+		
+		foreach ($this->fieldArray as $v)	{
+			if ($v=='_CLIPBOARD_' && $this->clipBoard)	{

There's also a tab between ) and {. There are no spaces around ==. There
are two surplus tabs at the empty line before the foreach.

@@ -265,14 +271,13 @@
 						
'<img'.t3lib_iconWorks::skinImg('','gfx/clip_select.gif','width="12"
height="12"').'
title="'.$GLOBALS['LANG']->getLL('clip_markRecords',1).'" alt="" />'.
 							'</a>';
 				}
-
 				$theData[$v] = implode('',$cells);
 			} else {	// Normal row:
 				$theT = $this->linkWrapSort($GLOBALS['LANG']->getLL('c_'.$v,1),
$this->path,$v);
 				$theData[$v] = $theT;
 			}
 		}
-		$out.=$this->addelement(1,'',$theData,' class="c-headLine"','');
+		$out.=$this->addelement(1,$levelUp,$theData,' class="c-headLine"','');
 		$out.=$iOut;

 			// half line is drawn

There are no spaces around the .=. There are no spaces after the commas
between function parameters.

@@ -660,6 +675,50 @@
 	}

 	/**
+	* Creates the edit control section
+	*
+	* @param	array		Array with information about the file/directory for
which to make the edit control section for the listing.
+	* @return	string		HTML-table
+	*/

What about using spaces instead of tabs for indendation in comments, too?

+	function makeEdit($theData) {
+		$cells=array();

There are no spaces around the =.

+		$fullIdent = $theData['path'].$theData['file'];
+		

There are no spaces around the concatenation dot. There are surplus tabs
on the following empty line.

+			// prepare space icon
+		$iconWidth  =
$GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth']  ?
$GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth']  : 12;
+		$iconHeight =
$GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeHeight'] ?
$GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeHeight'] : 12;
+		$spaceIcon = '<img src="' . $this->backPath . 'clear.gif" width="' .
$iconWidth . '" height="' . $iconHeight . '" title="" alt="" />';
+
+		
+			//edit

There a surplus tabs on the second empty line.

+		if ($theData['type'] == 'dir') {
+			$cells[] = $spaceIcon;
+		} else {
+			$editOnClick =
'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target='
.
+				rawurlencode($fullIdent) .
+			
'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location);return
false;';
+			$cells[] = '<a href="#" onclick="' . $editOnClick . '"><img' .
t3lib_iconWorks::skinImg('', 'gfx/edit.gif', 'width="' . $iconWidth . '"
height="' . $iconHeight . '"') . ' title="' .
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.edit') .'"
alt="" /></a>';

There's one space missing after the last concatenation dot.

+		}
+			//rename
+		$editOnClick =
'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_rename.php?target='
.
+			rawurlencode($fullIdent) .
+		
'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location);return
false;';
+		$cells[] = '<a href="#" onclick="' . $editOnClick . '"><img' .
t3lib_iconWorks::skinImg('', 'gfx/rename.gif', 'width="' . $iconWidth .
'" height="' . $iconHeight . '"') . ' title="' .
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.rename') .'"
alt="" /></a>';
+
+			//info
+		$editOnClick = 'top.launchView(\'' . $fullIdent . '\', \'\');return
false;';
+		$cells[] = '<a href="#" onclick="' . $editOnClick . '"><img' .
t3lib_iconWorks::skinImg('', 'gfx/zoom2.gif', 'width="' . $iconWidth .
'" height="' . $iconHeight . '"') . ' title="' .
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.info') . '"
alt="" /></a>';
+
+
+			// Compile items into a DIV-element:
+		return '							<!-- EDIT CONTROLS: -->
+											<div class="typo3-editCtrl">
+												' . implode('
+												', $cells).'

There are no spaces around the concatenation dot.

Index: typo3/file_list.php

@@ -149,7 +149,8 @@
 			'sort' => '',
 			'reverse' => '',
 			'displayThumbs' => '',
-			'clipBoard' => ''
+			'clipBoard' => '',
+			'bigControlPanel' => ''
 		);

 			// CLEANSE SETTINGS

There is no comma after the last array element.

@@ -274,6 +275,9 @@
 					<div id="typo3-listOptions">
 				';

+			   		// Add "display bigControlPanel" checkbox:	
+			
$pageContent.=t3lib_BEfunc::getFuncCheck($this->id,'SET[bigControlPanel]',$this->MOD_SETTINGS['bigControlPanel'],'file_list.php','','id="bigControlPanel"').'
<label
for="bigControlPanel">'.$LANG->getLL('bigControlPanel',1).'</label><br />';

There are no spaces around the .=. There are no spaces after the commas
between function parameters. There are no spaces around the
concatenation dots.

Greets,

Niels


More information about the TYPO3-team-core mailing list