commit
4c2cf35050
@ -0,0 +1,12 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
require_once('../../../../lib/base.php'); |
||||
$id = strip_tags($_GET['id']); |
||||
$activation = strip_tags($_GET['activation']); |
||||
OC_Calendar_Share::set_active(OC_User::getUser(), $id, $activation); |
||||
OC_JSON::success(); |
@ -1 +1 @@ |
||||
0.2.1 |
||||
0.3 |
@ -1,130 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
//check for calendar rights or create new one |
||||
ob_start(); |
||||
|
||||
OC_JSON::checkLoggedIn(); |
||||
OC_Util::checkAppEnabled('calendar'); |
||||
$nl="\r\n"; |
||||
$comps = array('VEVENT'=>true, 'VTODO'=>true, 'VJOURNAL'=>true); |
||||
$progressfile = 'import_tmp/' . md5(session_id()) . '.txt'; |
||||
if(is_writable('import_tmp/')){ |
||||
$progressfopen = fopen($progressfile, 'w'); |
||||
fwrite($progressfopen, '10'); |
||||
fclose($progressfopen); |
||||
} |
||||
$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']); |
||||
if($_POST['method'] == 'new'){ |
||||
$id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']); |
||||
OC_Calendar_Calendar::setCalendarActive($id, 1); |
||||
}else{ |
||||
$calendar = OC_Calendar_App::getCalendar($_POST['id']); |
||||
if($calendar['userid'] != OC_USER::getUser()){ |
||||
OC_JSON::error(); |
||||
exit(); |
||||
} |
||||
$id = $_POST['id']; |
||||
} |
||||
if(is_writable('import_tmp/')){ |
||||
$progressfopen = fopen($progressfile, 'w'); |
||||
fwrite($progressfopen, '20'); |
||||
fclose($progressfopen); |
||||
} |
||||
// normalize the newlines |
||||
$file = str_replace(array("\r","\n\n"), array("\n","\n"), $file); |
||||
$lines = explode("\n", $file); |
||||
unset($file); |
||||
if(is_writable('import_tmp/')){ |
||||
$progressfopen = fopen($progressfile, 'w'); |
||||
fwrite($progressfopen, '30'); |
||||
fclose($progressfopen); |
||||
} |
||||
// analyze the file, group components by uid, and keep refs to originating calendar object |
||||
// $cals is array calendar objects, keys are 1st line# $cal, ie array( $cal => $caldata ) |
||||
// $caldata is array( 'first' => 1st component line#, 'last' => last comp line#, 'end' => end line# ) |
||||
// $caldata is used to create prefix/suffix strings when building import text |
||||
// $uids is array of component arrays, keys are $uid, ie array( $uid => array( $beginlineno => $component ) ) |
||||
// $component is array( 'end' => end line#, 'cal'=> $cal ) |
||||
$comp=$uid=$cal=false; |
||||
$cals=$uids=array(); |
||||
$i = 0; |
||||
foreach($lines as $line) { |
||||
|
||||
if(strpos($line, ':')!==false) { |
||||
list($attr, $val) = explode(':', strtoupper($line)); |
||||
if ($attr == 'BEGIN' && $val == 'VCALENDAR') { |
||||
$cal = $i; |
||||
$cals[$cal] = array('first'=>$i,'last'=>$i,'end'=>$i); |
||||
} elseif ($attr =='BEGIN' && $cal!==false && isset($comps[$val])) { |
||||
$comp = $val; |
||||
$beginNo = $i; |
||||
} elseif ($attr == 'END' && $cal!==false && $val == 'VCALENDAR') { |
||||
if($comp!==false) { |
||||
unset($cals[$cal]); // corrupt calendar, unset it |
||||
} else { |
||||
$cals[$cal]['end'] = $i; |
||||
} |
||||
$comp=$uid=$cal=false; // reset calendar |
||||
} elseif ($attr == 'END' && $comp!==false && $val == $comp) { |
||||
if(! $uid) { |
||||
$uid = OC_Calendar_Object::createUID(); |
||||
} |
||||
$uids[$uid][$beginNo] = array('end'=>$i, 'cal'=>$cal); |
||||
if ($cals[$cal]['first'] == $cal) { |
||||
$cals[$cal]['first'] = $beginNo; |
||||
} |
||||
$cals[$cal]['last'] = $i; |
||||
$comp=$uid=false; // reset component |
||||
} elseif ($attr =="UID" && $comp!==false) { |
||||
list($attr, $uid) = explode(':', $line); |
||||
} |
||||
} |
||||
$i++; |
||||
} |
||||
// import the calendar |
||||
if(is_writable('import_tmp/')){ |
||||
$progressfopen = fopen($progressfile, 'w'); |
||||
fwrite($progressfopen, '60'); |
||||
fclose($progressfopen); |
||||
} |
||||
foreach($uids as $uid) { |
||||
|
||||
$prefix=$suffix=$content=array(); |
||||
foreach($uid as $begin=>$details) { |
||||
|
||||
$cal = $details['cal']; |
||||
if(!isset($cals[$cal])) { |
||||
continue; // from corrupt/incomplete calendar |
||||
} |
||||
$cdata = $cals[$cal]; |
||||
// if we have multiple components from different calendar objects, |
||||
// we should really merge their elements (enhancement?) -- 1st one wins for now. |
||||
if(! count($prefix)) { |
||||
$prefix = array_slice($lines, $cal, $cdata['first'] - $cal); |
||||
} |
||||
if(! count($suffix)) { |
||||
$suffix = array_slice($lines, $cdata['last']+1, $cdata['end'] - $cdata['last']); |
||||
} |
||||
$content = array_merge($content, array_slice($lines, $begin, $details['end'] - $begin + 1)); |
||||
} |
||||
if(count($content)) { |
||||
$import = join($nl, array_merge($prefix, $content, $suffix)) . $nl; |
||||
OC_Calendar_Object::add($id, $import); |
||||
} |
||||
} |
||||
// finished import |
||||
if(is_writable('import_tmp/')){ |
||||
$progressfopen = fopen($progressfile, 'w'); |
||||
fwrite($progressfopen, '100'); |
||||
fclose($progressfopen); |
||||
} |
||||
sleep(3); |
||||
if(is_writable('import_tmp/')){ |
||||
unlink($progressfile); |
||||
} |
||||
OC_JSON::success(); |
@ -0,0 +1,13 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
/* |
||||
* This class manages reminders for calendars |
||||
*/ |
||||
class OC_Calendar_Alarm{ |
||||
|
||||
} |
@ -0,0 +1,13 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
/* |
||||
* This class manages Attendees for calendars |
||||
*/ |
||||
class OC_Calendar_Attendees{ |
||||
|
||||
} |
@ -0,0 +1,259 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
/* |
||||
* This class manages shared calendars |
||||
*/ |
||||
class OC_Calendar_Share{ |
||||
const CALENDAR = 'calendar'; |
||||
const EVENT = 'event'; |
||||
/* |
||||
* @brief: returns informations about all calendar or events which users are sharing with the user - userid |
||||
* @param: (string) $userid - id of the user |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return: (array) $return - information about calendars |
||||
*/ |
||||
public static function allSharedwithuser($userid, $type, $active=null, $permission=null){ |
||||
$group_where = self::group_sql(OC_Group::getUserGroups($userid)); |
||||
$permission_where = self::permission_sql($permission); |
||||
if($type == self::CALENDAR){ |
||||
$active_where = self::active_sql($active); |
||||
}else{ |
||||
$active_where = ''; |
||||
} |
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') AND owner <> ? ' . $permission_where . ' ' . $active_where); |
||||
$result = $stmt->execute(array($userid, $userid)); |
||||
$return = array(); |
||||
while( $row = $result->fetchRow()){ |
||||
$return[] = $row; |
||||
} |
||||
return $return; |
||||
} |
||||
/* |
||||
* @brief: returns all users a calendar / event is shared with |
||||
* @param: (int) id - id of the calendar / event |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return: (array) $users - information about users a calendar / event is shared with |
||||
*/ |
||||
public static function allUsersSharedwith($id, $type){ |
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ' . $type . 'id = ? ORDER BY share'); |
||||
$result = $stmt->execute(array($id)); |
||||
$users = array(); |
||||
while( $row = $result->fetchRow()){ |
||||
$users[] = $row; |
||||
} |
||||
return $users; |
||||
} |
||||
/* |
||||
* @brief: shares a calendar / event |
||||
* @param: (string) $owner - userid of the owner |
||||
* @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) |
||||
* @param: (string) $sharetype - type of sharing (can be: user/group/public) |
||||
* @param: (string) $id - id of the calendar / event |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return (mixed) - token (if $sharetype == public) / bool (if $sharetype != public) |
||||
*/ |
||||
public static function share($owner, $share, $sharetype, $id, $type){ |
||||
if(self::is_already_shared($owner, $share, $sharetype, $id, $type)){ |
||||
return false; |
||||
} |
||||
switch($sharetype){ |
||||
case 'user': |
||||
case 'group': |
||||
case 'public': |
||||
break; |
||||
default: |
||||
return false; |
||||
} |
||||
if($sharetype == 'public'){ |
||||
$share = self::generate_token($id, $type); |
||||
} |
||||
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*calendar_share_' . $type . ' (owner,share,sharetype,' . $type . 'id,permissions' . (($type == self::CALENDAR)?', active':'') . ') VALUES(?,?,?,?,0' . (($type == self::CALENDAR)?', 1':'') . ')' ); |
||||
$result = $stmt->execute(array($owner,$share,$sharetype,$id)); |
||||
if($sharetype == 'public'){ |
||||
return $share; |
||||
}else{ |
||||
return true; |
||||
} |
||||
} |
||||
/* |
||||
* @brief: stops sharing a calendar / event |
||||
* @param: (string) $owner - userid of the owner |
||||
* @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) |
||||
* @param: (string) $sharetype - type of sharing (can be: user/group/public) |
||||
* @param: (string) $id - id of the calendar / event |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return (bool) |
||||
*/ |
||||
public static function unshare($owner, $share, $sharetype, $id, $type){ |
||||
$stmt = OC_DB::prepare('DELETE FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? ' . (($sharetype != 'public')?'AND share = ?':'') . ' AND sharetype = ? AND ' . $type . 'id = ?'); |
||||
if($sharetype != 'public'){ |
||||
$stmt->execute(array($owner,$share,$sharetype,$id)); |
||||
}else{ |
||||
$stmt->execute(array($owner,$sharetype,$id)); |
||||
} |
||||
return true; |
||||
} |
||||
/* |
||||
* @brief: changes the permission for a calendar / event |
||||
* @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) |
||||
* @param: (string) $sharetype - type of sharing (can be: user/group/public) |
||||
* @param: (string) $id - id of the calendar / event |
||||
* @param: (int) $permission - permission of user the calendar / event is shared with (if $sharetype == public then $permission = 0) |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return (bool) |
||||
*/ |
||||
public static function changepermission($share, $sharetype, $id, $permission, $type){ |
||||
if($sharetype == 'public' && $permission == 1){ |
||||
$permission = 0; |
||||
} |
||||
$stmt = OC_DB::prepare('UPDATE *PREFIX*calendar_share_' . $type . ' SET permissions = ? WHERE share = ? AND sharetype = ? AND ' . $type . 'id = ?'); |
||||
$stmt->execute(array($permission, $share, $sharetype, $id)); |
||||
return true; |
||||
} |
||||
/* |
||||
* @brief: generates a token for public calendars / events |
||||
* @return: (string) $token |
||||
*/ |
||||
private static function generate_token($id, $type){ |
||||
$uniqid = uniqid(); |
||||
if($type == self::CALENDAR){ |
||||
$events = OC_Calendar_Object::all($id); |
||||
$string = ''; |
||||
foreach($events as $event){ |
||||
$string .= $event['calendardata']; |
||||
} |
||||
}else{ |
||||
$string = OC_Calendar_Object::find($id); |
||||
} |
||||
$string = sha1($string['calendardata']); |
||||
$id = sha1($id); |
||||
$array = array($uniqid,$string,$id); |
||||
shuffle($array); |
||||
$string = implode('', $array); |
||||
$token = md5($string); |
||||
return substr($token, rand(0,16), 15); |
||||
} |
||||
/* |
||||
* @brief: checks if it is already shared |
||||
* @param: (string) $owner - userid of the owner |
||||
* @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) |
||||
* @param: (string) $sharetype - type of sharing (can be: user/group/public) |
||||
* @param: (string) $id - id of the calendar / event |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return (bool) |
||||
*/ |
||||
public static function is_already_shared($owner, $share, $sharetype, $id, $type){ |
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? AND share = ? AND sharetype = ? AND ' . $type . 'id = ?'); |
||||
$result = $stmt->execute(array($owner, $share, $sharetype, $id)); |
||||
if($result->numRows() > 0){ |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
private static function group_sql($groups){ |
||||
$group_where = ''; |
||||
$i = 0; |
||||
foreach($groups as $group){ |
||||
$group_where .= ' OR '; |
||||
$group_where .= ' (share = "' . $group . '" AND sharetype = "group") '; |
||||
$i++; |
||||
} |
||||
return $group_where; |
||||
} |
||||
private static function permission_sql($permission = null){ |
||||
$permission_where = ''; |
||||
if(!is_null($permission)){ |
||||
$permission_where = ' AND permissions = '; |
||||
$permission_where .= ($permission=='rw')?'"1"':'"0"'; |
||||
} |
||||
return $permission_where; |
||||
} |
||||
private static function active_sql($active = null){ |
||||
$active_where = ''; |
||||
if(!is_null($active)){ |
||||
$active_where = 'AND active = '; |
||||
$active_where .= (!is_null($active) && $active)?'1':'0'; |
||||
} |
||||
return $active_where; |
||||
} |
||||
/* |
||||
* @brief: checks the permission for editing an event |
||||
* @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) |
||||
* @param: (string) $id - id of the calendar / event |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return (bool) |
||||
*/ |
||||
public static function is_editing_allowed($share, $id, $type){ |
||||
$group_where = self::group_sql(OC_Group::getUserGroups($share)); |
||||
$permission_where = self::permission_sql('rw'); |
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') ' . $permission_where); |
||||
$result = $stmt->execute(array($share)); |
||||
if($result->numRows() == 1){ |
||||
return true; |
||||
} |
||||
if($type == self::EVENT){ |
||||
$event = OC_Calendar_App::getEventObject($id, false, false); |
||||
return self::is_editing_allowed($share, $event['calendarid'], self::CALENDAR); |
||||
} |
||||
return false; |
||||
} |
||||
/* |
||||
* @brief: checks the access of |
||||
* @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) |
||||
* @param: (string) $id - id of the calendar / event |
||||
* @param: (string) $type - use const self::CALENDAR or self::EVENT |
||||
* @return (bool) |
||||
*/ |
||||
public static function check_access($share, $id, $type){ |
||||
$group_where = self::group_sql(OC_Group::getUserGroups($share)); |
||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE (' . $type . 'id = ? AND (share = ? AND sharetype = "user") ' . $group_where . ')'); |
||||
$result = $stmt->execute(array($id,$share)); |
||||
$rows = $result->numRows(); |
||||
if($rows > 0){ |
||||
return true; |
||||
}elseif($type == self::EVENT){ |
||||
$event = OC_Calendar_App::getEventObject($id, false, false); |
||||
return self::check_access($share, $event['calendarid'], self::CALENDAR); |
||||
}else{ |
||||
return false; |
||||
} |
||||
} |
||||
/* |
||||
* @brief: returns the calendardata of an event or a calendar |
||||
* @param: (string) $token - token which should be searched |
||||
* @return: mixed - bool if false, array with type and id if true |
||||
*/ |
||||
public static function getElementByToken($token){ |
||||
$stmt_calendar = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::CALENDAR . ' WHERE sharetype = "public" AND share = ?'); |
||||
$result_calendar = $stmt_calendar->execute(array($token)); |
||||
$stmt_event = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . OC_Calendar_Share::EVENT . ' WHERE sharetype = "public" AND share = ?'); |
||||
$result_event = $stmt_event->execute(array($token)); |
||||
$return = array(); |
||||
if($result_calendar->numRows() == 0 && $result_event->numRows() == 0){ |
||||
return false; |
||||
}elseif($result_calendar->numRows() != 0){ |
||||
$return ['type'] = 'calendar'; |
||||
$calendar = $result_calendar->fetchRow(); |
||||
$return ['id'] = $calendar['calendarid']; |
||||
}else{ |
||||
$return ['type'] = 'event'; |
||||
$event = $result_event->fetchRow(); |
||||
$return ['id'] = $event['eventid']; |
||||
} |
||||
return $return; |
||||
} |
||||
|
||||
/* |
||||
* @brief sets the active status of the calendar |
||||
* @param (string) $ |
||||
*/ |
||||
public static function set_active($share, $id, $active){ |
||||
$stmt = OC_DB::prepare('UPDATE *PREFIX*calendar_share_calendar SET active = ? WHERE share = ? AND sharetype = "user" AND calendarid = ?'); |
||||
$stmt->execute(array($active, $share, $id)); |
||||
} |
||||
} |
@ -1,4 +0,0 @@ |
||||
<?php |
||||
|
||||
OC_Preferences::deleteKey(OC_USER::getUser(), 'calendar', 'timezone'); |
||||
?> |
@ -0,0 +1,23 @@ |
||||
<?php |
||||
require_once('../../lib/base.php'); |
||||
$token = strip_tags($_GET['t']); |
||||
$shared = OC_Calendar_Share::getElementByToken($token); |
||||
$nl = "\n\r"; |
||||
if($shared['type'] == OC_Calendar_Share::CALENDAR){ |
||||
$calendar = OC_Calendar_App::getCalendar($shared['id'], false); |
||||
$calobjects = OC_Calendar_Object::all($shared['id']); |
||||
header('Content-Type: text/Calendar'); |
||||
header('Content-Disposition: inline; filename=' . $calendar['displayname'] . '.ics'); |
||||
foreach($calobjects as $calobject){ |
||||
echo $calobject['calendardata'] . $nl; |
||||
} |
||||
}elseif($shared['type'] == OC_Calendar_Share::EVENT){ |
||||
$data = OC_Calendar_App::getEventObject($shared['id'], false); |
||||
$calendarid = $data['calendarid']; |
||||
$calendar = OC_Calendar_App::getCalendar($calendarid); |
||||
header('Content-Type: text/Calendar'); |
||||
header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics'); |
||||
echo $data['calendardata']; |
||||
}else{ |
||||
header('Error 404: Not Found'); |
||||
} |
@ -1,4 +1,8 @@ |
||||
<?php |
||||
echo "<td width=\"20px\"><input id=\"active_" . $_['calendar']["id"] . "\" type=\"checkbox\" onClick=\"Calendar.UI.Calendar.activation(this, " . $_['calendar']["id"] . ")\"" . ($_['calendar']["active"] ? ' checked="checked"' : '') . "></td>"; |
||||
echo "<td><label for=\"active_" . $_['calendar']["id"] . "\">" . $_['calendar']["displayname"] . "</label></td>"; |
||||
echo "<td width=\"20px\"><a href=\"#\" onclick=\"Calendar.UI.showCalDAVUrl('" . OC_User::getUser() . "', '" . rawurlencode( $_['calendar']["uri"] ) . "');\" title=\"" . $l->t("CalDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?calid=" . $_['calendar']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Calendar.UI.Calendar.edit(this, " . $_['calendar']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td><td width=\"20px\"><a href=\"#\" onclick=\"Calendar.UI.Calendar.deleteCalendar('" . $_['calendar']["id"] . "');\" title=\"" . $l->t("Delete") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/delete.svg\"></a></td>"; |
||||
echo '<td width="20px"><input id="active_' . $_['calendar']['id'] . '" type="checkbox" onClick="Calendar.UI.Calendar.activation(this,' . $_['calendar']['id'] . ')"' . ($_['calendar']['active'] ? ' checked="checked"' : '') . '></td>'; |
||||
echo '<td id="' . OC_User::getUser() . '_' . $_['calendar']['id'] . '"><label for="active_' . $_['calendar']['id'] . '">' . $_['calendar']['displayname'] . '</label></td>'; |
||||
echo '<td width="20px"><a href="#" onclick="Calendar.UI.Share.dropdown(\'' . OC_User::getUser() . '\', \'' . $_['calendar']['id'] . '\');" title="' . $l->t("Share Calendar") . '" class="action"><img class="svg action" src="' . ((!$_['shared']) ? '../../core/img/actions/share.svg' : '../../core/img/actions/shared.svg') . '"></a></td>'; |
||||
echo '<td width="20px"><a href="#" onclick="Calendar.UI.showCalDAVUrl(\'' . OC_User::getUser() . '\', \'' . $_['calendar']['uri'] . '\');" title="' . $l->t("CalDav Link") . '" class="action"><img class="svg action" src="../../core/img/actions/public.svg"></a></td>'; |
||||
echo '<td width="20px"><a href="export.php?calid=' . $_['calendar']['id'] . '" title="' . $l->t('Download') . '" class="action"><img class="svg action" src="../../core/img/actions/download.svg"></a></td>'; |
||||
echo '<td width="20px"><a href="#" title="' . $l->t('Edit') . '" class="action" onclick="Calendar.UI.Calendar.edit(this, ' . $_['calendar']['id'] . ');"><img class="svg action" src="../../core/img/actions/rename.svg"></a></td>'; |
||||
echo '<td width="20px"><a href="#" onclick="Calendar.UI.Calendar.deleteCalendar(\'' . $_['calendar']['id'] . '\');" title="' . $l->t('Delete') . '" class="action"><img class="svg action" src="../../core/img/actions/delete.svg"></a></td>'; |
@ -0,0 +1,4 @@ |
||||
<?php |
||||
echo '<td width="20px"><input id="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '" type="checkbox" onClick="Calendar.UI.Share.activation(this,\'' . $_['share']['owner'] . '\',' . $_['share']['calendar']['id'] . ')"' . ($_['share']['active'] ? ' checked="checked"' : '') . '></td>'; |
||||
echo '<td><label for="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '">' . $_['share']['calendar']['displayname'] . '</label></td>'; |
||||
echo '<td style="font-style: italic;">' . $l->t('shared with you by') . ' ' . $_['share']['owner'] . '</td>'; |
@ -1,13 +1,13 @@ |
||||
<div id="event" title="<?php echo $l->t("Edit an event");?>">
|
||||
<form id="event_form"> |
||||
<input type="hidden" name="id" value="<?php echo $_['id'] ?>">
|
||||
<input type="hidden" name="id" value="<?php echo $_['eventid'] ?>">
|
||||
<input type="hidden" name="lastmodified" value="<?php echo $_['lastmodified'] ?>">
|
||||
<?php echo $this->inc("part.eventform"); ?> |
||||
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div> |
||||
<span id="actions"> |
||||
<input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/event/edit.php');">
|
||||
<input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/event/delete.php');">
|
||||
<input type="button" class="submit" style="float: right;" name="export" value="<?php echo $l->t("Export");?>" onclick="window.location='export.php?eventid=<?php echo $_['id'] ?>';">
|
||||
<input type="button" class="submit" style="float: right;" name="export" value="<?php echo $l->t("Export");?>" onclick="window.location='export.php?eventid=<?php echo $_['eventid'] ?>';">
|
||||
</span> |
||||
</form> |
||||
</div> |
||||
|
@ -0,0 +1,247 @@ |
||||
<div id="event" title="<?php echo $l->t("View an event");?>">
|
||||
<ul> |
||||
<li><a href="#tabs-1"><?php echo $l->t('Eventinfo'); ?></a></li>
|
||||
<li><a href="#tabs-2"><?php echo $l->t('Repeating'); ?></a></li>
|
||||
<!--<li><a href="#tabs-3"><?php echo $l->t('Alarm'); ?></a></li>
|
||||
<li><a href="#tabs-4"><?php echo $l->t('Attendees'); ?></a></li>-->
|
||||
</ul> |
||||
<div id="tabs-1"> |
||||
<table width="100%"> |
||||
<tr> |
||||
<th width="75px"><?php echo $l->t("Title");?>:</th>
|
||||
<td> |
||||
<?php echo isset($_['title']) ? htmlspecialchars($_['title']) : '' ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table width="100%"> |
||||
<tr> |
||||
<th width="75px"><?php echo $l->t("Category");?>:</th>
|
||||
<td> |
||||
<?php |
||||
if(count($_['categories']) == 0){ |
||||
echo $l->t('No categories selected'); |
||||
}else{ |
||||
echo '<select id="category" name="categories[]" multiple="multiple" title="' . $l->t("Select category") . '">'; |
||||
echo html_select_options($_['categories'], $_['categories'], array('combine'=>true)); |
||||
echo '</select>'; |
||||
} |
||||
?> |
||||
</td> |
||||
<th width="75px"> <?php echo $l->t("Calendar");?>:</th>
|
||||
<td> |
||||
<select name="calendar" disabled="disabled"> |
||||
<option> |
||||
<?php |
||||
$calendar = OC_Calendar_App::getCalendar($_['calendar']); |
||||
echo $calendar['displayname'] . ' ' . $l->t('of') . ' ' . $calendar['userid']; |
||||
?> |
||||
</option> |
||||
|
||||
</select> |
||||
</td> |
||||
<th width="75px"> </th> |
||||
<td> |
||||
<input type="hidden" name="calendar" value="<?php echo $_['calendar_options'][0]['id'] ?>">
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<hr> |
||||
<table width="100%"> |
||||
<tr> |
||||
<th width="75px"></th> |
||||
<td> |
||||
<input onclick="Calendar.UI.lockTime();" type="checkbox"<?php if($_['allday']){echo 'checked="checked"';} ?> id="allday_checkbox" name="allday" disabled="disabled">
|
||||
<?php echo $l->t("All Day Event");?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<th width="75px"><?php echo $l->t("From");?>:</th>
|
||||
<td> |
||||
<?php echo $_['startdate'];?> |
||||
<?php echo (!$_['allday'])?$l->t('at'):''; ?>
|
||||
<?php echo $_['starttime'];?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<th width="75px"><?php echo $l->t("To");?>:</th>
|
||||
<td> |
||||
<?php echo $_['enddate'];?> |
||||
<?php echo (!$_['allday'])?$l->t('at'):''; ?>
|
||||
<?php echo $_['endtime'];?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<input type="button" class="submit" value="<?php echo $l->t("Advanced options"); ?>" onclick="Calendar.UI.showadvancedoptions();" id="advanced_options_button">
|
||||
<div id="advanced_options" style="display: none;"> |
||||
<hr> |
||||
<table> |
||||
<tr> |
||||
<th width="85px"><?php echo $l->t("Location");?>:</th>
|
||||
<td> |
||||
<?php echo isset($_['location']) ? htmlspecialchars($_['location']) : '' ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table> |
||||
<tr> |
||||
<th width="85px" style="vertical-align: top;"><?php echo $l->t("Description");?>:</th>
|
||||
<td> |
||||
<?php echo isset($_['description']) ? htmlspecialchars($_['description']) : '' ?></textarea>
|
||||
</tr> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
<div id="tabs-2"> |
||||
<table style="width:100%"> |
||||
<tr> |
||||
<th width="75px"><?php echo $l->t("Repeat");?>:</th>
|
||||
<td> |
||||
<select id="repeat" name="repeat"> |
||||
<?php |
||||
echo html_select_options(array($_['repeat_options'][$_['repeat']]), $_['repeat']); |
||||
?> |
||||
</select></td> |
||||
<td><input type="button" style="float:right;" class="submit" value="<?php echo $l->t("Advanced"); ?>" onclick="Calendar.UI.showadvancedoptionsforrepeating();" id="advanced_options_button"></td>
|
||||
</tr> |
||||
</table> |
||||
<div id="advanced_options_repeating" style="display:none;"> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_month" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td> |
||||
<select id="advanced_month_select" name="advanced_month_select"> |
||||
<?php |
||||
echo html_select_options(array($_['repeat_month_options'][$_['repeat_month']]), $_['repeat_month']); |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_year" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td> |
||||
<select id="advanced_year_select" name="advanced_year_select"> |
||||
<?php |
||||
echo html_select_options(array($_['repeat_year_options'][$_['repeat_year']]), $_['repeat_year']); |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_weekofmonth" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td id="weekofmonthcheckbox"> |
||||
<select id="weekofmonthoptions" name="weekofmonthoptions"> |
||||
<?php |
||||
echo html_select_options(array($_['repeat_weekofmonth_options'][$_['repeat_weekofmonth']]), $_['repeat_weekofmonth']); |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_weekday" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td id="weeklycheckbox"> |
||||
<select id="weeklyoptions" name="weeklyoptions[]" multiple="multiple" style="width: 150px;" title="<?php echo $l->t("Select weekdays") ?>">
|
||||
<?php |
||||
if (!isset($_['weekdays'])) {$_['weekdays'] = array();} |
||||
echo html_select_options(array($_['repeat_weekly_options'][$_['repeat_weekdays']]), $_['repeat_weekdays'], array('combine'=>true)); |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_byyearday" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td id="byyeardaycheckbox"> |
||||
<select id="byyearday" name="byyearday[]" multiple="multiple" title="<?php echo $l->t("Select days") ?>">
|
||||
<?php |
||||
if (!isset($_['repeat_byyearday'])) {$_['repeat_byyearday'] = array();} |
||||
echo html_select_options(array($_['repeat_byyearday_options'][$_['repeat_byyearday']]), $_['repeat_byyearday'], array('combine'=>true)); |
||||
?> |
||||
</select><?php echo $l->t('and the events day of year.'); ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_bymonthday" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td id="bymonthdaycheckbox"> |
||||
<select id="bymonthday" name="bymonthday[]" multiple="multiple" title="<?php echo $l->t("Select days") ?>">
|
||||
<?php |
||||
if (!isset($_['repeat_bymonthday'])) {$_['repeat_bymonthday'] = array();} |
||||
echo html_select_options(array($_['repeat_bymonthday_options'][$_['repeat_bymonthday']]), $_['repeat_bymonthday'], array('combine'=>true)); |
||||
?> |
||||
</select><?php echo $l->t('and the events day of month.'); ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_bymonth" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td id="bymonthcheckbox"> |
||||
<select id="bymonth" name="bymonth[]" multiple="multiple" title="<?php echo $l->t("Select months") ?>">
|
||||
<?php |
||||
if (!isset($_['repeat_bymonth'])) {$_['repeat_bymonth'] = array();} |
||||
echo html_select_options(array($_['repeat_bymonth_options'][$_['repeat_bymonth']]), $_['repeat_bymonth'], array('combine'=>true)); |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr id="advanced_byweekno" style="display:none;"> |
||||
<th width="75px"></th> |
||||
<td id="bymonthcheckbox"> |
||||
<select id="byweekno" name="byweekno[]" multiple="multiple" title="<?php echo $l->t("Select weeks") ?>">
|
||||
<?php |
||||
if (!isset($_['repeat_byweekno'])) {$_['repeat_byweekno'] = array();} |
||||
echo html_select_options(array($_['repeat_byweekno_options'][$_['repeat_byweekno']]), $_['repeat_byweekno'], array('combine'=>true)); |
||||
?> |
||||
</select><?php echo $l->t('and the events week of year.'); ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<table style="width:100%"> |
||||
<tr> |
||||
<th width="75px"><?php echo $l->t('Interval'); ?>:</th>
|
||||
<td> |
||||
<?php echo isset($_['repeat_interval']) ? $_['repeat_interval'] : '1'; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<th width="75px"><?php echo $l->t('End'); ?>:</th>
|
||||
<td> |
||||
<select id="end" name="end"> |
||||
<?php |
||||
if($_['repeat_end'] == '') $_['repeat_end'] = 'never'; |
||||
echo html_select_options(array($_['repeat_end_options'][$_['repeat_end']]), $_['repeat_end']); |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<th></th> |
||||
<td id="byoccurrences" style="display:none;"> |
||||
<?php echo $_['repeat_count'] . ' ' . $l->t('occurrences'); ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<th></th> |
||||
<td id="bydate" style="display:none;"> |
||||
<?php echo $_['repeat_date']; ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<?php echo $l->t('Summary'); ?>:<span id="repeatsummary"></span>
|
||||
</div> |
||||
</div> |
||||
<!--<div id="tabs-3">//Alarm</div> |
||||
<div id="tabs-4">//Attendees</div>--> |
||||
|
||||
</div> |
@ -0,0 +1,77 @@ |
||||
<?php |
||||
if(array_key_exists('calid', $_)){ |
||||
$id = $_['calid']; |
||||
$sharedelements = OC_Calendar_Share::allUsersSharedwith($_['calid'], OC_Calendar_Share::CALENDAR); |
||||
}else{ |
||||
$sharedelements = OC_Calendar_Share::allUsersSharedwith($_['eventid'], OC_Calendar_Share::EVENT); |
||||
$id = $_['eventid']; |
||||
} |
||||
$users = array();$groups = array();$public = array(); |
||||
foreach($sharedelements as $sharedelement){ |
||||
if($sharedelement['sharetype'] == 'user'){ |
||||
$users[] = $sharedelement; |
||||
}elseif($sharedelement['sharetype'] == 'group'){ |
||||
$groups[] = $sharedelement; |
||||
}elseif($sharedelement['sharetype'] == 'public'){ |
||||
$public = $sharedelement; |
||||
} |
||||
} |
||||
?> |
||||
<strong><?php echo $l->t('Users');?>:</strong><br>
|
||||
<select id="share_user" title="<?php echo $l->t('select users');?>" data-placeholder="<?php echo $l->t('select users'); ?>">
|
||||
<option value=""></option> |
||||
<?php |
||||
$allocusers = OC_User::getUsers(); |
||||
$allusers = array(); |
||||
foreach($allocusers as $ocuser){ |
||||
$allusers[$ocuser] = $ocuser; |
||||
} |
||||
unset($allusers[OC_User::getUser()]); |
||||
$allusers = array_flip($allusers); |
||||
echo html_select_options($allusers, array()); |
||||
?> |
||||
</select><br> |
||||
<ul id="sharewithuser_list"> |
||||
<?php foreach($users as $user): ?> |
||||
<li id="sharewithuser_<?php echo $user['share']; ?>"><input type="checkbox" width="12px" <?php echo ($user['permissions']?'checked="checked"':'')?> style="visibility:hidden;" title="<?php echo $l->t('Editable'); ?>"><?php echo $user['share']; ?><img src="<?php echo OC::$WEBROOT; ?>/core/img/actions/delete.svg" class="svg action" style="display:none;float:right;"></li>
|
||||
<script> |
||||
$('#sharewithuser_<?php echo $user['share']; ?> > img').click(function(){
|
||||
$('#share_user option[value="<?php echo $user['share']; ?>"]').removeAttr('disabled');
|
||||
Calendar.UI.Share.unshare(<?php echo $id; ?>, '<?php echo (array_key_exists('calid', $_)?'calendar':'event');?>', '<?php echo $user['share']; ?>', 'user');
|
||||
$('#sharewithuser_<?php echo $user['share']; ?>').remove();
|
||||
$("#share_user").trigger("liszt:updated"); |
||||
}); |
||||
$('#share_user option[value="<?php echo $user['share']; ?>"]').attr('disabled', 'disabled');
|
||||
</script> |
||||
<?php endforeach; ?> |
||||
</ul> |
||||
<strong><?php echo $l->t('Groups');?>:</strong><br>
|
||||
<select id="share_group" title="<?php echo $l->t('select groups');?>" data-placeholder="<?php echo $l->t('select groups'); ?>">
|
||||
<option value=""></option> |
||||
<?php |
||||
$allocgroups = OC_Group::getGroups(); |
||||
$allgroups = array(); |
||||
foreach($allocgroups as $ocgroup){ |
||||
$allgroups[$ocgroup] = $ocgroup; |
||||
} |
||||
echo html_select_options($allgroups, array()); |
||||
?> |
||||
</select><br> |
||||
<ul id="sharewithgroup_list"> |
||||
<?php foreach($groups as $group): ?> |
||||
<li id="sharewithgroup_<?php echo $group['share']; ?>"><input type="checkbox" width="12px" <?php echo ($group['permissions']?'checked="checked"':'')?> style="visibility:hidden;" title="<?php echo $l->t('Editable'); ?>"><?php echo $group['share']; ?><img src="<?php echo OC::$WEBROOT; ?>/core/img/actions/delete.svg" class="svg action" style="display:none;float:right;"></li>
|
||||
<script> |
||||
$('#sharewithgroup_<?php echo $group['share']; ?> > img').click(function(){
|
||||
$('#share_group option[value="<?php echo $group['share']; ?>"]').removeAttr('disabled');
|
||||
Calendar.UI.Share.unshare(<?php echo $id; ?>, '<?php echo (array_key_exists('calid', $_)?'calendar':'event');?>, '<?php echo $group['share']; ?>', 'group'); ?>
|
||||
$('#sharewithgroup_<?php echo $group['share']; ?>').remove();
|
||||
$("#share_group").trigger("liszt:updated"); |
||||
}); |
||||
$('#share_group option[value="<?php echo $group['share']; ?>"]').attr('disabled', 'disabled');
|
||||
</script> |
||||
<?php endforeach; ?> |
||||
</ul> |
||||
<div id="public"> |
||||
<input type="checkbox" id="publish" <?php echo ($public['share'])?'checked="checked"':'' ?>><label for="publish"><?php echo $l->t('make public'); ?></label><br>
|
||||
<input type="text" id="public_token" value="<?php echo OC_Helper::linkToAbsolute('apps/calendar', 'share.php?t=' . $public['share'], null, true) ; ?>" onmouseover="$('#public_token').select();" style="<?php echo (!$public['share'])?'display:none':'' ?>">
|
||||
</div> |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 187 B |
Loading…
Reference in new issue