make shared events editable and add (empty) classes for alarm and attendees
This commit is contained in:
parent
eaa649cfb2
commit
64d3301523
|
@ -15,6 +15,7 @@ OC_JSON::checkAppEnabled('calendar');
|
||||||
|
|
||||||
$id = $_GET['id'];
|
$id = $_GET['id'];
|
||||||
$data = OC_Calendar_App::getEventObject($id, true, true);
|
$data = OC_Calendar_App::getEventObject($id, true, true);
|
||||||
|
|
||||||
if(!$data){
|
if(!$data){
|
||||||
OC_JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar'))));
|
OC_JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar'))));
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -12,6 +12,13 @@ OC_JSON::checkAppEnabled('calendar');
|
||||||
|
|
||||||
$id = $_POST['id'];
|
$id = $_POST['id'];
|
||||||
|
|
||||||
|
if(!array_key_exists('calendar', $_POST)){
|
||||||
|
$cal = OC_Calendar_Object::getCalendarid($id);
|
||||||
|
$_POST['calendar'] = $cal;
|
||||||
|
}else{
|
||||||
|
$cal = $_POST['calendar'];
|
||||||
|
}
|
||||||
|
|
||||||
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
|
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
|
||||||
if($access != 'owner' && $access != 'rw'){
|
if($access != 'owner' && $access != 'rw'){
|
||||||
OC_JSON::error(array('message'=>'permission denied'));
|
OC_JSON::error(array('message'=>'permission denied'));
|
||||||
|
@ -24,14 +31,13 @@ if($errarr){
|
||||||
OC_JSON::error($errarr);
|
OC_JSON::error($errarr);
|
||||||
exit;
|
exit;
|
||||||
}else{
|
}else{
|
||||||
$cal = $_POST['calendar'];
|
$data = OC_Calendar_App::getEventObject($id, false, false);
|
||||||
$data = OC_Calendar_App::getEventObject($id);
|
|
||||||
$vcalendar = OC_VObject::parse($data['calendardata']);
|
$vcalendar = OC_VObject::parse($data['calendardata']);
|
||||||
|
|
||||||
OC_Calendar_App::isNotModified($vcalendar->VEVENT, $_POST['lastmodified']);
|
OC_Calendar_App::isNotModified($vcalendar->VEVENT, $_POST['lastmodified']);
|
||||||
OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar);
|
OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar);
|
||||||
|
|
||||||
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||||
if ($data['calendarid'] != $cal) {
|
if ($data['calendarid'] != $cal) {
|
||||||
OC_Calendar_Object::moveToCalendar($id, $cal);
|
OC_Calendar_Object::moveToCalendar($id, $cal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ if($access != 'owner' && $access != 'rw'){
|
||||||
OC_JSON::error(array('message'=>'permission denied'));
|
OC_JSON::error(array('message'=>'permission denied'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$vcalendar = OC_Calendar_App::getVCalendar($id);
|
$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
|
||||||
$vevent = $vcalendar->VEVENT;
|
$vevent = $vcalendar->VEVENT;
|
||||||
|
|
||||||
$allday = $_POST['allDay'];
|
$allday = $_POST['allDay'];
|
||||||
|
|
|
@ -16,7 +16,7 @@ if($access != 'owner' && $access != 'rw'){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$vcalendar = OC_Calendar_App::getVCalendar($id);
|
$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
|
||||||
$vevent = $vcalendar->VEVENT;
|
$vevent = $vcalendar->VEVENT;
|
||||||
|
|
||||||
$delta = new DateInterval('P0D');
|
$delta = new DateInterval('P0D');
|
||||||
|
@ -33,6 +33,6 @@ unset($vevent->DURATION);
|
||||||
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC);
|
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||||
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC);
|
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||||
|
|
||||||
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||||
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
|
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
|
||||||
OC_JSON::success(array('lastmodified'=>(int)$lastmodified->format('U')));
|
OC_JSON::success(array('lastmodified'=>(int)$lastmodified->format('U')));
|
||||||
|
|
|
@ -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{
|
||||||
|
|
||||||
|
}
|
|
@ -80,8 +80,8 @@ class OC_Calendar_App{
|
||||||
* @param bool $security - check access rights or not
|
* @param bool $security - check access rights or not
|
||||||
* @return mixed - bool / object
|
* @return mixed - bool / object
|
||||||
*/
|
*/
|
||||||
public static function getVCalendar($id, $security = true){
|
public static function getVCalendar($id, $security = true, $shared = false){
|
||||||
$event_object = self::getEventObject($id, $security);
|
$event_object = self::getEventObject($id, $security, $shared);
|
||||||
if($event_object === false){
|
if($event_object === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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{
|
||||||
|
|
||||||
|
}
|
|
@ -451,8 +451,8 @@ class OC_Calendar_Object{
|
||||||
$errarr['title'] = 'true';
|
$errarr['title'] = 'true';
|
||||||
$errnum++;
|
$errnum++;
|
||||||
}
|
}
|
||||||
$calendar = OC_Calendar_Calendar::find($request['calendar']);
|
$calendar = OC_Calendar_App::getCalendar($request['calendar'], true, true);
|
||||||
if($calendar['userid'] != OC_User::getUser()){
|
if(!$calendar){
|
||||||
$errarr['cal'] = 'true';
|
$errarr['cal'] = 'true';
|
||||||
$errnum++;
|
$errnum++;
|
||||||
}
|
}
|
||||||
|
@ -816,4 +816,9 @@ class OC_Calendar_Object{
|
||||||
$cal = OC_Calendar_Calendar::find($event['calendarid']);
|
$cal = OC_Calendar_Calendar::find($event['calendarid']);
|
||||||
return $cal['userid'];
|
return $cal['userid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCalendarid($id){
|
||||||
|
$event = self::find($id);
|
||||||
|
return $event['calendarid'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,12 +213,13 @@ class OC_Calendar_Share{
|
||||||
$group_where = self::group_sql(OC_Group::getUserGroups($share));
|
$group_where = self::group_sql(OC_Group::getUserGroups($share));
|
||||||
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ')');
|
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ')');
|
||||||
$result = $stmt->execute(array($share));
|
$result = $stmt->execute(array($share));
|
||||||
if($result->numRows() > 0){
|
$rows = $result->numRows();
|
||||||
|
if($rows > 0){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if($type == self::EVENT){
|
if($type == self::EVENT){
|
||||||
$event = OC_Calendar_App::getEventObject($id, false, false);
|
$event = OC_Calendar_App::getEventObject($id, false, false);
|
||||||
return self::is_editing_allowed($share, $event['calendarid'], self::CALENDAR);
|
return self::check_access($share, $event['calendarid'], self::CALENDAR);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<div id="event" title="<?php echo $l->t("Edit an event");?>">
|
<div id="event" title="<?php echo $l->t("Edit an event");?>">
|
||||||
<form id="event_form">
|
<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'] ?>">
|
<input type="hidden" name="lastmodified" value="<?php echo $_['lastmodified'] ?>">
|
||||||
<?php echo $this->inc("part.eventform"); ?>
|
<?php echo $this->inc("part.eventform"); ?>
|
||||||
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
|
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
|
||||||
<span id="actions">
|
<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;" 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: 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>
|
</span>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,7 +44,7 @@ echo 'Calendar.UI.Share.idtype = "event";' . "\n" . 'Calendar.UI.Share.currentid
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<th width="75px"> </th>
|
<th width="75px"> </th>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="calendar" value="<?php echo $_['calendar_options'][0]['eventid'] ?>">
|
<input type="hidden" name="calendar" value="<?php echo $_['calendar']; ?>">
|
||||||
</td>
|
</td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue