forked from Wavyzz/dolibarr
NEW Reduce nb of picto on ref into list, merging preview and download
This commit is contained in:
@@ -634,10 +634,11 @@ if ($result)
|
|||||||
$objectstatic->ref=$obj->ref;
|
$objectstatic->ref=$obj->ref;
|
||||||
|
|
||||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
// Picto + Ref
|
||||||
print '<td class="nobordernopadding nowrap">';
|
print '<td class="nobordernopadding nowrap">';
|
||||||
print $objectstatic->getNomUrl(1);
|
print $objectstatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
// Warning
|
||||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||||
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
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))
|
if (! empty($obj->note_private))
|
||||||
@@ -647,8 +648,7 @@ if ($result)
|
|||||||
print '</span>';
|
print '</span>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
// Other picto tool
|
||||||
// Ref
|
|
||||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||||
$filename=dol_sanitizeFileName($obj->ref);
|
$filename=dol_sanitizeFileName($obj->ref);
|
||||||
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||||
|
|||||||
@@ -5074,37 +5074,32 @@ class Form
|
|||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(".dropdown dt a").on(\'click\', function () {
|
jQuery(document).ready(function () {
|
||||||
$(".dropdown dd ul").slideToggle(\'fast\');
|
$(".dropdown dt a").on(\'click\', function () {
|
||||||
});
|
console.log($( this ).parent().parent().find(\'dd ul\'));
|
||||||
|
$( this ).parent().parent().find(\'dd ul\').slideToggle(\'fast\');
|
||||||
$(".dropdown dd ul li a").on(\'click\', function () {
|
// $(".dropdown dd ul").slideToggle(\'fast\');
|
||||||
$(".dropdown dd ul").hide();
|
});
|
||||||
});
|
|
||||||
|
$(document).bind(\'click\', function (e) {
|
||||||
function getSelectedValue(id) {
|
var $clicked = $(e.target);
|
||||||
return $("#" + id).find("dt a span.value").html();
|
if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide();
|
||||||
}
|
});
|
||||||
|
|
||||||
$(document).bind(\'click\', function (e) {
|
$(\'.multiselectcheckbox'.$htmlname.' input[type="checkbox"]\').on(\'click\', function () {
|
||||||
var $clicked = $(e.target);
|
console.log("A new field was added/removed")
|
||||||
if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide();
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\')
|
||||||
});
|
var title = $(this).val() + ",";
|
||||||
|
if ($(this).is(\':checked\')) {
|
||||||
$(\'.multiselectcheckbox'.$htmlname.' input[type="checkbox"]\').on(\'click\', function () {
|
$(\'.'.$htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
|
||||||
console.log("A new field was added/removed")
|
}
|
||||||
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\')
|
else {
|
||||||
var title = $(this).val() + ",";
|
$(\'.'.$htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
|
||||||
if ($(this).is(\':checked\')) {
|
}
|
||||||
$(\'.'.$htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
|
// Now, we submit page
|
||||||
}
|
$(this).parents(\'form:first\').submit();
|
||||||
else {
|
});
|
||||||
$(\'.'.$htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
|
});
|
||||||
}
|
|
||||||
// Now, we submit page
|
|
||||||
$(this).parents(\'form:first\').submit();
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
';
|
';
|
||||||
@@ -5665,13 +5660,23 @@ class Form
|
|||||||
{
|
{
|
||||||
if ($file && file_exists($dir."/".$file))
|
if ($file && file_exists($dir."/".$file))
|
||||||
{
|
{
|
||||||
if ($addlinktofullsize) $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
if ($addlinktofullsize)
|
||||||
|
{
|
||||||
|
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
|
||||||
|
if ($urladvanced) $ret.='<a href="'.$urladvanced.'">';
|
||||||
|
else $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
||||||
|
}
|
||||||
$ret.='<img alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
|
$ret.='<img alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
|
||||||
if ($addlinktofullsize) $ret.='</a>';
|
if ($addlinktofullsize) $ret.='</a>';
|
||||||
}
|
}
|
||||||
else if ($altfile && file_exists($dir."/".$altfile))
|
else if ($altfile && file_exists($dir."/".$altfile))
|
||||||
{
|
{
|
||||||
if ($addlinktofullsize) $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
if ($addlinktofullsize)
|
||||||
|
{
|
||||||
|
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
|
||||||
|
if ($urladvanced) $ret.='<a href="'.$urladvanced.'">';
|
||||||
|
else $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
||||||
|
}
|
||||||
$ret.='<img alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
|
$ret.='<img alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
|
||||||
if ($addlinktofullsize) $ret.='</a>';
|
if ($addlinktofullsize) $ret.='</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -586,12 +586,14 @@ class FormFile
|
|||||||
{
|
{
|
||||||
$file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview\.png)$','date',SORT_DESC);
|
$file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview\.png)$','date',SORT_DESC);
|
||||||
|
|
||||||
|
$out.= '<!-- html.formfile::showdocuments -->'."\n";
|
||||||
|
|
||||||
// Show title of array if not already shown
|
// Show title of array if not already shown
|
||||||
if ((! empty($file_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown)
|
if ((! empty($file_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown)
|
||||||
{
|
{
|
||||||
$headershown=1;
|
$headershown=1;
|
||||||
$out.= '<div class="titre">'.$titletoshow.'</div>';
|
$out.= '<div class="titre">'.$titletoshow.'</div>'."\n";
|
||||||
$out.= '<table class="border" summary="listofdocumentstable" width="100%">';
|
$out.= '<table class="border" summary="listofdocumentstable" width="100%">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop on each file found
|
// Loop on each file found
|
||||||
@@ -603,14 +605,14 @@ class FormFile
|
|||||||
|
|
||||||
// Define relative path for download link (depends on module)
|
// Define relative path for download link (depends on module)
|
||||||
$relativepath=$file["name"]; // Cas general
|
$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
|
if ($modulepart == 'export') $relativepath = $file["name"]; // Other case
|
||||||
|
|
||||||
$out.= "<tr ".$bc[$var].">";
|
$out.= "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
$documenturl = DOL_URL_ROOT.'/document.php';
|
$documenturl = DOL_URL_ROOT.'/document.php';
|
||||||
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->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
|
// Show file name with link to download
|
||||||
$out.= '<td class="nowrap">';
|
$out.= '<td class="nowrap">';
|
||||||
$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||||
@@ -619,9 +621,8 @@ class FormFile
|
|||||||
$out.= ' target="_blank">';
|
$out.= ' target="_blank">';
|
||||||
$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength);
|
$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength);
|
||||||
$out.= '</a>'."\n";
|
$out.= '</a>'."\n";
|
||||||
|
|
||||||
$out.= $this->showPreview($file,$modulepart,$relativepath);
|
$out.= $this->showPreview($file,$modulepart,$relativepath);
|
||||||
|
|
||||||
$out.= '</td>';
|
$out.= '</td>';
|
||||||
|
|
||||||
// Show file size
|
// Show file size
|
||||||
@@ -706,21 +707,28 @@ class FormFile
|
|||||||
*/
|
*/
|
||||||
function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='')
|
function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='')
|
||||||
{
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
|
$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
|
// For ajax treatment
|
||||||
$out.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\n";
|
$out.= '<!-- html.formfile::getDocumentsLink -->'."\n";
|
||||||
|
|
||||||
if (! empty($file_list))
|
if (! empty($file_list))
|
||||||
{
|
{
|
||||||
|
$out='<dl class="dropdown">
|
||||||
|
<dt><a href="#">'.img_picto('', 'listlight').'</a></dt>
|
||||||
|
<dd><div class="multichoicedoc"><ul class="ulselectedfields" style="display: none;">';
|
||||||
|
$tmpout='';
|
||||||
|
|
||||||
// Loop on each file found
|
// Loop on each file found
|
||||||
foreach($file_list as $file)
|
foreach($file_list as $file)
|
||||||
{
|
{
|
||||||
|
$i++;
|
||||||
if ($filter && ! preg_match('/'.$filter.'/i', $file["name"])) continue; // Discard this. It does not match provided filter.
|
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)
|
// Define relative path for download link (depends on module)
|
||||||
@@ -734,22 +742,31 @@ class FormFile
|
|||||||
$relativepath = $file["name"];
|
$relativepath = $file["name"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show file name with link to download
|
|
||||||
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
|
||||||
$mime=dol_mimetype($relativepath,'',0);
|
|
||||||
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
|
|
||||||
$out.= '>';
|
|
||||||
$out.= img_mime($relativepath, $file["name"]);
|
|
||||||
$out.= '</a>'."\n";
|
|
||||||
|
|
||||||
$out.= $this->showPreview($file,$modulepart,$relativepath);
|
|
||||||
|
|
||||||
$this->infofiles['nboffiles']++;
|
$this->infofiles['nboffiles']++;
|
||||||
$this->infofiles['files'][]=$file['fullname'];
|
$this->infofiles['files'][]=$file['fullname'];
|
||||||
$ext=pathinfo($file["name"], PATHINFO_EXTENSION);
|
$ext=pathinfo($file["name"], PATHINFO_EXTENSION);
|
||||||
if (empty($this->infofiles[$ext])) $this->infofiles['extensions'][$ext]=1;
|
if (empty($this->infofiles[$ext])) $this->infofiles['extensions'][$ext]=1;
|
||||||
else $this->infofiles['extensions'][$ext]++;
|
else $this->infofiles['extensions'][$ext]++;
|
||||||
|
|
||||||
|
$urladvanced = getAdvancedPreviewUrl($modulepart, $relativepath);
|
||||||
|
if ($urladvanced) $tmpout.= '<li><a href="'.$urladvanced.'">'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||||
|
$tmpout.= '<li><a data-ajax="false" class="pictopreview" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||||
|
$mime=dol_mimetype($relativepath,'',0);
|
||||||
|
if (preg_match('/text/',$mime)) $tmpout.= ' target="_blank"';
|
||||||
|
$tmpout.= '>';
|
||||||
|
$tmpout.=img_mime($relativepath, $file["name"]).' ';
|
||||||
|
$tmpout.= $langs->trans("Download ".$ext);
|
||||||
|
$tmpout.= '</a></li>'."\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$out.=$tmpout;
|
||||||
|
$out.='</ul></div></dd>
|
||||||
|
</dl>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO Add link to regenerate doc ?
|
||||||
|
//$out.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
@@ -845,6 +862,7 @@ class FormFile
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td class="tdoverflow">';
|
print '<td class="tdoverflow">';
|
||||||
|
|
||||||
//print "XX".$file['name']; //$file['name'] must be utf8
|
//print "XX".$file['name']; //$file['name'] must be utf8
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||||
if ($forcedownload) print '&attachment=1';
|
if ($forcedownload) print '&attachment=1';
|
||||||
@@ -864,7 +882,7 @@ class FormFile
|
|||||||
//print dol_trunc($file['name'],$maxlength,'middle');
|
//print dol_trunc($file['name'],$maxlength,'middle');
|
||||||
print $file['name'];
|
print $file['name'];
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
print $this->showPreview($file,$modulepart,$filepath);
|
print $this->showPreview($file,$modulepart,$filepath);
|
||||||
|
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
@@ -882,7 +900,9 @@ class FormFile
|
|||||||
//print $file['path'].'/'.$minifile.'<br>';
|
//print $file['path'].'/'.$minifile.'<br>';
|
||||||
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs
|
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs
|
||||||
//print $file['path'].'/'.$minifile.'<br>';
|
//print $file['path'].'/'.$minifile.'<br>';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
|
$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 '<a href="'.$urlforhref.'" class="aphoto" target="_blank">';
|
||||||
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$minifile).'" title="">';
|
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$minifile).'" title="">';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@@ -1327,30 +1347,31 @@ class FormFile
|
|||||||
|
|
||||||
return $nboflinks;
|
return $nboflinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show detail icon with link for preview
|
* Show detail icon with link for preview
|
||||||
* @param array $file File
|
*
|
||||||
* @param string $modulepart propal, facture, facture_fourn, ...
|
* @param array $file File
|
||||||
* @param string $relativepath Relative path of docs
|
* @param string $modulepart propal, facture, facture_fourn, ...
|
||||||
* @return string $out Output string with HTML
|
* @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;
|
global $langs, $conf;
|
||||||
|
|
||||||
if (empty($conf->use_javascript_ajax)) return '';
|
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
|
$urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath);
|
||||||
$mime_preview = array('jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css');
|
if ($urladvancedpreview)
|
||||||
$num_mime = array_search(dol_mimetype($file['name'], '', 1), $mime_preview);
|
{
|
||||||
|
$out.= '<a data-ajax="false" class="pictopreview" href="'.$urladvancedpreview.'">';
|
||||||
if( $num_mime!== false){
|
if (empty($ruleforpicto)) $out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail');
|
||||||
$out.= ' <a href="javascript:document_preview(\''.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).'\',\''.dol_mimetype($file['name']).'\', \''.$file['name'].'\')">';
|
else $out.= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']);
|
||||||
$out.= img_picto($langs->trans('Preview'), 'detail').'</a>';
|
$out.= '</a>';
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
}
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -950,14 +950,17 @@ function copyToClipboard(text,text2)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Function show document preview
|
* Function show document preview
|
||||||
|
*
|
||||||
* @params string file File path
|
* @params string file File path
|
||||||
* @params string type mime file
|
* @params string type mime file
|
||||||
* @params string title
|
* @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"];
|
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) {
|
if ($.inArray(type, ValidImageTypes) < 0) {
|
||||||
var width='85%';
|
var width='85%';
|
||||||
var object_width='100%';
|
var object_width='100%';
|
||||||
|
|||||||
@@ -5647,3 +5647,26 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
|||||||
|
|
||||||
return ($dirName?$dirName.'/':'').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
|
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 '';
|
||||||
|
}
|
||||||
|
|||||||
@@ -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['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.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_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_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_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);
|
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
|
// Ref
|
||||||
if (! empty($arrayfields['cf.ref']['checked']))
|
if (! empty($arrayfields['cf.ref']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="nobordernopadding nowrap">';
|
print '<td class="nowrap">';
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
// Picto + Ref
|
||||||
|
print '<td class="nobordernopadding nowrap">';
|
||||||
print $objectstatic->getNomUrl(1);
|
print $objectstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
// Warning
|
||||||
|
//print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||||
|
//print '</td>';
|
||||||
|
// Other picto tool
|
||||||
|
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||||
$filename=dol_sanitizeFileName($obj->ref);
|
$filename=dol_sanitizeFileName($obj->ref);
|
||||||
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
|
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
|
||||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||||
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -736,16 +736,24 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
// Picto + Ref
|
||||||
|
print '<td class="nobordernopadding nowrap">';
|
||||||
print $facturestatic->getNomUrl(1);
|
print $facturestatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
// Warning
|
||||||
|
//print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||||
|
//print '</td>';
|
||||||
|
// Other picto tool
|
||||||
|
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||||
$filename=dol_sanitizeFileName($obj->ref);
|
$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);
|
$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);
|
$subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
|
||||||
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
|
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
|
||||||
|
print '</td></tr></table>';
|
||||||
print "</td>\n";
|
|
||||||
|
print "</td>\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customer ref
|
// Customer ref
|
||||||
|
|||||||
@@ -1968,7 +1968,7 @@ if ($action == '' || $action == 'view')
|
|||||||
|
|
||||||
$var=true;
|
$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 '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
|||||||
@@ -3710,11 +3710,18 @@ class Product extends CommonObject
|
|||||||
else if ($nbbyrow < 0) $return .= '<div class="inline-block">';
|
else if ($nbbyrow < 0) $return .= '<div class="inline-block">';
|
||||||
|
|
||||||
$return.= "\n";
|
$return.= "\n";
|
||||||
if (empty($nolink)) $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
|
|
||||||
|
$relativefile=preg_replace('/^\//', '', $pdir.$photo);
|
||||||
|
if (empty($nolink))
|
||||||
|
{
|
||||||
|
$urladvanced=getAdvancedPreviewUrl('product', $relativefile);
|
||||||
|
if ($urladvanced) $return.='<a href="'.$urladvanced.'">';
|
||||||
|
else $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
|
||||||
|
}
|
||||||
|
|
||||||
// Show image (width height=$maxHeight)
|
// Show image (width height=$maxHeight)
|
||||||
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
|
// 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'];
|
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||||
|
|
||||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||||
|
|||||||
BIN
htdocs/theme/eldy/img/listlight.png
Normal file
BIN
htdocs/theme/eldy/img/listlight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 177 B |
@@ -869,8 +869,8 @@ div.nopadding {
|
|||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
}
|
}
|
||||||
.pictowarning {
|
.pictowarning, .pictopreview {
|
||||||
padding-left: 3px;
|
padding-<?php echo $left; ?>: 3px;
|
||||||
}
|
}
|
||||||
.colorthumb {
|
.colorthumb {
|
||||||
padding-left: 1px !important;
|
padding-left: 1px !important;
|
||||||
|
|||||||
BIN
htdocs/theme/md/img/listlight.png
Normal file
BIN
htdocs/theme/md/img/listlight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 177 B |
@@ -912,8 +912,8 @@ table.noborder tr.liste_titre td {
|
|||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
}
|
}
|
||||||
.pictowarning {
|
.pictowarning, .pictopreview {
|
||||||
padding-left: 3px;
|
padding-<?php echo $left; ?>: 3px;
|
||||||
}
|
}
|
||||||
.colorthumb {
|
.colorthumb {
|
||||||
padding-left: 1px !important;
|
padding-left: 1px !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user