Add subscriber login registered dev widget.

agranig/peering-route
Andreas Granig 13 years ago
parent fb780a72b3
commit d5dc850bd9

@ -1567,6 +1567,14 @@ sub calllist :Chained('master') :PathPart('calls') :Args(0) {
);
}
sub reglist :Chained('master') :PathPart('regdevices') :Args(0) {
my ($self, $c) = @_;
$c->stash(
template => 'subscriber/reglist.tt'
);
}
sub edit_master :Chained('master') :PathPart('edit') :Args(0) {
my ($self, $c) = @_;
my $subscriber = $c->stash->{subscriber};

@ -16,7 +16,7 @@ has 'type' => (
has 'priority' => (
is => 'ro',
isa => 'Int',
default => 10,
default => 30,
);
around handle => sub {

@ -0,0 +1,55 @@
package NGCP::Panel::Widget::Plugin::SubscriberRegisterOverview;
use Moose::Role;
has 'template' => (
is => 'ro',
isa => 'Str',
default => 'widgets/subscriber_reg_overview.tt'
);
has 'type' => (
is => 'ro',
isa => 'Str',
default => 'dashboard_widgets',
);
has 'priority' => (
is => 'ro',
isa => 'Int',
default => 40,
);
around handle => sub {
my ($foo, $self, $c) = @_;
my $rs = $c->model('DB')->resultset('location')->search({
username => $c->user->username,
});
if($c->config->{features}->{multidomain}) {
$rs = $rs->search({
domain => $c->user->domain->domain,
});
}
my $reg_count = $rs->count;
$rs = $rs->slice(0,4);
$c->stash(
regs => $rs,
reg_count => $reg_count,
);
return;
};
sub filter {
my ($self, $c, $type) = @_;
return $self if(
$type eq $self->type &&
($c->user_in_realm('subscriber') || $c->user_in_realm('subscriberadmin')) &&
ref $c->controller eq 'NGCP::Panel::Controller::Dashboard'
);
return;
}
1;
# vim: set tabstop=4 expandtab:

@ -16,7 +16,7 @@ has 'type' => (
has 'priority' => (
is => 'ro',
isa => 'Int',
default => 10,
default => 20,
);
around handle => sub {

@ -0,0 +1,22 @@
[% site_config.title = 'Registered Devices for ' _ subscriber.username _ '@' _ subscriber.domain.domain -%]
<div class="row">
<span class="pull-left" style="margin:0 5px 0 5px;">
<a class="btn btn-primary btn-large" href="[% c.uri_for('/back') %]"><i class="icon-arrow-left"></i> Back</a>
</span>
</div>
[% back_created = 1 -%]
<div class="ngcp-separator"></div>
[%
helper.name = 'Registered Devices';
helper.dt_columns = reg_dt_columns;
helper.column_sort = 'expires';
helper.form_object = form;
helper.ajax_uri = c.uri_for_action('/subscriber/ajax_registered', [c.req.captures.0]);
PROCESS 'helpers/datatables.tt';
%]
[% # vim: set tabstop=4 syntax=html expandtab: -%]

@ -24,7 +24,7 @@
<i class="icon-circle-arrow-up" style="color:red"></i>
[% END -%]
</div>
<div class="span6">[% call.destination_user_in %]</div>
<div class="span8">[% call.destination_user_in %]</div>
[% ELSE -%]
<div class="span1">
[% IF call.call_status == "ok" -%]
@ -33,11 +33,11 @@
<i class="icon-circle-arrow-down" style="color:red"></i>
[% END -%]
</div>
<div class="span6">[% call.clir ? "anonymous" : call.source_cli %]</div>
<div class="span8">[% call.clir ? "anonymous" : call.source_cli %]</div>
[% END -%]
</div>
<div class="row-fluid">
<div class="offset1 span6">[% call.start_time -%]</div>
<div class="offset1 span8">[% call.start_time -%]</div>
<div class="span1">[% Math.int(call.duration) -%]s</div>
</div>
</li>

@ -0,0 +1,37 @@
[% USE Math -%]
<div class="plan-container">
<div class="plan">
<div class="plan-header">
<div class="plan-title">Registered Devices</div>
<div class="plan-price">
<span>[% reg_count %]</span>
<span class="term">Registered Device[% reg_count != 1 ? 's' : '' %]</span>
</div>
</div>
<div class="plan-features large">
<ul>
[% IF reg_count == 0 -%]
<li>No devices registered</li>
[% ELSE -%]
[% FOR reg IN regs.all -%]
<li>
<div class="row-fluid">
<div>
[% IF reg.user_agent.length > 48 -%]
[% ua = reg.user_agent.substr(45, reg.user_agent.length - 45, '...'); ua %]
[% ELSE -%]
[% reg.user_agent %]
[% END -%]
</div>
</div>
</li>
[% END -%]
[% END -%]
</ul>
</div>
<div class="plan-actions">
<a href="[% c.uri_for_action('/subscriber/reglist', [subscriber.id]) %]" class="btn">View All Registered Devices</a>
</div>
</div>
</div>
[% # vim: set tabstop=4 syntax=html expandtab: -%]

@ -7,6 +7,7 @@
<ul class="dropdown-menu">
<li><a href="[% c.uri_for_action('/subscriber/calllist', [subscriber.id]) %]">Call List</a></li>
<li><a href="[% c.uri_for_action('/subscriber/voicemail', [subscriber.id]) %]">Voicebox Messages</a></li>
<li><a href="[% c.uri_for_action('/subscriber/reglist', [subscriber.id]) %]">Registered Devices</a></li>
<li><a href="[% c.uri_for_action('/subscriber/preferences', [subscriber.id]) %]">Line Settings</a></li>
</ul>
</li>

@ -1,4 +1,3 @@
[% USE Math -%]
<div class="plan-container">
<div class="plan">
<div class="plan-header">
@ -21,10 +20,10 @@
<i class="icon-volume-up" style="color:green"></i>
</a>
</div>
<div class="span6">[% vmail.callerid -%]</div>
<div class="span8">[% vmail.callerid -%]</div>
</div>
<div class="row-fluid">
<div class="offset1 span6">[% vmail.origtime -%]</div>
<div class="offset1 span8">[% vmail.origtime -%]</div>
<div class="span1">[% vmail.duration -%]s</div>
</div>
</li>

@ -7,6 +7,8 @@
<ul class="dropdown-menu">
<li><a href="[% c.uri_for_action('/subscriber/calllist', [subscriber.id]) %]">Call List</a></li>
<li><a href="[% c.uri_for_action('/subscriber/voicemail', [subscriber.id]) %]">Voicebox Messages</a></li>
<li><a href="[% c.uri_for_action('/subscriber/reglist', [subscriber.id]) %]">Registered Devices</a></li>
<li><a href="[% c.uri_for_action('/subscriber/preferences', [subscriber.id]) %]">Line Settings</a></li>
<li><a href="#">Subscriber Admin Test</a></li>
</ul>
</li>

Loading…
Cancel
Save