';
+ // Picto + Ref
print '| ';
print $objectstatic->getNomUrl(1);
print ' | ';
-
+ // Warning
print '';
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
if (! empty($obj->note_private))
@@ -647,8 +648,7 @@ if ($result)
print '';
}
print ' | ';
-
- // Ref
+ // Other picto tool
print '';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b21aab1af0e..66bb880147f 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5074,37 +5074,32 @@ class Form
';
@@ -5665,13 +5660,23 @@ class Form
{
if ($file && file_exists($dir."/".$file))
{
- if ($addlinktofullsize) $ret.='';
+ if ($addlinktofullsize)
+ {
+ $urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
+ if ($urladvanced) $ret.='';
+ else $ret.='';
+ }
$ret.=' ';
if ($addlinktofullsize) $ret.='';
}
else if ($altfile && file_exists($dir."/".$altfile))
{
- if ($addlinktofullsize) $ret.='';
+ if ($addlinktofullsize)
+ {
+ $urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
+ if ($urladvanced) $ret.='';
+ else $ret.='';
+ }
$ret.=' ';
if ($addlinktofullsize) $ret.='';
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index bd7ee30c277..1ec75cc43ed 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -586,12 +586,14 @@ class FormFile
{
$file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview\.png)$','date',SORT_DESC);
+ $out.= ''."\n";
+
// Show title of array if not already shown
if ((! empty($file_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown)
{
$headershown=1;
- $out.= ''.$titletoshow.' ';
- $out.= '';
+ $out.= ''.$titletoshow.' '."\n";
+ $out.= ''."\n";
}
// Loop on each file found
@@ -603,14 +605,14 @@ class FormFile
// Define relative path for download link (depends on module)
$relativepath=$file["name"]; // Cas general
- if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
+ if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
if ($modulepart == 'export') $relativepath = $file["name"]; // Other case
$out.= "";
$documenturl = DOL_URL_ROOT.'/document.php';
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
-
+
// Show file name with link to download
$out.= '| ';
$out.= '';
$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength);
$out.= ''."\n";
-
+
$out.= $this->showPreview($file,$modulepart,$relativepath);
-
$out.= ' | ';
// Show file size
@@ -706,21 +707,28 @@ class FormFile
*/
function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='')
{
+ global $conf, $langs;
+
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$out='';
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
- $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name fo ref (but not followed by "-" to discard uploaded files)
+ $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
// For ajax treatment
- $out.= ''.img_picto('', 'refresh').' '."\n";
-
+ $out.= ''."\n";
if (! empty($file_list))
{
+ $out='
+ - '.img_picto('', 'listlight').'
+ ';
+ $tmpout='';
+
// Loop on each file found
foreach($file_list as $file)
{
+ $i++;
if ($filter && ! preg_match('/'.$filter.'/i', $file["name"])) continue; // Discard this. It does not match provided filter.
// Define relative path for download link (depends on module)
@@ -734,22 +742,31 @@ class FormFile
$relativepath = $file["name"];
}
- // Show file name with link to download
- $out.= '';
- $out.= img_mime($relativepath, $file["name"]);
- $out.= ''."\n";
-
- $out.= $this->showPreview($file,$modulepart,$relativepath);
-
$this->infofiles['nboffiles']++;
$this->infofiles['files'][]=$file['fullname'];
$ext=pathinfo($file["name"], PATHINFO_EXTENSION);
if (empty($this->infofiles[$ext])) $this->infofiles['extensions'][$ext]=1;
else $this->infofiles['extensions'][$ext]++;
+
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $relativepath);
+ if ($urladvanced) $tmpout.= '- '.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'
';
+ $tmpout.= '- ';
+ $tmpout.=img_mime($relativepath, $file["name"]).' ';
+ $tmpout.= $langs->trans("Download ".$ext);
+ $tmpout.= '
'."\n";
+
}
+ $out.=$tmpout;
+ $out.='
+ ';
+ }
+ else
+ {
+ // TODO Add link to regenerate doc ?
+ //$out.= ''.img_picto('', 'refresh').' '."\n";
}
return $out;
@@ -845,6 +862,7 @@ class FormFile
$var=!$var;
print ' ';
print '';
+
//print "XX".$file['name']; //$file['name'] must be utf8
print '\n";
@@ -882,7 +900,9 @@ class FormFile
//print $file['path'].'/'.$minifile.' ';
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs
//print $file['path'].'/'.$minifile.' ';
- print '';
+ $urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']));
+ if (empty($urlforhref)) $urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']));
+ print '';
print ' ';
print '';
}
@@ -1327,30 +1347,31 @@ class FormFile
return $nboflinks;
}
-
+
+
/**
* Show detail icon with link for preview
- * @param array $file File
- * @param string $modulepart propal, facture, facture_fourn, ...
- * @param string $relativepath Relative path of docs
- * @return string $out Output string with HTML
+ *
+ * @param array $file File
+ * @param string $modulepart propal, facture, facture_fourn, ...
+ * @param string $relativepath Relative path of docs
+ * @param string $ruleforpicto Rule for picto: 0=Preview picto, 1=Use picto of mime type of file)
+ * @return string $out Output string with HTML
*/
- public function showPreview($file, $modulepart, $relativepath){
+ public function showPreview($file, $modulepart, $relativepath, $ruleforpicto=0)
+ {
global $langs, $conf;
- if (empty($conf->use_javascript_ajax)) return '';
-
$out='';
-
- $mime_preview = array('jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css');
- $num_mime = array_search(dol_mimetype($file['name'], '', 1), $mime_preview);
-
- if( $num_mime!== false){
- $out.= ' ';
- $out.= img_picto($langs->trans('Preview'), 'detail').'';
-
- return $out;
+ $urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath);
+ if ($urladvancedpreview)
+ {
+ $out.= '';
+ if (empty($ruleforpicto)) $out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail');
+ else $out.= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']);
+ $out.= '';
}
+ return $out;
}
}
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index d64b05ccd8c..17e8b547487 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -950,14 +950,17 @@ function copyToClipboard(text,text2)
/*
* Function show document preview
+ *
* @params string file File path
* @params string type mime file
* @params string title
*/
-function document_preview(file, type, title){
-
+function document_preview(file, type, title)
+{
+ console.log("document_preview A click was done");
var ValidImageTypes = ["image/gif", "image/jpeg", "image/png"];
-
+ console.log("document_preview A click was done. file="+file+", type="+type);
+
if ($.inArray(type, ValidImageTypes) < 0) {
var width='85%';
var object_width='100%';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 1d14bb2c86f..bc57cb3e405 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -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 '';
+}
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 3f2f77c62e8..3b6c928619f 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -502,7 +502,7 @@ if ($resql)
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['cf.fk_author']['checked'])) print_liste_field_titre($arrayfields['cf.fk_author']['label'],$_SERVER["PHP_SELF"],"u.login","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['cf.date_commande']['checked'])) print_liste_field_titre($arrayfields['cf.date_commande']['label'],$_SERVER["PHP_SELF"],"cf.date_commande","",$param,'align="center"',$sortfield,$sortorder);
- if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'],$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="right"',$sortfield,$sortorder);
+ if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'],$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['cf.total_ht']['checked'])) print_liste_field_titre($arrayfields['cf.total_ht']['label'],$_SERVER["PHP_SELF"],"cf.total_ht","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['cf.total_vat']['checked'])) print_liste_field_titre($arrayfields['cf.total_vat']['label'],$_SERVER["PHP_SELF"],"cf.tva","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['cf.total_ttc']['checked'])) print_liste_field_titre($arrayfields['cf.total_ttc']['label'],$_SERVER["PHP_SELF"],"cf.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
@@ -712,11 +712,23 @@ if ($resql)
// Ref
if (! empty($arrayfields['cf.ref']['checked']))
{
- print ' | ';
+ print ' | ';
+
+ print '';
+ // Picto + Ref
+ print '| ';
print $objectstatic->getNomUrl(1);
+ print ' | ';
+ // Warning
+ //print '';
+ //print ' | ';
+ // Other picto tool
+ print '';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
+ print ' | ';
+
print ' | '."\n";
if (! $i) $totalarray['nbfield']++;
}
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 574501276be..d234ea01bcb 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -736,16 +736,24 @@ if ($resql)
{
print '';
+ print '';
+ // Picto + Ref
+ print '| ';
print $facturestatic->getNomUrl(1);
+ print ' | ';
+ // Warning
+ //print '';
+ //print ' | ';
+ // Other picto tool
+ print '';
$filename=dol_sanitizeFileName($obj->ref);
-
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
$subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
-
- print " | \n";
-
- if (! $i) $totalarray['nbfield']++;
+ print ' ';
+
+ print " | \n";
+ if (! $i) $totalarray['nbfield']++;
}
// Customer ref
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 2ff5e2b5b43..90cc0ef806d 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1968,7 +1968,7 @@ if ($action == '' || $action == 'view')
$var=true;
- $somethingshown=$formfile->show_documents($modulepart,$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang);
+ $somethingshown=$formfile->show_documents($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang);
print '';
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 0a9962ecd7b..3f8e258b9ea 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3710,11 +3710,18 @@ class Product extends CommonObject
else if ($nbbyrow < 0) $return .= ' ';
$return.= "\n";
- if (empty($nolink)) $return.= ' ';
+
+ $relativefile=preg_replace('/^\//', '', $pdir.$photo);
+ if (empty($nolink))
+ {
+ $urladvanced=getAdvancedPreviewUrl('product', $relativefile);
+ if ($urladvanced) $return.='';
+ else $return.= '';
+ }
// Show image (width height=$maxHeight)
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
- $alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo;
+ $alt=$langs->transnoentitiesnoconv('File').': '.$relativefile;
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
diff --git a/htdocs/theme/eldy/img/listlight.png b/htdocs/theme/eldy/img/listlight.png
new file mode 100644
index 00000000000..c894f28ce38
Binary files /dev/null and b/htdocs/theme/eldy/img/listlight.png differ
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index b052a18fdf7..5602b109b4f 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -869,8 +869,8 @@ div.nopadding {
padding-left: 2px;
padding-right: 2px;
}
-.pictowarning {
- padding-left: 3px;
+.pictowarning, .pictopreview {
+ padding-: 3px;
}
.colorthumb {
padding-left: 1px !important;
diff --git a/htdocs/theme/md/img/listlight.png b/htdocs/theme/md/img/listlight.png
new file mode 100644
index 00000000000..c894f28ce38
Binary files /dev/null and b/htdocs/theme/md/img/listlight.png differ
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index bdfd10fc23d..d8855714c06 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -912,8 +912,8 @@ table.noborder tr.liste_titre td {
padding-left: 2px;
padding-right: 2px;
}
-.pictowarning {
- padding-left: 3px;
+.pictowarning, .pictopreview {
+ padding-: 3px;
}
.colorthumb {
padding-left: 1px !important;
|