Update edittaskform for new calendar API

This commit is contained in:
Bart Visscher 2012-02-22 20:12:49 +01:00
parent 7f754c02f3
commit 92db4f8be0
3 changed files with 5 additions and 17 deletions

View File

@ -8,19 +8,7 @@ OC_JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
$id = $_GET['id'];
$task = OC_Calendar_Object::find( $id );
if( $task === false ){
OC_JSON::error(array('data' => array( 'message' => $l10n->t('Can not find Task!'))));
exit();
}
$calendar = OC_Calendar_Calendar::findCalendar( $task['calendarid'] );
if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){
OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your task!'))));
exit();
}
$details = Sabre_VObject_Reader::read($task['calendardata'])->VTODO;
$details = OC_Calendar_App::getVCalendar($id)->VTODO;
$categories = array();
if (isset($details->CATEGORIES)){
$categories = explode(',', $details->CATEGORIES->value);
@ -35,7 +23,7 @@ $tmpl = new OC_Template('tasks','part.edittaskform');
$tmpl->assign('category_options', $category_options);
$tmpl->assign('percent_options', $percent_options);
$tmpl->assign('priority_options', $priority_options);
$tmpl->assign('task',$task);
$tmpl->assign('id',$id);
$tmpl->assign('details',$details);
$tmpl->assign('categories', $categories);
$page = $tmpl->fetchPage();

View File

@ -13,8 +13,8 @@ OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('tasks');
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
if( count($calendars) == 0){
header('Location: ' . OC_HELPER::linkTo('calendar', 'index.php'));
if( count($calendars) == 0 ) {
header('Location: ' . OC_Helper::linkTo('calendar', 'index.php'));
exit;
}

View File

@ -1,5 +1,5 @@
<form id="tasks_edittaskform">
<input type="hidden" name="id" value="<?php echo $_['task']['id']; ?>">
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
<?php echo $this->inc('part.taskform'); ?>
<input type="submit" name="submit" value="<?php echo $l->t('Update Task'); ?>">
</form>