diff options
author | Maxime Corteel <mcorteel@gmail.com> | 2016-04-17 02:00:54 +0300 |
---|---|---|
committer | Maxime Corteel <mcorteel@gmail.com> | 2016-04-19 00:37:50 +0300 |
commit | d2f7bae5c60afd4aedf57a9aeefd4b1d600f7d15 (patch) | |
tree | 9fd69c3d1c337aeed405c7910f9871072864e12f /controller | |
parent | 34e8f66e6fe13027b56b3f8480dee42902f33bd7 (diff) |
Design changes
Diffstat (limited to 'controller')
-rw-r--r-- | controller/pagecontroller.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index d4a00217..f97ba91a 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -36,6 +36,7 @@ use \OCP\IURLGenerator; use OCP\Security\ISecureRandom; use \OCP\AppFramework\Http\TemplateResponse; use \OCP\AppFramework\Http\RedirectResponse; +use \OCP\AppFramework\Http\JSONResponse; use \OCP\AppFramework\Controller; $userMgr = \OC::$server->getUserManager(); @@ -162,8 +163,9 @@ class PageController extends Controller { } catch(\OCP\AppFramework\Db\DoesNotExistException $e) { $notification = null; } - if($this->hasUserAccess($poll)) return new TemplateResponse('polls', 'goto.tmpl', ['poll' => $poll, 'dates' => $dates, 'comments' => $comments, 'votes' => $votes, 'notification' => $notification, 'userId' => $this->userId, 'userMgr' => $this->manager, 'urlGenerator' => $this->urlGenerator, 'avatarManager' => $this->avatarManager]); - else { + if($this->hasUserAccess($poll)) { + return new TemplateResponse('polls', 'goto.tmpl', ['poll' => $poll, 'dates' => $dates, 'comments' => $comments, 'votes' => $votes, 'notification' => $notification, 'userId' => $this->userId, 'userMgr' => $this->manager, 'urlGenerator' => $this->urlGenerator, 'avatarManager' => $this->avatarManager]); + } else { \OCP\User::checkLoggedIn(); return new TemplateResponse('polls', 'no.acc.tmpl', []); } @@ -361,7 +363,7 @@ class PageController extends Controller { } } } else { - $userId = $userId . ' (extern)'; + $userId = $userId; } $poll = $this->eventMapper->find($pollId); if($changed === 'true') { @@ -408,7 +410,7 @@ class PageController extends Controller { $this->sendNotifications($pollId, $userId); $hash = $this->eventMapper->find($pollId)->getHash(); $url = $this->urlGenerator->linkToRoute('polls.page.goto_poll', ['hash' => $hash]); - return new RedirectResponse($url); + return new JSONResponse(array('comment' => $commentBox, 'date' => date('Y-m-d H:i:s'), 'userName' => $this->manager->get($userId)->getDisplayName())); } public function getPollsForUser() { @@ -435,8 +437,7 @@ class PageController extends Controller { foreach ($user_groups as $user_group) { if ($user_group === $grp) return true; } - } - else if (strpos($item, 'user_') === 0) { + } else if (strpos($item, 'user_') === 0) { $usr = substr($item, 5); if ($usr === \OCP\User::getUser()) return true; } |