diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index cf8557de961..d177e7d99c1 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -856,7 +856,8 @@ function newpopup(url, title) { } /** - * Function show document preview. Use the "dialog" function. + * Function show document preview. It uses the "dialog" function. + * The a tag around the img must have the src='', class='documentpreview', mime='image/xxx', target='_blank' from getAdvancedPreviewUrl(). * * @param string file Url * @param string type Mime file type ("image/jpeg", "application/pdf", "text/html") diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 48d192843d8..cf6082f3bd8 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -417,11 +417,25 @@ function showWebsiteTemplates(Website $website) print '
'; - $file=$dirtheme."/".$subdirwithoutzip.".jpg"; + $file = $dirtheme."/".$subdirwithoutzip.".jpg"; $url=DOL_URL_ROOT.'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.".jpg"; if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png'; + + $originalfile = basename($file); + $entity = $conf->entity; + $modulepart = 'doctemplateswebsite'; + $cache = ''; + $title = $file; + + $ret=''; + $urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile, 1, '&entity='.$entity); + if (! empty($urladvanced)) $ret.=''; + else $ret.=''; + print $ret; print ''.$title.''; + print ''; + print '
'; print $subdir.' ('.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).')'; print '
ref.'&templateuserfile='.$subdir.'" class="button">'.$langs->trans("Load").'';