Calendar: Fix saving of Categories in an event
This commit is contained in:
parent
f9b7ed3a1f
commit
28e0d64ede
4 changed files with 4 additions and 17 deletions
|
@ -41,13 +41,8 @@ switch($dtstart->getDateType()) {
|
||||||
|
|
||||||
$summary = $vevent->getAsString('SUMMARY');
|
$summary = $vevent->getAsString('SUMMARY');
|
||||||
$location = $vevent->getAsString('LOCATION');
|
$location = $vevent->getAsString('LOCATION');
|
||||||
$categories = $vevent->getAsArray('CATEGORIES');
|
$categories = $vevent->getAsString('CATEGORIES');
|
||||||
$description = $vevent->getAsString('DESCRIPTION');
|
$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');
|
$last_modified = $vevent->__get('LAST-MODIFIED');
|
||||||
if ($last_modified){
|
if ($last_modified){
|
||||||
$lastmodified = $last_modified->getDateTime()->format('U');
|
$lastmodified = $last_modified->getDateTime()->format('U');
|
||||||
|
@ -189,7 +184,6 @@ if($data['repeating'] == 1){
|
||||||
}
|
}
|
||||||
|
|
||||||
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||||
$category_options = OC_Calendar_App::getCategoryOptions();
|
|
||||||
$repeat_options = OC_Calendar_App::getRepeatOptions();
|
$repeat_options = OC_Calendar_App::getRepeatOptions();
|
||||||
$repeat_end_options = OC_Calendar_App::getEndOptions();
|
$repeat_end_options = OC_Calendar_App::getEndOptions();
|
||||||
$repeat_month_options = OC_Calendar_App::getMonthOptions();
|
$repeat_month_options = OC_Calendar_App::getMonthOptions();
|
||||||
|
@ -205,7 +199,6 @@ $tmpl = new OC_Template('calendar', 'part.editevent');
|
||||||
$tmpl->assign('id', $id);
|
$tmpl->assign('id', $id);
|
||||||
$tmpl->assign('lastmodified', $lastmodified);
|
$tmpl->assign('lastmodified', $lastmodified);
|
||||||
$tmpl->assign('calendar_options', $calendar_options);
|
$tmpl->assign('calendar_options', $calendar_options);
|
||||||
$tmpl->assign('category_options', $category_options);
|
|
||||||
$tmpl->assign('repeat_options', $repeat_options);
|
$tmpl->assign('repeat_options', $repeat_options);
|
||||||
$tmpl->assign('repeat_month_options', $repeat_month_options);
|
$tmpl->assign('repeat_month_options', $repeat_month_options);
|
||||||
$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
|
$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
|
||||||
|
|
|
@ -32,7 +32,6 @@ $start->setTimezone(new DateTimeZone($timezone));
|
||||||
$end->setTimezone(new DateTimeZone($timezone));
|
$end->setTimezone(new DateTimeZone($timezone));
|
||||||
|
|
||||||
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||||
$category_options = OC_Calendar_App::getCategoryOptions();
|
|
||||||
$repeat_options = OC_Calendar_App::getRepeatOptions();
|
$repeat_options = OC_Calendar_App::getRepeatOptions();
|
||||||
$repeat_end_options = OC_Calendar_App::getEndOptions();
|
$repeat_end_options = OC_Calendar_App::getEndOptions();
|
||||||
$repeat_month_options = OC_Calendar_App::getMonthOptions();
|
$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 = new OC_Template('calendar', 'part.newevent');
|
||||||
$tmpl->assign('calendar_options', $calendar_options);
|
$tmpl->assign('calendar_options', $calendar_options);
|
||||||
$tmpl->assign('category_options', $category_options);
|
|
||||||
$tmpl->assign('repeat_options', $repeat_options);
|
$tmpl->assign('repeat_options', $repeat_options);
|
||||||
$tmpl->assign('repeat_month_options', $repeat_month_options);
|
$tmpl->assign('repeat_month_options', $repeat_month_options);
|
||||||
$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
|
$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
|
||||||
|
|
|
@ -436,10 +436,6 @@ class OC_Calendar_Object{
|
||||||
$errnum++;
|
$errnum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($request['categories']) && !is_array($request['categories'])){
|
|
||||||
$errors['categories'] = $l10n->t('Not an array');
|
|
||||||
}
|
|
||||||
|
|
||||||
$fromday = substr($request['from'], 0, 2);
|
$fromday = substr($request['from'], 0, 2);
|
||||||
$frommonth = substr($request['from'], 3, 2);
|
$frommonth = substr($request['from'], 3, 2);
|
||||||
$fromyear = substr($request['from'], 6, 4);
|
$fromyear = substr($request['from'], 6, 4);
|
||||||
|
@ -607,7 +603,7 @@ class OC_Calendar_Object{
|
||||||
{
|
{
|
||||||
$title = $request["title"];
|
$title = $request["title"];
|
||||||
$location = $request["location"];
|
$location = $request["location"];
|
||||||
$categories = isset($request["categories"]) ? $request["categories"] : array();
|
$categories = $request["categories"];
|
||||||
$allday = isset($request["allday"]);
|
$allday = isset($request["allday"]);
|
||||||
$from = $request["from"];
|
$from = $request["from"];
|
||||||
$to = $request["to"];
|
$to = $request["to"];
|
||||||
|
@ -781,7 +777,7 @@ class OC_Calendar_Object{
|
||||||
|
|
||||||
$vevent->setString('LOCATION', $location);
|
$vevent->setString('LOCATION', $location);
|
||||||
$vevent->setString('DESCRIPTION', $description);
|
$vevent->setString('DESCRIPTION', $description);
|
||||||
$vevent->setString('CATEGORIES', join(',', $categories));
|
$vevent->setString('CATEGORIES', $categories);
|
||||||
|
|
||||||
/*if($repeat == "true"){
|
/*if($repeat == "true"){
|
||||||
$vevent->RRULE = $repeat;
|
$vevent->RRULE = $repeat;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th width="75px"><?php echo $l->t("Category");?>:</th>
|
<th width="75px"><?php echo $l->t("Category");?>:</th>
|
||||||
<td>
|
<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>
|
<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>
|
</td>
|
||||||
<?php if(count($_['calendar_options']) > 1) { ?>
|
<?php if(count($_['calendar_options']) > 1) { ?>
|
||||||
|
|
Loading…
Reference in a new issue