Agenda events are cleaner

This commit is contained in:
Laurent Destailleur 2011-06-11 11:01:11 +00:00
parent c7d0405b90
commit b870f584a4
2 changed files with 21 additions and 21 deletions

View File

@ -558,7 +558,8 @@ if (sizeof($listofextcals))
$event->datep=$datestart+$usertime; $event->datep=$datestart+$usertime;
$event->datef=$dateend+$usertime; $event->datef=$dateend+$usertime;
$event->type_code="ICALEVENT"; $event->type_code="ICALEVENT";
$event->libelle='<b>'.$icalevent['SUMMARY'].'</b><br>'.str_replace("\\n", "<br>", $icalevent['DESCRIPTION']); $event->libelle=$icalevent['SUMMARY'];
if ($icalevent['DESCRIPTION']) $event->libelle.='<br>'.dol_nl2br($icalevent['DESCRIPTION'],1);
$event->date_start_in_calendar=$event->datep; $event->date_start_in_calendar=$event->datep;
@ -607,7 +608,7 @@ if (sizeof($listofextcals))
} }
} }
$maxlength=18; $maxnbofchar=18;
$cachethirdparties=array(); $cachethirdparties=array();
$cachecontacts=array(); $cachecontacts=array();
@ -651,7 +652,7 @@ if (empty($action) || $action == 'show_month') // View by month
{ {
$style='cal_other_month'; $style='cal_other_month';
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">'; echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
show_day_events ($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength, $newparam); show_day_events ($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
echo " </td>\n"; echo " </td>\n";
} }
/* Show days of the current month */ /* Show days of the current month */
@ -666,7 +667,7 @@ if (empty($action) || $action == 'show_month') // View by month
if ($today) $style='cal_today'; if ($today) $style='cal_today';
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">'; echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength, $newparam); show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
echo " </td>\n"; echo " </td>\n";
} }
/* Show days after the current month (next month) */ /* Show days after the current month (next month) */
@ -674,7 +675,7 @@ if (empty($action) || $action == 'show_month') // View by month
{ {
$style='cal_other_month'; $style='cal_other_month';
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">'; echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength, $newparam); show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
echo "</td>\n"; echo "</td>\n";
} }
$tmpday++; $tmpday++;
@ -721,14 +722,14 @@ elseif ($action == 'show_week') // View by week
if ($today) $style='cal_today'; if ($today) $style='cal_today';
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">'; echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxlength, $newparam, 1, 300); show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo " </td>\n"; echo " </td>\n";
} }
else else
{ {
$style='cal_current_month'; $style='cal_current_month';
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">'; echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxlength, $newparam, 1, 300); show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo "</td>\n"; echo "</td>\n";
} }
$tmpday++; $tmpday++;
@ -760,7 +761,8 @@ else // View by day
echo " </tr>\n"; echo " </tr>\n";
echo " <tr>\n"; echo " <tr>\n";
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">'; echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
show_day_events ($db, $day, $month, $year, $month, $style, $eventarray, 0, 80, $newparam, 1, 300); $maxnbofchar=80;
show_day_events ($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo "</td>\n"; echo "</td>\n";
echo " </tr>\n"; echo " </tr>\n";
echo '</table>'; echo '</table>';
@ -867,14 +869,15 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($event->type_code != 'BIRTHDAY') if ($event->type_code != 'BIRTHDAY')
{ {
// Picto // Picto
if ($showinfo && $event->type_code != 'ICALEVENT') if (empty($event->fulldayevent))
{ {
print $event->getNomUrl(2).' '; //print $event->getNomUrl(2).' ';
} }
// Date // Date
if (empty($event->fulldayevent)) if (empty($event->fulldayevent))
{ {
//print '<strong>';
$daterange=''; $daterange='';
// Show hours (start ... end) // Show hours (start ... end)
@ -909,7 +912,6 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
$daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M'); $daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M');
} }
if ($event->type_code == 'ICALEVENT') $daterange.='<br>('.$event->icalname.')';
//print $daterange; //print $daterange;
if ($event->type_code != 'ICALEVENT') if ($event->type_code != 'ICALEVENT')
{ {
@ -922,24 +924,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
{ {
print $daterange; print $daterange;
} }
print '<br>'."\n"; //print '</strong> ';
print "<br>\n";
} }
else else
{ {
if ($showinfo) if ($showinfo)
{ {
print $langs->trans("EventOnFullDay").'<br>'."\n"; print $langs->trans("EventOnFullDay")."<br>\n";
} }
} }
// Show label // Show title
if ($event->type_code == 'ICALEVENT') if ($event->type_code == 'ICALEVENT') print $event->libelle;
{
if ($event->fulldayevent) print '('.$event->icalname.')<br>';
print $event->libelle;
}
else print $event->getNomUrl(0,$maxnbofchar,'cal_event'); else print $event->getNomUrl(0,$maxnbofchar,'cal_event');
if ($event->type_code == 'ICALEVENT') print '<br>('.$event->icalname.')';
// If action related to company / contact // If action related to company / contact
$linerelatedto='';$length=16; $linerelatedto='';$length=16;
if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2); if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2);
@ -967,7 +968,6 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$linerelatedto.=$contact->getNomUrl(1,'',$length); $linerelatedto.=$contact->getNomUrl(1,'',$length);
} }
if ($linerelatedto) print '<br>'.$linerelatedto; if ($linerelatedto) print '<br>'.$linerelatedto;
} }
// Show location // Show location

View File

@ -10,7 +10,7 @@ AffectedTo=Affecté à
DoneBy=Réalisé par DoneBy=Réalisé par
Events=Événements Events=Événements
ListOfActions=Liste des événements ListOfActions=Liste des événements
EventOnFullDay=Événements sur la journée EventOnFullDay=Événement sur la journée
Location=Lieu Location=Lieu
SearchAnAction=Rechercher un événement/tâche SearchAnAction=Rechercher un événement/tâche
MenuToDoActions=Les événem. incomplets MenuToDoActions=Les événem. incomplets