* @param integer Optional: $size is [w]x[h] of the thumbnail. 56 is default.
* @return string Thumbnail image tag.
*/
- function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir='',$abs=0,$tparams='',$size='') {
+ function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir=NULL,$abs=0,$tparams='',$size='') {
global $TCA;
// Load table.
t3lib_div::loadTCA($table);
// Find uploaddir automatically
- $uploaddir = $uploaddir ? $uploaddir : $TCA[$table]['columns'][$field]['config']['uploadfolder'];
+ $uploaddir = (is_null($uploaddir)) ? $TCA[$table]['columns'][$field]['config']['uploadfolder'] : $uploaddir;
+ $uploaddir = preg_replace('#/$#','',$uploaddir);
// Set thumbs-script:
if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
$max=0;
if (t3lib_div::inList('gif,jpg,png',$ext)) {
$imgInfo=@getimagesize(PATH_site.$uploaddir.'/'.$theFile);
- if (is_array($imgInfo)) {$max = max($imgInfo);}
+ if (is_array($imgInfo)) {$max = max($imgInfo[0],$imgInfo[1]);}
}
// use the original image if it's size fits to the thumbnail size
if ($max && $max<=(count($sizeParts)&&max($sizeParts)?max($sizeParts):56)) {
$thumbData.='<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="../'.$backPath.$url.'" '.$imgInfo[3].' hspace="2" border="0" title="'.trim($url).'"'.$tparams.' alt="" /></a> ';
// New 190201 stop
} elseif ($ext=='ttf' || t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$ext)) {
- $theFile = ($abs?'':'../').$uploaddir.'/'.trim($theFile);
+ $theFile = ($abs?'':'../').($uploaddir?$uploaddir.'/':'').trim($theFile);
$params = '&file='.rawurlencode($theFile);
$params .= $size?'&size='.$size:'';
$url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
* See Inside TYPO3 for details about how to use / make Function menus
* Usage: 50
*
- * @param string $id is the "&id=" parameter value to be sent to the module
+ * @param string $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
* @param string $elementName it the form elements name, probably something like "SET[...]"
* @param string $currentValue is the value to be selected currently.
* @param array $menuItems is an array with the menu items for the selector box
* @param string $addParams is additional parameters to pass to the script.
* @return string HTML code for selector box
*/
- function getFuncMenu($id,$elementName,$currentValue,$menuItems,$script='',$addparams='') {
+ function getFuncMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') {
if (is_array($menuItems)) {
+ if (!is_array($mainParams)) {
+ $mainParams = array('id' => $mainParams);
+ }
+ $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams);
+
if (!$script) { $script=basename(PATH_thisScript); }
$options = array();
'</option>';
}
if (count($options)) {
- $onChange = 'jumpToUrl(\''.$script.'?id='.rawurlencode($id).$addparams.'&'.$elementName.'=\'+this.options[this.selectedIndex].value,this);';
+ $onChange = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+this.options[this.selectedIndex].value,this);';
return '
<!-- Function Menu of module -->
* Works like ->getFuncMenu() but takes no $menuItem array since this is a simple checkbox.
* Usage: 34
*
- * @param string $id is the "&id=" parameter value to be sent to the module
+ * @param string $mainParams $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
* @param string $elementName it the form elements name, probably something like "SET[...]"
* @param string $currentValue is the value to be selected currently.
* @param string $script is the script to send the &id to, if empty it's automatically found
* @return string HTML code for checkbox
* @see getFuncMenu()
*/
- function getFuncCheck($id,$elementName,$currentValue,$script='',$addparams='',$tagParams='') {
+ function getFuncCheck($mainParams,$elementName,$currentValue,$script='',$addparams='',$tagParams='') {
+ if (!is_array($mainParams)) {
+ $mainParams = array('id' => $mainParams);
+ }
+ $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams);
+
if (!$script) {basename(PATH_thisScript);}
- $onClick = 'jumpToUrl(\''.$script.'?id='.$id.$addparams.'&'.$elementName.'=\'+(this.checked?1:0),this);';
+ $onClick = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+(this.checked?1:0),this);';
return '<input type="checkbox" name="'.$elementName.'"'.($currentValue?' checked="checked"':'').' onclick="'.htmlspecialchars($onClick).'"'.($tagParams?' '.$tagParams:'').' />';
}
* Works like ->getFuncMenu() / ->getFuncCheck() but displays a input field instead which updates the script "onchange"
* Usage: 1
*
- * @param string $id is the "&id=" parameter value to be sent to the module
+ * @param string $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
* @param string $elementName it the form elements name, probably something like "SET[...]"
* @param string $currentValue is the value to be selected currently.
* @param integer Relative size of input field, max is 48
* @return string HTML code for input text field.
* @see getFuncMenu()
*/
- function getFuncInput($id,$elementName,$currentValue,$size=10,$script="",$addparams="") {
+ function getFuncInput($mainParams,$elementName,$currentValue,$size=10,$script="",$addparams="") {
+ if (!is_array($mainParams)) {
+ $mainParams = array('id' => $mainParams);
+ }
+ $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams);
+
if (!$script) {basename(PATH_thisScript);}
- $onChange = 'jumpToUrl(\''.$script.'?id='.$id.$addparams.'&'.$elementName.'=\'+escape(this.value),this);';
+ $onChange = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+escape(this.value),this);';
return '<input type="text"'.$GLOBALS['TBE_TEMPLATE']->formWidth($size).' name="'.$elementName.'" value="'.htmlspecialchars($currentValue).'" onchange="'.htmlspecialchars($onChange).'" />';
}