This commit is contained in:
30
templs/forwarded-add-form.html.ep
Normal file
30
templs/forwarded-add-form.html.ep
Normal file
@@ -0,0 +1,30 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% 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="/forwarded/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add forwardeded domain</h5>
|
||||
<label>Domain name
|
||||
<input type="text" name="forwarded_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="/forwarded/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
%#EOF
|
||||
32
templs/forwarded-add-handler.html.ep
Normal file
32
templs/forwarded-add-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
% my $name = $c->req->param('forwarded_name');
|
||||
% my $id = $u->forwarded_exist($name);
|
||||
|
||||
% if ($id) {
|
||||
<div class="callout warning">Domain <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($id) {
|
||||
% my $res = $u->forwarded_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/forwarded-delete-form.html.ep
Normal file
39
templs/forwarded-delete-form.html.ep
Normal file
@@ -0,0 +1,39 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $forwarded_id = $c->req->param('forwarded_id') || 0;
|
||||
% my $profile = $u->forwarded_profile($forwarded_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $forwarded_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="/forwarded/delete/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Delete domain <%= $forwarded_name %></h5>
|
||||
<input type="hidden" name="forwarded_id" value="<%= $forwarded_id %>"/>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/forwarded/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Domain with id <%= $forwarded_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
32
templs/forwarded-delete-handler.html.ep
Normal file
32
templs/forwarded-delete-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $forwarded_id = $c->req->param('forwarded_id') || 0;
|
||||
% my $profile = $u->forwarded_profile($forwarded_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $name = $profile->{name};
|
||||
% my $res = $u->forwarded_delete($forwarded_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 <%= $forwarded_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
74
templs/forwarded-list.html.ep
Normal file
74
templs/forwarded-list.html.ep
Normal file
@@ -0,0 +1,74 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
<h5 class="text-center">
|
||||
Domains <a href="/forwarded/list"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/forwarded/add/form">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
|
||||
% my $list = $u->forwarded_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-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><a href="/forwarded/update/form?forwarded_id=<%= $id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/forwarded/delete/form?forwarded_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/forwarded-update-form.html.ep
Normal file
44
templs/forwarded-update-form.html.ep
Normal file
@@ -0,0 +1,44 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $forwarded_id = $c->req->param('forwarded_id') || 0;
|
||||
% my $profile = $u->forwarded_profile($forwarded_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $forwarded_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="/forwarded/update/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Edit domain</h5>
|
||||
<input type="hidden" name="forwarded_id" value="<%= $forwarded_id %>"/>
|
||||
<label>Domain name
|
||||
<input type="text" value="<%= $forwarded_name %>" name="forwarded_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="/forwarded/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Domain with id <%= $forwarded_id %> not exist</div>
|
||||
% }
|
||||
|
||||
|
||||
%#EOF
|
||||
41
templs/forwarded-update-handler.html.ep
Normal file
41
templs/forwarded-update-handler.html.ep
Normal file
@@ -0,0 +1,41 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $name = $c->req->param('forwarded_name');
|
||||
% my $forwarded_id = $c->req->param('forwarded_id') || 0;
|
||||
% my $profile = $u->forwarded_profile($forwarded_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $cid = $u->forwarded_exist($name);
|
||||
% if ($cid) {
|
||||
<div class="callout warning">Domain <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $res = $u->forwarded_update($forwarded_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 <%= $forwarded_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
<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="/forward/list">Forward</a></li>
|
||||
<li><a href="/forwarded/list">Forwarded</a></li>
|
||||
<li><a href="/unwanted/list">Unwanted</a></li>
|
||||
<li><a href="/trusted/list">Trusted</a></li>
|
||||
<li><a href="/mxlog">Log</a></li>
|
||||
<li><a href="/logout"><i class="fi-arrow-right"></i></a></li>
|
||||
</ul>
|
||||
|
||||
30
templs/trusted-add-form.html.ep
Normal file
30
templs/trusted-add-form.html.ep
Normal file
@@ -0,0 +1,30 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% 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="/trusted/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add trusteded host</h5>
|
||||
<label>Host name
|
||||
<input type="text" name="trusted_name" placeholder="host.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="/trusted/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
%#EOF
|
||||
32
templs/trusted-add-handler.html.ep
Normal file
32
templs/trusted-add-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
% my $name = $c->req->param('trusted_name');
|
||||
% my $id = $u->trusted_exist($name);
|
||||
|
||||
% if ($id) {
|
||||
<div class="callout warning">Host <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($id) {
|
||||
% my $res = $u->trusted_add($name);
|
||||
% if ($res) {
|
||||
<div class="callout success">Host <%= $name %> has been added.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Host <%= $name %> was not added.</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
39
templs/trusted-delete-form.html.ep
Normal file
39
templs/trusted-delete-form.html.ep
Normal file
@@ -0,0 +1,39 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $trusted_id = $c->req->param('trusted_id') || 0;
|
||||
% my $profile = $u->trusted_profile($trusted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $trusted_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="/trusted/delete/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Delete host <%= $trusted_name %></h5>
|
||||
<input type="hidden" name="trusted_id" value="<%= $trusted_id %>"/>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/trusted/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $trusted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
32
templs/trusted-delete-handler.html.ep
Normal file
32
templs/trusted-delete-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $trusted_id = $c->req->param('trusted_id') || 0;
|
||||
% my $profile = $u->trusted_profile($trusted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $name = $profile->{name};
|
||||
% my $res = $u->trusted_delete($trusted_id);
|
||||
|
||||
% if ($res) {
|
||||
<div class="callout success">Host <%= $name %> has been deleted</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Host <%= $name %> was not deleted</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $trusted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
74
templs/trusted-list.html.ep
Normal file
74
templs/trusted-list.html.ep
Normal file
@@ -0,0 +1,74 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
<h5 class="text-center">
|
||||
Hosts <a href="/trusted/list"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/trusted/add/form">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
|
||||
% my $list = $u->trusted_list;
|
||||
|
||||
% unless ($list) {
|
||||
<div class="callout alert">
|
||||
Cannot list hosts. May be wrong database?
|
||||
</div>
|
||||
% }
|
||||
|
||||
<table class="hover" id="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>host</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><a href="/trusted/update/form?trusted_id=<%= $id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/trusted/delete/form?trusted_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/trusted-update-form.html.ep
Normal file
44
templs/trusted-update-form.html.ep
Normal file
@@ -0,0 +1,44 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $trusted_id = $c->req->param('trusted_id') || 0;
|
||||
% my $profile = $u->trusted_profile($trusted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $trusted_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="/trusted/update/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Edit host</h5>
|
||||
<input type="hidden" name="trusted_id" value="<%= $trusted_id %>"/>
|
||||
<label>Host name
|
||||
<input type="text" value="<%= $trusted_name %>" name="trusted_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="/trusted/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $trusted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
|
||||
%#EOF
|
||||
41
templs/trusted-update-handler.html.ep
Normal file
41
templs/trusted-update-handler.html.ep
Normal file
@@ -0,0 +1,41 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $name = $c->req->param('trusted_name');
|
||||
% my $trusted_id = $c->req->param('trusted_id') || 0;
|
||||
% my $profile = $u->trusted_profile($trusted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $cid = $u->trusted_exist($name);
|
||||
% if ($cid) {
|
||||
<div class="callout warning">Host <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $res = $u->trusted_update($trusted_id, name => $name);
|
||||
% if ($res) {
|
||||
<div class="callout success">Host <%= $name %> has been updated.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Host <%= $name %> was not updated.</div>
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $trusted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
30
templs/unwanted-add-form.html.ep
Normal file
30
templs/unwanted-add-form.html.ep
Normal file
@@ -0,0 +1,30 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% 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="/unwanted/add/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Add unwanted host</h5>
|
||||
<label>Host name
|
||||
<input type="text" name="unwanted_name" placeholder="host.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="/unwanted/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
%#EOF
|
||||
32
templs/unwanted-add-handler.html.ep
Normal file
32
templs/unwanted-add-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
% my $name = $c->req->param('unwanted_name');
|
||||
% my $id = $u->unwanted_exist($name);
|
||||
|
||||
% if ($id) {
|
||||
<div class="callout warning">Host <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($id) {
|
||||
% my $res = $u->unwanted_add($name);
|
||||
% if ($res) {
|
||||
<div class="callout success">Host <%= $name %> has been added.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Host <%= $name %> was not added.</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
39
templs/unwanted-delete-form.html.ep
Normal file
39
templs/unwanted-delete-form.html.ep
Normal file
@@ -0,0 +1,39 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $unwanted_id = $c->req->param('unwanted_id') || 0;
|
||||
% my $profile = $u->unwanted_profile($unwanted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $unwanted_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="/unwanted/delete/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Delete host <%= $unwanted_name %></h5>
|
||||
<input type="hidden" name="unwanted_id" value="<%= $unwanted_id %>"/>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="button">Accept</button>
|
||||
<a class="button" href="/unwanted/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $unwanted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
32
templs/unwanted-delete-handler.html.ep
Normal file
32
templs/unwanted-delete-handler.html.ep
Normal file
@@ -0,0 +1,32 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $unwanted_id = $c->req->param('unwanted_id') || 0;
|
||||
% my $profile = $u->unwanted_profile($unwanted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $name = $profile->{name};
|
||||
% my $res = $u->unwanted_delete($unwanted_id);
|
||||
|
||||
% if ($res) {
|
||||
<div class="callout success">Host <%= $name %> has been deleted</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Host <%= $name %> was not deleted</div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $unwanted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
74
templs/unwanted-list.html.ep
Normal file
74
templs/unwanted-list.html.ep
Normal file
@@ -0,0 +1,74 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
<h5 class="text-center">
|
||||
Hosts <a href="/unwanted/list"><i class="fi-refresh"></i></a>
|
||||
<a class="float-right button tiny" href="/unwanted/add/form">
|
||||
<i class="fi-plus"></i>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
|
||||
% my $list = $u->unwanted_list;
|
||||
|
||||
% unless ($list) {
|
||||
<div class="callout alert">
|
||||
Cannot list hosts. May be wrong database?
|
||||
</div>
|
||||
% }
|
||||
|
||||
<table class="hover" id="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>host</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><a href="/unwanted/update/form?unwanted_id=<%= $id %>"><i class="fi-pencil"></i></a></td>
|
||||
<td><a href="/unwanted/delete/form?unwanted_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/unwanted-update-form.html.ep
Normal file
44
templs/unwanted-update-form.html.ep
Normal file
@@ -0,0 +1,44 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $unwanted_id = $c->req->param('unwanted_id') || 0;
|
||||
% my $profile = $u->unwanted_profile($unwanted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $unwanted_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="/unwanted/update/handler" method="get" data-abide novalidate>
|
||||
<h5 class="text-center">Edit host</h5>
|
||||
<input type="hidden" name="unwanted_id" value="<%= $unwanted_id %>"/>
|
||||
<label>Host name
|
||||
<input type="text" value="<%= $unwanted_name %>" name="unwanted_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="/unwanted/list">Escape</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $unwanted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
|
||||
%#EOF
|
||||
41
templs/unwanted-update-handler.html.ep
Normal file
41
templs/unwanted-update-handler.html.ep
Normal file
@@ -0,0 +1,41 @@
|
||||
%#
|
||||
%# $Id$
|
||||
%#
|
||||
% layout 'default';
|
||||
% title 'Maacom';
|
||||
|
||||
% use Mojo::Util qw(dumper);
|
||||
|
||||
% my $u = $c->app->user;
|
||||
|
||||
% my $name = $c->req->param('unwanted_name');
|
||||
% my $unwanted_id = $c->req->param('unwanted_id') || 0;
|
||||
% my $profile = $u->unwanted_profile($unwanted_id);
|
||||
|
||||
% if ($profile) {
|
||||
% my $cid = $u->unwanted_exist($name);
|
||||
% if ($cid) {
|
||||
<div class="callout warning">Host <%= $name %> already exists</div>
|
||||
% }
|
||||
|
||||
% unless ($cid) {
|
||||
% my $res = $u->unwanted_update($unwanted_id, name => $name);
|
||||
% if ($res) {
|
||||
<div class="callout success">Host <%= $name %> has been updated.</div>
|
||||
% }
|
||||
|
||||
% unless ($res) {
|
||||
<div class="callout alert">Host <%= $name %> was not updated.</div>
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
% unless ($profile) {
|
||||
<div class="callout warning">Host with id <%= $unwanted_id %> not exist</div>
|
||||
% }
|
||||
|
||||
%#EOF
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user