Various changes.. Too numerous to mention. Major change is a table change for having multiple categories for a sngle event.

This commit is contained in:
skeeter 2001-09-17 02:33:19 +00:00
parent 41c8bd58d3
commit 2da7e41cd4
13 changed files with 460 additions and 263 deletions

View File

@ -164,33 +164,38 @@
$this->filter = ' '.$this->prefs['calendar']['defaultfilter'].' ';
}
if(isset($GLOBALS['date']))
$date = (isset($GLOBALS['HTTP_GET_VARS']['date'])?$GLOBALS['HTTP_GET_VARS']['date']:(isset($GLOBALS['HTTP_POST_VARS']['date'])?$GLOBALS['HTTP_POST_VARS']['date']:''));
$year = (isset($GLOBALS['HTTP_GET_VARS']['year'])?$GLOBALS['HTTP_GET_VARS']['year']:(isset($GLOBALS['HTTP_POST_VARS']['year'])?$GLOBALS['HTTP_POST_VARS']['year']:''));
$month = (isset($GLOBALS['HTTP_GET_VARS']['month'])?$GLOBALS['HTTP_GET_VARS']['month']:(isset($GLOBALS['HTTP_POST_VARS']['month'])?$GLOBALS['HTTP_POST_VARS']['month']:''));
$day = (isset($GLOBALS['HTTP_GET_VARS']['day'])?$GLOBALS['HTTP_GET_VARS']['day']:(isset($GLOBALS['HTTP_POST_VARS']['day'])?$GLOBALS['HTTP_POST_VARS']['day']:''));
if(isset($date))
{
$this->year = intval(substr($GLOBALS['date'],0,4));
$this->month = intval(substr($GLOBALS['date'],4,2));
$this->day = intval(substr($GLOBALS['date'],6,2));
$this->year = intval(substr($date,0,4));
$this->month = intval(substr($date,4,2));
$this->day = intval(substr($date,6,2));
}
else
{
if(isset($GLOBALS['year']))
if(isset($year))
{
$this->year = $GLOBALS['year'];
$this->year = $year;
}
elseif($this->year == 0)
{
$this->year = date('Y',time());
}
if(isset($GLOBALS['month']))
if(isset($month))
{
$this->month = $GLOBALS['month'];
$this->month = $month;
}
elseif($this->month == 0)
{
$this->month = date('m',time());
}
if(isset($GLOBALS['day']))
if(isset($day))
{
$this->day = $GLOBALS['day'];
$this->day = $day;
}
elseif($this->day == 0)
{
@ -372,6 +377,7 @@
{
$l_cal = (@isset($params['cal']) && $params['cal']?$params['cal']:$GLOBALS['HTTP_POST_VARS']['cal']);
$l_participants = (@$params['participants']?$params['participants']:$GLOBALS['HTTP_POST_VARS']['participants']);
$l_categories = (@$params['categories']?$params['categories']:$GLOBALS['HTTP_POST_VARS']['categories']);
$l_start = (@isset($params['start']) && $params['start']?$params['start']:$GLOBALS['HTTP_POST_VARS']['start']);
$l_end = (@isset($params['end']) && $params['end']?$params['end']:$GLOBALS['HTTP_POST_VARS']['end']);
$l_recur_enddate = (@isset($params['recur_enddate']) && $params['recur_enddate']?$params['recur_enddate']:$GLOBALS['HTTP_POST_VARS']['recur_enddate']);
@ -425,15 +431,15 @@
$l_cal['private'] = 'public';
}
if(!isset($l_cal['category']))
if(!isset($l_categories))
{
$l_cal['category'] = 0;
$l_categories = 0;
}
$is_public = ($l_cal['private'] == 'public'?1:0);
$this->so->event_init();
$this->add_attribute('uid',$l_cal['uid']);
$this->so->set_category($l_cal['category']);
$this->so->set_category(implode($l_categories,','));
$this->so->set_title($l_cal['title']);
$this->so->set_description($l_cal['description']);
$this->so->set_start($l_start['year'],$l_start['month'],$l_start['mday'],$l_start['hour'],$l_start['min'],0);
@ -532,8 +538,8 @@
$this->so->add_attribute('priority',$l_cal['priority']);
$event = $this->get_cached_event();
$event['title'] = addslashes($event['title']);
$event['description'] = addslashes($event['description']);
$event['title'] = $GLOBALS['phpgw']->db->db_addslashes($event['title']);
$event['description'] = $GLOBALS['phpgw']->db->db_addslashes($event['description']);
$this->store_to_appsession($event);
$datetime_check = $this->validate_update($event);
if($datetime_check)
@ -1649,166 +1655,6 @@
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
}
function switch_status($status)
{
switch($status)
{
case 'U':
return 0;
break;
case 'A':
return 1;
break;
case 'R':
return 2;
break;
case 'T':
return 3;
break;
}
}
function export_ical($l_event_id=0)
{
$event_id = ($l_event_id?$l_event_id:$GLOBALS['HTTP_GET_VARS']['cal_id']);
include(PHPGW_APP_INC.'/../setup/setup.inc.php');
$icalendar = CreateObject('calendar.boicalendar');
if(!is_array($event_id))
{
$ids[] = $event_id;
}
else
{
$ids = $event_id;
}
$ical = $icalendar->new_ical();
$icalendar->set_var($ical['prodid'],'value','-//phpGroupWare//phpGroupWare '.$setup_info['calendar']['version'].' MIMEDIR//'.strtoupper($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']));
$icalendar->set_var($ical['version'],'value','2.0');
$icalendar->set_var($ical['method'],'value',strtoupper('publish'));
while(list($key,$value) = each($ids))
{
$ical_event = Array();
$event = $this->so->read_entry($event_id);
$icalendar->set_var($ical_event['uid'],'value','phpGW/'.$event['id']);
$ical_event['priority'] = $event['priority'];
$ical_event['class'] = intval($event['public']);
$icalendar->set_var($ical_event['description'],'value',$event['title']);
$icalendar->set_var($ical_event['summary'],'value',$event['description']);
$icalendar->set_var($ical_event['location'],'value',$event['location']);
$icalendar->set_var($ical_event['uid'],'value',$event['uid']);
$dtstart_mktime = $this->maketime($event['start']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
$dtend_mktime = $this->maketime($event['end']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
$mod_mktime = $this->maketime($event['modtime']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
if($event['location'])
{
$icalendar->set_var($ical_event['location'],'value',$event['location']);
}
if(count($event['participants']) > 1)
{
$db = $GLOBALS['phpgw']->db;
@reset($event['participants']);
while(list($part,$status) = each($event['participants']))
{
$GLOBALS['phpgw']->accounts->get_account_name($accountid,$lid,$fname,$lname);
$name = $fname.' '.$lname;
$owner_status = $icalendar->switch_partstat(intval($this->switch_status($event['participants'][$part])));
$owner_mailto = 'mpeters@satx.rr.com';
$str = 'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$owner_mailto;
if($part == $event['owner'])
{
$str = 'ROLE=CHAIR;'.$str;
}
else
{
$str = 'ROLE=REQ-PARTICIPANT;'.$str;
}
$icalendar->parse_value($ical_event,'attendee',$str,'vevent');
if($part == $event['owner'])
{
$icalendar->parse_value($ical_event,'organizer',$str,'vevent');
}
}
}
if($event['recur_type'])
{
$str = '';
switch($event['recur_type'])
{
case MCAL_RECUR_DAILY:
$str .= 'FREQ=DAILY';
break;
case MCAL_RECUR_WEEKLY:
$str .= 'FREQ=WEEKLY';
if($event['recur_data'])
{
$str .= ';BYDAY=';
for($i=1;$i<MCAL_M_ALLDAYS;$i=$i*2)
{
if($i & $event['recur_data'])
{
switch($i)
{
case MCAL_M_SUNDAY:
$day[] = 'SU';
break;
case MCAL_M_MONDAY:
$day[] = 'MO';
break;
CASE MCAL_M_TUESDAY:
$day[] = 'TU';
break;
case MCAL_M_WEDNESDAY:
$day[] = 'WE';
break;
case MCAL_M_THURSDAY:
$day[] = 'TH';
break;
case MCAL_M_FRIDAY:
$day[] = 'FR';
break;
case MCAL_M_SATURDAY:
$day[] = 'SA';
break;
}
}
}
$str .= implode(',',$day);
}
break;
case MCAL_RECUR_MONTHLY_MDAY:
break;
case MCAL_RECUR_MONTHLY_WDAY:
break;
case MCAL_RECUR_YEARLY:
$str .= 'FREQ=YEARLY';
break;
}
if($event['recur_interval'])
{
$str .= ';INTERVAL='.$event['recur_interval'];
}
if($event['recur_enddate']['month'] != 0 && $event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['year'] != 0)
{
$recur_mktime = $this->maketime($event['recur_enddate']) - $this->datetime->tz_offset;
$str .= ';UNTIL='.date('Ymd\THis\Z',$recur_mktime);
}
$icalendar->parse_value($ical_event,'rrule',$str,'vevent');
}
$ical_events[] = $ical_event;
}
$ical['event'] = $ical_events;
return $icalendar->build_ical($ical);
}
function get_alarms($event_id)
{
return $this->so->get_alarm($event_id);

View File

@ -265,7 +265,7 @@
if(count($holiday) == 7)
{
$holiday['locale'] = $holiday[0];
$holiday['name'] = addslashes($holiday[1]);
$holiday['name'] = $GLOBALS['phpgw']->db->db_addslashes($holiday[1]);
$holiday['mday'] = intval($holiday[2]);
$holiday['month_num'] = intval($holiday[3]);
$holiday['occurence'] = intval($holiday[4]);

View File

@ -81,7 +81,8 @@ class boicalendar
{
var $public_functions = array(
'import' => True
'import' => True,
'export' => True
);
@ -1718,17 +1719,17 @@ class boicalendar
{
for($i=0;$i<count($event[$value]);$i++)
{
$str .= $this->fold(strtoupper($value).$this->build_parameters($event[$value][$i],$value));
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_parameters($event[$value][$i],$value));
}
}
else
{
$str .= $this->fold(strtoupper($value).$this->build_parameters($event[$value],$value));
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_parameters($event[$value],$value));
}
}
elseif($value == 'dtstamp' || $value == 'created')
{
$str .= $this->fold(strtoupper($value).':'.gmdate('Ymd\THis\Z'));
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).':'.gmdate('Ymd\THis\Z'));
}
break;
case 'uri':
@ -1736,7 +1737,7 @@ class boicalendar
{
for($i=0;$i<count($event[$value]);$i++)
{
$str .= $this->fold(strtoupper($value).$this->build_parameters($event[$value][$i],$to_text));
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_parameters($event[$value][$i],$to_text));
}
}
break;
@ -1819,7 +1820,7 @@ class boicalendar
$temp_output = $this->build_parameters($event[$value][$j],$value);
if($temp_output)
{
$str .= $this->fold(strtoupper($value).$temp_output);
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$temp_output);
}
}
}
@ -1828,7 +1829,7 @@ class boicalendar
$temp_output = $this->build_parameters($event[$value],$value);
if($temp_output)
{
$str .= $this->fold(strtoupper($value).$temp_output);
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$temp_output);
}
}
break;
@ -2783,8 +2784,74 @@ class boicalendar
return $str;
}
function import()
{
function switch_to_phpgw_status($partstat)
{
switch($partstat)
{
case 0:
return 'U';
break;
case 1:
return 'A';
break;
case 2:
return 'R';
break;
case 3:
return 'T';
break;
default:
return 'U';
break;
}
}
function switch_phpgw_status($status)
{
switch($status)
{
case 'U':
return 0;
break;
case 'A':
return 1;
break;
case 'R':
return 2;
break;
case 'T':
return 3;
break;
}
}
function check_owner(&$event,$ical,$so_event)
{
if(!isset($event['participant'][$GLOBALS['phpgw_info']['user']['account_id']]))
{
if(isset($ical['organizer']) &&
$ical['organizer']['user'].'@'.$ical['organizer']['host'] == $GLOBALS['phpgw_info']['user']['preferences']['email']['address'])
{
$so_event->add_attribute('owner',$GLOBALS['phpgw_info']['user']['account_id']);
$so_event->add_attribute('participants',$this->switch_to_phpgw_status($ical['organizer']['partstat']),$GLOBALS['phpgw_info']['user']['account_id']);
}
else
{
$attendee_count = count($ical['attendee']);
for($j=0;$j<$attendee_count;$j++)
{
if($ical['attendee'][$j]['user'].'@'.$ical['attendee'][$j]['host'] == $GLOBALS['phpgw_info']['user']['preferences']['email']['address'])
{
$so_event->add_attribute('participants',$this->switch_to_phpgw_status($ical['attendee'][$j]['partstat']),$GLOBALS['phpgw_info']['user']['account_id']);
}
}
}
}
}
function import_file()
{
if($GLOBALS['uploadedfile'] == 'none' || $GLOBALS['uploadedfile'] == '')
{
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',
@ -2803,26 +2870,52 @@ class boicalendar
$newfilename = md5($GLOBALS['uploadedfile'].", ".$uploadedfile_name.", "
. time() . getenv("REMOTE_ADDR") . $random_number );
copy($GLOBALS['uploadedfile'], $uploaddir . $newfilename);
$filename = $uploaddir . $newfilename;
copy($GLOBALS['uploadedfile'], $filename);
// $ftp = fopen($uploaddir . $newfilename . '.info','wb');
// fputs($ftp,$uploadedfile_type."\n".$uploadedfile_name."\n");
// fclose($ftp);
return $filename;
}
$filename = $uploaddir . $newfilename;
$fp=fopen($filename,'rt');
$mime_msg = explode("\n",fread($fp, filesize($filename)));
fclose($fp);
function import($mime_msg='')
{
if($GLOBALS['uploadedfile'] != 'none' && $GLOBALS['uploadedfile'] != '')
{
$filename = $this->import_file();
$fp=fopen($filename,'rt');
$mime_msg = explode("\n",fread($fp, filesize($filename)));
fclose($fp);
unlink($filename);
}
elseif(!$mime_msg)
{
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',
Array(
'menuaction' => 'calendar.uiicalendar.import',
'action' => 'GetFile'
)
)
);
$GLOBALS['phpwg']->common->phpgw_exit();
}
$so_event = createobject('calendar.socalendar',
Array(
'owner' => 0,
'filter' => '',
'category' => ''
)
);
if(!is_object($GLOBALS['uicalendar']))
{
$so_event = createobject('calendar.socalendar',
Array(
'owner' => 0,
'filter' => '',
'category' => ''
)
);
}
else
{
$so_event = $GLOBALS['uicalendar']->bo->so;
}
unlink($filename);
$datetime_vars = Array(
'start' => 'dtstart',
'end' => 'dtend',
@ -2839,6 +2932,9 @@ class boicalendar
's' => 'sec'
);
$GLOBALS['phpgw']->common->create_emailpreferences();
$users_email = $GLOBALS['phpgw_info']['user']['preferences']['email']['address'];
$cats = CreateObject('phpgwapi.categories');
$ical = $this->parse($mime_msg);
$c_events = count($ical['event']);
for($i=0;$i<$c_events;$i++)
@ -2850,15 +2946,11 @@ class boicalendar
if($uid_exists)
{
$event = $so_event->read_entry($uid_exists[0]);
if(!isset($event['participant'][$GLOBALS['phpgw_info']['user']['account_id']]))
{
$so_event->add_attribute('participants','A',$GLOBALS['phpgw_info']['user']['account_id']);
$event = $so_event->get_cached_event();
$so_event->add_entry($event);
$event = $so_event->get_cached_event();
}
$event = $so_event->read_entry($uid_exists);
$this->check_owner($event,$ical['event'][$i],$so_event);
$event = $so_event->get_cached_event();
$so_event->add_entry($event);
$event = $so_event->get_cached_event();
}
else
{
@ -2909,13 +3001,51 @@ class boicalendar
$so_event->set_date($e_datevar,$event[$e_datevar]['year'],$event[$e_datevar]['month'],$event[$e_datevar]['mday'],$event[$e_datevar]['hour'],$event[$e_datevar]['min'],$event[$e_datevar]['sec']);
}
}
if(!isset($ical['event'][$i]['category']['value']) || !$ical['event'][$i]['category']['value'])
if(!isset($ical['event'][$i]['categories']['value']) || !$ical['event'][$i]['categories']['value'])
{
$so_event->add_attribute('category',0);
$so_event->set_category(0);
}
else
{
//categories -- with value
$ical_cats = Array();
if(strpos($ical['event'][$i]['categories']['value'],','))
{
$ical_cats = explode(',',$ical['event'][$i]['categories']['value']);
}
else
{
$ical_cats[] = $ical['event'][$i]['categories']['value'];
}
@reset($ical_cats);
while(list($key,$cat) = each($ical_cats))
{
if(!$cats->exists('appandmains',$cat))
{
$cats->add(
Array(
'name' => $cat,
'descr' => $cat,
'parent' => '',
'access' => 'private',
'data' => ''
)
);
}
// $temp_id = $cats->name2id($cat);
// echo 'Category Name : '.$cat.' : Category ID :'.$temp_id."<br>\n";
// $cat_id_nums[] = $temp_id;
$cat_id_nums[] = $cats->name2id($cat);
}
@reset($cat_id_nums);
if(count($cat_id_nums) > 1)
{
$so_event->set_category(implode($cat_id_nums,','));
}
else
{
$so_event->set_category($cat_id_nums[0]);
}
}
if(isset($ical['event'][$i]['rrule']))
@ -2946,14 +3076,195 @@ class boicalendar
)
);
$GLOBALS['phpgw']->common->phpgw_exit();
}
}
function debug($str='')
{
if($this->debug_str)
function export($l_event_id=0)
{
echo $str."<br>\n";
$event_id = ($l_event_id?$l_event_id:$GLOBALS['HTTP_GET_VARS']['cal_id']);
$string_array = Array(
'summary' => 'description',
'location' => 'location',
'description' => 'title',
'uid' => 'uid'
);
$cats = CreateObject('phpgwapi.categories');
include(PHPGW_APP_INC.'/../setup/setup.inc.php');
if(!is_array($event_id))
{
$ids[] = $event_id;
}
else
{
$ids = $event_id;
}
$ical = $this->new_ical();
$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'])
{
$so_event = createobject('calendar.socalendar',
Array(
'owner' => 0,
'filter' => '',
'category' => ''
)
);
}
else
{
$so_event = $GLOBALS['uicalendar']->bo->so;
}
while(list($key,$value) = each($ids))
{
$ical_event = Array();
$event = $so_event->read_entry($value);
$ical_event['priority'] = $event['priority'];
$ical_event['class'] = intval($event['public']);
$dtstart_mktime = $so_event->maketime($event['start']) - $so_event->datetime->tz_offset;
$this->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
$dtend_mktime = $so_event->maketime($event['end']) - $so_event->datetime->tz_offset;
$this->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
$mod_mktime = $so_event->maketime($event['modtime']) - $so_event->datetime->tz_offset;
$this->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
@reset($string_array);
while(list($ical_value,$event_value) = each($string_array))
{
if($event[$event_value])
{
$this->set_var($ical_event[$ical_value],'value',$event[$event_value]);
}
}
if ($event['category'])
{
$cats->categories(0,'calendar');
$category = explode(',',$event['category']);
@reset($category);
while(list($key,$cat) = each($category))
{
$_cat = $cats->return_single($cat);
$cat_string[] = $_cat[0]['name'];
}
@reset($cat_string);
$this->set_var($ical_event['categories'],'value',implode($cat_string,','));
}
if(count($event['participants']) > 1)
{
if(!is_object($db))
{
$db = $GLOBALS['phpgw']->db;
}
@reset($event['participants']);
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 = 'mpeters@satx.rr.com';
$str = 'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$owner_mailto;
if($part == $event['owner'])
{
$str = 'ROLE=CHAIR;'.$str;
}
else
{
$str = 'ROLE=REQ-PARTICIPANT;'.$str;
}
$this->parse_value($ical_event,'attendee',$str,'vevent');
if($part == $event['owner'])
{
$this->parse_value($ical_event,'organizer',$str,'vevent');
}
}
}
if($event['recur_type'])
{
$str = '';
switch($event['recur_type'])
{
case MCAL_RECUR_DAILY:
$str .= 'FREQ=DAILY';
break;
case MCAL_RECUR_WEEKLY:
$str .= 'FREQ=WEEKLY';
if($event['recur_data'])
{
$str .= ';BYDAY=';
for($i=1;$i<MCAL_M_ALLDAYS;$i=$i*2)
{
if($i & $event['recur_data'])
{
switch($i)
{
case MCAL_M_SUNDAY:
$day[] = 'SU';
break;
case MCAL_M_MONDAY:
$day[] = 'MO';
break;
CASE MCAL_M_TUESDAY:
$day[] = 'TU';
break;
case MCAL_M_WEDNESDAY:
$day[] = 'WE';
break;
case MCAL_M_THURSDAY:
$day[] = 'TH';
break;
case MCAL_M_FRIDAY:
$day[] = 'FR';
break;
case MCAL_M_SATURDAY:
$day[] = 'SA';
break;
}
}
}
$str .= implode(',',$day);
}
break;
case MCAL_RECUR_MONTHLY_MDAY:
break;
case MCAL_RECUR_MONTHLY_WDAY:
break;
case MCAL_RECUR_YEARLY:
$str .= 'FREQ=YEARLY';
break;
}
if($event['recur_interval'])
{
$str .= ';INTERVAL='.$event['recur_interval'];
}
if($event['recur_enddate']['month'] != 0 && $event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['year'] != 0)
{
$recur_mktime = $so_event->maketime($event['recur_enddate']) - $so_event->datetime->tz_offset;
$str .= ';UNTIL='.date('Ymd\THis\Z',$recur_mktime);
}
$this->parse_value($ical_event,'rrule',$str,'vevent');
}
$ical_events[] = $ical_event;
}
$ical['event'] = $ical_events;
return $this->build_ical($ical);
}
function debug($str='')
{
if($this->debug_str)
{
echo $str."<br>\n";
}
}
}
}
?>

View File

@ -134,8 +134,14 @@
{
$found = $this->cal->get_event_ids(True,$sql);
}
return $found;
if(is_array($found))
{
return $found[0];
}
else
{
return False;
}
}
function add_entry(&$event)

View File

@ -117,7 +117,7 @@ class socalendar_ extends socalendar__
$this->add_attribute('owner',intval($this->stream->f('owner')));
$this->add_attribute('id',intval($this->stream->f('cal_id')));
$this->set_class(intval($this->stream->f('is_public')));
$this->set_category(intval($this->stream->f('category')));
$this->set_category($this->stream->f('category'));
$this->set_title($GLOBALS['phpgw']->strip_html($this->stream->f('title')));
$this->set_description($GLOBALS['phpgw']->strip_html($this->stream->f('description')));
$this->add_attribute('uid',$GLOBALS['phpgw']->strip_html($this->stream->f('uid')));
@ -380,31 +380,34 @@ class socalendar_ extends socalendar__
$this->stream->lock($locks);
if($event['id'] == 0)
{
if ($GLOBALS['phpgw_info']['server']['hostname'] != '')
if(!$event['uid'])
{
$id_suffix = $GLOBALS['phpgw_info']['server']['hostname'];
}
else
{
$id_suffix = $GLOBALS['phpgw']->common->randomstring(3).'local';
}
$parts = Array(
0 => 'title',
1 => 'description'
);
@reset($parts);
while(list($key,$field) = each($parts))
{
$part[$key] = substr($GLOBALS['phpgw']->crypto->encrypt($event[$field]),0,20);
if(!$GLOBALS['phpgw']->crypto->enabled)
if ($GLOBALS['phpgw_info']['server']['hostname'] != '')
{
$part[$key] = bin2hex(unserialize($part[$key]));
$id_suffix = $GLOBALS['phpgw_info']['server']['hostname'];
}
else
{
$id_suffix = $GLOBALS['phpgw']->common->randomstring(3).'local';
}
$parts = Array(
0 => 'title',
1 => 'description'
);
@reset($parts);
while(list($key,$field) = each($parts))
{
$part[$key] = substr($GLOBALS['phpgw']->crypto->encrypt($event[$field]),0,20);
if(!$GLOBALS['phpgw']->crypto->enabled)
{
$part[$key] = bin2hex(unserialize($part[$key]));
}
}
$event['uid'] = $part[0].'-'.$part[1].'@'.$id_suffix;
}
$event['uid'] = $part[0].'-'.$part[1].'@'.$id_suffix;
$temp_name = tempnam($GLOBALS['phpgw_info']['server']['temp_dir'],'cal');
$this->stream->query('INSERT INTO phpgw_cal(uid,title,owner,priority,is_public,category) '
. "values('".$event['uid']."','".$temp_name."',".$event['owner'].','.$event['priority'].','.$event['public'].','.$event['category'].')');
. "values('".$event['uid']."','".$temp_name."',".$event['owner'].','.$event['priority'].','.$event['public'].",'".$event['category']."')");
$this->stream->query("SELECT cal_id FROM phpgw_cal WHERE title='".$temp_name."'");
$this->stream->next_record();
$event['id'] = $this->stream->f('cal_id');
@ -429,11 +432,11 @@ class socalendar_ extends socalendar__
. 'mdatetime='.$today.', '
. 'edatetime='.$enddate.', '
. 'priority='.$event['priority'].', '
. 'category='.$event['category'].', '
. "category='".$event['category']."', "
. "cal_type='".$type."', "
. 'is_public='.$event['public'].', '
. "title='".addslashes($event['title'])."', "
. "description='".addslashes($event['description'])."', "
. "title='".$this->stream->db_addslashes($event['title'])."', "
. "description='".$this->stream->db_addslashes($event['description'])."', "
. "location='".$event['location']."', "
. 'reference='.$event['reference'].' '
. 'WHERE cal_id='.$event['id'];

View File

@ -645,7 +645,7 @@
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
echo nl2br($this->bo->export_ical($cal_id));
echo nl2br(execmethod('calendar.boicalendar.export',$GLOBALS['HTTP_GET_VARS']['cal_id']));
}
function add($cd=0,$readsess=0)
@ -1105,6 +1105,8 @@
}
}
$num_users = count($users);
if ($num_users > 50)
{
$size = 15;
@ -1461,19 +1463,16 @@
);
$this->output_template_array($p,'table_row','footer_row',$var);
$y = $this->bo->year;
$m = $this->bo->month;
$d = $this->bo->day;
unset($thisdate);
$thisdate = $this->bo->datetime->makegmttime(0,0,0,$m,$d,$y);
$sun = $this->bo->datetime->get_weekday_start($y,$m,$d) - $this->tz_offset - 7200;
$thisdate = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->tz_offset;
$sun = $this->bo->datetime->get_weekday_start($this->bo->year,$this->bo->month,$this->bo->day) - $this->tz_offset - 7200;
$str = '';
for ($i = -7; $i <= 7; $i++)
{
$begin = $sun + (3600 * 24 * 7 * $i);
$end = $begin + (3600 * 24 * 6);
$str .= '<option value="' . $GLOBALS['phpgw']->common->show_date($begin,'Ymd') . '"'.($begin <= $thisdate['raw'] && $end >= $thisdate['raw']?' selected':'')
$begin = $sun + (604800 * $i);
$end = $begin + 604799;
$str .= '<option value="' . $GLOBALS['phpgw']->common->show_date($begin,'Ymd') . '"'.($begin <= $thisdate && $end >= $thisdate?' selected':'')
.'>' . lang($GLOBALS['phpgw']->common->show_date($begin,'F')) . ' ' . $GLOBALS['phpgw']->common->show_date($begin,'d') . '-'
. lang($GLOBALS['phpgw']->common->show_date($end,'F')) . ' ' . $GLOBALS['phpgw']->common->show_date($end,'d') . '</option>'."\n";
}
@ -1491,9 +1490,9 @@
$this->output_template_array($p,'table_row','footer_row',$var);
$str = '';
for ($i = ($y - 3); $i < ($y + 3); $i++)
for ($i = ($this->bo->year - 3); $i < ($this->bo->year + 3); $i++)
{
$str .= '<option value="'.$i.'"'.($i == $y?' selected':'').'>'.$i.'</option>'."\n";
$str .= '<option value="'.$i.'"'.($i == $this->bo->year?' selected':'').'>'.$i.'</option>'."\n";
}
$var = Array(
@ -2120,10 +2119,17 @@
if ($event['category'])
{
$this->cat->categories($this->bo->owner,'calendar');
$cat = $this->cat->return_single($event['category']);
$category = explode(',',$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' => $cat[0]['name']
'data' => implode($cat_string,',')
);
}
@ -2841,7 +2847,7 @@
// Display Categories
$var[] = Array(
'field' => lang('Category'),
'data' => '<select name="cal[category]"><option value="0">'.lang('Choose the category').'</option>'.$this->cat->formated_list('select','all',$event['category'],True).'</select>'
'data' => '<select name="categories" multiple size="5"><option value="0">'.lang('Choose the category').'</option>'.$this->cat->formated_list('select','all',explode(',',$event['category']),True).'</select>'
);
// Location

View File

@ -80,7 +80,7 @@
function test()
{
$print_events = False;
$print_events = True;
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
@ -116,6 +116,7 @@
$this->print_test($event['location'],'Location','X-');
$this->print_test($event['sequence'],'Sequence','X-');
$this->print_test($event['priority'],'Priority','X-');
$this->print_test($event['categories'],'Categories','X-');
$this->print_test($event['dtstart'],'Date Start','X-');
$this->print_test($event['dtstamp'],'Date Stamp','X-');
$this->print_test($event['rrule'],'Recurrence','X-');
@ -188,6 +189,7 @@
$var = Array(
'vcal_header' => '<p>&nbsp;<b>' . lang('Calendar - [iv]Cal Importer') . '</b><hr><p>',
'ical_lang' => lang('(i/v)Cal'),
'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.boicalendar.import'),
'lang_access' => lang('Access'),
'lang_groups' => lang('Which groups'),

View File

@ -23,10 +23,10 @@
'nofooter' => True
);
$phpgw_info['flags'] = $phpgw_flags;
$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
include('../header.inc.php');
Header('Location: '.$phpgw->link('/index.php','menuaction=calendar.uicalendar.index'));
$phpgw->common->phpgw_exit();
Header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.index&date='.date('Ymd')));
$GLOBALS['phpgw']->common->phpgw_exit();
?>

View File

@ -1,4 +1,5 @@
1 match found calendar en 1 match found
(i/v)cal calendar en (i/v)Cal
a calendar en a
accept calendar en Accept
accepted calendar en Accepted
@ -11,6 +12,7 @@ are you sure you want to delete this holiday ? calendar en Are you sure you want
brief description calendar en Brief Description
calendar common en calendar
calendar preferences common en Calendar preferences
calendar - [iv]cal importer calendar en Calendar - [iv]Cal Importer
calendar - add calendar en Calendar - Add
calendar - edit calendar en Calendar - Edit
calendar holiday management admin en Calendar Holiday Management
@ -41,6 +43,7 @@ grant calendar access common en Grant Calendar Access
group public only calendar en Group Public Only
ignore conflict calendar en Ignore Conflict
i participate calendar en I Participate
load [iv]cal calendar en Load [iv]Cal
location calendar en Location
minutes calendar en minutes
mo calendar en M

View File

@ -13,7 +13,7 @@
$setup_info['calendar']['name'] = 'calendar';
$setup_info['calendar']['title'] = 'Calendar';
$setup_info['calendar']['version'] = '0.9.13.005';
$setup_info['calendar']['version'] = '0.9.13.006';
$setup_info['calendar']['app_order'] = 3;
$setup_info['calendar']['enable'] = 1;

View File

@ -17,7 +17,7 @@
'cal_id' => array('type' => 'auto','nullable' => False),
'uid' => array('type' => 'varchar', 'precision' => 255,'nullable' => False),
'owner' => array('type' => 'int', 'precision' => 8,'nullable' => False),
'category' => array('type' => 'int', 'precision' => 8,'nullable' => True),
'category' => array('type' => 'varchar', 'precision' => 30,'nullable' => True),
'groups' => array('type' => 'varchar', 'precision' => 255,'nullable' => True),
'datetime' => array('type' => 'int', 'precision' => 8,'nullable' => True),
'mdatetime' => array('type' => 'int', 'precision' => 8,'nullable' => True),

View File

@ -877,4 +877,24 @@
$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005';
return $GLOBALS['setup_info']['calendar']['currentver'];
}
$test[] = '0.9.13.005';
function calendar_upgrade0_9_13_005()
{
$GLOBALS['phpgw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__);
while($GLOBALS['phpgw_setup']->oProc->next_record())
{
$calendar_data[$GLOBALS['phpgw_setup']->oProc->f('cal_id')] = $GLOBALS['phpgw_setup']->oProc->f('category');
}
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True));
@reset($calendar_data);
while(list($cal_id,$category) = each($calendar_data))
{
$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__);
}
$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006';
return $GLOBALS['setup_info']['calendar']['currentver'];
}
?>

View File

@ -3,7 +3,7 @@
<form ENCTYPE="multipart/form-data" method="POST" action="{action_url}">
<table border=0>
<tr>
<td>(i/v)Cal: <input type="file" name="uploadedfile"></td>
<td>{ical_lang}: <input type="file" name="uploadedfile"></td>
<td><input type="submit" name="action" value="{load_vcal}"></td>
</tr>
</table>