src/web/handlers_iuse.py \
src/web/handlers_mirrors.py \
src/web/handlers_nopaste.py \
- src/web/handlers_talk.py \
src/web/location.py \
src/web/people.py \
- src/web/talk.py \
src/web/ui_modules.py
webdir = $(backenddir)/web
templates_modulesdir = $(templatesdir)/modules
+templates_people_DATA = \
+ src/templates/people/base.html \
+ src/templates/people/index.html \
+ src/templates/people/registrations.html \
+ src/templates/people/search.html \
+ src/templates/people/user.html \
+ src/templates/people/users.html
+
+templates_peopledir = $(templatesdir)/people
+
+templates_people_modules_DATA = \
+ src/templates/people/modules/accounts-list.html \
+ src/templates/people/modules/cdr.html \
+ src/templates/people/modules/channels.html \
+ src/templates/people/modules/registrations.html
+
+templates_people_modulesdir = $(templates_peopledir)/modules
+
templates_static_DATA = \
src/templates/static/features.html \
src/templates/static/get-involved.html \
templates_staticdir = $(templatesdir)/static
-templates_talk_DATA = \
- src/templates/talk/base.html \
- src/templates/talk/index.html \
- src/templates/talk/registrations.html \
- src/templates/talk/search.html \
- src/templates/talk/user.html \
- src/templates/talk/users.html
-
-templates_talkdir = $(templatesdir)/talk
-
-templates_talk_modules_DATA = \
- src/templates/talk/modules/accounts-list.html \
- src/templates/talk/modules/cdr.html \
- src/templates/talk/modules/channels.html \
- src/templates/talk/modules/registrations.html
-
-templates_talk_modulesdir = $(templates_talkdir)/modules
-
# ------------------------------------------------------------------------------
SCSS_FILES = \
{% extends "../base.html" %}
-{% block subtitle %}{{ _("Talk") }}{% end block %}
+{% block subtitle %}{{ _("People") }}{% end block %}
{% block menu %}
{% if current_user %}
from . import download
from . import location
from . import people
-from . import talk
from . import ui_modules
class Application(tornado.web.Application):
"Map" : ui_modules.MapModule,
# Talk
- "TalkAccountsList" : talk.AccountsListModule,
- "TalkCDR" : talk.CDRModule,
- "TalkChannels" : talk.ChannelsModule,
- "TalkRegistrations" : talk.RegistrationsModule,
+ "TalkAccountsList" : people.AccountsListModule,
+ "TalkCDR" : people.CDRModule,
+ "TalkChannels" : people.ChannelsModule,
+ "TalkRegistrations" : people.RegistrationsModule,
# Old modules
"LanguageName" : ui_modules.LanguageNameModule,
# talk.ipfire.org
self.add_handlers(r"talk(\.dev)?\.ipfire\.org", [
- (r"/", talk.IndexHandler),
- (r"/search", talk.SearchHandler),
- (r"/users", talk.UsersHandler),
- (r"/users/(\w+)", talk.UserHandler),
- (r"/users/(\w+)/registrations", talk.RegistrationsHandler),
- (r"/conferences", TalkConferencesHandler),
- (r"/diagnosis", TalkDiagnosisHandler),
- (r"/hangup/(.*)", TalkHangupChannelHandler),
- (r"/phonebook/(\w+)", TalkPhonebookAccountHandler),
- (r"/phonebook", TalkPhonebookHandler),
- (r"/profile", TalkProfileHandler),
- ] + authentication_handlers)
+ (r"/", tornado.web.RedirectHandler, { "url" : "https://people.ipfire.org/" }),
+ ])
# people.ipfire.org
self.add_handlers(r"people(\.dev)?\.ipfire\.org", [
+ (r"/", people.IndexHandler),
+ (r"/search", people.SearchHandler),
+ (r"/users", people.UsersHandler),
+ (r"/users/(\w+)", people.UserHandler),
(r"/users/(\w+)\.jpg", people.AvatarHandler),
- ])
+ (r"/users/(\w+)/registrations", people.RegistrationsHandler),
+ ] + authentication_handlers)
# ipfire.org
self.add_handlers(r"ipfire\.org", [
+++ /dev/null
-#!/usr/bin/python
-
-import tornado.web
-
-from .handlers_base import *
-
-class TalkIndexHandler(BaseHandler):
- @tornado.web.authenticated
- def get(self):
- self.render("talk/index.html")
-
-
-class TalkPhonebookHandler(BaseHandler):
- @tornado.web.authenticated
- def get(self):
- phonebook = self.talk.get_phonebook(self.current_user)
-
- self.render("talk/phonebook.html", phonebook=phonebook)
-
-
-class TalkPhonebookAccountHandler(BaseHandler):
- @tornado.web.authenticated
- def get(self, uid):
- account = self.accounts.find(uid)
- if not account:
- raise tornado.web.HTTPError(404, "Account not found: %s" % uid)
-
- self.render("talk/phonebook-contact.html", account=account)
-
-
-class TalkDiagnosisHandler(BaseHandler):
- @tornado.web.authenticated
- def get(self):
- # Access only allowed for admins
- if not self.current_user.is_admin():
- raise tornado.web.HTTPError(403)
-
- return self.render("talk/diagnosis.html")
-
-
-class TalkHangupChannelHandler(BaseHandler):
- def _get_channel(self, channel_id):
- account = None if self.current_user.is_admin() else self.current_user
-
- channel = self.talk.get_channel(channel_id, account=account)
- if not channel:
- raise tornado.web.HTTPError(404)
-
- return channel
-
- @tornado.web.authenticated
- def get(self, channel_id):
- channel = self._get_channel(channel_id)
-
- self.render("talk/confirm-hangup.html", channel=channel)
-
- @tornado.web.authenticated
- def post(self, channel_id):
- channel = self._get_channel(channel_id)
-
- # Hangup
- channel.hangup()
-
- self.redirect("/")
-
-
-class TalkConferencesHandler(BaseHandler):
- @tornado.web.authenticated
- def get(self):
- return self.render("talk/conferences.html",
- conferences=self.talk.conferences)
-
-
-class TalkProfileHandler(BaseHandler):
- @tornado.web.authenticated
- def get(self):
- return self.redirect("/phonebook/%s" % self.current_user.uid)
import tornado.web
from . import handlers_base as base
+from . import ui_modules
+
+class IndexHandler(base.BaseHandler):
+ @tornado.web.authenticated
+ def get(self):
+ self.render("people/index.html")
+
class AvatarHandler(base.BaseHandler):
def get(self, uid):
# Deliver payload
self.finish(avatar)
+
+
+class RegistrationsHandler(base.BaseHandler):
+ @tornado.web.authenticated
+ def get(self, uid):
+ # Get own account
+ if self.current_user.uid == uid:
+ account = self.current_user
+
+ # Admins can access all other users, too
+ elif self.current_user.is_admin():
+ account = self.backend.accounts.get_by_uid(uid)
+ if not account:
+ raise tornado.web.HTTPError(404, "Could not find account %s" % uid)
+
+ # Otherwise, no access is permitted
+ else:
+ raise tornado.web.HTTPError(403)
+
+ self.render("people/registrations.html", account=account)
+
+
+class SearchHandler(base.BaseHandler):
+ @tornado.web.authenticated
+ def get(self):
+ q = self.get_argument("q")
+
+ # Perform the search
+ accounts = self.backend.talk.search(q)
+
+ # Redirect when only one result was found
+ if len(accounts) == 1:
+ self.redirect("/users/%s" % accounts[0].uid)
+ return
+
+ self.render("people/search.html", q=q, accounts=accounts)
+
+
+class UsersHandler(base.BaseHandler):
+ @tornado.web.authenticated
+ def get(self):
+ self.render("people/users.html")
+
+
+class UserHandler(base.BaseHandler):
+ @tornado.web.authenticated
+ def get(self, uid):
+ account = self.backend.accounts.get_by_uid(uid)
+ if not account:
+ raise tornado.web.HTTPError(404, "Could not find account %s" % uid)
+
+ self.render("people/user.html", account=account)
+
+
+class AccountsListModule(ui_modules.UIModule):
+ def render(self, accounts=None):
+ if accounts is None:
+ accounts = self.backend.talk.accounts
+
+ return self.render_string("people/modules/accounts-list.html", accounts=accounts)
+
+
+class CDRModule(ui_modules.UIModule):
+ def render(self, account, limit=None):
+ cdr = account.get_cdr(limit=limit)
+
+ return self.render_string("people/modules/cdr.html", account=account, cdr=cdr)
+
+
+class ChannelsModule(ui_modules.UIModule):
+ def render(self, account):
+ channels = self.backend.talk.freeswitch.get_sip_channels(account)
+
+ return self.render_string("people/modules/channels.html", account=account, channels=channels)
+
+
+class RegistrationsModule(ui_modules.UIModule):
+ def render(self, account):
+ return self.render_string("people/modules/registrations.html", account=account)
+++ /dev/null
-#!/usr/bin/python
-
-import tornado.web
-
-from . import handlers_base as base
-from . import ui_modules
-
-class IndexHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self):
- self.render("talk/index.html")
-
-
-class RegistrationsHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self, uid):
- # Get own account
- if self.current_user.uid == uid:
- account = self.current_user
-
- # Admins can access all other users, too
- elif self.current_user.is_admin():
- account = self.backend.accounts.get_by_uid(uid)
- if not account:
- raise tornado.web.HTTPError(404, "Could not find account %s" % uid)
-
- # Otherwise, no access is permitted
- else:
- raise tornado.web.HTTPError(403)
-
- self.render("talk/registrations.html", account=account)
-
-
-class SearchHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self):
- q = self.get_argument("q")
-
- # Perform the search
- accounts = self.backend.talk.search(q)
-
- # Redirect when only one result was found
- if len(accounts) == 1:
- self.redirect("/users/%s" % accounts[0].uid)
- return
-
- self.render("talk/search.html", q=q, accounts=accounts)
-
-
-class UsersHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self):
- self.render("talk/users.html")
-
-
-class UserHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self, uid):
- account = self.backend.accounts.get_by_uid(uid)
- if not account:
- raise tornado.web.HTTPError(404, "Could not find account %s" % uid)
-
- self.render("talk/user.html", account=account)
-
-
-class AccountsListModule(ui_modules.UIModule):
- def render(self, accounts=None):
- if accounts is None:
- accounts = self.backend.talk.accounts
-
- return self.render_string("talk/modules/accounts-list.html", accounts=accounts)
-
-
-class CDRModule(ui_modules.UIModule):
- def render(self, account, limit=None):
- cdr = account.get_cdr(limit=limit)
-
- return self.render_string("talk/modules/cdr.html", account=account, cdr=cdr)
-
-
-class ChannelsModule(ui_modules.UIModule):
- def render(self, account):
- channels = self.backend.talk.freeswitch.get_sip_channels(account)
-
- return self.render_string("talk/modules/channels.html", account=account, channels=channels)
-
-
-class RegistrationsModule(ui_modules.UIModule):
- def render(self, account):
- return self.render_string("talk/modules/registrations.html", account=account)