Fix: Echec mise en page sur boite rss si echec de recup du flux

This commit is contained in:
Laurent Destailleur 2006-04-06 18:54:10 +00:00
parent b43c4643d1
commit c2fed80874
3 changed files with 10 additions and 6 deletions

View File

@ -69,11 +69,13 @@ class box_external_rss extends ModeleBoxes {
if ($rss->ERROR) {
// Affiche warning car il y a eu une erreur
$title.=" ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate",(isset($rss->date)?dolibarr_print_date($rss->date,"%d %b %Y %H:%M"):'unknown date')));
$this->info_box_head = array('text' => $title);
$this->info_box_head = array('text' => $title,'limit' => 0);
}
$this->info_box_head = array('text' => $title);
else
{
$this->info_box_head = array('text' => $title);
}
for($i = 0; $i < $max ; $i++){
$item = $rss->items[$i];
$href = $item['link'];

View File

@ -70,7 +70,8 @@ class ModeleBoxes
// Affiche titre de la boite
print '<tr class="box_titre"><td';
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
print '>'.dolibarr_trunc($head['text'],$this->MAXLENGTHBOX);
print '>';
print dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX);
if ($head['sublink'])
{
print ' <a href="'.$head['sublink'].'">'.img_picto($head['subtext'],$head['subpicto']).'</a>';

View File

@ -516,11 +516,12 @@ function dolibarr_print_phone($phone,$country="FR")
/**
\brief Tronque une chaine à une taille donnée en ajoutant les points de suspension si cela dépasse
\param string Chaine à tronquer
\param size Longueur max de la chaine
\param size Longueur max de la chaine. Si 0, pas de limite.
\return string Chaine tronquée
*/
function dolibarr_trunc($string,$size=40)
{
if ($size==0) return $string;
if (strlen($string) > $size)
return substr($string,0,$size).'...';
else