[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] calendar/inc class.uiicalendar.inc.php, 1.10 class.ui
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] calendar/inc class.uiicalendar.inc.php, 1.10 class.uicalendar.inc.php, 1.117 class.bocalendar.inc.php, 1.98 class.socalendar_sql.inc.php, 1.38 class.boicalendar.inc.php, 1.28 class.socalendar.inc.php, 1.30 |
Date: |
Fri, 18 Nov 2005 12:40:00 +0100 |
Update of calendar/inc
Modified Files:
Branch: MAIN
class.uiicalendar.inc.php lines: +2 -2
class.uicalendar.inc.php lines: +18 -72
class.bocalendar.inc.php lines: +1 -2
class.socalendar_sql.inc.php lines: +6 -31
class.boicalendar.inc.php lines: +30 -29
class.socalendar.inc.php lines: +6 -3
Log Message:
fixed ical export and switched to db pk identifiers for the UID
====================================================
Index: calendar/inc/class.uiicalendar.inc.php
diff -u calendar/inc/class.uiicalendar.inc.php:1.9
calendar/inc/class.uiicalendar.inc.php:1.10
--- calendar/inc/class.uiicalendar.inc.php:1.9 Sun May 15 06:57:37 2005
+++ calendar/inc/class.uiicalendar.inc.php Fri Nov 18 11:40:45 2005
@@ -21,7 +21,7 @@
var $public_functions = array(
'test' => True,
- 'import' => True
+ 'import' => True
);
====================================================
Index: calendar/inc/class.uicalendar.inc.php
diff -u calendar/inc/class.uicalendar.inc.php:1.116
calendar/inc/class.uicalendar.inc.php:1.117
--- calendar/inc/class.uicalendar.inc.php:1.116 Fri Nov 11 10:18:21 2005
+++ calendar/inc/class.uicalendar.inc.php Fri Nov 18 11:40:45 2005
@@ -945,69 +945,16 @@
}
$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
- if(!isset($_POST['output_file']) ||
!$_POST['output_file'])
- {
-
unset($GLOBALS['phpgw_info']['flags']['noheader']);
-
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
$GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Export');
- $GLOBALS['phpgw']->common->phpgw_header();
-
- $p = $GLOBALS['phpgw']->template;
- $p->set_file(
- Array(
- 'form_button' =>
'form_button_script.tpl'
- )
- );
- $var = Array(
- 'action_url_button' =>
$this->page('export'),
- 'action_text_button' =>
lang('Submit'),
- 'action_confirm_button' => '',
- 'action_extra_field' =>
"\n".lang('Enter Output Filename: ( .vcs appended )')."\n".' <input
name="output_file" size="25" maxlength="80" value="">'."\n"
- . ' <input type="hidden"
name="cal_id" value="'.$_POST['cal_id'].'">'
- );
- $p->set_var($var);
- echo $p->fp('out','form_button');
- }
- else
- {
- $output_file = $_POST['output_file'].'.vcs';
- $vfs = CreateObject('phpgwapi.vfs');
-//
if(!$vfs->file_exists('.calendar',array(RELATIVE_USER)))
-// {
-//
$vfs->mkdir('.calendar',array(RELATIVE_USER));
-// }
-
- $content =
ExecMethod('calendar.boicalendar.export',
-
Array(
-
'l_event_id' => $_POST['cal_id'],
-
'chunk_split' => False,
-
)
-
);
-
- $vfs->cd(array('string' => '/',
- 'relatives' =>
array(RELATIVE_USER)
- ));
- $vfs->write(array('string' => $output_file,
- 'relatives' => array
(RELATIVE_USER),
- 'content' => $content
- ));
-
- if($this->debug)
- {
- echo '<!-- DEBUG: Output Filename =
'.$output_file.' -->'."\n";
- echo '<!-- DEBUG: Fakebase =
'.$vfs->fakebase.' -->'."\n";
- echo '<!-- DEBUG: Path =
'.$vfs->pwd().' -->'."\n";
- }
- if ($this->bo->return_to)
- {
- Header('Location:
'.$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to));
- }
- else
- {
- Header('Location: '.$this->index());
- }
- $GLOBALS['phpgw']->common->phpgw_exit();
- }
+
+ $browser = createObject('phpgwapi.browser');
+
$browser->content_header("phpgw-cal-{$_POST['cal_id']}.ics", 'text/calendar');
+ $content = ExecMethod('calendar.boicalendar.export',
array
+ (
+
'l_event_id' => $_POST['cal_id'],
+
'chunk_split' => False,
+ ));
+ echo $content;
+ exit;
}
function reinstate_list($params='')
@@ -1172,7 +1119,6 @@
$this->bo->set_title('');
$this->bo->set_description('');
$this->bo->add_attribute('location','');
- $this->bo->add_attribute('uid','');
$this->bo->add_attribute('priority',2);
if(@$this->bo->prefs['calendar']['default_private'])
{
@@ -3686,19 +3632,19 @@
$recur_exception = implode (",",
$event[recur_exception]);
}
+ //FIXME this is ugly and should use templates better
$vars = Array(
'font' => $this->theme['font'],
'bg_color' =>
$this->theme['bg_text'],
'action_url' =>
$GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update')),
'popup_url' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.participants_popup'),
- '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"
-
. '<input type="hidden" name="recur_exception"
value="'.$recur_exception.'">'."\n"
-
. ($_GET['cal_id'] && $event['id'] == 0?'<input type="hidden"
name="cal[reference]" value="'.$_GET['cal_id'].'">'."\n":
-
(@isset($event['reference'])?'<input type="hidden" name="cal[reference]"
value="'.$event['reference'].'">'."\n":''))
+ '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="recur_exception" value="'.$recur_exception.'"
/>'."\n"
+
. ($_GET['cal_id'] && $event['id'] == 0?'<input type="hidden"
name="cal[reference]" value="'.$_GET['cal_id'].'" />'."\n":
+
(@isset($event['reference'])?'<input type="hidden" name="cal[reference]"
value="'.$event['reference'].'" />'."\n":''))
. (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) &&
$GLOBALS['phpgw_info']['server']['deny_user_grants_access']?
-
'<input type="hidden" name="participants[]"
value="'.$this->bo->owner.'">'."\n":''),
+
'<input type="hidden" name="participants[]" value="'.$this->bo->owner.'"
/>'."\n":''),
'errormsg' =>
($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):'')
);
$p->set_var($vars);
====================================================
Index: calendar/inc/class.bocalendar.inc.php
diff -u calendar/inc/class.bocalendar.inc.php:1.97
calendar/inc/class.bocalendar.inc.php:1.98
--- calendar/inc/class.bocalendar.inc.php:1.97 Fri Nov 11 10:18:21 2005
+++ calendar/inc/class.bocalendar.inc.php Fri Nov 18 11:40:45 2005
@@ -731,7 +731,6 @@
$is_public = ($l_cal['private'] ==
'public'?1:0);
$this->so->event_init();
- $this->add_attribute('uid',$l_cal['uid']);
if(count($l_categories) >= 2)
{
$this->so->set_category(implode(',',$l_categories));
====================================================
Index: calendar/inc/class.socalendar_sql.inc.php
diff -u calendar/inc/class.socalendar_sql.inc.php:1.37
calendar/inc/class.socalendar_sql.inc.php:1.38
--- calendar/inc/class.socalendar_sql.inc.php:1.37 Sun May 15 06:57:37 2005
+++ calendar/inc/class.socalendar_sql.inc.php Fri Nov 18 11:40:45 2005
@@ -229,11 +229,11 @@
// Use
http://www.php.net/manual/en/function.mcal-fetch-event.php as the reference
$this->add_attribute('owner',intval($this->stream->f('owner')));
$this->add_attribute('id',intval($this->stream->f('cal_id')));
+ $this->add_attribute('uid',
"phpgw://{$_SERVER['SERVER_NAME']}/calendar/" .
intval($this->stream->f('cal_id')));
$this->set_class(intval($this->stream->f('is_public')));
$this->set_category($this->stream->f('category'));
$this->set_title(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('title'))));
$this->set_description(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('description'))));
-
$this->add_attribute('uid',$GLOBALS['phpgw']->strip_html($this->stream->f('uid')));
$this->add_attribute('location',stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('location'))));
$this->add_attribute('reference',intval($this->stream->f('reference')));
@@ -572,35 +572,10 @@
$this->stream->lock($locks);
if($event['id'] == 0)
{
- if(!$event['uid'])
- {
- if
($GLOBALS['phpgw_info']['server']['hostname'] != '')
- {
- $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] = md5($part[$key]);
- }
- }
- $event['uid'] =
$part[0].'-'.$part[1].'@'.$id_suffix;
- }
- $this->stream->query('INSERT INTO
phpgw_cal(uid,title,owner,priority,is_public,category) '
- .
"values('".$event['uid']."','".$this->stream->db_addslashes($event['title'])
- .
"',".$event['owner'].','.$event['priority'].','.$event['public'].",'"
- . $event['category']."')",__LINE__,__FILE__);
+ $this->stream->query('INSERT INTO phpgw_cal(title,
owner, priority, is_public, category) '
+ .
"values('','".$this->stream->db_addslashes($event['title'])
+ .
"',{$event['owner']},{$event['priority']},{$event['public']},"
+ . "{$event['category']})",__LINE__,__FILE__);
$event['id'] =
$this->stream->get_last_insert_id('phpgw_cal','cal_id');
}
====================================================
Index: calendar/inc/class.boicalendar.inc.php
diff -u calendar/inc/class.boicalendar.inc.php:1.27
calendar/inc/class.boicalendar.inc.php:1.28
--- calendar/inc/class.boicalendar.inc.php:1.27 Fri Oct 14 23:58:48 2005
+++ calendar/inc/class.boicalendar.inc.php Fri Nov 18 11:40:45 2005
@@ -80,10 +80,11 @@
class boicalendar
{
- var $public_functions = array(
- 'import' => True,
- 'export' => True
- );
+ var $public_functions = array
+ (
+ 'import' => True,
+ 'export' => True
+ );
var $ical;
@@ -2850,8 +2851,7 @@
function is_owner($part_record)
{
- if(($part_record['user'].'@'.$part_record['host'] ==
$GLOBALS['phpgw_info']['user']['preferences']['email']['address']) ||
- ($part_record['cn'] ==
$GLOBALS['phpgw_info']['user']['account_lid']))
+ if( "{$part_record['user'address@hidden'host']}" ==
ExecMethod('phpgwapi.contacts.get_email',
$GLOBALS['phpgw_info']['user']['person_id']) )
{
return True;
}
@@ -2863,14 +2863,14 @@
function check_owner(&$event,$ical,$so_event)
{
-
if(!isset($event['participant'][$GLOBALS['phpgw_info']['user']['account_id']]))
+
if(!isset($event['participant'][$GLOBALS['phpgw_info']['user']['person_id']]))
{
if(isset($ical['organizer']))
{
if($this->is_owner($ical['organizer']))
{
-
$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']);
+
$so_event->add_attribute('owner', $GLOBALS['phpgw_info']['user']['person_id']);
+
$so_event->add_attribute('participants',
$this->switch_to_phpgw_status($ical['organizer']['partstat']),
$GLOBALS['phpgw_info']['user']['person_id']);
}
}
elseif(isset($ical['attendee']))
@@ -2881,14 +2881,14 @@
{
if($this->is_owner($ical['attendee'][$j]))
{
-
$so_event->add_attribute('participants',$this->switch_to_phpgw_status($ical['attendee'][$j]['partstat']),intval($GLOBALS['phpgw_info']['user']['account_id']));
+
$so_event->add_attribute('participants',$this->switch_to_phpgw_status($ical['attendee'][$j]['partstat']),
intval($GLOBALS['phpgw_info']['user']['person_id']));
}
}
}
else
{
-
$so_event->add_attribute('owner',$GLOBALS['phpgw_info']['user']['account_id']);
-
$so_event->add_attribute('participants','A',$GLOBALS['phpgw_info']['user']['account_id']);
+ $so_event->add_attribute('owner',
$GLOBALS['phpgw_info']['user']['person_id']);
+
$so_event->add_attribute('participants', 'A',
$GLOBALS['phpgw_info']['user']['person_id']);
}
}
}
@@ -2987,8 +2987,7 @@
// time limit should be controlled elsewhere
@set_time_limit(0);
- $GLOBALS['phpgw_info']['user']['preferences'] =
$GLOBALS['phpgw']->preferences->create_email_preferences();
- $users_email =
$GLOBALS['phpgw_info']['user']['preferences']['email']['address'];
+ $users_email =
ExecMethod('phpgwapi.contacts.get_email',
$GLOBALS['phpgw_info']['user']['person_id']);
$cats = CreateObject('phpgwapi.categories');
$ical = $this->parse($mime_msg);
switch($ical['version']['value'])
@@ -3025,10 +3024,6 @@
$so_event->event_init();
$so_event->add_attribute('id',0);
$so_event->add_attribute('reference',0);
- if($ical['event'][$i]['uid']['value'])
- {
-
$so_event->add_attribute('uid',$ical['event'][$i]['uid']['value']);
- }
if($ical['event'][$i]['summary']['value'])
{
$so_event->set_title($ical['event'][$i]['summary']['value']);
@@ -3241,10 +3236,15 @@
}
$ical = $this->new_ical();
+
+ $versiona = explode('.',
$setup_info['calendar']['version']);
+ unset($versiona[count($versiona)]);
+ $version = implode('.', $versiona);
-
$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['prodid'],'value',"-//phpGroupWare//phpGroupWare $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));
+ unset($version, $versiona);
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['uicalendar'])
{
@@ -3267,6 +3267,7 @@
{
$so_event = $GLOBALS['uicalendar']->bo->so;
}
+
while(list($key,$value) = each($ids))
{
@@ -3327,22 +3328,22 @@
$this->set_var($ical_event['categories'],'value',implode($cat_string,','));
}
- if(count($event['participants']) > 1)
+ if( is_array($event['participants']) &&
count($event['participants']) > 1)
{
if(!is_object($db))
{
- $db = $GLOBALS['phpgw']->db;
+ $db =& $GLOBALS['phpgw']->db;
}
- @reset($event['participants']);
- while(list($part,$status) =
each($event['participants']))
- {
-
$GLOBALS['phpgw']->accounts->get_account_name($part,$lid,$fname,$lname);
- $name = $fname.' '.$lname;
+
+ $contacts =
createObject('phpgwapi.contacts');
+ foreach($event['participants'] as $part
=> $status)
+ {
+ $name =
$contacts->get_contact_name($part);
+
$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'];
+ $mailto =
$contacts->get_email($part);
$str =
'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$mailto;
if($part == $event['owner'])
====================================================
Index: calendar/inc/class.socalendar.inc.php
diff -u calendar/inc/class.socalendar.inc.php:1.29
calendar/inc/class.socalendar.inc.php:1.30
--- calendar/inc/class.socalendar.inc.php:1.29 Sun May 15 06:57:37 2005
+++ calendar/inc/class.socalendar.inc.php Fri Nov 18 11:40:45 2005
@@ -181,12 +181,15 @@
function find_uid($uid)
{
- $sql = " AND (phpgw_cal.uid = '".$uid."') ";
+ $uid_parts = explode('/', $uid);
+ $cal_id = intval($uid_parts[count($uid_parts) -1]);
+
+ $sql = " AND (phpgw_cal.cal_id = {$cal_id}) ";
$found = $this->cal->get_event_ids(False,$sql);
if(!$found)
{
- $found = $this->cal->get_event_ids(True,$sql);
+ $found = $this->cal->get_event_ids(True, $sql);
}
if(is_array($found))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] calendar/inc class.uiicalendar.inc.php, 1.10 class.uicalendar.inc.php, 1.117 class.bocalendar.inc.php, 1.98 class.socalendar_sql.inc.php, 1.38 class.boicalendar.inc.php, 1.28 class.socalendar.inc.php, 1.30,
skwashd <=