src/templates/people/search.html \
src/templates/people/sip.html \
src/templates/people/user.html \
+ src/templates/people/user-base.html \
src/templates/people/user-edit.html \
src/templates/people/users.html
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav ml-auto mr-3">
<li class="nav-item">
- <a class="nav-link {% if request.path == "/users" %}active{% end %}" href="/users">
- {{ _("Users") }}
+ <a class="nav-link {% if request.path == "/users/%s" % current_user.uid %}active{% end %}" href="/users/{{ current_user.uid }}">
+ {{ _("My Profile") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.path.startswith("/users/%s/calls" % current_user.uid) %}active{% end %}" href="/users/{{ current_user.uid }}/calls">
- {{ _("Calls") }}
+ {{ _("My Calls") }}
+ </a>
+ </li>
+
+ <li class="nav-item">
+ <a class="nav-link {% if request.path == "/users" %}active{% end %}" href="/users">
+ {{ _("Users") }}
</a>
</li>
</ul>
</div>
{% end %}
{% end block %}
-
-{% block content %}
- <div class="row">
- <div class="col">
- {% block main %}{% end block %}
- </div>
-
- {% block right %}
- <div class="col-md-3 text-center">
- <img class="img-fluid rounded-circle mb-4" src="{{ current_user.avatar_url(160) }}" alt="{{ current_user }}" />
-
- <p>
- <a class="text-white" href="/users/{{ current_user.uid }}">{{ current_user.name }}</a>
- </p>
-
- <p>
- {% module SIPStatus(current_user) %}
- </p>
- </div>
- {% end block %}
- </div>
-{% end block %}
-{% extends "base.html" %}
+{% extends "user-base.html" %}
-{% block title %}{{ _("Call") }}{% end block %}
+{% block title %}{{ account }} - {{ _("Call") }}{% end block %}
{% block main %}
<div class="card">
-{% extends "base.html" %}
+{% extends "user-base.html" %}
-{% block title %}{{ _("Calls") }}{% end block %}
+{% block title %}{{ account }} - {{ _("Calls") }}{% end block %}
{% block main %}
+ <h1>{{ _("Calls") }}</h1>
+
<div class="card">
<div class="card-body">
- <h4>{{ _("Calls on %s") % locale.format_day(date) }}</h4>
-
<nav>
<ul class="pagination justify-content-center">
{% set yesterday = date - datetime.timedelta(days=1) %}
{% block title %}{{ _("Home") }}{% end block %}
-{% block main %}
- {% module Channels(current_user) %}
-
- <div class="card">
- <div class="card-body">
- <h4>{{ _("Your Recent Calls") }}</h4>
+{% block content %}
+ <section>
+ <h1>{{ _("Hello, %s!") % current_user.first_name }}</h1>
+ </section>
- {% module CDR(current_user, limit=5) %}
- </div>
- </div>
+ {% module Channels(current_user) %}
{% end block %}
-{% extends "base.html" %}
+{% extends "user-base.html" %}
-{% block title %}{{ _("Change Password for %s") % account }}{% end block %}
+{% block title %}{{ account }} - {{ _("Change Password") }}{% end block %}
{% block main %}
<div class="row justify-content-center">
<div class="col col-md-8">
- <h4 class="mb-4">{{ _("Change Password for %s") % account }}</h4>
+ <h4 class="mb-4">{{ _("Change Password") }}</h4>
<form method="POST" action="">
{% raw xsrf_form_html() %}
{% block title %}{{ _("Search Results for \"%s\"") % q }}{% end block %}
-{% block main %}
- <h3 class="mb-4">{{ _("Search Results for \"%s\"") % q }}</h3>
+{% block content %}
+ <div class="row justify-content-center">
+ <div class="col col-md-8">
+ <h1>{{ _("Search Results for \"%s\"") % q }}</h1>
- {% if accounts %}
- {% module AccountsList(accounts) %}
- {% else %}
- <p class="text-muted text-center my-5">
- {{ _("There are no results for \"%s\"") % q }}
- </p>
- {% end %}
+ {% if accounts %}
+ {% module AccountsList(accounts) %}
+ {% else %}
+ <p class="text-muted text-center my-5">
+ {{ _("There are no results for \"%s\"") % q }}
+ </p>
+ {% end %}
+ </div>
+ </div>
{% end block %}
-{% extends "base.html" %}
+{% extends "user-base.html" %}
-{% block title %}{{ _("SIP Status of %s") % account }}{% end block %}
+{% block title %}{{ account }} - {{ _("SIP Status") }}{% end block %}
{% block main %}
<h1>{{ _("SIP Status") }}</h1>
--- /dev/null
+{% extends "base.html" %}
+
+{% block title %}{{ account }}{% end block %}
+
+{% block content %}
+ <div class="row">
+ {% block sidebar %}
+ <div class="col-12 col-md-3">
+ <img class="img-fluid rounded-circle my-2" src="{{ account.avatar_url(512) }}" alt="{{ account }}" />
+
+ <h3 class="my-3">
+ <a class="text-white" href="/users/{{ account.uid }}">{{ account.name }}</a>
+ </h3>
+
+ {% if account.sip_id %}
+ <h5>
+ {{ account.sip_id }}
+
+ <small class="ml-2">
+ {% module SIPStatus(account) %}
+ </small>
+ </h5>
+ {% end %}
+
+ {% if account.can_be_managed_by(current_user) %}
+ <div class="btn-toolbar mb-3">
+ <a class="btn btn-warning btn-sm btn-block" href="/users/{{ account.uid }}/edit">
+ <span class="fas fa-edit mr-2"></span> {{ _("Edit") }}
+ </a>
+
+ <a class="btn btn-light btn-sm btn-block" href="/users/{{ account.uid }}/passwd">
+ {{ _("Change Password") }}
+ </a>
+
+ <a class="btn btn-light btn-sm btn-block" href="/users/{{ account.uid }}/ssh-keys">
+ <span class="fas fa-key mr-2"></span> {{ _("Manage SSH Keys") }}
+ </a>
+ </div>
+ {% end %}
+ </div>
+ {% end %}
+
+ <div class="col-12 col-md-8 offset-md-1">
+ {% block main %}{% end block %}
+ </div>
+ </div>
+{% end block %}
-{% extends "base.html" %}
+{% extends "user-base.html" %}
-{% block title %}{{ _("Edit %s") % account }}{% end block %}
+{% block title %}{{ account }} - {{ _("Edit") }}{% end block %}
{% block main %}
- <div class="row justify-content-center">
- <div class="col-6">
- <h4 class="mb-4">{{ _("Edit %s") % account }}</h4>
+ <h4 class="mb-4">{{ _("Edit") }}</h4>
- <form method="POST" action="" enctype="multipart/form-data">
- {% raw xsrf_form_html() %}
+ <form method="POST" action="" enctype="multipart/form-data">
+ {% raw xsrf_form_html() %}
- <div class="form-row mb-3">
- <div class="col">
- <label>{{ _("First Name") }}</label>
+ <div class="form-row mb-3">
+ <div class="col">
+ <label>{{ _("First Name") }}</label>
- <input type="text" class="form-control" name="first_name"
- placeholder="{{ _("First Name") }}" value="{{ account.first_name }}" required>
- </div>
+ <input type="text" class="form-control" name="first_name"
+ placeholder="{{ _("First Name") }}" value="{{ account.first_name }}" required>
+ </div>
- <div class="col">
- <label>{{ _("Last Name") }}</label>
+ <div class="col">
+ <label>{{ _("Last Name") }}</label>
- <input type="text" class="form-control" name="last_name"
- placeholder="{{ _("Last Name") }}" value="{{ account.last_name }}" required>
- </div>
- </div>
+ <input type="text" class="form-control" name="last_name"
+ placeholder="{{ _("Last Name") }}" value="{{ account.last_name }}" required>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label>{{ _("Address") }}</label>
- <div class="form-group">
- <label>{{ _("Address") }}</label>
+ <textarea type="text" class="form-control" name="address" rows="5" required
+ placeholder="{{ _("Address") }}">{{ "\n".join(account.address) }}</textarea>
- <textarea type="text" class="form-control" name="address" rows="5" required
- placeholder="{{ _("Address") }}">{{ "\n".join(account.address) }}</textarea>
+ <small class="form-text text-muted">
+ {{ _("Enter your full address including your country") }}
+ </small>
+ </div>
- <small class="form-text text-muted">
- {{ _("Enter your full address including your country") }}
- </small>
- </div>
+ <div class="form-group">
+ <label>{{ _("Avatar") }}</label>
- <div class="form-group">
- <label>{{ _("Avatar") }}</label>
+ <input type="file" class="form-control-file" name="avatar">
- <input type="file" class="form-control-file" name="avatar">
+ <small class="form-text text-muted">
+ {{ _("Upload a new avatar") }}
+ </small>
+ </div>
- <small class="form-text text-muted">
- {{ _("Upload a new avatar") }}
- </small>
- </div>
+ <fieldset>
+ <legend>{{ _("Email") }}</legend>
- <fieldset>
- <legend>{{ _("Email") }}</legend>
-
- <div class="form-group">
- <label>{{ _("Forward Emails") }}</label>
+ <div class="form-group">
+ <label>{{ _("Forward Emails") }}</label>
- <input type="mail" class="form-control" name="mail_routing_address"
- placeholder="{{ _("Email Address") }}" value="{{ account.mail_routing_address or "" }}">
+ <input type="mail" class="form-control" name="mail_routing_address"
+ placeholder="{{ _("Email Address") }}" value="{{ account.mail_routing_address or "" }}">
- <small class="form-text text-muted">
- {{ _("All emails will be forwarded to this email address") }}
- </small>
- </div>
- </fieldset>
+ <small class="form-text text-muted">
+ {{ _("All emails will be forwarded to this email address") }}
+ </small>
+ </div>
+ </fieldset>
- <fieldset>
- <legend>{{ _("Telephone") }}</legend>
+ <fieldset>
+ <legend>{{ _("Telephone") }}</legend>
- <div class="form-group">
- <label>{{ _("Phone Numbers") }}</label>
+ <div class="form-group">
+ <label>{{ _("Phone Numbers") }}</label>
- <textarea type="text" class="form-control" name="phone_numbers" rows="5"
- placeholder="{{ _("Phone Numbers") }}">{{ "\n".join((format_phone_number_to_e164(n) for n in account.phone_numbers)) }}</textarea>
+ <textarea type="text" class="form-control" name="phone_numbers" rows="5"
+ placeholder="{{ _("Phone Numbers") }}">{{ "\n".join((format_phone_number_to_e164(n) for n in account.phone_numbers)) }}</textarea>
- <small class="form-text text-muted">
- {{ _("Enter your landline and mobile phone numbers") }}
- </small>
- </div>
+ <small class="form-text text-muted">
+ {{ _("Enter your landline and mobile phone numbers") }}
+ </small>
+ </div>
- <div class="form-group">
- <label>{{ _("Forward Calls") }}</label>
+ <div class="form-group">
+ <label>{{ _("Forward Calls") }}</label>
- <input type="text" class="form-control" name="sip_routing_address"
- placeholder="{{ _("SIP URI or Phone Number") }}" value="{{ account.sip_routing_address or "" }}">
+ <input type="text" class="form-control" name="sip_routing_address"
+ placeholder="{{ _("SIP URI or Phone Number") }}" value="{{ account.sip_routing_address or "" }}">
- <small class="form-text text-muted">
- {{ _("All calls will be forwarded to this phone number or SIP URI") }}
- </small>
- </div>
- </fieldset>
+ <small class="form-text text-muted">
+ {{ _("All calls will be forwarded to this phone number or SIP URI") }}
+ </small>
+ </div>
+ </fieldset>
- <input class="btn btn-primary btn-block" type="submit" value="{{ _("Save") }}">
- </form>
- </div>
- </div>
+ <input class="btn btn-primary btn-block" type="submit" value="{{ _("Save") }}">
+ </form>
{% end block %}
-
-{% block right %}{% end block %}
-{% extends "base.html" %}
-
-{% block title %}{{ account }}{% end block %}
+{% extends "user-base.html" %}
{% block main %}
{% import phonenumbers %}
- <div class="row justify-content-center">
- <div class="col col-md-6 col-lg-4 mb-5">
- <img class="img-fluid rounded-circle my-5" src="{{ account.avatar_url(512) }}" alt="{{ account }}" />
-
- <h3 class="text-center mb-0">{{ account }}</h3>
-
- {% if account.sip_id %}
- <h5 class="text-center mb-0">{{ account.sip_id }}</h5>
- {% end %}
- </div>
- </div>
+ <div class="card p-3">
+ <div class="card-body">
+ <div class="row">
+ <div class="col">
+ <a class="btn btn-dark btn-block" href="mailto:{{ account.email }}">
+ {{ _("Email %s") % account.first_name }}
+ </a>
+ </div>
+ </div>
- <div class="row justify-content-center">
- <div class="col col-md-8">
- <div class="card p-3">
- <div class="card-body">
- <div class="row">
- <div class="col">
- <a class="btn btn-dark btn-block" href="mailto:{{ account.email }}">
- {{ _("Email %s") % account.first_name }}
- </a>
- </div>
+ <div class="row">
+ {% if account.address %}
+ <div class="col-md-6 mt-5">
+ <h6>{{ _("Postal Address") }}</h6>
+
+ <address>
+ <strong>{{ account.name }}</strong>
+ <br>
+ {% for line in account.address %}
+ {{ line }}<br>
+ {% end %}
+ </address>
</div>
-
- <div class="row">
- {% if account.address %}
- <div class="col-md-6 mt-5">
- <h6>{{ _("Postal Address") }}</h6>
-
- <address>
- <strong>{{ account.name }}</strong>
- <br>
- {% for line in account.address %}
- {{ line }}<br>
+ {% end %}
+
+ {% if account.phone_numbers %}
+ <div class="col-md-6 mt-5">
+ <h6>{{ _("Phone Numbers") }}</h6>
+
+ <ul class="list-unstyled">
+ {% for number in account.phone_numbers %}
+ <li>
+ {% if phonenumbers.number_type(number) == phonenumbers.PhoneNumberType.MOBILE %}
+ <span class="fa fa-mobile" title="{{ _("Mobile") }}"></span>
+ {% else %}
+ <span class="fa fa-phone"></span>
{% end %}
- </address>
- </div>
- {% end %}
-
- {% if account.phone_numbers %}
- <div class="col-md-6 mt-5">
- <h6>
- <span class="mr-2">{{ _("SIP Status") }}</span>
- {% module SIPStatus(account) %}
- </h6>
-
- <h6>{{ _("Phone Numbers") }}</h6>
-
- <ul class="list-unstyled">
- {% for number in account.phone_numbers %}
- <li>
- {% if phonenumbers.number_type(number) == phonenumbers.PhoneNumberType.MOBILE %}
- <span class="fa fa-mobile" title="{{ _("Mobile") }}"></span>
- {% else %}
- <span class="fa fa-phone"></span>
- {% end %}
-
- <a href="tel:{{ format_phone_number_to_e164(number) }}"
- title="{{ format_phone_number_location(number) }}">{{ format_phone_number(number) }}</a>
- </li>
- {% end %}
- </ul>
- </div>
- {% end %}
+ <a href="tel:{{ format_phone_number_to_e164(number) }}"
+ title="{{ format_phone_number_location(number) }}">{{ format_phone_number(number) }}</a>
+ </li>
+ {% end %}
+ </ul>
</div>
-
- {% if account.can_be_managed_by(current_user) %}
- <div class="btn-toolbar justify-content-center">
- <a class="btn btn-warning" href="/users/{{ account.uid }}/edit">
- <span class="fas fa-edit mr-2"></span> {{ _("Edit") }}
- </a>
-
- <a class="btn btn-light ml-2" href="/users/{{ account.uid }}/passwd">
- {{ _("Change Password") }}
- </a>
-
- <a class="btn btn-light ml-2" href="/users/{{ account.uid }}/ssh-keys">
- <span class="fas fa-key mr-2"></span> {{ _("Manage SSH Keys") }}
- </a>
- </div>
- {% end %}
- </div>
+ {% end %}
</div>
</div>
</div>
{% end block %}
-
-{% block right %}{% end block %}
{% block title %}{{ _("Users") }}{% end block %}
-{% block main %}
- <h3 class="mb-4">{{ _("Users") }}</h3>
+{% block content %}
+ <div class="row justify-content-center">
+ <div class="col col-md-8">
+ <h1>{{ _("Users") }}</h1>
- {% module AccountsList() %}
+ {% module AccountsList() %}
+ </div>
+ </div>
{% end block %}
class CallHandler(base.BaseHandler):
@tornado.web.authenticated
def get(self, uid, uuid):
+ account = self.backend.accounts.get_by_uid(uid)
+ if not account:
+ raise tornado.web.HTTPError(404, "Could not find account %s" % uid)
+
call = self.backend.talk.freeswitch.get_call_by_uuid(uuid)
if not call:
raise tornado.web.HTTPError(404, "Could not find call %s" % uuid)
# XXX limit
- self.render("people/call.html", call=call)
+ self.render("people/call.html", account=account, call=call)
class SearchHandler(base.BaseHandler):