2
0
forked from Wavyzz/dolibarr

NEW Reduce nb of picto on ref into list, merging preview and download

This commit is contained in:
Laurent Destailleur
2016-08-05 12:18:51 +02:00
parent 57a542d52d
commit e168888c59
13 changed files with 170 additions and 91 deletions

View File

@@ -5647,3 +5647,26 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
return ($dirName?$dirName.'/':'').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
}
/**
* Return URL we can use for advanced preview links
*
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $relativepath Relative path of docs
* @return string Output string with HTML
*/
function getAdvancedPreviewUrl($modulepart, $relativepath)
{
global $conf;
if (empty($conf->use_javascript_ajax)) return '';
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css');
//$mime_preview[]='vnd.oasis.opendocument.presentation';
//$mime_preview[]='archive';
$num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview);
if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.$relativepath).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js('ttt').'\')';
else return '';
}