X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/e66275acdf79f04c346d13ed2af3e69335402d79..7cea94c8edbe92d117fdcc08a3a958caf6abc6ae:/typo3/class.browse_links.php diff --git a/typo3/class.browse_links.php b/typo3/class.browse_links.php index 10de7d008f2..3734d3d311b 100755 --- a/typo3/class.browse_links.php +++ b/typo3/class.browse_links.php @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * -* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) +* (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -234,14 +234,14 @@ class TBE_browser_recordList extends localRecordList { } /** - * Returns the title (based on $code) of a table ($table) without a link + * Local version that sets allFields to true to support userFieldSelect * - * @param string Table name - * @param string Table label - * @return string The linked table label + * @return void + * @see fieldSelectBox */ - function linkWrapTable($table,$code) { - return $code; + function generateList() { + $this->allFields = true; + parent::generateList(); } } @@ -663,6 +663,7 @@ class browse_links { var $setTarget; // Target (RTE specific) var $setTitle; // title (RTE specific) var $doc; // Backend template object + var $elements = array(); // Holds information about files // GPvars: (Input variables from outside) /** @@ -958,7 +959,7 @@ class browse_links { // This is JavaScript especially for the TBE Element Browser! $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']'; - + // insertElement - Call check function (e.g. for uniqueness handling): if ($pArr[4] && $pArr[5]) { $JScodeCheck = ' @@ -1013,7 +1014,7 @@ class browse_links { focusOpenerAndClose(close); '; } - + $JScode.=' var elRef=""; var targetDoc=""; @@ -1057,15 +1058,14 @@ class browse_links { } } function focusOpenerAndClose(close) { // - if (close) { - parent.window.opener.focus(); - parent.close(); - } + BrowseLinks.focusOpenerAndClose(close); } '; // Finally, add the accumulated JavaScript to the template object: - $this->doc->JScode = $this->doc->wrapScriptTags($JScode); + $this->doc->JScode = ''."\n"; + $this->doc->JScode.= ''."\n"; + $this->doc->JScode.= $this->doc->wrapScriptTags($JScode); // Debugging: if (FALSE) debug(array( @@ -1448,6 +1448,8 @@ class browse_links { $pagetree = t3lib_div::makeInstance('TBE_PageTree'); $pagetree->thisScript=$this->thisScript; $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0; + $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); + $pagetree->addField('nav_title'); $tree=$pagetree->getBrowsableTree(); // Making the list of elements, if applicable: @@ -1515,7 +1517,7 @@ class browse_links { $_MCONF['name']='file_list'; $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']); $addParams = '&act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams); - $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],$this->thisScript,$addParams).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1); + $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],$this->thisScript,$addParams,'id="checkDisplayThumbs"').' '; } else { $thumbNailCheck=''; } @@ -1557,6 +1559,8 @@ class browse_links { // Add some space $content.='

'; + // Setup indexed elements: + $this->doc->JScode.= $this->doc->wrapScriptTags('BrowseLinks.addElements('.t3lib_div::array2json($this->elements).');'); // Ending page, returning content: $content.= $this->doc->endPage(); $content = $this->doc->insertStylesAndJS($content); @@ -1735,6 +1739,12 @@ class browse_links { // Add the HTML for the record list to output variable: $out.=$dblist->HTMLcode; + + // Add support for fieldselectbox in singleTableMode + if ($dblist->table) { + $out.= $dblist->fieldSelectBox($dblist->table); + } + $out.=$dblist->getSearchBox(); } @@ -1867,7 +1877,9 @@ class browse_links { if (is_array($files)) { // Create headline (showing number of files): - $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files))); + $filesCount = count($files); + $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):', $filesCount)); + $out.=$this->getBulkSelector($filesCount); $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']); @@ -1890,7 +1902,7 @@ class browse_links { $fI=pathinfo($filepath); // Thumbnail/size generation: - if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$fI['extension']) && !$noThumbs) { + if (t3lib_div::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),strtolower($fI['extension'])) && !$noThumbs) { $imgInfo = $imgObj->getImageDimensions($filepath); $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels'; $clickIcon = t3lib_BEfunc::getThumbNail($BACK_PATH.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"'); @@ -1908,9 +1920,20 @@ class browse_links { if (strstr($filepath,',') || strstr($filepath,'|')) { // In case an invalid character is in the filepath, display error message: $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |')); $ATag = $ATag_alt = ""; + $bulkCheckBox = ''; } else { // If filename is OK, just add it: - $ATag = ""; - $ATag_alt = substr($ATag,0,-4).",'',1);\">"; + $filesIndex = count($this->elements); + $this->elements['file_'.$filesIndex] = array( + 'md5' => t3lib_div::shortMD5($filepath), + 'type' => 'file', + 'fileName' => $fI['basename'], + 'filePath' => $filepath, + 'fileExt' => $fI['extension'], + 'fileIcon' => $ficon, + ); + $ATag = ""; + $ATag_alt = substr($ATag,0,-4).",1);\">"; + $bulkCheckBox = ' '; } $ATag_e=''; @@ -1920,7 +1943,7 @@ class browse_links { $ATag2_e=''; // Combine the stuff: - $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e; + $filenameAndIcon=$bulkCheckBox.$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e; // Show element: if ($pDim) { // Image... @@ -1962,7 +1985,6 @@ class browse_links { '.implode('',$lines).' '; } - // Return accumulated content for filelisting: return $out; } @@ -2004,13 +2026,13 @@ class browse_links { // Fraverse files: while(list(,$filepath)=each($files)) { - $fI=pathinfo($filepath); + $fI = pathinfo($filepath); // URL of image: $iurl = $this->siteURL.t3lib_div::rawurlencodeFP(substr($filepath,strlen(PATH_site))); // Show only web-images - if (t3lib_div::inList('gif,jpeg,jpg,png',$fI['extension'])) { + if (t3lib_div::inList('gif,jpeg,jpg,png',strtolower($fI['extension']))) { $imgInfo = @getimagesize($filepath); $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels'; @@ -2284,7 +2306,7 @@ class browse_links { $code.='
- '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).' +
'; @@ -2339,6 +2361,29 @@ class browse_links { return $code; } + + /** + * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser. + * + * @param integer $filesCount: Number of files currently displayed + * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned + */ + function getBulkSelector($filesCount) { + if ($filesCount) { + $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:toggleSelection',1); + $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:importSelection',1); + + $out = $this->doc->spacer(15).'
' . + '' . + ' ' . + $labelToggleSelection.''.$this->doc->spacer(5) . + '' . + ' ' . + $labelImportSelection.'' . + '
'.$this->doc->spacer(15); + } + return $out; + } } // Include extension? @@ -2347,4 +2392,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class } -?> \ No newline at end of file +?>