Fixes for Calendar app
This commit is contained in:
parent
15559d3e88
commit
2353f02d9a
4 changed files with 41 additions and 2 deletions
|
@ -29,15 +29,25 @@ if($errarr){
|
|||
exit;
|
||||
}else{
|
||||
$id = $_POST['id'];
|
||||
$cal = $_POST['calendar'];
|
||||
$data = OC_Calendar_Object::find($id);
|
||||
if (!$data)
|
||||
{
|
||||
echo json_encode(array("error"=>"true"));
|
||||
exit;
|
||||
}
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
|
||||
if($calendar['userid'] != OC_User::getUser()){
|
||||
echo json_encode(array("error"=>"true"));
|
||||
exit;
|
||||
}
|
||||
$vcalendar = Sabre_VObject_Reader::read($data['calendardata']);
|
||||
OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar);
|
||||
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||
if ($data['calendarid'] != $cal) {
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($request['calendar']);
|
||||
OC_Calendar_Object::moveToCalendar($id, $cal);
|
||||
}
|
||||
echo json_encode(array("success"=>"true"));
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -26,6 +26,11 @@ $repeat_options = OC_Calendar_Object::getRepeatOptions($l10n);
|
|||
|
||||
$id = $_GET['id'];
|
||||
$data = OC_Calendar_Object::find($id);
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
|
||||
if($calendar['userid'] != OC_User::getUser()){
|
||||
echo $l10n->t('Wrong calendar');
|
||||
exit;
|
||||
}
|
||||
$object = Sabre_VObject_Reader::read($data['calendardata']);
|
||||
$vevent = $object->VEVENT;
|
||||
$dtstart = $vevent->DTSTART;
|
||||
|
@ -38,11 +43,19 @@ switch($dtstart->getDateType()) {
|
|||
$endtime = $dtend->getDateTime()->format('H:i');
|
||||
$allday = false;
|
||||
break;
|
||||
case Sabre_VObject_Element_DateTime::DATE:
|
||||
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
||||
$starttime = '';
|
||||
$dtend->getDateTime()->modify('-1 day');
|
||||
$enddate = $dtend->getDateTime()->format('d-m-Y');
|
||||
$endtime = '';
|
||||
$allday = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$summary = isset($vevent->SUMMARY) ? $vevent->SUMMARY->value : '';
|
||||
$location = isset($vevent->LOCATION) ? $vevent->LOCATION->value : '';
|
||||
$category = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
|
||||
$category = isset($vevent->CATEGORIES) ? $vevent->CATEGORIES->value : '';
|
||||
$repeat = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
|
||||
$description = isset($vevent->DESCRIPTION) ? $vevent->DESCRIPTION->value : '';
|
||||
|
||||
|
|
|
@ -180,6 +180,15 @@ class OC_Calendar_Object{
|
|||
return true;
|
||||
}
|
||||
|
||||
public static function moveToCalendar($id, $calendarid){
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET calendarid=? WHERE id = ?' );
|
||||
$result = $stmt->execute(array($calendarid,$id));
|
||||
|
||||
OC_Calendar_Calendar::touchCalendar($id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a UID
|
||||
* @return string
|
||||
|
@ -415,6 +424,9 @@ class OC_Calendar_Object{
|
|||
$created->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->add($created);
|
||||
|
||||
$uid = self::createUID();
|
||||
$vevent->add('UID',$uid);
|
||||
|
||||
return self::updateVCalendarFromRequest($request, $vcalendar);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,11 @@
|
|||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
|
||||
$events = OC_Calendar_Object::all($calendars[0]['id']);
|
||||
$events = array();
|
||||
foreach($calendars as $calendar) {
|
||||
$tmp = OC_Calendar_Object::all($calendar['id']);
|
||||
$events = array_merge($events, $tmp);
|
||||
}
|
||||
$select_year = $_GET["year"];
|
||||
$return_events = array();
|
||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
|
|
Loading…
Reference in a new issue