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.17,


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.71.2.17,1.71.2.18 class.uicalendar.inc.php,1.66.2.26,1.66.2.27
Date: Mon, 28 Oct 2002 11:59:02 -0500

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

Modified Files:
      Tag: Version-0_9_14-branch
        class.bocalendar.inc.php class.uicalendar.inc.php 
Log Message:
some updates for the calendar:
- added 3 param. to bocalendar::check_perms to check agains an other user (not 
only an event or the viewed cal)
- save status of participants during edit (got no longer lost)
- added name of editied user to the edit-status screen
- some other ACL changes/corrections


Index: class.bocalendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.bocalendar.inc.php,v
retrieving revision 1.71.2.17
retrieving revision 1.71.2.18
diff -C2 -r1.71.2.17 -r1.71.2.18
*** class.bocalendar.inc.php    23 Sep 2002 23:01:31 -0000      1.71.2.17
--- class.bocalendar.inc.php    28 Oct 2002 16:58:58 -0000      1.71.2.18
***************
*** 899,907 ****
                }
  
-               function can_user_edit($event)
-               {
-                       return $this->check_perms(PHPGW_ACL_EDIT,$event);
-               }
- 
                function fix_update_time(&$time_param)
                {
--- 899,902 ----
***************
*** 1090,1098 ****
                }
  
!               function check_perms($needed,$event=0)
                {
                        if (is_int($event) && $event == 0)
                        {
!                               $owner = $this->owner;
                        }
                        else
--- 1085,1103 ----
                }
  
!               /*!
!               @function check_perms( )
!               @syntax check_perms($needed,$event=0,$other=0)
!               @abstract Checks if the current user has the necessary ACL 
rights 
!               @author ralfbecker
!               @discussion The check is performed on an event or general on 
the cal of an other user
!               @param $needed necessary ACL right: PHPGW_ACL_{READ|EDIT|DELETE}
!               @param $event event as array or the event-id or 0 for general 
check
!               @param $other uid to check (if event==0) or 0 to check against 
$this->owner
!               */
!               function check_perms($needed,$event=0,$other=0)
                {
                        if (is_int($event) && $event == 0)
                        {
!                               $owner = $other > 0 ? $other : $this->owner;
                        }
                        else
***************
*** 1173,1177 ****
                                $owner = $this->owner;
                        }
!                       if ($owner == 
$GLOBALS['phpgw_info']['user']['account_id'] || ($event['public']==1) || 
($this->check_perms(PHPGW_ACL_PRIVATE,$owner) && $event['public']==0) || 
$event['owner'] == $GLOBALS['phpgw_info']['user']['account_id'])
                        {
                                return False;
--- 1178,1182 ----
                                $owner = $this->owner;
                        }
!                       if ($owner == 
$GLOBALS['phpgw_info']['user']['account_id'] || ($event['public']==1) || 
($this->check_perms(PHPGW_ACL_PRIVATE,$event) && $event['public']==0) || 
$event['owner'] == $GLOBALS['phpgw_info']['user']['account_id'])
                        {
                                return False;

Index: class.uicalendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.uicalendar.inc.php,v
retrieving revision 1.66.2.26
retrieving revision 1.66.2.27
diff -C2 -r1.66.2.26 -r1.66.2.27
*** class.uicalendar.inc.php    23 Sep 2002 23:01:31 -0000      1.66.2.26
--- class.uicalendar.inc.php    28 Oct 2002 16:58:58 -0000      1.66.2.27
***************
*** 848,855 ****
                        elseif(isset($GLOBALS['HTTP_GET_VARS']['cal_id']))
                        {
!                               $cal_id = $GLOBALS['HTTP_GET_VARS']['cal_id'];
!                               $event = 
$this->bo->read_entry(intval($GLOBALS['HTTP_GET_VARS']['cal_id']));
  
!                               if(!$this->bo->can_user_edit($event))
                                {
                                        Header('Location: 
'.$this->page('view','&cal_id='.$cal_id));
--- 848,855 ----
                        elseif(isset($GLOBALS['HTTP_GET_VARS']['cal_id']))
                        {
!                               $cal_id = 
intval($GLOBALS['HTTP_GET_VARS']['cal_id']);
!                               $event = $this->bo->read_entry($cal_id);
  
!                               
if(!$this->bo->check_perms(PHPGW_ACL_EDIT,$event))
                                {
                                        Header('Location: 
'.$this->page('view','&cal_id='.$cal_id));
***************
*** 1940,1944 ****
                        while ($user = each($users))
                        {
!                               
if(($GLOBALS['phpgw']->accounts->exists($user[0]) && 
$this->bo->check_perms(PHPGW_ACL_READ,$user[0])) || 
$GLOBALS['phpgw']->accounts->get_type($user[0]) == 'g')
                                {
                                        $str .= '    <option 
value="'.$user[0].'">('.$GLOBALS['phpgw']->accounts->get_type($user[0]).') 
'.$user[1].'</option>'."\n";
--- 1940,1944 ----
                        while ($user = each($users))
                        {
!                               
if(($GLOBALS['phpgw']->accounts->exists($user[0]) && 
$this->bo->check_perms(PHPGW_ACL_READ,0,$user[0])) || 
$GLOBALS['phpgw']->accounts->get_type($user[0]) == 'g')
                                {
                                        $str .= '    <option 
value="'.$user[0].'">('.$GLOBALS['phpgw']->accounts->get_type($user[0]).') 
'.$user[1].'</option>'."\n";
***************
*** 1982,1986 ****
                                                while($members != False && 
list($index,$member) = each($members))
                                                {
!                                                       
if($this->bo->check_perms(PHPGW_ACL_READ,$member['account_id']) && 
!isset($parts[$member['account_id']]))
                                                        {
                                                                
$parts[$member['account_id']] = 1;
--- 1982,1986 ----
                                                while($members != False && 
list($index,$member) = each($members))
                                                {
!                                                       
if($this->bo->check_perms(PHPGW_ACL_READ,0,$member['account_id']) && 
!isset($parts[$member['account_id']]))
                                                        {
                                                                
$parts[$member['account_id']] = 1;
***************
*** 1989,1993 ****
                                                break;
                                        case 'u':
!                                               
if($this->bo->check_perms(PHPGW_ACL_READ,$participants[$i]) && 
!isset($parts[$participants[$i]]))
                                                {
                                                        
$parts[$participants[$i]] = 1;
--- 1989,1993 ----
                                                break;
                                        case 'u':
!                                               
if($this->bo->check_perms(PHPGW_ACL_READ,0,$participants[$i]) && 
!isset($parts[$participants[$i]]))
                                                {
                                                        
$parts[$participants[$i]] = 1;
***************
*** 3163,3167 ****
                                if($GLOBALS['phpgw']->accounts->exists($user))
                                {
!                                       $str .= 
($str?'<br>':'').$GLOBALS['phpgw']->common->grab_owner_name($user).' 
('.($this->bo->check_perms(PHPGW_ACL_EDIT,$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";
                                }
                        }
--- 3163,3167 ----
                                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";
                                }
                        }
***************
*** 3736,3752 ****
                        while(list($param,$text) = each($response_choices))
                        {
!                               if(!($param == REJECTED && $ev['owner'] == 
$this->bo->owner))
!                               {
!                                       $var = Array(   
!                                               'action_url_button'     => 
$this->page('set_action','&cal_id='.$cal_id.'&action='.$param),
!                                               'action_text_button'    => '  
'.$text.'  ',
!                                               'action_confirm_button' => '',
!                                               'action_extra_field'    => ''
!                                       );
!                                       $p->set_var($var);
!                                       $str .= 
'<td>'.$p->fp('out','form_button').'</td>'."\n";
!                               }
                        }
!                       return '<table width="100%" cols="4"><tr 
align="center">'."\n".$str.'</tr></table>'."\n";
                }
  
--- 3736,3751 ----
                        while(list($param,$text) = each($response_choices))
                        {
!                               $var = Array(
!                                       'action_url_button'     => 
$this->page('set_action','&cal_id='.$cal_id.'&action='.$param),
!                                       'action_text_button'    => '  '.$text.' 
 ',
!                                       'action_confirm_button' => '',
!                                       'action_extra_field'    => ''
!                               );
!                               $p->set_var($var);
!                               $str .= 
'<td>'.$p->fp('out','form_button').'</td>'."\n";
                        }
!                       $str = 
'<td><b>'.$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner).":</b></td>\n".$str;
! 
!                       return '<table width="100%"><tr 
align="center">'."\n".$str.'</tr></table>'."\n";
                }
  
***************
*** 3790,3794 ****
                                'action_url'            => 
$GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update')),
                                'common_hidden' => '<input type="hidden" 
name="cal[id]" value="'.$event['id'].'">'."\n"
!                                                                               
. '<input type="hidden" name="cal[owner]" value="'.$this->bo->owner.'">'."\n"
                                                                                
. '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n"
                                                                                
. ($GLOBALS['HTTP_GET_VARS']['cal_id'] && $event['id'] == 0?'<input 
type="hidden" name="cal[reference]" 
value="'.$GLOBALS['HTTP_GET_VARS']['cal_id'].'">'."\n":
--- 3789,3793 ----
                                'action_url'            => 
$GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update')),
                                'common_hidden' => '<input type="hidden" 
name="cal[id]" value="'.$event['id'].'">'."\n"
!                                                                               
. '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'">'."\n"
                                                                                
. '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n"
                                                                                
. ($GLOBALS['HTTP_GET_VARS']['cal_id'] && $event['id'] == 0?'<input 
type="hidden" name="cal[reference]" 
value="'.$GLOBALS['HTTP_GET_VARS']['cal_id'].'">'."\n":
***************
*** 3902,3906 ****
                                $accounts = 
$GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar');
                                $users = Array();
!                               
$this->build_part_list($users,$accounts,$this->bo->owner);
  
                                $str = '';
--- 3901,3905 ----
                                $accounts = 
$GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar');
                                $users = Array();
!                               
$this->build_part_list($users,$accounts,$event['owner']);
  
                                $str = '';
***************
*** 3909,3915 ****
                                while (list($id,$user_array) = each($users))
                                {
!                                       if($id != intval($this->bo->owner))
                                        {
!                                               $str .= '    <option value="' . 
$id . '"'.($event['participants'][$id]?' 
selected':'').'>('.$user_array['type'].') 
'.$user_array['name'].'</option>'."\n";
                                        }
                                }
--- 3908,3914 ----
                                while (list($id,$user_array) = each($users))
                                {
!                                       if($id != intval($event['owner']))
                                        {
!                                               $str .= '    <option value="' . 
$id.$event['participants'][$id] . '"'.($event['participants'][$id]?' 
selected':'').'>('.$user_array['type'].') 
'.$user_array['name'].'</option>'."\n";
                                        }
                                }
***************
*** 3920,3924 ****
  
  // I Participate
!                               if((($event['id'] > 0) && 
isset($event['participants'][$this->bo->owner])) || !$event['id'])
                                {
                                        $checked = ' checked';
--- 3919,3923 ----
  
  // I Participate
!                               if((($event['id'] > 0) && 
isset($event['participants'][$event['owner']])) || !$event['id'])
                                {
                                        $checked = ' checked';
***************
*** 3929,3934 ****
                                }
                                $var[] = Array(
!                                       'field' => 
$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner).' 
'.lang('Participates'),
!                                       'data'  => '<input type="checkbox" 
name="participants[]" value="'.$this->bo->owner.'"'.$checked.'>'
                                );
                        }
--- 3928,3933 ----
                                }
                                $var[] = Array(
!                                       'field' => 
$GLOBALS['phpgw']->common->grab_owner_name($event['owner']).' 
'.lang('Participates'),
!                                       'data'  => '<input type="checkbox" 
name="participants[]" 
value="'.$event['owner'].$event['participants'][$event['owner']].'"'.$checked.'>'
                                );
                        }





reply via email to

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