phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] calendar/inc class.uicalendar.inc.php, 1.115 class.bo


From: skwashd
Subject: [Phpgroupware-cvs] calendar/inc class.uicalendar.inc.php, 1.115 class.bocalendar.inc.php, 1.96
Date: Mon, 7 Nov 2005 01:20:00 +0100

Update of calendar/inc

Modified Files:
     Branch: MAIN
            class.uicalendar.inc.php lines: +4 -4
            class.bocalendar.inc.php lines: +44 -18

Log Message:
ensure a phpgw users is a participant and keep participant status info

====================================================
Index: calendar/inc/class.uicalendar.inc.php
diff -u calendar/inc/class.uicalendar.inc.php:1.114 
calendar/inc/class.uicalendar.inc.php:1.115
--- calendar/inc/class.uicalendar.inc.php:1.114 Sun Nov  6 21:30:42 2005
+++ calendar/inc/class.uicalendar.inc.php       Mon Nov  7 00:20:50 2005
@@ -3796,11 +3796,11 @@
                        }

                        $str = '';
-                       foreach ( $event['participants'] as $id => $ignore )
+                       foreach ( $event['participants'] as $id => $status )
                        {
                                if($id != intval($event['owner']))
                                {
-                                       $str .= '<option value="' . $id . '" 
selected="selected">'
+                                       $str .= '<option value="' . $id . 
$status . '" selected="selected">'
                                                        . 
$this->bo->contacts->get_name_of_person_id($id) . '</option>' . "\n";
                                }
                        }
@@ -3823,7 +3823,7 @@
                        }
                        $var['owner'] = Array(
                                'field' => lang('%1 participates', 
$this->bo->contacts->get_name_of_person_id($event['owner']) ),
-                               'data'  => '<input type="checkbox" 
name="participants[]" value="'.$event['owner'].'"'.$checked.'>'
+                               'data'  => '<input type="checkbox" 
name="participants[]" value="'.$event['owner'].'A"'.$checked.'>'
                        );
 // Reminder
                        // The user must use "Alarm Management" to 
change/modify an alarm

====================================================
Index: calendar/inc/class.bocalendar.inc.php
diff -u calendar/inc/class.bocalendar.inc.php:1.95 
calendar/inc/class.bocalendar.inc.php:1.96
--- calendar/inc/class.bocalendar.inc.php:1.95  Fri Oct 28 02:41:34 2005
+++ calendar/inc/class.bocalendar.inc.php       Mon Nov  7 00:20:50 2005
@@ -793,13 +793,10 @@
                                                break;
                                }

-                               $part = False;
                                if ( is_array($l_participants) && 
count($l_participants) )
                                {
-                                       $accept_type = 'U'; //TODO add option 
for 'C' == Contact
                                        $parts = $l_participants;
                                        $minparts = min($l_participants);
-                                       $part = true;
                                        foreach ( $l_participants as 
$participant )
                                        {
                                                if ( substr($participant, 0, 2) 
== 'g_' )
@@ -819,6 +816,10 @@
                                                }
                                                else
                                                {
+                                                       if (($accept_type = 
substr($parts[$i],-1,1)) == '0' || intval($accept_type) > 0)
+                                                       {
+                                                               $accept_type = 
'U';
+                                                       }
                                                        
$this->so->add_attribute('participants', $accept_type, intval($participant));
                                                }
                                        }
@@ -953,7 +954,7 @@
                                        $this->read_sessiondata();
                                        if ($this->return_to)
                                        {
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->return_to);
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php', "menuaction={$this->return_to}");
                                                
$GLOBALS['phpgw']->common->phpgw_exit();
                                        }
                                        Execmethod('calendar.uicalendar.index');
@@ -1080,34 +1081,59 @@
                        }
                }

+               /**
+               * Ensure an event is valid
+               *
+               * @param array $event event data
+               * @return int 0 for ok > 0 == error
+               */
                function validate_update($event)
                {
-                       $error = 0;
-                       // do a little form verifying
-                       if (!count($event['participants']))
+                       if (!is_array($event['participants']) || 
!count($event['participants']))
                        {
-                               $error = 43;
+                               return 43;
+                       }
+                       else
+                       {
+                               $acct_part = false;
+                               foreach ( $event['participants'] as 
$participant => $status)
+                               {
+                                       if ( 
$GLOBALS['phpgw']->accounts->search_person($participant) )
+                                       {
+                                               $acct_part = true;
+                                               break;
+                                       }
+                               }
+
+                               if ( !$acct_part )
+                               {
+                                       return 43;
+                               }
                        }
-                       elseif ($event['title'] == '')
+
+                       if ($event['title'] == '')
                        {
-                               $error = 40;
+                               return 40;
                        }
-                       elseif 
(($GLOBALS['phpgw']->datetime->time_valid($event['start']['hour'],$event['start']['min'],0)
 == False) || 
($GLOBALS['phpgw']->datetime->time_valid($event['end']['hour'],$event['end']['min'],0)
 == False))
+
+                       if 
(($GLOBALS['phpgw']->datetime->time_valid($event['start']['hour'],$event['start']['min'],0)
 == False) || 
($GLOBALS['phpgw']->datetime->time_valid($event['end']['hour'],$event['end']['min'],0)
 == False))
                        {
-                               $error = 41;
+                               return 41;
                        }
-                       elseif 
(($GLOBALS['phpgw']->datetime->date_valid($event['start']['year'],$event['start']['month'],$event['start']['mday'])
 == False) || 
($GLOBALS['phpgw']->datetime->date_valid($event['end']['year'],$event['end']['month'],$event['end']['mday'])
 == False) || 
($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday'])
 == 1))
+
+                       if 
(($GLOBALS['phpgw']->datetime->date_valid($event['start']['year'],$event['start']['month'],$event['start']['mday'])
 == False) || 
($GLOBALS['phpgw']->datetime->date_valid($event['end']['year'],$event['end']['month'],$event['end']['mday'])
 == False) || 
($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday'])
 == 1))
                        {
-                               $error = 42;
+                               return 42;
                        }
-                       elseif 
($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday'])
 == 0)
+
+                       if 
($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday'])
 == 0)
                        {
                                if 
($GLOBALS['phpgw']->datetime->time_compare($event['start']['hour'],$event['start']['min'],0,$event['end']['hour'],$event['end']['min'],0)
 == 1)
                                {
-                                       $error = 42;
+                                       return 42;
                                }
                        }
-                       return $error;
+                       return 0;
                }

                /**






reply via email to

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