Work on merge tab photos and attached files

This commit is contained in:
Laurent Destailleur 2015-06-19 00:52:58 +02:00
parent d8f86708b1
commit b5cc7ae1c8
3 changed files with 63 additions and 45 deletions

View File

@ -840,7 +840,12 @@ class FormFile
$fileinfo = pathinfo($file['name']); $fileinfo = pathinfo($file['name']);
print '<td align="center">'; print '<td align="center">';
$minifile=$fileinfo['filename'].'_mini.'.strtolower($fileinfo['extension']); // Thumbs are created with filename in lower case $minifile=$fileinfo['filename'].'_mini.'.strtolower($fileinfo['extension']); // Thumbs are created with filename in lower case
if (image_format_supported($file['name']) > 0) print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">'; if (image_format_supported($file['name']) > 0)
{
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
print '</a>';
}
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
} }
@ -848,6 +853,15 @@ class FormFile
// ($param must start with &) // ($param must start with &)
print '<td align="right">'; print '<td align="right">';
if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; '; if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; ';
else
{
if (image_format_supported($file['name']) > 0)
{
// TODO Add link from photo page here
}
}
if ($permtodelete) if ($permtodelete)
{ {
/* /*

View File

@ -3552,7 +3552,8 @@ class Product extends CommonObject
// 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').': '.$pdir.$photo;
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; $alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
if ($photo_vignette && $imgarray['height'] > $maxHeight) { if ($photo_vignette && $imgarray['height'] > $maxHeight)
{
$return.= '<!-- Show thumb -->'; $return.= '<!-- Show thumb -->';
$return.= '<img class="photo photowithmargin" border="0" '.($conf->dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; $return.= '<img class="photo photowithmargin" border="0" '.($conf->dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
} }

View File

@ -275,8 +275,10 @@ if ($object->id)
'tr_TR', 'tr_TR',
'zh_CN' 'zh_CN'
); );
foreach ( $langs_available as $key => $value ) { foreach ( $langs_available as $key => $value )
if ($showwarning && in_array($key, $uncompletelanguages)) { {
if ($showwarning && in_array($key, $uncompletelanguages))
{
// $value.=' - '.$langs->trans("TranslationUncomplete",$key); // $value.=' - '.$langs->trans("TranslationUncomplete",$key);
} }
if ($filter && is_array($filter)) { if ($filter && is_array($filter)) {
@ -299,10 +301,10 @@ if ($object->id)
} }
$style = 'impair'; $style = 'impair';
foreach ( $filearray as $filetoadd ) { foreach ($filearray as $filetoadd)
{
if ($ext = pathinfo($filetoadd['name'], PATHINFO_EXTENSION) == 'pdf') { if ($ext = pathinfo($filetoadd['name'], PATHINFO_EXTENSION) == 'pdf')
{
if ($style == 'pair') { if ($style == 'pair') {
$style = 'impair'; $style = 'impair';
} else { } else {
@ -329,10 +331,11 @@ if ($object->id)
print '</td></tr>'; print '</td></tr>';
} }
} }
print '<tr><td>';
print '<tr><td>';
print '<input type="submit" class="button" name="save" value="' . $langs->trans('Save') . '">'; print '<input type="submit" class="button" name="save" value="' . $langs->trans('Save') . '">';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';