Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-04-13 18:51:04 +0400
committerBart Visscher <bartv@thisnet.nl>2012-04-13 23:13:58 +0400
commit28e0d64edefb0156056d47e84de9a494f0236bea (patch)
treea2c7fb5155688d29d7bf939f1b50ca43239f7884 /apps/calendar
parentf9b7ed3a1f0e3671b0018ead4b303f60460f9ea8 (diff)
Calendar: Fix saving of Categories in an event
Diffstat (limited to 'apps/calendar')
-rw-r--r--apps/calendar/ajax/event/edit.form.php9
-rw-r--r--apps/calendar/ajax/event/new.form.php2
-rw-r--r--apps/calendar/lib/object.php8
-rw-r--r--apps/calendar/templates/part.eventform.php2
4 files changed, 4 insertions, 17 deletions
diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php
index 837edbbbf05..a979836755b 100644
--- a/apps/calendar/ajax/event/edit.form.php
+++ b/apps/calendar/ajax/event/edit.form.php
@@ -41,13 +41,8 @@ switch($dtstart->getDateType()) {
$summary = $vevent->getAsString('SUMMARY');
$location = $vevent->getAsString('LOCATION');
-$categories = $vevent->getAsArray('CATEGORIES');
+$categories = $vevent->getAsString('CATEGORIES');
$description = $vevent->getAsString('DESCRIPTION');
-foreach($categories as $category){
- if (!in_array($category, $category_options)){
- array_unshift($category_options, $category);
- }
-}
$last_modified = $vevent->__get('LAST-MODIFIED');
if ($last_modified){
$lastmodified = $last_modified->getDateTime()->format('U');
@@ -189,7 +184,6 @@ if($data['repeating'] == 1){
}
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
-$category_options = OC_Calendar_App::getCategoryOptions();
$repeat_options = OC_Calendar_App::getRepeatOptions();
$repeat_end_options = OC_Calendar_App::getEndOptions();
$repeat_month_options = OC_Calendar_App::getMonthOptions();
@@ -205,7 +199,6 @@ $tmpl = new OC_Template('calendar', 'part.editevent');
$tmpl->assign('id', $id);
$tmpl->assign('lastmodified', $lastmodified);
$tmpl->assign('calendar_options', $calendar_options);
-$tmpl->assign('category_options', $category_options);
$tmpl->assign('repeat_options', $repeat_options);
$tmpl->assign('repeat_month_options', $repeat_month_options);
$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php
index c19928a727e..e7d52c675de 100644
--- a/apps/calendar/ajax/event/new.form.php
+++ b/apps/calendar/ajax/event/new.form.php
@@ -32,7 +32,6 @@ $start->setTimezone(new DateTimeZone($timezone));
$end->setTimezone(new DateTimeZone($timezone));
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
-$category_options = OC_Calendar_App::getCategoryOptions();
$repeat_options = OC_Calendar_App::getRepeatOptions();
$repeat_end_options = OC_Calendar_App::getEndOptions();
$repeat_month_options = OC_Calendar_App::getMonthOptions();
@@ -46,7 +45,6 @@ $repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions();
$tmpl = new OC_Template('calendar', 'part.newevent');
$tmpl->assign('calendar_options', $calendar_options);
-$tmpl->assign('category_options', $category_options);
$tmpl->assign('repeat_options', $repeat_options);
$tmpl->assign('repeat_month_options', $repeat_month_options);
$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index 4d4421b5c4a..dbec61c67ec 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -436,10 +436,6 @@ class OC_Calendar_Object{
$errnum++;
}
- if(isset($request['categories']) && !is_array($request['categories'])){
- $errors['categories'] = $l10n->t('Not an array');
- }
-
$fromday = substr($request['from'], 0, 2);
$frommonth = substr($request['from'], 3, 2);
$fromyear = substr($request['from'], 6, 4);
@@ -607,7 +603,7 @@ class OC_Calendar_Object{
{
$title = $request["title"];
$location = $request["location"];
- $categories = isset($request["categories"]) ? $request["categories"] : array();
+ $categories = $request["categories"];
$allday = isset($request["allday"]);
$from = $request["from"];
$to = $request["to"];
@@ -781,7 +777,7 @@ class OC_Calendar_Object{
$vevent->setString('LOCATION', $location);
$vevent->setString('DESCRIPTION', $description);
- $vevent->setString('CATEGORIES', join(',', $categories));
+ $vevent->setString('CATEGORIES', $categories);
/*if($repeat == "true"){
$vevent->RRULE = $repeat;
diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php
index 130ce111b03..3830c273a73 100644
--- a/apps/calendar/templates/part.eventform.php
+++ b/apps/calendar/templates/part.eventform.php
@@ -10,7 +10,7 @@
<tr>
<th width="75px"><?php echo $l->t("Category");?>:</th>
<td>
- <input id="category" name="categories" type="text" placeholder="<?php echo $l->t('Separate categories with commas'); ?>">
+ <input id="category" name="categories" type="text" placeholder="<?php echo $l->t('Separate categories with commas'); ?>" value="<?php echo isset($_['categories']) ? htmlspecialchars($_['categories']) : '' ?>">
<a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"><img alt="<?php echo $l->t('Edit categories'); ?>" src="<?php echo image_path('core','actions/rename.svg')?>" class="svg action" style="width: 16px; height: 16px;"></a>
</td>
<?php if(count($_['calendar_options']) > 1) { ?>