diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-04-23 22:13:35 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-04-23 22:13:35 +0200 |
commit | b704ff1bc7053e5b8b1a83be58466e8627f849fa (patch) | |
tree | 7f9f8371b0239670b65ad19d8f18ba6881a714bf /apps/tasks/ajax | |
parent | 728e6a6bf9540b845073c4c8fb96dd7eb1dffa3a (diff) | |
download | nextcloud-server-b704ff1bc7053e5b8b1a83be58466e8627f849fa.tar.gz nextcloud-server-b704ff1bc7053e5b8b1a83be58466e8627f849fa.zip |
Tasks: Simple add task action
Diffstat (limited to 'apps/tasks/ajax')
-rw-r--r-- | apps/tasks/ajax/addtask.php | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/apps/tasks/ajax/addtask.php b/apps/tasks/ajax/addtask.php index 3f129a0eb90..9d62a5fe707 100644 --- a/apps/tasks/ajax/addtask.php +++ b/apps/tasks/ajax/addtask.php @@ -5,26 +5,23 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('tasks'); -$cid = $_POST['id']; -$calendar = OC_Calendar_App::getCalendar( $cid ); +$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true); +$cid = reset($calendars)['id']; -$errors = OC_Task_App::validateRequest($_POST); -if (!empty($errors)) { - OC_JSON::error(array('data' => array( 'errors' => $errors ))); - exit(); -} - -$vcalendar = OC_Task_App::createVCalendarFromRequest($_POST); +$input = $_GET['text']; +$request = array(); +$request['summary'] = $input; +$request["categories"] = null; +$request['priority'] = null; +$request['percent_complete'] = null; +$request['completed'] = null; +$request['location'] = null; +$request['due'] = null; +$request['description'] = null; +$vcalendar = OC_Task_App::createVCalendarFromRequest($request); $id = OC_Calendar_Object::add($cid, $vcalendar->serialize()); -$priority_options = OC_Task_App::getPriorityOptions(); -$tmpl = new OC_Template('tasks','part.details'); -$tmpl->assign('priority_options', $priority_options); -$tmpl->assign('details',$vcalendar->VTODO); -$tmpl->assign('id',$id); -$page = $tmpl->fetchPage(); - $user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone); -OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task ))); +OC_JSON::success(array('task' => $task)); |