phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] calendar inc/class.bocalendar.inc.php inc/class...


From: Dave Hall
Subject: [Phpgroupware-cvs] calendar inc/class.bocalendar.inc.php inc/class...
Date: Fri, 16 Dec 2005 13:24:44 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    calendar
Branch:         
Changes by:     Dave Hall <address@hidden>      05/12/16 13:24:44

Modified files:
        inc            : class.bocalendar.inc.php 
                         class.boicalendar.inc.php 
                         class.socalendar.inc.php 
                         class.socalendar_sql.inc.php 
                         class.uicalendar.inc.php hook_home_week.inc.php 
                         hook_settings.inc.php hook_sidebox_menu.inc.php 
        setup          : phpgw_de.lang setup.inc.php 
        templates/default: contacts_popup.tpl 
Added files:
        js/wz_tooltip  : wz_tooltip.js 
        templates/default: week_new.tpl 

Log message:
        Merging in the rocon/bottkom mods to calendar, which consist of:
        * Tooltip option for description in view
        * New view - week new which is day view for the 7 days of the week 
(quite nice)
        * Colors per category (disabled due to lack of API support for 
functionality)
        * some iCal improvements
        
        I have not included the xml import/export code for syncML at this stage
        as it needs some mods for the contacts based participants model in HEAD

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.bocalendar.inc.php.diff?tr1=1.101&tr2=1.102&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.boicalendar.inc.php.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.socalendar.inc.php.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.socalendar_sql.inc.php.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.uicalendar.inc.php.diff?tr1=1.120&tr2=1.121&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/hook_home_week.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/hook_settings.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/hook_sidebox_menu.inc.php.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/js/wz_tooltip/wz_tooltip.js?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/setup/phpgw_de.lang.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/setup/setup.inc.php.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/templates/default/contacts_popup.tpl.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/templates/default/week_new.tpl?rev=1.1

Patches:
Index: calendar/inc/class.bocalendar.inc.php
diff -u calendar/inc/class.bocalendar.inc.php:1.101 
calendar/inc/class.bocalendar.inc.php:1.102
--- calendar/inc/class.bocalendar.inc.php:1.101 Fri Dec  9 09:30:30 2005
+++ calendar/inc/class.bocalendar.inc.php       Fri Dec 16 13:24:44 2005
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.bocalendar.inc.php,v 1.101 2005/12/09 09:30:30 skwashd 
Exp $ */
+       /* $Id: class.bocalendar.inc.php,v 1.102 2005/12/16 13:24:44 skwashd 
Exp $ */
 
        class bocalendar
        {
@@ -3030,7 +3030,10 @@
                                'defaultfilter'   => 'all',
                                'default_private' => '0',
                                'display_minicals'=> '1',
-                               'print_black_white'=>'0'
+                               'print_black_white'=>'0',
+                               'show_descrpt_ovr'=> '1',
+                               'show_descrpt_title'=> '1',
+                               'show_time_line'  => '1'
                        );
                        foreach($defaults as $var => $default)
                        {
@@ -3137,5 +3140,44 @@
                        }
                        return $group_list;
                }
+               
+               /**
+               * Get list of available category colors
+               *
+               * @internal current returns an empty array as API doesn't 
support functionality
+               * @author Thomas Bott
+               * @returns array of html-style colors for each category
+               */
+               function get_cat_colors()
+               {
+                       return array();
+                       $cat_color_ids = $this->cat->get_cat_colors();
+
+                       foreach ($cat_color_ids as $cat_id => $entry)
+                       {
+                               if ( $entry['cat_color_id'] )
+                               {
+                                       $cat_colors[$cat_id] = 
$GLOBALS['phpgw_info']['theme']['cat_color'][$entry['cat_color_id']];
+                               }
+                               else # if empty, find next parent with color set
+                               {
+                                       $cat_parent_id = $entry['cat_parent'];
+                                       $color_to_set = FALSE;
+                                       while ( !$color_to_set )
+                                       {
+                                               $color_to_set = 
($cat_color_ids[$cat_parent_id]['cat_color_id']) ? 
$cat_color_ids[$cat_parent_id]['cat_color_id'] : FALSE;
+                                               if ($cat_parent_id == 0 && ! 
$color_to_set)
+                                               {
+                                                       $color_to_set = "1";
+                                               }
+                                               $cat_parent_id = 
$cat_color_ids[$cat_parent_id]['cat_parent'];
+
+                                       }
+                                       $cat_colors[$cat_id] = 
$GLOBALS['phpgw_info']['theme']['cat_color'][$color_to_set];
+                               }
+                       }
+
+                       return $cat_colors;
+               }
        }
 ?>
Index: calendar/inc/class.boicalendar.inc.php
diff -u calendar/inc/class.boicalendar.inc.php:1.30 
calendar/inc/class.boicalendar.inc.php:1.31
--- calendar/inc/class.boicalendar.inc.php:1.30 Fri Dec  9 00:32:20 2005
+++ calendar/inc/class.boicalendar.inc.php      Fri Dec 16 13:24:44 2005
@@ -1,16 +1,16 @@
 <?php
-  /**************************************************************************\
-  * phpGroupWare - iCalendar Parser                                          *
-  * http://www.phpgroupware.org                                              *
-  * Written by Mark Peters <address@hidden>                        *
-  * --------------------------------------------                             *
-  *  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 the   *
-  *  Free Software Foundation; either version 2 of the License, or (at your  *
-  *  option) any later version.                                              *
-  \**************************************************************************/
+/**************************************************************************\
+ * phpGroupWare - iCalendar Parser                                          *
+ * http://www.phpgroupware.org                                              *
+ * Written by Mark Peters <address@hidden>                        *
+ * --------------------------------------------                             *
+ *  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 the   *
+ *  Free Software Foundation; either version 2 of the License, or (at your  *
+ *  option) any later version.                                              *
+ \**************************************************************************/
 
-       /* $Id: class.boicalendar.inc.php,v 1.30 2005/12/09 00:32:20 skwashd 
Exp $ */
+/* $Id: class.boicalendar.inc.php,v 1.31 2005/12/16 13:24:44 skwashd Exp $ */
 
 define('FOLD_LENGTH',75);
 
@@ -37,22 +37,22 @@
 define('COMPLETED',5);
 define('IN_PROCESS',6);
 
-       /*
-        * Class
-        */
+/*
+ * Class
+ */
 define('PRIVATE',0);
 define('PUBLIC',1);
 define('CONFIDENTIAL',3);
 
-       /*
-        * Transparency
-        */
+/*
+ * Transparency
+ */
 define('TRANSPARENT',0);
 define('OPAQUE',1);
 
-       /*
-        * Frequency
-        */
+/*
+ * Frequency
+ */
 define('SECONDLY',1);
 define('MINUTELY',2);
 define('HOURLY',3);
@@ -81,1178 +81,1395 @@
 {
 
        var $public_functions = array
-                               (
-                                       'import'                => True,
-                                       'export'                => True
-                               );
+               (
+                'import'               => True,
+                'export'               => True
+               );
 
 
        var $ical;
        var $line = 0;
-       var $event = Array();
-       var $todo = Array();
-       var $journal = Array();
-       var $freebusy = Array();
-       var $timezone = Array();
-       var $property = Array();
-       var $parameter = Array();
+       var $event = array();
+       var $todo = array();
+       var $journal = array();
+       var $freebusy = array();
+       var $timezone = array();
+       var $property = array();
+       var $parameter = array();
        var $debug_str = False;
        var $api = True;
        var $chunk_split = True;
-       
+
        /*
         * Base Functions
         */
 
        function boicalendar()
        {
-               $this->property = Array(
-                       'action'                => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'valarm'                => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'attach'                => Array(
-                               'type'          => 'uri',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'valarm'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'attendee'              => Array(
-                               'type'          => 'cal-address',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'valarm'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),                      
-                       'categories'            => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'class'                 => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'comment'               => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'daylight'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'standard'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'valarm'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'completed'             => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'contact'               => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'created'               => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'description'           => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'valarm'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'dtend'                 => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'dtstamp'               => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),                      
-                       'dtstart'               => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'daylight'      => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'standard'      => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'due'                   => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'duration'              => Array(
-                               'type'          => 'duration',
-                               'to_text'       => False,
-                               'valarm'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'exdate'                => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vevent'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'exrule'                => Array(
-                               'type'          => 'recur',
-                               'to_text'       => False,
-                               'vevent'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'freebusy'              => Array(
-                               'type'          => 'freebusy',
-                               'to_text'       => False,
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'geo'                   => Array(
-                               'type'          => 'float',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'last_modified'         => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtimezone'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'location'              => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'method'                        => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'ical'  => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'organizer'             => Array(
-                               'type'          => 'cal-address',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),                      
-                       'percent_complete'      => Array(
-                               'type'          => 'integer',
-                               'to_text'       => False,
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'priority'              => Array(
-                               'type'          => 'integer',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'prodid'                        => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'ical'  => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'rdate'                 => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'daylight'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'standard'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'recurrence_id'         => Array(
-                               'type'          => 'date-time',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo' => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'related_to'            => Array(
-                               'type'          => 'text',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'request_status'        => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'resources'             => Array(
-                               'type'          => 'text',
-                               'to_text'       => False,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'rrule'                 => Array(
-                               'type'          => 'recur',
-                               'to_text'       => False,
-                               'daylight'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'standard'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'sequence'              => Array(
-                               'type'          => 'integer',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'status'                => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'summary'               => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'valarm'                => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'transp'                => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'trigger'               => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'valarm'        => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'tzid'                  => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vtimezone'             => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'tzname'                => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'daylight'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               ),
-                               'standard'      => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => True
-                               )
-                       ),
-                       'tzoffsetfrom'          => Array(
-                               'type'          => 'utc-offset',
-                               'to_text'       => True,
-                               'daylight'              => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'standard'              => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'tzoffsetto'            => Array(
-                               'type'          => 'utc-offset',
-                               'to_text'       => True,
-                               'daylight'              => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'standard'              => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'tzurl'                 => Array(
-                               'type'          => 'uri',
-                               'to_text'       => True,
-                               'vtimezone'             => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'uid'                   => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'vtodo'         => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'url'                   => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'vevent'        => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'vfreebusy'             => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               ),
-                               'vjournal'              => Array(
-                                       'state'         => 'optional',
-                                       'multiples'     => False
-                               ),
-                               'vtodo' => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       ),
-                       'version'                       => Array(
-                               'type'          => 'text',
-                               'to_text'       => True,
-                               'ical'  => Array(
-                                       'state'         => 'required',
-                                       'multiples'     => False
-                               )
-                       )
-               );
-               $this->parameter = Array(
-                       'altrep'                => Array(
-                               'type'          => 'uri',
-                               'quoted'                => True,
-                               'to_text'       => True,
-                               'properties'    => Array(
-                                       'comment'               => True,
-                                       'description'   => True,
-                                       'location'              => True,
-                                       'prodid'                        => True,
-                                       'resources'             => True,
-                                       'summary'               => True,
-                                       'contact'               => True         
                        
-                               )
-                       ),
-                       'freq'          => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_freq',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'                 => True
-                               )
-                       ),
-                       'byday'         => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'byhour'                => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'byminute'              => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'bymonth'               => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'bymonthday'    => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'bysecond'              => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'bysetpos'              => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'byweekno'              => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'byyearday'             => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'class'                 => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_class',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'class'                 => True
-                               )
-                       ),
-                       'cn'                    => Array(
-                               'type'          => 'text',
-                               'quoted'                => True,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True,
-                                       'organizer'             => True         
                        
-                               )
-                       ),
-                       'count'         => Array(
-                               'type'          => 'integer',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'                 => True
-                               )
-                       ),
-                       'cu'                    => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_cu',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True
-                               )
-                       ),
-                       'delegated_from'        => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_mailto',
-                               'quoted'                => True,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True
-                               )
-                       ),
-                       'delegated_to'  => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_mailto',
-                               'quoted'                => True,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True
-                               )
-                       ),
-                       'dir'                   => Array(
-                               'type'          => 'dir',
-                               'quoted'                => True,
-                               'to_text'       => True,
-                               'properties'    => Array(
-                                       'attendee'              => True,
-                                       'organizer'             => True
-                               )
-                       ),
-                       'dtend'         => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_date',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'dtend'         => True
-                               )
-                       ),
-                       'dtstamp'               => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_date',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'dtstamp'               => True
-                               )
-                       ),
-                       'dtstart'               => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_date',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'dtstart'               => True
-                               )
-                       ),
-                       'encoding'      => Array( // "future bug" fix
-                               'type'          => 'function',
-                               'function'      => 'switch_encoding',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attach'                        => True
-                               )
-                       ),
-                       'fmttype'       => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attach'                        => True
-                               )
-                       ),
-                       'fbtype'                => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_fbtype',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attach'                        => True
-                               )
-                       ),
-                       'interval'              => Array(
-                               'type'          => 'integer',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'language'              => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'categories'    => True,
-                                       'comment'               => True,
-                                       'description'   => True,
-                                       'location'              => True,
-                                       'resources'             => True,
-                                       'summary'               => True,
-                                       'tzname'                        => True,
-                                       'attendee'              => True,
-                                       'contact'               => True,
-                                       'organizer'             => True,
-                                       'x-type'                        => True
-                               )
-                       ),
-                       'last_modified'         => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_date',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'last_modified' => True
-                               )
-                       ),
-                       'mailto'                => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_mailto',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True,
-                                       'organizer'             => True
-                               )
-                       ),
-                       'member'                => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_mailto',
-                               'quoted'                => True,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True
-                               )
-                       ),
-                       'partstat'              => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_partstat',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True,
-                                       'organizer'             => True
-                               )
-                       ),
-                       'range'         => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_range',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'recurrence_id' => True
-                               )
-                       ),
-                       'related'               => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_related',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'related_to'    => True
-                               )
-                       ),
-                       'role'          => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_role',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True,
-                                       'organizer'             => True
-                               )
-                       ),
-                       'rsvp'          => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_rsvp',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True
-                               )
-                       ),
-                       'sent_by'               => Array(
-                               'type'          => 'function',
-                               'function'      => 'parse_user_host',
-                               'quoted'                => True,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'attendee'              => True,
-                                       'organizer'             => True
-                               )
-                       ),
-                       'tzid'          => Array(
-                               'type'          => 'text',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'dtend'         => True,
-                                       'due'                   => True,
-                                       'dtstart'       => True,
-                                       'exdate'                => True,
-                                       'rdate'         => True,
-                                       'recurrence_id' => True
-                               )
-                       ),
-                       'until'         => Array(
-                               'type'          => 'function',
-                               'function'      => 'switch_date',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'value'         => Array(
-                               'type'          => 'value',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'calscale'      => True,
-                                       'prodid'                => True,
-                                       'method'                => True,
-                                       'version'       => True,
-                                       'attach'                => True,
-                                       'categories'    => True,
-                                       'class'         => True,
-                                       'comment'       => True,
-                                       'description'   => True,
-                                       'geo'           => True,
-                                       'location'      => True,
-                                       'percent'       => True,
-                                       'priority'      => True,
-                                       'resources'     => True,
-                                       'status'                => True,
-                                       'summary'       => True,
-                                       'completed'     => True,
-                                       'dtend'         => True,
-                                       'due'           => True,
-                                       'dtstart'       => True,
-                                       'duration'      => True,
-                                       'freebusy'      => True,
-                                       'transp'                => True,
-                                       'tzid'          => True,
-                                       'tzname'                => True,
-                                       'tzoffsetfrom'  => True,
-                                       'tzoffsetto'    => True,
-                                       'tzurl'         => True,
-                                       'attendee'      => True,
-                                       'contact'       => True,
-                                       'organizer'     => True,
-                                       'recurrence_id' => True,
-                                       'url'           => True,
-                                       'uid'           => True,
-                                       'exdate'        => True,
-                                       'exrule'        => True,
-                                       'rdate' => True,
-                                       'rrule' => True,
-                                       'action'        => True,
-                                       'repeat'        => True,
-                                       'trigger'       => True,
-                                       'created'       => True,
-                                       'dtstamp'       => True,
-                                       'last_modified' => True,
-                                       'sequence'      => True,
-                                       'x_type'                => True,
-                                       'request_status'        => True
-                               )
-                       ),
-                       'wkst'          => Array(
-                               'type'          => 'string',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'rrule'         => True
-                               )
-                       ),
-                       'x_type'                => Array(
-                               'type'          => 'x_type',
-                               'quoted'                => False,
-                               'to_text'       => False,
-                               'properties'    => Array(
-                                       'calscale'      => True,
-                                       'method'                => True,
-                                       'prodid'                => True,
-                                       'version'       => True,
-                                       'attach'                => True,
-                                       'categories'    => True,
-                                       'class'         => True,
-                                       'comment'       => True,
-                                       'description'   => True,
-                                       'geo'           => True,
-                                       'location'      => True,
-                                       'percent'       => True,
-                                       'priority'      => True,
-                                       'resources'     => True,
-                                       'status'                => True,
-                                       'summary'       => True,
-                                       'completed'     => True,
-                                       'dtend'         => True,
-                                       'due'           => True,
-                                       'dtstart'       => True,
-                                       'duration'      => True,
-                                       'freebusy'      => True,
-                                       'transp'                => True,
-                                       'tzid'          => True,
-                                       'tzname'                => True,
-                                       'tzoffsetfrom'  => True,
-                                       'tzoffsetto'    => True,
-                                       'tzurl'         => True,
-                                       'attendee'      => True,
-                                       'contact'       => True,
-                                       'organizer'     => True,
-                                       'recurrence_id' => True,
-                                       'url'           => True,
-                                       'uid'           => True,
-                                       'exdate'        => True,
-                                       'exrule'        => True,
-                                       'rdate' => True,
-                                       'rrule' => True,
-                                       'action'        => True,
-                                       'repeat'        => True,
-                                       'trigger'       => True,
-                                       'created'       => True,
-                                       'dtstamp'       => True,
-                                       'last_modified' => True,
-                                       'sequence'      => True,
-                                       'x_type'                => True,
-                                       'request_status'        => True
-                               )
-                       )                       
-               );
+               $this->property = array
+                       (
+                               'action'        => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'attach'        => array
+                                               (
+                                                       'type'          => 
'uri',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'attendee'      => array
+                                               (
+                                                       'type'          => 
'cal-address',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'categories'    => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'class'         => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'comment'       => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'daylight'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'standard'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'completed'     => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'contact'       => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
        'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'created'       => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'description'   => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'dtend'         => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'dtstamp'       => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),                      
+
+                               'dtstart'       => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'daylight'      => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'standard'      => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'due'           => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'duration'      => array
+                                               (
+                                                       'type'          => 
'duration',
+                                                       'to_text'       => 
False,
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'exdate'        => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'exrule'        => array
+                                               (
+                                                       'type'          => 
'recur',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'freebusy'      => array
+                                               (
+                                                       'type'          => 
'freebusy',
+                                                       'to_text'       => 
False,
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'geo'           => array
+                                               (
+                                                       'type'          => 
'float',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'last_modified' => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtimezone'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'location'      => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'method'        => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'ical'  => array
+                                                               (
+                                                                       'state' 
        => 'required',
+                                                                       
'multiples'     => False
+                                                               )
+                                               ),
+
+                               'organizer'     => array
+                                               (
+                                                       'type'          => 
'cal-address',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'percent_complete' => array
+                                               (
+                                                       'type'          => 
'integer',
+                                                       'to_text'       => 
False,
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'priority'      => array
+                                               (
+                                                       'type'          => 
'integer',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'prodid'        => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'ical'          => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'rdate'         => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'daylight'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'standard'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'recurrence_id' => array
+                                               (
+                                                       'type'          => 
'date-time',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'related_to'    => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'request_status'=> array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'resources'     => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => 
False,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
        'state'         => 'optional',
+                                                                               
        'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'rrule'         => array
+                                               (
+                                                       'type'          => 
'recur',
+                                                       'to_text'       => 
False,
+                                                       'daylight'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'standard'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'sequence'      => array
+                                               (
+                                                       'type'          => 
'integer',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'status'        => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+
+                               'summary'       => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                               
+                               'transp'        => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                               
+                               'trigger'       => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'valarm'        => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                                               
+                               'tzid'          => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vtimezone'     => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                                               
+                               'tzname'        => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'daylight'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       ),
+                                                       'standard'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => True
+                                                                       )
+                                               ),
+
+                               'tzoffsetfrom'  => array
+                                               (
+                                                       'type'          => 
'utc-offset',
+                                                       'to_text'       => True,
+                                                       'daylight'      => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'standard'      => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                                               
+                               'tzoffsetto'    => array
+                                               (
+                                                       'type'          => 
'utc-offset',
+                                                       'to_text'       => True,
+                                                       'daylight'      => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'standard'      => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                               
+                               'tzurl'         => array
+                                               (
+                                                       'type'          => 
'uri',
+                                                       'to_text'       => True,
+                                                       'vtimezone'     => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       
+                                               ),
+                                               
+                               'uid'           => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                                               
+                               'url'           => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'vevent'        => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vfreebusy'     => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vjournal'      => array
+                                                                       (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                       ),
+                                                       'vtodo'         => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               ),
+                                               
+                               'version'       => array
+                                               (
+                                                       'type'          => 
'text',
+                                                       'to_text'       => True,
+                                                       'ical'          => array
+                                                                       (
+                                                                               
'state'         => 'required',
+                                                                               
'multiples'     => False
+                                                                       )
+                                               )
+                       ));
+
+               $this->parameter = array(
+                               'altrep'                => array(
+                                       'type'          => 'uri',
+                                       'quoted'                => True,
+                                       'to_text'       => True,
+                                       'properties'    => array(
+                                               'comment'               => True,
+                                               'description'   => True,
+                                               'location'              => True,
+                                               'prodid'                        
=> True,
+                                               'resources'             => True,
+                                               'summary'               => True,
+                                               'contact'               => True 
                                
+                                               )
+                                       ),
+                               'freq'          => array(
+                                       'type'          => 'function',
+                                       'function'      => 'switch_freq',
+                                       'quoted'                => False,
+                                       'to_text'       => False,
+                                       'properties'    => array(
+                                               'rrule'                 => True
+                                               )
+                                       ),
+                               'byday'         => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'byhour'                => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'byminute'              => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'bymonth'               => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'bymonthday'    => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'bysecond'              => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'bysetpos'              => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'byweekno'              => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'byyearday'             => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'class'                 => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_class',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'class'                 
=> True
+                                                       )
+                                               ),
+                               'cn'                    => array(
+                                               'type'          => 'text',
+                                               'quoted'                => True,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True,
+                                                       'organizer'             
=> True                                 
+                                                       )
+                                               ),
+                               'count'         => array(
+                                               'type'          => 'integer',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'                 
=> True
+                                                       )
+                                               ),
+                               'cu'                    => array(
+                                               'type'          => 'function',
+                                               'function'      => 'switch_cu',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True
+                                                       )
+                                               ),
+                               'delegated_from'        => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_mailto',
+                                               'quoted'                => True,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True
+                                                       )
+                                               ),
+                               'delegated_to'  => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_mailto',
+                                               'quoted'                => True,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True
+                                                       )
+                                               ),
+                               'dir'                   => array(
+                                               'type'          => 'dir',
+                                               'quoted'                => True,
+                                               'to_text'       => True,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True,
+                                                       'organizer'             
=> True
+                                                       )
+                                               ),
+                               'dtend'         => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_date',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'dtend'         => True
+                                                       )
+                                               ),
+                               'dtstamp'               => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_date',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'dtstamp'               
=> True
+                                                       )
+                                               ),
+                               'dtstart'               => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_date',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'dtstart'               
=> True
+                                                       )
+                                               ),
+                               'encoding'      => array( // "future bug" fix
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_encoding',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attach'                
        => True
+                                                       )
+                                               ),
+                               'fmttype'       => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attach'                
        => True
+                                                       )
+                                               ),
+                               'fbtype'                => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_fbtype',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attach'                
        => True
+                                                       )
+                                               ),
+                               'interval'              => array(
+                                               'type'          => 'integer',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'language'              => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'categories'    => True,
+                                                       'comment'               
=> True,
+                                                       'description'   => True,
+                                                       'location'              
=> True,
+                                                       'resources'             
=> True,
+                                                       'summary'               
=> True,
+                                                       'tzname'                
        => True,
+                                                       'attendee'              
=> True,
+                                                       'contact'               
=> True,
+                                                       'organizer'             
=> True,
+                                                       'x-type'                
        => True
+                                                       )
+                                               ),
+                               'last_modified'         => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_date',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'last_modified' => True
+                                                       )
+                                               ),
+                               'mailto'                => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_mailto',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True,
+                                                       'organizer'             
=> True
+                                                       )
+                                               ),
+                               'member'                => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_mailto',
+                                               'quoted'                => True,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True
+                                                       )
+                                               ),
+                               'partstat'              => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_partstat',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True,
+                                                       'organizer'             
=> True
+                                                       )
+                                               ),
+                               'range'         => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_range',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'recurrence_id' => True
+                                                       )
+                                               ),
+                               'related'               => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_related',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'related_to'    => True
+                                                       )
+                                               ),
+                               'role'          => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_role',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True,
+                                                       'organizer'             
=> True
+                                                       )
+                                               ),
+                               'rsvp'          => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_rsvp',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True
+                                                       )
+                                               ),
+                               'sent_by'               => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'parse_user_host',
+                                               'quoted'                => True,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'attendee'              
=> True,
+                                                       'organizer'             
=> True
+                                                       )
+                                               ),
+                               'tzid'          => array(
+                                               'type'          => 'text',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'dtend'         => True,
+                                                       'due'                   
=> True,
+                                                       'dtstart'       => True,
+                                                       'exdate'                
=> True,
+                                                       'rdate'         => True,
+                                                       'recurrence_id' => True
+                                                       )
+                                               ),
+                               'until'         => array(
+                                               'type'          => 'function',
+                                               'function'      => 
'switch_date',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'rrule'         => True
+                                                       )
+                                               ),
+                               'value'         => array(
+                                               'type'          => 'value',
+                                               'quoted'                => 
False,
+                                               'to_text'       => False,
+                                               'properties'    => array(
+                                                       'calscale'      => True,
+                                                       'prodid'                
=> True,
+                                                       'method'                
=> True,
+                                                       'version'       => True,
+                                                       'attach'                
=> True,
+                                                       'categories'    => True,
+                                                       'class'         => True,
+                                                       'comment'       => True,
+                                                       'description'   => True,
+                                                       'geo'           => True,
+                                                       'location'      => True,
+                                                       'percent'       => True,
+                                                       'priority'      => True,
+                                                       'resources'     => True,
+                                                       'status'                
=> True,
+                                                       'summary'       => True,
+                                                       'completed'     => True,
+                                                       'dtend'         => True,
+                                                       'due'           => True,
+                                                       'dtstart'       => True,
+                                                       'duration'      => True,
+                                                       'freebusy'      => True,
+                                                       'transp'                
=> True,
+                                                       'tzid'          => True,
+                                                       'tzname'                
=> True,
+                                                       'tzoffsetfrom'  => True,
+                                                       'tzoffsetto'    => True,
+                                                       'tzurl'         => True,
+                                                       'attendee'      => True,
+                                                       'contact'       => True,
+                                                       'organizer'     => True,
+                                                       'recurrence_id' => True,
+                                                       'url'           => True,
+                                                       'uid'           => True,
+                                                       'exdate'        => True,
+                                                       'exrule'        => True,
+                                                       'rdate' => True,
+                                                       'rrule' => True,
+                                                       'action'        => True,
+                                                       'repeat'        => True,
+                                                       'trigger'       => True,
+                                                       'created'       => True,
+                                                       'dtstamp'       => True,
+                                                       'last_modified' => True,
+                                                       'sequence'      => True,
+                                                       'x_type'                
=> True,
+                                                       'request_status'        
=> True
+                                                               )
+                                                               ),
+                                                       'wkst'          => 
array(
+                                                                       'type'  
        => 'string',
+                                                                       
'quoted'                => False,
+                                                                       
'to_text'       => False,
+                                                                       
'properties'    => array(
+                                                                               
'rrule'         => True
+                                                                               
)
+                                                                       ),
+                                                       'x_type'                
=> array(
+                                                                       'type'  
        => 'x_type',
+                                                                       
'quoted'                => False,
+                                                                       
'to_text'       => False,
+                                                                       
'properties'    => array(
+                                                                               
'calscale'      => True,
+                                                                               
'method'                => True,
+                                                                               
'prodid'                => True,
+                                                                               
'version'       => True,
+                                                                               
'attach'                => True,
+                                                                               
'categories'    => True,
+                                                                               
'class'         => True,
+                                                                               
'comment'       => True,
+                                                                               
'description'   => True,
+                                                                               
'geo'           => True,
+                                                                               
'location'      => True,
+                                                                               
'percent'       => True,
+                                                                               
'priority'      => True,
+                                                                               
'resources'     => True,
+                                                                               
'status'                => True,
+                                                                               
'summary'       => True,
+                                                                               
'completed'     => True,
+                                                                               
'dtend'         => True,
+                                                                               
'due'           => True,
+                                                                               
'dtstart'       => True,
+                                                                               
'duration'      => True,
+                                                                               
'freebusy'      => True,
+                                                                               
'transp'                => True,
+                                                                               
'tzid'          => True,
+                                                                               
'tzname'                => True,
+                                                                               
'tzoffsetfrom'  => True,
+                                                                               
'tzoffsetto'    => True,
+                                                                               
'tzurl'         => True,
+                                                                               
'attendee'      => True,
+                                                                               
'contact'       => True,
+                                                                               
'organizer'     => True,
+                                                                               
'recurrence_id' => True,
+                                                                               
'url'           => True,
+                                                                               
'uid'           => True,
+                                                                               
'exdate'        => True,
+                                                                               
'exrule'        => True,
+                                                                               
'rdate' => True,
+                                                                               
'rrule' => True,
+                                                                               
'action'        => True,
+                                                                               
'repeat'        => True,
+                                                                               
'trigger'       => True,
+                                                                               
'created'       => True,
+                                                                               
'dtstamp'       => True,
+                                                                               
'last_modified' => True,
+                                                                               
'sequence'      => True,
+                                                                               
'x_type'                => True,
+                                                                               
'request_status'        => True
+                                                                               
        )
+                                                                               
        )                       
+                                                                               
        );
                if(!is_object($GLOBALS['phpgw']->datetime))
                {
                        $GLOBALS['phpgw']->datetime = 
createobject('phpgwapi.datetime');
@@ -1295,7 +1512,7 @@
 
        function fold($str)
        {
-                return $this->chunk_split==True ? 
chunk_split($str,FOLD_LENGTH,"\r\n") : $str."\r\n";
+               return $this->chunk_split ? chunk_split($str, FOLD_LENGTH, 
"\r\n") : $str."\r\n";
        }
 
        function strip_quotes($str)
@@ -1341,7 +1558,7 @@
                        reset($cached_returns[$property]);
                        return $cached_returns[$property];
                }
-               
+
                reset($this->parameter);
                while(list($key,$param_array) = each($this->parameter))
                {
@@ -1365,7 +1582,7 @@
                        reset($cached_returns[$ical_type]);
                        return $cached_returns[$ical_type];
                }
-               
+
                reset($this->property);
                while(list($key,$param_array) = each($this->property))
                {
@@ -1381,16 +1598,15 @@
 
        function new_ical()
        {
-               return Array();
+               return array();
        }
 
        /*
         * Parse Functions
         */
-
        function parse_geo(&$event,$value)
        {
-//             $return_value = $this->explode_param($value,True);
+               //$return_value = $this->explode_param($value,True);
                if(count($return_value) == 2)
                {
                        $event['lat'] = $return_value[0];
@@ -1409,10 +1625,10 @@
        {
                if(!ereg('[\=\;]',$value))
                {
-                       $return_value[] = Array(
-                               'param' => $majortype,
-                               'value' => $value
-                       );
+                       $return_value[] = array(
+                                       'param' => $majortype,
+                                       'value' => $value
+                                       );
                        $value = '';
                }
                elseif(ereg('(.*(\:\\\\)?.*):(.*)',$value,$temp))
@@ -1421,20 +1637,20 @@
                        $this->debug('Param '.$majortype.' Value : '.$temp[3]);
                        if($temp[3])
                        {
-                               $return_value[] = Array(
-                                       'param' => $majortype,
-                                       'value' => $temp[3]
-                               );
+                               $return_value[] = array(
+                                               'param' => $majortype,
+                                               'value' => $temp[3]
+                                               );
                                $value = str_replace(':MAILTO','',$temp[1]);
                        }
                        while(ereg('(([A-Z\-]*)[=]([[:alnum:] 
\_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&address@hidden<\>\-]*))([\;]?)(.*)',$value,$temp))
                        {
                                $this->debug('Value : 
'._debug_array($temp,False));
                                $this->debug('Param '.$temp[2].' Value : 
'.$temp[3]);
-                               $return_value[] = Array(
-                                       'param' => $temp[2],
-                                       'value' => $temp[3]
-                               );
+                               $return_value[] = array(
+                                               'param' => $temp[2],
+                                               'value' => $temp[3]
+                                               );
                                $value = chop($temp[5]);
                                $this->debug('Value would be = '.$value);
                                flush();
@@ -1446,16 +1662,21 @@
                        {
                                $this->debug('Value : 
'._debug_array($temp,False));
                                $this->debug('Param '.$temp[2].' Value : 
'.$temp[3]);
-                               $return_value[] = Array(
-                                       'param' => $temp[2],
-                                       'value' => $temp[3]
-                               );
+                               $return_value[] = array(
+                                               'param' => $temp[2],
+                                               'value' => $temp[3]
+                                               );
                                $value = chop($temp[5]);
                                $this->debug('Value would be = '.$value);
                                flush();
                        }
                }
-               
+
+               if(!isset($return_value))
+               {
+                       $return_value = array();
+               }
+
                for($i=0;$i<count($return_value);$i++)
                {
                        $name = strtolower($return_value[$i]['param']);
@@ -1512,7 +1733,18 @@
                                        case 'value':
                                                
if(@$this->property[$majortype]['type'] == 'date-time')
                                                {
-                                                       
$this->set_var($event,$param,$this->switch_date($name));
+                                                       if ($majortype == 
'exdate')
+                                                       {
+                                                               $value = 
explode (",", $value);
+                                                               for ($val = 0 ; 
$val < count ($value) ; ++$val)
+                                                               {
+                                                                       
$this->set_var($event[$majortype][$val],$param,$this->switch_date($value[$val]));
+                                                               }               
                                                
+                                                       }
+                                                       else
+                                                       {
+                                                               
$this->set_var($event[$majortype],$param,$this->switch_date($value));
+                                                       }
                                                }
                                                elseif($value <> "\\n" && 
$value)
                                                {
@@ -1527,7 +1759,7 @@
 
        function parse_value(&$event,$majortype,$value,$mode)
        {
-               $var = Array();
+               $var = array();
                $this->debug('Mode : '.$mode.' Majortype : '.$majortype);
                $this->parse_parameters($var,$majortype,$value);
                if($this->property[$majortype][$mode]['multiples'])
@@ -1567,7 +1799,7 @@
                {
                        $quote = '"';
                }
-               
+
                $return_value = 
$this->fold('X-'.$x_type['name'].$seperator.$quote.$x_type['value'].$quote);
                if($seperator == '=')
                {
@@ -1595,100 +1827,119 @@
                        return ':'.implode($exdates,',');
                }
                else
-               {
-                       while(list($dumb_key,$key) = each($param))
+                       if($property == 'rdate')
                        {
-                               if($key == 'value')
+                               while(list($key,$value) = each($event))
                                {
-                                       continue;
+                                       $rdates[] = $this->switch_date($value);
                                }
-                               if($key == 'mailto')
+                               return ':'.implode($rdates,',');
+                       }
+                       else
+                       {
+#while(list($dumb_key,$key) = each($param))
+                               foreach ($param as $key) 
                                {
-                                       $include_mailto = True;
-                                       continue;
+                                       if($key == 'value')
+                                       {
+                                               continue;
+                                       }
+                                       if($key == 'mailto')
+                                       {
+                                               $include_mailto = True;
+                                               continue;
+                                       }
+                                       $param_array = @$this->parameter[$key];
+                                       $type = @$this->parameter[$key]['type'];
+                                       if($type == 'date-time')
+                                       {
+                                               $include_datetime = True;
+                                               continue;
+                                       }
+                                       $quote = 
(@$this->parameter[$key]['quoted']?'"':'');
+                                       if(isset($event[$key]) && 
@$this->parameter[$key]['properties'][$property])
+                                       {
+                                               $change_text = 
@$this->parameter[$key]['to_text'];
+                                               $value = $event[$key];
+                                               if($change_text && $type == 
'text')
+                                               {
+                                                       $value = 
$this->to_text($value);
+                                               }
+                                               switch($type)
+                                               {
+                                                       case 'dir':
+                                                               $str .= 
';'.str_replace('_','-',strtoupper($key)).'='.$quote.$this->to_dir($value).$quote;
+                                                               break;
+                                                       case 'function':
+                                                               $str .= 
';'.str_replace('_','-',strtoupper($key)).'=';
+                                                               $function = 
$this->parameter[$key]['function'];
+                                                               
$this->debug($key.' Function Param : '.$value);
+                                                               $str .= 
$quote.$this->$function($value).$quote;
+                                                               break;
+                                                       case 'integer':
+                                                               $str .= ';' . 
strtoupper($key) . "=$value";
+                                                               break;
+                                                       case 'text':
+                                                       case 'string':
+                                                               $str .= 
';'.strtoupper($key).'='.$quote.$value.$quote;
+                                                               break;
+                                                       case 'date-time':
+                                                               $str .= 
($key=='until'?':':';UNTIL=').date('Ymd\THis',mktime($event['hour'],$event['min'],$event['sec'],$event['month'],$event['mday'],$event['year'])).(address@hidden($event['tzid'])?'Z':'');
+                                                               $str .= "\r\n";
+                                                               break;
+                                                       case 'integer':
+                                                               $str .= ';' . 
strtoupper($key) . '=' . $value;
+                                                               break;
+                                               }
+                                               unset($value);
+                                       }
                                }
-                               $param_array = @$this->parameter[$key];
-                               $type = @$this->parameter[$key]['type'];
-                               if($type == 'date-time')
+
+                               if(!empty($event['x_type']))
                                {
-                                       $include_datetime = True;
-                                       continue;
+                                       $c_x_type = count($event['x_type']);
+                                       for($j=0;$j<$c_x_type;$j++)
+                                       {
+                                               $str .= 
';'.$this->build_xtype($event['x_type'][$j],'=');
+                                       }
                                }
-                               $quote = 
(@$this->parameter[$key]['quoted']?'"':'');
-                               if(isset($event[$key]) && 
@$this->parameter[$key]['properties'][$property])
+                               if(!empty($event['value']))
                                {
-                                       $change_text = 
@$this->parameter[$key]['to_text'];
-                                       $value = $event[$key];
-                                       if($change_text && $type == 'text')
+                                       if($property == 'trigger')
                                        {
-                                               $value = $this->to_text($value);
+                                               $seperator = ';';
                                        }
-                                       switch($type)
+                                       else
                                        {
-                                               case 'dir':
-                                                       $str .= 
';'.str_replace('_','-',strtoupper($key)).'='.$quote.$this->to_dir($value).$quote;
-                                                       break;
-                                               case 'function':
-                                                       $str .= 
';'.str_replace('_','-',strtoupper($key)).'=';
-                                                       $function = 
$this->parameter[$key]['function'];
-                                                       $this->debug($key.' 
Function Param : '.$value);
-                                                       $str .= 
$quote.$this->$function($value).$quote;
-                                                       break;
-                                               case 'integer':
-                                                       $str .= ';' . 
strtoupper($key) . "=$value";
-                                                       break;
-                                               case 'text':
-                                               case 'string':
-                                                       $str .= 
';'.strtoupper($key).'='.$quote.$value.$quote;
-                                                       break;
-                                               case 'date-time':
-                                                       $str .= 
($key=='until'?':':';UNTIL=').date('Ymd\THis',mktime($event['hour'],$event['min'],$event['sec'],$event['month'],$event['mday'],$event['year'])).(address@hidden($event['tzid'])?'Z':'');
-                                                       break;
+                                               $seperator = ':';
                                        }
-                                       unset($value);
-                               }
-                       }
-
-                       if(!empty($event['x_type']))
-                       {
-                               $c_x_type = count($event['x_type']);
-                               for($j=0;$j<$c_x_type;$j++)
-                               {
-                                       $str .= 
';'.$this->build_xtype($event['x_type'][$j],'=');
+                                       $str .= 
$seperator.($this->parameter['value']['to_text']?$this->to_text($event['value']):$event['value']);
+                                       $str .= "\r\n";
                                }
-                       }
-                       if(!empty($event['value']))
-                       {
-                               if($property == 'trigger')
+                               if($include_mailto == True)
                                {
-                                       $seperator = ';';
+                                       $key = 'mailto';
+                                       $function = 
$this->parameter[$key]['function'];
+                                       $ret_value = 
$this->$function($event[$key]);
+                                       $str .= ($ret_value?':'.$ret_value:'');
+                                       $str .= "\r\n";
                                }
-                               else
+                               if($include_datetime == True || 
@$this->property[$property]['type'] == 'date-time')
                                {
-                                       $seperator = ':';
+                                       $str .= 
':'.date('Ymd\THis',mktime($event['hour'],$event['min'],$event['sec'],$event['month'],$event['mday'],$event['year'])).(address@hidden($event['tzid'])?'Z':'');
+                                       $str .= "\r\n";
                                }
-                               $str .= 
$seperator.($this->parameter['value']['to_text']?$this->to_text($event['value']):$event['value']);
-                       }
-                       if($include_mailto == True)
-                       {
-                               $key = 'mailto';
-                               $function = $this->parameter[$key]['function'];
-                               $ret_value = $this->$function($event[$key]);
-                               $str .= ($ret_value?':'.$ret_value:'');
-                       }
-                       if($include_datetime == True || 
@$this->property[$property]['type'] == 'date-time')
-                       {
-                               $str .= 
':'.date('Ymd\THis',mktime($event['hour'],$event['min'],$event['sec'],$event['month'],$event['mday'],$event['year'])).(address@hidden($event['tzid'])?'Z':'');
+                               return 
($property=='rrule'?':'.substr($str,1):$str);
                        }
-                       return ($property=='rrule'?':'.substr($str,1):$str);
-               }
        }
 
        function build_text($event,$property)
        {
+               error_log('build_text-----event: '. serialize($event));
                $str = '';
                $param = $this->find_parameters($property);
-               while(list($dumb_key,$key) = each($param))
+#while(list($dumb_key,$key) = each($param))
+               foreach ($param as $key) 
                {
                        if(!empty($event[$key]) && $key != 'value')
                        {
@@ -1716,12 +1967,14 @@
                        for($j=0;$j<$c_x_type;$j++)
                        {
                                $str .= 
';'.$this->build_xtype($event['x_type'][$j],'=');
+                               $str .= "\r\n";
                        }
                }
                if(!empty($event['value']))
                {
                        $str .= 
':'.($this->parameter['value']['to_text']?$this->to_text($event['value']):$event['value']);
                }
+               error_log('build_text-----str: '.$str);
                return $str;
        }
 
@@ -1729,7 +1982,8 @@
        {
                $prop = $this->find_properties($ical_item);
                reset($prop);
-               while(list($dumb_key,$key) = each($prop))
+#while(list($dumb_key,$key) = each($prop))
+               foreach($prop as $key) 
                {
                        $value  = $key;
                        $varray = $this->property[$key];
@@ -1742,7 +1996,7 @@
                                case 'date-time':
                                        if(!empty($event[$value]))
                                        {
-                                               if($multiples && $value != 
'exdate')
+                                               if($multiples && $value != ( 
'exdate' || 'rdate' ))
                                                {
                                                        
for($i=0;$i<count($event[$value]);$i++)
                                                        {
@@ -1757,6 +2011,7 @@
                                        elseif($value == 'dtstamp' || $value == 
'created')
                                        {
                                                $str .= 
$this->fold(strtoupper(str_replace('_','-',$value)).':'.gmdate('Ymd\THis\Z'));
+                                               $str .= "\r\n";
                                        }
                                        break;
                                case 'uri':
@@ -1788,21 +2043,25 @@
                                        if(!empty($event[$value]))
                                        {
                                                $str .= 
$this->fold(strtoupper(str_replace('_','-',$value)).':'.$event[$value]);
+                                               $str .= "\r\n";
                                        }
                                        elseif($value == 'sequence' || $value 
== 'percent_complete')
                                        {
                                                $str .= 
$this->fold(strtoupper(str_replace('_','-',$value)).':0');
+                                               $str .= "\r\n";
                                        }
                                        break;
                                case 'function':
                                        $str .= 
';'.str_replace('_','-',strtoupper($value)).'=';
                                        $function = 
@$this->parameter[$key]['function'];
                                        $str .= 
(@$this->parameter[$key]['quoted']?'"':'').$this->$function($event[$key]).(@$this->parameter[$key]['quoted']?'"':'');
+                                       $str .= "\r\n";
                                        break;
                                case 'float':
                                        if(!empty($event[$value]))
                                        {
                                                $str .= 
$this->fold(strtoupper(str_replace('_','-',$value)).':'.$event[$value]['lat'].';'.$event[$value]['lon']);
+                                               $str .= "\r\n";
                                        }
                                        break;
                                case 'text':
@@ -1830,11 +2089,13 @@
                                                                
for($i=0;$i<count($event[$value]);$i++)
                                                                {
                                                                        $str .= 
$this->fold(strtoupper(str_replace('_','-',$value)).':'.$this->$function($event[$value][$i]));
+                                                                       $str .= 
"\r\n";
                                                                }
                                                        }
                                                        else
                                                        {
                                                                $str .= 
$this->fold(strtoupper(str_replace('_','-',$value)).':'.$this->$function($event[$value]));
+                                                               $str .= "\r\n";
                                                        }
                                                }
                                        }
@@ -1994,10 +2255,10 @@
 
        function switch_date($var)
        {
-       $this->debug('SWITCH_DATE: gettype = '.gettype($var));
+               $this->debug('SWITCH_DATE: gettype = '.gettype($var));
                if(is_string($var))
                {
-                       $dtime = Array();
+                       $dtime = array();
                        if(strpos($var,':'))
                        {
                                $pos = explode(':',$var);
@@ -2038,20 +2299,20 @@
                                         *
                                         * The implementor will need to 
consider how to convert that time to UTC.
                                         */
-//                                     if($this->api)
-//                                     {
-//                                             $dtime['hour'] -= 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
-//                                             if($dtime['hour'] < 0)
-//                                             {
-//                                                     $dtime['mday'] -= 1;
-//                                                     $dtime['hour'] = 24 - 
$dtime['hour'];
-//                                             }
-//                                             elseif($dtime['hour'] >= 24)
-//                                             {
-//                                                     $dtime['mday'] += 1;
-//                                                     $dtime['hour'] = 
$dtime['hour'] - 24;
-//                                             }
-//                                     }
+                                       //                                      
if($this->api)
+                                       //                                      
{
+                                       //                                      
        $dtime['hour'] -= 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
+                                       //                                      
        if($dtime['hour'] < 0)
+                                       //                                      
        {
+                                       //                                      
                $dtime['mday'] -= 1;
+                                       //                                      
                $dtime['hour'] = 24 - $dtime['hour'];
+                                       //                                      
        }
+                                       //                                      
        elseif($dtime['hour'] >= 24)
+                                       //                                      
        {
+                                       //                                      
                $dtime['mday'] += 1;
+                                       //                                      
                $dtime['hour'] = $dtime['hour'] - 24;
+                                       //                                      
        }
+                                       //                                      
}
                                }
                        }
                        else
@@ -2246,13 +2507,13 @@
                                $parts = explode(':',$var);
                                $var = $parts[1];
                        }
-               
+
                        $parts = explode('@',$var);
                        $this->debug("Count of mailto parts : ".count($parts));
                        if(count($parts) == 2)
                        {
                                $this->debug("Splitting ".$parts[0]." @ 
".$parts[1]);
-                               $temp_address = Array();
+                               $temp_address = array();
                                $temp_address['user'] = $parts[0];
                                $temp_address['host'] = $parts[1];
                                return $temp_address;
@@ -2264,31 +2525,31 @@
                }
                elseif(is_array($var))
                {
-//                     return 'MAILTO:'.$var['user'].'@'.$var['host'];
+                       //                      return 
'MAILTO:'.$var['user'].'@'.$var['host'];
                        return $var['user'].'@'.$var['host'];
                }
        }
 
        function switch_partstat($var)
        {
-//             $this->debug_str = True;
+               //              $this->debug_str = True;
                $this->debug('PARTSTAT = '.$var);
-//             $this->debug_str = False;
+               //              $this->debug_str = False;
                if(is_string($var))
                {
                        switch($var)
                        {
                                case 'NEEDS-ACTION':
-                                  return 0; // NEEDS_ACTION;
+                                       return 0; // NEEDS_ACTION;
                                        break;
                                case 'ACCEPTED':
-                                  return 1; // ACCEPTED;
+                                       return 1; // ACCEPTED;
                                        break;
                                case 'DECLINED':
-                                  return 2; // DECLINED;
+                                       return 2; // DECLINED;
                                        break;
                                case 'TENTATIVE':
-                                  return 3; // TENTATIVE;
+                                       return 3; // TENTATIVE;
                                        break;
                                case 'DELEGATED':
                                        return 4; // DELEGATED;
@@ -2308,25 +2569,25 @@
                {
                        switch(intval($var))
                        {
-                       case 0: // NEEDS_ACTION:
+                               case 0: // NEEDS_ACTION:
                                        return 'NEEDS-ACTION';
                                        break;
-                       case 1: //  ACCEPTED:
+                               case 1: //  ACCEPTED:
                                        return 'ACCEPTED';
                                        break;
-                       case 2: // DECLINED:
+                               case 2: // DECLINED:
                                        return 'DECLINED';
                                        break;
-                       case 3: // TENTATIVE:
+                               case 3: // TENTATIVE:
                                        return 'TENTATIVE';
                                        break;
-                       case 4: // DELEGATED:
+                               case 4: // DELEGATED:
                                        return 'DELEGATED';
                                        break;
-                       case 5: // COMPLETED:
+                               case 5: // COMPLETED:
                                        return 'COMPLETED';
                                        break;
-                       case 6: // IN_PROCESS:
+                               case 6: // IN_PROCESS:
                                        return 'IN-PROCESS';
                                        break;
                                default:
@@ -2573,14 +2834,14 @@
                $text = $this->read_line_unfold($ical_text);
                while($text)
                {
-//                     if(strlen($ical_text[$i]) > 75)
-//                     {
-//                             continue;
-//                     }
+                       //                      if(strlen($ical_text[$i]) > 75)
+                       //                      {
+                       //                              continue;
+                       //                      }
 
                        ereg($property_regexp,$text,$temp);
                        $majortype = str_replace('-','_',strtolower($temp[1]));
-                       $value = chop($temp[2]);
+                       $value = utf8_decode(chop($temp[2]));
 
                        if($mode != 'none' && ($majortype != 'begin' && 
$majortype != 'end'))
                        {
@@ -2617,16 +2878,16 @@
                                {
                                        case 'daylight':
                                        case 'standard':
-                                               $t_event = Array();
+                                               $t_event = array();
                                                $t_event = $event;
-                                               $event = Array();
+                                               $event = array();
                                                break;
                                        case 'valarm':
                                                if($tmode == 'vevent' || $tmode 
== 'vtodo')
                                                {
                                                        $t_event = $event;
                                                        unset($event);
-                                                       $event = Array();
+                                                       $event = array();
                                                }
                                                else
                                                {
@@ -2641,7 +2902,7 @@
                                        case 'vjournal':
                                        case 'vtimezone':
                                        case 'vtodo':
-                                               $event = Array();
+                                               $event = array();
                                                break;
                                }
                                $event['type'] = strtolower($value);
@@ -2750,7 +3011,7 @@
                                                
$this->set_var($event,$majortype,intval($value));
                                                break;
                                        case 'uri':
-                                               $new_var = Array();
+                                               $new_var = array();
                                                
$this->parse_parameters($new_var,$majortype,$value);
                                                if($multiples)
                                                {
@@ -2782,18 +3043,21 @@
 
        function build_ical($ical)
        {
-               $var = Array(
-                       'timezone',
-                       'event',
-                       'todo',
-                       'journal',
-                       'freebusy'
-               );
+               $var = array(
+                               'timezone',
+                               'event',
+                               'todo',
+                               'journal',
+                               'freebusy'
+                           );
 
                $str = 'BEGIN:VCALENDAR'."\r\n";
                $str .= 
$this->fold('PRODID'.$this->build_text($ical['prodid'],'prodid'));
+               $str .= "\r\n";
                $str .= 
$this->fold('VERSION'.$this->build_text($ical['version'],'version'));
+               $str .= "\r\n";
                $str .= 
$this->fold('METHOD'.$this->build_text($ical['method'],'method'));
+               $str .= "\r\n";
                while(list($key,$vtype) = each($var))
                {
                        if($ical[$vtype])
@@ -2802,6 +3066,7 @@
                                {
                                        $str .= 
'BEGIN:V'.strtoupper($vtype)."\r\n";
                                        $str .= 
$this->build_card_internals('v'.$vtype,$ical[$vtype][$i]);
+                                       $str = substr($str,0,-2);
                                        $str .= 
'END:V'.strtoupper($vtype)."\r\n";
                                }
                        }
@@ -2811,332 +3076,557 @@
                return $str;
        }
 
-               function switch_to_phpgw_status($partstat)
+       function switch_to_phpgw_status($partstat)
+       {
+               switch($partstat)
                {
-                       switch($partstat)
-                       {
-                               case 0:
-                                       return 'U';
-                                       break;
-                               case 1:
-                                       return 'A';
-                                       break;
-                               case 2:
-                                       return 'R';
-                                       break;
-                               case 3:
-                                       return 'T';
-                                       break;
-                               default:
-                                       return 'U';
-                                       break;
-                       }
+                       case 0:
+                               return 'U';
+                               break;
+                       case 1:
+                               return 'A';
+                               break;
+                       case 2:
+                               return 'R';
+                               break;
+                       case 3:
+                               return 'T';
+                               break;
+                       default:
+                               return 'U';
+                               break;
                }
+       }
 
-               function switch_phpgw_status($status)
+       function switch_phpgw_status($status)
+       {
+               switch($status)
                {
-                       switch($status)
-                       {
-                               case 'U':
-                                       return 0;
-                                       break;
-                               case 'A':
-                                       return 1;
-                                       break;
-                               case 'R':
-                                       return 2;
-                                       break;
-                               case 'T':
-                                       return 3;
-                                       break;
-                       }
+                       case 'U':
+                               return 0;
+                               break;
+                       case 'A':
+                               return 1;
+                               break;
+                       case 'R':
+                               return 2;
+                               break;
+                       case 'T':
+                               return 3;
+                               break;
                }
+       }
 
-               function is_owner($part_record)
+       function is_owner($part_record)
+       {
+               if( strtolower("{$part_record['user'address@hidden'host']}") == 
strtolower(ExecMethod('phpgwapi.contacts.get_email', 
$GLOBALS['phpgw_info']['user']['person_id'])) )
                {
-                       if( "{$part_record['user'address@hidden'host']}" == 
ExecMethod('phpgwapi.contacts.get_email', 
$GLOBALS['phpgw_info']['user']['person_id']) )
-                       {
-                               return True;
-                       }
-                       else
-                       {
-                               return False;
-                       }
+                       return True;
+               }
+               else
+               {
+                       return False;
                }
+       }
 
-               function check_owner(&$event,$ical,$so_event)
+       function check_owner(&$event,$ical,$so_event)
+       {
+               
if(!isset($event['participant'][$GLOBALS['phpgw_info']['user']['person_id']]))
                {
-                       
if(!isset($event['participant'][$GLOBALS['phpgw_info']['user']['person_id']]))
+                       if(isset($ical['organizer']))
                        {
-                               if(isset($ical['organizer']))
+                               if($this->is_owner($ical['organizer']))
                                {
-                                       if($this->is_owner($ical['organizer']))
-                                       {
-                                               
$so_event->add_attribute('owner', $GLOBALS['phpgw_info']['user']['person_id']);
-                                               
$so_event->add_attribute('participants', 
$this->switch_to_phpgw_status($ical['organizer']['partstat']), 
$GLOBALS['phpgw_info']['user']['person_id']);
-                                       }
+                                       $so_event->add_attribute('owner', 
$GLOBALS['phpgw_info']['user']['person_id']);
+                                       
$so_event->add_attribute('participants', 
$this->switch_to_phpgw_status($ical['organizer']['partstat']), 
$GLOBALS['phpgw_info']['user']['person_id']);
                                }
-                               elseif(isset($ical['attendee']))
-                               {
-                                       $attendee_count = 
count($ical['attendee']);
+                       }
+                       elseif(isset($ical['attendee']))
+                       {
+                               $attendee_count = count($ical['attendee']);
 
-                                       for($j=0;$j<$attendee_count;$j++)
+                               for($j=0;$j<$attendee_count;$j++)
+                               {
+                                       
if($this->is_owner($ical['attendee'][$j]))
                                        {
-                                               
if($this->is_owner($ical['attendee'][$j]))
-                                               {
-                                                       
$so_event->add_attribute('participants',$this->switch_to_phpgw_status($ical['attendee'][$j]['partstat']),
 intval($GLOBALS['phpgw_info']['user']['person_id']));
-                                               }
+                                               
$so_event->add_attribute('participants',$this->switch_to_phpgw_status($ical['attendee'][$j]['partstat']),
 intval($GLOBALS['phpgw_info']['user']['person_id']));
                                        }
                                }
-                               else
-                               {
-                                       $so_event->add_attribute('owner', 
$GLOBALS['phpgw_info']['user']['person_id']);
-                                       
$so_event->add_attribute('participants', 'A', 
$GLOBALS['phpgw_info']['user']['person_id']);
-                               }
+                       }
+                       else
+                       {
+                               $so_event->add_attribute('owner', 
$GLOBALS['phpgw_info']['user']['person_id']);
+                               $so_event->add_attribute('participants', 'A', 
$GLOBALS['phpgw_info']['user']['person_id']);
                        }
                }
+       }
 
-               function import_file()
+       function import_file()
+       {
+               if( ! is_array($_FILES['uploadedfile']) || 
$_FILES['uploadedfile']['tmp_name'] == '' /*|| 
$_FILES['uploadedfile']['tmp_name'] = 'none'*/)
                {
-                       if( ! is_array($_FILES['uploadedfile']) || 
$_FILES['uploadedfile']['tmp_name'] == '' /*|| 
$_FILES['uploadedfile']['tmp_name'] = 'none'*/)
-                       {
-                               Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',
-                                               Array(
+                       Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',
+                                               array(
                                                        'menuaction'    => 
'calendar.uiicalendar.import',
                                                        'action'        => 
'GetFile'
+                                                    )
                                                )
-                                       )
-                               );
-                               $GLOBALS['phpgw']->common->phpgw_exit();
-                       }
-                       $uploaddir = 
$GLOBALS['phpgw_info']['server']['temp_dir'] . SEP;
+                             );
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               $uploaddir = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP;
 
-                       srand((double)microtime()*1000000);
-                       $random_number = rand(100000000,999999999);
-                       $newfilename = md5($_FILES['uploadedfile']['name'].", 
".$uploadedfile_name.", "
+               srand((double)microtime()*1000000);
+               $random_number = rand(100000000,999999999);
+               $newfilename = md5($_FILES['uploadedfile']['name'].", 
".$uploadedfile_name.", "
                                . time() . getenv("REMOTE_ADDR") . 
$random_number );
 
-                       $filename = $uploaddir . $newfilename;
-                       if ( 
!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $filename) )
-                       {
-                               Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',
-                                               Array(
+               $filename = $uploaddir . $newfilename;
+               if ( !move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 
$filename) )
+               {
+                       Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',
+                                               array(
                                                        'menuaction'    => 
'calendar.uiicalendar.import',
                                                        'action'    => 'GetFile'
+                                                    )
                                                )
-                                       )
-                               );
-                               $GLOBALS['phpgw']->common->phpgw_exit();
-                       }
-//                     $ftp = fopen($uploaddir . $newfilename . '.info','wb');
-//                     
fputs($ftp,$uploadedfile_type."\n".$uploadedfile_name."\n");
-//                     fclose($ftp);
-                       return $filename;
+                             );
+                       $GLOBALS['phpgw']->common->phpgw_exit();
                }
+               //                      $ftp = fopen($uploaddir . $newfilename 
. '.info','wb');
+               //                      
fputs($ftp,$uploadedfile_type."\n".$uploadedfile_name."\n");
+               //                      fclose($ftp);
+               return $filename;
+       }
 
-               function import($mime_msg='')
+       function import($mime_msg='', $isReturn=false, $timestamp = 0, $id = 0)
+       {
+               $this->line = 0;
+               if( is_array($_FILES['uploadedfile']) && 
$_FILES['uploadedfile']['name'] != '')
                {
-                       if( is_array($_FILES['uploadedfile']) && 
$_FILES['uploadedfile']['name'] != '')
-                       {
-                               $filename = $this->import_file();
-                               $fp=fopen($filename,'rt');
-                               $mime_msg = explode("\n",fread($fp, 
filesize($filename)));
-                               fclose($fp);
-                               unlink($filename);
-                       }
-                       elseif(!$mime_msg)
-                       {
-                               Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',
-                                               Array(
+                       $filename = $this->import_file();
+                       $fp=fopen($filename,'rt');
+                       $mime_msg = explode("\n",fread($fp, 
filesize($filename)));
+                       fclose($fp);
+                       unlink($filename);
+               }
+               elseif(!$mime_msg)
+               {
+                       if($isReturn)
+                               return false;
+
+                       Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',
+                                               array(
                                                        'menuaction'    => 
'calendar.uiicalendar.import',
                                                        'action'        => 
'GetFile'
+                                                    )
                                                )
-                                       )
-                               );
-                               $GLOBALS['phpgw']->common->phpgw_exit();        
                        
-                       }
+                             );
+                       $GLOBALS['phpgw']->common->phpgw_exit();                
                
+               }
 
-                       if(!is_object($GLOBALS['uicalendar']))
-                       {
-                               $so_event = createobject('calendar.socalendar',
-                                       Array(
+               if(!is_object($GLOBALS['uicalendar']))
+               {
+                       $so_event = createobject('calendar.socalendar',
+                                       array(
                                                'owner' => 0,
                                                'filter'        => '',
                                                'category'      => ''
-                                       )
-                               );
-                       }
-                       else
-                       {
-                               $so_event = $GLOBALS['uicalendar']->bo->so;
-                       }
-               
-                       $datetime_vars = Array(
-                               'start' => 'dtstart',
-                               'end'   => 'dtend',
+                                            )
+                                       );
+               }
+               else
+               {
+                       $so_event = $GLOBALS['uicalendar']->bo->so;
+               }
+
+               $datetime_vars = array(
+                               'start' => 'dtstart',
+                               'end'   => 'dtend',
                                'modtime'       => 'dtstamp',
                                'modtime'       => 'last_modified'
-                       );
-                       
-                       $date_array = Array(
+                               );
+
+               $date_array = array(
                                'Y'     => 'year',
                                'm'     => 'month',
                                'd'     => 'mday',
                                'H'     => 'hour',
                                'i'     => 'min',
                                's'     => 'sec'
-                       );
+                               );
+
+               // time limit should be controlled elsewhere
+               @set_time_limit(0);
 
-                       // time limit should be controlled elsewhere
-                       @set_time_limit(0);
+               $gmt_offset = 
date('O',$GLOBALS['phpgw']->datetime->users_localtime);  // offset to GMT
+               $offset_mins = intval(substr($gmt_offset, 1, 2)) * 60 + 
intval(substr($gmt_offset, 3, 2));
 
-                       $users_email = 
ExecMethod('phpgwapi.contacts.get_email', 
$GLOBALS['phpgw_info']['user']['person_id']);
-                       $cats = CreateObject('phpgwapi.categories');
-                       $ical = $this->parse($mime_msg);
-                       switch($ical['version']['value'])
+               $users_email = ExecMethod('phpgwapi.contacts.get_email', 
$GLOBALS['phpgw_info']['user']['person_id']);
+               $cats = CreateObject('phpgwapi.categories');
+               $ical = $this->parse($mime_msg);
+               switch($ical['version']['value'])
+               {
+                       case '1.0':
+                               $cat_sep = ';';
+                               break;
+                       case '2.0':
+                       default:
+                               $cat_sep = ',';
+                               break;
+               }
+               $c_events = count($ical['event']);
+               for($i=0;$i<$c_events;$i++)
+               {
+                       if($ical['event'][$i]['uid']['value'])
                        {
-                               case '1.0':
-                                       $cat_sep = ';';
-                                       break;
-                               case '2.0':
-                               default:
-                                       $cat_sep = ',';
-                                       break;
+                               $uid_exists = 
$so_event->find_uid($ical['event'][$i]['uid']['value']);
+                       }
+                       else
+                       {
+                               $uid_exists = false;
+                       }
+                       if ($id > 0)
+                       {
+                               $uid_exists = $so_event->find_cal_id($id);
                        }
-                       $c_events = count($ical['event']);
-                       for($i=0;$i<$c_events;$i++)
+                       if($uid_exists)
                        {
-                               if($ical['event'][$i]['uid']['value'])
+                               $event = $so_event->read_entry($uid_exists);
+                               
$this->check_owner($event,$ical['event'][$i],$so_event);
+                               $event = $so_event->get_cached_event();
+                               $so_event->add_entry($event);
+                               //                                      $event 
= $so_event->get_cached_event();
+                       }
+                       else
+                       {
+                               $so_event->event_init();
+                               $so_event->add_attribute('id',0);
+                               $so_event->add_attribute('reference',0);
+                       }
+
+                       if($ical['event'][$i]['summary']['value'])
+                       {
+                               
$so_event->set_title($ical['event'][$i]['summary']['value']);
+                       }
+                       if($ical['event'][$i]['description']['value'])
+                       {
+                               
$so_event->set_description($ical['event'][$i]['description']['value']);
+                       }
+                       if($ical['event'][$i]['location']['value'])
+                       {
+                               
$so_event->add_attribute('location',$ical['event'][$i]['location']['value']);
+                       }
+                       if(isset($ical['event'][$i]['priority']))
+                       {
+                               
$so_event->add_attribute('priority',$ical['event'][$i]['priority']);
+                       }
+                       else
+                       {
+                               $so_event->add_attribute('priority',2);
+                       }
+                       if(!isset($ical['event'][$i]['class']))
+                       {
+                               $ical['event'][$i]['class'] = 1;
+                       }
+                       $so_event->set_class($ical['event'][$i]['class']);
+
+                       // Handle alarm import start
+                       if (count($ical['event'][$i]['alarm'])>0)
+                       {
+                               
for($a=0;$a<count($ical['event'][$i]['alarm']);++$a)
                                {
-                                       $uid_exists = 
$so_event->find_uid($ical['event'][$i]['uid']['value']);
+                                       $alarm_prior = 
substr($ical['event'][$i]['alarm'][$a]['trigger']['value'], 3);
+                                       if ($string_pos=strpos($alarm_prior, 
"D"))
+                                       {       
+                                               $alarm_prior_days = 
substr($alarm_prior, 0, $string_pos);
+                                               $alarm_prior = 
substr($alarm_prior, $string_pos + 1);
+                                       }
+                                       if ($string_pos = strpos($alarm_prior, 
"H"))
+                                       {  
+                                               $alarm_prior_hours = 
substr($alarm_prior, 0, $string_pos);
+                                               $alarm_prior = 
substr($alarm_prior, $string_pos + 1);
+                                       }
+                                       if ($string_pos = strpos($alarm_prior, 
"M"))
+                                       {
+                                               $alarm_prior_min = 
substr($alarm_prior, 0, $string_pos);
+                                       }                       
+
+                                       $imported_alarm[$a] = array(    time => 
mktime($ical['event'][$i]['dtstart']['hour'] - 
$alarm_prior_hours,$ical['event'][$i]['dtstart']['min'] - $alarm_prior_min + 
$offset_mins,$ical['event'][$i]['dtstart']['sec'],$ical['event'][$i]['dtstart']['month'],$ical['event'][$i]['dtstart']['mday']
 - $alarm_prior_days,$ical['event'][$i]['dtstart']['year']),
+                                                       owner => 
$GLOBALS['phpgw_info']['user']['account_id'],
+                                                       enabled => 1
+                                                       );
                                }
-                               else
+                               $so_event->add_attribute('alarm', 
$imported_alarm);
+                       }
+                       // Handle alarm import end
+
+                       @reset($datetime_vars);
+                       while(list($e_datevar,$i_datevar) = 
each($datetime_vars))
+                       {
+                               if(isset($ical['event'][$i][$i_datevar]))
                                {
-                                       $uid_exists = False;
+                                       $temp_time = 
$so_event->maketime($ical['event'][$i][$i_datevar]) + 
$GLOBALS['phpgw']->datetime->tz_offset;
+                                       @reset($date_array);
+                                       while(list($key,$var) = 
each($date_array))
+                                       {
+                                               $event[$e_datevar][$var] = 
intval(date($key,$temp_time));
+                                       }
+                                       
$so_event->set_date($e_datevar,$event[$e_datevar]['year'],$event[$e_datevar]['month'],$event[$e_datevar]['mday'],$event[$e_datevar]['hour'],$event[$e_datevar]['min']
 + $offset_mins, $event[$e_datevar]['sec']);
                                }
-                               if($uid_exists)
+                       }
+
+                       // If a Timestamp is given from the sync module add it 
to the event
+                       if ($timestamp > 0)
+                       {
+                               $so_event->set_date("timestamp", date ('Y', 
$timestamp),date ('m', $timestamp),date ('d', $timestamp),date ('H', 
$timestamp),date ('i', $timestamp),date ('s', $timestamp));
+                       }
+
+                       if(!isset($ical['event'][$i]['categories']['value']) || 
!$ical['event'][$i]['categories']['value'])
+                       {
+                               $so_event->set_category(0);
+                       }
+                       else
+                       {
+                               $ical_cats = array();
+                               
if(strpos($ical['event'][$i]['categories']['value'],$cat_sep))
                                {
-                                       $event = 
$so_event->read_entry($uid_exists);
-                                       
$this->check_owner($event,$ical['event'][$i],$so_event);
-                                       $event = $so_event->get_cached_event();
-                                       $so_event->add_entry($event);
-//                                     $event = $so_event->get_cached_event();
+                                       $ical_cats = 
explode($cat_sep,$ical['event'][$i]['categories']['value']);
                                }
                                else
                                {
-                                       $so_event->event_init();
-                                       $so_event->add_attribute('id',0);
-                                       $so_event->add_attribute('reference',0);
-                                       
if($ical['event'][$i]['summary']['value'])
-                                       {
-                                               
$so_event->set_title($ical['event'][$i]['summary']['value']);
-                                       }
-                                       
if($ical['event'][$i]['description']['value'])
-                                       {
-                                               
$so_event->set_description($ical['event'][$i]['description']['value']);
-                                       }
-                                       
if($ical['event'][$i]['location']['value'])
-                                       {
-                                               
$so_event->add_attribute('location',$ical['event'][$i]['location']['value']);
-                                       }
-                                       
if(isset($ical['event'][$i]['priority']))
-                                       {
-                                               
$so_event->add_attribute('priority',$ical['event'][$i]['priority']);
-                                       }
-                                       else
-                                       {
-                                               
$so_event->add_attribute('priority',2);
-                                       }
-                                       if(!isset($ical['event'][$i]['class']))
+                                       $ical_cats[] = 
$ical['event'][$i]['categories']['value'];
+                               }
+
+                               @reset($ical_cats);
+                               $cat_id_nums = array();
+                               while(list($key,$cat) = each($ical_cats))
+                               {
+                                       if(!$cats->exists('appandmains',$cat))
                                        {
-                                               $ical['event'][$i]['class'] = 1;
-                                       }
-                                       
$so_event->set_class($ical['event'][$i]['class']);
+                                               $cats->add(
+                                                               array(
+                                                                       'name'  
=> $cat,
+                                                                       'descr' 
=> $cat,
+                                                                       
'parent'        => '',
+                                                                       
'access'        => 'private',
+                                                                       'data'  
=> ''
+                                                                    )
+                                                         );
+                                       }
+                                       //                                      
                $temp_id = $cats->name2id($cat);
+                                       //                                      
                echo 'Category Name : '.$cat.' : Category ID :'.$temp_id."<br 
/>\n";
+                                       //                                      
                $cat_id_nums[] = $temp_id;
+                                       $cat_id_nums[] = $cats->name2id($cat);
+                               }
+                               @reset($cat_id_nums);
+                               if(count($cat_id_nums) > 1)
+                               {
+                                       
$so_event->set_category(implode($cat_id_nums,','));
+                               }
+                               else
+                               {
+                                       
$so_event->set_category($cat_id_nums[0]);
+                               }
+                       }
 
-                                       @reset($datetime_vars);
-                                       while(list($e_datevar,$i_datevar) = 
each($datetime_vars))
+                       //rrule
+                       $c_rrules = count($ical['event'][$i]['rrule']);         
                        
+                       for($r = 0 ; $r < $c_rrules ; ++$r)
+                       {
+                               if(isset($ical['event'][$i]['rrule'][$r]))
+                               {
+                                       // recur_enddate
+                                       
if(isset($ical['event'][$i]['rrule'][$r]['until']))
                                        {
-                                               
if(isset($ical['event'][$i][$i_datevar]))
+                                               $recur_enddate['year'] = 
intval($ical['event'][$i]['rrule'][$r]['until']['year']);
+                                               $recur_enddate['month'] = 
intval($ical['event'][$i]['rrule'][$r]['until']['month']);
+                                               $recur_enddate['mday'] = 
intval($ical['event'][$i]['rrule'][$r]['until']['mday']);
+                                       }
+                                       else if 
($ical['event'][$i]['rrule'][$r]['count'])
+                                               // If a count is passed instead 
of an until date we have to calculate 
+                                               // the enddate for the 
different recurrences otherwise the groupware 
+                                               // won't recognize the enddate
+                                       {  
+                                               $count = 
($ical['event'][$i]['rrule'][$r]['count'] - 1) * 
$ical['event'][$i]['rrule'][$r]['interval'];
+                                               
switch($ical['event'][$i]['rrule'][$r]['freq'])
                                                {
-                                                       $temp_time = 
$so_event->maketime($ical['event'][$i][$i_datevar]) + 
$GLOBALS['phpgw']->datetime->tz_offset;
-                                                       @reset($date_array);
-                                                       while(list($key,$var) = 
each($date_array))
-                                                       {
-                                                               
$event[$e_datevar][$var] = intval(date($key,$temp_time));
-                                                       }
-                                                       
$so_event->set_date($e_datevar,$event[$e_datevar]['year'],$event[$e_datevar]['month'],$event[$e_datevar]['mday'],$event[$e_datevar]['hour'],$event[$e_datevar]['min'],$event[$e_datevar]['sec']);
+                                                       case DAILY:
+                                                               
$recur_enddate['year'] = $ical['event'][$i]['dtstart']['year'];
+                                                               
$recur_enddate['month'] = $ical['event'][$i]['dtstart']['month'];
+
+                                                               // If an 
intervall is submittet we have to multiply the count with it to get the right 
enddate
+                                                               if 
($ical['event'][$i]['rrule'][$r]['interval'] > 1)
+                                                               {
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'] + $count;
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'] + $count;
+                                                               }
+
+                                                               // Only 
Weekdays means that that MO - FR are submitted meaning 5 days
+                                                               // so if tht 
occurs treat it that way  
+                                                               if ( count ( 
explode (",", $ical['event'][$i]['rrule'][$r]['byday'])) == 5 )
+                                                               {
+                                                                       // 
Calculate over how many weeks the count lasts and add 2 days to every week
+                                                                       for ($c 
= 0 ; $c < floor ($count / 5) ; ++$c )
+                                                                       {
+                                                                               
$weekend += 2;
+                                                                       }
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'] + $count + 
$weekend;
+                                                               }
+                                                               break;
+                                                       case WEEKLY:
+                                                               $weekday_array 
= explode (",",$ical['event'][$i]['rrule'][$r]['byday']);
+                                                               $count_weekdays 
= count ($weekday_array);
+                                                               $count_weeks = 
intval (floor ($count / $count_weekdays));
+
+                                                               if 
($weekday_array['0'] == "SU")
+                                                               {
+                                                                       
$temp_array = $weekday_array;
+                                                                       for ($t 
= 1 ; $t < count ($weekday_array) ; ++$t)
+                                                                       {
+                                                                               
$weekday_array[$t-1] = $temp_array[$t];
+                                                                       }
+                                                                       
array_push ($weekday_array, "SU");
+                                                               }
+
+                                                               // If we have 
more than one week and the modulo is 0 the enddate is exactly $count_weeks later
+                                                               if 
($count_weekdays > 1 && ($count % $count_weekdays) == 0)
+                                                               {
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'] + ($count_weeks 
* 7);
+                                                               }// otherwise 
there are following dates
+                                                               else if 
($count_weekdays > 1)
+                                                               {
+                                                                       // 
retrieve information about startdate
+                                                                       
$start_date = getdate (mktime (0, 0, 0, $ical['event'][$i]['dtstart']['month'], 
$ical['event'][$i]['dtstart']['mday'], $ical['event'][$i]['dtstart']['year']));
+                                                                       // Get 
the Weekday (MO, TU, WE ...)
+                                                                       
$start_weekday = strtoupper (substr ($start_date['weekday'], 0, 2));
+                                                                       // 
Search for its position in array and add the amount of occuring dates till the 
next week
+                                                                       
$weekday_position = intval (array_search ($start_weekday, $weekday_array)) + 
intval ($count % $count_weekdays);
+                                                                       // if 
the position exceeds array count start at the beginning of the array
+                                                                       if ( 
($weekday_position + 1) > count ($weekday_array) )
+                                                                       {
+                                                                               
$weekday_position = $weekday_position % count ($weekday_array);
+                                                                               
++$count_weeks;
+                                                                       }
+                                                                       
$last_occurence_weekday = $weekday_array[$weekday_position];
+
+                                                                       switch 
( $last_occurence_weekday )
+                                                                       {
+                                                                               
case MO:
+                                                                               
        $last_weekday = 1;
+                                                                               
        break;
+                                                                               
case TU:
+                                                                               
        $last_weekday = 2;
+                                                                               
        break;
+                                                                               
case WE:
+                                                                               
        $last_weekday = 3;
+                                                                               
        break;
+                                                                               
case TH:
+                                                                               
        $last_weekday = 4;
+                                                                               
        break;
+                                                                               
case FR:
+                                                                               
        $last_weekday = 5;
+                                                                               
        break;
+                                                                               
case SA:
+                                                                               
        $last_weekday = 6;
+                                                                               
        break;
+                                                                               
case SU:
+                                                                               
        $last_weekday = 7;
+                                                                               
        break;
+                                                                       }       
+
+                                                                       $diff = 
$last_weekday - $start_date['wday'];
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'] + ($count_weeks 
* 7) + $diff;
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'] + ($count * 7);
+                                                               }
+
+                                                               
$recur_enddate['year'] = $ical['event'][$i]['dtstart']['year'];
+                                                               
$recur_enddate['month'] = $ical['event'][$i]['dtstart']['month'];
+                                                               break;
+                                                       case MONTHLY:
+                                                               // If the 
recurrence is monthly by monthday  
+                                                               
if($ical['event'][$i]['rrule'][$r]['bymonthday'])
+                                                               {
+                                                                       
$recur_enddate['month'] = $ical['event'][$i]['dtstart']['month'] + $count;
+                                                                       
$recur_enddate['year'] = $ical['event'][$i]['dtstart']['year'];
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'];
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$recur_enddate['month'] = $ical['event'][$i]['dtstart']['month'] + $count ;
+                                                                       
$recur_enddate['year'] = $ical['event'][$i]['dtstart']['year'];
+
+                                                                       
$num_weekday_start = date ("w", (mktime (0, 0, 0, 
$ical['event'][$i]['dtstart']['month'], $ical['event'][$i]['dtstart']['mday'], 
$ical['event'][$i]['dtstart']['year'])));
+                                                                       
$num_first_weekday_in_endmonth = date ("w",mktime (0, 0, 0, 
$recur_enddate['month'] , 1, $recur_enddate['year']));
+
+                                                                       // 
calculate the first occurrence of the searched weekday
+                                                                       
$first_searched_weekday_in_month = 7 - $num_first_weekday_in_endmonth + 
$num_weekday_start ;
+                                                                       // 
because we are in the first week we have to subtract 1 from the count to get 
the correct enddate
+                                                                       
$which_week = ceil($ical['event'][$i]['dtstart']['mday'] / 7) - 1;
+                                                                       
$recur_enddate['mday'] = 1 + $first_searched_weekday_in_month + (7 * 
$which_week);
+                                                               }
+                                                               break;
+                                                       case YEARLY:
+                                                               if 
($ical['event'][$i]['rrule'][$r]['bymonthday'])
+                                                               {
+                                                                       
$recur_enddate['year'] = $ical['event'][$i]['dtstart']['year'] + $count;
+                                                                       
$recur_enddate['month'] = $ical['event'][$i]['dtstart']['month'];
+                                                                       
$recur_enddate['mday'] = $ical['event'][$i]['dtstart']['mday'];
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$recur_enddate['year'] = $ical['event'][$i]['dtstart']['year'] + $count;
+                                                                       
$recur_enddate['month'] = $ical['event'][$i]['dtstart']['month'];
+                                                                       
$num_weekday_start = date ("w", (mktime (0, 0, 0, 
$ical['event'][$i]['dtstart']['month'], $ical['event'][$i]['dtstart']['mday'], 
$ical['event'][$i]['dtstart']['year'])));
+                                                                       
$num_first_weekday_in_endmonth = date ("w",mktime (0, 0, 0, 
$recur_enddate['month'] , 1, $recur_enddate['year']));
+
+                                                                       // 
calculate the first occurrence of the searched weekday
+                                                                       
$first_searched_weekday_in_month = 7 - $num_first_weekday_in_endmonth + 
$num_weekday_start ;
+                                                                       // 
because we are in the first week we have to subtract 1 from the count to get 
the correct enddate
+                                                                       
$which_week = ceil($ical['event'][$i]['dtstart']['mday'] / 7) - 1;
+                                                                       
$recur_enddate['mday'] = 1 + $first_searched_weekday_in_month + (7 * 
$which_week);
+                                                               }
+                                                               break;
                                                }
                                        }
-                                       
if(!isset($ical['event'][$i]['categories']['value']) || 
!$ical['event'][$i]['categories']['value'])
-                                       {
-                                               $so_event->set_category(0);
-                                       }
                                        else
                                        {
-                                               $ical_cats = Array();
-                                               
if(strpos($ical['event'][$i]['categories']['value'],$cat_sep))
-                                               {
-                                                       $ical_cats = 
explode($cat_sep,$ical['event'][$i]['categories']['value']);
-                                               }
-                                               else
-                                               {
-                                                       $ical_cats[] = 
$ical['event'][$i]['categories']['value'];
-                                               }
+                                               $recur_enddate['year'] = 0;
+                                               $recur_enddate['month'] = 0;
+                                               $recur_enddate['mday'] = 0;
+                                       }
 
-                                               @reset($ical_cats);
-                                               $cat_id_nums = Array();
-                                               while(list($key,$cat) = 
each($ical_cats))
+                                       // recur_data
+                                       $recur_data = 0;
+                                       
if(isset($ical['event'][$i]['rrule'][$r]['byday']))
+                                       {
+                                               $week_days = array(
+                                                               MCAL_M_SUNDAY   
=> 'SU',
+                                                               MCAL_M_MONDAY   
=> 'MO',
+                                                               MCAL_M_TUESDAY  
=> 'TU',
+                                                               
MCAL_M_WEDNESDAY        => 'WE',
+                                                               MCAL_M_THURSDAY 
=> 'TH',
+                                                               MCAL_M_FRIDAY   
=> 'FR',
+                                                               MCAL_M_SATURDAY 
=> 'SA'
+                                                               );
+                                               @reset($week_days);
+                                               while(list($key,$val) = 
each($week_days))
                                                {
-                                                       
if(!$cats->exists('appandmains',$cat))
+                                                       if(strpos(' 
'.$ical['event'][$i]['rrule'][$r]['byday'],$val))
                                                        {
-                                                               $cats->add(
-                                                                       Array(
-                                                                               
'name'  => $cat,
-                                                                               
'descr' => $cat,
-                                                                               
'parent'        => '',
-                                                                               
'access'        => 'private',
-                                                                               
'data'  => ''
-                                                                       )
-                                                               );
+                                                               $recur_data += 
$key;
                                                        }
-//                                                     $temp_id = 
$cats->name2id($cat);
-//                                                     echo 'Category Name : 
'.$cat.' : Category ID :'.$temp_id."<br />\n";
-//                                                     $cat_id_nums[] = 
$temp_id;
-                                                       $cat_id_nums[] = 
$cats->name2id($cat);
-                                               }
-                                               @reset($cat_id_nums);
-                                               if(count($cat_id_nums) > 1)
-                                               {
-                                                       
$so_event->set_category(implode($cat_id_nums,','));
-                                               }
-                                               else
-                                               {
-                                                       
$so_event->set_category($cat_id_nums[0]);
                                                }
                                        }
-
-//rrule
-                                       if(isset($ical['event'][$i]['rrule']))
+                                       
elseif(isset($ical['event'][$i]['rrule'][$r]['wkst']))
                                        {
-// recur_enddate
-                                               
if(isset($ical['event'][$i]['rrule']['until']))
-                                               {
-                                                       $recur_enddate['year'] 
= intval($ical['event'][$i]['rrule']['until']['year']);
-                                                       $recur_enddate['month'] 
= intval($ical['event'][$i]['rrule']['until']['month']);
-                                                       $recur_enddate['mday'] 
= intval($ical['event'][$i]['rrule']['until']['mday']);
-                                               }
-                                               else
-                                               {
-                                                       $recur_enddate['year'] 
= 0;
-                                                       $recur_enddate['month'] 
= 0;
-                                                       $recur_enddate['mday'] 
= 0;
-                                               }
-
-// recur_data
-                                               $recur_data = 0;
-                                               
if(isset($ical['event'][$i]['rrule']['byday']))
-                                               {
-                                                       $week_days = Array(
+                                               $week_days = array(
                                                                MCAL_M_SUNDAY   
=> 'SU',
                                                                MCAL_M_MONDAY   
=> 'MO',
                                                                MCAL_M_TUESDAY  
=> 'TU',
@@ -3144,305 +3634,484 @@
                                                                MCAL_M_THURSDAY 
=> 'TH',
                                                                MCAL_M_FRIDAY   
=> 'FR',
                                                                MCAL_M_SATURDAY 
=> 'SA'
-                                                       );
-                                                       @reset($week_days);
-                                                       while(list($key,$val) = 
each($week_days))
+                                                               );
+                                               @reset($week_days);
+                                               while(list($key,$val) = 
each($week_days))
+                                               {
+                                                       if(strpos(' 
'.$ical['event'][$i]['rrule'][$r]['wkst'],$val))
                                                        {
-                                                               if(strpos(' 
'.$ical['event'][$i]['rrule']['byday'],$val))
-                                                               {
-                                                                       
$recur_data += $key;
-                                                               }
+                                                               $recur_data += 
$key;
                                                        }
                                                }
-
-// interval
-                                               
if(!isset($ical['event'][$i]['rrule']['interval']))
-                                               {
-                                                       $interval = 1;
-                                               }
-                                               else
-                                               {
-                                                       $interval = 
intval($ical['event'][$i]['rrule']['interval']);
-                                               }
-// recur_type
-                                               
switch($ical['event'][$i]['rrule']['freq'])
-                                               {
-                                                       case DAILY:
-                                                               $recur_type = 
MCAL_RECUR_DAILY;
-                                                               break;
-                                                       case WEEKLY:
-                                                               
$so_event->set_recur_weekly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,$recur_data);
-                                                               break;
-                                                       case MONTHLY:
-// Still need to determine if this is by day or by week for the month..
-//                                                             $recur_type = 
MCAL_RECUR_M??????;
-                                                               break;
-                                                       case YEARLY:
-                                                               
$so_event->set_recur_yearly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
-                                                               break;
-                                               }
                                        }
-                                       else
+
+                                       // interval
+                                       
if(!isset($ical['event'][$i]['rrule'][$r]['interval']))
                                        {
-                                               $so_event->set_recur_none();
+                                               $interval = 0;
                                        }
-
-// Owner                               
-                                       
if(!isset($ical['event'][$i]['organizer']) || 
(isset($ical['event'][$i]['organizer']) && 
$this->is_owner($ical['event'][$i]['organizer'])))
+                                       else if 
($ical['event'][$i]['rrule'][$r]['interval'] == 1)
                                        {
-                                               
$so_event->add_attribute('owner',$GLOBALS['phpgw_info']['user']['account_id']);
-                                               
$so_event->add_attribute('participants','A',intval($GLOBALS['phpgw_info']['user']['account_id']));
+                                               $interval = 0;
                                        }
                                        else
                                        {
-//owner
+                                               $interval = 
intval($ical['event'][$i]['rrule'][$r]['interval']);
                                        }
-                               
-                                       $event = $so_event->get_cached_event();
-                                       $so_event->add_entry($event);
-//                                     $event = $so_event->get_cached_event();
+                                       // recur_type
+                                       
switch($ical['event'][$i]['rrule'][$r]['freq'])
+                                       {
+                                               case DAILY:
+                                                       
$so_event->set_recur_daily($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,$recur_data);
+                                                       break;
+                                               case WEEKLY:
+                                                       
$so_event->set_recur_weekly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,$recur_data);
+                                                       break;
+                                               case MONTHLY:
+                                                       
if($ical['event'][$i]['rrule'][$r]['bymonthday'])
+                                                       {
+                                                               
$so_event->set_recur_monthly_mday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
+                                                       }
+                                                       else
+                                                       {       // If the 
bymonthday value contains a "-" it's meant to be the last weekday in month so  
tell set_recur_monthly_wday
+                                                               // to set the 
recur_last_weekday_in_month to true (1)
+                                                               
error_log("strstr ergebnis:". strlen($ical['event'][$i]['rrule'][$r]['byday']));
+                                                               if ( strlen 
($ical['event'][$i]['rrule'][$r]['byday'])>3 )
+                                                               {
+                                                                       
$so_event->set_recur_monthly_wday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,
 1);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$so_event->set_recur_monthly_wday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,
 0);
+                                                               }
+                                                       }
+                                                       break;
+                                               case YEARLY:
+                                                       if 
($ical['event'][$i]['rrule'][$r]['bymonthday'])
+                                                       {
+                                                               
$so_event->set_recur_yearly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
+                                                       }
+                                                       else
+                                                       {
+                                                               if ( strlen 
($ical['event'][$i]['rrule'][$r]['byday'])>3 )
+                                                               {
+                                                                       
$so_event->set_recur_yearly_wday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,
 1);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$so_event->set_recur_yearly_wday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,
 0);
+                                                               }
+                                                       }
+                                                       break;
+                                       }
+                               }
+                               else
+                               {
+                                       $so_event->set_recur_none();
+                               }
+
+                               if ($ical['event'][$i]['rrule'][$r]['count'] > 
0)
+                               {
+                                       $count = 
$ical['event'][$i]['rrule'][$r]['count'];
+                               }
+                       }
+                       // exdate                                       
+                       $c_exdate = 
count($ical['event'][$i]['exdate']['0']['exdate']);
+                       if ($c_exdate > 0)
+                       {       $ar_exdate = array();
+                               for($e = 0 ; $e < $c_exdate ; ++$e)
+                               {
+                                       
$ical['event'][$i]['exdate']['0']['exdate'][$e]['value']['min'] += $offset_mins;
+                                       array_push ($ar_exdate, 
$so_event->maketime($ical['event'][$i]['exdate']['0']['exdate'][$e]['value']));
                                }
+                               $so_event->add_attribute('recur_exception', 
$ar_exdate);
+                       }
+                       // rdate                                
+                       $c_rdate = count($ical['event'][$i]['rdate']['0']);
+                       if ($c_rdate > 0)
+                       {
+                               $ar_rdate = array();
+                               for($e = 0 ; $e < $c_rdate ; ++$e)
+                               {
+
+                                       
$ical['event'][$i]['rdate']['0']['rdate']['value']['min'] += $offset_mins;
+                                       $rdate_start =  
$ical['event'][$i]['rdate']['0']['rdate']['value'];
+                                       
$ical['event'][$i]['rdate']['0']['rdate']['value']['hour'] += 
$ical['event'][$i]['dtend']['hour'] - $ical['event'][$i]['dtstart']['hour'];
+                                       
$ical['event'][$i]['rdate']['0']['rdate']['value']['min'] += 
$ical['event'][$i]['dtend']['min'] - $ical['event'][$i]['dtstart']['min']; + 
$offset_mins;
+                                       
$ical['event'][$i]['rdate']['0']['rdate']['value']['sec'] += 
$ical['event'][$i]['dtend']['sec'] - $ical['event'][$i]['dtstart']['sec'];
+                                       $rdate_end =  
$ical['event'][$i]['rdate']['0']['rdate']['value'];
+                                       $submit 
=$so_event->maketime($rdate_start)."/".$so_event->maketime($rdate_end);
+                                       array_push ($ar_rdate, $submit);
+                               }
+                               $so_event->add_attribute('recur_date', 
$ar_rdate);
+                       }
+
+
+
+                       // Owner                                
+                       if(!isset($ical['event'][$i]['organizer']) || 
(isset($ical['event'][$i]['organizer']) && 
$this->is_owner($ical['event'][$i]['organizer'])))
+                       {
+                               
$so_event->add_attribute('owner',$GLOBALS['phpgw_info']['user']['account_id']);
+                               
$so_event->add_attribute('participants','A',intval($GLOBALS['phpgw_info']['user']['account_id']));
+                       }
+                       else
+                       { // workaround for ical without organizer -> set 
current user as organizer (without this workaround, the entry wouldnt be shown 
in the calendar!)
+                               
$so_event->add_attribute('participants','A',intval($GLOBALS['phpgw_info']['user']['account_id']));
                        }
-                       Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php',
-                                       Array(
+
+                       // Attendee
+                       // todo
+
+                       $event = $so_event->get_cached_event();
+                       $so_event->add_entry($event);
+
+                       unset($this->event);
+               }
+
+               if($isReturn==true)
+               {
+                       if(isset($event['id']))
+                               return $event['id'];
+                       else
+                               return false;
+               }
+
+               Header('Location: '.$GLOBALS['phpgw']->link('/index.php',
+                                       array(
                                                'menuaction'    => 
'calendar.uicalendar.view',
                                                'cal_id'        => $event['id']
+                                            )
                                        )
-                               )
-                       );
-                       $GLOBALS['phpgw']->common->phpgw_exit();
-               }
+                     );
+               $GLOBALS['phpgw']->common->phpgw_exit();
+       }
 
-               function export($params)
+       function export($params)
+       {
+               $event_id = 
get_var('cal_id',array('GET','DEFAULT'),$params['l_event_id']);
+
+               if ( isset($params['chunk_split']) )
                {
-                       $event_id = 
get_var('cal_id',Array('GET','DEFAULT'),$params['l_event_id']);
                        $this->chunk_split = $params['chunk_split'];
-                       $method = 
($params['method']?$params['method']:"publish");
+               }
 
-                       $string_array = Array(
+               $method = ($params['method']?$params['method']:"publish");
+
+               $string_array = array(
                                'description'   => 'description',
                                'location'      => 'location',
                                'summary'       => 'title',
                                'uid'           => 'uid'
-                       );
+                               );
+
+               $cats = CreateObject('phpgwapi.categories');
+
+               include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php');
+               if(!is_array($event_id))
+               {
+                       $ids[] = $event_id;
+               }
+               else
+               {
+                       $ids = $event_id;
+               }
+
+               $ical = $this->new_ical();
+
+               $versiona = explode('.', $setup_info['calendar']['version']);
+               unset($versiona[count($versiona)]);
+               $version = implode('.', $versiona);
 
-                       $cats = CreateObject('phpgwapi.categories');
-                       
-                       
include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php');
-                       if(!is_array($event_id))
+               
$this->set_var($ical['prodid'],'value',"-//phpGroupWare//phpGroupWare $version 
MIMEDIR//" . 
strtoupper($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']));
+               $this->set_var($ical['version'],'value','2.0');
+               $this->set_var($ical['method'],'value',strtoupper($method));
+               unset($version, $versiona);
+
+               
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['uicalendar'])
+               {
+                       
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['bocalendar'])
                        {
-                               $ids[] = $event_id;
+                               $so_event = createobject('calendar.socalendar',
+                                               array(
+                                                       'owner' => 0,
+                                                       'filter'        => '',
+                                                       'category'      => ''
+                                                    )
+                                               );
                        }
                        else
                        {
-                               $ids = $event_id;
+                               $so_event = $GLOBALS['bocalendar']->so;
                        }
+               }
+               else
+               {
+                       $so_event = $GLOBALS['uicalendar']->bo->so;
+               }
 
-                       $ical = $this->new_ical();
-                       
-                       $versiona = explode('.', 
$setup_info['calendar']['version']);
-                       unset($versiona[count($versiona)]);
-                       $version = implode('.', $versiona);
 
-                       
$this->set_var($ical['prodid'],'value',"-//phpGroupWare//phpGroupWare $version 
MIMEDIR//" . 
strtoupper($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']));
-                       $this->set_var($ical['version'],'value','2.0');
-                       
$this->set_var($ical['method'],'value',strtoupper($method));
-                       unset($version, $versiona);
+               while(list($key,$value) = each($ids))
+               {
+                       $ical_event = array();
+                       $event = $so_event->read_entry($value);
 
-                       
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['uicalendar'])
+                       if($event['alarm'])
                        {
-                               
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['bocalendar'])
+                               while(list($dummy,$alarm) = 
each($event['alarm']))
                                {
-                                       $so_event = 
createobject('calendar.socalendar',
-                                               Array(
-                                                       'owner' => 0,
-                                                       'filter'        => '',
-                                                       'category'      => ''
-                                               )
-                                       );
+                                       $ical_temp = array();
+                                       $ical_temp['action']['value'] = 
'DISPLAY';
+                                       $ical_temp['description']['value'] = 
$alarm['text'];
+
+                                       // Calculate the Period of Time for 
alarmmanagement
+                                       $eventstart = 
mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$event['start']['month'],$event['start']['mday'],$event['start']['year']);
+                                       $alarmtime = $eventstart - 
$alarm['time'];
+
+                                       $alarmday = date('d', $alarmtime)-1;
+                                       $alarmhour = date('H', $alarmtime)-1;
+                                       $alarmmin = date('i', $alarmtime);
+
+                                       // Construct the PT String
+                                       if ($alarmday>0)
+                                       {
+                                               $alarmstring = $alarmday . 'D';
+                                       }
+                                       if ($alarmhour>0)
+                                       {
+                                               $alarmstring .= $alarmhour . 
'H';
+                                       }
+                                       if ($alarmmin>0)
+                                       {
+                                               $alarmstring .= $alarmmin . 'M';
+                                       }
+
+                                       
$this->set_var($ical_temp['trigger'],'value','RELATED=START:-PT' . 
$alarmstring,'valarm');
+                                       
//$this->set_var($ical_temp['trigger'],'value','VALUE=DATE-TIME:'.date('Ymd\THis\Z',$alarm['time']),'valarm');
+                                       $ical_event['alarm'][] = $ical_temp;
                                }
-                               else
+                       }
+
+                       $ical_event['priority'] = $event['priority'];
+                       $ical_event['class'] = intval($event['public']);
+                       $dtstart_mktime = $so_event->maketime($event['start']);
+                       
$this->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
+                       $dtend_mktime = $so_event->maketime($event['end']);
+                       
$this->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
+                       $mod_mktime = $so_event->maketime($event['modtime']);
+                       
$this->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
+                       @reset($string_array);
+                       while(list($ical_value,$event_value) = 
each($string_array))
+                       {
+                               if($event[$event_value])
                                {
-                                       $so_event = $GLOBALS['bocalendar']->so;
+                                       
$this->set_var($ical_event[$ical_value],'value',$event[$event_value]);
                                }
                        }
-                       else
+
+                       if ($event['category'])
                        {
-                               $so_event = $GLOBALS['uicalendar']->bo->so;
+                               $cats->categories(0,'calendar');
+                               $category = explode(',',$event['category']);
+                               @reset($category);
+                               while(list($key,$cat) = each($category))
+                               {
+                                       $_cat = $cats->return_single($cat);
+                                       $cat_string[] = $_cat[0]['name'];
+                               }
+                               @reset($cat_string);
+                               
$this->set_var($ical_event['categories'],'value',implode($cat_string,','));
                        }
-                       
-               
-                       while(list($key,$value) = each($ids))
-                       {
-                               $ical_event = Array();
-                               $event = $so_event->read_entry($value);
 
-                               if($event['alarm'])
+                       if( is_array($event['participants']) && 
count($event['participants']) > 1)
+                       {
+                               if(!is_object($db))
                                {
-                                       while(list($dummy,$alarm) = 
each($event['alarm']))
-                                       {
-                                               $ical_temp = Array();
-                                               $ical_temp['action']['value'] = 
'DISPLAY';
-                                               
$ical_temp['description']['value'] = $alarm['text'];
-                                               
$this->set_var($ical_temp['trigger'],'value','VALUE=DATE-TIME:'.date('Ymd\THis\Z',$alarm['time']),'valarm');
-                                               $ical_event['alarm'][] = 
$ical_temp;
-                                       }
+                                       $db =& $GLOBALS['phpgw']->db;
                                }
 
-                               $ical_event['priority'] = $event['priority'];
-                               $ical_event['class'] = intval($event['public']);
-                               $dtstart_mktime = 
$so_event->maketime($event['start']);
-                               
$this->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
-                               $dtend_mktime = 
$so_event->maketime($event['end']);
-                               
$this->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
-                               $mod_mktime = 
$so_event->maketime($event['modtime']);
-                               
$this->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
-                               @reset($string_array);
-                               while(list($ical_value,$event_value) = 
each($string_array))
+                               $contacts = createObject('phpgwapi.contacts');
+
+                               foreach($event['participants'] as $part => 
$status)
                                {
-                                       if($event[$event_value])
+                                       $name = 
$contacts->get_contact_name($part);
+
+                                       $owner_status = 
$this->switch_partstat(intval($this->switch_phpgw_status($event['participants'][$part])));
+
+                                       $mailto = $contacts->get_email($part);
+
+                                       $str = 
'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$mailto;
+                                       if($part == $event['owner'])
                                        {
-                                               
$this->set_var($ical_event[$ical_value],'value',$event[$event_value]);
+                                               $str = 'ROLE=CHAIR;'.$str;
                                        }
-                               }
-                               
-                               if ($event['category'])
-                               {
-                                       $cats->categories(0,'calendar');
-                                       $category = 
explode(',',$event['category']);
-                                       @reset($category);
-                                       while(list($key,$cat) = each($category))
+                                       else
                                        {
-                                               $_cat = 
$cats->return_single($cat);
-                                               $cat_string[] = 
$_cat[0]['name'];
+                                               $str = 
'ROLE=REQ-PARTICIPANT;'.$str;
                                        }
-                                       @reset($cat_string);
-                                       
$this->set_var($ical_event['categories'],'value',implode($cat_string,','));
-                               }
-
-                               if( is_array($event['participants']) && 
count($event['participants']) > 1)
-                               {
-                                       if(!is_object($db))
+                                       if ($method != 'reply' || $part == 
$GLOBALS['phpgw_info']['user']['account_id'])
                                        {
-                                               $db =& $GLOBALS['phpgw']->db;
+                                               
$this->parse_value($ical_event,'attendee',$str,'vevent');
                                        }
-                                       
-                                       $contacts = 
createObject('phpgwapi.contacts');
-
-                                       foreach($event['participants'] as $part 
=> $status)
+                                       if($part == $event['owner'])
                                        {
-                                               $name = 
$contacts->get_contact_name($part);
-                                               
-                                               $owner_status = 
$this->switch_partstat(intval($this->switch_phpgw_status($event['participants'][$part])));
-
-                                               $mailto = 
$contacts->get_email($part);
-
-                                               $str = 
'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$mailto;
-                                               if($part == $event['owner'])
-                                               {
-                                                       $str = 
'ROLE=CHAIR;'.$str;
-                                               }
-                                               else
-                                               {
-                                                       $str = 
'ROLE=REQ-PARTICIPANT;'.$str;
-                                               }
-                                               if ($method != 'reply' || $part 
== $GLOBALS['phpgw_info']['user']['account_id'])
-                                               {
-                                                       
$this->parse_value($ical_event,'attendee',$str,'vevent');
-                                               }
-                                               if($part == $event['owner'])
-                                               {
-                                                       
$this->parse_value($ical_event,'organizer',$str,'vevent');
-                                               }
+                                               
$this->parse_value($ical_event,'organizer',$str,'vevent');
                                        }
                                }
-                               if($event['recur_type'])
+                       }
+                       if($event['recur_type'])
+                       {
+                               $str = '';
+                               switch($event['recur_type'])
                                {
-                                       $str = '';
-                                       switch($event['recur_type'])
-                                       {
-                                               case MCAL_RECUR_DAILY:
-                                                       $str .= 'FREQ=DAILY';
-                                                       break;
-                                               case MCAL_RECUR_WEEKLY:
-                                                       $str .= 'FREQ=WEEKLY';
-                                                       if($event['recur_data'])
+                                       case MCAL_RECUR_DAILY:
+                                               $str .= 'FREQ=DAILY';
+                                               if ($event['recur_data'] > 0)
+                                               { 
+                                                       $str .= ';BYDAY=';
+                                                       
for($i=1;$i<MCAL_M_ALLDAYS;$i=$i*2)
                                                        {
-                                                               $str .= 
';BYDAY=';
-                                                               
for($i=1;$i<MCAL_M_ALLDAYS;$i=$i*2)
+                                                               if($i & 
$event['recur_data'])
                                                                {
-                                                                       if($i & 
$event['recur_data'])
+                                                                       
switch($i)
                                                                        {
-                                                                               
switch($i)
-                                                                               
{
-                                                                               
        case MCAL_M_SUNDAY:
-                                                                               
                $day[] = 'SU';
-                                                                               
                break;
-                                                                               
        case MCAL_M_MONDAY:
-                                                                               
                $day[] = 'MO';
-                                                                               
                break;
+                                                                               
case MCAL_M_SUNDAY:
+                                                                               
        $day[] = 'SU';
+                                                                               
        break;
+                                                                               
case MCAL_M_MONDAY:
+                                                                               
        $day[] = 'MO';
+                                                                               
        break;
                                                                                
        CASE MCAL_M_TUESDAY:
                                                                                
                $day[] = 'TU';
-                                                                               
                break;
-                                                                               
        case MCAL_M_WEDNESDAY:
-                                                                               
                $day[] = 'WE';
-                                                                               
                break;
-                                                                               
        case MCAL_M_THURSDAY:
-                                                                               
                $day[] = 'TH';
-                                                                               
                break;
-                                                                               
        case MCAL_M_FRIDAY:
-                                                                               
                $day[] = 'FR';
-                                                                               
                break;
-                                                                               
        case MCAL_M_SATURDAY:
-                                                                               
                $day[] = 'SA';
-                                                                               
                break;
-                                                                               
}
+                                                                               
        break;
+                                                                               
case MCAL_M_WEDNESDAY:
+                                                                               
        $day[] = 'WE';
+                                                                               
        break;
+                                                                               
case MCAL_M_THURSDAY:
+                                                                               
        $day[] = 'TH';
+                                                                               
        break;
+                                                                               
case MCAL_M_FRIDAY:
+                                                                               
        $day[] = 'FR';
+                                                                               
        break;
+                                                                               
case MCAL_M_SATURDAY:
+                                                                               
        $day[] = 'SA';
+                                                                               
        break;
                                                                        }
                                                                }
-                                                               $str .= 
implode(',',$day);
                                                        }
-                                                       break;
-                                               case MCAL_RECUR_MONTHLY_MDAY:
-                                                       break;
-                                               case MCAL_RECUR_MONTHLY_WDAY:
-                                                       break;
-                                               case MCAL_RECUR_YEARLY:
-                                                       $str .= 'FREQ=YEARLY';
-                                                       break;
-                                       }
-                                       if($event['recur_interval'])
-                                       {
-                                               $str .= 
';INTERVAL='.$event['recur_interval'];
-                                       }
-                                       if($event['recur_enddate']['month'] != 
0 && $event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['year'] != 
0)
+                                                       $str .= 
implode(',',$day);
+                                               }
+                                               break;
+                                       case MCAL_RECUR_WEEKLY:
+                                               $str .= 'FREQ=WEEKLY';
+                                               if($event['recur_data'])
+                                               {
+                                                       $str .= ';BYDAY=';
+                                                       
for($i=1;$i<MCAL_M_ALLDAYS;$i=$i*2)
+                                                       {
+                                                               if($i & 
$event['recur_data'])
+                                                               {
+                                                                       
switch($i)
+                                                                       {
+                                                                               
case MCAL_M_SUNDAY:
+                                                                               
        $day[] = 'SU';
+                                                                               
        break;
+                                                                               
case MCAL_M_MONDAY:
+                                                                               
        $day[] = 'MO';
+                                                                               
        break;
+                                                                               
        CASE MCAL_M_TUESDAY:
+                                                                               
                $day[] = 'TU';
+                                                                               
        break;
+                                                                               
case MCAL_M_WEDNESDAY:
+                                                                               
        $day[] = 'WE';
+                                                                               
        break;
+                                                                               
case MCAL_M_THURSDAY:
+                                                                               
        $day[] = 'TH';
+                                                                               
        break;
+                                                                               
case MCAL_M_FRIDAY:
+                                                                               
        $day[] = 'FR';
+                                                                               
        break;
+                                                                               
case MCAL_M_SATURDAY:
+                                                                               
        $day[] = 'SA';
+                                                                               
        break;
+                                                                       }
+                                                               }
+                                                       }
+                                                       $str .= 
implode(',',$day);
+                                               }
+                                               break;
+                                       case MCAL_RECUR_MONTHLY_MDAY:
+                                               $str .= 
'FREQ=MONTHLY;BYMONTHDAY=' . $event['start']['mday'];
+                                               break;
+                                       case MCAL_RECUR_MONTHLY_WDAY:
+                                               // Calculate which weekday from 
monthstart
+                                               $weekdaycount = intval 
($event['start']['mday']/7)+1;
+                                               $weekday = strtoupper (substr 
(date 
('D',mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$event['start']['month'],$event['start']['mday'],$event['start']['year'])),
 0, 2));
+                                               if 
($event['recur_last_weekday_in_month'])
+                                               {
+                                                       $str .= 
'FREQ=MONTHLY;BYDAY=-1' . $weekday;
+                                               }
+                                               else
+                                               {
+                                                       $str .= 
'FREQ=MONTHLY;BYDAY=' . $weekdaycount . $weekday;
+                                               }       
+                                               break;
+                                       case MCAL_RECUR_YEARLY:
+                                               $str .= 'FREQ=YEARLY;BYMONTH=' 
. $event['start']['month'] . ';BYMONTHDAY=' . $event['start']['mday'];
+                                               break;
+                                       case MCAL_RECUR_YEARLY_WDAY:
+                                               $eventstart_jd = gregoriantojd 
( $event['start']['month'], $event['start']['mday'], $event['start']['year']);
+                                               $monthstart_jd = gregoriantojd 
( $event['start']['month'], 1, $event['start']['year']);
+                                               $weekdaycount = intval 
(($eventstart_jd-$monthstart_jd)/7)+1;
+                                               $weekday = strtoupper (substr 
(date 
('D',mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$event['start']['month'],$event['start']['mday'],$event['start']['year'])),
 0, 2));
+                                               $str .= 'FREQ=YEARLY;BYMONTH=' 
. $event['start']['month'] . ';BYDAY=' . $weekdaycount . $weekday;
+                                               break;
+                               }
+                               if($event['recur_interval'])
+                               {
+                                       $str .= 
';INTERVAL='.$event['recur_interval'];
+                               }
+                               if($event['recur_enddate']['month'] != 0 && 
$event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['year'] != 0)
+                               {
+                                       $recur_mktime = 
$so_event->maketime($event['recur_enddate']) - 
$GLOBALS['phpgw']->datetime->tz_offset;
+                                       $str .= 
';UNTIL='.date('Ymd\THis\Z',$recur_mktime);
+                               }
+                               
$this->parse_value($ical_event,'rrule',$str,'vevent');
+
+                               $exceptions =& $event['recur_exception'];
+                               if(is_array($exceptions))
+                               {
+                                       foreach ( $exceptions as $key => 
$except_datetime )
                                        {
-                                               $recur_mktime = 
$so_event->maketime($event['recur_enddate']) - 
$GLOBALS['phpgw']->datetime->tz_offset;
-                                               $str .= 
';UNTIL='.date('Ymd\THis\Z',$recur_mktime);
+                                               $except_datetime = 
mktime(date('H',$except_datetime),date('i',$except_datetime) - 
$offset,0,date('m',$except_datetime),date('d',$except_datetime),date('Y',$except_datetime));
+                                               $ical_event['exdate'][] = 
$this->switch_date(date('Ymd\THis\Z',$except_datetime));
                                        }
-                                       
$this->parse_value($ical_event,'rrule',$str,'vevent');
+                               }
 
-                                       $exceptions =& 
$event['recur_exception'];
-                                       if(is_array($exceptions))
-                                       {
-                                               foreach ( $exceptions as $key 
=> $except_datetime )
-                                               {
-                                                       $ical_event['exdate'][] 
= $this->switch_date(date('Ymd\THis\Z',$except_datetime));
-                                               }
+                               $rdate = $event['recur_date'];
+                               if(is_array($rdate))
+                               {
+                                       @reset($rdate);
+                                       while(list($key,$recur_datetime) = 
each($rdate))
+                                       {       
+                                               $recur_datetime = explode ("/", 
$recur_datetime);
+                                               $recur_datetime['0'] = 
mktime(date('H',$recur_datetime['0']),date('i',$recur_datetime['0']) - 
$offset,0,date('m',$recur_datetime['0']),date('d',$recur_datetime['0']),date('Y',$recur_datetime['0']));
+                                               $ical_event['rdate'][] = 
$this->switch_date(date('Ymd\THis\Z',$recur_datetime['0']));
                                        }
                                }
-                               $ical_events[] = $ical_event;
                        }
-
-                       $ical['event'] = $ical_events;
-                       return $this->build_ical($ical);
+                       $ical_events[] = $ical_event;
                }
 
-               function debug($str='')
+               $ical['event'] = $ical_events;
+               return $this->build_ical($ical);
+       }
+
+       function debug($str='')
+       {
+               if($this->debug_str)
                {
-                       if($this->debug_str)
-                       {
-                               echo $str."<br />\n";
-                       }
+                       echo $str."<br />\n";
                }
        }
+}
 ?>
Index: calendar/inc/class.socalendar.inc.php
diff -u calendar/inc/class.socalendar.inc.php:1.30 
calendar/inc/class.socalendar.inc.php:1.31
--- calendar/inc/class.socalendar.inc.php:1.30  Fri Nov 18 11:40:45 2005
+++ calendar/inc/class.socalendar.inc.php       Fri Dec 16 13:24:44 2005
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.socalendar.inc.php,v 1.30 2005/11/18 11:40:45 skwashd Exp $ */
+  /* $Id: class.socalendar.inc.php,v 1.31 2005/12/16 13:24:44 skwashd Exp $ */
 
        class socalendar
        {
@@ -201,6 +201,32 @@
                        }
                }
 
+
+
+## by tb
+               function find_cal_id($id)
+               {
+                       $sql = " AND (phpgw_cal.cal_id = '".$id."') ";
+
+                       $found = $this->cal->get_event_ids(False,$sql);
+                       if(!$found)
+                       {
+                               $found = $this->cal->get_event_ids(True,$sql);
+                       }
+                       if(is_array($found))
+                       {
+                               return $found[0];
+                       }
+                       else
+                       {
+                               return False;
+                       }
+               }
+## by tb
+
+
+
+
                function add_entry(&$event)
                {
                        $this->cal->store_event($event);
Index: calendar/inc/class.socalendar_sql.inc.php
diff -u calendar/inc/class.socalendar_sql.inc.php:1.39 
calendar/inc/class.socalendar_sql.inc.php:1.40
--- calendar/inc/class.socalendar_sql.inc.php:1.39      Sun Dec  4 09:58:15 2005
+++ calendar/inc/class.socalendar_sql.inc.php   Fri Dec 16 13:24:44 2005
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.socalendar_sql.inc.php,v 1.39 2005/12/04 09:58:15 skwashd Exp 
$ */
+  /* $Id: class.socalendar_sql.inc.php,v 1.40 2005/12/16 13:24:44 skwashd Exp 
$ */
 
 if (@$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar_'])
 {
@@ -23,10 +23,10 @@
 
 class socalendar_ extends socalendar__
 {
-       var $deleted_events = Array();
+       var $deleted_events = array();
        
        var $cal_event;
-       var $today = Array('raw','day','month','year','full','dow','dm','bd');
+       var $today = array('raw','day','month','year','full','dow','dm','bd');
 
        function socalendar_()
        {
@@ -297,7 +297,7 @@
                                
$this->add_attribute('recur_data',$this->stream->f('recur_data'));
 
                                $exception_list = 
$this->stream->f('recur_exception');
-                               $exceptions = Array();
+                               $exceptions = array();
                                if(strpos(' '.$exception_list,','))
                                {
                                        $exceptions = 
explode(',',$exception_list);
@@ -351,7 +351,7 @@
                        {
                                while($this->stream->next_record())
                                {
-                                       $this->event['alarm'][] = Array(
+                                       $this->event['alarm'][] = array(
                                                'id'            => 
intval($this->stream->f('alarm_id')),
                                                'time'  => 
intval($this->stream->f('cal_time')),
                                                'text'  => 
$this->stream->f('cal_text'),
@@ -408,6 +408,7 @@
 //             $user_where .= ','.implode(',',$member);
                $user_where .= ')) ';
 
+
                if($this->debug)
                {
                        echo '<!-- '.$user_where.' -->'."\n";
@@ -482,7 +483,7 @@
                        return 1;
                }
                $this_event = $this->event;
-               $locks = Array(
+               $locks = array(
                        'phpgw_cal',
                        'phpgw_cal_user',
                        'phpgw_cal_repeats',
@@ -539,7 +540,7 @@
                
                $this->stream->query($sql,__LINE__,__FILE__);
 
-               $retval = Array();
+               $retval = array();
                if($this->stream->num_rows() == 0)
                {
                        if($this->debug)
@@ -562,7 +563,7 @@
 
        function save_event(&$event)
        {
-               $locks = Array(
+               $locks = array(
                        'phpgw_cal',
                        'phpgw_cal_user',
                        'phpgw_cal_repeats',
@@ -607,7 +608,7 @@
                                . 
($event['groups']?"groups='".(count($event['groups'])>1?implode(',',$event['groups']):','.$event['groups'][0].',')."',
 ":'')
                                . 'reference='.$event['reference'].' '
                                . 'WHERE cal_id='.$event['id'];
-                               
+               
                $this->stream->query($sql,__LINE__,__FILE__);
                
                $this->stream->query('DELETE FROM phpgw_cal_user WHERE 
cal_id='.$event['id'],__LINE__,__FILE__);
@@ -740,20 +741,14 @@
 
        function set_status($id,$owner,$status)
        {
-               $status_code_short = Array(
-                       REJECTED =>     'R',
+               $status_code_short = array(
+                       REJECTED        => 'R',
                        NO_RESPONSE     => 'U',
-                       TENTATIVE       =>      'T',
-                       ACCEPTED        =>      'A'
+                       TENTATIVE       => 'T',
+                       ACCEPTED        => 'A'
                );
                
                $this->stream->query("UPDATE phpgw_cal_user SET 
cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND 
cal_login=".$owner,__LINE__,__FILE__);
-/* OLD-ALARM
-               if ($status == 'R')
-               {
-                       $this->stream->query('UPDATE phpgw_cal_alarm set 
alarm_enabled=0 where cal_id='.$id.' and cal_owner='.$owner,__LINE__,__FILE__);
-               }
-*/
                return True;
        }
        
Index: calendar/inc/class.uicalendar.inc.php
diff -u calendar/inc/class.uicalendar.inc.php:1.120 
calendar/inc/class.uicalendar.inc.php:1.121
--- calendar/inc/class.uicalendar.inc.php:1.120 Thu Dec  8 12:15:42 2005
+++ calendar/inc/class.uicalendar.inc.php       Fri Dec 16 13:24:44 2005
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.uicalendar.inc.php,v 1.120 2005/12/08 12:15:42 skwashd 
Exp $ */
+       /* $Id: class.uicalendar.inc.php,v 1.121 2005/12/16 13:24:44 skwashd 
Exp $ */
 
        class uicalendar
        {
@@ -32,6 +32,8 @@
                var $theme;
                var $link_tpl;
 
+               var $inserted_tooltip_js = false;
+
                // planner related variables
                var $planner_html;
 
@@ -65,6 +67,8 @@
                                'get_month'     => True,
                                'week'          => True,
                                'get_week'      => True,
+                               'week_new'      => True,
+                               'get_week_new'  => True,
                                'year'          => True,
                                'view'          => True,
                                'edit'          => True,
@@ -109,11 +113,9 @@
 
                        $this->link_tpl = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $this->link_tpl->set_unknowns('remove');
-                       $this->link_tpl->set_file(
-                          Array(
-                                  'link_picture'       => 'link_pict.tpl'
-                          )
-                       );
+                       
+                       $this->link_tpl->set_file('link_picture', 
'link_pict.tpl');
+                       
                        
$this->link_tpl->set_block('link_picture','link_pict','link_pict');
                        
$this->link_tpl->set_block('link_picture','pict','pict');
                        
$this->link_tpl->set_block('link_picture','link_open','link_open');
@@ -124,7 +126,7 @@
                        {
                                // save return-fkt for add, view, ...
                                list(,,$fkt) = 
explode('.',$GLOBALS['phpgw_info']['menuaction']);
-                               if ($fkt == 'day' || $fkt == 'week' || $fkt == 
'month' || $fkt == 'year' || $fkt == 'planner')
+                               if ($fkt == 'day' || $fkt == 'week' || $fkt == 
'week_new' || $fkt == 'month' || $fkt == 'year' || $fkt == 'planner')
                                {
                                        $this->bo->return_to = 
$GLOBALS['phpgw_info']['menuaction'].
                                                
sprintf('&date=%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day);
@@ -134,6 +136,13 @@
                        $this->always_app_header = 
$this->bo->prefs['common']['template_set'] == 'idots';
 
                        print_debug('UI',$this->_debug_sqsof());
+
+                       $this->cat_colors = $this->bo->get_cat_colors();
+
+                       if ( $this->bo->debug )
+                       {
+                               echo "<!-- Cat Colors\n" . 
print_r($this->cat_colors, true) . "\n-->\n";
+                       }
                }
 
                /* Public functions */
@@ -158,7 +167,7 @@
                        }
 
                        $this->bo->store_to_cache(
-                               Array(
+                               array(
                                        'smonth'        => $params['month'],
                                        'sday'  => 1,
                                        'syear' => $params['year']
@@ -187,7 +196,7 @@
                                $mini_cal_tpl = 
CreateObject('phpgwapi.Template',$this->template_dir);
                                $mini_cal_tpl->set_unknowns('remove');
                                $mini_cal_tpl->set_file(
-                                       Array(
+                                       array(
                                                'mini_calendar' => 
'mini_cal.tpl'
                                        )
                                );
@@ -206,7 +215,7 @@
                                $month = 
lang($GLOBALS['phpgw']->common->show_date($date['raw'],'F')).' 
'.$GLOBALS['phpgw']->common->show_date($date['raw'],'Y');
                        }
 
-                       $var = Array(
+                       $var = array(
                                'cal_img_root'          =>      
$GLOBALS['phpgw']->common->image('calendar','mini-calendar-bar'),
                                'bgcolor'                       =>      
$this->theme['bg_color'],
                                'bgcolor1'                      =>      
$this->theme['bg_color'],
@@ -220,24 +229,24 @@
                        switch(strtolower($params['buttons']))
                        {
                                case 'right':
-                                       $var = Array(
+                                       $var = array(
                                                'nextmonth'                     
=>      '<a href="'.$this->page('month','&date='.$month_ahead).'"><img 
src="'.$GLOBALS['phpgw']->common->image('phpgwapi','right').'" border="0"></a>'
                                        );
                                        break;
                                case 'left':
-                                       $var = Array(
+                                       $var = array(
                                                'prevmonth'                     
=>      '<a href="'.$this->page('month','&date='.$month_ago).'"><img 
src="'.$GLOBALS['phpgw']->common->image('phpgwapi','left').'" border="0"></a>'
                                        );                                      
                                        break;
                                case 'both':
-                                       $var = Array(
+                                       $var = array(
                                                'prevmonth'                     
=>      '<a href="'.$this->page('month','&date='.$month_ago).'"><img 
src="'.$GLOBALS['phpgw']->common->image('phpgwapi','left').'" border="0"></a>',
                                                'nextmonth'                     
=>      '<a href="'.$this->page('month','&date='.$month_ahead).'"><img 
src="'.$GLOBALS['phpgw']->common->image('phpgwapi','right').'" border="0"></a>'
                                        );
                                        break;
                                case 'none':
                                default:
-                                       $var = Array(
+                                       $var = array(
                                                'prevmonth'                     
=>      '',
                                                'nextmonth'                     
=>      ''
                                        );
@@ -249,7 +258,7 @@
                        {
                                for($i=0;$i<7;$i++)
                                {
-                                       $var = Array(
+                                       $var = array(
                                                'dayname'       => '<b>' . 
substr(lang($GLOBALS['phpgw']->datetime->days[$i]),0,2) . '</b>',
                                                'day_image'     => ''
                                        );
@@ -285,7 +294,7 @@
                                        {
                                                $day_params['day_image'] = '';
                                        }
-                                       $var[] = Array(
+                                       $var[] = array(
                                                'day_image'     => 
$day_params['day_image'],
                                                'dayname'       => $str
                                        );
@@ -358,7 +367,7 @@
                        if (!$this->bo->printer_friendly || 
($this->bo->printer_friendly && 
@$this->bo->prefs['calendar']['display_minicals']))
                        {
                                $minical_prev = $this->mini_calendar(
-                                       Array(
+                                       array(
                                                'day'   => 1,
                                                'month' => $this->bo->month - 1,
                                                'year'  => $this->bo->year,
@@ -367,7 +376,7 @@
                                );
                                
                                $minical_next = $this->mini_calendar(
-                                       Array(
+                                       array(
                                                'day'   => 1,
                                                'month' => $this->bo->month + 1,
                                                'year'  => $this->bo->year,
@@ -396,7 +405,7 @@
 
                        $this->bo->read_holidays();
 
-                       $var = Array(
+                       $var = array(
                                'printer_friendly'      => $printer,
                                'bg_text'               => 
$this->theme['bg_text'],
                                'small_calendar_prev'   => $minical_prev,
@@ -412,21 +421,27 @@
                        $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $p->set_unknowns('remove');
                        $p->set_file(
-                               Array(
+                               array(
                                        'index_t'       =>      'index.tpl'
                                )
                        );
+                       
+                       $var = $this->insert_tooltip_js($var);
+                       
                        $p->set_var($var);
                        return $p->fp('out','index_t');
                }
 
                function week()
                {
+                       $this->week_type = 'old';
                        echo 
$this->printer_friendly($this->get_week(),lang('Weekview'));
                }
 
                function get_week()
                {
+                       $week_type_name = ($this->week_type == 'new') ? 
'week_new' : 'week';
+                       
                        $this->bo->read_holidays();
 
                        $next = 
$GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day 
+ 7,$this->bo->year);
@@ -435,7 +450,7 @@
                        if (!$this->bo->printer_friendly || 
($this->bo->printer_friendly && 
@$this->bo->prefs['calendar']['display_minicals']))
                        {
                                $minical_this = $this->mini_calendar(
-                                       Array(
+                                       array(
                                                'day'   => $this->bo->day,
                                                'month' => $this->bo->month,
                                                'year'  => $this->bo->year,
@@ -445,7 +460,7 @@
                                        )
                                );
                                $minical_prev = $this->mini_calendar(
-                                       Array(
+                                       array(
                                                'day'   => $this->bo->day,
                                                'month' => $this->bo->month - 1,
                                                'year'  => $this->bo->year,
@@ -455,7 +470,7 @@
                                        )
                                );
                                $minical_next = $this->mini_calendar(
-                                       Array(
+                                       array(
                                                'day'   => $this->bo->day,
                                                'month' => $this->bo->month + 1,
                                                'year'  => $this->bo->year,
@@ -475,9 +490,9 @@
                        if (!$this->bo->printer_friendly)
                        {
                                $printer = '';
-                               $prev_week_link = '<a 
href="'.$this->page('week','&date='.$prev['full']).'">&lt;&lt;</a>';
-                               $next_week_link = '<a 
href="'.$this->page('week','&date='.$next['full']).'">&gt;&gt;</a>';
-                               $print = '<a 
href="'.$this->page('week','&friendly=1&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day))."\"
 TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = 
'".lang('Generate printer-friendly version')."'\">[".lang('Printer 
Friendly').']</a>';
+                               $prev_week_link = '<a 
href="'.$this->page($week_type_name,'&date='.$prev['full']).'">&lt;&lt;</a>';
+                               $next_week_link = '<a 
href="'.$this->page($week_type_name,'&date='.$next['full']).'">&gt;&gt;</a>';
+                               $print = '<a 
href="'.$this->page($week_type_name,'&friendly=1&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day))."\"
 target=\"cal_printer_friendly\">[".lang('Printer Friendly').']</a>';
                        }
                        else
                        {
@@ -488,7 +503,7 @@
                                $GLOBALS['phpgw_info']['flags']['nofooter'] = 
True;
                        }
 
-                       $var = Array(
+                       $var = array(
                                'printer_friendly'      => $printer,
                                'bg_text'               => 
$this->theme['bg_text'],
                                'small_calendar_prev'   => $minical_prev,
@@ -501,7 +516,7 @@
                                                                : 
$this->bo->contacts->get_name_of_person_id($this->bo->owner) ),
                                'small_calendar_next'   => $minical_next,
                                'week_display'          => 
$this->display_weekly(
-                                       Array(
+                                       array(
                                                'date'          => 
sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day),
                                                'showyear'      => true,
                                                'owners'        => 
$this->bo->owner
@@ -512,83 +527,31 @@
 
                        $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $p->set_file(
-                               Array(
-                                       'week_t' => 'week.tpl'
+                               array(
+                                       'week_t' => $week_type_name.'.tpl'
                                )
                        );
+
+                       $var = $this->insert_tooltip_js($var);
+
                        $p->set_var($var);
                        return $p->fp('out','week_t');
+               }
 
-/*
-                       $this->bo->read_holidays();
-                       
-                       if (!$this->bo->printer_friendly || 
($this->bo->printer_friendly && 
@$this->bo->prefs['calendar']['display_minicals']))
-                       {
-                               $minical = $this->mini_calendar(
-                                       Array(
-                                               'day'   => $this->bo->day,
-                                               'month' => $this->bo->month,
-                                               'year'  => $this->bo->year,
-                                               'link'  => 'day'
-                                       )
-                               );
-                       }
-                       else
-                       {
-                               $minical = '';
-                       }
-                       
-                       if (!$this->bo->printer_friendly)
-                       {
-                               
unset($GLOBALS['phpgw_info']['flags']['noheader']);
-                               
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
-                               $GLOBALS['phpgw']->common->phpgw_header();
-                               $printer = '';
-                               $param = 
'&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day).'&friendly=1';
-                               $print = '<a 
href="'.$this->page('day'.$param)."\" TARGET=\"cal_printer_friendly\" 
onMouseOver=\"window.status = '".lang('Generate printer-friendly 
version')."'\">[".lang('Printer Friendly').']</a>';
-                       }
-                       else
+               function week_new()
+               {
+                       $this->week_type = 'new';
+                       echo $this->printer_friendly($this->get_week(), 
lang('Weekview'));
+                       if ( $this->bo->debug )
                        {
-                               $GLOBALS['phpgw_info']['flags']['nofooter'] = 
True;
-                               $printer = '<body 
bgcolor="'.$this->theme['bg_color'].'">';
-                               $print =        '';
+                               echo "\n<!-- Theme:\n" . print_r($this->theme, 
true) . "\n-->\n";
                        }
+               }
 
-                       $now    = $GLOBALS['phpgw']->datetime->makegmttime(0, 
0, 0, $this->bo->month, $this->bo->day, $this->bo->year);
-                       $now['raw'] += $GLOBALS['phpgw']->datetime->tz_offset;
-                       $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);
-
-                       $p = $GLOBALS['phpgw']->template;
-                       $p->set_file(
-                               Array(
-                                       'day_t' => 'day.tpl'
-                               )
-                       );
-                       $p->set_block('day_t','day','day');
-                       $p->set_block('day_t','day_event','day_event');
-
-                       $var = Array(
-                               'printer_friendly'              => $printer,
-                               'bg_text'                       => 
$this->theme['bg_text'],
-                               'daily_events'                  => 
$this->print_day(
-                                       Array(
-                                               'year'  => $this->bo->year,
-                                               'month' => $this->bo->month,
-                                               'day'   => $this->bo->day
-                                       )
-                               ),
-                               'small_calendar'                => $minical,
-                               'date'                          => 
lang(date('F',$m)).' '.sprintf("%02d",$this->bo->day).', '.$this->bo->year,
-                               'username'                      => ( 
$this->bo->is_group
-                                                                       ? 
$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)
-                                                                       : 
$this->bo->contacts->get_name_of_person_id($this->bo->owner) ),
-                               'print'                         => $print
-                       );
-
-                       $p->set_var($var);
-                       $p->parse('day_events','day_event');
-                       $p->pparse('out','day');
-*/
+               function get_week_new()
+               {
+                       $this->week_type = 'new';
+                       return $this->get_week();
                }
 
                function year()
@@ -619,7 +582,7 @@
                                $printer = '';
                        }
 
-                       $var = Array(
+                       $var = array(
                                'print'         => $print,
                                'left_link' => $left_link,
                                'font'          => $this->theme['font'],
@@ -630,7 +593,7 @@
 
                        $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $p->set_file(
-                               Array(
+                               array(
                                        'year_t' => 'year.tpl'
                                )
                        );
@@ -646,7 +609,7 @@
                                        $p->parse('row','month_sep',True);
                                }
                                $p->set_var('mini_month',$this->mini_calendar(
-                                               Array(
+                                               array(
                                                        'day'   => 1,
                                                        'month' => $i,
                                                        'year'  => 
$this->bo->year,
@@ -695,8 +658,8 @@
                                $GLOBALS['phpgw']->common->phpgw_exit(True);
                        }
 
-                       $this->bo->repeating_events = Array();
-                       $this->bo->cached_events = Array();
+                       $this->bo->repeating_events = array();
+                       $this->bo->cached_events = array();
                        $this->bo->repeating_events[0] = $event;
                        $datetime = 
mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - 
$GLOBALS['phpgw']->datetime->tz_offset;
                        $this->bo->check_repeating_events($datetime);
@@ -723,7 +686,7 @@
 
                        $p = $GLOBALS['phpgw']->template;
                        $p->set_file(
-                               Array(
+                               array(
                                        'form_button'   => 
'form_button_script.tpl'
                                )
                        );
@@ -734,7 +697,7 @@
                        {
                                if($event['recur_type'] != MCAL_RECUR_NONE)
                                {
-                                       $var = Array(
+                                       $var = array(
                                                'action_url_button'     => 
$this->page('edit','&cal_id='.$cal_id),
                                                'action_text_button'    => 
lang('Edit Single'),
                                                'action_confirm_button' => '',
@@ -744,7 +707,7 @@
                                        $p->set_var($var);
                                        $button_left .= 
'<td>'.$p->fp('button','form_button').'</td>';
 
-                                       $var = Array(
+                                       $var = array(
                                                'action_url_button'     => 
$this->page('edit','&cal_id='.$cal_id),
                                                'action_text_button'    => 
lang('Edit Series'),
                                                'action_confirm_button' => '',
@@ -755,7 +718,7 @@
                                }
                                else
                                {
-                                       $var = Array(
+                                       $var = array(
                                                'action_url_button'     => 
$this->page('edit','&cal_id='.$cal_id),
                                                'action_text_button'    => 
lang('Edit'),
                                                'action_confirm_button' => '',
@@ -765,7 +728,7 @@
                                        $button_left .= 
'<td>'.$p->fp('button','form_button').'</td>';
                                }
 
-                               $var = Array(
+                               $var = array(
                                        'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'),
                                        'action_text_button'    => lang('Alarm 
Management'),
                                        'action_confirm_button' => '',
@@ -779,7 +742,7 @@
                        {
                                if($event['recur_type'] != MCAL_RECUR_NONE)
                                {
-                                       $var = Array(
+                                       $var = array(
                                                'action_url_button'     => 
$this->page('delete','&cal_id='.$cal_id),
                                                'action_text_button'    => 
lang('Delete Single'),
                                                'action_confirm_button' => 
"onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this 
single occurence ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
@@ -789,7 +752,7 @@
                                        $p->set_var($var);
                                        $button_right .= 
'<td>'.$p->fp('button','form_button').'</td>';
 
-                                       $var = Array(
+                                       $var = array(
                                                'action_url_button'     => 
$this->page('delete','&cal_id='.$cal_id),
                                                'action_text_button'    => 
lang('Delete Series'),
                                                'action_confirm_button' => 
"onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this 
entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
@@ -800,7 +763,7 @@
 
                                        if($event['recur_exception'])
                                        {
-                                               $var = Array(
+                                               $var = array(
                                                        'action_url_button'     
=> $this->page('reinstate_list','&cal_id='.$cal_id),
                                                        'action_text_button'    
=> lang('Reinstate'),
                                                        'action_confirm_button' 
=> '',
@@ -812,7 +775,7 @@
                                }
                                else
                                {
-                                       $var = Array(
+                                       $var = array(
                                                'action_url_button'     => 
$this->page('delete','&cal_id='.$cal_id),
                                                'action_text_button'    => 
lang('Delete'),
                                                'action_confirm_button' => 
"onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this 
entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
@@ -831,7 +794,7 @@
                                {
                                        if 
($GLOBALS['phpgw_info']['user']['account_id'] == $user)
                                        {
-                                               $var = Array(
+                                               $var = array(
                                                        'action_url_button'     
=> $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'),
                                                        'action_text_button'    
=> lang('Alarm Management'),
                                                        'action_confirm_button' 
=> '',
@@ -843,7 +806,7 @@
                                }
                        }
 
-                       $var = Array(
+                       $var = array(
                                'action_url_button'     => 
$this->page('export'),
                                'action_text_button'    => lang('Export'),
                                'action_confirm_button' => '',
@@ -854,7 +817,7 @@
 
                        if ($this->bo->return_to)
                        {
-                               $var = Array(
+                               $var = array(
                                        'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to),
                                        'action_text_button'    => lang('Done'),
                                        'action_confirm_button' => '',
@@ -900,7 +863,7 @@
                        {
                                $can_edit = True;
                                $this->edit_form(
-                                       Array(
+                                       array(
                                                'event' => 
$this->bo->restore_from_appsession(),
                                                'cd' => $params['cd']
                                        )
@@ -929,7 +892,7 @@
                                        $event['recur_exception'] = array();
                                }
                                $this->edit_form(
-                                       Array(
+                                       array(
                                                'event' => $event,
                                                'cd'    => $cd
                                        )
@@ -1009,7 +972,7 @@
 
                        $p = &$GLOBALS['phpgw']->template;
                        $p->set_file(
-                               Array(
+                               array(
                                        'form_button'   => 
'form_button_script.tpl'
                                )
                        );
@@ -1025,7 +988,7 @@
                                'data'  => '<select name="reinstate_index[]" 
multiple size="5">'."\n".$str.'</select>'
                        ));
 
-                       $var = Array(
+                       $var = array(
                                'action_url_button'     => 
$this->page('reinstate','&cal_id='.$cal_id),
                                'action_text_button'    => lang('Reinstate'),
                                'action_confirm_button' => '',
@@ -1034,7 +997,7 @@
                        $p->set_var($var);
                        $button_left = 
'<td>'.$p->fp('out','form_button').'</td>';
 
-                       $var = Array(
+                       $var = array(
                                'action_url_button'     => $this->bo->return_to 
? $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to) : 
$this->page(''),
                                'action_text_button'    => lang('Cancel'),
                                'action_confirm_button' => '',
@@ -1067,7 +1030,7 @@
                                echo '<!-- Calling bo->reinstate -->'."\n";
                        }
                        $cd = $this->bo->reinstate(
-                               Array(
+                               array(
                                        'cal_id'        => $cal_id,
                                        'reinstate_index'       => 
$reinstate_index
                                )
@@ -1134,7 +1097,7 @@
                                $event = $this->bo->get_cached_event();
                        }
                        $this->edit_form(
-                               Array(
+                               array(
                                        'event' => $event,
                                        'cd' => $cd
                                )
@@ -1156,7 +1119,7 @@
                                {
                                        $date = $_POST['date'];
                                        $cd = $this->bo->delete_single(
-                                               Array(
+                                               array(
                                                        'id'    => $cal_id,
                                                        'year'  => 
substr($date,0,4),
                                                        'month' => 
substr($date,4,2),
@@ -1192,7 +1155,8 @@
                        if (!$this->bo->printer_friendly || 
($this->bo->printer_friendly && 
@$this->bo->prefs['calendar']['display_minicals']))
                        {
                                $minical = $this->mini_calendar(
-                                       Array(
+                                       array
+                                       (
                                                'day'   => $this->bo->day,
                                                'month' => $this->bo->month,
                                                'year'  => $this->bo->year,
@@ -1222,35 +1186,46 @@
                        $now['raw'] += $GLOBALS['phpgw']->datetime->tz_offset;
 
                        $p = $GLOBALS['phpgw']->template;
-                       $p->set_file(
-                               Array(
-                                       'day_t' => 'day.tpl'
-                               )
-                       );
+                       $p->set_file('day_t', 'day.tpl');
+
                        $p->set_block('day_t','day','day');
                        $p->set_block('day_t','day_event','day_event');
 
-                       $var = Array(
-                               'printer_friendly'      => $printer,
-                               'bg_text'                       => 
$this->theme['bg_text'],
-                               'daily_events'          => $this->print_day(
-                                       Array(
-                                               'year'  => $this->bo->year,
-                                               'month' => $this->bo->month,
-                                               'day'   => $this->bo->day
-                                       )
-                               ),
-                               'small_calendar'        => $minical,
-                               'date'                  => 
$this->bo->long_date($now),
-                               'username'              => ( $this->bo->is_group
-                                                               ? 
$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)
-                                                               : 
$this->bo->contacts->get_name_of_person_id($this->bo->owner) ),
-                               'print'                 => $print
-                       );
-
+                       $var = array
+                               (
+                                       'printer_friendly'      => $printer,
+                                       'bg_text'               => 
$this->theme['bg_text'],
+                                       'daily_events'          => 
$this->print_day(
+                                                                       array
+                                                                       (
+                                                                               
'year'  => $this->bo->year,
+                                                                               
'month' => $this->bo->month,
+                                                                               
'day'   => $this->bo->day
+                                                                       )),
+                                       'small_calendar'        => $minical,
+                                       'date'                  => 
$this->bo->long_date($now),
+                                       'username'              => ( 
$this->bo->is_group ? 
$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner) : 
$this->bo->contacts->get_name_of_person_id($this->bo->owner) ),
+                                       'print'                 => $print
+                               );
+                       
+                       if ( $this->bo->debug )
+                       {
+                               echo "\n<!-- Daily Events\n" . 
print_r($var['daily_events'], true) . "\n-->\n";
+                       }
+                       
+                       $var = $this->insert_tooltip_js($var);
+                       
                        $p->set_var($var);
-                       $p->parse('day_events','day_event');
-                       echo 
$this->printer_friendly($p->fp('out','day'),lang('Dayview'));
+
+                       if ($this->week_type != 'new')
+                       {
+                               $p->parse('day_events','day_event');
+                               echo 
$this->printer_friendly($p->fp('out','day'),lang('Dayview'));
+                       }
+                       elseif ($this->week_type == 'new')
+                       {
+                               return $var['daily_events'];
+                       }
                }
 
                function edit_status()
@@ -1280,7 +1255,7 @@
 
                        $freetime = 
$GLOBALS['phpgw']->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year'])
 - $GLOBALS['phpgw']->datetime->tz_offset);
                        echo $this->timematrix(
-                               Array(
+                               array(
                                        'date'          => $freetime,
                                        'starttime'     => 
$this->bo->splittime('000000',False),
                                        'endtime'       => 0,
@@ -1684,7 +1659,7 @@
                                $cel = '';
                        }
 
-                       if ($event['priority'] == 3)
+                       if ($event['priority'] >= 3)
                        {
                                $cel .= 
$this->planner_html->image('calendar','mini-calendar-bar.gif','','border="0"');
                        }
@@ -1869,7 +1844,7 @@
                        // generate duplicate free list of events within 
observed interval
                        //
                        $this->bo->store_to_cache(
-                               Array(
+                               array(
                                        'syear' => $this->bo->year,
                                        'smonth'        => $this->bo->month,
                                        'sday'  => 1,
@@ -1920,7 +1895,7 @@
 
                        $p = &$GLOBALS['phpgw']->template;
                        $p->set_file(
-                               Array(
+                               array(
                                        'mq'            => 'matrix_query.tpl',
                                        'form_button'   => 
'form_button_script.tpl'
                                )
@@ -1942,7 +1917,7 @@
                                );
 
 // View type
-                       $var[] = Array(
+                       $var[] = array(
                                'field' =>      lang('View'),
                                'data'  =>      '<select 
name="matrixtype">'."\n"
                                        . '<option value="free/busy" 
selected>'.lang('free/busy').'</option>'."\n"
@@ -2027,7 +2002,7 @@
                                
$this->output_template_array($p,'rows','list',$var[$i]);
                        }
 
-                       $vars = Array(
+                       $vars = array(
                                'submit_button'         => lang('View'),
                                'action_url_button'     => $this->bo->return_to 
? $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to) : 
$this->page(''),
                                'action_text_button'    => lang('Cancel'),
@@ -2047,7 +2022,7 @@
                                $this->index();
                        }
                        $participants = $_POST['participants'];
-                       $parts = Array();
+                       $parts = array();
                        $acct = 
CreateObject('phpgwapi.accounts',$this->bo->owner);
                        
                        if (is_array($participants))
@@ -2096,7 +2071,8 @@
                        {
                                case 'free/busy':
                                        echo '<br />'.$this->timematrix(
-                                               Array(
+                                               array
+                                               (
                                                        'date'          => 
$GLOBALS['phpgw']->datetime->gmtdate($date_selected['raw']),
                                                        'starttime'     => 
$this->bo->splittime('000000',False),
                                                        'endtime'       => 0,
@@ -2105,30 +2081,90 @@
                                        );
                                        break;
                                case 'weekly':
-                                       echo '<br />'.$this->display_weekly(
-                                               Array(
-                                                       'date'          => 
date('Ymd', $GLOBALS['phpgw']->datetime->gmtdate($date_selected['raw'])),
-                                                       'showyear'      => true,
-                                                       'owners'        => 
$participants
-                                               )
+                                       echo "<br />\n<span style=\"font-size: 
larger; 
color:#000000;\"><strong>".$this->bo->get_week_label()."</strong></span><br 
/>\n"
+                                               . $this->display_weekly(
+                                                       array
+                                                       (
+                                                               'date'          
=> date('Ymd', $GLOBALS['phpgw']->datetime->gmtdate($date_selected['raw'])),
+                                                               'showyear'      
=> true,
+                                                               'owners'        
=> $participants
+                                                       )
                                        );
+
+                                       $prev_next_shift = 7;
+
                                        break;
                        }
+
+                       $next_day = 
$GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day 
+ $prev_next_shift,$this->bo->year);
+                       $prev_day = 
$GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day 
- $prev_next_shift,$this->bo->year);
+ 
+                       #echo '<br>prev: '.var_dump($prev_day);
+                       #echo '<br>next: '.var_dump($next_day);
+ 
+                       echo ' <table cellpadding="5" border="0" 
width="100%"><tr><td>'."\n";
+                       
+                       // Prev
+                       echo "\n<br />\n".'<form 
action="'.$this->page('viewmatrix').'" method="post" name="matrixform">'."\n";
+                       echo '  <input type="hidden" name="year" 
value="'.$prev_day['year'].'">'."\n";
+                       echo '  <input type="hidden" name="month" 
value="'.$prev_day['month'].'">'."\n";
+                       echo '  <input type="hidden" name="day" 
value="'.$prev_day['day'].'">'."\n";
+                       echo '  <input type="hidden" name="matrixtype" 
value="'.$_POST['matrixtype'].'">'."\n";
+                       foreach($participants as $part)
+                       {
+                               echo '  <input type="hidden" 
name="participants[]" value="'.$part.'">'."\n";
+                       }
+                       echo '  <input type="submit" name="prev" 
value="&lt;&lt;">'."\n";
+                       echo ' </td>'."\n";
+                       echo '</form>'."\n";
+
+                       $part_inputs = '';
+                       foreach ( $participants as $part )
+                       {
+                               $part_inputs = "\t<input type=\"hidden\" 
name=\"participants[]\" value=\"{$part}\" />\n";
+                       }
+
+                       // Next
+                       echo ' <td align="right">'."\n";
+                       echo "\n<br />\n".'<form 
action="'.$this->page('viewmatrix').'" method="post" name="matrixform">'."\n";
+                       echo '  <input type="hidden" name="year" 
value="'.$next_day['year'].'">'."\n";
+                       echo '  <input type="hidden" name="month" 
value="'.$next_day['month'].'">'."\n";
+                       echo '  <input type="hidden" name="day" 
value="'.$next_day['day'].'">'."\n";
+                       echo '  <input type="hidden" name="matrixtype" 
value="'.$_POST['matrixtype'].'">'."\n";
+                       echo $part_inputs;
+                       echo '  <input type="submit" name="prev" 
value="&gt;&gt;">'."\n";
+                       echo ' </td>'."\n";
+                       echo '</form>'."\n";
+
+                       echo ' </td></tr></table>'."\n";
+                       echo ' <table cellpadding="5" border="0"><tr><td 
valign="bottom">'."\n";
                        echo "\n<br />\n".'<form 
action="'.$this->page('viewmatrix').'" method="post" name="matrixform">'."\n";
-                       echo ' <table cellpadding="5"><tr><td>'."\n";
                        echo '  <input type="hidden" name="year" 
value="'.$this->bo->year.'">'."\n";
                        echo '  <input type="hidden" name="month" 
value="'.$this->bo->month.'">'."\n";
                        echo '  <input type="hidden" name="day" 
value="'.$this->bo->day.'">'."\n";
                        echo '  <input type="hidden" name="matrixtype" 
value="'.$_POST['matrixtype'].'">'."\n";
-                       foreach($participants as $part)
-                       {
-                               echo '  <input type="hidden" 
name="participants[]" value="'.$part.'">'."\n";
-                       }
+                       echo $part_inputs;
                        echo '  <input type="submit" name="refresh" 
value="'.lang('Refresh').'">'."\n";
-                       echo ' </td><td>'."\n";
+                       echo ' </td><td valign="bottom">'."\n";
                        echo '  <input type="submit" name="cancel" 
value="'.lang('Cancel').'">'."\n";
-                       echo ' </td></tr></table>'."\n";
                        echo '</form>'."\n";
+                       echo ' </td>'."\n";
+
+                       $other_type = ($_POST['matrixtype'] == 'weekly') ? 
'free/busy' : 'weekly';
+
+                       echo ' <td> &nbsp; </td>'."\n";
+                       echo ' <td align="right" valign="bottom">'."\n";
+                       echo "\n<br />\n".'<form 
action="'.$this->page('viewmatrix').'" method="post" name="matrixform">'."\n";
+                       echo '  <input type="hidden" name="year" 
value="'.$this->bo->year.'">'."\n";
+                       echo '  <input type="hidden" name="month" 
value="'.$this->bo->month.'">'."\n";
+                       echo '  <input type="hidden" name="day" 
value="'.$this->bo->day.'">'."\n";
+                       echo '  <input type="hidden" name="matrixtype" 
value="'.$other_type.'">'."\n";
+                       echo $part_inputs;
+                       echo lang('change view to').':  <input type="submit" 
name="change_view" value="'.lang($other_type).'">'."\n";
+                       echo '</form>'."\n";
+                       echo ' </td>'."\n";
+
+                       echo ' </td></tr></table>'."\n";
                }
 
                function search()
@@ -2196,7 +2232,7 @@
 
                        $p = $GLOBALS['phpgw']->template;
                        $p->set_file(
-                               Array(
+                               array(
                                        'search_form'   => 'search.tpl'
                                )
                        );
@@ -2205,7 +2241,7 @@
                        
$p->set_block('search_form','search_list','search_list');
                        
$p->set_block('search_form','search_list_footer','search_list_footer');
 
-                       $var = Array(
+                       $var = array(
                                'th_bg'         => $this->theme['th_bg'],
                                'search_text'   => lang('Search Results'),
                                'quantity'      => $quantity
@@ -2271,7 +2307,7 @@
                                {
                                        $_page = 'planner';
                                }
-                               elseif ($_page=='index' || ($_page != 'day' && 
$_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 
'planner'))
+                               elseif ($_page=='index' || ($_page != 'day' && 
$_page != 'week' && $_page != 'week_new' && $_page != 'month' && $_page != 
'year' && $_page != 'planner'))
                                {
                                        $_page = 'month';
                                        
$GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar','month');
@@ -2331,7 +2367,7 @@
                        $p = $GLOBALS['phpgw']->template;
        
                        $p->set_file(
-                               Array(
+                               array(
                                        'footer'        => 'footer.tpl',
                                        'form_button'   => 
'form_button_script.tpl'
                                )
@@ -2360,7 +2396,7 @@
                                $str .= '<option value="'.$d_ymd.'"'.($d_ymd == 
$thisdate?' selected':'').'>'.lang(date('F', $d)).strftime(' %Y', 
$d).'</option>'."\n";
                        }
 
-                       $var = Array(
+                       $var = array(
                                'action_url'    => $this->page($method,''),
                                'form_name'     => 'SelectMonth',
                                'label'         => lang('Month'),
@@ -2388,7 +2424,7 @@
                                           . 
$GLOBALS['phpgw']->common->show_date($end,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                }
 
-                               $var = Array(
+                               $var = array(
                                        'action_url'    => 
$this->page($method,''),
                                        'form_name'     => 'SelectWeek',
                                        'label'         => lang('Week'),
@@ -2407,7 +2443,7 @@
                                $str .= '<option value="'.$i.'"'.($i == 
$this->bo->year?' selected':'').'>'.$i.'</option>'."\n";
                        }
 
-                       $var = Array(
+                       $var = array(
                                'action_url'    => $this->page($method,''),
                                'form_name'     => 'SelectYear',
                                'label'         => lang('Year'),
@@ -2436,7 +2472,7 @@
                                        $str .= '<option value="'.$i.'"'.($i == 
$this->bo->num_months?' selected':'').'>'.$i.'</option>'."\n";
                                }
 
-                               $var = Array(
+                               $var = array(
                                        'action_url'    => 
$this->page($method,''),
                                        'form_name'     => 
'SelectNumberOfMonths',
                                        'label'         => lang('Number of 
Months'),
@@ -2450,7 +2486,7 @@
                                
$this->output_template_array($p,'table_row','footer_row',$var);
                        }
 
-                       $var = Array(
+                       $var = array(
                                'submit_button'         => lang('Submit'),
                                'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiicalendar.import'),
                                'action_text_button'    => lang('Import'),
@@ -2475,6 +2511,22 @@
                        {
                           $time_width = 
(intval($this->bo->prefs['common']['time_format']) == 12?10:7);
                        }
+                       
+                       switch ($this->bo->prefs['calendar']['interval']) //in 
minutes
+                       {
+                               case 5:
+                               case 10:
+                               case 15:
+                                       $time_height = '20px';
+                                       break;
+                               case 45:
+                               case 60:
+                                       $time_height = '37px';
+                                       break;
+                               default:
+                                       $time_height = '27px';
+                                       break;
+                       }
 
                        return 'A.minicalendar { color: #000000; font: xx-small 
'.$this->theme['font'].' }'."\n"
                                . '  A.bminicalendar { color: #336699; font: 
italic bold xx-small '.$this->theme['font'].' }'."\n"
@@ -2487,7 +2539,7 @@
                                . '  .event-on { background-color: 
'.$this->theme['row_on'].'; color: '.$this->theme['bg_text'].'; font: 100 
80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
                                . '  .event-off { background-color: 
'.$this->theme['row_off'].'; color: '.$this->theme['bg_text'].'; font: 100 
80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
                                . '  .event-holiday { background-color: 
'.$this->theme['bg04'].'; color: '.$this->theme['bg_text'].'; font: 100 
80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
-                               . '  .time { background-color: 
'.$this->theme['navbar_bg'].'; color: '.$this->theme['bg_text'].'; font: 
80%/110% '.$this->theme['font'].'; width: '.$time_width.'%; border: 1px 
'.$this->theme['navbar_text'].'; vertical-align: middle }'."\n"
+                               . '  .time { background-color: 
'.$this->theme['th_bg'].'; color: '.$this->theme['bg_text'].'; font: 80%/110% 
'.$this->theme['font'].'; width: '.$time_width.'%; height: '.$time_height.';  
border: 1px outset '.$this->theme['navbar_text'].'; vertical-align: top;}'."\n"
                                . '  .tablecell { width: 80px; height: 80px 
}'."\n"
                                . '  .planner-cell { cursor:pointer; 
cursor:hand; border: thin solid black; }';
                }
@@ -2555,28 +2607,104 @@
                        if(!$is_private)
                        {
                                $text .= 
$this->bo->display_status($event['users_status']);
+                               $status_long = 
$this->bo->get_long_status($event['users_status']);
+                       }
+
+                       $status = $text;
+
+                       $tmp_cats = explode(',',$event['category']);
+                       $tmp_cat  = $tmp_cats[0];
+                       $cat_color = isset($this->cat_colors[$tmp_cat]) ? 
$this->cat_colors[$tmp_cat] : 'transparent';
+                       $cat_color_div_start = '<div style="border-left:3px 
solid '.$cat_color.';padding:3px;">';
+                       $cat_color_div_end = '</div>';
+
+                       switch 
($this->bo->prefs['calendar']['show_descrpt_ovr'])
+                       {
+                               case '0':
+                                       $text = '<span style="font-size: 
x-small; font-family:'.$this->theme['font'].'">' . $str_participants
+                                               . '<span style="white-space: 
nowrap;">'.$time.' </span> '
+                                               . 
wordwrap($this->bo->get_short_field($event,$is_private,'title'), 30, 
$GLOBALS['phpgw']->browser->br, True)
+                                               . $text
+                                               . 
$GLOBALS['phpgw']->browser->br;
+                                       break;
+
+                               default:
+                                       $text = '<span style="font-size: 
x-small; font-family:'.$this->theme['font'].'">' . $str_participants 
+                                               . '<span style="white-space: 
nowrap;">'.$time.' </span> '
+                                               . 
wordwrap($this->bo->get_short_field($event,$is_private,'title'), 30, 
$GLOBALS['phpgw']->browser->br, True)
+                                               . $text.': <em>'
+                                               . 
wordwrap($this->bo->get_short_field($event,$is_private,'description'), 30,  
$GLOBALS['phpgw']->browser->br, True)
+                                               . '</em></span>'
+                                               . 
$GLOBALS['phpgw']->browser->br;
+                                       break;
+                       }
+
+                       switch 
($this->bo->prefs['calendar']['show_descrpt_title'])
+                       {
+                               case '0':
+                                       break;
+
+                               case '23':
+                                       $participants = '';
+                                       if ( is_array($event['participants'])  
&& count($event['participants'])>0 )
+                                       {
+                                               foreach($event['participants'] 
as $user => $short_status)
+                                               {
+                                                       
if($GLOBALS['phpgw']->accounts->exists($user))
+                                                       {
+                                                               $participants 
.= $this->bo->contacts->get_name_of_person_id($user).' 
('.$this->bo->get_long_status($short_status).')<br>';
+                                                       }
+                                               }
+                                       }
+                                       
+                                       $text = "<span 
onmouseover=\"this.T_TITLE='{$time}';"
+                                               . 
"this.T_BGCOLOR='{$this->theme['bg02']}';"
+                                               . 
"this.T_BORDERCOLOR='{$this->theme['navbar_bg']}';"
+                                               . 
"this.T_TITLECOLOR='{$this->theme['table_text']}';"
+                                               . "return escape('"
+                                               . addslashes("<span 
style='font-size: x-small; font-family: {$this->theme['font']};'>"
+                                                       . 
$this->my_nl2br($this->bo->get_short_field($event,$is_private,'title'))
+                                                       . " ($status_long):<br 
/><em>"
+                                                       . 
$this->my_nl2br($this->bo->get_short_field($event,$is_private,'description'))
+                                                       . '</em>'
+                                                       . 
$GLOBALS['phpgw']->browser->br
+                                                       . '<hr 
color='.$this->theme['navbar_bg'].'> '.lang('Participants').': <br><i>'
+                                                       . $participants
+                                                       .'</em></span>')
+                                               . "');\">"
+                                               . $text . '</span>';
+                                       break;
+
+                               case '1':
+                               default:
+                                       $text = '<span title="'.$time.' '
+                                               . 
$this->bo->get_short_field($event,$is_private,'title')
+                                               . $status.': '
+                                               . 
$this->bo->get_short_field($event,$is_private,'description')
+                                               . "\">{$text}</span>\n";
+                               break;
                        }
 
-                       $text = '<font size="-2" 
face="'.$this->theme['font'].'"><nobr>&nbsp;'.$time.'&nbsp;</nobr> '
-                               . 
wordwrap($this->bo->get_short_field($event,$is_private,'title'), 30, 
$GLOBALS['phpgw']->browser->br, True)
-                               . $text.': <I>'
-                               . 
wordwrap($this->bo->get_short_field($event,$is_private,'description'), 30,  
$GLOBALS['phpgw']->browser->br, True)
-                               . '</I></font>'
-                               . $GLOBALS['phpgw']->browser->br;
-                               
-                       
                        //$text = '<font size="-2" 
face="'.$this->theme['font'].'"><nobr>&nbsp;'.$time.'&nbsp;</nobr> 
'.$this->bo->get_short_field($event,$is_private,'title').$text.': 
<I>'.$this->bo->get_short_field($event,$is_private,'description').'</I></font>'.$GLOBALS['phpgw']->browser->br;
 
+                       if ($cat_color)
+                       {
+                               $var = array(
+                                       'cat_color_div_start' => 
$cat_color_div_start
+                               );
+                               
$this->output_template_array($this->link_tpl,'picture','cat_color_div_start',$var);
+                       }
+
                        if ($editable)
                        {
                                $date = 
sprintf('%04d%02d%02d',$year,$month,$day);
                                
$this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date));
-                               $this->link_tpl->set_var('lang_view',lang('View 
this entry'));
+                               
#$this->link_tpl->set_var('lang_view',lang('View this entry'));
                                
$this->link_tpl->parse('picture','link_open',True);
 
-                               if($event['priority'] == 3)
+                               if ($event['priority'] >= 3)
                                {
-                                       $picture[] = Array(
+                                       $picture[] = array(
                                                'pict'  => 
$GLOBALS['phpgw']->common->image('calendar','high'),
                                                'width' => 8,
                                                'height'=> 17,
@@ -2586,7 +2714,7 @@
                                }
                                if($event['recur_type'] == MCAL_RECUR_NONE)
                                {
-                                       $picture[] = Array(
+                                       $picture[] = array(
                                                'pict'  => 
$GLOBALS['phpgw']->common->image('calendar','circle'),
                                                'width' => 5,
                                                'height'=> 7,
@@ -2596,7 +2724,7 @@
                                }
                                else
                                {
-                                       $picture[] = Array(
+                                       $picture[] = array(
                                                'pict'  => 
$GLOBALS['phpgw']->common->image('calendar','recur'),
                                                'width' => 12,
                                                'height'=> 12,
@@ -2608,27 +2736,27 @@
                                $participants = 
$this->planner_participants($event['participants']);
                                if(count($event['participants']) > 1)
                                {
-                                       $picture[] = Array(
+                                       $picture[] = array(
                                                'pict'  => 
$GLOBALS['phpgw']->common->image('calendar','multi_3'),
                                                'width' => 14,
                                                'height'=> 14,
-                                               'alt' => $participants,
-                                               'title' => $participants
+                                               'alt'   => $participants,
+                                               'title' => $participants,
                                        );
                                }
                                else
                                {
-                                       $picture[] = Array(
+                                       $picture[] = array(
                                                'pict'  =>  
$GLOBALS['phpgw']->common->image('calendar','single'),
                                                'width' => 14,
                                                'height'=> 14,
                                                'alt' => $participants,
-                                               'title' => $participants
+                                               'title' => $participants,
                                        );
                                }
                                if($event['public'] == 0)
                                {
-                                       $picture[] = Array(
+                                       $picture[] = array(
                                                'pict'  => 
$GLOBALS['phpgw']->common->image('calendar','private'),
                                                'width' => 13,
                                                'height'=> 13,
@@ -2640,10 +2768,9 @@
                                {
                                        // if the alarm is to go off the day 
before the event
                                        // the icon does not show up because of 
'alarm_today'
-                                       // - TOM
                                        
if($this->bo->alarm_today($event,$rawdate_offset,$starttime))
                                        {
-                                               $picture[] = Array(
+                                               $picture[] = array(
                                                        'pict'  => 
$GLOBALS['phpgw']->common->image('calendar','alarm'),
                                                        'width' => 13,
                                                        'height'=> 13,
@@ -2656,28 +2783,39 @@
                                $description = 
$this->bo->get_short_field($event,$is_private,'description');
                                for($i=0;$i<count($picture);$i++)
                                {
-                                       $var = Array(
+                                       $var = array(
                                                'pic_image'  => 
$picture[$i]['pict'],
                                                'width'      => 
$picture[$i]['width'],
                                                'height'     => 
$picture[$i]['height'],
                                                'alt'        => 
$picture[$i]['alt'],
-                                               'title'      => 
$picture[$i]['title']
+                                               'title'      => 
$picture[$i]['title'],
                                        );
                                        
$this->output_template_array($this->link_tpl,'picture','pict',$var);
                                }
                        }
                        if ($text)
                        {
-                               $var = Array(
+                               $var = array(
                                        'text' => $text
                                );
                                
$this->output_template_array($this->link_tpl,'picture','link_text',$var);
                        }
 
+
+
                        if ($editable)
                        {
                                
$this->link_tpl->parse('picture','link_close',True);
                        }
+## by tb -> cat_color_div_end is for end of cat-colors
+                       if ($cat_color)
+                       {
+                               $var = array(
+                                       'cat_color_div_end' => 
$cat_color_div_end
+                               );
+                               
$this->output_template_array($this->link_tpl,'picture','cat_color_div_end',$var);
+                       }
+## END - by tb
                        $str = $this->link_tpl->fp('out','link_pict');
                        $this->link_tpl->set_var('picture','');                 
                        $this->link_tpl->set_var('out','');
@@ -2729,13 +2867,13 @@
 
                        $p = $GLOBALS['phpgw']->template;
                        $p->set_file(
-                               Array(
+                               array(
                                        'overlap'       => 'overlap.tpl',
                                        'form_button'   => 
'form_button_script.tpl'
                                )
                        );
 
-                       $var = Array(
+                       $var = array(
                                'color'         => $this->theme['bg_text'],
                                'overlap_title' => lang('Scheduling Conflict'),
                                'overlap_text'  => lang('Your suggested time of 
<B> %1 - %2 </B> conflicts with the following existing calendar 
entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)),
@@ -2744,16 +2882,16 @@
                        $p->set_var($var);
 
                        $date = 
sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday);
-                       $var = Array(
-                               'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update','readsess'=>1)),
+                       $var = array(
+                               'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'calendar.bocalendar.update','readsess'=>1)),
                                'action_text_button'    => lang('Ignore 
Conflict'),
                                'action_confirm_button' => '',
                                'action_extra_field'    => ''
                        );
                        
$this->output_template_array($p,'resubmit_button','form_button',$var);
 
-                       $var = Array(
-                               'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.edit','readsess'=>1,'date'=>$date)),
+                       $var = array(
+                               'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'calendar.uicalendar.edit','readsess'=>1,'date'=>$date)),
                                'action_text_button'    => lang('Re-Edit 
Event'),
                                'action_confirm_button' => '',
                                'action_extra_field'    => ''
@@ -2811,7 +2949,7 @@
                                }
                        }
                        @reset($id_array);
-                       $ret_val = Array();
+                       $ret_val = array();
                        while(list($index,$id) = each($id_array))
                        {
                                if (!isset($cats[$id]))
@@ -2832,20 +2970,20 @@
                        $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $p->set_unknowns('remove');
                        $p->set_file(
-                               Array (
+                               array (
                                        'month_header' => 'month_header.tpl'
                                )
                        );
                        
$p->set_block('month_header','monthly_header','monthly_header');
                        
$p->set_block('month_header','column_title','column_title');
 
-                       $var = Array(
+                       $var = array(
                                'bgcolor'       => $this->theme['th_bg'],
                                'font_color'    => $this->theme['th_text']
                        );
                        if($this->bo->printer_friendly && 
@$this->bo->prefs['calendar']['print_black_white'])
                        {
-                               $var = Array(
+                               $var = array(
                                        'bgcolor'       => '',
                                        'font_color'    => ''
                                );
@@ -2868,6 +3006,14 @@
                        return $p->fp('out','monthly_header');
                }
 
+## by tb
+               function 
display_week_new($startdate,$weekly,$cellcolor,$display_name = 
False,$owner=0,$monthstart=0,$monthend=0)
+               {
+                       $this->week_type = 'new';
+                       return 
$this->display_week($startdate,$weekly,$cellcolor,$display_name,$owner,$monthstart,$monthend);
+               }
+## by tb
+
                function 
display_week($startdate,$weekly,$cellcolor,$display_name = 
False,$owner=0,$monthstart=0,$monthend=0)
                {
                        if($owner == 0)
@@ -2882,7 +3028,7 @@
                        $p->set_unknowns('keep');
                
                        $p->set_file(
-                               Array(
+                               array(
                                        'month_header'  => 'month_header.tpl',
                                        'month_day'     => 'month_day.tpl'
                                )
@@ -2908,17 +3054,18 @@
                                $year = intval(substr($date,0,4));
                                $month = intval(substr($date,4,2));
                                $day = intval(substr($date,6,2));
-                               $var = Array(
+                               $var = array(
                                        'column_data'   => '',
                                        'extra'         => ''
                                );
                                $p->set_var($var);
                                if ($weekly || ($date >= $monthstart && $date 
<= $monthend))
                                {
+
                                        if ($day_params['new_event'])
                                        {
                                                $new_event_link = ' <a 
href="'.$this->page('add','&date='.$date).'">'
-                                                       . '<img 
src="'.$GLOBALS['phpgw']->common->image('calendar','new').'" width="10" 
height="10" alt="'.lang('New Entry').'" border="0" align="center">'
+                                                       . '<img 
src="'.$GLOBALS['phpgw']->common->image('calendar','new').'" width="10" 
height="10" alt="'.lang('New Entry').'" title="'.lang('New Entry').'" 
border="0" align="center">'
                                                        . '</a>';
                                                $day_number = '<a 
href="'.$this->page('day','&date='.$date).'">'.$day.'</a>';
                                        }
@@ -2928,15 +3075,18 @@
                                                $day_number = $day;
                                        }
 
-                                       $var = Array(
+                                       $var = array(
                                                'extra'         => 
$day_params['extra'],
                                                'new_event_link'=> 
$new_event_link,
                                                'day_number'    => $day_number
                                        );
                                        if($day_params['week'])
                                        {
-                                               $var['new_event_link'] .= 
'<font size="-2"> &nbsp; '.
-                                                       
(!$this->bo->printer_friendly?'<a 
href="'.$this->page('week','&date='.$date).'">' 
.$day_params['week'].'</a>':$day_params['week']);
+## by tb: string is too long for week_new
+                                               $tmp_str = ($this->week_type == 
'new') ? '&nbsp;' : '&nbsp; ';
+                                               $var['new_event_link'] .= 
'<font size="-2">'. $tmp_str .
+                                                       
(!$this->bo->printer_friendly?'<a 
href="'.$this->page('week_new','&date='.$date).'">' 
.$day_params['week'].'</a>':$day_params['week']);
+## END - by tb
                                        }
 
                                        $p->set_var($var);
@@ -2945,24 +3095,30 @@
                                        {
                                                foreach($day_params['holidays'] 
as $key => $value)
                                                {
-                                                       $var = Array(
+                                                       $var = array(
                                                                'day_events' => 
'<font face="'.$this->theme['font'].'" 
size="-1">'.$value.'</font>'.$GLOBALS['phpgw']->browser->br
                                                        );
                                                        
$this->output_template_array($p,'daily_events','event',$var);
                                                }
                                        }
 
-                                       if($day_params['appts'])
+                                       if($day_params['appts'] || 
$this->week_type == 'new')
                                        {
-                                               $var = Array(
+                                               $var = array(
                                                        'week_day_font_size'    
=> '2',
                                                        'events'                
=> ''
                                                );
                                                $p->set_var($var);
                                                $events = 
$this->bo->cached_events[$date];
+## by tb
+                                               if ($this->week_type != 'new')
+                                               {
                                                foreach($events as $event)
                                                {
-                                                       if 
($this->bo->rejected_no_show($event))
+## by tb:      we don't want a user to be able to see a event if he has no 
permission to read it !!!
+##                             this shoud be in 
class.bocalendar->get_cached_events() !!!
+                                                               if 
($this->bo->rejected_no_show($event) || !$this->bo->check_perms(PHPGW_ACL_READ))
+## by tb
                                                        {
                                                                continue;       
// user does not want to see rejected events
                                                        }
@@ -2971,13 +3127,29 @@
                                                        
$p->set_var('day_events','');
                                                }
                                        }
+                                               elseif ($this->week_type == 
'new')
+                                               {
+                                                       $day_to_display =       
array(
+                                                               'year'  => 
$year,
+                                                               'month' => 
$month,
+                                                               'day'   => $day
+                                                               );
+                                                       
$p->set_var('day_events',$this->print_day($day_to_display));
+                                                       
$p->parse('events','event',True);
+                                                       
$p->set_var('day_events','');
+
+                                               }
+## END - by tb
+                                       }
+
                                        
$p->parse('daily_events','day_event',True);
                                        
$p->parse('column_data','month_daily',True);
                                        $p->set_var('daily_events','');
                                        $p->set_var('events','');
+
 /*                                     if($day_params['week'])
                                        {
-                                               $var = Array(
+                                               $var = array(
                                                        'week_day_font_size'    
=> '-2',
                                                        'events'                
=> (!$this->bo->printer_friendly?'<a 
href="'.$this->page('week','&date='.$date).'">' 
.$day_params['week'].'</a>':$day_params['week'])
                                                );
@@ -3000,7 +3172,7 @@
                        }
 
                        $this->bo->store_to_cache(
-                               Array(
+                               array(
                                        'syear' => $year,
                                        'smonth'=> $month,
                                        'sday'  => 1
@@ -3022,7 +3194,7 @@
                        $p->set_unknowns('keep');
                
                        $p->set_file(
-                               Array(
+                               array(
                                        'week'  =>      'month_day.tpl'
                                )
                        );
@@ -3030,7 +3202,7 @@
                        $p->set_block('week','event','event');
 
 
-                       $var = Array(
+                       $var = array(
                                'cols'      => 7,
                                'day_events'=> 
$this->week_header($month,$year,False)
                        );
@@ -3041,7 +3213,7 @@
                        for ($i=intval($start + 
$GLOBALS['phpgw']->datetime->tz_offset);intval(date('Ymd',$i)) <= $monthend;$i 
+= 604800)
                        {
                                $cellcolor = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($cellcolor);
-                               $var = Array(
+                               $var = array(
                                        'day_events' => 
$this->display_week($i,False,$cellcolor,False,$owner,$monthstart,$monthend)
                                );
                                
$this->output_template_array($p,'row','event',$var);
@@ -3066,7 +3238,7 @@
                        $p->set_unknowns('keep');
 
                        $p->set_file(
-                               Array(
+                               array(
                                        'week'  => 'month_day.tpl'
                                )
                        );
@@ -3093,7 +3265,8 @@
                                $owners_array[0] = $owners;
                                $cols = 7;
                        }
-                       $var = Array(
+
+                       $var = array(
                           'cols'         => $cols,
                           'day_events'   => 
$this->week_header($month,$year,$display_name)
                        );
@@ -3107,7 +3280,7 @@
                                $this->bo->so->owner = $owners_array[$i];
                                $this->bo->so->open_box($owners_array[$i]);
                                $this->bo->store_to_cache(
-                                       Array(
+                                       array(
                                                'syear'  => date('Y',$tstart),
                                                'smonth' => date('m',$tstart),
                                                'sday'   => date('d',$tstart),
@@ -3134,7 +3307,7 @@
                        $p = &$GLOBALS['phpgw']->template;
 
                        $p->set_file(
-                               Array(
+                               array(
                                        'view'  => 'view.tpl'
                                )
                        );
@@ -3172,7 +3345,7 @@
                                foreach($event['alarm'] as $key => $alarm)
                                {
                                        $icon = '<img 
src="'.$GLOBALS['phpgw']->common->image('calendar',($alarm['enabled']?'enabled':'disabled')).'"
 width="13" height="13">';
-                                       $var = Array(
+                                       $var = array(
                                                'field' => 
$icon.$GLOBALS['phpgw']->common->show_date($alarm['time']),
                                                'data'  => 'Email Notification'
                                        );
@@ -3218,7 +3391,7 @@
                        print_debug('in print_day()');
 
                        $this->bo->store_to_cache(
-                               Array(
+                               array(
                                        'syear'  => $params['year'],
                                        'smonth' => $params['month'],
                                        'sday'   => $params['day'],
@@ -3231,9 +3404,10 @@
                        $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $p->set_unknowns('keep');
 
-                       $templates = Array(
+                       $templates = array(
                                'day_cal'       => 'day_cal.tpl'
                        );
+
                        $p->set_file($templates);
                        $p->set_block('day_cal','day','day');
                        $p->set_block('day_cal','day_row','day_row');
@@ -3256,6 +3430,17 @@
                                $last_slot_end = -1;
                                foreach($events as $event)
                                {
+
+## by tb:      we don't want a user to be able to see a event if he has no 
permission to read it !!!
+##                             this shoud be in 
class.bocalendar->get_cached_events() !!!
+                                       #echo '<br><b>check_perms: 
|'.$this->bo->check_perms(PHPGW_ACL_READ).'|</b><br>';
+                                       
if(!$this->bo->check_perms(PHPGW_ACL_READ))
+                                       {
+                                               continue;
+##                                             echo '<center>'.lang('You do 
not have permission to read this record!').'</center>'."\n";
+##                                             
$GLOBALS['phpgw']->common->phpgw_exit(True);
+                                       }
+## by tb
                                        if ($this->bo->rejected_no_show($event))
                                        {
                                                continue;       // user does 
not want to see rejected events
@@ -3275,7 +3460,11 @@
                                                $slot_end = 
max($last_slot_end,$slot_end);
                                        }
                                        $rows[$slot] .= 
$this->link_to_entry($event,$params['month'],$params['day'],$params['year']);
-
+## by tb  --> old cat-colors: has problems with overlaying events
+#                                      $tmp_cats = 
explode(',',$event['category']);
+#                                      $tmp_cat  = $tmp_cats[0];
+#                                      $color[$slot] = ( 
$this->cat_colors[$tmp_cat]) ? $this->cat_colors[$tmp_cat] : 'noColor';
+## by tb
                                        print_debug('slot',$slot);
                                        print_debug('row',$rows[$slot]);
 
@@ -3322,8 +3511,19 @@
                                        $rowspan = intval($row_span[$slot]);
                                        if ($rowspan > 1)
                                        {
-                                               $p->set_var('extras',' 
rowspan="'.$rowspan.'"');
+## by tb --> old catcolors: has problems with overlaying event
+#                                              $p->set_var('extras',' 
rowspan="'.$rowspan.'"'.' style="border-left:3px solid 
'.$color[$slot].';padding:3px;vertical-align:top;" ');
+                                               $p->set_var('extras',' 
rowspan="'.$rowspan.'"'.' style="vertical-align:top;" ');
+## END - by tb
                                        }
+## by tb --> old catcolors: has problems with overlaying event
+                                       else
+                                       {
+#                                              $p->set_var('extras',' 
style="border-left:3px solid '.$color[$slot].';padding:3px;vertical-align:top;" 
');
+                                               $p->set_var('extras',' 
style="border-left:vertical-align:top;" ');
+                                       }
+## END - by tb
+
                                        $p->set_var('event',$rows[$slot]);
                                        $row_to_print = $this->nm_on_off();
                                        
$p->parse('item','day_event'.$row_to_print,False);
@@ -3338,25 +3538,37 @@
                                        $min  = date('i',$time);
                                        $time = 
$GLOBALS['phpgw']->common->formattime($hour,$min);
 
-                                       $open_link = ' - ';
+## by tb
+                                       $open_link = ($this->week_type != 
'new') ? ' - ' : '';
+## by tb
                                        if(!$this->bo->printer_friendly && 
$this->bo->check_perms(PHPGW_ACL_ADD))
                                        {
                                                $open_link .= '<a 
href="'.$this->page('add',"&date=$date_to_eval&hour=$hour&minute=$min").'">';
                                                $close_link = '</a>';
                                        }
                                }
-                               $var = Array(
+                               $var = array(
                                        'open_link'  => $open_link,
                                        'time'       => $time,
                                        'close_link' => $close_link,
                                        'tr_color'   => ''      // dummy to 
stop output_template_array to set it
                                );
-                               
$this->output_template_array($p,'item','day_time',$var);
                                
+
+## by tb
+                               if ($this->week_type != 'new' ||
+                                       ( $this->week_type == 'new' && 
$this->bo->prefs['calendar']['show_time_line'] == '1' )
+                                  )
+                               {
+                                       
$this->output_template_array($p,'item','day_time',$var);
+                       }
                                $p->parse('row','day_row',True);
                        }
+
+                       $this->time_line_saved = TRUE;
+## END - by tb
                        return $p->fp('out','day');
-               }       // end function
+               }       // end funct. - print_day($params)
 
                function timematrix($param)
                {
@@ -3386,8 +3598,10 @@
 
                        $pix = 
$GLOBALS['phpgw']->common->image('calendar','pix');
 
-                       $str = 
'<center>'.lang($GLOBALS['phpgw']->common->show_date($date['raw'],'l'))
-                               . ', '.$this->bo->long_date($date).'<br />'
+## by tb
+                       $str = '<center><font size="+1" 
color="#000000"><b>'.lang($GLOBALS['phpgw']->common->show_date($date['raw'],'l'))
+                               . ', 
'.$this->bo->long_date($date).'</b></font><br />'
+## by tb
                                . '<table width="85%" border="0" 
cellspacing="0" cellpadding="0" cols="'.((24 * $interval) + 1).'">'
                                . '<tr><td height="1" colspan="'.((24 * 
$interval) + 1).'" bgcolor="black"><img src="'.$pix.'"></td></tr>'
                                . '<tr><td width="15%"><font 
color="'.$this->theme['bg_text'].'" face="'.$this->theme['font'].'" 
size="-2">'.lang('Participant').'</font></td>';
@@ -3414,11 +3628,11 @@
                                $str .= '<tr align="center">'
                                        . '<td width="15%" align="left"><font 
color="'.$this->theme['bg_text'].'" face="'.$this->theme['font'].'" 
size="-2">'.$fullname.'</font></td>';
 
-                               $this->bo->cached_events = Array();
+                               $this->bo->cached_events = array();
                                $this->bo->so->owner = $part;
                                $this->bo->so->open_box($part);
                                $this->bo->store_to_cache(
-                                       Array(
+                                       array(
                                                'syear' => $date['year'],
                                                'smonth'=> $date['month'],
                                                'sday'  => $date['day'],
@@ -3478,13 +3692,13 @@
                {
                        $p = &$GLOBALS['phpgw']->template;
                        $p->set_file(
-                               Array(
+                               array(
                                        'form_button'   => 
'form_button_script.tpl'
                                )
                        );
 
                        $ev = $this->bo->get_cached_event();
-                       $response_choices = Array(
+                       $response_choices = array(
                                ACCEPTED        => lang('Accept'),
                                REJECTED        => lang('Reject'),
                                TENTATIVE       => lang('Tentative'),
@@ -3493,7 +3707,7 @@
                        $str = '';
                        while(list($param,$text) = each($response_choices))
                        {
-                               $var = Array(
+                               $var = array(
                                        'action_url_button'     => 
$this->page('set_action','&cal_id='.$cal_id.'&action='.$param),
                                        'action_text_button'    => '  '.$text.' 
 ',
                                        'action_confirm_button' => '',
@@ -3504,7 +3718,7 @@
                        }
                        if ($this->bo->return_to)
                        {
-                               $var = Array(
+                               $var = array(
                                        'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to),
                                        'action_text_button'    => 
lang('cancel'),
                                        'action_confirm_button' => '',
@@ -3572,6 +3786,12 @@
                        $cats = createObject('phpgwapi.categories');
                        $cats->app_name = 'addressbook';
                        $cat_list = $cats->return_array('all', 0, false);
+
+                       if ( !is_array($cat_list) ) // deal with warning when 
no cats exist
+                       {
+                               $cat_list = array();
+                       }
+                       
                        foreach ( $cat_list as $cat )
                        {
                                $t->set_var(
@@ -3632,6 +3852,9 @@
                        // $sb = CreateObject('phpgwapi.sbox');
                        $sb = CreateObject('phpgwapi.sbox2');
                        $jscal = CreateObject('phpgwapi.jscalendar');   // 
before phpgw_header() !!!
+## by tb
+                       $jscal = CreateObject('phpgwapi.jscalendar');   // 
before phpgw_header() !!!
+## by tb
 
                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
                        unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
@@ -3642,7 +3865,7 @@
 
                        $p = &$GLOBALS['phpgw']->template;
                        $p->set_file(
-                               Array(
+                               array(
                                        'edit'          => 'edit.tpl',
                                        'form_button'   => 
'form_button_script.tpl'
                                )
@@ -3658,10 +3881,10 @@
                        }
        
                        //FIXME this is ugly and should use templates better
-                       $vars = Array(
+                       $vars = array(
                                'font'                  => $this->theme['font'],
                                'bg_color'              => 
$this->theme['bg_text'],
-                               'action_url'            => 
$GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update')),
+                               'action_url'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'calendar.bocalendar.update')),
                                'popup_url'             => 
$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.participants_popup'),
                                'common_hidden' => '<input type="hidden" 
name="cal[id]" value="'.$event['id'].'" />'."\n"
                                                                                
. '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'" />'."\n"
@@ -3675,14 +3898,14 @@
                        $p->set_var($vars);
 
 // Brief Description
-                       $var['title'] = Array(
+                       $var['title'] = array(
                                'tr_color' => $this->theme['th_bg'],
                                'field' => lang('Title'),
                                'data'  => '<input name="cal[title]" size="45" 
maxlength="80" value="'.$event['title'].'">'
                        );
 
 // Full Description
-                       $var['description'] = Array(
+                       $var['description'] = array(
                                'field' => lang('Full Description'),
                                'data'  => '<textarea name="cal[description]" 
rows="5" cols="40" wrap="virtual" 
maxlength="2048">'.$event['description'].'</textarea>'
                        );
@@ -3705,13 +3928,13 @@
                        {
                                $check_cats[] = 0;
                        }
-                       $var['category'] = Array(
+                       $var['category'] = array(
                                'field' => lang('Category'),
                                'data'  => '<select name="categories[]" 
multiple 
size="5">'.$this->cat->formated_list('select','all',$check_cats,True).'</select>'
                        );
 
 // Location
-                       $var['location'] = Array(
+                       $var['location'] = array(
                                'field' => lang('Location'),
                                'data'  => '<input name="cal[location]" 
size="45" maxlength="255" value="'.$event['location'].'">'
                        );
@@ -3719,7 +3942,7 @@
 // Date
 
                        $start = $this->bo->maketime($event['start']) - 
$GLOBALS['phpgw']->datetime->tz_offset;
-                       $var['startdate'] = Array(
+                       $var['startdate'] = array(
                                'field' => lang('Start Date'),
 /*
                                'data'  => 
$GLOBALS['phpgw']->common->dateformatorder(
@@ -3737,14 +3960,14 @@
                                $str .= '<input type="radio" name="start[ampm]" 
value="am"'.($event['start']['hour'] >= 12?'':' checked').'>am'."\n"
                                        . '<input type="radio" 
name="start[ampm]" value="pm"'.($event['start']['hour'] >= 12?' 
checked':'').'>pm'."\n";
                        }
-                       $var['starttime'] = Array(
+                       $var['starttime'] = array(
                                'field' => lang('Start Time'),
                                'data'  => '<input name="start[hour]" size="2" 
VALUE="'.$GLOBALS['phpgw']->common->show_date($start,$hourformat).'" 
maxlength="2">:<input name="start[min]" size="2" 
value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" 
maxlength="2">'."\n".$str
                        );
 
 // End Date
                        $end = $this->bo->maketime($event['end']) - 
$GLOBALS['phpgw']->datetime->tz_offset;
-                       $var['enddate'] = Array(
+                       $var['enddate'] = array(
                                'field' => lang('End Date'),
 /*
                                'data'  => 
$GLOBALS['phpgw']->common->dateformatorder(
@@ -3762,19 +3985,19 @@
                                $str = '<input type="radio" name="end[ampm]" 
value="am"'.($event['end']['hour'] >= 12?'':' checked').'>am'."\n"
                                        . '<input type="radio" name="end[ampm]" 
value="pm"'.($event['end']['hour'] >= 12?' checked':'').'>pm'."\n";
                        }
-                       $var['endtime'] = Array(
+                       $var['endtime'] = array(
                                'field' => lang('End Time'),
                                'data'  => '<input name="end[hour]" size="2" 
VALUE="'.$GLOBALS['phpgw']->common->show_date($end,$hourformat).'" 
maxlength="2">:<input name="end[min]" size="2" 
value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" 
maxlength="2">'."\n".$str
                        );
 
 // Priority
-                       $var['priority'] = Array(
+                       $var['priority'] = array(
                                'field' => lang('Priority'),
                                'data'  => 
$sb->getPriority('cal[priority]',$event['priority'])
                        );
 
 // Access
-                       $var['access'] = Array(
+                       $var['access'] = array(
                                'field' => lang('Private'),
                                'data'  => '<input type="checkbox" 
name="cal[private]" value="private"'.(!$event['public']?' checked':'').'>'
                        );
@@ -3811,7 +4034,7 @@
                        {
                                $checked = '';
                        }
-                       $var['owner'] = Array(
+                       $var['owner'] = array(
                                'field' => lang('%1 participates', 
$this->bo->contacts->get_name_of_person_id($event['owner']) ),
                                'data'  => '<input type="checkbox" 
name="participants[]" value="'.$event['owner'].'A"'.$checked.'>'
                        );
@@ -3867,7 +4090,7 @@
                                }
                                $mout .= '</select>'."\n".' '.lang('minutes').' 
';
 
-                               $var['alarm'] = Array(
+                               $var['alarm'] = array(
                                        'field' => lang('Alarm'),
                                        'data'  => 
$dout.$hout.$mout.lang('before the event')
                                );
@@ -3880,7 +4103,7 @@
                        {
                                $str .= '<option 
value="'.$type.'"'.($event['recur_type']==$type?' 
selected':'').'>'.lang($label).'</option>';
                        }
-                       $var['recure_type'] = Array(
+                       $var['recure_type'] = array(
                                'field' => lang('Repeat Type'),
                                'data'  => '<select 
name="cal[recur_type]">'."\n".$str.'</select>'."\n"
                        );
@@ -3896,7 +4119,7 @@
                                $recur_end = 
$this->bo->maketime($event['start']) + 86400 - 
$GLOBALS['phpgw']->datetime->tz_offset;
                        }
        
-                       $var['recure_enddate'] = Array(
+                       $var['recure_enddate'] = array(
                                'field' => lang('Repeat End Date'),
                                'data'  => '<input type="checkbox" 
name="cal[rpt_use_end]" value="y"'.$checked.'>'.lang('Use End Date').'  '.
 /*
@@ -3915,12 +4138,12 @@
                                $boxes .= '<input type="checkbox" 
name="cal[rpt_day][]" value="'.$mask.'"'.($event['recur_data'] & $mask ? ' 
checked' : '').'>&nbsp;'.lang($name)."\n";
                                if (++$i == 5) $boxes .= '<br />';
                        }
-                       $var['recure_day'] = Array(
+                       $var['recure_day'] = array(
                                'field' => lang('Repeat Day').'<br 
/>'.lang('(for weekly)'),
                                'data'  => $boxes
                        );
 
-                       $var['recure_interval'] = Array(
+                       $var['recure_interval'] = array(
                                'field' => lang('Interval'),
                                'data'  => '<input name="cal[recur_interval]" 
size="4" maxlength="4" value="'.$event['recur_interval'].'">'
                        );
@@ -4018,7 +4241,7 @@
                        $delete_button = $cancel_button = '';
                        if ($event['id'] > 0)
                        {
-                               $var = Array(
+                               $var = array(
                                        'action_url_button'     => 
$this->page('delete','&cal_id='.$event['id']),
                                        'action_text_button'    => 
lang('Delete'),
                                        'action_confirm_button' => 
"onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this 
entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
@@ -4031,7 +4254,7 @@
 
                        if ($this->bo->return_to)
                        {
-                               $var = Array(
+                               $var = array(
                                        'action_url_button'     => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to),
                                        'action_text_button'    => 
lang('Cancel'),
                                        'action_confirm_button' => '',
@@ -4063,7 +4286,7 @@
 
                        $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
                        $p->set_file(
-                               Array(
+                               array(
                                        'T_edit_partlist' => 
'edit_partlist.tpl',
                                        'T_edit_partlist_blocks' => 
'edit_partlist_blocks.tpl'
                                )
@@ -4187,7 +4410,7 @@
 
                function read_contact($id)
                {
-                       $query_fields = Array(
+                       $query_fields = array(
                                'n_given' => 'n_given',
                                'n_family' => 'n_family',
                                'email' => 'email',
@@ -4227,7 +4450,7 @@
                                {
                                        
if($GLOBALS['phpgw']->accounts->exists($id) == True)
                                        {
-                                               $users[$id] = Array(
+                                               $users[$id] = array(
                                                        'name'  => 
$GLOBALS['phpgw']->common->grab_owner_name($id),
                                                        'type'  => 
$GLOBALS['phpgw']->accounts->get_type($id)
                                                );
@@ -4316,7 +4539,7 @@
                                {
                                        $new_event = False;
                                }
-                               $holiday_name = Array();
+                               $holiday_name = array();
                                if($holidays)
                                {
                                        for($k=0;$k<count($holidays);$k++)
@@ -4329,7 +4552,7 @@
                                {
                                        $week = lang('week').' 
'.(int)((date('z',($startdate+(24*3600*4)))+7)/7);
                                }
-                               $daily[$date] = Array(
+                               $daily[$date] = array(
                                        'extra'         => $extra,
                                        'new_event'     => $new_event,
                                        'holidays'      => $holiday_name,
@@ -4347,6 +4570,41 @@
                        
                        return $daily;
                }
+
+               /**
+               * @author Thomas Bott
+               */
+               function insert_tooltip_js($var)
+               {
+                       if ( !is_array($var) )
+                       {
+                               $var = array();
+                       }
+
+                       if ( $this->inserted_tooltip_js == FALSE )
+                       {
+                               $tooltip_js = '<script type="text/javascript" 
src="' . $GLOBALS['phpgw_info']['server']['webserver_url'] . 
'/calendar/js/wz_tooltip/wz_tooltip.js"></script>';
+                               $var = array_merge($var, array('tooltip_js' => 
$tooltip_js) );
+                               $this->inserted_tooltip_js = TRUE;
+                       }
+                       return $var;
+               }
+
+               /**
+               * @author Thomas Bott
+               */
+               function my_nl2br($text)
+               {
+                       $retvalue="";
+                       for ($i=0;$i< strlen($text);$i++)
+                       {
+                               if ($text[$i]!=chr(13))
+                               {
+                                       $text[$i]=="\n" ? $retvalue .= "<BR>" : 
$retvalue .= $text[$i];
+                               }
+                       }
+                       return $retvalue;
+               }
        }
 
        //Moved this here for performance reasons and cos it didn't belong in 
the middle of a method - skwashd
Index: calendar/inc/hook_home_week.inc.php
diff -u calendar/inc/hook_home_week.inc.php:1.6 
calendar/inc/hook_home_week.inc.php:1.7
--- calendar/inc/hook_home_week.inc.php:1.6     Sun May 15 06:57:37 2005
+++ calendar/inc/hook_home_week.inc.php Fri Dec 16 13:24:44 2005
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: hook_home_week.inc.php,v 1.6 2005/05/15 06:57:37 skwashd Exp $ */
+  /* $Id: hook_home_week.inc.php,v 1.7 2005/12/16 13:24:44 skwashd Exp $ */
 
        $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
        if($d1 == 'htt' || $d1 == 'ftp' )
@@ -23,6 +23,6 @@
        unset($d1);
 
        $GLOBALS['extra_data'] = $GLOBALS['css']."\n".'<td>'."\n".'<table 
border="0" cols="3"><tr><td align="center" width="100%" valign="top">'
-               . ExecMethod('calendar.uicalendar.get_week')
+               . ExecMethod('calendar.uicalendar.get_week_new')
                .'</td>'."\n".'</tr>'."\n".'</table>'."\n".'</td>'."\n";
 ?>
Index: calendar/inc/hook_settings.inc.php
diff -u calendar/inc/hook_settings.inc.php:1.5 
calendar/inc/hook_settings.inc.php:1.6
--- calendar/inc/hook_settings.inc.php:1.5      Sun May 15 06:57:37 2005
+++ calendar/inc/hook_settings.inc.php  Fri Dec 16 13:24:44 2005
@@ -13,13 +13,14 @@
        *  option) any later version.                                           
   *
        
\**************************************************************************/
 
-       /* $Id: hook_settings.inc.php,v 1.5 2005/05/15 06:57:37 skwashd Exp $ */
+       /* $Id: hook_settings.inc.php,v 1.6 2005/12/16 13:24:44 skwashd Exp $ */
 
        ExecMethod('calendar.bocalendar.check_set_default_prefs');
 
        $default = array(
                'day'          => lang('Daily'),
                'week'         => lang('Weekly'),
+               'week_new'     => lang('detailed Weekly'),
                'month'        => lang('Monthly'),
                'year'         => lang('Yearly'),
                'planner_cat'  => lang('Planner by category'),
@@ -166,3 +167,20 @@
 
        create_check_box('Print calendars in black & white','print_black_white',
                'Should the printer friendly view be in black & white or in 
color (as in normal view)?');
+
+## by tb
+       create_check_box('Show complete description in 
overview','show_descrpt_ovr',
+               'Select wether the event description is shown in the overview 
(e.g. week-view) or not.');
+
+       $show_descrpt_title = array(
+               '0'     => lang('no'),
+               '1'     => lang('yes'),
+               '23'    => lang('js-ToolTip')
+       );
+       create_select_box('Show complete description in 
title-tag','show_descrpt_title',$show_descrpt_title,
+               'Select how to show the event description as tooltip: never, 
ever or as js-tooltip (more infos).');
+
+       create_check_box('Show time-line in detailed weekly 
view','show_time_line',
+               'Select wether to show the time-line in the detailed weekly 
view or not.');
+## END - by tb
+
Index: calendar/inc/hook_sidebox_menu.inc.php
diff -u calendar/inc/hook_sidebox_menu.inc.php:1.3 
calendar/inc/hook_sidebox_menu.inc.php:1.4
--- calendar/inc/hook_sidebox_menu.inc.php:1.3  Sun Oct 23 12:57:16 2005
+++ calendar/inc/hook_sidebox_menu.inc.php      Fri Dec 16 13:24:44 2005
@@ -10,7 +10,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: hook_sidebox_menu.inc.php,v 1.3 2005/10/23 12:57:16 skwashd Exp $ */
+  /* $Id: hook_sidebox_menu.inc.php,v 1.4 2005/12/16 13:24:44 skwashd Exp $ */
 {
 
  /*
@@ -32,6 +32,8 @@
                                'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'calendar.uicalendar.day'))),
                        array('text'  => 'This week',
                                'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'calendar.uicalendar.week'))),
+                       array('text'  => 'This week (detailed)',
+                               'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'calendar.uicalendar.week_new'))),
                        array('text'  => 'This month',
                                'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'calendar.uicalendar.month'))),
                        array('text'  => 'This year',
Index: calendar/setup/phpgw_de.lang
diff -u calendar/setup/phpgw_de.lang:1.22 calendar/setup/phpgw_de.lang:1.23
--- calendar/setup/phpgw_de.lang:1.22   Sun May 15 06:57:37 2005
+++ calendar/setup/phpgw_de.lang        Fri Dec 16 13:24:44 2005
@@ -7,7 +7,7 @@
 1 match found  calendar        de      1 Treffer gefunden
 a      calendar        de      a
 accept calendar        de      Zusagen
-accepted       calendar        de      Zugesagt
+accepted       calendar        de      zugesagt
 action that caused the notify: added, canceled, accepted, rejected, ...        
calendar        de      Aktion die die Benachrichtigung verursacht hat: 
Zugefügt, Storniert, Zugesagt, Abgesagt
 add a single entry by passing the fields.      calendar        de      Einen 
einzelnen neuen Eintrag über seine Felder erzeugen.
 add alarm      calendar        de      Alarm zufügen
@@ -42,6 +42,7 @@
 canceled       calendar        de      Abgesagt
 change all events for $params['old_owner'] to $params['new_owner'].    
calendar        de      Ändere alle Termine für $params['old_owner'] auf 
$params['new_owner'].
 change status  calendar        de      Zusage ändern
+change view to calendar        de      Ansicht ändern zu
 choose the category    calendar        de      Kategorie auswählen
 click %1here%2 to return to the calendar.      calendar        de      
%1Hier%2 klicken um zum Kalender zurück zu kehren.
 configuration  calendar        de      Konfiguration
@@ -63,12 +64,15 @@
 default view of appointments   calendar        de      Standard-Ansicht der 
Termine
 defines the size in minutes of the lines in the day view.      calendar        
de      Bestimmt die Zeitskala in Minuten der Tagesansicht des Kalendars.
 delete a single entry by passing the id.       calendar        de      Lösche 
einen einzelnen Eintrag über seine Id.
+delete all participants        calendar        de      Alle Teilnehmer löschen
 delete an entire users calendar.       calendar        de      Lösche den 
kompletten Kalender eines Benutzers.
 delete selected contacts       calendar        de      Löscht die ausgewählten 
Kontakte.
 delete series  calendar        de      Serie löschen
 delete single  calendar        de      Einzelevent löschen
 deleted        calendar        de      Abgesagt
 description    calendar        de      Beschreibung
+deselect all participants      calendar        de      Alle Teilnehmer abwählen
+detailed weekly        calendar        de      Wöchentlich (detailiert)
 display interval in day view   calendar        de      Intervall der 
Tagesansicht
 display mini calendars when printing   calendar        de      zeige einen 
kleinen Kalender beim drucken
 display status of events       calendar        de      Status von Terminen 
anzeigen
@@ -130,6 +134,7 @@
 intervals in day view  calendar        de      Zeitintervalle in der 
Tagesansicht
 intervals per day in planner view      calendar        de      Zeitintervalle 
pro Tag in der Planeransicht
 invalid entry id.      calendar        de      ungültige Id des Eintrags.
+js-tooltip     calendar        de      js-tooltip
 last   calendar        de      letzte
 lastname of person to notify   calendar        de      Nachname der zu 
benachrichtigenden Person
 length shown<br />(emtpy for full length)      calendar        de      
angezeigte Länge<br />(leer für volle Länge)
@@ -170,11 +175,11 @@
 olddate        calendar        de      AltesDatum
 on %1 %2 %3 your meeting request for %4        calendar        de      Am %1 
hat %2 Ihre Einladung für den %4 %3
 on all changes calendar        de      bei allen Veränderungen
-on all changes too     calendar        de      
+on all changes too     calendar        de                         auch bei 
allen Veränderungen
 on all modification, but responses     calendar        de      bei allen 
Änderungen, außer Antworten
 on any time change (and above options) calendar        de      bei allen 
zeitliche Änderunge (und obige optionen)
-on any time change too calendar        de      auch jede zeitliche Veränderung
-on every time-change too       calendar        de      
+on any time change too calendar        de      auch jegliche zeitliche 
Veränderung
+on every time-change too       calendar        de      auch jede zeitliche 
Veränderung
 on invitation / cancelation only       calendar        de      nur bei 
Einladungen/Absagen
 on participant responses too   calendar        de      auch bei Antworten der 
Teilnehmer
 on time change of more than 4 hours too        calendar        de      bei 
zeitlichen Änderungen größer als 4 Stunden
@@ -212,7 +217,7 @@
 regular summary of your appointments   calendar        de      
 reinstate      calendar        de      Wiedereinsetzen
 reject calendar        de      Absagen
-rejected       calendar        de      Abgesagt
+rejected       calendar        de      abgesagt
 repeat day     calendar        de      Wiederholungstag
 repeat end date        calendar        de      Enddatum
 repeat type    calendar        de      Wiederholungstyp
@@ -226,6 +231,9 @@
 scheduling conflict    calendar        de      Terminüberschneidung
 search results calendar        de      Suchergebnisse
 selected contacts (%1) calendar        de      Ausgewählte Kontakte (%1)
+Select wether the event description is shown in the overview (e.g. week-view) 
or not.  calendar        de      Soll die vollständige Beschreibung eines 
Termins in der Übersicht (z.B: Wochenansicht) angezeigt werden?
+Select wether to show the time-line in the detailed weekly view or not.        
calendar        de      Soll in der detailierten Wochenansicht die Zeitleiste 
angezeigt werden?
+Select how to show the event description as tooltip: never, ever or as 
js-tooltip (more infos).        calendar        de      Wie soll die 
vollständige Beschreibung eines Termins als ToolTip in der Übersicht angezeigt: 
nicht anzeigen, anzeigen oder mit JavaScript-ToolTip (mehr Informationen) 
anzeigen?
 send updates via email common  de      Updates via E-Mail senden
 send/receive updates via email calendar        de      Senden/Empfangen von 
Aktualisierungen via EMail
 set a year only for one-time / non-regular holidays.   calendar        de      
Nur für einmalige/unregelmäßige Feiertage das Jahr angeben.
@@ -238,10 +246,13 @@
 should the printer friendly view be in black & white or in color (as in normal 
view)?  calendar        de      Soll die Drucker freundliche Ansicht in 
schwarz-weiß dargestellt werden oder in Farbe (identisch der normalen Ansicht)?
 should the printer friendly view be in black & white or in color, like the 
normal view?        calendar        de      
 should the status of the event-participants (accept, reject, ...) be shown in 
brakets after each participants name ?   calendar        de      Soll der 
Status (Zugesagt,Abgesagt ...)der Termin- Teilnehmer in Klammern hinter jeden 
Teilnehmer angezeigt werden?
+Show complete description in overview  calendar        de      Vollständige 
Beschreibung in der Übersicht anzeigen.
+Show complete description in title-tag calendar        de      Vollständige 
Beschreibung im Title-tag.
 show day view on main screen   calendar        de      Tagesansicht auf 
Startseite anzeigen
 show default view on main screen       calendar        de      Standardansicht 
auf der Startseite anzeigen
 show high priority events on main screen       calendar        de      Termine 
mit hoher Priorität auf der Startseite anzeigen
 show invitations you rejected  calendar        de      Zeige Einladungen 
welche abgelehnt wurden an
+Show time-line in detailed weekly view calendar        de      Zeige die 
Zeitleiste in der detailierten Wochenansicht
 single event   calendar        de      Einzelner Termin
 sorry, the owner has just deleted this event   calendar        de      Der 
Eigentümer hat diesen Termin gerade gelöscht
 sorry, this event does not exist       calendar        de      Dieser Termin 
existiert nicht
@@ -256,7 +267,7 @@
 su     calendar        de      So
 submit to repository   calendar        de      Übertragen zu phpGroupWare.org
 sun    calendar        de      So
-tentative      calendar        de      Vorläufige Zusage
+tentative      calendar        de      vorläufig zugesagt
 test import (show importable records <u>only</u> in browser)   calendar        
de      Test Import (zeigt importierte Datensätze <u>nur</u> im Webbrowser an)
 text   calendar        de      Text
 th     calendar        de      Do
@@ -281,6 +292,7 @@
 this message is sent when you set an alarm for a certain event. include all 
information you might need.        calendar        de      Diese Meldung wird 
ihnen gesandt, wenn sie einen Alarm für einen Termin setzen. Nehmen sie alle 
Information darin auf, die sie benötigen.
 this month     calendar        de      Dieser Monat
 this week      calendar        de      Diese Woche
+this week (detailed)   calendar        de      Diese Woche (detailiert)
 this year      calendar        de      Dieses Jahr
 thu    calendar        de      Do
 title  calendar        de      Titel
Index: calendar/setup/setup.inc.php
diff -u calendar/setup/setup.inc.php:1.32 calendar/setup/setup.inc.php:1.33
--- calendar/setup/setup.inc.php:1.32   Fri Nov 18 11:40:45 2005
+++ calendar/setup/setup.inc.php        Fri Dec 16 13:24:44 2005
@@ -9,7 +9,7 @@
        *  option) any later version.                                           
   *
        
\**************************************************************************/
 
-       /* $Id: setup.inc.php,v 1.32 2005/11/18 11:40:45 skwashd Exp $ */
+       /* $Id: setup.inc.php,v 1.33 2005/12/16 13:24:44 skwashd Exp $ */
 
        $setup_info['calendar']['name']    = 'calendar';
        $setup_info['calendar']['version'] = '0.9.18.002';
@@ -45,6 +45,7 @@
        $setup_info['calendar']['hooks'][] = 'home_day';
        $setup_info['calendar']['hooks'][] = 'home_month';
        $setup_info['calendar']['hooks'][] = 'home_week';
+       $setup_info['calendar']['hooks'][] = 'home_weeknew';
        $setup_info['calendar']['hooks'][] = 'home_year';
        $setup_info['calendar']['hooks'][] = 'manual';
        $setup_info['calendar']['hooks'][] = 'preferences';
Index: calendar/templates/default/contacts_popup.tpl
diff -u calendar/templates/default/contacts_popup.tpl:1.4 
calendar/templates/default/contacts_popup.tpl:1.5
--- calendar/templates/default/contacts_popup.tpl:1.4   Fri Nov 11 10:18:21 2005
+++ calendar/templates/default/contacts_popup.tpl       Fri Dec 16 13:24:44 2005
@@ -2,7 +2,7 @@
 <html>
        <head>
                <title>{lang_title}</title>
-               <script type="text/javascript" 
src="./communik8r/js/base/base.js"><script>
+               <script type="text/javascript" 
src="./communik8r/js/base/base.js"></script>
                <script type="text/javascript" 
src="./communik8r/js/base/events.js"></script>
                <script type="text/javascript" 
src="./communik8r/js/sarissa/sarissa.js"></script>
                <script type="text/javascript">





reply via email to

[Prev in Thread] Current Thread [Next in Thread]