From b870f584a44bc711f003c47499c5085d2a38bc99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Jun 2011 11:01:11 +0000 Subject: [PATCH] Agenda events are cleaner --- htdocs/comm/action/index.php | 40 +++++++++++++++++----------------- htdocs/langs/fr_FR/agenda.lang | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index c45093aa075..39c63002e49 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -558,7 +558,8 @@ if (sizeof($listofextcals)) $event->datep=$datestart+$usertime; $event->datef=$dateend+$usertime; $event->type_code="ICALEVENT"; - $event->libelle=''.$icalevent['SUMMARY'].'
'.str_replace("\\n", "
", $icalevent['DESCRIPTION']); + $event->libelle=$icalevent['SUMMARY']; + if ($icalevent['DESCRIPTION']) $event->libelle.='
'.dol_nl2br($icalevent['DESCRIPTION'],1); $event->date_start_in_calendar=$event->datep; @@ -607,7 +608,7 @@ if (sizeof($listofextcals)) } } -$maxlength=18; +$maxnbofchar=18; $cachethirdparties=array(); $cachecontacts=array(); @@ -651,7 +652,7 @@ if (empty($action) || $action == 'show_month') // View by month { $style='cal_other_month'; echo ' '; - 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 " \n"; } /* Show days of the current month */ @@ -666,7 +667,7 @@ if (empty($action) || $action == 'show_month') // View by month if ($today) $style='cal_today'; echo ' '; - 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 " \n"; } /* 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'; echo ' '; - 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 "\n"; } $tmpday++; @@ -721,14 +722,14 @@ elseif ($action == 'show_week') // View by week if ($today) $style='cal_today'; echo ' '; - 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 " \n"; } else { $style='cal_current_month'; echo ' '; - 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 "\n"; } $tmpday++; @@ -760,7 +761,8 @@ else // View by day echo " \n"; echo " \n"; echo ' '; - 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 "\n"; echo " \n"; echo ''; @@ -867,14 +869,15 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code != 'BIRTHDAY') { // Picto - if ($showinfo && $event->type_code != 'ICALEVENT') + if (empty($event->fulldayevent)) { - print $event->getNomUrl(2).' '; + //print $event->getNomUrl(2).' '; } // Date if (empty($event->fulldayevent)) { + //print ''; $daterange=''; // 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) $daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M'); } - if ($event->type_code == 'ICALEVENT') $daterange.='
('.$event->icalname.')'; //print $daterange; if ($event->type_code != 'ICALEVENT') { @@ -922,24 +924,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { print $daterange; } - print '
'."\n"; + //print '
'; + print "
\n"; } else { if ($showinfo) { - print $langs->trans("EventOnFullDay").'
'."\n"; + print $langs->trans("EventOnFullDay")."
\n"; } } - // Show label - if ($event->type_code == 'ICALEVENT') - { - if ($event->fulldayevent) print '('.$event->icalname.')
'; - print $event->libelle; - } + // Show title + if ($event->type_code == 'ICALEVENT') print $event->libelle; else print $event->getNomUrl(0,$maxnbofchar,'cal_event'); + if ($event->type_code == 'ICALEVENT') print '
('.$event->icalname.')'; + // If action related to company / contact $linerelatedto='';$length=16; 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); } if ($linerelatedto) print '
'.$linerelatedto; - } // Show location diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index 9f71cb0900f..a880394f724 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -10,7 +10,7 @@ AffectedTo=Affecté à DoneBy=Réalisé par Events=Événements ListOfActions=Liste des événements -EventOnFullDay=Événements sur la journée +EventOnFullDay=Événement sur la journée Location=Lieu SearchAnAction=Rechercher un événement/tâche MenuToDoActions=Les événem. incomplets