2011-09-12 23:28:28 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Init owncloud
|
2012-05-04 19:19:25 +04:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('tasks');
|
2011-09-12 23:28:28 +04:00
|
|
|
|
|
|
|
$l10n = new OC_L10N('tasks');
|
|
|
|
|
|
|
|
$id = $_POST['id'];
|
2012-02-23 00:15:57 +04:00
|
|
|
$vcalendar = OC_Calendar_App::getVCalendar($id);
|
2011-09-12 23:28:28 +04:00
|
|
|
|
2012-02-22 23:11:38 +04:00
|
|
|
$errors = OC_Task_App::validateRequest($_POST);
|
2011-09-14 00:44:15 +04:00
|
|
|
if (!empty($errors)) {
|
2012-05-04 19:19:25 +04:00
|
|
|
OCP\JSON::error(array('data' => array( 'errors' => $errors )));
|
2011-09-14 00:44:15 +04:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2012-02-22 23:11:38 +04:00
|
|
|
OC_Task_App::updateVCalendarFromRequest($_POST, $vcalendar);
|
2011-09-12 23:28:28 +04:00
|
|
|
OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
|
|
|
|
2012-02-22 23:11:38 +04:00
|
|
|
$priority_options = OC_Task_App::getPriorityOptions();
|
2011-09-12 23:28:28 +04:00
|
|
|
$tmpl = new OC_Template('tasks','part.details');
|
2011-09-14 00:44:15 +04:00
|
|
|
$tmpl->assign('priority_options', $priority_options);
|
|
|
|
$tmpl->assign('details', $vcalendar->VTODO);
|
|
|
|
$tmpl->assign('id', $id);
|
2011-09-12 23:28:28 +04:00
|
|
|
$page = $tmpl->fetchPage();
|
|
|
|
|
2012-05-04 22:20:37 +04:00
|
|
|
$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
2012-03-09 01:26:54 +04:00
|
|
|
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
|
|
|
|
|
2012-05-04 19:19:25 +04:00
|
|
|
OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
|