diff options
-rw-r--r-- | appinfo/routes.php | 10 | ||||
-rw-r--r-- | js/app/controllers/detailscontroller.coffee | 3 | ||||
-rw-r--r-- | js/app/services/businesslayer/tasksbusinesslayer.coffee | 3 | ||||
-rw-r--r-- | js/app/services/persistence.coffee | 10 | ||||
-rw-r--r-- | js/public/app.js | 20 | ||||
-rw-r--r-- | lib/controller/taskscontroller.php | 37 | ||||
-rw-r--r-- | templates/part.details.php | 1 |
7 files changed, 81 insertions, 3 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 5d65f23d..c0523484 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -243,6 +243,16 @@ $this->create('task_reminder', '/tasks/{taskID}/reminder') } ); +$this->create('task_comment', '/tasks/{taskID}/comment') + ->post() + ->action( + function($params){ + session_write_close(); + $dispatcher = new Dispatcher($params); + $dispatcher->dispatch('TasksController', 'addComment'); + } + ); + /* * Settings */ diff --git a/js/app/controllers/detailscontroller.coffee b/js/app/controllers/detailscontroller.coffee index 82c336a3..95743e56 100644 --- a/js/app/controllers/detailscontroller.coffee +++ b/js/app/controllers/detailscontroller.coffee @@ -288,6 +288,9 @@ $timeout, $routeParams, SettingsModel) -> @_$scope.setReminderDuration = (taskID) -> _tasksbusinesslayer.setReminder(_$scope.route.taskID) + @_$scope.addComment = () -> + _tasksbusinesslayer.addComment(_$scope.route.taskID,'test') + return new DetailsController($scope, $window, TasksModel, TasksBusinessLayer, $route, $location, $timeout, $routeParams, SettingsModel) diff --git a/js/app/services/businesslayer/tasksbusinesslayer.coffee b/js/app/services/businesslayer/tasksbusinesslayer.coffee index 70fa748f..70f849d3 100644 --- a/js/app/services/businesslayer/tasksbusinesslayer.coffee +++ b/js/app/services/businesslayer/tasksbusinesslayer.coffee @@ -332,6 +332,9 @@ angular.module('Tasks').factory 'TasksBusinessLayer', setShowHidden: (showHidden) -> @_persistence.setShowHidden(showHidden) + addComment: (taskID, comment) -> + @_persistence.addComment(taskID, comment) + return new TasksBusinessLayer(TasksModel, Persistence) diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee index 44e14484..39f9df66 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -326,6 +326,16 @@ angular.module('Tasks').factory 'Persistence', @_request.post '/apps/tasks_enhanced/settings/showhidden/{showHidden}', params + addComment: (taskID, comment) -> + params = + routeParams: + taskID: taskID + data: + comment: comment + + @_request.post '/apps/tasks_enhanced/tasks/{taskID}/comment', + params + return new Persistence(Request, Loading, $rootScope) ]
\ No newline at end of file diff --git a/js/public/app.js b/js/public/app.js index 43895393..61579472 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -663,6 +663,9 @@ this._$scope.setReminderDuration = function(taskID) { return _tasksbusinesslayer.setReminder(_$scope.route.taskID); }; + this._$scope.addComment = function() { + return _tasksbusinesslayer.addComment(_$scope.route.taskID, 'test'); + }; } return DetailsController; @@ -1627,6 +1630,10 @@ return this._persistence.setShowHidden(showHidden); }; + TasksBusinessLayer.prototype.addComment = function(taskID, comment) { + return this._persistence.addComment(taskID, comment); + }; + return TasksBusinessLayer; })(); @@ -2582,6 +2589,19 @@ return this._request.post('/apps/tasks_enhanced/settings/showhidden/{showHidden}', params); }; + Persistence.prototype.addComment = function(taskID, comment) { + var params; + params = { + routeParams: { + taskID: taskID + }, + data: { + comment: comment + } + }; + return this._request.post('/apps/tasks_enhanced/tasks/{taskID}/comment', params); + }; + return Persistence; })(); diff --git a/lib/controller/taskscontroller.php b/lib/controller/taskscontroller.php index 5ac072f0..ca78f5f8 100644 --- a/lib/controller/taskscontroller.php +++ b/lib/controller/taskscontroller.php @@ -149,7 +149,7 @@ class TasksController extends Controller { /** * @NoAdminRequired */ - public function percentComplete( $percentCompete ){ + public function percentComplete(){ $response = new JSONResponse(); try{ $percent_complete = $this->params('complete'); @@ -447,7 +447,7 @@ class TasksController extends Controller { /** * @NoAdminRequired */ - public function setCategories($taskId, $categories){ + public function setCategories(){ $taskId = $this->params('taskID'); $categories = $this->params('categories'); $response = new JSONResponse(); @@ -465,7 +465,7 @@ class TasksController extends Controller { /** * @NoAdminRequired */ - public function setLocation($taskId, $location){ + public function setLocation(){ $taskId = $this->params('taskID'); $location = $this->params('location'); $response = new JSONResponse(); @@ -480,5 +480,36 @@ class TasksController extends Controller { return $response; } + /** + * @NoAdminRequired + */ + public function addComment(){ + $taskId = $this->params('taskID'); + $comment = $this->params('comment'); + $response = new JSONResponse(); + try { + $vcalendar = \OC_Calendar_App::getVCalendar($taskId); + $vtodo = $vcalendar->VTODO; + // $vtodo->setString('COMMENT', 'haha'); + // $vtodo->setString('COMMENT', 'haha2'); + // $vtodo->setString('COMMENT', 'haha3'); + // $vtodo->offsetSet('USERID','offsetSet'); + // $vtodo->addProperty('COMMENT','haha4'); + $tmp = $vtodo->addProperty('COMMENT','haha6'); + $tmp->offsetSet('USERID','offsetSet'); + // unset($vtodo->COMMENT); + \OC_Calendar_Object::edit($taskId, $vcalendar->serialize()); + + $test = $vtodo->getAsArray('COMMENT'); + $test = $vtodo->COMMENT['USERID']->value; + $response->setData($test); + + } catch(\Exception $e) { + // throw new BusinessLayerException($e->getMessage()); + } + + return $response; + } + } diff --git a/templates/part.details.php b/templates/part.details.php index ce0a5534..5797d1cb 100644 --- a/templates/part.details.php +++ b/templates/part.details.php @@ -111,5 +111,6 @@ <a class="detail-close" ng-click="closeDetails()" stop-event="click"> <span class="icon detail-close"></span> </a> + <a ng-click="addComment()">Comment</a> </div> </div>
\ No newline at end of file |