@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function create($title, $stackId, $type, $order, $owner) { |
54 | 54 | $this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT); |
55 | - if($this->boardService->isArchived($this->stackMapper, $stackId)) { |
|
55 | + if ($this->boardService->isArchived($this->stackMapper, $stackId)) { |
|
56 | 56 | throw new StatusException('Operation not allowed. This board is archived.'); |
57 | 57 | } |
58 | 58 | $card = new Card(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | public function delete($id) { |
69 | 69 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
70 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
70 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
71 | 71 | throw new StatusException('Operation not allowed. This board is archived.'); |
72 | 72 | } |
73 | 73 | return $this->cardMapper->delete($this->cardMapper->find($id)); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public function update($id, $title, $stackId, $type, $order, $description, $owner, $duedate) { |
77 | 77 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
78 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
78 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
79 | 79 | throw new StatusException('Operation not allowed. This board is archived.'); |
80 | 80 | } |
81 | 81 | $card = $this->cardMapper->find($id); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function rename($id, $title) { |
96 | 96 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
97 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
97 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
98 | 98 | throw new StatusException('Operation not allowed. This board is archived.'); |
99 | 99 | } |
100 | 100 | $card = $this->cardMapper->find($id); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function reorder($id, $stackId, $order) { |
109 | 109 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
110 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
110 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
111 | 111 | throw new StatusException('Operation not allowed. This board is archived.'); |
112 | 112 | } |
113 | 113 | $cards = $this->cardMapper->findAll($stackId); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | public function archive($id) { |
140 | 140 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
141 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
141 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
142 | 142 | throw new StatusException('Operation not allowed. This board is archived.'); |
143 | 143 | } |
144 | 144 | $card = $this->cardMapper->find($id); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | public function unarchive($id) { |
150 | 150 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
151 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
151 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
152 | 152 | throw new StatusException('Operation not allowed. This board is archived.'); |
153 | 153 | } |
154 | 154 | $card = $this->cardMapper->find($id); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | public function assignLabel($cardId, $labelId) { |
160 | 160 | $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
161 | - if($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
161 | + if ($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
162 | 162 | throw new StatusException('Operation not allowed. This board is archived.'); |
163 | 163 | } |
164 | 164 | $card = $this->cardMapper->find($cardId); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | public function removeLabel($cardId, $labelId) { |
172 | 172 | $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
173 | - if($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
173 | + if ($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
174 | 174 | throw new StatusException('Operation not allowed. This board is archived.'); |
175 | 175 | } |
176 | 176 | $card = $this->cardMapper->find($cardId); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | Util::addScript('deck', 'vendor/markdown-it-link-target/dist/markdown-it-link-target.min'); |
39 | 39 | Util::addScript('deck', 'vendor/jquery-timepicker/jquery.ui.timepicker'); |
40 | 40 | |
41 | -if(!\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
41 | +if (!\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
42 | 42 | Util::addScript('deck', 'public/app'); |
43 | 43 | } else { |
44 | 44 | // Load seperate JS files when debug mode is enabled |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | 'filters' => ['boardFilterAcl', 'cardFilter', 'cardSearchFilter', 'iconWhiteFilter', 'lightenColorFilter', 'orderObjectBy', 'dateFilters', 'textColorFilter'], |
50 | 50 | 'service' => ['ApiService', 'BoardService', 'CardService', 'LabelService', 'StackService', 'StatusService'], |
51 | 51 | ]; |
52 | - foreach($js as $folder=>$files) { |
|
52 | + foreach ($js as $folder=>$files) { |
|
53 | 53 | foreach ($files as $file) { |
54 | - Util::addScript('deck', $folder.'/'.$file); |
|
54 | + Util::addScript('deck', $folder . '/' . $file); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -38,109 +38,109 @@ |
||
38 | 38 | */ |
39 | 39 | class BoardApiController extends ApiController { |
40 | 40 | |
41 | - private $service; |
|
42 | - private $userInfo; |
|
43 | - |
|
44 | - /** |
|
45 | - * @param string $appName |
|
46 | - * @param IRequest $request |
|
47 | - * @param IUserManager $userManager |
|
48 | - * @param IGroupManager $groupManager |
|
49 | - * @param BoardService $service |
|
50 | - * @param $userId |
|
51 | - */ |
|
52 | - public function __construct($appName, IRequest $request, IUserManager $userManager, IGroupManager $groupManager, BoardService $service, $userId) { |
|
53 | - parent::__construct($appName, $request); |
|
54 | - $this->service = $service; |
|
55 | - $this->userId = $userId; |
|
56 | - $this->userManager = $userManager; |
|
57 | - $this->groupManager = $groupManager; |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * @NoAdminRequired |
|
62 | - * @CORS |
|
63 | - * @NoCSRFRequired |
|
64 | - * |
|
65 | - * Return all of the boards that the current user has access to. |
|
66 | - */ |
|
67 | - public function index() { |
|
68 | - $boards = $this->service->findAll($this->getUserInfo()); |
|
69 | - |
|
70 | - return new DataResponse($boards); |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * @NoAdminRequired |
|
75 | - * @CORS |
|
76 | - * @NoCSRFRequired |
|
77 | - * |
|
78 | - * @params $id |
|
79 | - * |
|
80 | - * Return the board specified by $id. |
|
81 | - */ |
|
82 | - public function get($id) { |
|
83 | - $board = $this->service->find($id); |
|
84 | - |
|
85 | - // FIXME: this should probably 404 if the board has been deleted |
|
86 | - |
|
87 | - return new DataResponse($board); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @NoAdminRequired |
|
92 | - * @CORS |
|
93 | - * @NoCSRFRequired |
|
94 | - * |
|
95 | - * @params $title |
|
96 | - * @params $color |
|
97 | - * |
|
98 | - * Create a board with the specified title and color. |
|
99 | - */ |
|
100 | - public function create($title, $color) { |
|
101 | - $board = $this->service->create($title, $this->userId, $color); |
|
102 | - |
|
103 | - return new DataResponse($board); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @NoAdminRequired |
|
108 | - * @CORS |
|
109 | - * @NoCSRFRequired |
|
110 | - * |
|
111 | - * @params $id |
|
112 | - * |
|
113 | - * Delete the board specified by $id. Return the board that was deleted. |
|
114 | - */ |
|
115 | - public function delete($id) { |
|
116 | - $board = $this->service->delete($id); |
|
117 | - |
|
118 | - return new DataResponse($board); |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * @NoAdminRequired |
|
123 | - * @CORS |
|
124 | - * @NoCSRFRequired |
|
125 | - * |
|
126 | - * @params $id |
|
127 | - * |
|
128 | - * Undo the deletion of the board specified by $id. |
|
129 | - */ |
|
130 | - public function undoDelete($id) { |
|
131 | - $board = $this->service->find($id); |
|
132 | - $this->service->deleteUndo($id); |
|
133 | - |
|
134 | - return new DataResponse($board); |
|
135 | - } |
|
136 | - |
|
137 | - // this is taken from BoardController, but it's not ideal |
|
138 | - private function getUserInfo() { |
|
139 | - $groups = $this->groupManager->getUserGroupIds( |
|
41 | + private $service; |
|
42 | + private $userInfo; |
|
43 | + |
|
44 | + /** |
|
45 | + * @param string $appName |
|
46 | + * @param IRequest $request |
|
47 | + * @param IUserManager $userManager |
|
48 | + * @param IGroupManager $groupManager |
|
49 | + * @param BoardService $service |
|
50 | + * @param $userId |
|
51 | + */ |
|
52 | + public function __construct($appName, IRequest $request, IUserManager $userManager, IGroupManager $groupManager, BoardService $service, $userId) { |
|
53 | + parent::__construct($appName, $request); |
|
54 | + $this->service = $service; |
|
55 | + $this->userId = $userId; |
|
56 | + $this->userManager = $userManager; |
|
57 | + $this->groupManager = $groupManager; |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * @NoAdminRequired |
|
62 | + * @CORS |
|
63 | + * @NoCSRFRequired |
|
64 | + * |
|
65 | + * Return all of the boards that the current user has access to. |
|
66 | + */ |
|
67 | + public function index() { |
|
68 | + $boards = $this->service->findAll($this->getUserInfo()); |
|
69 | + |
|
70 | + return new DataResponse($boards); |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * @NoAdminRequired |
|
75 | + * @CORS |
|
76 | + * @NoCSRFRequired |
|
77 | + * |
|
78 | + * @params $id |
|
79 | + * |
|
80 | + * Return the board specified by $id. |
|
81 | + */ |
|
82 | + public function get($id) { |
|
83 | + $board = $this->service->find($id); |
|
84 | + |
|
85 | + // FIXME: this should probably 404 if the board has been deleted |
|
86 | + |
|
87 | + return new DataResponse($board); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @NoAdminRequired |
|
92 | + * @CORS |
|
93 | + * @NoCSRFRequired |
|
94 | + * |
|
95 | + * @params $title |
|
96 | + * @params $color |
|
97 | + * |
|
98 | + * Create a board with the specified title and color. |
|
99 | + */ |
|
100 | + public function create($title, $color) { |
|
101 | + $board = $this->service->create($title, $this->userId, $color); |
|
102 | + |
|
103 | + return new DataResponse($board); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @NoAdminRequired |
|
108 | + * @CORS |
|
109 | + * @NoCSRFRequired |
|
110 | + * |
|
111 | + * @params $id |
|
112 | + * |
|
113 | + * Delete the board specified by $id. Return the board that was deleted. |
|
114 | + */ |
|
115 | + public function delete($id) { |
|
116 | + $board = $this->service->delete($id); |
|
117 | + |
|
118 | + return new DataResponse($board); |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * @NoAdminRequired |
|
123 | + * @CORS |
|
124 | + * @NoCSRFRequired |
|
125 | + * |
|
126 | + * @params $id |
|
127 | + * |
|
128 | + * Undo the deletion of the board specified by $id. |
|
129 | + */ |
|
130 | + public function undoDelete($id) { |
|
131 | + $board = $this->service->find($id); |
|
132 | + $this->service->deleteUndo($id); |
|
133 | + |
|
134 | + return new DataResponse($board); |
|
135 | + } |
|
136 | + |
|
137 | + // this is taken from BoardController, but it's not ideal |
|
138 | + private function getUserInfo() { |
|
139 | + $groups = $this->groupManager->getUserGroupIds( |
|
140 | 140 | $this->userManager->get($this->userId) |
141 | 141 | ); |
142 | - return ['user' => $this->userId, |
|
143 | - 'groups' => $groups]; |
|
144 | - } |
|
142 | + return ['user' => $this->userId, |
|
143 | + 'groups' => $groups]; |
|
144 | + } |
|
145 | 145 | |
146 | 146 | } |
@@ -36,62 +36,62 @@ |
||
36 | 36 | */ |
37 | 37 | class StackApiController extends ApiController { |
38 | 38 | |
39 | - private $service; |
|
40 | - private $userInfo; |
|
39 | + private $service; |
|
40 | + private $userInfo; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param string $appName |
|
44 | - * @param IRequest $request |
|
45 | - * @param StackService $service |
|
46 | - */ |
|
47 | - public function __construct($appName, IRequest $request, StackService $service) { |
|
48 | - parent::__construct($appName, $request); |
|
49 | - $this->service = $service; |
|
50 | - } |
|
42 | + /** |
|
43 | + * @param string $appName |
|
44 | + * @param IRequest $request |
|
45 | + * @param StackService $service |
|
46 | + */ |
|
47 | + public function __construct($appName, IRequest $request, StackService $service) { |
|
48 | + parent::__construct($appName, $request); |
|
49 | + $this->service = $service; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @NoAdminRequired |
|
54 | - * @CORS |
|
55 | - * @NoCSRFRequired |
|
56 | - * |
|
57 | - * Return all of the stacks in the specified board. |
|
58 | - */ |
|
59 | - public function index($boardId) { |
|
60 | - $stacks = $this->service->findAll($boardId); |
|
52 | + /** |
|
53 | + * @NoAdminRequired |
|
54 | + * @CORS |
|
55 | + * @NoCSRFRequired |
|
56 | + * |
|
57 | + * Return all of the stacks in the specified board. |
|
58 | + */ |
|
59 | + public function index($boardId) { |
|
60 | + $stacks = $this->service->findAll($boardId); |
|
61 | 61 | |
62 | - return new DataResponse($stacks); |
|
63 | - } |
|
62 | + return new DataResponse($stacks); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @NoAdminRequired |
|
67 | - * @CORS |
|
68 | - * @NoCSRFRequired |
|
69 | - * |
|
70 | - * @params $title |
|
71 | - * @params $order |
|
72 | - * |
|
73 | - * Create a stack with the specified title and order. |
|
74 | - */ |
|
75 | - public function create($boardId, $title, $order) { |
|
76 | - // this throws a StatusException that needs to be caught and handled |
|
77 | - $stack = $this->service->create($title, $boardId, $order); |
|
65 | + /** |
|
66 | + * @NoAdminRequired |
|
67 | + * @CORS |
|
68 | + * @NoCSRFRequired |
|
69 | + * |
|
70 | + * @params $title |
|
71 | + * @params $order |
|
72 | + * |
|
73 | + * Create a stack with the specified title and order. |
|
74 | + */ |
|
75 | + public function create($boardId, $title, $order) { |
|
76 | + // this throws a StatusException that needs to be caught and handled |
|
77 | + $stack = $this->service->create($title, $boardId, $order); |
|
78 | 78 | |
79 | - return new DataResponse($stack); |
|
80 | - } |
|
79 | + return new DataResponse($stack); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @NoAdminRequired |
|
84 | - * @CORS |
|
85 | - * @NoCSRFRequired |
|
86 | - * |
|
87 | - * @params $id |
|
88 | - * |
|
89 | - * Delete the stack specified by $id. Return the board that was deleted. |
|
90 | - */ |
|
91 | - public function delete($boardId, $id) { |
|
92 | - $stack = $this->service->delete($id); |
|
82 | + /** |
|
83 | + * @NoAdminRequired |
|
84 | + * @CORS |
|
85 | + * @NoCSRFRequired |
|
86 | + * |
|
87 | + * @params $id |
|
88 | + * |
|
89 | + * Delete the stack specified by $id. Return the board that was deleted. |
|
90 | + */ |
|
91 | + public function delete($boardId, $id) { |
|
92 | + $stack = $this->service->delete($id); |
|
93 | 93 | |
94 | - return new DataResponse($stack); |
|
95 | - } |
|
94 | + return new DataResponse($stack); |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -62,18 +62,18 @@ |
||
62 | 62 | ['name' => 'label#update', 'url' => '/labels/{labelId}', 'verb' => 'PUT'], |
63 | 63 | ['name' => 'label#delete', 'url' => '/labels/{labelId}', 'verb' => 'DELETE'], |
64 | 64 | |
65 | - // api |
|
66 | - ['name' => 'board_api#index', 'url' => '/api/v1.0/boards', 'verb' => 'GET'], |
|
67 | - ['name' => 'board_api#get', 'url' => '/api/v1.0/board/{id}', 'verb' => 'GET'], |
|
68 | - ['name' => 'board_api#create', 'url' => '/api/v1.0/board', 'verb' => 'POST'], |
|
69 | - ['name' => 'board_api#delete', 'url' => '/api/v1.0/board/{id}', 'verb' => 'DELETE'], |
|
70 | - ['name' => 'board_api#undo_delete', 'url' => '/api/v1.0/board/{id}/undo_delete', 'verb' => 'POST'], |
|
65 | + // api |
|
66 | + ['name' => 'board_api#index', 'url' => '/api/v1.0/boards', 'verb' => 'GET'], |
|
67 | + ['name' => 'board_api#get', 'url' => '/api/v1.0/board/{id}', 'verb' => 'GET'], |
|
68 | + ['name' => 'board_api#create', 'url' => '/api/v1.0/board', 'verb' => 'POST'], |
|
69 | + ['name' => 'board_api#delete', 'url' => '/api/v1.0/board/{id}', 'verb' => 'DELETE'], |
|
70 | + ['name' => 'board_api#undo_delete', 'url' => '/api/v1.0/board/{id}/undo_delete', 'verb' => 'POST'], |
|
71 | 71 | |
72 | - ['name' => 'stack_api#index', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'GET'], |
|
73 | - ['name' => 'stack_api#create', 'url' => '/api/v1.0/board/{boardId}/stack', 'verb' => 'POST'], |
|
74 | - ['name' => 'stack_api#delete', 'url' => '/api/v1.0/board/{boardId}/stack/{id}', 'verb' => 'DELETE'], |
|
72 | + ['name' => 'stack_api#index', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'GET'], |
|
73 | + ['name' => 'stack_api#create', 'url' => '/api/v1.0/board/{boardId}/stack', 'verb' => 'POST'], |
|
74 | + ['name' => 'stack_api#delete', 'url' => '/api/v1.0/board/{boardId}/stack/{id}', 'verb' => 'DELETE'], |
|
75 | 75 | |
76 | - ['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}', |
|
77 | - 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']], |
|
76 | + ['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}', |
|
77 | + 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']], |
|
78 | 78 | ] |
79 | 79 | ]; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | public function getDuedate() { |
62 | - if($this->duedate === null) |
|
62 | + if ($this->duedate === null) |
|
63 | 63 | return null; |
64 | 64 | $dt = new DateTime($this->duedate); |
65 | 65 | return $dt->format('c'); |
@@ -71,16 +71,16 @@ discard block |
||
71 | 71 | $due = strtotime($this->duedate); |
72 | 72 | |
73 | 73 | $today = new DateTime(); |
74 | - $today->setTime( 0, 0, 0 ); |
|
74 | + $today->setTime(0, 0, 0); |
|
75 | 75 | |
76 | 76 | $match_date = new DateTime($this->duedate); |
77 | 77 | |
78 | - $match_date->setTime( 0, 0, 0 ); |
|
78 | + $match_date->setTime(0, 0, 0); |
|
79 | 79 | |
80 | - $diff = $today->diff( $match_date ); |
|
81 | - $diffDays = (integer)$diff->format( "%R%a" ); // Extract days count in interval |
|
80 | + $diff = $today->diff($match_date); |
|
81 | + $diffDays = (integer) $diff->format("%R%a"); // Extract days count in interval |
|
82 | 82 | |
83 | - if($due !== false) { |
|
83 | + if ($due !== false) { |
|
84 | 84 | if ($diffDays === 1) { |
85 | 85 | $json['overdue'] = self::DUEDATE_NEXT; |
86 | 86 | } |
@@ -59,8 +59,9 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | public function getDuedate() { |
62 | - if($this->duedate === null) |
|
63 | - return null; |
|
62 | + if($this->duedate === null) { |
|
63 | + return null; |
|
64 | + } |
|
64 | 65 | $dt = new DateTime($this->duedate); |
65 | 66 | return $dt->format('c'); |
66 | 67 | } |