Tooltip and cache for boxes

This commit is contained in:
frederic34 2015-01-23 00:55:24 +01:00
parent 6bda61436b
commit 925aa2039b
10 changed files with 252 additions and 192 deletions

View File

@ -500,7 +500,7 @@ if ($id > 0)
{ {
$propal_static = new Propal($db); $propal_static = new Propal($db);
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.ref_client, p.remise, ";
$sql.= " p.datep as dp, p.fin_validite as datelimite"; $sql.= " p.datep as dp, p.fin_validite as datelimite";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
@ -534,6 +534,7 @@ if ($id > 0)
print '<td class="nowrap">'; print '<td class="nowrap">';
$propal_static->id=$objp->propalid; $propal_static->id=$objp->propalid;
$propal_static->ref=$objp->ref; $propal_static->ref=$objp->ref;
$propal_static->ref_client=$objp->ref_client;
print $propal_static->getNomUrl(1); print $propal_static->getNomUrl(1);
if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) {
print " ".img_warning(); print " ".img_warning();
@ -561,7 +562,7 @@ if ($id > 0)
$commande_static=new Commande($db); $commande_static=new Commande($db);
$sql = "SELECT s.nom, s.rowid,"; $sql = "SELECT s.nom, s.rowid,";
$sql.= " c.rowid as cid, c.total_ht, c.ref, c.fk_statut, c.facture,"; $sql.= " c.rowid as cid, c.total_ht, c.ref, c.ref_client, c.fk_statut, c.facture,";
$sql.= " c.date_commande as dc"; $sql.= " c.date_commande as dc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
$sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " WHERE c.fk_soc = s.rowid ";
@ -611,6 +612,7 @@ if ($id > 0)
print '<td class="nowrap">'; print '<td class="nowrap">';
$commande_static->id=$objp->cid; $commande_static->id=$objp->cid;
$commande_static->ref=$objp->ref; $commande_static->ref=$objp->ref;
$commande_static->ref_client=$objp->ref_client;
print $commande_static->getNomUrl(1); print $commande_static->getNomUrl(1);
print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n"; print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>'; print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';

View File

@ -94,7 +94,7 @@ class box_activity extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice'.$fileid; $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice'.$fileid;
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
$data = array(); $data = array();
if ($refresh) { if ($refresh) {
@ -173,7 +173,7 @@ class box_activity extends ModeleBoxes
); );
} }
$cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice2'.$fileid; $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice2'.$fileid;
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
if ($refresh) { if ($refresh) {
@ -255,7 +255,7 @@ class box_activity extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic=new Commande($db); $commandestatic=new Commande($db);
$cachefile = DOL_DATA_ROOT.'/commande/temp/boxactivity-order'.$fileid; $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-order'.$fileid;
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
$data = array(); $data = array();
if ($refresh) { if ($refresh) {
@ -334,7 +334,7 @@ class box_activity extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic=new Propal($db); $propalstatic=new Propal($db);
$cachefile = DOL_DATA_ROOT.'/propale/temp/boxactivity-propal'.$fileid; $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-propal'.$fileid;
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
$data = array(); $data = array();
if ($refresh) { if ($refresh) {

View File

@ -127,7 +127,7 @@ class box_comptes extends ModeleBoxes
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][3] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code) 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
); );
$i++; $i++;
@ -148,10 +148,10 @@ class box_comptes extends ModeleBoxes
'td' => 'align="right" class="liste_total"', 'td' => 'align="right" class="liste_total"',
'text' => '&nbsp;' 'text' => '&nbsp;'
); );
$totalamount=price($solde,0,$langs,0,0,-1,$key);
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][3] = array(
'td' => 'align="right" class="liste_total"', 'td' => 'align="right" class="liste_total"',
'text' => $totalamount 'text' => price($solde, 0, $langs, 0, 0, -1, $key)
); );
$i++; $i++;
} }

View File

@ -113,36 +113,52 @@ class box_members extends ModeleBoxes
$memberstatic->name=$objp->company; $memberstatic->name=$objp->company;
} }
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); 'tooltip' => $memberstatic->getFullName($langs),
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid,
);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array(
'td' => 'align="left"',
'text' => $memberstatic->getFullName($langs), 'text' => $memberstatic->getFullName($langs),
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); 'tooltip' => $memberstatic->getFullName($langs),
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid,
);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array(
'text' => dol_print_date($datem, "day")); 'td' => 'align="right"',
'text' => dol_print_date($datem, "day"),
);
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][3] = array(
'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3)); 'td' => 'align="right" width="18"',
'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3),
);
$i++; $i++;
} }
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers")); if ($num==0)
$this->info_box_contents[$i][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedCustomers"),
);
$db->free($result); $db->free($result);
} } else {
else { $this->info_box_contents[0][0] = array(
$this->info_box_contents[0][0] = array( 'td' => 'align="left"', 'td' => 'align="left"',
'maxlength'=>500, 'maxlength'=>500,
'text' => ($db->error().' sql='.$sql)); 'text' => ($db->error().' sql='.$sql),
);
} }
} } else {
else { $this->info_box_contents[0][0] = array(
$this->info_box_contents[0][0] = array('align' => 'left', 'align' => 'left',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"),
);
} }
} }

View File

@ -99,13 +99,19 @@ class box_produits extends ModeleBoxes
} }
} }
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array(
'td' => 'align="left" width="16"',
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); 'tooltip' => $objp->label,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid,
);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array(
'td' => 'align="left"',
'text' => $objp->label, 'text' => $objp->label,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); 'tooltip' => $objp->label,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid,
);
if ($objp->price_base_type == 'HT') if ($objp->price_base_type == 'HT')
{ {
@ -117,37 +123,52 @@ class box_produits extends ModeleBoxes
$price=price($objp->price_ttc); $price=price($objp->price_ttc);
$price_base_type=$langs->trans("TTC"); $price_base_type=$langs->trans("TTC");
} }
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array(
'text' => $price); 'td' => 'align="right"',
'text' => $price,
);
$this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', $this->info_box_contents[$i][3] = array(
'text' => $price_base_type); 'td' => 'align="left" class="nowrap"',
'text' => $price_base_type,
);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array(
'text' => dol_print_date($datem,'day')); 'td' => 'align="right"',
'text' => dol_print_date($datem,'day'),
);
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][5] = array(
'text' => $productstatic->LibStatut($objp->tosell,3,0)); 'td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tosell,3,0),
);
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][6] = array(
'text' => $productstatic->LibStatut($objp->tobuy,3,1)); 'td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tobuy,3,1),
);
$i++; $i++;
} }
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProducts")); if ($num==0)
$this->info_box_contents[$i][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedProducts"),
);
$db->free($result); $db->free($result);
} } else {
else $this->info_box_contents[0][0] = array(
{ 'td' => 'align="left"',
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
'maxlength'=>500, 'maxlength'=>500,
'text' => ($db->error().' sql='.$sql)); 'text' => ($db->error().' sql='.$sql),
);
} }
} } else {
else { $this->info_box_contents[0][0] = array(
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"),
);
} }
} }

View File

@ -178,14 +178,25 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
*/ */
function showBox($head, $contents) function showBox($head, $contents)
{ {
global $langs,$conf; global $langs, $user, $conf;
require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
$bcx=array(); $bcx=array();
$bcx[0] = 'class="box_pair"'; $bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"'; $bcx[1] = 'class="box_impair"';
$var = false; $var = false;
$now = dol_now();
$cachetime = 900; // 900 : 15mn
$fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache';
$cachedir = DOL_DATA_ROOT.'/cache/boxes';
if (! dol_is_dir($cachedir)) dol_mkdir($cachedir);
$cachefile = $cachedir.'/box-'.$fileid;
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
$out = '';
if ($refresh) {
dol_syslog(get_class($this).'::showBox'); dol_syslog(get_class($this).'::showBox');
// Define nbcol and nblines of the box to show // Define nbcol and nblines of the box to show
@ -193,57 +204,57 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
if (isset($contents[0])) $nbcol=count($contents[0]); if (isset($contents[0])) $nbcol=count($contents[0]);
$nblines=count($contents); $nblines=count($contents);
print "\n\n<!-- Box start -->\n"; $out.= "\n<!-- Box ".get_class($this)." start -->\n";
print '<div class="box" id="boxto_'.$this->box_id.'">'."\n"; $out.= '<div class="box" id="boxto_'.$this->box_id.'">'."\n";
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
{ {
print '<table summary="boxtable'.$this->box_id.'" width="100%" class="noborder boxtable">'."\n"; $out.= '<table summary="boxtable'.$this->box_id.'" width="100%" class="noborder boxtable">'."\n";
} }
// Show box title // Show box title
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto'])) if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']))
{ {
//print '<div id="boxto_'.$this->box_id.'_title">'."\n"; //$out.= '<div id="boxto_'.$this->box_id.'_title">'."\n";
//print '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n"; //$out.= '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
print '<tr class="box_titre">'; $out.= '<tr class="box_titre">';
print '<td'; $out.= '<td';
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; } if ($nbcol > 0) { $out.= ' colspan="'.$nbcol.'"'; }
print '>'; $out.= '>';
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print '<table summary="" class="nobordernopadding" width="100%"><tr><td>'; $out.= '<table summary="" class="nobordernopadding" width="100%"><tr><td>';
} }
if (! empty($head['text'])) if (! empty($head['text']))
{ {
$s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX); $s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX);
print $s; $out.= $s;
} }
print ' '; $out.= ' ';
if (! empty($head['sublink'])) print '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>'; if (! empty($head['sublink'])) $out.= '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>';
if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); if (! empty($head['subpicto'])) $out.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"');
if (! empty($head['sublink'])) '</a>'; if (! empty($head['sublink'])) '</a>';
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
print '</td><td class="nocellnopadd boxclose nowrap">'; $out.= '</td><td class="nocellnopadd boxclose nowrap">';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); $out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"');
print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); $out.= img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
$label=$head['text']; $label=$head['text'];
if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')';
print '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">'; $out.= '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">';
print '</td></tr></table>'; $out.= '</td></tr></table>';
} }
print '</td>'; $out.= '</td>';
print "</tr>\n"; $out.= "</tr>\n";
//print "</table>\n"; //$out.= "</table>\n";
//print "</div>\n"; //$out.= "</div>\n";
} }
// Show box lines // Show box lines
if ($nblines) if ($nblines)
{ {
//print '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n"; //$out.= '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
// Loop on each record // Loop on each record
for ($i=0, $n=$nblines; $i < $n; $i++) for ($i=0, $n=$nblines; $i < $n; $i++)
{ {
@ -252,8 +263,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
$var=!$var; $var=!$var;
// TR // TR
if (isset($contents[$i][0]['tr'])) print '<tr valign="top" '.$contents[$i][0]['tr'].'>'; if (isset($contents[$i][0]['tr'])) $out.= '<tr valign="top" '.$contents[$i][0]['tr'].'>';
else print '<tr valign="top" '.$bcx[$var].'>'; else $out.= '<tr valign="top" '.$bcx[$var].'>';
// Loop on each TD // Loop on each TD
$nbcolthisline=count($contents[$i]); $nbcolthisline=count($contents[$i]);
@ -268,62 +279,70 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
$text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:''; $text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:'';
$text2withnotags=preg_replace('/<([^>]+)>/i','',$text2); $text2withnotags=preg_replace('/<([^>]+)>/i','',$text2);
$textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:''; $textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:'';
//print "xxx $textwithnotags y"; //$out.= "xxx $textwithnotags y";
if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']=""; if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']="";
$tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:''; $tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:'';
print '<td'.$tdparam.'>'."\n"; $out.= '<td'.$tdparam.'>'."\n";
// Url // Url
if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo'])) if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo']))
{ {
print '<a href="'.$contents[$i][$j]['url'].'" title="'.dol_escape_htmltag($langs->trans("Show").' '.$tooltip, 1).'" class="classfortooltip"'; $out.= '<a href="'.$contents[$i][$j]['url'].'" title="'.dol_escape_htmltag($langs->trans("Show").' '.$tooltip, 1).'" class="classfortooltip"';
//print ' alt="'.$textwithnotags.'"'; // Pas de alt sur un "<a href>" //$out.= ' alt="'.$textwithnotags.'"'; // Pas de alt sur un "<a href>"
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; $out.= isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
print '>'; $out.= '>';
} }
// Logo // Logo
if (! empty($contents[$i][$j]['logo'])) if (! empty($contents[$i][$j]['logo']))
{ {
$logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']); $logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']);
print '<a href="'.$contents[$i][$j]['url'].'">'; $out.= '<a href="'.$contents[$i][$j]['url'].'">';
print img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"'); $out.= img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"');
} }
$maxlength=$MAXLENGTHBOX; $maxlength=$MAXLENGTHBOX;
if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength']; if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength); if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength);
if (preg_match('/^<img/i',$text) || ! empty($contents[$i][$j]['asis'])) print $text; // show text with no html cleaning if (preg_match('/^<img/i',$text) || ! empty($contents[$i][$j]['asis'])) $out.= $text; // show text with no html cleaning
else print $textwithnotags; // show text with html cleaning else $out.= $textwithnotags; // show text with html cleaning
// End Url // End Url
if (! empty($contents[$i][$j]['url'])) print '</a>'; if (! empty($contents[$i][$j]['url'])) $out.= '</a>';
if (preg_match('/^<img/i',$text2) || ! empty($contents[$i][$j]['asis2'])) print $text2; // show text with no html cleaning if (preg_match('/^<img/i',$text2) || ! empty($contents[$i][$j]['asis2'])) $out.= $text2; // show text with no html cleaning
else print $text2withnotags; // show text with html cleaning else $out.= $text2withnotags; // show text with html cleaning
if (! empty($textnoformat)) print "\n".$textnoformat."\n"; if (! empty($textnoformat)) $out.= "\n".$textnoformat."\n";
print "</td>\n"; $out.= "</td>\n";
} }
print "</tr>\n"; $out.= "</tr>\n";
} }
} }
} }
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
{ {
print "</table>\n"; $out.= "</table>\n";
} }
// If invisible box with no contents // If invisible box with no contents
if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) print "<br>\n"; if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "<br>\n";
print "</div>\n"; $out.= "</div>\n";
print "<!-- Box end -->\n\n"; $out.= "<!-- Box ".get_class($this)." end -->\n\n";
file_put_contents($cachefile,serialize($out),LOCK_EX);
} else {
dol_syslog(get_class($this).'::showBoxCached');
$out = unserialize(file_get_contents($cachefile));
print "<!-- Box ".get_class($this)." from cache -->";
}
print $out;
} }
} }

View File

@ -7,7 +7,7 @@ require '../../main.inc.php';
if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1')
{ {
print "Page available only frome remote address 127.0.0.1"; print "Page available only from remote address 127.0.0.1";
exit; exit;
} }

View File

@ -8,7 +8,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1')
{ {
print "Page available only frome remote address 127.0.0.1"; print "Page available only from remote address 127.0.0.1";
exit; exit;
} }

View File

@ -1748,11 +1748,13 @@ class Societe extends CommonObject
$lien = '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$this->id; $lien = '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$this->id;
} }
$label = $langs->trans("ShowCompany").': '.$name;
// Add type of canvas // Add type of canvas
$lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($name, 1).'" class="classfortooltip">'; $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $lienfin='</a>';
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name, 'company', 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($lien.img_object($label, 'company', 'class="classfortooltip"').$lienfin);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.($maxlen?dol_trunc($name,$maxlen):$name).$lienfin; $result.=$lien.($maxlen?dol_trunc($name,$maxlen):$name).$lienfin;