From b58e81d1860ab4cdfc5b0f4d66f54034d1a5ed52 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 2 Jun 2011 16:52:37 +0000 Subject: [PATCH] task #9747: Can show content of external calendar (ical) into agenda --- htdocs/comm/action/class/actioncomm.class.php | 5 +++++ htdocs/comm/action/index.php | 11 ++++++----- htdocs/lib/agenda.lib.php | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 54c113fb06e..c28260945f7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002-2004 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,6 +80,10 @@ class ActionComm extends CommonObject var $facid; var $supplierorderrowid; var $supplierinvoicerowid; + + // Ical + var $icalname; + var $icalcolor; /** diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 835e3501b87..38d8e2f6b3f 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -508,12 +508,13 @@ if ($conf->global->ENABLE_AGENDA_EXT==1 && $conf->global->AGENDA_EXT_NB>0) $namecal = $conf->global->$paramkey; $paramkey='AGENDA_EXT_COLOR'.$i; $colorcal = $conf->global->$paramkey; - $event->id=$namecal; + $event->id=$icalevent[UID]; + $event->icalname=$namecal; + $event->icalcolor=$colorcal; $event->datep=$icalevent[DTSTART]; $event->datef=$icalevent[DTEND]; $event->type_code="ICALEVENT"; - $event->type_id = $colorcal; - $event->libelle=''.$icalevent[SUMMARY].'
'.dol_nl2br($icalevent[DESCRIPTION],1,false); + $event->libelle=''.$icalevent[SUMMARY].'
'.str_replace("\\n", "
", "$icalevent[DESCRIPTION]");; //$event->fulldayevent=$obj->fulldayevent; $event->date_start_in_calendar=$event->datep; @@ -801,7 +802,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $colorindex=0; if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) $colorindex=1; if ($event->type_code == 'BIRTHDAY') $colorindex=2; - if ($event->type_code == 'ICALEVENT') $color=$event->type_id; + if ($event->type_code == 'ICALEVENT') $color=$event->icalcolor; else $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); //print "x".$color; @@ -848,7 +849,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) print dol_print_date($event->date_end_in_calendar,'%H:%M'); } - if ($event->type_code == 'ICALEVENT') print '
('.$event->id.')'; + if ($event->type_code == 'ICALEVENT') print '
('.$event->icalname.')'; print '
'."\n"; } else diff --git a/htdocs/lib/agenda.lib.php b/htdocs/lib/agenda.lib.php index 90812ff5611..d13597f0cee 100644 --- a/htdocs/lib/agenda.lib.php +++ b/htdocs/lib/agenda.lib.php @@ -315,7 +315,7 @@ function agenda_prepare_head() if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // In dev version only for the moment { $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extsites.php"; - $head[$h][1] = $langs->trans("Import"); + $head[$h][1] = $langs->trans("ExtSites"); $head[$h][2] = 'extsites'; $h++; }