diff options
author | Georg Ehrke <dev@georgswebsite.de> | 2012-04-10 15:53:39 -0400 |
---|---|---|
committer | Georg Ehrke <dev@georgswebsite.de> | 2012-04-10 16:03:38 -0400 |
commit | 64d3301523dce1032f7e20f03452573c125f8b17 (patch) | |
tree | c4e58d373607d9c8df81748677b36568492602d9 /apps/calendar | |
parent | eaa649cfb2e178765782c427098ecb82627b073b (diff) | |
download | nextcloud-server-64d3301523dce1032f7e20f03452573c125f8b17.tar.gz nextcloud-server-64d3301523dce1032f7e20f03452573c125f8b17.zip |
make shared events editable and add (empty) classes for alarm and attendees
Diffstat (limited to 'apps/calendar')
-rw-r--r-- | apps/calendar/ajax/event/edit.form.php | 1 | ||||
-rw-r--r-- | apps/calendar/ajax/event/edit.php | 12 | ||||
-rw-r--r-- | apps/calendar/ajax/event/move.php | 2 | ||||
-rw-r--r-- | apps/calendar/ajax/event/resize.php | 4 | ||||
-rw-r--r-- | apps/calendar/lib/alarm.php | 13 | ||||
-rw-r--r-- | apps/calendar/lib/app.php | 4 | ||||
-rw-r--r-- | apps/calendar/lib/attendees.php | 13 | ||||
-rw-r--r-- | apps/calendar/lib/object.php | 9 | ||||
-rw-r--r-- | apps/calendar/lib/share.php | 5 | ||||
-rw-r--r-- | apps/calendar/templates/part.editevent.php | 4 | ||||
-rw-r--r-- | apps/calendar/templates/part.eventform.php | 2 |
11 files changed, 54 insertions, 15 deletions
diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php index a2e3fe6163f..6783462eaf1 100644 --- a/apps/calendar/ajax/event/edit.form.php +++ b/apps/calendar/ajax/event/edit.form.php @@ -15,6 +15,7 @@ OC_JSON::checkAppEnabled('calendar'); $id = $_GET['id']; $data = OC_Calendar_App::getEventObject($id, true, true); + if(!$data){ OC_JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar')))); exit; diff --git a/apps/calendar/ajax/event/edit.php b/apps/calendar/ajax/event/edit.php index 8dd99b2b100..f65b67b84ac 100644 --- a/apps/calendar/ajax/event/edit.php +++ b/apps/calendar/ajax/event/edit.php @@ -12,6 +12,13 @@ OC_JSON::checkAppEnabled('calendar'); $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); if($access != 'owner' && $access != 'rw'){ OC_JSON::error(array('message'=>'permission denied')); @@ -24,14 +31,13 @@ if($errarr){ OC_JSON::error($errarr); exit; }else{ - $cal = $_POST['calendar']; - $data = OC_Calendar_App::getEventObject($id); + $data = OC_Calendar_App::getEventObject($id, false, false); $vcalendar = OC_VObject::parse($data['calendardata']); OC_Calendar_App::isNotModified($vcalendar->VEVENT, $_POST['lastmodified']); 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) { OC_Calendar_Object::moveToCalendar($id, $cal); } diff --git a/apps/calendar/ajax/event/move.php b/apps/calendar/ajax/event/move.php index c6743e2354f..faf3a9c8f1c 100644 --- a/apps/calendar/ajax/event/move.php +++ b/apps/calendar/ajax/event/move.php @@ -14,7 +14,7 @@ if($access != 'owner' && $access != 'rw'){ OC_JSON::error(array('message'=>'permission denied')); exit; } -$vcalendar = OC_Calendar_App::getVCalendar($id); +$vcalendar = OC_Calendar_App::getVCalendar($id, false, false); $vevent = $vcalendar->VEVENT; $allday = $_POST['allDay']; diff --git a/apps/calendar/ajax/event/resize.php b/apps/calendar/ajax/event/resize.php index a2ae83111b8..983a04f3bb8 100644 --- a/apps/calendar/ajax/event/resize.php +++ b/apps/calendar/ajax/event/resize.php @@ -16,7 +16,7 @@ if($access != 'owner' && $access != 'rw'){ exit; } -$vcalendar = OC_Calendar_App::getVCalendar($id); +$vcalendar = OC_Calendar_App::getVCalendar($id, false, false); $vevent = $vcalendar->VEVENT; $delta = new DateInterval('P0D'); @@ -33,6 +33,6 @@ unset($vevent->DURATION); $vevent->setDateTime('LAST-MODIFIED', '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(); OC_JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); diff --git a/apps/calendar/lib/alarm.php b/apps/calendar/lib/alarm.php new file mode 100644 index 00000000000..a71cc086827 --- /dev/null +++ b/apps/calendar/lib/alarm.php @@ -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{ + +}
\ No newline at end of file diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index 9febf389f50..58cc34658c6 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -80,8 +80,8 @@ class OC_Calendar_App{ * @param bool $security - check access rights or not * @return mixed - bool / object */ - public static function getVCalendar($id, $security = true){ - $event_object = self::getEventObject($id, $security); + public static function getVCalendar($id, $security = true, $shared = false){ + $event_object = self::getEventObject($id, $security, $shared); if($event_object === false){ return false; } diff --git a/apps/calendar/lib/attendees.php b/apps/calendar/lib/attendees.php new file mode 100644 index 00000000000..ac30e11b3be --- /dev/null +++ b/apps/calendar/lib/attendees.php @@ -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{ + +}
\ No newline at end of file diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 898b3910140..11123697e9a 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -451,8 +451,8 @@ class OC_Calendar_Object{ $errarr['title'] = 'true'; $errnum++; } - $calendar = OC_Calendar_Calendar::find($request['calendar']); - if($calendar['userid'] != OC_User::getUser()){ + $calendar = OC_Calendar_App::getCalendar($request['calendar'], true, true); + if(!$calendar){ $errarr['cal'] = 'true'; $errnum++; } @@ -816,4 +816,9 @@ class OC_Calendar_Object{ $cal = OC_Calendar_Calendar::find($event['calendarid']); return $cal['userid']; } + + public static function getCalendarid($id){ + $event = self::find($id); + return $event['calendarid']; + } } diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index f5acef92b6f..6a4e1a6f1cf 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -213,12 +213,13 @@ class OC_Calendar_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 . ')'); $result = $stmt->execute(array($share)); - if($result->numRows() > 0){ + $rows = $result->numRows(); + if($rows > 0){ 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 self::check_access($share, $event['calendarid'], self::CALENDAR); } return false; } diff --git a/apps/calendar/templates/part.editevent.php b/apps/calendar/templates/part.editevent.php index 6e319e1b4e0..58314db1a6b 100644 --- a/apps/calendar/templates/part.editevent.php +++ b/apps/calendar/templates/part.editevent.php @@ -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> diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php index e4bae3d4f81..36c741b3a39 100644 --- a/apps/calendar/templates/part.eventform.php +++ b/apps/calendar/templates/part.eventform.php @@ -44,7 +44,7 @@ echo 'Calendar.UI.Share.idtype = "event";' . "\n" . 'Calendar.UI.Share.currentid <?php } else { ?> <th width="75px"> </th> <td> - <input type="hidden" name="calendar" value="<?php echo $_['calendar_options'][0]['eventid'] ?>"> + <input type="hidden" name="calendar" value="<?php echo $_['calendar']; ?>"> </td> <?php } ?> </tr> |