forked from extern/egroupware
TONS of fixes.. Major changes in preparation of turning on ICAP server.
This commit is contained in:
parent
8538655d81
commit
4538dde870
@ -253,65 +253,62 @@
|
||||
$str .= '>';
|
||||
display_item($p,lang('Private'),$str);
|
||||
|
||||
// Participants
|
||||
$accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar');
|
||||
$users = Array();
|
||||
for($i=0;$i<count($accounts);$i++)
|
||||
function build_part_list(&$users,$accounts,$owner)
|
||||
{
|
||||
if(intval($accounts[$i]) != $owner && !isset($users[$accounts[$i]]))
|
||||
global $phpgw;
|
||||
if($accounts == False)
|
||||
{
|
||||
$users[intval($accounts[$i])] = $phpgw->common->grab_owner_name(intval($accounts[$i]));
|
||||
if($phpgw->accounts->get_type(intval($accounts[$i])) == 'g')
|
||||
return;
|
||||
}
|
||||
while(list($index,$id) = each($accounts))
|
||||
{
|
||||
if(intval($id) == $owner)
|
||||
{
|
||||
$group_members = $phpgw->acl->get_ids_for_location(intval($accounts[$i]),1,'phpgw_group');
|
||||
if($group_members != False)
|
||||
continue;
|
||||
}
|
||||
if(!isset($users[intval($id)]))
|
||||
{
|
||||
$users[intval($id)] = $phpgw->common->grab_owner_name(intval($id));
|
||||
if($phpgw->accounts->get_type(intval($id)) == 'g')
|
||||
{
|
||||
for($j=0;$j<count($group_members);$j++)
|
||||
{
|
||||
if($group_members[$j] != $owner && !isset($users[$group_members[$j]]))
|
||||
{
|
||||
$users[$group_members[$j]] = $phpgw->common->grab_owner_name($group_members[$j]);
|
||||
}
|
||||
}
|
||||
build_part_list($users,$phpgw->acl->get_ids_for_location(intval($id),1,'phpgw_group'),$owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$str = "\n".' <select name="participants[]" multiple size="5">'."\n";
|
||||
for ($l=0;$l<count($event->participants);$l++)
|
||||
// Participants
|
||||
$accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar');
|
||||
$users = Array();
|
||||
build_part_list($users,$accounts,$owner);
|
||||
// unset($users[$owner]);
|
||||
echo "Owner = ".$users[$owner]."<br>\n";
|
||||
while(list($key,$status) = each($event->participants))
|
||||
{
|
||||
$parts[$event->participants[$l]] = ' selected';
|
||||
$parts[$key] = ' selected';
|
||||
}
|
||||
|
||||
$str = "\n".' <select name="participants[]" multiple size="5">'."\n";
|
||||
@asort($users);
|
||||
@reset($users);
|
||||
$user = Array();
|
||||
while ($user = each($users))
|
||||
while (list($id,$name) = each($users))
|
||||
{
|
||||
$userid = intval($user[0]);
|
||||
if($userid != $owner && $phpgw->accounts->exists($userid) == True)
|
||||
if(intval($id) == intval($owner))
|
||||
{
|
||||
$str .= ' <option value="' . $userid . '"'.$parts[$userid].'>('.$phpgw->accounts->get_type($userid).') '.$user[1].'</option>'."\n";
|
||||
continue;
|
||||
}
|
||||
elseif($phpgw->accounts->exists($id) == True)
|
||||
{
|
||||
$str .= ' <option value="' . $id . '"'.$parts[$id].'>('.$phpgw->accounts->get_type($id).') '.$name.'</option>'."\n";
|
||||
}
|
||||
}
|
||||
$str .= ' </select>';
|
||||
display_item($p,lang('Participants'),$str);
|
||||
|
||||
// I Participate
|
||||
$participate = False;
|
||||
if($id)
|
||||
{
|
||||
for($i=0;$i<count($event->participants);$i++)
|
||||
{
|
||||
if($event->participants[$i] == $owner)
|
||||
{
|
||||
$participate = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
$str = '<input type="checkbox" name="participants[]" value="'.$owner.'"';
|
||||
if((($id > 0) && ($participate == True)) || !isset($id))
|
||||
if((($id > 0) && isset($event->participants[$owner])) || !isset($id))
|
||||
{
|
||||
$str .= ' checked';
|
||||
}
|
||||
|
@ -179,14 +179,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
$participants = Array();
|
||||
while($parts = each($part))
|
||||
// $participants = Array();
|
||||
while(list($key,$value) = each($part))
|
||||
{
|
||||
$participants[] = $parts[0];
|
||||
$phpgw->calendar->add_attribute('participants['.$key.']','U');
|
||||
}
|
||||
|
||||
reset($participants);
|
||||
$phpgw->calendar->add_attribute('participants',$participants);
|
||||
// reset($participants);
|
||||
// $phpgw->calendar->add_attribute('participants',$participants);
|
||||
$phpgw->calendar->add_attribute('priority',$priority);
|
||||
$event = $phpgw->calendar->event;
|
||||
|
||||
|
@ -640,37 +640,41 @@ class calendar extends calendar_
|
||||
for($outer_loop=0;$outer_loop<($this->sorted_events_matching - 1);$outer_loop++)
|
||||
{
|
||||
$outer = $events[$outer_loop];
|
||||
$outer_time = $phpgw->common->show_date($outer->datetime,'Hi');
|
||||
$outer_etime = $phpgw->common->show_date($outer->edatetime,'Hi');
|
||||
$outer_stime = mktime($outer->start->hour,$outer->start->min,$outer->start->sec,$outer->start->month,$outer->start->mday,$outer->start->year) - $this->datetime->tz_offset;
|
||||
$outer_etime = mktime($outer->end->hour,$outer->end->min,$outer->end->sec,$outer->end->month,$outer->end->mday,$outer->end->year) - $this->datetime->tz_offset;
|
||||
$ostime = $phpgw->common->show_date($outer_stime,'Hi');
|
||||
$oetime = $phpgw->common->show_date($outer_etime,'Hi');
|
||||
|
||||
if($outer->datetime < $datetime)
|
||||
if($outer_stime < $datetime)
|
||||
{
|
||||
$outer_time = 0;
|
||||
$ostime = 0;
|
||||
}
|
||||
|
||||
if($outer->edatetime > $eod)
|
||||
if($outer_etime > $eod)
|
||||
{
|
||||
$outer_etime = 2359;
|
||||
$oetime = 2359;
|
||||
}
|
||||
|
||||
for($inner_loop=$outer_loop;$inner_loop<$this->sorted_events_matching;$inner_loop++)
|
||||
{
|
||||
$inner = $events[$inner_loop];
|
||||
$inner_time = $phpgw->common->show_date($inner->datetime,'Hi');
|
||||
$inner_etime = $phpgw->common->show_date($inner->edatetime,'Hi');
|
||||
$inner_stime = mktime($inner->start->hour,$inner->start->min,$inner->start->sec,$inner->start->month,$inner->start->mday,$inner->start->year) - $this->datetime->tz_offset;
|
||||
$inner_etime = mktime($inner->end->hour,$inner->end->min,$inner->end->sec,$inner->end->month,$inner->end->mday,$inner->end->year) - $this->datetime->tz_offset;
|
||||
$istime = $phpgw->common->show_date($inner_stime,'Hi');
|
||||
$ietime = $phpgw->common->show_date($inner_etime,'Hi');
|
||||
|
||||
if($inner->datetime < $datetime)
|
||||
if($inner_stime < $datetime)
|
||||
{
|
||||
$inner_time = 0;
|
||||
$istime = 0;
|
||||
}
|
||||
|
||||
if($inner->edatetime > ($datetime + 86399))
|
||||
if($inner_etime > ($datetime + 86399))
|
||||
{
|
||||
$inner_etime = 2359;
|
||||
$ietime = 2359;
|
||||
}
|
||||
|
||||
if(($outer_time > $inner_time) ||
|
||||
(($outer_time == $inner_time) && ($outer_etime > $inner_etime)))
|
||||
if(($ostime > $istime) ||
|
||||
(($ostime == $istime) && ($oetime > $ietime)))
|
||||
{
|
||||
$temp = $events[$inner_loop];
|
||||
$events[$inner_loop] = $events[$outer_loop];
|
||||
@ -714,11 +718,11 @@ class calendar extends calendar_
|
||||
|
||||
if($this->printer_friendly == False)
|
||||
{
|
||||
$month = '<a href="' . $phpgw->link('/calendar/month.php','month='.date('m',$date['raw']).'&year='.date('Y',$date['raw']).'&owner='.$this->owner) . '" class="minicalendar">' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year . '</a>';
|
||||
$month = '<a href="' . $phpgw->link('/calendar/month.php','month='.$phpgw->common->show_date($date['raw'],'m').'&year='.$phpgw->common->show_date($date['raw'],'Y').'&owner='.$this->owner) . '" class="minicalendar">' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$phpgw->common->show_date($date['raw'],'Y').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$month = lang($phpgw->common->show_date($date['raw'],'F')).' '.$year;
|
||||
$month = lang($phpgw->common->show_date($date['raw'],'F')).' '.$phpgw->common->show_date($date['raw'],'Y');
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
@ -887,13 +891,13 @@ class calendar extends calendar_
|
||||
$p_g = '';
|
||||
if(count($participants))
|
||||
{
|
||||
for($i=0;$i<count($participants);$i++)
|
||||
while(list($user,) = each($participants))
|
||||
{
|
||||
if($i > 0)
|
||||
if($p_g)
|
||||
{
|
||||
$p_g .= ' OR ';
|
||||
}
|
||||
$p_g .= 'phpgw_cal_user.cal_login='.$participants[$i];
|
||||
$p_g .= 'phpgw_cal_user.cal_login='.$user;
|
||||
}
|
||||
}
|
||||
if($p_g)
|
||||
@ -1160,7 +1164,7 @@ class calendar extends calendar_
|
||||
|
||||
$start = $this->datetime->get_weekday_start($year, $month, $day);
|
||||
|
||||
$this->end_repeat_day = $start + 604800;
|
||||
$this->end_repeat_day = intval(date('Ymd',$start + 604800));
|
||||
|
||||
$cellcolor = $phpgw_info['theme']['row_off'];
|
||||
|
||||
@ -1527,14 +1531,19 @@ class calendar extends calendar_
|
||||
|
||||
reset($event->participants);
|
||||
$participating = False;
|
||||
for($j=0;$j<count($event->participants);$j++)
|
||||
$participate = False;
|
||||
while(list($part,$status) = each($event->participants))
|
||||
{
|
||||
if($event->participants[$j] == $this->owner)
|
||||
if($part == $this->owner)
|
||||
{
|
||||
$participating = True;
|
||||
}
|
||||
if($part == $phpgw_info['user']['account_id'])
|
||||
{
|
||||
$participate = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
||||
|
||||
$p->set_unknowns('keep');
|
||||
@ -1597,14 +1606,6 @@ class calendar extends calendar_
|
||||
$p->set_var($var);
|
||||
$p->parse('row','list',True);
|
||||
|
||||
$participate = False;
|
||||
for($i=0;$i<count($event->participants);$i++)
|
||||
{
|
||||
if($event->participants[$i] == $phpgw_info['user']['account_id'])
|
||||
{
|
||||
$participate = True;
|
||||
}
|
||||
}
|
||||
$var = Array(
|
||||
'field' => lang('Created By'),
|
||||
'data' => $phpgw->common->grab_owner_name($event->owner)
|
||||
@ -1648,24 +1649,24 @@ class calendar extends calendar_
|
||||
|
||||
$str = '';
|
||||
reset($event->participants);
|
||||
while (list($key,$value) = each($event->participants))
|
||||
while (list($user,$short_status) = each($event->participants))
|
||||
{
|
||||
if($str)
|
||||
{
|
||||
$str .= '<br>';
|
||||
}
|
||||
|
||||
$status = $this->get_long_status($event->status[$key]);
|
||||
$long_status = $this->get_long_status($short_status);
|
||||
|
||||
$str .= $phpgw->common->grab_owner_name($event->participants[$key]).' (';
|
||||
$str .= $phpgw->common->grab_owner_name($user).' (';
|
||||
|
||||
if($event->participants[$key] == $this->owner && $this->check_perms(PHPGW_ACL_EDIT) == True)
|
||||
if($user == $this->owner && $this->check_perms(PHPGW_ACL_EDIT) == True)
|
||||
{
|
||||
$str .= '<a href="'.$phpgw->link('/calendar/edit_status.php','owner='.$this->owner.'&id='.$event->id).'">'.$status.'</a>';
|
||||
$str .= '<a href="'.$phpgw->link('/calendar/edit_status.php','owner='.$this->owner.'&id='.$event->id).'">'.$long_status.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$str .= $status;
|
||||
$str .= $long_status;
|
||||
}
|
||||
$str .= ')'."\n";
|
||||
}
|
||||
|
@ -158,18 +158,21 @@ class calendar__
|
||||
$new_event_datetime = mktime($new_event->start->hour,$new_event->start->min,$new_event->start->sec,$new_event->start->month,$new_event->start->mday,$new_event->start->year) - $this->datetime->tz_offset;
|
||||
}
|
||||
|
||||
for($i=0;$i<count($participants);$i++)
|
||||
while(list($userid,$statusid) = each($participants))
|
||||
{
|
||||
if($participants[$i] != $phpgw_info['user']['account_id'])
|
||||
if(intval($userid) != $phpgw_info['user']['account_id'])
|
||||
{
|
||||
$preferences = CreateObject('phpgwapi.preferences',$participants[$i]);
|
||||
// echo "Msg Type = ".$msg_type."<br>\n";
|
||||
// echo "userid = ".$userid."<br>\n";
|
||||
$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 = $phpgw->common->create_emailpreferences($part_prefs,$participants[$i]);
|
||||
$part_prefs = $phpgw->common->create_emailpreferences($part_prefs,intval($userid));
|
||||
$to = $part_prefs['email']['address'];
|
||||
// echo "Email being sent to: ".$to."<br>\n";
|
||||
|
||||
$phpgw_info['user']['preferences']['common']['tz_offset'] = $part_prefs['common']['tz_offset'];
|
||||
$phpgw_info['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat'];
|
||||
@ -227,41 +230,28 @@ class calendar__
|
||||
|
||||
function prepare_recipients(&$new_event,$old_event)
|
||||
{
|
||||
$old_part_count = count($old_event->participants);
|
||||
for($i=0;$i<$old_part_count;$i++)
|
||||
// Find modified and deleted users.....
|
||||
while(list($old_userid,$old_status) = each($old_event->participants))
|
||||
{
|
||||
$delete = True;
|
||||
$new_part_count = count($new_event->participants);
|
||||
for($k=0;$k<$new_part_count;$k++)
|
||||
if(isset($new_event->participants[$old_userid]))
|
||||
{
|
||||
if($new_event->participants[$k] == $old_event->participants[$i])
|
||||
{
|
||||
$delete = False;
|
||||
$this->modified[] = $new_event->participants[$k];
|
||||
$new_event->status[$k] = $old_event->status[$i];
|
||||
}
|
||||
// echo "Modifying event for user ".$old_userid."<br>\n";
|
||||
$this->modified[intval($old_userid)] = $new_status;
|
||||
}
|
||||
if($delete == True)
|
||||
else
|
||||
{
|
||||
$this->deleted[] = $old_event->participants[$i];
|
||||
// echo "Deleting user ".$old_userid." from the event<br>\n";
|
||||
$this->deleted[intval($old_userid)] = $old_status;
|
||||
}
|
||||
}
|
||||
$new_part_count = count($new_event->participants);
|
||||
for($i=0;$i<$new_part_count;$i++)
|
||||
// Find new users.....
|
||||
while(list($new_userid,$new_status) = each($new_event->participants))
|
||||
{
|
||||
$add = True;
|
||||
$old_part_count = count($old_event->participants);
|
||||
for($k=0;$k<$old_part_count;$k++)
|
||||
if(!isset($old_event->participants[$new_userid]))
|
||||
{
|
||||
if($new_event->participants[$i] == $old_event->participants[$k])
|
||||
{
|
||||
$add = False;
|
||||
}
|
||||
}
|
||||
if($add == True)
|
||||
{
|
||||
$this->added[] = $new_event->participants[$i];
|
||||
$new_event->status[$i] = 'U';
|
||||
// echo "Adding event for user ".$new_userid."<br>\n";
|
||||
$this->added[$new_userid] = 'U';
|
||||
$new_event->participants[$new_userid] = 'U';
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,12 +389,12 @@ class calendar__
|
||||
return $this->fetch_event($this->event->id);
|
||||
}
|
||||
|
||||
function add_attribute($attribute,$value)
|
||||
function add_attribute($attribute,$value,$element='')
|
||||
{
|
||||
if(is_array($value))
|
||||
{
|
||||
reset($value);
|
||||
}
|
||||
$this->event->$attribute = $value;
|
||||
eval("\$this->event->".$attribute." = ".$value.";");
|
||||
}
|
||||
}
|
||||
|
@ -338,6 +338,7 @@ class calendar_ extends calendar__
|
||||
TENTATIVE => 'T',
|
||||
ACCEPTED => 'A'
|
||||
);
|
||||
$this->add_attribute('status['.$owner.']',$status_code_short[$status]);
|
||||
// $this->stream->query("UPDATE calendar_entry_user SET cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__);
|
||||
return True;
|
||||
}
|
||||
|
@ -200,8 +200,9 @@ class calendar_ extends calendar__
|
||||
{
|
||||
$this->event->users_status = $this->stream->f('cal_status');
|
||||
}
|
||||
$this->event->participants[] = $this->stream->f('cal_login');
|
||||
$this->event->status[] = $this->stream->f('cal_status');
|
||||
// $this->event->participants[$this->stream->f('cal_login')] = $this->stream->f('cal_status');
|
||||
// $this->add_attribute('participants',$this->stream->f('cal_status'),intval($this->stream->f('cal_login')));
|
||||
$this->add_attribute('participants['.intval($this->stream->f('cal_login')).']',$this->stream->f('cal_status'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -256,10 +257,9 @@ class calendar_ extends calendar__
|
||||
}
|
||||
else
|
||||
{
|
||||
$part_count = count($this->event->participants);
|
||||
for($i=0;$i<$part_count;$i++)
|
||||
while(list($key,$value) = each($this->event->participants))
|
||||
{
|
||||
$this->event->status[$i] = 'U';
|
||||
$this->add_attribute('participants['.intval($key).']','U');
|
||||
}
|
||||
$this->send_update(MSG_ADDED,$this->event->participants,'',$this->event);
|
||||
}
|
||||
@ -290,7 +290,7 @@ class calendar_ extends calendar__
|
||||
// return next_recurrence (int stream, int weekstart, array next);
|
||||
}
|
||||
|
||||
function expunge($stream)
|
||||
function expunge()
|
||||
{
|
||||
if(count($this->deleted_events) <= 0)
|
||||
{
|
||||
@ -307,7 +307,7 @@ class calendar_ extends calendar__
|
||||
{
|
||||
$event_id = $this->deleted_events[$i];
|
||||
|
||||
$event = $this->fetch_event($stream,$event_id);
|
||||
$event = $this->fetch_event($event_id);
|
||||
$this->send_update(MSG_DELETED,$event->participants,$event);
|
||||
|
||||
for($k=0;$k<count($locks);$k++)
|
||||
@ -420,16 +420,12 @@ class calendar_ extends calendar__
|
||||
reset($event->participants);
|
||||
while (list($key,$value) = each($event->participants))
|
||||
{
|
||||
if(intval($value) == intval($this->user))
|
||||
if(intval($key) == intval($this->user))
|
||||
{
|
||||
$status = 'A';
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = $event->status[$key];
|
||||
$value = 'A';
|
||||
}
|
||||
$this->stream->query('INSERT INTO phpgw_cal_user(cal_id,cal_login,cal_status) '
|
||||
. 'VALUES('.$event->id.','.$value.",'".$status."')",__LINE__,__FILE__);
|
||||
. 'VALUES('.$event->id.','.intval($key).",'".$value."')",__LINE__,__FILE__);
|
||||
}
|
||||
|
||||
if($event->recur_type != RECUR_NONE)
|
||||
@ -469,14 +465,6 @@ class calendar_ extends calendar__
|
||||
return True;
|
||||
}
|
||||
|
||||
function event_set_participants($stream,$participants)
|
||||
{
|
||||
$this->event->participants = Array();
|
||||
reset($participants);
|
||||
$this->event->participants = $participants;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_status($id,$owner,$status)
|
||||
{
|
||||
$status_code_short = Array(
|
||||
|
@ -35,6 +35,7 @@
|
||||
. '<tr><td bgcolor="'.$phpgw_info["theme"]["bg_text"].'" valign="top">';
|
||||
// $phpgw->calendar->printer_friendly = True;
|
||||
$now = $phpgw->calendar->datetime->makegmttime(0,0,0,$phpgw->calendar->today['month'],$phpgw->calendar->today['day'],$phpgw->calendar->today['year']);
|
||||
$now['raw'] += $phpgw->calendar->datetime->tz_offset;
|
||||
echo $phpgw->calendar->print_day_at_a_glance($now).'</td></tr></table>'."\n";
|
||||
// $phpgw->calendar->printer_friendly = False;
|
||||
echo "\n".'<!-- Calendar info --></table></td></tr>'."\n";
|
||||
|
@ -99,7 +99,7 @@
|
||||
'button_value' => lang('Go!')
|
||||
);
|
||||
$tpl->set_var($var);
|
||||
$tpl->fp('header_column','form_button_dropdown',True);
|
||||
$tpl->parse('header_column','form_button_dropdown',True);
|
||||
}
|
||||
|
||||
if(count($grants) > 0)
|
||||
|
@ -99,7 +99,7 @@
|
||||
'button_value' => lang('Go!')
|
||||
);
|
||||
$tpl->set_var($var);
|
||||
$tpl->fp('header_column','form_button_dropdown',True);
|
||||
$tpl->parse('header_column','form_button_dropdown',True);
|
||||
}
|
||||
|
||||
if(count($grants) > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user