]>
Commit | Line | Data |
---|---|---|
66862195 MT |
1 | #!/usr/bin/python |
2 | ||
3 | import tornado.web | |
4 | ||
11347e46 | 5 | from .handlers_base import * |
66862195 MT |
6 | |
7 | class TalkIndexHandler(BaseHandler): | |
8 | @tornado.web.authenticated | |
9 | def get(self): | |
7aee4b8d | 10 | self.render("talk/index.html") |
66862195 MT |
11 | |
12 | ||
13 | class TalkPhonebookHandler(BaseHandler): | |
14 | @tornado.web.authenticated | |
15 | def get(self): | |
16 | phonebook = self.talk.get_phonebook(self.current_user) | |
17 | ||
18 | self.render("talk/phonebook.html", phonebook=phonebook) | |
19 | ||
20 | ||
21 | class TalkPhonebookAccountHandler(BaseHandler): | |
22 | @tornado.web.authenticated | |
23 | def get(self, uid): | |
24 | account = self.accounts.find(uid) | |
25 | if not account: | |
26 | raise tornado.web.HTTPError(404, "Account not found: %s" % uid) | |
27 | ||
77431b9c | 28 | self.render("talk/phonebook-contact.html", account=account) |
66862195 MT |
29 | |
30 | ||
31 | class TalkDiagnosisHandler(BaseHandler): | |
32 | @tornado.web.authenticated | |
33 | def get(self): | |
a69e87a1 MT |
34 | # Access only allowed for admins |
35 | if not self.current_user.is_admin(): | |
36 | raise tornado.web.HTTPError(403) | |
78439bec | 37 | |
66862195 MT |
38 | return self.render("talk/diagnosis.html") |
39 | ||
40 | ||
40818cf2 | 41 | class TalkHangupChannelHandler(BaseHandler): |
a69e87a1 MT |
42 | def _get_channel(self, channel_id): |
43 | account = None if self.current_user.is_admin() else self.current_user | |
40818cf2 | 44 | |
a69e87a1 MT |
45 | channel = self.talk.get_channel(channel_id, account=account) |
46 | if not channel: | |
47 | raise tornado.web.HTTPError(404) | |
40818cf2 | 48 | |
a69e87a1 | 49 | return channel |
40818cf2 | 50 | |
a69e87a1 MT |
51 | @tornado.web.authenticated |
52 | def get(self, channel_id): | |
53 | channel = self._get_channel(channel_id) | |
40818cf2 | 54 | |
a69e87a1 | 55 | self.render("talk/confirm-hangup.html", channel=channel) |
40818cf2 | 56 | |
a69e87a1 MT |
57 | @tornado.web.authenticated |
58 | def post(self, channel_id): | |
59 | channel = self._get_channel(channel_id) | |
40818cf2 | 60 | |
a69e87a1 MT |
61 | # Hangup |
62 | channel.hangup() | |
40818cf2 | 63 | |
a69e87a1 | 64 | self.redirect("/") |
40818cf2 MT |
65 | |
66 | ||
66862195 MT |
67 | class TalkConferencesHandler(BaseHandler): |
68 | @tornado.web.authenticated | |
69 | def get(self): | |
70 | return self.render("talk/conferences.html", | |
71 | conferences=self.talk.conferences) | |
72 | ||
73 | ||
66862195 MT |
74 | class TalkProfileHandler(BaseHandler): |
75 | @tornado.web.authenticated | |
76 | def get(self): | |
77 | return self.redirect("/phonebook/%s" % self.current_user.uid) |