summaryrefslogtreecommitdiffstats
path: root/apps/tasks/ajax
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-04-15 15:39:49 +0200
committerBart Visscher <bartv@thisnet.nl>2012-04-15 15:39:49 +0200
commit947d2e5705ed606469d99ec4115b60f4eae3a0c4 (patch)
tree4831e391aa10feb4a6020b566e1a05130abc43ba /apps/tasks/ajax
parent19d81068f62cf38f03422a0f7bc50b309351dc5f (diff)
downloadnextcloud-server-947d2e5705ed606469d99ec4115b60f4eae3a0c4.tar.gz
nextcloud-server-947d2e5705ed606469d99ec4115b60f4eae3a0c4.zip
Tasks: Mark task as complete when checking the checkbox
Diffstat (limited to 'apps/tasks/ajax')
-rw-r--r--apps/tasks/ajax/complete.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/tasks/ajax/complete.php b/apps/tasks/ajax/complete.php
new file mode 100644
index 00000000000..22c65c0bc83
--- /dev/null
+++ b/apps/tasks/ajax/complete.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+// Init owncloud
+require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('tasks');
+
+$id = $_POST['id'];
+$checked = $_POST['checked'];
+$vcalendar = OC_Calendar_App::getVCalendar( $id );
+
+$vtodo = $vcalendar->VTODO;
+OC_Task_App::setComplete($vtodo, $checked ? '100' : '0', null);
+OC_Calendar_Object::edit($id, $vcalendar->serialize());
+
+$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$task_info = OC_Task_App::arrayForJSON($id, $vtodo, $user_timezone);
+OC_JSON::success(array('data' => $task_info));