adding ACL and ICal support

This commit is contained in:
skeeter 2001-02-12 04:58:36 +00:00
parent a039c0116c
commit 639eb3dafe
4 changed files with 735 additions and 484 deletions

View File

@ -21,7 +21,8 @@
{
function calendar($p_friendly=False)
{
$this->calendar_($p_friendly);
}
$this->printer_friendly = $p_friendly;
$this->today = $this->localdates(time());
}
}
?>

View File

@ -0,0 +1,138 @@
<?php
/**************************************************************************\
* phpGroupWare - ICal Calendar *
* http://www.phpgroupware.org *
* Created by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
class calendar_
{
var $stream;
var $user;
var $cal_event;
function open($calendar='',$user='',$passwd='',$options='')
{
global $phpgw, $phpgw_info;
if($user=='')
{
$this->user = $phpgw_info['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $phpgw->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_open('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_open('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
return $this->stream;
}
function popen($calendar='',$user='',$passwd='',$options='')
{
global $phpgw, $phpgw_info;
if($user=='')
{
$this->user = $phpgw_info['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $phpgw->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_popen('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_popen('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
return $this->stream;
}
function reopen($calendar,$options='')
{
if($options != '')
{
$this->stream = mcal_reopen($calendar,$options);
}
else
{
$this->stream = mcal_reopen($calendar);
}
return $this->stream;
}
function close($mcal_stream,$options='')
{
if($options != '')
{
return mcal_close($mcal_stream,$options);
}
else
{
return mcal_close($mcal_stream);
}
}
function create_calendar($stream,$calendar)
{
return mcal_create_calendar($stream,$calendar);
}
function rename_calendar($stream,$old_name,$new_name)
{
return mcal_rename_calendar($stream,$old_name,$new_name);
}
function delete_calendar($stream,$calendar)
{
return mcal_delete_calendar($stream,$calendar);
}
function fetch_event($mcal_stream,$event_id,$options='')
{
if(!isset($this->stream))
{
return False;
}
$this->cal_event = CreateObject('calendar.calendar_item');
if($options != '')
{
$event = mcal_fetch_event($mcal_stream,$event_id,$options);
}
else
{
$event = mcal_fetch_event($mcal_stream,$event_id);
}
// Need to load the $this->cal_info variable with the data from the mcal_fetch_event() call
// Use http://www.php.net/manual/en/function.mcal-fetch-event.phpas the reference
// Return $this->cal_event;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -16,12 +16,19 @@
if (floor($PHP_VERSION ) == 4) {
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday, $filter, $keywords;
global $matrixtype, $participants;
global $matrixtype, $participants, $owner, $phpgw;
}
if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"]))
$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday";
if(!isset($owner)) { $owner = 0; }
if(!isset($owner) || !$owner) {
$owner = $phpgw_info['user']['account_id'];
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
}
if(!isset($filter) || !$filter)
$filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"];
if (isset($date) && strlen($date) > 0) {
@ -79,7 +86,7 @@
</a>
</td>
<form action="<?php echo $phpgw->link(); ?>" method="POST" name="filtermethod">
<td width="55%" align="center" valign="center">
<td width="45%" align="center" valign="center">
<b><?php echo lang("Filter"); ?>:</b>
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
<?php if(isset($date) && $date) { ?>
@ -111,6 +118,40 @@
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
</td>
</form>
<?php
$grants = $phpgw->acl->get_grants('calendar');
if(count($grants) > 0)
{
?>
<form action="<?php echo $phpgw->link(); ?>" method="POST" name="setowner">
<td width="20%" align="center" valign="center">
<b><?php echo lang("User"); ?>:</b>
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
<?php if(isset($date) && $date) { ?>
<input type="hidden" name="date" value="<?php echo $date; ?>">
<?php } ?>
<input type="hidden" name="month" value="<?php echo $thismonth; ?>">
<input type="hidden" name="day" value="<?php echo $thisday; ?>">
<input type="hidden" name="year" value="<?php echo $thisyear; ?>">
<?php if(isset($keywords) && $keywords) { ?>
<input type="hidden" name="keywords" value="<?php echo $keywords; ?>">
<?php } ?>
<select name="owner" onchange="document.setowner.submit()">
<?php
while(list($grantor,$rights) = each($grants))
{
?>
<option value="<?php echo $grantor; ?>"<?php if($grantor==$owner) echo " selected"; ?>><?php echo $phpgw->common->grab_owner_name($grantor); ?></option>
<?php
}
?>
</select>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
</td>
</form>
<?php
}
?>
<form action="<?php echo $phpgw->link("search.php"); ?>" method="POST">
<td align="right" valign="center">
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">