This commit is contained in:
77
templs/alias-add-form.html.ep
Normal file
77
templs/alias-add-form.html.ep
Normal file
@@ -0,0 +1,77 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $domain_id = $c->req->param('domain_id');
|
||||
|
||||
% if ($domain_id) {
|
||||
% my $profile = $u->domain_profile($domain_id);
|
||||
% my $domain_name = $profile->{name};
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/alias/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add alias to domain <%= $domain_name %></h5>
|
||||
<input type="hidden" name="domain_id" value="<%= $domain_id %>"/>
|
||||
<label>Alias name
|
||||
<input type="text" name="alias_name" placeholder="aliasname" required pattern="[_.a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,42}"/>
|
||||
<span class="form-error">Mandatory, 2 or more letter</span>
|
||||
</label>
|
||||
<label>Destination list
|
||||
<input type="text" name="list" placeholder="some@bare.org,foo@bar.com" required pattern="[_.,@a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
|
||||
<span class="form-error">Mandatory, 6 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/alias/list?domain_id=<%= $domain_id %>">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($domain_id) {
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/alias/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add alias</h5>
|
||||
<label>Alias name
|
||||
<input type="text" name="alias_name" placeholder="aliasname" required pattern="[_.a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,42}"/>
|
||||
<span class="form-error">Mandatory, 2 or more letter</span>
|
||||
</label>
|
||||
<label>Domain
|
||||
<select name="domain_id" required>
|
||||
<option value=""></option>
|
||||
% foreach my $rec (@{$u->domain_list}) {
|
||||
<option value="<%= $rec->{id} %>"><%= $rec->{name} %></option>
|
||||
% }
|
||||
</select >
|
||||
</label>
|
||||
<label>Destination list
|
||||
<input type="text" name="list" placeholder="some@bare.org,foo@bar.com" required pattern="[_.@,a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
|
||||
<span class="form-error">Mandatory, 6 or more letter</span>
|
||||
</label>
|
||||
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/alias/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
31
templs/alias-add-handler.html.ep
Normal file
31
templs/alias-add-handler.html.ep
Normal file
@@ -0,0 +1,31 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $alias_name = $c->req->param('alias_name');
|
||||
% my $domain_id = $c->req->param('domain_id');
|
||||
% my $list = $c->req->param('list');
|
||||
|
||||
% my $cid = $u->alias_exist($alias_name, $domain_id);
|
||||
|
||||
% if ($cid) {
|
||||
<div class="callout warning">Alias <%= $alias_name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $id = $u->alias_add($alias_name, $list, $domain_id);
|
||||
% if ($id) {
|
||||
<div class="callout success">Alias <%= $alias_name %> has been added.</div>
|
||||
% }
|
||||
|
||||
% unless ($id) {
|
||||
<div class="callout alert">Alias <%= $alias_name %> was not added.</div>
|
||||
% }
|
||||
% }
|
||||
%#EOF
|
||||
41
templs/alias-delete-form.html.ep
Normal file
41
templs/alias-delete-form.html.ep
Normal file
@@ -0,0 +1,41 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $alias_id = $c->req->param('alias_id') || 0;
|
||||
% my $profile = $u->alias_profile($alias_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $alias_name = $profile->{name};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/alias/delete/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Delete alias <%= $address %></h5>
|
||||
<input type="hidden" name="alias_id" value="<%= $alias_id %>"/>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/alias/list?domain_id=<%= $domain_id %>">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
|
||||
% }
|
||||
%#EOF
|
||||
34
templs/alias-delete-handler.html.ep
Normal file
34
templs/alias-delete-handler.html.ep
Normal file
@@ -0,0 +1,34 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $alias_id = $c->req->param('alias_id') || 0;
|
||||
% my $profile = $u->alias_profile($alias_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $name = $profile->{name};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
% my $res = $u->alias_delete($alias_id);
|
||||
|
||||
% if ($res) {
|
||||
<div class="callout success">Alias <%= $address %> has been deleted</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Alias <%= $address %> was not deleted</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
123
templs/alias-list.html.ep
Normal file
123
templs/alias-list.html.ep
Normal file
@@ -0,0 +1,123 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $req = $c->req;
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $domain_id = $req->param('domain_id');
|
||||
|
||||
% unless ($domain_id) {
|
||||
<h5 class="text-center">
|
||||
Aliases <a href="/alias/list"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/alias/add/form">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
% my $list = $u->alias_list;
|
||||
|
||||
<table class="hover" id="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>alias</th>
|
||||
<th><i class="fi-male-female"></i></th>
|
||||
<th><i class="fi-at-sign"></i></th>
|
||||
<th><i class="fi-address-book"></i></th>
|
||||
<th><i class="fi-pencil"></i></th>
|
||||
<th><i class="fi-trash"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% my $n = 0;
|
||||
% if ($list) {
|
||||
% foreach my $row (@$list) {
|
||||
% $n += 1;
|
||||
% my $alias_id = $row->{id};
|
||||
% my $address = $row->{address};
|
||||
% my $domain_id = $row->{domain_id};
|
||||
% my $count = split ",", $row->{list};
|
||||
<tr>
|
||||
<td><%= $n %></td>
|
||||
<td><%= $address %></td>
|
||||
<td><%= $count %></td>
|
||||
<td><a href="/alias/list?domain_id=<%= $domain_id %>"><i class="fi-at-sign"></i></a></td>
|
||||
<td><a href="/alias/rename/form?alias_id=<%= $alias_id %>"><i class="fi-address-book"></i></a></td>
|
||||
<td><a href="/alias/update/form?alias_id=<%= $alias_id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/alias/delete/form?alias_id=<%= $alias_id %>"><i class="fi-trash"></i></a></td>
|
||||
</tr>
|
||||
% }
|
||||
% }
|
||||
</tbody>
|
||||
</table>
|
||||
% }
|
||||
|
||||
% if ($domain_id) {
|
||||
<h5 class="text-center">
|
||||
Aliases <a href="/alias/list?domain_id=<%= $domain_id %>"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/alias/add/form?domain_id=<%= $domain_id %>">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
% my $list = $u->alias_list($domain_id);
|
||||
|
||||
<table class="hover" id="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>alias</th>
|
||||
<th><i class="fi-male-female"></i></th>
|
||||
<th><i class="fi-address-book"></i></th>
|
||||
<th><i class="fi-pencil"></i></th>
|
||||
<th><i class="fi-trash"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% if ($list) {
|
||||
% my $n = 0;
|
||||
% foreach my $row (@$list) {
|
||||
% $n += 1;
|
||||
% my $c = split ',', $row->{list};
|
||||
|
||||
% my $alias_id = $row->{id};
|
||||
% my $address = $row->{address};
|
||||
% my $domain_id = $row->{domain_id};
|
||||
% my $count = split ",", $row->{list};
|
||||
<tr>
|
||||
<td><%= $n %></td>
|
||||
<td><%= $address %></td>
|
||||
<td><%= $count %></td>
|
||||
<td><a href="/alias/rename/form?alias_id=<%= $alias_id %>"><i class="fi-address-book"></i></a></td>
|
||||
<td><a href="/alias/update/form?alias_id=<%= $alias_id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/alias/delete/form?alias_id=<%= $alias_id %>"><i class="fi-trash"></i></a></td>
|
||||
</tr>
|
||||
% }
|
||||
% }
|
||||
</tbody>
|
||||
</table>
|
||||
% }
|
||||
|
||||
<script>
|
||||
$.extend(true, $.fn.dataTable.defaults, {
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"language": {
|
||||
"search": "",
|
||||
"lengthMenu": "_MENU_",
|
||||
"info": "_START_-_END_ of _TOTAL_",
|
||||
"infoEmpty": "",
|
||||
},
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#table').DataTable();
|
||||
});
|
||||
</script>
|
||||
%# EOF
|
||||
|
||||
46
templs/alias-rename-form.html.ep
Normal file
46
templs/alias-rename-form.html.ep
Normal file
@@ -0,0 +1,46 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $alias_id = $c->req->param('alias_id') || 0;
|
||||
% my $profile = $u->alias_profile($alias_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $alias_name = $profile->{name};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $list = $profile->{list};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/alias/update/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Edit alias <%= $address %></h5>
|
||||
<input type="hidden" name="alias_id" value="<%= $alias_id %>"/>
|
||||
<label>Alias name
|
||||
<input type="text" value="<%= $alias_name %>" name="alias_name" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,42}"/>
|
||||
<span class="form-error">Mandatory, 2 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/alias/list?">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
|
||||
% }
|
||||
%#EOF
|
||||
44
templs/alias-rename-handler.html.ep
Normal file
44
templs/alias-rename-handler.html.ep
Normal file
@@ -0,0 +1,44 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $new_name = $c->req->param('alias_name');
|
||||
% my $alias_id = $c->req->param('alias_id') || 0;
|
||||
% my $profile = $u->alias_profile($alias_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
% my $cid = $u->alias_exist($new_name, $domain_id);
|
||||
% if ($cid) {
|
||||
<div class="callout warning">Alias with <%= $address %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $res = $u->alias_update($alias_id, name => $new_name);
|
||||
% if ($res) {
|
||||
<div class="callout success">Alias <%= $address %> has been updated.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Alias <%= $address %> was not updated.</div>
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
46
templs/alias-update-form.html.ep
Normal file
46
templs/alias-update-form.html.ep
Normal file
@@ -0,0 +1,46 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $alias_id = $c->req->param('alias_id') || 0;
|
||||
% my $profile = $u->alias_profile($alias_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $alias_name = $profile->{name};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $list = $profile->{list};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/alias/update/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Edit alias <%= $address %></h5>
|
||||
<input type="hidden" name="alias_id" value="<%= $alias_id %>"/>
|
||||
<label>Destinations list
|
||||
<textarea rows="5" name="list" required"><%= $list %></textarea>
|
||||
<span class="form-error">Mandatory, 6 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/alias/list?">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
|
||||
% }
|
||||
%#EOF
|
||||
44
templs/alias-update-handler.html.ep
Normal file
44
templs/alias-update-handler.html.ep
Normal file
@@ -0,0 +1,44 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper trim);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $alias_id = $c->req->param('alias_id') || 0;
|
||||
% my $list = $c->req->param('list');
|
||||
|
||||
% my $profile = $u->alias_profile($alias_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
% $list =~ s/[\s\n]/,/g;
|
||||
% $list =~ s/,,/,/g;
|
||||
% $list =~ s/^,//g;
|
||||
% $list =~ s/,$//g;
|
||||
|
||||
% my $res = $u->alias_update($alias_id, list => $list);
|
||||
% if ($res) {
|
||||
<div class="callout success">Alias <%= $address %> has been updated.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Alias <%= $address %> was not updated.</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
30
templs/domain-add-form.html.ep
Normal file
30
templs/domain-add-form.html.ep
Normal file
@@ -0,0 +1,30 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/domain/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add domain</h5>
|
||||
<label>Domain name
|
||||
<input type="text" name="domain_name" placeholder="domain.org" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
|
||||
<span class="form-error">Mandatory, 5 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/domain/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
%#EOF
|
||||
32
templs/domain-add-handler.html.ep
Normal file
32
templs/domain-add-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
% my $name = $c->req->param('domain_name');
|
||||
% my $id = $u->domain_exist($name);
|
||||
|
||||
% if ($id) {
|
||||
<div class="callout warning">Domain <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($id) {
|
||||
% my $res = $u->domain_add($name);
|
||||
% if ($res) {
|
||||
<div class="callout success">Domain <%= $name %> has been added.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Domain <%= $name %> was not added.</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
39
templs/domain-delete-form.html.ep
Normal file
39
templs/domain-delete-form.html.ep
Normal file
@@ -0,0 +1,39 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $domain_id = $c->req->param('domain_id') || 0;
|
||||
% my $profile = $u->domain_profile($domain_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $domain_name = $profile->{name};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/domain/delete/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Delete domain <%= $domain_name %></h5>
|
||||
<input type="hidden" name="domain_id" value="<%= $domain_id %>"/>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/domain/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
32
templs/domain-delete-handler.html.ep
Normal file
32
templs/domain-delete-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $domain_id = $c->req->param('domain_id') || 0;
|
||||
% my $profile = $u->domain_profile($domain_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $name = $profile->{name};
|
||||
% my $res = $u->domain_delete($domain_id);
|
||||
|
||||
% if ($res) {
|
||||
<div class="callout success">Domain <%= $name %> has been deleted</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Domain <%= $name %> was not deleted</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
80
templs/domain-list.html.ep
Normal file
80
templs/domain-list.html.ep
Normal file
@@ -0,0 +1,80 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
<h5 class="text-center">
|
||||
Domains <a href="/domain/list"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/domain/add/form">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
|
||||
% my $list = $u->domain_list;
|
||||
|
||||
% unless ($list) {
|
||||
<div class="callout alert">
|
||||
Cannot list domains. May be wrong database?
|
||||
</div>
|
||||
% }
|
||||
|
||||
<table class="hover" id="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>domain</th>
|
||||
<th><i class="fi-graph-pie"></i></th>
|
||||
<th><i class="fi-male"></i></th>
|
||||
<th><i class="fi-male-female"></i></th>
|
||||
<th><i class="fi-pencil"></i></th>
|
||||
<th><i class="fi-trash"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% my $n = 0;
|
||||
|
||||
% if ($list) {
|
||||
% foreach my $row (@$list) {
|
||||
% $n += 1;
|
||||
% my $id = $row->{id};
|
||||
% my $name = $row->{name};
|
||||
% my $size = $row->{size};
|
||||
<tr>
|
||||
<td><%= $n %></td>
|
||||
<td><%= $name %></td>
|
||||
<td><%= $size %></td>
|
||||
<td><a href="/user/list?domain_id=<%= $id %>"><%= $u->domain_user_count($id) %></a></td>
|
||||
<td><a href="/alias/list?domain_id=<%= $id %>"><%= $u->domain_alias_count($id) %></a></td>
|
||||
<td><a href="/domain/update/form?domain_id=<%= $id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/domain/delete/form?domain_id=<%= $id %>"><i class="fi-trash"></i></a></td>
|
||||
</tr>
|
||||
% }
|
||||
% }
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
$.extend(true, $.fn.dataTable.defaults, {
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"language": {
|
||||
"search": "",
|
||||
"lengthMenu": "_MENU_",
|
||||
"info": "_START_-_END_ of _TOTAL_",
|
||||
"infoEmpty": "",
|
||||
},
|
||||
|
||||
} );
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#table').DataTable();
|
||||
});
|
||||
</script>
|
||||
|
||||
%# EOF
|
||||
44
templs/domain-update-form.html.ep
Normal file
44
templs/domain-update-form.html.ep
Normal file
@@ -0,0 +1,44 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $domain_id = $c->req->param('domain_id') || 0;
|
||||
% my $profile = $u->domain_profile($domain_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $domain_name = $profile->{name};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/domain/update/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Edit domain</h5>
|
||||
<input type="hidden" name="domain_id" value="<%= $domain_id %>"/>
|
||||
<label>Domain name
|
||||
<input type="text" value="<%= $domain_name %>" name="domain_name" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
|
||||
<span class="form-error">Mandatory, 5 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/domain/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
|
||||
% }
|
||||
|
||||
|
||||
%#EOF
|
||||
41
templs/domain-update-handler.html.ep
Normal file
41
templs/domain-update-handler.html.ep
Normal file
@@ -0,0 +1,41 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $name = $c->req->param('domain_name');
|
||||
% my $domain_id = $c->req->param('domain_id') || 0;
|
||||
% my $profile = $u->domain_profile($domain_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $cid = $u->domain_exist($name);
|
||||
% if ($cid) {
|
||||
<div class="callout warning">Domain <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $res = $u->domain_update($domain_id, name => $name);
|
||||
% if ($res) {
|
||||
<div class="callout success">Domain <%= $name %> has been updated.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Domain <%= $name %> was not updated.</div>
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
13
templs/exception.development.html.ep
Normal file
13
templs/exception.development.html.ep
Normal file
@@ -0,0 +1,13 @@
|
||||
%#
|
||||
%# $Id: exception.html.ep 627 2017-04-15 13:02:08Z ziggi $
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Error';
|
||||
|
||||
<h5>Oops... Exception</h5>
|
||||
|
||||
<pre>
|
||||
%= $exception
|
||||
</pre>
|
||||
|
||||
%#EOF
|
||||
13
templs/exception.production.html.ep
Normal file
13
templs/exception.production.html.ep
Normal file
@@ -0,0 +1,13 @@
|
||||
%#
|
||||
%# $Id: exception.html.ep 627 2017-04-15 13:02:08Z ziggi $
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Error';
|
||||
|
||||
<h5>Oops... Exception</h5>
|
||||
|
||||
<pre>
|
||||
%= $exception
|
||||
</pre>
|
||||
|
||||
%#EOF
|
||||
9
templs/hello.html.ep
Normal file
9
templs/hello.html.ep
Normal file
@@ -0,0 +1,9 @@
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper html_unescape unquote);
|
||||
|
||||
<h5 class="text-center">Hi! How are you there?</h5>
|
||||
|
||||
%#EOF
|
||||
|
||||
58
templs/layouts/default.html.ep
Normal file
58
templs/layouts/default.html.ep
Normal file
@@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><%= title %></title>
|
||||
<link rel="stylesheet" href="/css/foundation-float.min.css">
|
||||
<link rel="stylesheet" href="/css/datatables.css"/>
|
||||
<link rel="stylesheet" href="/css/app.css">
|
||||
|
||||
<link rel="stylesheet" href="/icons/foundation-icons.css">
|
||||
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script src="/js/datatables.min.js"></script>
|
||||
<script src="/js/foundation.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="title-bar" data-responsive-toggle="topbar-menu" data-hide-for="medium">
|
||||
<button class="menu-icon" type="button" data-toggle="topbar-menu"></button>
|
||||
<div class="title-bar-title">Menu</div>
|
||||
</div>
|
||||
|
||||
<div class="top-bar" id="topbar-menu">
|
||||
<div class="top-bar-left">
|
||||
<ul class="dropdown menu" data-dropdown-menu>
|
||||
<li class="menu-text">Mail</li>
|
||||
<li><a href="/domain/list">Domain</a></li>
|
||||
<li><a href="/user/list">User</a></li>
|
||||
<li><a href="/alias/list">Alias</a></li>
|
||||
<li><a href="/mxlog">Log</a></li>
|
||||
<li><a href="/logout"><i class="fi-arrow-right"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"> </div>
|
||||
<div class="row">
|
||||
<!- end of head template ->
|
||||
|
||||
<%= content %>
|
||||
|
||||
<!- begin of tail template ->
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<p class="text-center"><small>Made by <a href="http://wiki.unix7.org">Borodin Oleg</a></small></p>
|
||||
</div>
|
||||
|
||||
<script src="/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<!- end of tail template ->
|
||||
<!- EOF ->
|
||||
58
templs/login.html.ep
Normal file
58
templs/login.html.ep
Normal file
@@ -0,0 +1,58 @@
|
||||
%#
|
||||
%# $Id: login.html.ep 634 2017-04-15 13:55:49Z ziggi $
|
||||
%#
|
||||
<html class="no-js" lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="/css/foundation-float.min.css">
|
||||
<link rel="stylesheet" href="/css/app.css">
|
||||
|
||||
<link rel="stylesheet" href="/icons/foundation-icons.css">
|
||||
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script src="/js/foundation.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="row"> </div>
|
||||
<div class="row">
|
||||
<div class="small-3 columns hide-for-small"> </div>
|
||||
<div class="small-6 columns text-center">
|
||||
<div class="row">
|
||||
<div class="columns">
|
||||
|
||||
<form accept-charset="UTF-8" method="post" action="/login">
|
||||
<div class="row column">
|
||||
<h4 class="text-center">Login with your username</h4>
|
||||
<label>Username
|
||||
<input type="text" name="username" placeholder="username" />
|
||||
</label>
|
||||
<label>Password
|
||||
<input type="password" name="password" placeholder="password" />
|
||||
</label>
|
||||
<p>
|
||||
<button type="submit" class="button">Log In</button>
|
||||
</p>
|
||||
<p class="text-center"></p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small-3 columns hide-for-small"> </div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<p class="text-center"><small>Made by <a href="http://wiki.unix7.org">Borodin Oleg</a></small></p>
|
||||
</div>
|
||||
|
||||
<script src="/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<!- EOF ->
|
||||
%# EOF
|
||||
65
templs/mxlog.html.ep
Normal file
65
templs/mxlog.html.ep
Normal file
@@ -0,0 +1,65 @@
|
||||
%# $Id$
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
% my $t = $c->app->tail;
|
||||
|
||||
% unless ($c->req->param('next')) {
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
<h5 class="text-center"><%= $t->file %></h5>
|
||||
<div class="callout">
|
||||
<small><div id="log">
|
||||
% foreach my $line (@{$t->first}) {
|
||||
<%= $line %><br/>
|
||||
% }
|
||||
</div></small>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div id="clear" class="button">Clear</div>
|
||||
<div id="pause" class="button">Pause</div>
|
||||
</div>
|
||||
|
||||
% $c->session(pos => $t->pos);
|
||||
<script>
|
||||
function aTail () {
|
||||
$.get("", { next : "yes" },
|
||||
function (data) {
|
||||
$("#log").append(data);
|
||||
$('html,body').animate({
|
||||
scrollTop: document.body.scrollHeight},
|
||||
"slow"
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
$("#clear").click(function() {
|
||||
$("#log").empty();
|
||||
});
|
||||
|
||||
var tailRun = 1;
|
||||
var timerId = setInterval(function(){ aTail(); }, 2000);
|
||||
|
||||
$("#pause").click(function() {
|
||||
if (tailRun == 1) {
|
||||
clearInterval(timerId);
|
||||
$("#pause").html("Pause");
|
||||
$("#pause").toggleClass("secondary");
|
||||
tailRun = 0;
|
||||
} else {
|
||||
timerId = setInterval(function() {aTail()}, 2000);
|
||||
$("#pause").html("Pause");
|
||||
$("#pause").toggleClass("secondary");
|
||||
tailRun = 1;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
% }
|
||||
|
||||
% if ($c->req->param('next')) {
|
||||
% $t->pos($c->session('pos'));
|
||||
% foreach my $line (@{$t->last}) {
|
||||
<%= $line %><br/>
|
||||
% }
|
||||
% $c->session(pos => $t->pos);
|
||||
% }
|
||||
%#EOF
|
||||
9
templs/not_found.development.html.ep
Normal file
9
templs/not_found.development.html.ep
Normal file
@@ -0,0 +1,9 @@
|
||||
%#
|
||||
%# $Id: not_found.html.ep 627 2017-04-15 13:02:08Z ziggi $
|
||||
%#
|
||||
% layout 'default';
|
||||
% title '404 Not found';
|
||||
|
||||
<h5>404 Page not found</h5>
|
||||
|
||||
%#EOF
|
||||
9
templs/not_found.production.html.ep
Normal file
9
templs/not_found.production.html.ep
Normal file
@@ -0,0 +1,9 @@
|
||||
%#
|
||||
%# $Id: not_found.html.ep 627 2017-04-15 13:02:08Z ziggi $
|
||||
%#
|
||||
% layout 'default';
|
||||
% title '404 Not found';
|
||||
|
||||
<h5>404 Page not found</h5>
|
||||
|
||||
%#EOF
|
||||
78
templs/user-add-form.html.ep
Normal file
78
templs/user-add-form.html.ep
Normal file
@@ -0,0 +1,78 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $domain_id = $c->req->param('domain_id');
|
||||
|
||||
% if ($domain_id) {
|
||||
% my $profile = $u->domain_profile($domain_id);
|
||||
% my $domain_name = $profile->{name};
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/user/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add user to domain <%= $domain_name %></h5>
|
||||
<input type="hidden" name="domain_id" value="<%= $domain_id %>"/>
|
||||
<label>Username
|
||||
<input type="text" name="user_name" placeholder="username" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,42}"/>
|
||||
<span class="form-error">Mandatory, 2 or more letter</span>
|
||||
</label>
|
||||
<label>Password
|
||||
<input type="text" name="password" placeholder="xxxxxxxxx" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
|
||||
<span class="form-error">Mandatory, 6 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/user/list?domain_id=<%= $domain_id %>">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($domain_id) {
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/user/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add user</h5>
|
||||
<label>Username
|
||||
<input type="text" name="user_name" placeholder="username" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,42}"/>
|
||||
<span class="form-error">Mandatory, 2 or more letter</span>
|
||||
</label>
|
||||
<label>Password
|
||||
<input type="text" name="password" placeholder="xxxxxxxxx" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
|
||||
<span class="form-error">Mandatory, 6 or more letter</span>
|
||||
</label>
|
||||
|
||||
<label>Domain
|
||||
<select name="domain_id" required>
|
||||
<option value=""></option>
|
||||
% foreach my $rec (@{$u->domain_list}) {
|
||||
<option value="<%= $rec->{id} %>"><%= $rec->{name} %></option>
|
||||
% }
|
||||
</select >
|
||||
</label>
|
||||
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/user/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
35
templs/user-add-handler.html.ep
Normal file
35
templs/user-add-handler.html.ep
Normal file
@@ -0,0 +1,35 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $user_name = $c->req->param('user_name');
|
||||
% my $domain_id = $c->req->param('domain_id');
|
||||
% my $password = $c->req->param('password');
|
||||
|
||||
% my $cid = $u->user_exist($user_name, $domain_id);
|
||||
|
||||
% if ($cid) {
|
||||
<div class="callout warning">User <%= $user_name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $id = $u->user_add($user_name, $password, $domain_id);
|
||||
% if ($id) {
|
||||
<div class="callout success">User <%= $user_name %> has been added.</div>
|
||||
% }
|
||||
|
||||
% unless ($id) {
|
||||
<div class="callout alert">User <%= $user_name %> was not added.</div>
|
||||
% }
|
||||
% }
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
41
templs/user-delete-form.html.ep
Normal file
41
templs/user-delete-form.html.ep
Normal file
@@ -0,0 +1,41 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $user_id = $c->req->param('user_id') || 0;
|
||||
% my $profile = $u->user_profile($user_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $user_name = $profile->{name};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/user/delete/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Delete user <%= $address %></h5>
|
||||
<input type="hidden" name="user_id" value="<%= $user_id %>"/>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/user/list?domain_id=<%= $domain_id %>">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">User with id <%= $user_id %> not exist</div>
|
||||
% }
|
||||
%#EOF
|
||||
34
templs/user-delete-handler.html.ep
Normal file
34
templs/user-delete-handler.html.ep
Normal file
@@ -0,0 +1,34 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $user_id = $c->req->param('user_id') || 0;
|
||||
% my $profile = $u->user_profile($user_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $name = $profile->{name};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
% my $res = $u->user_delete($user_id);
|
||||
|
||||
% if ($res) {
|
||||
<div class="callout success">User <%= $address %> has been deleted</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">User <%= $address %> was not deleted</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">User with id <%= $user_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
123
templs/user-list.html.ep
Normal file
123
templs/user-list.html.ep
Normal file
@@ -0,0 +1,123 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $req = $c->req;
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $domain_id = $req->param('domain_id');
|
||||
|
||||
|
||||
|
||||
% if ($domain_id) {
|
||||
<h5 class="text-center">
|
||||
Accounts <a href="/user/list?domain_id=<%= $domain_id %>"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/user/add/form?domain_id=<%= $domain_id %>">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
% my $list = $u->user_list($domain_id);
|
||||
|
||||
<table class="hover" id="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>address</th>
|
||||
<th><i class="fi-graph-pie"></i></th>
|
||||
<th><i class="fi-address-book"></i></th>
|
||||
<th><i class="fi-pencil"></i></th>
|
||||
<th><i class="fi-trash"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% if ($list) {
|
||||
% my $n = 0;
|
||||
% foreach my $row (@$list) {
|
||||
% $n += 1;
|
||||
% my $address = $row->{address};
|
||||
% my $user_id = $row->{id};
|
||||
% my $domain_id = $row->{domain_id};
|
||||
% my $size = $row->{size} || 0;
|
||||
<tr>
|
||||
<td><%= $n %></td>
|
||||
<td><%= $address %></td>
|
||||
<td><%= $size %></td>
|
||||
<td><a href="/user/rename/form?user_id=<%= $user_id %>"><i class="fi-address-book"></i></a></td>
|
||||
<td><a href="/user/update/form?user_id=<%= $user_id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/user/delete/form?user_id=<%= $user_id %>"><i class="fi-trash"></i></a></td>
|
||||
</tr>
|
||||
% }
|
||||
% }
|
||||
</tbody>
|
||||
</table>
|
||||
% }
|
||||
|
||||
% unless ($domain_id) {
|
||||
<h5 class="text-center">
|
||||
Accounts <a href="/user/list"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/user/add/form">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
% my $list = $u->user_list;
|
||||
|
||||
<table class="hover" id="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>address</th>
|
||||
<th><i class="fi-graph-pie"></i></th>
|
||||
<th><i class="fi-at-sign"></i></th>
|
||||
<th><i class="fi-address-book"></i></th>
|
||||
<th><i class="fi-pencil"></i></th>
|
||||
<th><i class="fi-trash"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% my $n = 0;
|
||||
% if ($list) {
|
||||
% foreach my $row (@$list) {
|
||||
% $n += 1;
|
||||
% my $address = $row->{address};
|
||||
% my $user_id = $row->{id};
|
||||
% my $domain_id = $row->{domain_id};
|
||||
% my $size = $row->{size} || 0;
|
||||
<tr>
|
||||
<td><%= $n %></td>
|
||||
<td><%= $address %></td>
|
||||
<td><%= $size %></td>
|
||||
<td><a href="/user/list?domain_id=<%= $domain_id %>"><i class="fi-at-sign"></i></a></td>
|
||||
<td><a href="/user/rename/form?user_id=<%= $user_id %>"><i class="fi-address-book"></i></a></td>
|
||||
<td><a href="/user/update/form?user_id=<%= $user_id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/user/delete/form?user_id=<%= $user_id %>"><i class="fi-trash"></i></a></td>
|
||||
</tr>
|
||||
% }
|
||||
% }
|
||||
</tbody>
|
||||
</table>
|
||||
% }
|
||||
|
||||
<script>
|
||||
$.extend(true, $.fn.dataTable.defaults, {
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"language": {
|
||||
"search": "",
|
||||
"lengthMenu": "_MENU_",
|
||||
"info": "_START_-_END_ of _TOTAL_",
|
||||
"infoEmpty": "",
|
||||
},
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#table').DataTable();
|
||||
});
|
||||
</script>
|
||||
%# EOF
|
||||
|
||||
46
templs/user-rename-form.html.ep
Normal file
46
templs/user-rename-form.html.ep
Normal file
@@ -0,0 +1,46 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $user_id = $c->req->param('user_id') || 0;
|
||||
% my $profile = $u->user_profile($user_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $user_name = $profile->{name};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $password = $profile->{password};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/user/rename/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Rename user <%= $address %></h5>
|
||||
<input type="hidden" name="user_id" value="<%= $user_id %>"/>
|
||||
<label>Username
|
||||
<input type="text" value="<%= $user_name %>" name="user_name" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,42}"/>
|
||||
<span class="form-error">Mandatory, 2 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/user/list?domain_id=<%= $domain_id %>">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">User with id <%= $user_id %> not exist</div>
|
||||
% }
|
||||
%#EOF
|
||||
41
templs/user-rename-handler.html.ep
Normal file
41
templs/user-rename-handler.html.ep
Normal file
@@ -0,0 +1,41 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $new_name = $c->req->param('user_name');
|
||||
% my $user_id = $c->req->param('user_id') || 0;
|
||||
% my $profile = $u->user_profile($user_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
% my $cid = $u->user_exist($new_name, $domain_id);
|
||||
|
||||
% if ($cid) {
|
||||
<div class="callout warning">User <%= $address %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $res = $u->user_update($user_id, name => $new_name);
|
||||
% if ($res) {
|
||||
<div class="callout success">User <%= $address %> has been updated.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">User <%= $address %> was not updated.</div>
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">User with id <%= $user_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
46
templs/user-update-form.html.ep
Normal file
46
templs/user-update-form.html.ep
Normal file
@@ -0,0 +1,46 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $user_id = $c->req->param('user_id') || 0;
|
||||
% my $profile = $u->user_profile($user_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $user_name = $profile->{name};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $password = $profile->{password};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="medium-6 medium-centered cell">
|
||||
|
||||
<form accept-charset="UTF-8" action="/user/update/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Edit user <%= $address %></h5>
|
||||
<input type="hidden" name="user_id" value="<%= $user_id %>"/>
|
||||
<label>Password
|
||||
<input type="text" value="<%= $password %>" name="password" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{6,42}"/>
|
||||
<span class="form-error">Mandatory, 6 or more letter</span>
|
||||
</label>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/user/list?">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">User with id <%= $user_id %> not exist</div>
|
||||
% }
|
||||
%#EOF
|
||||
38
templs/user-update-handler.html.ep
Normal file
38
templs/user-update-handler.html.ep
Normal file
@@ -0,0 +1,38 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Mail';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $user_id = $c->req->param('user_id') || 0;
|
||||
% my $password = $c->req->param('password');
|
||||
|
||||
% my $profile = $u->user_profile($user_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $domain_id = $profile->{domain_id};
|
||||
% my $domain_name = $profile->{domain_name};
|
||||
% my $address = $profile->{address};
|
||||
|
||||
% my $res = $u->user_update($user_id, password => $password);
|
||||
% if ($res) {
|
||||
<div class="callout success">User <%= $address %> has been updated.</div>
|
||||
% }
|
||||
% unless ($res) {
|
||||
<div class="callout alert">User <%= $address %> was not updated.</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">User with id <%= $user_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user