diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-04-17 17:32:21 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-04-17 17:32:21 +0200 |
commit | 6ba30cb713b4abd0500fb692f6227284f620e74a (patch) | |
tree | 55985bae41445fa04ebc91518ddcee4e9d6b81b2 /apps/tasks/ajax/update_property.php | |
parent | 8afeb0fedbeadfee7beca9997817cb75eff6e29f (diff) | |
download | nextcloud-server-6ba30cb713b4abd0500fb692f6227284f620e74a.tar.gz nextcloud-server-6ba30cb713b4abd0500fb692f6227284f620e74a.zip |
Tasks: Clicking task summary opens input for edit
Diffstat (limited to 'apps/tasks/ajax/update_property.php')
-rw-r--r-- | apps/tasks/ajax/update_property.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/tasks/ajax/update_property.php b/apps/tasks/ajax/update_property.php new file mode 100644 index 00000000000..1916a2eb7b1 --- /dev/null +++ b/apps/tasks/ajax/update_property.php @@ -0,0 +1,36 @@ +<?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']; +$property = $_POST['type']; +$vcalendar = OC_Calendar_App::getVCalendar( $id ); + +$vtodo = $vcalendar->VTODO; +switch($property) { + case 'summary': + $summary = $_POST['summary']; + $vtodo->setString('SUMMARY', $summary); + break; + case 'complete': + $checked = $_POST['checked']; + OC_Task_App::setComplete($vtodo, $checked ? '100' : '0', null); + break; + default: + OC_JSON::error(array('data'=>array('message'=>'Unknown type'))); + exit(); +} +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)); |