diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 9fb3c090024..9cf27df3c18 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2010 Laurent Destailleur * * 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 @@ -134,7 +134,7 @@ $urlvcal='global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').''; -$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'ical',$urlical); +$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'ical/ics',$urlical); $message.='
'; $urlrss=''.$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').''; $message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'rss',$urlrss); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index a6d9d38bc87..6338501afbd 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -596,13 +596,13 @@ class ActionComm extends CommonObject /** - * \brief Export events from database into a cal file. - * \param format 'ical' or 'vcal' - * \param type 'event' or 'journal' - * \param cachedelay Do not rebuild file if date older than cachedelay seconds - * \param filename Force filename - * \param filters Array of filters - * \return int <0 if error, nb of events in new file if ok + * Export events from database into a cal file. + * @param format 'ical' or 'vcal' + * @param type 'event' or 'journal' + * @param cachedelay Do not rebuild file if date older than cachedelay seconds + * @param filename Force filename + * @param filters Array of filters + * @return int <0 if error, nb of events in new file if ok */ function build_exportfile($format,$type,$cachedelay,$filename,$filters) { @@ -661,7 +661,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_user_author, a.fk_user_mod,"; $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.fk_facture, a.percent as percentage, a.fk_commande,"; - $sql.= " a.priority, a.location,"; + $sql.= " a.priority, a.fulldayevent, a.location,"; $sql.= " u.firstname, u.name,"; $sql.= " s.nom as socname,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; @@ -740,6 +740,7 @@ class ActionComm extends CommonObject $event['enddate']=$dateend; // Not required with type 'journal' $event['author']=$obj->firstname.($obj->name?" ".$obj->name:""); $event['priority']=$obj->priority; + $event['fulldayevent']=$obj->fulldayevent; $event['location']=$langs->convToOutputCharset($obj->location); $event['transparency']='TRANSPARENT'; // TRANSPARENT or OPAQUE $event['category']=$langs->convToOutputCharset($obj->libelle); // libelle type action diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 2f511310064..446fbc7cd01 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -847,13 +847,15 @@ if ($id) // Date debut print ''.$langs->trans("DateActionStart").''; - print dol_print_date($act->datep,'dayhour'); + if (! $act->fulldayevent) print dol_print_date($act->datep,'dayhour'); + else print dol_print_date($act->datep,'day'); if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); print ''; // Date fin print ''.$langs->trans("DateActionEnd").''; - print dol_print_date($act->datef,'dayhour'); + if (! $act->fulldayevent) print dol_print_date($act->datef,'dayhour'); + else print dol_print_date($act->datef,'day'); if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print ''; @@ -875,7 +877,7 @@ if ($id) if ($act->usertodo->id > 0) print $act->usertodo->getNomUrl(1); print ''; - // Realise par + // Done by print ''.$langs->trans("ActionDoneBy").''; if ($act->userdone->id > 0) print $act->userdone->getNomUrl(1); print ''; diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index fbbe1688203..e5c50f0219f 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -469,6 +469,7 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S'; if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ'; if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ'; + if ($format == 'dayxcard') $format='%Y%m%d'; // If date undefined or "", we return "" if (dol_strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) diff --git a/htdocs/lib/xcal.lib.php b/htdocs/lib/xcal.lib.php index 5afcc3fe5fc..e0a6ddc4d50 100644 --- a/htdocs/lib/xcal.lib.php +++ b/htdocs/lib/xcal.lib.php @@ -25,6 +25,7 @@ /** * \brief Build a file from an array of events + * All input params and data must be encoded in $conf->charset_output * \param format 'vcal' or 'ical' * \param title Title of export * \param desc Description of export @@ -32,7 +33,6 @@ * \param outputfile Output file * \param filter Filter * \return int <0 if ko, Nb of events in file if ok - * \remarks All input params and data must be encoded in $conf->charset_output */ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$filter='') { @@ -83,7 +83,9 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi $enddate = $event['enddate']; $summary = $event['summary']; $category = $event['category']; - $location = $event['location']; + $priority = $event['priority']; + $fulldayevent = $event['fulldayevent']; + $location = $event['location']; $email = $event['email']; $url = $event['url']; $transparency = $event['transparency']; // OPAQUE or TRANSPARENT @@ -144,12 +146,15 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi // Date must be GMT dates fwrite($calfileh,"DTSTAMP:".dol_print_date($now,'dayhourxcard',true)."\n"); - $startdatef = dol_print_date($startdate,'dayhourxcard',true); + if (! $fulldayevent) $startdatef = dol_print_date($startdate,'dayhourxcard',true); + else $startdatef = dol_print_date($startdate,'dayxcard',true); fwrite($calfileh,"DTSTART:".$startdatef."\n"); if (empty($enddate)) $enddate=$startdate+$duration; - $enddatef = dol_print_date($enddate,'dayhourxcard',true); - fwrite($calfileh,"DTEND:".$enddatef."\n"); - + if (! $fulldayevent) + { + $enddatef = dol_print_date($enddate,'dayhourxcard',true); + fwrite($calfileh,"DTEND:".$enddatef."\n"); + } if (! empty($transparency)) fwrite($calfileh,"TRANSP:".$transparency."\n"); if (! empty($category)) fwrite($calfileh,"CATEGORIES:".$encoding.$category."\n"); fwrite($calfileh,"END:VEVENT\n"); @@ -218,6 +223,7 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi /** * \brief Build a file from an array of events + * All input data must be encoded in $conf->charset_output * \param format 'rss' * \param title Title of export * \param desc Description of export @@ -225,7 +231,6 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi * \param outputfile Output file * \param filter Filter * \return int <0 if ko, Nb of events in file if ok - * \remarks All input data must be encoded in $conf->charset_output */ function build_rssfile($format='rss',$title,$desc,$events_array,$outputfile,$filter='') { @@ -296,6 +301,12 @@ function build_rssfile($format='rss',$title,$desc,$events_array,$outputfile,$fil $url = $event['url']; $author = $event['author']; $category = $event['category']; + /* No place inside a RSS + $priority = $event['priority']; + $fulldayevent = $event['fulldayevent']; + $location = $event['location']; + $email = $event['email']; + */ $description=preg_replace('//i',"\n",$event['desc']); $description=dol_string_nohtmltag($description,0); // Remove html tags diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 076b01afba6..70337a28d7e 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -23,6 +23,14 @@ * \version $Id$ */ +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.