phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.71.2.33.


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.71.2.33.2.5,1.71.2.33.2.6 class.boicalendar.inc.php,1.16.2.4,1.16.2.4.2.1 class.socalendar__.inc.php,1.11.2.1,1.11.2.1.2.1 class.uicalendar.inc.php,1.66.2.55.2.10,1.66.2.55.2.11 hook_settings.inc.php,1.1.2.5,1.1.2.6
Date: Mon, 19 May 2003 19:29:25 -0400

Update of /cvsroot/phpgroupware/calendar/inc
In directory subversions:/tmp/cvs-serv7380/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.bocalendar.inc.php class.boicalendar.inc.php 
        class.socalendar__.inc.php class.uicalendar.inc.php 
        hook_settings.inc.php 
Log Message:
added configurable notifys (with iCal attachments) and the necessary prefs


Index: class.bocalendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.bocalendar.inc.php,v
retrieving revision 1.71.2.33.2.5
retrieving revision 1.71.2.33.2.6
diff -C2 -r1.71.2.33.2.5 -r1.71.2.33.2.6
*** class.bocalendar.inc.php    4 May 2003 17:05:07 -0000       1.71.2.33.2.5
--- class.bocalendar.inc.php    19 May 2003 23:29:22 -0000      1.71.2.33.2.6
***************
*** 18,30 ****
        {
                var $public_functions = Array(
!                       'read_entry'    => True,
!                       'delete_entry' => True,
!                       'delete_calendar'       => True,
!                       'change_owner'  => True,
!                       'update'       => True,
!                       'preferences'  => True,
!                       'store_to_cache'        => True,
!                       'export_event'  => True,
!                       'reinstate'             => True
                );
  
--- 18,30 ----
        {
                var $public_functions = Array(
!                       'read_entry'      => True,
!                       'delete_entry'    => True,
!                       'delete_calendar' => True,
!                       'change_owner'    => True,
!                       'update'          => True,
!                       'check_set_default_prefs' => True,
!                       'store_to_cache'  => True,
!                       'export_event'    => True,
!                       'reinstate'       => True
                );
  
***************
*** 133,136 ****
--- 133,137 ----
                function bocalendar($session=0)
                {
+                       $this->cat = CreateObject('phpgwapi.categories');
                        $this->grants = 
$GLOBALS['phpgw']->acl->get_grants('calendar');
                        @reset($this->grants);
***************
*** 143,152 ****
                                }       
  
!                               while(list($grantor,$rights) = 
each($this->grants))
                                {
                                        print_debug('Grantor',$grantor);
                                        print_debug('Rights',$rights);
                                }
-                               @reset($this->grants);
                        }
  
--- 144,152 ----
                                }       
  
!                               foreach($this->grants as $grantor => $rights)
                                {
                                        print_debug('Grantor',$grantor);
                                        print_debug('Rights',$rights);
                                }
                        }
  
***************
*** 162,165 ****
--- 162,166 ----
  
                        $this->prefs['calendar']    = 
$GLOBALS['phpgw_info']['user']['preferences']['calendar'];
+                       $this->check_set_default_prefs();
  
                        $owner = 
(isset($GLOBALS['owner'])?$GLOBALS['owner']:'');
***************
*** 873,879 ****
                                        $new_event = $event;
                                        $old_event = 
$this->read_entry($event['id']);
-                                       
$this->prepare_recipients($new_event,$old_event);
                                        $this->so->cal->event = $event;
                                        $this->so->add_entry($event);
                                }
                                $date = 
sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']);
--- 874,880 ----
                                        $new_event = $event;
                                        $old_event = 
$this->read_entry($event['id']);
                                        $this->so->cal->event = $event;
                                        $this->so->add_entry($event);
+                                       
$this->prepare_recipients($new_event,$old_event);
                                }
                                $date = 
sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']);
***************
*** 2035,2066 ****
                }
  
                function set_status($cal_id,$status)
                {
!                       $old_event = $this->so->read_entry($cal_id);
!                       switch($status)
                        {
!                               case REJECTED:
!                                       
$this->send_update(MSG_REJECTED,$old_event['participants'],$old_event);
!                                       $this->so->set_status($cal_id,$status);
!                                       break;
!                               case TENTATIVE:
!                                       
$this->send_update(MSG_TENTATIVE,$old_event['participants'],$old_event);
!                                       $this->so->set_status($cal_id,$status);
                                        break;
!                               case ACCEPTED:
!                                       
$this->send_update(MSG_ACCEPTED,$old_event['participants'],$old_event);
!                                       $this->so->set_status($cal_id,$status);
                                        break;
                        }
!                       return True;
                }
  
!               function 
send_update($msg_type,$participants,$old_event=False,$new_event=False)
                {
!                       $db = $GLOBALS['phpgw']->db;
!                       $db->query("SELECT app_version FROM phpgw_applications 
WHERE app_name='calendar'",__LINE__,__FILE__);
!                       $db->next_record();
!                       $version = $db->f('app_version');
!                       unset($db);
  
                        $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->create_email_preferences();
--- 2036,2135 ----
                }
  
+               /*!
+               @function set_status
+               @abstract set the participant response $status for event 
$cal_id and notifies the owner of the event
+               */
                function set_status($cal_id,$status)
                {
!                       $status2msg = array(
!                               REJECTED  => MSG_REJECTED,
!                               TENTATIVE => MSG_TENTATIVE,
!                               ACCEPTED  => MSG_ACCEPTED
!                       );
!                       if (!isset($status2msg[$status]))
                        {
!                               return False;
!                       }
!                       $this->so->set_status($cal_id,$status);
!                       $event = $this->so->read_entry($cal_id);
!                       
$this->send_update($status2msg[$status],$event['participants'],$event);
! 
!                       return True;
!               }
! 
!               /*!
!               @function update_requested
!               @abstract checks if $userid has requested (in $part_prefs) 
updates for $msg_type
!               @syntax 
update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event)
!               @param $userid numerical user-id
!               @param $part_prefs preferces of the user $userid
!               @param $msg_type type of the notification: MSG_ADDED, 
MSG_MODIFIED, MSG_ACCEPTED, ...
!               @param $old_event Event before the change
!               @param $new_event Event after the change
!               @returns 0 = no update requested, > 0 update requested
!               */
!               function 
update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event)
!               {
!                       $want_update = 0;
!                       
!                       // the following switch fall-through all cases, as each 
included the following too
!                       //
!                       $msg_is_response = $msg_type == MSG_REJECTED || 
$msg_type == MSG_ACCEPTED || $msg_type == MSG_TENTATIVE;
! 
!                       switch($ru = $part_prefs['calendar']['receive_updates'])
!                       {
!                               case 'responses':
!                                       if ($msg_is_response)
!                                       {
!                                               ++$want_update;
!                                       }
!                               case 'modifications':
!                                       if ($msg_type == MSG_MODIFIED)
!                                       {
!                                               ++$want_update;
!                                       }
!                               case 'time_change_4h':
!                               case 'time_change':
!                                       $diff = 
max(abs($this->maketime($old_event['start'])-$this->maketime($new_event['start'])),
!                                               
abs($this->maketime($old_event['end'])-$this->maketime($new_event['end'])));
!                                       $check = $ru == 'time_change_4h' ? 4 * 
60 * 60 - 1 : 0;
!                                       if ($msg_type == MSG_MODIFIED && $diff 
> $check)
!                                       {
!                                               ++$want_update;
!                                       }
!                               case 'add_cancel':
!                                       if ($old_event['owner'] == $userid && 
$msg_is_response ||
!                                           $msg_type == MSG_DELETED || 
$msg_type == MSG_ADDED)
!                                       {
!                                               ++$want_update;
!                                       }
                                        break;
!                               case 'no':
                                        break;
                        }
!                       echo 
"<p>bocalendar::update_requested(user=$userid,pref=".$part_prefs['calendar']['receive_updates']
 
.",msg_type=$msg_type,".($old_event?$old_event['title']:'False').",".($old_event?$old_event['title']:'False').")
 = $want_update</p>\n";
!                       return $want_update > 0;
                }
  
!               /*!
!               @function send_update
!               @abstract sends update-messages to certain participants of an 
event
!               @syntax 
send_update($msg_type,$to_notify,$old_event,$new_event=False)
!               @param $msg_type type of the notification: MSG_ADDED, 
MSG_MODIFIED, MSG_ACCEPTED, ...
!               @param $to_notify array with numerical user-ids as keys (!) 
(value is not used)
!               @param $old_event Event before the change
!               @param $new_event Event after the change
!               */
!               function 
send_update($msg_type,$to_notify,$old_event,$new_event=False)
                {
!                       if (!is_array($to_notify))
!                       {
!                               $to_notify = array();
!                       }
!                       if (!isset($to_notify[$old_event['owner']]))
!                       {
!                               $to_notify[$old_event['owner']] = 'owner';      
// always include the event-owner
!                       }
!                       $version = 
$GLOBALS['phpgw_info']['apps']['calendar']['version'];
  
                        $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->create_email_preferences();
***************
*** 2087,2096 ****
                        {
                                $user = $this->owner;
- //            
- //                            $accounts = 
CreateObject('phpgwapi.accounts',$user);
- //                            $phpgw_info['user'] = 
$accounts->read_repository();
- //
- //                            $pref = 
CreateObject('phpgwapi.preferences',$user);
- //                            $GLOBALS['phpgw_info']['user']['preferences'] = 
$pref->read_repository();
                        }
                        else
--- 2156,2159 ----
***************
*** 2101,2190 ****
                        $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->create_email_preferences($user);
  
                        switch($msg_type)
                        {
                                case MSG_DELETED:
!                                       $action = 'Deleted';
!                                       $event_id = $old_event['id'];
                                        $msgtype = '"calendar";';
                                        break;
                                case MSG_MODIFIED:
!                                       $action = 'Modified';
!                                       $event_id = $old_event['id'];
                                        $msgtype = '"calendar"; 
Version="'.$version.'"; Id="'.$new_event['id'].'"';
                                        break;
                                case MSG_ADDED:
!                                       $action = 'Added';
!                                       $event_id = $new_event['id'];
                                        $msgtype = '"calendar"; 
Version="'.$version.'"; Id="'.$new_event['id'].'"';
                                        break;
                                case MSG_REJECTED:
                                        $action = 'Rejected';
!                                       $event_id = $old_event['id'];
                                        $msgtype = '"calendar";';
                                        break;
                                case MSG_TENTATIVE:
                                        $action = 'Tentative';
!                                       $event_id = $old_event['id'];
                                        $msgtype = '"calendar";';
                                        break;
                                case MSG_ACCEPTED:
                                        $action = 'Accepted';
!                                       $event_id = $old_event['id'];
                                        $msgtype = '"calendar";';
                                        break;
                        }
! 
!                       if($old_event != False)
                        {
!                               $old_event_datetime = $t_old_start_time - 
$GLOBALS['phpgw']->datetime->tz_offset;
                        }
!               
!                       if($new_event != False)
                        {
!                               $new_event_datetime = 
$this->maketime($new_event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
!                               $new_event_datetime_end = 
$this->maketime($new_event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
                        }
  
!                       //Added to construct the participant's list to an event
!                       $event_participants = '';
!                       reset($participants);
!                       $ac=CreateObject('phpgwapi.accounts');
!  
!                       while(list($userid,$statid)=each($participants))
!                       {
!                               $event_participants .= 
($event_participants?"\n":'');
!                               $ac->account_id=$userid;
!                               $ac->read_repository();
!                               $event_participants .= 
'<'.$ac->data['account_lid'].'> '.$ac->data['fullname'];
!                       }
!                       //End
! 
!                       reset($participants);
!                       while($participants && list($userid,$statusid) = 
each($participants))
!                       {
!                               if((intval($userid) != 
$GLOBALS['phpgw_info']['user']['account_id']) &&
!                                  (
!                                   (
!                                    ($msg_type == MSG_REJECTED || $msg_type == 
MSG_TENTATIVE || $msg_type == MSG_ACCEPTED) &&
!                                    ($old_event['owner'] == $userid)
!                                   ) ||
!                                   ($msg_type == MSG_DELETED || $msg_type == 
MSG_MODIFIED || $msg_type == MSG_ADDED)
!                                  )
!                                 )
                                {
                                        print_debug('Msg Type',$msg_type);
                                        print_debug('UserID',$userid);
-                                       if(!is_object($send))
-                                       {
-                                               $send = 
CreateObject('phpgwapi.send');
-                                       }
  
!                                       $preferences = 
CreateObject('phpgwapi.preferences',intval($userid));
                                        $part_prefs = 
$preferences->read_repository();
!                                       
if(!isset($part_prefs['calendar']['send_updates']) || 
!$part_prefs['calendar']['send_updates'])
                                        {
                                                continue;
                                        }
!                                       $part_prefs = 
$preferences->create_email_preferences(intval($userid));
                                        $to = $part_prefs['email']['address'];
  
--- 2164,2243 ----
                        $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->create_email_preferences($user);
  
+                       $event = $msg_type == MSG_ADDED || $msg_type == 
MSG_MODIFIED ? $new_event : $old_event;
+                       if($old_event != False)
+                       {
+                               $old_starttime = $t_old_start_time - 
$GLOBALS['phpgw']->datetime->tz_offset;
+                       }
+                       $starttime = $this->maketime($event['start']) - 
$GLOBALS['phpgw']->datetime->tz_offset;
+                       $endtime   = $this->maketime($event['end']) - 
$GLOBALS['phpgw']->datetime->tz_offset;
+ 
                        switch($msg_type)
                        {
                                case MSG_DELETED:
!                                       $action = $msg = 'Canceled';
                                        $msgtype = '"calendar";';
                                        break;
                                case MSG_MODIFIED:
!                                       $action = $msg = 'Modified';
                                        $msgtype = '"calendar"; 
Version="'.$version.'"; Id="'.$new_event['id'].'"';
                                        break;
                                case MSG_ADDED:
!                                       $action = $msg = 'Added';
                                        $msgtype = '"calendar"; 
Version="'.$version.'"; Id="'.$new_event['id'].'"';
                                        break;
                                case MSG_REJECTED:
                                        $action = 'Rejected';
!                                       $msg = 'Response';
                                        $msgtype = '"calendar";';
                                        break;
                                case MSG_TENTATIVE:
                                        $action = 'Tentative';
!                                       $msg = 'Response';
                                        $msgtype = '"calendar";';
                                        break;
                                case MSG_ACCEPTED:
                                        $action = 'Accepted';
!                                       $msg = 'Response';
                                        $msgtype = '"calendar";';
                                        break;
                        }
!                       $notify_msg = $this->prefs['calendar']['notify'.$msg];
!                       $details = array(                       // 
event-details for the notify-msg
!                               'id'          => $msg_type == MSG_ADDED ? 
$new_event['id'] : $old_event['id'],
!                               'action'      => lang($action),
!                       );
!                       $event_arr = $this->event2array($event);
!                       foreach($event_arr as $key => $val)
                        {
!                               $details[$key] = $val['data'];
                        }
!                       $details['participants'] = 
implode("\n",$details['participants']);
! 
!                       if(!is_object($GLOBALS['phpgw']->send))
                        {
!                               $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
                        }
+                       $send = &$GLOBALS['phpgw']->send;
+ 
+                       foreach($to_notify as $userid => $statusid)
+                       {
+                               $userid = intval($userid);
  
!                               if($userid != 
$GLOBALS['phpgw_info']['user']['account_id'])
                                {
                                        print_debug('Msg Type',$msg_type);
                                        print_debug('UserID',$userid);
  
!                                       $preferences = 
CreateObject('phpgwapi.preferences',$userid);
                                        $part_prefs = 
$preferences->read_repository();
!                                       
!                                       if 
(!$this->update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event))
                                        {
                                                continue;
                                        }
!                                       
$GLOBALS['phpgw']->accounts->get_account_name($userid,$lid,$details['to-firstname'],$details['to-lastname']);
!                                       $details['to-fullname'] = 
$GLOBALS['phpgw']->common->display_fullname('',$details['to-firstname'],$details['to-lastname']);
! 
!                                       $part_prefs = 
$preferences->create_email_preferences($userid);
                                        $to = $part_prefs['email']['address'];
  
***************
*** 2197,2210 ****
                                        $GLOBALS['phpgw']->datetime->tz_offset 
= ((60 * 60) * 
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
  
!                                       if($old_event != False)
                                        {
!                                               $old_event_date = 
$GLOBALS['phpgw']->common->show_date($old_event_datetime);
!                                       }
!                               
!                                       if($new_event != False)
!                                       {
!                                               $new_event_date = 
$GLOBALS['phpgw']->common->show_date($new_event_datetime);
!                                               $new_event_end = 
$GLOBALS['phpgw']->common->show_date($new_event_datetime_end);
                                        }
                                
                                        switch($msg_type)
--- 2250,2259 ----
                                        $GLOBALS['phpgw']->datetime->tz_offset 
= ((60 * 60) * 
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
  
!                                       if($old_starttime)
                                        {
!                                               $details['olddate'] = 
$GLOBALS['phpgw']->common->show_date($old_starttime);
                                        }
+                                       $details['startdate'] = 
$GLOBALS['phpgw']->common->show_date($starttime);
+                                       $details['enddate']   = 
$GLOBALS['phpgw']->common->show_date($endtime);
                                
                                        switch($msg_type)
***************
*** 2213,2230 ****
                                                        $action_date = 
$old_event_date;
                                                        $body = lang ('Your 
meeting scheduled for') .' '. $old_event_date .' '. lang('has been canceled');
!                                                       
$event_head=$old_event['title'];
!                                                       
$event_description=$old_event['description'];
                                                        break;
                                                case MSG_MODIFIED:
                                                        $action_date = 
$new_event_date;
                                                        $body = lang ('Your 
meeting that had been scheduled for').' '.$old_event_date.' '. lang('has been 
rescheduled to') .' '.$new_event_date;
!                                                       
$event_head=$old_event['title'];
!                                                       
$event_description=$old_event['description'];
                                                        break;
                                                case MSG_ADDED:
                                                        $action_date = 
$new_event_date;
                                                        $body = lang ('You have 
a meeting scheduled for').' '. $new_event_date;
!                                                       
$event_head=$new_event['title'];
!                                                       
$event_description=$new_event['description'];
                                                        break;
                                                case MSG_REJECTED:
--- 2262,2276 ----
                                                        $action_date = 
$old_event_date;
                                                        $body = lang ('Your 
meeting scheduled for') .' '. $old_event_date .' '. lang('has been canceled');
!                                                       $method = 'cancel';
                                                        break;
                                                case MSG_MODIFIED:
                                                        $action_date = 
$new_event_date;
                                                        $body = lang ('Your 
meeting that had been scheduled for').' '.$old_event_date.' '. lang('has been 
rescheduled to') .' '.$new_event_date;
!                                                       $method = 'request';
                                                        break;
                                                case MSG_ADDED:
                                                        $action_date = 
$new_event_date;
                                                        $body = lang ('You have 
a meeting scheduled for').' '. $new_event_date;
!                                                       $method = 'request';
                                                        break;
                                                case MSG_REJECTED:
***************
*** 2234,2252 ****
                                                        $body = 'On 
'.$GLOBALS['phpgw']->common->show_date(time() - 
$GLOBALS['phpgw']->datetime->tz_offset).' 
'.$GLOBALS['phpgw']->common->grab_owner_name($GLOBALS['phpgw_info']['user']['account_id']).'
 '.$action.' your meeting request for '.$old_event_date;
                                                        $body = lang('On %1 %2 
%3 your meeting request for %4',$GLOBALS['phpgw']->common->show_date(time() - 
$GLOBALS['phpgw']->datetime->tz_offset),$GLOBALS['phpgw']->common->grab_owner_name($GLOBALS['phpgw_info']['user']['account_id']),lang($action),$old_event_date);
!                                                       
$event_head=$old_event['title'];
!                                                       
$event_description=$old_event['description'];
                                                        break;
                                        }
                                        $subject = lang('Calendar Event') . ' 
('. lang($action) .') #'.$event_id.': '.$action_date.' (L)';
!                                       
if(isset($part_prefs['calendar']['send_extra']) && 
$part_prefs['calendar']['send_extra'])
                                        {
!                                               $body .= 
"\n\n".'***'.lang('Please confirm,accept,reject or examine changes in the 
corresponding entry in your calendar').'***'."\n\n"
!                                                       . '----'.lang('Event 
Details Follow').'----';
!                                               $body .= ($new_event_date ? 
"\n\n".lang('Start- and Enddates').":\n".$new_event_date.' -- '. $new_event_end 
: '');
!                                               $body .= 
($event_head?"\n\n".lang('TITLE').':'."\n".'        '.$event_head:'');
!                                               $body .= 
($event_description?"\n\n".lang('DESCRIPTION').':'."\n".'        
'.$event_description:'');
!                                               $body .= 
($event_participants?"\n\n".lang('Participants').':'."\n".'        
'.$event_participants:'');
!                                       }
!                                       $returncode = 
$send->msg('email',$to,$subject,$body,$msgtype,'','','',$sender);
                                }
                        }
--- 2280,2324 ----
                                                        $body = 'On 
'.$GLOBALS['phpgw']->common->show_date(time() - 
$GLOBALS['phpgw']->datetime->tz_offset).' 
'.$GLOBALS['phpgw']->common->grab_owner_name($GLOBALS['phpgw_info']['user']['account_id']).'
 '.$action.' your meeting request for '.$old_event_date;
                                                        $body = lang('On %1 %2 
%3 your meeting request for %4',$GLOBALS['phpgw']->common->show_date(time() - 
$GLOBALS['phpgw']->datetime->tz_offset),$GLOBALS['phpgw']->common->grab_owner_name($GLOBALS['phpgw_info']['user']['account_id']),lang($action),$old_event_date);
!                                                       $method = 'reply';
                                                        break;
+                                               default:
+                                                       $method = 'publish';
                                        }
                                        $subject = lang('Calendar Event') . ' 
('. lang($action) .') #'.$event_id.': '.$action_date.' (L)';
!                                       list($subject,$body) = 
split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2);
!                                       $subject = 
$send->encode_subject($subject);
!                                       
switch($part_prefs['calendar']['update_format'])
                                        {
!                                               case  'extended':
!                                                       $body .= 
"\n\n".lang('Event Details follow').":\n";
!                                                       foreach($event_arr as 
$key => $val)
!                                                       {
!                                                               if ($key != 
'access' && $key != 'priority')
!                                                               {
!                                                                       $body 
.= sprintf("%-20s %s\n",$val['field'].':',$details[$key]);
!                                                               }
!                                                       }
!                                                       break;
! 
!                                               case 'ical':
!                                                       $content_type = 
"calendar; method=$method; name=calendar.ics";
! /* would be nice, need to get it working
!                                                       if ($body != '')
!                                                       {
!                                                               $boundary = 
'----Message-Boundary';
!                                                               $body .= 
"\n\n\n$boundary\nContent-type: text/$content_type\n".
!                                                                       
"Content-Disposition: inline\nContent-transfer-encoding: 7BIT\n\n";
!                                                               $content_type = 
'';
!                                                       }
! */
!                                                       $body = 
ExecMethod('calendar.boicalendar.export',array(
!                                                               'l_event_id'  
=> $event['id'],
!                                                               'method'      
=> $method,
!                                                               'chunk_split' 
=> False
!                                                       ));
!                                                       break;
!                                       }
!                                       $returncode = 
$send->msg('email',$to,$subject,$body,''/*$msgtype*/,'','','',$sender, 
$content_type/*,$boundary*/);
!                                       //echo "<p>send(to='$to', 
sender='$sender'<br>subject='$subject') 
returncode=$returncode<br>".nl2br($body)."</p>\n";
                                }
                        }
***************
*** 2388,2395 ****
                        if(is_array($event_ids))
                        {
!                       foreach($event_ids as $key => $id)
!                       {
!                               $events[$id] = $this->so->cal->fetch_event($id);
!                       }
                        }
                        unset($event_ids);
--- 2460,2467 ----
                        if(is_array($event_ids))
                        {
!                               foreach($event_ids as $key => $id)
!                               {
!                                       $events[$id] = 
$this->so->cal->fetch_event($id);
!                               }
                        }
                        unset($event_ids);
***************
*** 2398,2405 ****
                        if(is_array($rep_event_ids))
                        {
!                       foreach($rep_event_ids as $key => $id)
!                       {
!                               $events[$id] = $this->so->cal->fetch_event($id);
!                       }
                        }
                        unset($rep_event_ids);
--- 2470,2477 ----
                        if(is_array($rep_event_ids))
                        {
!                               foreach($rep_event_ids as $key => $id)
!                               {
!                                       $events[$id] = 
$this->so->cal->fetch_event($id);
!                               }
                        }
                        unset($rep_event_ids);
***************
*** 2477,2480 ****
--- 2549,2821 ----
  
                        return $users + $groups;        // users first and then 
groups, both alphabeticaly
+               }
+               
+               /*!
+               @function event2array
+               @abstract create array with name, translated name and readable 
content of each attributes of an event
+               @syntax event2array($event,$sep='<br>')
+               @param $event event to use
+               @returns array of attributes with fieldname as key and array 
with the 'field'=translated name \
+                       'data' = readable content (for participants this is an 
array !)
+               */
+               function event2array($event)
+               {
+                       $var['title'] = Array(
+                               'field'         => lang('Title'),
+                               'data'          => $event['title']
+                       );
+ 
+                       // Some browser add a \n when its entered in the 
database. Not a big deal
+                       // this will be printed even though its not needed.
+                       if ($event['description'])
+                       {
+                               $var['description'] = Array(
+                                       'field' => lang('Description'),
+                                       'data'  => $event['description']
+                               );
+                       }
+ 
+                       if ($event['category'])
+                       {
+                               $cats = Array();
+                               
$this->cat->categories($this->bo->owner,'calendar');
+                               if(strpos($event['category'],','))
+                               {
+                                       $cats = explode(',',$event['category']);
+                               }
+                               else
+                               {
+                                       $cats[] = $event['category'];
+                               }
+                               foreach($cats as $cat_id)
+                               {
+                                       list($cat) = 
$this->cat->return_single($cat_id);
+                                       $cat_string[] = $cat['name'];
+                               }
+                               $var['category'] = Array(
+                                       'field' => lang('Category'),
+                                       'data'  => implode(', ',$cat_string)
+                               );
+                       }
+ 
+                       if ($event['location'])
+                       {
+                               $var['location'] = Array(
+                                       'field' => lang('Location'),
+                                       'data'  => $event['location']
+                               );
+                       }
+                       $var['startdate'] = Array(
+                               'field' => lang('Start Date/Time'),
+                               'data'  => 
$GLOBALS['phpgw']->common->show_date($this->maketime($event['start']) - 
$GLOBALS['phpgw']->datetime->tz_offset),
+                       );
+       
+                       $var['enddate'] = Array(
+                               'field' => lang('End Date/Time'),
+                               'data'  => 
$GLOBALS['phpgw']->common->show_date($this->maketime($event['end']) - 
$GLOBALS['phpgw']->datetime->tz_offset)
+                       );
+ 
+                       $pri = Array(
+                               1       => lang('Low'),
+                               2       => lang('Normal'),
+                               3       => lang('High')
+                       );
+                       $var['priority'] = Array(
+                               'field' => lang('Priority'),
+                               'data'  => $pri[$event['priority']]
+                       );
+ 
+                       $var['owner'] = Array(
+                               'field' => lang('Created By'),
+                               'data'  => 
$GLOBALS['phpgw']->common->grab_owner_name($event['owner'])
+                       );
+       
+                       $var['updated'] = Array(
+                               'field' => lang('Updated'),
+                               'data'  => 
$GLOBALS['phpgw']->common->show_date($this->maketime($event['modtime']) - 
$GLOBALS['phpgw']->datetime->tz_offset)
+                       );
+ 
+                       $var['access'] = Array(
+                               'field' => lang('Access'),
+                               'data'  => $event['public'] ? lang('Public') : 
lang('Privat')
+                       );
+ 
+                       if(@isset($event['groups'][0]))
+                       {
+                               $cal_grps = '';
+                               for($i=0;$i<count($event['groups']);$i++)
+                               {
+                                       
if($GLOBALS['phpgw']->accounts->exists($event['groups'][$i]))
+                                       {
+                                               $cal_grps .= 
($i>0?'<br>':'').$GLOBALS['phpgw']->accounts->id2name($event['groups'][$i]);
+                                       }
+                               }
+       
+                               $var['groups'] = Array(
+                                       'field' => lang('Groups'),
+                                       'data'  => $cal_grps
+                               );
+                       }
+ 
+                       $participants = array();
+                       foreach($event['participants'] as $user => 
$short_status)
+                       {
+                               if($GLOBALS['phpgw']->accounts->exists($user))
+                               {
+                                       $participants[$user] = 
$GLOBALS['phpgw']->common->grab_owner_name($user).' 
('.$this->get_long_status($short_status).')';
+                               }
+                       }
+                       $var['participants'] = Array(
+                               'field' => lang('Participants'),
+                               'data'  => $participants
+                       );
+ 
+                       // Repeated Events
+                       if($event['recur_type'] != MCAL_RECUR_NONE)
+                       {
+                               $rpt_type = Array(
+                                       MCAL_RECUR_NONE         => 'none',
+                                       MCAL_RECUR_DAILY        => 'daily',
+                                       MCAL_RECUR_WEEKLY       => 'weekly',
+                                       MCAL_RECUR_MONTHLY_WDAY => 
'monthlybyday',
+                                       MCAL_RECUR_MONTHLY_MDAY => 
'monthlybydate',
+                                       MCAL_RECUR_YEARLY       => 'yearly'
+                               );
+                               $str = lang($rpt_type[$event['recur_type']]);
+ 
+                               $str_extra = '';
+                               if ($event['recur_enddate']['mday'] != 0 && 
$event['recur_enddate']['month'] != 0 && $event['recur_enddate']['year'] != 0)
+                               {
+                                       $recur_end = 
$this->bo->maketime($event['recur_enddate']);
+                                       if($recur_end != 0)
+                                       {
+                                               $recur_end -= 
$GLOBALS['phpgw']->datetime->tz_offset;
+                                               $str_extra .= lang('ends').': 
'.lang($GLOBALS['phpgw']->common->show_date($recur_end,'l')).', 
'.lang($GLOBALS['phpgw']->common->show_date($recur_end,'F')).' 
'.$GLOBALS['phpgw']->common->show_date($recur_end,'d, Y').' ';
+                                       }
+                               }
+                               if($event['recur_type'] == MCAL_RECUR_WEEKLY || 
$event['recur_type'] == MCAL_RECUR_DAILY)
+                               {
+                                       $repeat_days = '';
+                                       
if($this->bo->prefs['calendar']['weekdaystarts'] == 'Sunday')
+                                       {
+                                               if (!!($event['recur_data'] & 
MCAL_M_SUNDAY) == True)
+                                               {
+                                                       
$this->view_add_day(lang('Sunday'),$repeat_days);
+                                               }
+                                       }
+                                       if (!!($event['recur_data'] & 
MCAL_M_MONDAY) == True)
+                                       {
+                                               
$this->view_add_day(lang('Monday'),$repeat_days);
+                                       }
+                                       if (!!($event['recur_data'] & 
MCAL_M_TUESDAY) == True)
+                                       {
+                                               
$this->view_add_day(lang('Tuesday'),$repeat_days);
+                                       }
+                                       if (!!($event['recur_data'] & 
MCAL_M_WEDNESDAY) == True)
+                                       {
+                                               
$this->view_add_day(lang('Wednesday'),$repeat_days);
+                                       }
+                                       if (!!($event['recur_data'] & 
MCAL_M_THURSDAY) == True)
+                                       {
+                                               
$this->view_add_day(lang('Thursday'),$repeat_days);
+                                       }
+                                       if (!!($event['recur_data'] & 
MCAL_M_FRIDAY) == True)
+                                       {
+                                               
$this->view_add_day(lang('Friday'),$repeat_days);
+                                       }
+                                       if (!!($event['recur_data'] & 
MCAL_M_SATURDAY) == True)
+                                       {
+                                               
$this->view_add_day(lang('Saturday'),$repeat_days);
+                                       }
+                                       
if($this->bo->prefs['calendar']['weekdaystarts'] != 'Sunday')
+                                       {
+                                               if (!!($event['recur_data'] & 
MCAL_M_SUNDAY) == True)
+                                               {
+                                                       
$this->view_add_day(lang('Sunday'),$repeat_days);
+                                               }
+                                       }
+                                       if($repeat_days <> '')
+                                       {
+                                               $str_extra .= lang('days 
repeated').': '.$repeat_days;
+                                       }
+                               }
+                               if($event['recur_interval'] != 0)
+                               {
+                                       $str_extra .= lang('Interval').': 
'.$event['recur_interval'];
+                               }
+ 
+                               if($str_extra)
+                               {
+                                       $str .= ' ('.$str_extra.')';
+                               }
+ 
+                               $var['repetition'] = Array(
+                                       'field' => lang('Repetition'),
+                                       'data'  => $str,
+                               );
+                       }
+                       return $var;
+               }
+               
+               /*!
+               @function check_set_default_prefs
+               @abstract sets the default prefs, if they are not already set 
(on a per pref. basis)
+               @note It sets a flag in the app-session-data to be called only 
once per session
+               */
+               function check_set_default_prefs()
+               {
+                       if (($set = 
$GLOBALS['phpgw']->session->appsession('default_prefs_set','calendar')))
+                       {
+                               return;
+                       }
+                       
$GLOBALS['phpgw']->session->appsession('default_prefs_set','calendar','set');
+ 
+                       $default_prefs = 
$GLOBALS['phpgw']->preferences->default['calendar'];
+                       
+                       $subject = lang('Calendar Event') . ' - $$action$$: 
$$startdate$$ $$title$$'."\n";
+                       $defaults = array(
+                               'defaultcalendar' => 'week',
+                               'mainscreen_showevents' => '0',
+                               'summary'         => 'no',
+                               'receive_updates' => 'no',
+                               'update_format'   => 'ical',
+                               'notifyAdded'     => $subject . lang ('You have 
a meeting scheduled for %1','$$startdate$$'),
+                               'notifyCanceled'  => $subject . lang ('Your 
meeting scheduled for %1 has been canceled','$$startdate$$'),
+                               'notifyModified'  => $subject . lang ('Your 
meeting that had been scheduled for %1 has been rescheduled to 
%2','$$olddate$$','$$startdate$$'),
+                               'notifyResponse'  => $subject . lang ('On %1 %2 
%3 your meeting request for 
%4','$$date$$','$$fullname$$','$$action$$','$$startdate$$'),
+                               'show_rejected'   => '0',
+                               'display_status'  => '1',
+                               'weekdaystarts'   => 'Monday',
+                               'workdaystarts'   => '9',
+                               'workdayends'     => '17',
+                               'interval'        => '30',
+                               'defaultlength'   => '60',
+                               'planner_start_with_group' => 
$GLOBALS['phpgw']->accounts->name2id('Default'),
+                               'planner_intervals_per_day'=> '4',
+                               'defaultfilter'   => 'all',
+                               'default_private' => '0',
+                               'display_minicals'=> '1',
+                               'print_black_white'=>'0'
+                       );
+                       foreach($defaults as $var => $default)
+                       {
+                               if (!isset($default_prefs[$var]) || 
$default_prefs[$var] == '')
+                               {
+                                       
$GLOBALS['phpgw']->preferences->add('calendar',$var,$default,'default');
+                                       $need_save = True;
+                               }
+                       }
+                       if ($need_save)
+                       {
+                               $prefs = 
$GLOBALS['phpgw']->preferences->save_repository(False,'default');
+                               $this->prefs['calendar'] = $prefs['calendar'];
+                       }
+                       if ($this->prefs['calendar']['send_updates'] && 
!isset($this->prefs['calendar']['receive_updates']))
+                       {
+                               $this->prefs['calendar']['receive_updates'] = 
$this->prefs['calendar']['send_updates'];
+                               
$GLOBALS['phpgw']->preferences->add('calendar','receive_updates',$this->prefs['calendar']['send_updates']);
+                               
$GLOBALS['phpgw']->preferences->delete('calendar','send_updates');
+                               $prefs = 
$GLOBALS['phpgw']->preferences->save_repository();
+                       }
                }
        }

Index: class.boicalendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.boicalendar.inc.php,v
retrieving revision 1.16.2.4
retrieving revision 1.16.2.4.2.1
diff -C2 -r1.16.2.4 -r1.16.2.4.2.1
*** class.boicalendar.inc.php   24 Jun 2002 09:52:54 -0000      1.16.2.4
--- class.boicalendar.inc.php   19 May 2003 23:29:22 -0000      1.16.2.4.2.1
***************
*** 98,101 ****
--- 98,102 ----
        var $debug_str = False;
        var $api = True;
+       var $chunk_split = True;
        
        /*
***************
*** 1294,1298 ****
        function fold($str)
        {
!               return chunk_split($str,FOLD_LENGTH,"\r\n");
        }
  
--- 1295,1299 ----
        function fold($str)
        {
!                return $this->chunk_split==True ? 
chunk_split($str,FOLD_LENGTH,"\r\n") : $str."\r\n";
        }
  
***************
*** 2275,2300 ****
                        {
                                case 'NEEDS-ACTION':
!                                       return NEEDS_ACTION;
                                        break;
                                case 'ACCEPTED':
!                                       return ACCEPTED;
                                        break;
                                case 'DECLINED':
!                                       return DECLINED;
                                        break;
                                case 'TENTATIVE':
!                                       return TENTATIVE;
                                        break;
                                case 'DELEGATED':
!                                       return DELEGATED;
                                        break;
                                case 'COMPLETED':
!                                       return COMPLETED;
                                        break;
                                case 'IN-PROCESS':
!                                       return IN_PROCESS;
                                        break;
                                default:
!                                       return OTHER;
                                        break;
                        }
--- 2276,2301 ----
                        {
                                case 'NEEDS-ACTION':
!                                  return 0; // NEEDS_ACTION;
                                        break;
                                case 'ACCEPTED':
!                                  return 1; // ACCEPTED;
                                        break;
                                case 'DECLINED':
!                                  return 2; // DECLINED;
                                        break;
                                case 'TENTATIVE':
!                                  return 3; // TENTATIVE;
                                        break;
                                case 'DELEGATED':
!                                       return 4; // DELEGATED;
                                        break;
                                case 'COMPLETED':
!                                       return 5; // COMPLETED;
                                        break;
                                case 'IN-PROCESS':
!                                       return 6; // IN_PROCESS;
                                        break;
                                default:
!                                       return 99; // OTHER;
                                        break;
                        }
***************
*** 2304,2326 ****
                        switch(intval($var))
                        {
!                               case NEEDS_ACTION:
                                        return 'NEEDS-ACTION';
                                        break;
!                               case ACCEPTED:
                                        return 'ACCEPTED';
                                        break;
!                               case DECLINED:
                                        return 'DECLINED';
                                        break;
!                               case TENTATIVE:
                                        return 'TENTATIVE';
                                        break;
!                               case DELEGATED:
                                        return 'DELEGATED';
                                        break;
!                               case COMPLETED:
                                        return 'COMPLETED';
                                        break;
!                               case IN_PROCESS:
                                        return 'IN-PROCESS';
                                        break;
--- 2305,2327 ----
                        switch(intval($var))
                        {
!                       case 0: // NEEDS_ACTION:
                                        return 'NEEDS-ACTION';
                                        break;
!                       case 1: //  ACCEPTED:
                                        return 'ACCEPTED';
                                        break;
!                       case 2: // DECLINED:
                                        return 'DECLINED';
                                        break;
!                       case 3: // TENTATIVE:
                                        return 'TENTATIVE';
                                        break;
!                       case 4: // DELEGATED:
                                        return 'DELEGATED';
                                        break;
!                       case 5: // COMPLETED:
                                        return 'COMPLETED';
                                        break;
!                       case 6: // IN_PROCESS:
                                        return 'IN-PROCESS';
                                        break;
***************
*** 3206,3212 ****
                }
  
!               function export($l_event_id=0)
                {
!                       $event_id = 
($l_event_id?$l_event_id:$GLOBALS['HTTP_GET_VARS']['cal_id']);
  
                        $string_array = Array(
--- 3207,3215 ----
                }
  
!               function export($params)
                {
!                       $event_id = 
($params['l_event_id']?$params['l_event_id']:$GLOBALS['HTTP_GET_VARS']['cal_id']);
!                       $this->chunk_split = $params['chunk_split'];
!                       $method = 
($params['method']?$params['method']:"publish");
  
                        $string_array = Array(
***************
*** 3233,3237 ****
                        
$this->set_var($ical['prodid'],'value','-//phpGroupWare//phpGroupWare 
'.$setup_info['calendar']['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('publish'));
  
                        
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['uicalendar'])
--- 3236,3240 ----
                        
$this->set_var($ical['prodid'],'value','-//phpGroupWare//phpGroupWare 
'.$setup_info['calendar']['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));
  
                        
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['uicalendar'])
***************
*** 3274,3284 ****
                                }
  
                                $ical_event['priority'] = $event['priority'];
                                $ical_event['class'] = intval($event['public']);
!                               $dtstart_mktime = 
$so_event->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
                                
$this->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
!                               $dtend_mktime = 
$so_event->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
                                
$this->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
!                               $mod_mktime = 
$so_event->maketime($event['modtime']) - $GLOBALS['phpgw']->datetime->tz_offset;
                                
$this->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
                                @reset($string_array);
--- 3277,3298 ----
                                }
  
+                               // use system's date info for caluculating 
local timezone's offset in minutes
+                               //
+                               $gmt_offset = 
date('O',$GLOBALS['phpgw']->datetime->users_localtime);  // offset to GMT
+                               $offset = intval(substr($gmt_offset, 1, 2)) * 
60 + intval(substr($gmt_offset, 3, 2));
+                               if ($offset > 0)
+                               {
+                                       $event['start']['min']   -= $offset;
+                                       $event['end']['min']     -= $offset;
+                                       $event['modtime']['min'] -= $offset;
+                               }
+ 
                                $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);
***************
*** 3314,3322 ****
                                        while(list($part,$status) = 
each($event['participants']))
                                        {
!                                               
$GLOBALS['phpgw']->accounts->get_account_name($accountid,$lid,$fname,$lname);
                                                $name = $fname.' '.$lname;
                                                $owner_status = 
$this->switch_partstat(intval($this->switch_phpgw_status($event['participants'][$part])));
!                                               $owner_mailto = 
'address@hidden';
!                                               $str = 
'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$owner_mailto;
                                                if($part == $event['owner'])
                                                {
--- 3328,3340 ----
                                        while(list($part,$status) = 
each($event['participants']))
                                        {
!                                               
$GLOBALS['phpgw']->accounts->get_account_name($part,$lid,$fname,$lname);
                                                $name = $fname.' '.$lname;
+ 
                                                $owner_status = 
$this->switch_partstat(intval($this->switch_phpgw_status($event['participants'][$part])));
! 
!                                               $mail_prefs = 
$GLOBALS['phpgw']->preferences->create_email_preferences($part);
!                                               $mailto = 
$mail_prefs['email']['address'];
! 
!                                               $str = 
'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$mailto;
                                                if($part == $event['owner'])
                                                {
***************
*** 3327,3331 ****
                                                        $str = 
'ROLE=REQ-PARTICIPANT;'.$str;
                                                }
!                                               
$this->parse_value($ical_event,'attendee',$str,'vevent');
                                                if($part == $event['owner'])
                                                {
--- 3345,3352 ----
                                                        $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'])
                                                {

Index: class.socalendar__.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.socalendar__.inc.php,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.1.2.1
diff -C2 -r1.11.2.1 -r1.11.2.1.2.1
*** class.socalendar__.inc.php  23 Jun 2002 20:28:43 -0000      1.11.2.1
--- class.socalendar__.inc.php  19 May 2003 23:29:22 -0000      1.11.2.1.2.1
***************
*** 41,45 ****
        define('MCAL_M_SATURDAY',64);
        
!       define('MCAL_M_WEEKDAYS',63);
        define('MCAL_M_WEEKEND',65);
        define('MCAL_M_ALLDAYS',127);
--- 41,45 ----
        define('MCAL_M_SATURDAY',64);
        
!       define('MCAL_M_WEEKDAYS',62);
        define('MCAL_M_WEEKEND',65);
        define('MCAL_M_ALLDAYS',127);

Index: class.uicalendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.uicalendar.inc.php,v
retrieving revision 1.66.2.55.2.10
retrieving revision 1.66.2.55.2.11
diff -C2 -r1.66.2.55.2.10 -r1.66.2.55.2.11
*** class.uicalendar.inc.php    7 May 2003 11:00:33 -0000       1.66.2.55.2.10
--- class.uicalendar.inc.php    19 May 2003 23:29:23 -0000      1.66.2.55.2.11
***************
*** 78,81 ****
--- 78,82 ----
                        'set_action' => True,
                        'planner' => True,
+                       'modify_ext_partlist' => True,
                        'matrixselect'  => True,
                        'viewmatrix'    => True,
***************
*** 95,98 ****
--- 96,100 ----
  
                        $this->bo = CreateObject('calendar.bocalendar',1);
+                       $this->cat = &$this->bo->cat;
  
                        print_debug('BO Owner',$this->bo->owner);
***************
*** 100,104 ****
                        $this->template = $GLOBALS['phpgw']->template;
                        $this->template_dir = 
$GLOBALS['phpgw']->common->get_tpl_dir('calendar');
-                       $this->cat      = CreateObject('phpgwapi.categories');
  
                        $this->holiday_color = 
(substr($this->theme['bg06'],0,1)=='#'?'':'#').$this->theme['bg06'];
--- 102,105 ----
***************
*** 950,954 ****
  //                            }
  
!                               $content = 
ExecMethod('calendar.boicalendar.export',$GLOBALS['HTTP_POST_VARS']['cal_id']);
                                $vfs->cd(array('string' => '/', 
                                                        'relatives' => 
array(RELATIVE_USER)
--- 951,961 ----
  //                            }
  
!                               $content = 
ExecMethod('calendar.boicalendar.export', 
!                                                                               
         Array(
!                                                                               
                         'l_event_id' => $GLOBALS['HTTP_POST_VARS']['cal_id'],
!                                                                               
                         'chunk_split' => False,
!                                                                               
                         )
!                                                                               
         );
! 
                                $vfs->cd(array('string' => '/', 
                                                        'relatives' => 
array(RELATIVE_USER)
***************
*** 958,962 ****
                                                        'content' => $content
                                                        ));
! //                            $vfs->write($output_file, array 
(RELATIVE_USER_APP), $content);
                                if($this->debug)
                                {
--- 965,969 ----
                                                        'content' => $content
                                                        ));
! 
                                if($this->debug)
                                {
***************
*** 1129,1136 ****
                                $can_edit = True;
  
!                               $thishour = 
(isset($GLOBALS['HTTP_GET_VARS']['hour'])?intval($GLOBALS['HTTP_GET_VARS']['hour']):0);
!                               $thisminute = 
(isset($GLOBALS['HTTP_GET_VARS']['minute'])?intval($GLOBALS['HTTP_GET_VARS']['minute']):0);
!                               
$this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$thishour,$thisminute,0);
!                               
$this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$thishour,$thisminute,0);
                                $this->bo->set_title('');
                                $this->bo->set_description('');
--- 1136,1146 ----
                                $can_edit = True;
  
!                               $starthour = 
intval(get_var('hour',array('GET'),$this->bo->prefs['calendar']['workdaystarts']));
!                               $startmin  = 
intval(get_var('minute',array('GET'),0));
!                               $endmin    = $startmin + 
intval($this->bo->prefs['calendar']['defaultlength']);
!                               $endhour   = $starthour + 
$this->bo->normalizeminutes($endmin);
!                               ;
!                               
$this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0);
!                               
$this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0);
                                $this->bo->set_title('');
                                $this->bo->set_description('');
***************
*** 1167,1171 ****
  
                        $date = 
sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day);
- //                    if(($GLOBALS['HTTP_GET_VARS']['cal_id'] > 0) && 
($event['owner'] == $this->bo->owner) && 
$this->bo->check_perms(PHPGW_ACL_DELETE))
                        
if($this->bo->check_perms(PHPGW_ACL_DELETE,$cal_id=intval($GLOBALS['HTTP_GET_VARS']['cal_id'])))
                        {
--- 1177,1180 ----
***************
*** 2050,2079 ****
                        $parts = Array();
                        $acct = 
CreateObject('phpgwapi.accounts',$this->bo->owner);
!                       $c_participants = count($participants);
!                       foreach($participants as $participant)
                        {
!                               switch 
($GLOBALS['phpgw']->accounts->get_type($participant))
                                {
!                                       case 'g':
!                                               if ($members = 
$acct->member(intval($participant)))
!                                               {
!                                                       foreach($members as 
$member)
                                                        {
!                                                               
if($this->bo->check_perms(PHPGW_ACL_READ,0,$member['account_id']))
                                                                {
!                                                                       
$parts[$member['account_id']] = True;
                                                                }
                                                        }
!                                               }
!                                               break;
!                                       case 'u':
!                                               
if($this->bo->check_perms(PHPGW_ACL_READ,0,$participant))
!                                               {
!                                                       $parts[$participant] = 
1;
!                                               }
!                                               break;
                                }
                        }
-                       unset($acct);
                        $participants = array_keys($parts);     // get id's as 
values and a numeric index
  
--- 2059,2091 ----
                        $parts = Array();
                        $acct = 
CreateObject('phpgwapi.accounts',$this->bo->owner);
!                       
!                       if (is_array($participants))
                        {
!                               foreach($participants as $participant)
                                {
!                                       switch 
($GLOBALS['phpgw']->accounts->get_type($participant))
!                                       {
!                                               case 'g':
!                                                       if ($members = 
$acct->member(intval($participant)))
                                                        {
!                                                               
foreach($members as $member)
                                                                {
!                                                                       
if($this->bo->check_perms(PHPGW_ACL_READ,0,$member['account_id']))
!                                                                       {
!                                                                               
$parts[$member['account_id']] = True;
!                                                                       }
                                                                }
                                                        }
!                                                       break;
!                                               case 'u':
!                                                       
if($this->bo->check_perms(PHPGW_ACL_READ,0,$participant))
!                                                       {
!                                                               
$parts[$participant] = 1;
!                                                       }
!                                                       break;
!                                       }
                                }
+                               unset($acct);
                        }
                        $participants = array_keys($parts);     // get id's as 
values and a numeric index
  
***************
*** 3106,3121 ****
                        }
  
-                       $pri = Array(
-                               1       => lang('Low'),
-                               2       => lang('Normal'),
-                               3       => lang('High')
-                       );
- 
                        $p = &$GLOBALS['phpgw']->template;
  
                        $p->set_file(
                                Array(
!                                       'view'  => 'view.tpl'
!                               )
                        );
                        $p->set_block('view','view_event','view_event');
--- 3118,3127 ----
                        }
  
                        $p = &$GLOBALS['phpgw']->template;
  
                        $p->set_file(
                                Array(
!                                       'view'  => 'view.tpl'
!                               )
                        );
                        $p->set_block('view','view_event','view_event');
***************
*** 3123,3322 ****
                        $p->set_block('view','hr','hr');
  
!                       $var[] = Array(
!                               'tr_color'      => $this->theme['th_bg'],
!                               'field'         => lang('Title'),
!                               'data'          => $event['title']
!                       );
  
!                       // Some browser add a \n when its entered in the 
database. Not a big deal
!                       // this will be printed even though its not needed.
!                       if ($event['description'])
!                       {
!                               $var[] = Array(
!                                       'field' => lang('Description'),
!                                       'data'  => $event['description']
!                               );
!                       }
  
!                       if ($event['category'])
                        {
!                               $category = Array();
!                               
$this->cat->categories($this->bo->owner,'calendar');
!                               if(strpos($event['category'],','))
!                               {
!                                       $category = 
explode(',',$event['category']);
!                               }
!                               else
!                               {
!                                       $category[] = $event['category'];
!                               }
!                               @reset($category);
!                               while(list($key,$cat) = each($category))
                                {
!                                       $_cat = $this->cat->return_single($cat);
!                                       $cat_string[] = $_cat[0]['name'];
                                }
-                               @reset($cat_string);
-                               $var[] = Array(
-                                       'field' => lang('Category'),
-                                       'data'  => implode(',',$cat_string)
-                               );
                        }
! 
!                       if ($event['location'])
!                       {
!                               $var[] = Array(
!                                       'field' => lang('Location'),
!                                       'data'  => $event['location']
!                               );
!                       }
!                       $var[] = Array(
!                               'field' => lang('Start Date/Time'),
!                               'data'  => 
$GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - 
$GLOBALS['phpgw']->datetime->tz_offset)
!                       );
!       
!                       $var[] = Array(
!                               'field' => lang('End Date/Time'),
!                               'data'  => 
$GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - 
$GLOBALS['phpgw']->datetime->tz_offset)
!                       );
! 
!                       $var[] = Array(
!                               'field' => lang('Priority'),
!                               'data'  => $pri[$event['priority']]
!                       );
! 
!                       $var[] = Array(
!                               'field' => lang('Created By'),
!                               'data'  => 
$GLOBALS['phpgw']->common->grab_owner_name($event['owner'])
!                       );
!       
!                       $var[] = Array(
!                               'field' => lang('Updated'),
!                               'data'  => 
$GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['modtime']) - 
$GLOBALS['phpgw']->datetime->tz_offset)
!                       );
! 
!                       $var[] = Array(
!                               'field' => lang('Access'),
!                               'data'  => 
$event['public']==True?lang('Public'):lang('Privat')
!                       );
! 
!                       if(@isset($event['groups'][0]))
!                       {
!                               $cal_grps = '';
!                               for($i=0;$i<count($event['groups']);$i++)
!                               {
!                                       
if($GLOBALS['phpgw']->accounts->exists($event['groups'][$i]))
!                                       {
!                                               $cal_grps .= 
($i>0?'<br>':'').$GLOBALS['phpgw']->accounts->id2name($event['groups'][$i]);
!                                       }
!                               }
!       
!                               $var[] = Array(
!                                       'field' => lang('Groups'),
!                                       'data'  => $cal_grps
!                               );
!                       }
! 
!                       $str = '';
!                       reset($event['participants']);
!                       while (list($user,$short_status) = 
each($event['participants']))
!                       {
!                               if($GLOBALS['phpgw']->accounts->exists($user))
!                               {
!                                       $str .= 
($str?'<br>':'').$GLOBALS['phpgw']->common->grab_owner_name($user).' 
('.($this->bo->check_perms(PHPGW_ACL_EDIT,0,$user)?'<a 
href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$this->bo->get_long_status($short_status).'</a>':$this->bo->get_long_status($short_status)).')'."\n";
!                               }
!                       }
!                       $var[] = Array(
!                               'field' => lang('Participants'),
!                               'data'  => $str
!                       );
! 
!                       // Repeated Events
!                       $rpt_type = Array(
!                               MCAL_RECUR_NONE         => 'none',
!                               MCAL_RECUR_DAILY        => 'daily',
!                               MCAL_RECUR_WEEKLY       => 'weekly',
!                               MCAL_RECUR_MONTHLY_WDAY => 'monthlybyday',
!                               MCAL_RECUR_MONTHLY_MDAY => 'monthlybydate',
!                               MCAL_RECUR_YEARLY       => 'yearly'
!                       );
!                       $str = lang($rpt_type[$event['recur_type']]);
!                       if($event['recur_type'] <> MCAL_RECUR_NONE)
!                       {
!                               $str_extra = '';
!                               if ($event['recur_enddate']['mday'] != 0 && 
$event['recur_enddate']['month'] != 0 && $event['recur_enddate']['year'] != 0)
!                               {
!                                       $recur_end = 
$this->bo->maketime($event['recur_enddate']);
!                                       if($recur_end != 0)
!                                       {
!                                               $recur_end -= 
$GLOBALS['phpgw']->datetime->tz_offset;
!                                               $str_extra .= lang('ends').': 
'.lang($GLOBALS['phpgw']->common->show_date($recur_end,'l')).', 
'.lang($GLOBALS['phpgw']->common->show_date($recur_end,'F')).' 
'.$GLOBALS['phpgw']->common->show_date($recur_end,'d, Y').' ';
!                                       }
!                               }
!                               if($event['recur_type'] == MCAL_RECUR_WEEKLY || 
$event['recur_type'] == MCAL_RECUR_DAILY)
!                               {
!                                       $repeat_days = '';
!                                       
if($this->bo->prefs['calendar']['weekdaystarts'] == 'Sunday')
!                                       {
!                                               if (!!($event['recur_data'] & 
MCAL_M_SUNDAY) == True)
!                                               {
!                                                       
$this->view_add_day(lang('Sunday'),$repeat_days);
!                                               }
!                                       }
!                                       if (!!($event['recur_data'] & 
MCAL_M_MONDAY) == True)
!                                       {
!                                               
$this->view_add_day(lang('Monday'),$repeat_days);
!                                       }
!                                       if (!!($event['recur_data'] & 
MCAL_M_TUESDAY) == True)
!                                       {
!                                               
$this->view_add_day(lang('Tuesday'),$repeat_days);
!                                       }
!                                       if (!!($event['recur_data'] & 
MCAL_M_WEDNESDAY) == True)
!                                       {
!                                               
$this->view_add_day(lang('Wednesday'),$repeat_days);
!                                       }
!                                       if (!!($event['recur_data'] & 
MCAL_M_THURSDAY) == True)
!                                       {
!                                               
$this->view_add_day(lang('Thursday'),$repeat_days);
!                                       }
!                                       if (!!($event['recur_data'] & 
MCAL_M_FRIDAY) == True)
!                                       {
!                                               
$this->view_add_day(lang('Friday'),$repeat_days);
!                                       }
!                                       if (!!($event['recur_data'] & 
MCAL_M_SATURDAY) == True)
!                                       {
!                                               
$this->view_add_day(lang('Saturday'),$repeat_days);
!                                       }
!                                       
if($this->bo->prefs['calendar']['weekdaystarts'] == 'Monday')
!                                       {
!                                               if (!!($event['recur_data'] & 
MCAL_M_SUNDAY) == True)
!                                               {
!                                                       
$this->view_add_day(lang('Sunday'),$repeat_days);
!                                               }
!                                       }
!                                       if($repeat_days <> '')
!                                       {
!                                               $str_extra .= lang('days 
repeated').': '.$repeat_days;
!                                       }
!                               }
!                               if($event['recur_interval'] != 0)
!                               {
!                                       $str_extra .= lang('Interval').': 
'.$event['recur_interval'];
!                               }
! 
!                               if($str_extra)
!                               {
!                                       $str .= ' ('.$str_extra.')';
!                               }
! 
!                               $var[] = Array(
!                                       'field' => lang('Repetition'),
!                                       'data'  => $str
!                               );
!                       }
! 
!                       for($i=0;$i<count($var);$i++)
                        {
!                               
$this->output_template_array($p,'row','list',$var[$i]);
                        }
  
--- 3129,3148 ----
                        $p->set_block('view','hr','hr');
  
!                       $vars = $this->bo->event2array($event);
  
!                       $vars['title']['data']['tr_color'] = 
$this->theme['th_bg'];
  
!                       foreach($vars['participants']['data'] as $user => $str)
                        {
!                               if 
($this->bo->check_perms(PHPGW_ACL_EDIT,0,$user) && ereg('^(.*) 
\((.*)\)$',$str,$parts))
                                {
!                                        $vars['participants']['data'][$user] = 
$parts[1].' (<a 
href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$parts[2].'</a>)';
                                }
                        }
!                       $vars['participants']['data'] = 
implode("<br>\n",$vars['participants']['data']);
!                       
!                       foreach($vars as $var)
                        {
!                               
$this->output_template_array($p,'row','list',$var);
                        }
  
***************
*** 3809,3813 ****
                        $hourformat = substr($this->bo->users_timeformat,0,1);
                        
!                       $sb = CreateObject('phpgwapi.sbox');
  
                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
--- 3635,3640 ----
                        $hourformat = substr($this->bo->users_timeformat,0,1);
                        
!                       // $sb = CreateObject('phpgwapi.sbox');
!                       $sb = CreateObject('phpgwapi.sbox2');
  
                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
***************
*** 3878,3882 ****
                        $var[] = Array(
                                'field' => lang('Category'),
!                               'data'  => '<select name="categories[]" 
multiple size="5"><option value="0">'.lang('Choose the 
category').'</option>'.$this->cat->formated_list('select','all',$check_cats,True).'</select>'
                        );
  
--- 3705,3709 ----
                        $var[] = Array(
                                'field' => lang('Category'),
!                               'data'  => '<select name="categories[]" 
multiple 
size="5">'.$this->cat->formated_list('select','all',$check_cats,True).'</select>'
                        );
  
***************
*** 3987,3990 ****
--- 3814,3861 ----
                                                break;
                                }
+ /*
+ // External Participants
+ 
+                               // FIXME: where does the list of external 
participants come from?
+                               //
+                               $id = '1_h';
+                               $test_contact[$id] = array();
+                               $test_contact[$id]['name'] = "Stephan Cremer";
+                               $id = '3_b';
+                               $test_contact[$id] = array();
+                               $test_contact[$id]['name'] = "Stephan_Uni 
Cremer_Uni";
+ 
+                               $part = "";
+                               $ext_disp = '<textarea 
name="external_participants" rows="5" cols="40" readonly="readonly">'."\n";
+                               while(list($id,$contact) = each($test_contact)) 
{
+                                 $part .= $part!= '' ? ',' : '';
+                                 $part .= $id;
+                                 $ext_disp .= '(FIXME: 
b_OR_h)'.$contact['name']."\n";
+                               }
+                               $ext_disp .= '</textarea>'."\n".'<br>';
+ 
+                               $url = $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'calendar.uiextpartlist.modify'));
+                               // $url = $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'calendar.uicalendar.modify_ext_partlist'));
+                               $mod_ext = '<script language="JavaScript">'."\n"
+                                                       . 'function 
modify_window(url) {'."\n"
+                                                       . '   
document.addform.ext_part_id.value="";'."\n"
+                                                       . '   awin = 
window.open(url,"modify","width=500,height=400,toolbar=no,resizable=yes");'."\n"
+ // DEBUG START
+ . '}'."\n".'function show() {'."\n"
+ . '   alert("Participants: " + document.addform.ext_part_id.value);'."\n"
+ // DEBUG END
+                                                       . 
'}'."\n</script>\n".$ext_disp."\n"
+ // DEBUG START
+ . '<input type="button" value="Status" onClick="javascript:show()">'."\n"
+ // DEBUG END
+                                                       . '<input type="button" 
onClick="javascript:modify_window(\''.$url.'&part='.$part
+                                                       . '\')" 
value="'.lang('Modify List of External Participants').'">'."\n"
+                                                       . '<input type="hidden" 
name="ext_part_id" value="'.$part.'">'."\n";
+ 
+                               $var[] = Array(
+                                       'field' => "\n".lang('External 
Participants'),
+                                       'data'  => "\n".$mod_ext."\n"
+                               );
+ */
  // I Participate
                                if((($event['id'] > 0) && 
isset($event['participants'][$event['owner']])) || !$event['id'])
***************
*** 4044,4053 ****
                        $var[] = Array(
                                'field' => lang('Repeat End Date'),
!                               'data'  => '<input type="checkbox" 
name="cal[rpt_use_end]" value="y"'.$checked.'>'.lang('Use End Date').'  '
!                                  .$GLOBALS['phpgw']->common->dateformatorder(
!                                
$sb->getYears('recur_enddate[year]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'Y'))),
!                          
$sb->getMonthText('recur_enddate[month]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'n'))),
!                   
$sb->getDays('recur_enddate[mday]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'d')))
!                )
                        );
  
--- 3915,3924 ----
                        $var[] = Array(
                                'field' => lang('Repeat End Date'),
!                               'data'  => '<input type="checkbox" 
name="cal[rpt_use_end]" value="y"'.$checked.'>'.lang('Use End Date').'  '.
!                                       
$GLOBALS['phpgw']->common->dateformatorder(
!                                               
$sb->getYears('recur_enddate[year]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'Y'))),
!                                               
$sb->getMonthText('recur_enddate[month]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'n'))),
!                                               
$sb->getDays('recur_enddate[mday]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'d')))
!                                       )
                        );
  
***************
*** 4102,4105 ****
--- 3973,4142 ----
                        $p->set_var('cancel_button',$cancel_button);
                        $p->pparse('out','edit_entry');
+               }
+ 
+               // modify list of an event's external participants (i.e. non 
pgpgw users)
+               //
+               function modify_ext_partlist()
+               {
+                       $GLOBALS['phpgw_info']['flags']['noheader'] = True;
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
+                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+ 
+                       $total_contacts = 0;
+                       $participant = array();
+                       $control_data= array();
+ 
+                       $control_data['action'] = '';
+                       $control_data['delete'] = array();
+                       $control_data['part'] = array();
+ 
+                       $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
+                       $p->set_file(
+                               Array(
+                                       'T_edit_partlist' => 
'edit_partlist.tpl',
+                                       'T_edit_partlist_blocks' => 
'edit_partlist_blocks.tpl'
+                               )
+                       );
+ 
+                       
$p->set_block('T_edit_partlist_blocks','B_alert_msg','V_alert_msg');
+                       
$p->set_block('T_edit_partlist_blocks','B_partlist','V_partlist');
+                       
$p->set_block('T_edit_partlist_blocks','B_participants_none','V_participants_none');
+                       
$p->set_block('T_edit_partlist_blocks','B_delete_btn','V_delete_btn');
+                       
+                       global $query_addr;
+                       $sb = CreateObject('phpgwapi.sbox2');
+                       $addy = $sb->getAddress('addr','',$query_addr);
+ 
+                       $add_ext  = $addy['doSearchFkt'];
+                       $add_ext .= $addy['addr_title']!=lang('Address 
Book')?$addy['addr_title']:'';
+                       $add_ext .= "&nbsp;".$addy['addr'].$addy['addr_nojs'];
+ 
+                       $p->set_var('text_add_name',$add_ext);
+ 
+                       if(isset($GLOBALS['HTTP_GET_VARS']['part']) && 
$GLOBALS['HTTP_GET_VARS']['part'])
+                       {
+                               $control_data['part'] = split(",", 
$GLOBALS['HTTP_GET_VARS']['part']);
+                       }
+                       else
+                       {
+                               $control_data['part'] = 
$GLOBALS['HTTP_POST_VARS']['participant'];
+                               $control_data['action'] = 
$GLOBALS['HTTP_POST_VARS']['action'];
+                               $control_data['delete'] = 
$GLOBALS['HTTP_POST_VARS']['delete'];
+                       }
+ 
+                       for ($i=0; $i<count($control_data['part']); $i++)
+                       {
+                         $id = $control_data['part'][$i];
+                         list($contact) = $this->read_contact($id);
+ 
+                         $participant[$id] = array();
+                         $participant[$id]['name'] = $contact['n_given'].' 
'.$contact['n_family'];
+                       }
+ 
+                       if ($control_data['action'] == lang('Delete selected 
contacts'))
+                       {
+                               for ($i=0; $i<count($control_data['delete']); 
$i++)
+                               {
+                                       $id = $control_data['delete'][$i];
+                                       unset($participant[$id]);
+                               }
+                       }
+                       
+                       if ($control_data['action'] == lang('Add Contact'))
+                       {
+                               $id = $GLOBALS['HTTP_POST_VARS']['id_addr'];
+                               if (isset($id) && intval($id) != 0)
+                               {
+                                       list($contact) = 
$this->read_contact($id);
+                                       $participant[$id] = array();
+                                       $participant[$id]['name'] = 
$contact['n_given'].' '.$contact['n_family'];
+                               }
+                       }
+ 
+                       // create list of currently selected contacts
+                       //
+                       while(list($id,$contact) = each($participant))
+                       {
+                               
$p->set_var('hidden_delete_name','participant[]');
+                               $p->set_var('hidden_delete_value',$id);
+                               $p->set_var('ckbox_delete_name','delete[]');
+                               $p->set_var('ckbox_delete_value',$id);
+                               
$p->set_var('ckbox_delete_participant',$contact['name']);
+                               $p->parse('V_partlist','B_partlist',True);
+                               $total_contacts++;
+                       }
+ 
+                       if ($total_contacts == 0)
+                       {
+                               // no contacts have been selected
+                               // => clear the delete form, remove delete 
button and show the none block
+                               //
+                               $p->set_var('V_partlist','');
+                               $p->set_var('V_delete_btn','');
+                               $p->set_var('text_none',lang('None'));
+                               
$p->parse('V_participants_none','B_participants_none');
+                       }
+                       else
+                       {
+                               // at least one contact has been selected
+                               // => clear the none block, fill the delete 
form and add delete button
+                               //
+                               $p->set_var('V_participants_none','');
+                               $p->set_var('btn_delete_name','action');
+                               $p->set_var('btn_delete_value',lang('Delete 
selected contacts'));
+                               $p->parse('V_delete_btn','B_delete_btn');
+                       }
+ 
+                       $body_tags  = 
'bgcolor="'.$GLOBALS['phpgw_info']['theme']['bg_color']
+                                                       . '" 
alink="'.$GLOBALS['phpgw_info']['theme']['alink']
+                                                       . '" 
link="'.$GLOBALS['phpgw_info']['theme']['link']
+                                                       .'" 
vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"';
+ 
+                       $form_action = $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'calendar.uicalendar.modify'));
+                       
+                       $charset = lang('charset');
+                       $p->set_var('charset',$charset);
+                       
$p->set_var('page_title',$GLOBALS['phpgw_flags']['currentapp'] 
+                                                                               
                                         . ' - ' .lang('External 
Participants'));
+                       
$p->set_var('font_family',$GLOBALS['phpgw_info']['theme']['font']);
+                       $p->set_var('body_tags',$body_tags);
+                       $p->set_var('form_method','POST');
+                       $p->set_var('form_action',$form_action);
+                       $p->set_var('text_add_contact',lang('External 
Participants'));
+                       $p->set_var('text_contacts_selected',lang('Selected 
contacts (%1)',$total_contacts));
+                       $p->set_var('btn_add_name','action');
+                       $p->set_var('btn_add_value',lang('Add Contact'));
+                       $p->set_var('btn_done_name','done');
+                       $p->set_var('btn_done_value',lang('Done'));
+                       $p->set_var('btn_done_js','copyback()');
+                       $p->set_var('form1_name','ext_form');
+ 
+                       $p->pfp('out','T_edit_partlist');                       
+               }
+ 
+               function read_contact($id)
+               {
+                       $query_fields = Array(
+                               'n_given' => 'n_given',
+                               'n_family' => 'n_family',
+                               'email' => 'email',
+                               'email_home' => 'email_home'
+                       );
+ 
+                 /*
+                       if ($this->rights & PHPGW_ACL_READ)
+                       {
+                               return 
$this->contacts->read_single_entry($id,$fields);
+                       }
+                       else
+                       {
+                               $rtrn = array(0 => array('No access' => 'No 
access'));
+                               return $rtrn;
+                       }
+                 */
+ 
+                 $contacts = CreateObject('phpgwapi.contacts', False);
+                 return $contacts->read_single_entry($id,$query_fields);
                }
  

Index: hook_settings.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/hook_settings.inc.php,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -r1.1.2.5 -r1.1.2.6
*** hook_settings.inc.php       4 May 2003 17:05:07 -0000       1.1.2.5
--- hook_settings.inc.php       19 May 2003 23:29:23 -0000      1.1.2.6
***************
*** 16,19 ****
--- 16,21 ----
        /* $Id$ */
  
+       ExecMethod('calendar.bocalendar.check_set_default_prefs');
+ 
        $default = array(
                'day'          => lang('Daily'),
***************
*** 29,33 ****
        create_check_box('show default view on main 
screen','mainscreen_showevents',
                'Displays your default calendar view on the startpage (page you 
get when you enter phpGroupWare or click on the homepage icon)?');
! 
        $summary = array(
                'no'     => lang('Never'),
--- 31,35 ----
        create_check_box('show default view on main 
screen','mainscreen_showevents',
                'Displays your default calendar view on the startpage (page you 
get when you enter phpGroupWare or click on the homepage icon)?');
! /*
        $summary = array(
                'no'     => lang('Never'),
***************
*** 35,60 ****
                'weekly' => lang('Weekly')
        );
!       create_select_box('Default view of appointments','summary',$summary,
                'Do you want to receive a regulary summary of your 
appointsments via email?<br>The summary is sent to your standard email-address 
on the morning of that day or on Monday for weekly summarys.<br>It is only sent 
when you have any appointments on that day or week.');
!       
        $updates = array(
                'no'             => lang('Never'),
!               'new_delete'     => lang('on invitation / cancelation only'),
                'time_change_4h' => lang('on time change of more than 4 hours 
too'),
                'time_change'    => lang('on any time change too'),
!               'all_changes'    => lang('on all changes')
        );
        create_select_box('Receive email updates','receive_updates',$updates,
!               "Do you want to be notified about new or changed appointments? 
You be notified about changes you make yourself.<br>You can limit the 
notifications to certain changes only. Each item includes all the notification 
listed above it. All changes include changes of title, description, 
participants and the acceptions and rejections of the appointment.");
  
!       create_notify('Notification message for updates you 
send','notification_msg',5,50,
!               'This message is sent to every participant of events you own, 
who has requested notifcations.<br>You can use certain variables which get 
substituted with the data of the event. The first line is the subject of the 
email.');
  
        create_check_box('Show invitations you rejected','show_rejected',
                'Should invitations you rejected still be shown in your 
calendar ?<br>You can only accept them later (eg. when your scheduling conflict 
is removed), if they are still shown in your calendar!');
! /*
!       create_check_box('Send/receive updates via email','send_updates');
!       create_check_box('Receive extra information in event 
mails','send_extra');
! */
        create_check_box('Display status of events','display_status',
                'Should the status of the event-participants (accept, reject, 
...) be shown in brakets after each participants name ?');
--- 37,93 ----
                'weekly' => lang('Weekly')
        );
!       create_select_box('Receive summary of appointments','summary',$summary,
                'Do you want to receive a regulary summary of your 
appointsments via email?<br>The summary is sent to your standard email-address 
on the morning of that day or on Monday for weekly summarys.<br>It is only sent 
when you have any appointments on that day or week.');
! */    
        $updates = array(
                'no'             => lang('Never'),
!               'add_cancel'     => lang('on invitation / cancelation only'),
                'time_change_4h' => lang('on time change of more than 4 hours 
too'),
                'time_change'    => lang('on any time change too'),
!               'modifications'  => lang('on all modification, but responses'),
!               'responses'      => lang('on participant responses too')
        );
        create_select_box('Receive email updates','receive_updates',$updates,
!               "Do you want to be notified about new or changed appointments? 
You be notified about changes you make yourself.<br>You can limit the 
notifications to certain changes only. Each item includes all the notification 
listed above it. All modifications include changes of title, description, 
participants, but no participant responses. If the owner of an event requested 
any notifcations, he will always get the participant responses like acceptions 
and rejections too.");
  
!       $update_formats = array(
!               'none'     => lang('None'),
!               'extended' => lang('Extended'),
!               'ical'     => lang('iCal / rfc2445')
!       );
!       create_select_box('Format of event 
updates','update_format',$update_formats,
!               'Extended updates always include the complete event-details. 
iCal\'s can be imported by certain other calendar-applications.');
  
+       $event_details = array(
+               'to-fullname' => lang('Fullname of person to notify'),
+               'to-firstname'=> lang('Firstname of person to notify'),
+               'to-lastname' => lang('Lastname of person to notify'),
+               'title'       => lang('Title of the event'),
+               'description' => lang('Description'),
+               'startdate'   => lang('Start Date/Time'),
+               'enddate'     => lang('End Date/Time'),
+               'olddate'     => lang('Old Startdate'),
+               'category'    => lang('Category'),
+               'location'    => lang('Location'),
+               'priority'    => lang('Priority'),
+               'participants'=> lang('Participants'),
+               'owner'       => lang('Owner'),
+               'repetition'  => lang('Repetitiondetails (or empty)'),
+               'action'      => lang('Action that caused the notify: Added, 
Canceled, Accepted, Rejected, ...')
+       );
+       create_notify('Notification messages for added events 
','notifyAdded',5,50,
+               'This message is sent to every participant of events you own, 
who has requested notifcations about new events.<br>You can use certain 
variables which get substituted with the data of the event. The first line is 
the subject of the email.',
+               '',$event_details);
+       create_notify('Notification messages for canceled events 
','notifyCanceled',5,50,
+               'This message is sent for canceled or deleted 
events.','',$event_details,False);
+       create_notify('Notification messages for modified events 
','notifyModified',5,50,
+               'This message is sent for modified or moved 
events.','',$event_details,False);
+       create_notify('Notification messages for your responses 
','notifyResponse',5,50,
+               'This message is sent when you accept, tentative accept or 
reject an event.',
+               '',$event_details,False);
+       
        create_check_box('Show invitations you rejected','show_rejected',
                'Should invitations you rejected still be shown in your 
calendar ?<br>You can only accept them later (eg. when your scheduling conflict 
is removed), if they are still shown in your calendar!');
! 
        create_check_box('Display status of events','display_status',
                'Should the status of the event-participants (accept, reject, 
...) be shown in brakets after each participants name ?');
***************
*** 73,77 ****
        }
        create_select_box('work day starts on','workdaystarts',$options,
!               'This defines the start of your dayview. Events before this 
time, are shown above the dayview.');
        create_select_box('work day ends on','workdayends',$options,
                'This defines the end of your dayview. Events after this time, 
are shown below the dayview.');
--- 106,110 ----
        }
        create_select_box('work day starts on','workdaystarts',$options,
!               'This defines the start of your dayview. Events before this 
time, are shown above the dayview.<br>This time is also used as a default 
starttime for new events.');
        create_select_box('work day ends on','workdayends',$options,
                'This defines the end of your dayview. Events after this time, 
are shown below the dayview.');
***************
*** 87,90 ****
--- 120,125 ----
        create_select_box('Intervals in day view','interval',$intervals,
                'Defines the size in minutes of the lines in the day view.');
+       create_input_box('default appointment length (in 
minutes)','defaultlength',
+               'Default length of newly created events. The length is in 
minutes, eg. 60 for 1 hour.','',3);
  
        $groups = 
$GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']);





reply via email to

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