forked from Wavyzz/dolibarr
Fix document_preview is possible on files with + chars inside.
This commit is contained in:
@@ -673,6 +673,7 @@ else
|
||||
|
||||
print "</table><br>";
|
||||
|
||||
print '<hr style="margin-bottom: 20px">';
|
||||
|
||||
// Add personnal information
|
||||
print load_fiche_titre('<div class="comboperso">'.$langs->trans("PersonalInformations").'</div>','','');
|
||||
|
||||
@@ -867,9 +867,9 @@ class FormFile
|
||||
|
||||
// Preview
|
||||
$urladvanced = getAdvancedPreviewUrl($modulepart, $relativepath);
|
||||
if ($urladvanced) $tmpout.= '<li><a data-ajax="false" href="'.$urladvanced.'">'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
if ($urladvanced) $tmpout.= '<li><a href="'.$urladvanced.'">'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
// Download
|
||||
$tmpout.= '<li><a data-ajax="false" class="pictopreview" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$tmpout.= '<li><a 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.= '>';
|
||||
@@ -1679,10 +1679,11 @@ class FormFile
|
||||
$out='';
|
||||
if ($conf->browser->layout != 'phone')
|
||||
{
|
||||
$urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath); // Return if a file is qualified for preview
|
||||
if ($urladvancedpreview)
|
||||
$urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath, 1); // Return if a file is qualified for preview.
|
||||
if (count($urladvancedpreview))
|
||||
{
|
||||
$out.= '<a data-ajax="false" class="pictopreview" href="'.$urladvancedpreview.'">';
|
||||
$out.= '<a class="pictopreview '.$urladvancedpreview['css'].'" href="'.$urladvancedpreview['url'].'"'.(empty($urladvancedpreview['mime'])?'':' mime="'.$urladvancedpreview['mime'].'"').' '.(empty($urladvancedpreview['target'])?'':' target="'.$urladvancedpreview['target'].'"').'>';
|
||||
//$out.= '<a class="pictopreview">';
|
||||
if (empty($ruleforpicto)) $out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail');
|
||||
else $out.= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']);
|
||||
$out.= '</a>';
|
||||
|
||||
@@ -693,7 +693,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
$colspan=9;
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
|
||||
@@ -728,21 +727,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
// Photo
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
// Name - Position
|
||||
// Photo - Name
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">';
|
||||
print '</td>';
|
||||
|
||||
// Address / Phone
|
||||
// Position
|
||||
print '<td class="liste_titre">';
|
||||
//print '<input type="text" class="flat" name="search_addressphone" size="20" value="'.$search_addressphone.'">';
|
||||
print '</td>';
|
||||
|
||||
// Email
|
||||
// Address - Phone - Email
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
// Status
|
||||
@@ -797,13 +791,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Photo
|
||||
print '<td width="50px">';
|
||||
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder','small',1,0,1);
|
||||
print '</td>';
|
||||
|
||||
// Name
|
||||
// Photo - Name
|
||||
print '<td>';
|
||||
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1);
|
||||
print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage));
|
||||
print '</td>';
|
||||
|
||||
@@ -812,7 +802,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
if ($obj->poste) print $obj->poste;
|
||||
print '</td>';
|
||||
|
||||
// Address and phone
|
||||
// Address - Phone - Email
|
||||
print '<td>';
|
||||
print $contactstatic->getBannerAddress('contact', $object);
|
||||
print '</td>';
|
||||
|
||||
@@ -5855,10 +5855,11 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
||||
* 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
|
||||
* @param string $relativepath Relative path of docs.
|
||||
* @param int $alldata Return array with all components (1 is recommended)
|
||||
* @return string|array Output string with href link or array with all components of link
|
||||
*/
|
||||
function getAdvancedPreviewUrl($modulepart, $relativepath)
|
||||
function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -5869,7 +5870,14 @@ function getAdvancedPreviewUrl($modulepart, $relativepath)
|
||||
//$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($langs->trans('Preview')).'\')';
|
||||
if ($alldata == 1)
|
||||
{
|
||||
if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath), 'mime'=>dol_mimetype($relativepath), );
|
||||
else return array();
|
||||
}
|
||||
|
||||
// old behavior
|
||||
if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath)).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')';
|
||||
else return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -1882,7 +1882,9 @@ if (! function_exists("llxFooter"))
|
||||
|
||||
if (! empty($delayedhtmlcontent)) print $delayedhtmlcontent;
|
||||
|
||||
// Wrapper to show tooltips
|
||||
// TODO Move this in lib_head.js
|
||||
|
||||
// Wrapper to show tooltips (html or onclick popup)
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover))
|
||||
{
|
||||
print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
|
||||
@@ -1902,6 +1904,21 @@ if (! function_exists("llxFooter"))
|
||||
</script>' . "\n";
|
||||
}
|
||||
|
||||
// Wrapper to manage document_preview
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print "\n<!-- JS CODE TO ENABLE document_preview -->\n";
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".documentpreview").click(function () {
|
||||
console.log("We click on preview for element with href="+$(this).attr(\'href\')+" mime="+$(this).attr(\'mime\'));
|
||||
document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), \''.dol_escape_js($langs->transnoentities("Preview")).'\');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>' . "\n";
|
||||
}
|
||||
|
||||
// Wrapper to manage dropdown
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
|
||||
@@ -802,7 +802,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="nofichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
@@ -845,7 +845,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
print '<textarea name="domiciliation" rows="'.ROWS_4.'" cols="40" maxlength="255">';
|
||||
print '<textarea name="domiciliation" rows="'.ROWS_4.'" class="quatrevingtpercent" maxlength="255">';
|
||||
print GETPOST('domiciliation');
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
@@ -854,7 +854,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
|
||||
print '<textarea name="owner_address" rows="'.ROWS_4.'" cols="40" maxlength="255">';
|
||||
print '<textarea name="owner_address" rows="'.ROWS_4.'" class="quatrevingtpercent" maxlength="255">';
|
||||
print GETPOST('owner_address');
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user