summaryrefslogtreecommitdiffstats
path: root/apps/calendar/lib
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-04-13 18:36:20 +0200
committerBart Visscher <bartv@thisnet.nl>2012-04-13 21:13:58 +0200
commit4c520079964b8b3ecacb9ff6e74d60ac07f130fe (patch)
tree0083c9f29f434391398be48c4ad9872a3adc7151 /apps/calendar/lib
parent471e735b0c26a4f845e8341a98fdc04067ee4cfa (diff)
downloadnextcloud-server-4c520079964b8b3ecacb9ff6e74d60ac07f130fe.tar.gz
nextcloud-server-4c520079964b8b3ecacb9ff6e74d60ac07f130fe.zip
Calendar: Update category list when updating/adding event
Diffstat (limited to 'apps/calendar/lib')
-rw-r--r--apps/calendar/lib/app.php8
-rw-r--r--apps/calendar/lib/object.php2
2 files changed, 10 insertions, 0 deletions
diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php
index 5e803ebf7bf..22c1133e006 100644
--- a/apps/calendar/lib/app.php
+++ b/apps/calendar/lib/app.php
@@ -116,6 +116,14 @@ class OC_Calendar_App{
}
}
+ /**
+ * check VEvent for new categories.
+ * @see OC_VCategories::loadFromVObject
+ */
+ public static function loadCategoriesFromVCalendar(OC_VObject $calendar) {
+ self::getVCategories()->loadFromVObject($calendar->VEVENT, true);
+ }
+
public static function getRepeatOptions(){
return OC_Calendar_Object::getRepeatOptions(self::$l10n);
}
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index dbec61c67ec..d5622f6251f 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -93,6 +93,7 @@ class OC_Calendar_Object{
*/
public static function add($id,$data){
$object = OC_VObject::parse($data);
+ OC_Calendar_App::loadCategoriesFromVCalendar($object);
list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
if(is_null($uid)){
@@ -139,6 +140,7 @@ class OC_Calendar_Object{
$oldobject = self::find($id);
$object = OC_VObject::parse($data);
+ OC_Calendar_App::loadCategoriesFromVCalendar($object);
list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' );