Portforwarding panels modified
This commit is contained in:
parent
2ccc3b18cc
commit
ffe62c9951
@ -8,66 +8,82 @@
|
||||
% my $cmmnt = $pf_datas->{cmmnt};
|
||||
% my $allow = $pf_datas->{allow};
|
||||
|
||||
% if (config->{debug} == 1) {
|
||||
<p>
|
||||
%= dumper $c->current_route
|
||||
%= dumper $c->stash("ret")
|
||||
%= dumper %$pf_datas
|
||||
</p>
|
||||
% if (config->{debug} == 0) {
|
||||
<pre>
|
||||
<%= dumper $c->current_route %>
|
||||
<%= dumper $c->stash("ret") %>
|
||||
<%= dumper %$pf_datas %>
|
||||
</pre>
|
||||
% }
|
||||
|
||||
%= form_for '/portforwardinge' => (method => 'POST') => begin
|
||||
<br>
|
||||
%= l "pf_SUMMARY_REMOVE_DESC"
|
||||
</p><br>
|
||||
<span class="">
|
||||
%=l "pf_LABEL_PROTOCOL"
|
||||
</span>
|
||||
<span class="">
|
||||
%=$proto
|
||||
</span><br><br>
|
||||
<span class="">
|
||||
%=l "pf_LABEL_SOURCE_PORT"
|
||||
</span>
|
||||
<span class="">
|
||||
%=$sport
|
||||
</span>
|
||||
<br><br>
|
||||
<span class="">
|
||||
%=l "pf_LABEL_DESTINATION_HOST"
|
||||
</span>
|
||||
<span class="">
|
||||
%=$dport
|
||||
</span>
|
||||
<br><br>
|
||||
<span class="">
|
||||
%=l "pf_LABEL_DESTINATION_PORT"
|
||||
</span>
|
||||
<span class="">
|
||||
%=$dhost
|
||||
</span>
|
||||
<br><br>
|
||||
<span class="">
|
||||
%=l "pf_RULE_COMMENT"
|
||||
</span>
|
||||
<span class="">
|
||||
%=$cmmnt
|
||||
</span>
|
||||
<br><br>
|
||||
<span class="">
|
||||
%=l "pf_ALLOW_HOSTS"
|
||||
</span>
|
||||
<span class="">
|
||||
%=$allow
|
||||
</span>
|
||||
<br><br>
|
||||
%#}
|
||||
%= hidden_field sport=>$sport
|
||||
%= hidden_field proto=>$proto
|
||||
<br>
|
||||
%= submit_button "$btn", class => ""
|
||||
</p>
|
||||
<form action="/smanager/portforwardinge" method="POST">
|
||||
|
||||
%end
|
||||
<br>
|
||||
<div>
|
||||
<%= l 'pf_SUMMARY_REMOVE_DESC' %>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<% l 'pf_LABEL_PROTOCOL' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= $proto %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<% l 'pf_LABEL_SOURCE_PORT' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= $sport %>
|
||||
</td>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>
|
||||
<% l 'pf_LABEL_DESTINATION_HOST' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= $dport %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<% l 'pf_LABEL_DESTINATION_PORT' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= $dhost %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<% l 'pf_RULE_COMMENT' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= $cmmnt %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<% l 'pf_ALLOW_HOSTS' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= $allow %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= hidden_field sport=>$sport %>
|
||||
<%= hidden_field proto=>$proto %>
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-md-1">
|
||||
<button type="submit" class="btn btn-primary"><%= $btn %></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
@ -1,6 +1,10 @@
|
||||
<div>
|
||||
% my $btn = l('pf_CREATE_RULE');
|
||||
%= form_for '/portforwardinga' => (method => 'POST') => begin
|
||||
|
||||
|
||||
|
||||
<form action="/smanager/portforwardinga" method="POST">
|
||||
|
||||
<br>
|
||||
|
||||
% my $retref= $c->stash("ret");
|
||||
% my %ret;
|
||||
@ -18,103 +22,94 @@
|
||||
% my $var5 = @vars[4];
|
||||
% my $var6 = @vars[5];
|
||||
|
||||
%if ($ret{ret} eq "") {
|
||||
%= $c->render_to_string(inline => l('pf_FIRST_PAGE_DESCRIPTION'));
|
||||
%} elsif (index($ret{ret},"SUCCESS") != -1) {
|
||||
% if ($ret{ret} eq "") {
|
||||
<%= $c->render_to_string(inline => l('pf_FIRST_PAGE_DESCRIPTION')); %>
|
||||
% } elsif (index($ret{ret},"SUCCESS") != -1) {
|
||||
<br>
|
||||
<div class="">
|
||||
<!--<h2> Operation Status Report</h2>-->
|
||||
%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
|
||||
<div>
|
||||
<h2> Operation Status Report</h2>
|
||||
<%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6); %>
|
||||
</div>
|
||||
%} else {
|
||||
% } else {
|
||||
<br>
|
||||
<div class="">
|
||||
<!--<h2> Operation Status Report - Error</h2>-->
|
||||
%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
|
||||
<div class="text-danger">
|
||||
<h2> Operation Status Report - Error</h2>
|
||||
<%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6); %>
|
||||
</div>
|
||||
%}
|
||||
% }
|
||||
|
||||
<p>
|
||||
<br>
|
||||
%= submit_button "$btn", class => ""
|
||||
</p>
|
||||
|
||||
% my $btn = l('pf_CREATE_RULE');
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-md-2">
|
||||
<button type="submit" class="btn btn-primary"><%= $btn %></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
% end
|
||||
|
||||
% if ($empty){
|
||||
% if ($empty){
|
||||
<br>
|
||||
%=l 'pf_NO_FORWARDS'
|
||||
% } else {
|
||||
<br>
|
||||
%=l 'pf_SHOW_FORWARDS'
|
||||
<br><br />
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="">
|
||||
%=l 'pf_LABEL_PROTOCOL'
|
||||
</th>
|
||||
<th class="">
|
||||
%=l 'pf_LABEL_SOURCE_PORT'
|
||||
</th>
|
||||
<th class="">
|
||||
%=l 'pf_LABEL_DESTINATION_HOST'
|
||||
</th>
|
||||
<th class="">
|
||||
%=l 'pf_LABEL_DESTINATION_PORT'
|
||||
</th>
|
||||
<th class="">
|
||||
%=l 'pf_ALLOW_HOSTS'
|
||||
</th>
|
||||
<th class="">
|
||||
%=l 'pf_RULE_COMMENT'
|
||||
</th>
|
||||
<th class="" '>
|
||||
%=l 'ACTION'
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% my %forwards = ();
|
||||
% $forwards{TCP} = $tcpforwards;
|
||||
% $forwards{UDP} = $udpforwards;
|
||||
|
||||
% foreach my $proto (sort keys %forwards) {
|
||||
|
||||
% if (@{ $forwards{$proto} }) {
|
||||
% foreach my $entry (@{ $forwards{$proto} }) {
|
||||
<%= l 'pf_NO_FORWARDS' %>
|
||||
% } else {
|
||||
<br>
|
||||
<%= l 'pf_SHOW_FORWARDS' %>
|
||||
<br><br>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
% my $sport = $entry->key;
|
||||
% my $dhost = $entry->prop('DestHost');
|
||||
% my $dport = $entry->prop('DestPort') || '';
|
||||
% my $cmmnt = $entry->prop('Comment') || '';
|
||||
% my $allow = $entry->prop('AllowHosts') || '';
|
||||
%= t td => (class => "") => $proto
|
||||
%= t td => (class => "") => $sport
|
||||
%= t td => (class => "") => $dhost
|
||||
%= t td => (class => "") => $dport
|
||||
%= t td => (class => "") => $allow
|
||||
%= t td => (class => "") => $cmmnt
|
||||
<td class="">
|
||||
%my $remove_text = l('REMOVE'); # Localized text
|
||||
%my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
%my $actionRemove = qq{
|
||||
% <a href="portforwardingd?CsrfDef=$csrf_token&trt=DEL&sport=$sport&proto=$proto">
|
||||
% <button type='button' class="" title='$remove_text' >
|
||||
% $remove_text
|
||||
% </button>
|
||||
% </a>
|
||||
%};
|
||||
<%= $c->render_to_string(inline => $actionRemove) %>
|
||||
</td>
|
||||
<th><%= l 'pf_LABEL_PROTOCOL' %></th>
|
||||
<th><%= l 'pf_LABEL_SOURCE_PORT' %></th>
|
||||
<th><%= l 'pf_LABEL_DESTINATION_HOST' %></th>
|
||||
<th><%= l 'pf_LABEL_DESTINATION_PORT' %></th>
|
||||
<th><%= l 'pf_ALLOW_HOSTS' %></th>
|
||||
<th><%= l 'pf_RULE_COMMENT' %></th>
|
||||
<th class="text-center"><%= l 'ACTION' %></th>
|
||||
</tr>
|
||||
% }
|
||||
% }
|
||||
%}
|
||||
%}
|
||||
</tbody>
|
||||
</thead>
|
||||
<tbody>
|
||||
% my %forwards = ();
|
||||
% $forwards{TCP} = $tcpforwards;
|
||||
% $forwards{UDP} = $udpforwards;
|
||||
|
||||
% foreach my $proto (sort keys %forwards) {
|
||||
|
||||
% if (@{ $forwards{$proto} }) {
|
||||
% foreach my $entry (@{ $forwards{$proto} }) {
|
||||
<tr class="align-middle">
|
||||
% my $sport = $entry->key;
|
||||
% my $dhost = $entry->prop('DestHost');
|
||||
% my $dport = $entry->prop('DestPort') || '';
|
||||
% my $cmmnt = $entry->prop('Comment') || '';
|
||||
% my $allow = $entry->prop('AllowHosts') || '';
|
||||
<td><%= $proto %></td>
|
||||
<td><%= $sport %></td>
|
||||
<td><%= $dhost %></td>
|
||||
<td><%= $dport %></td>
|
||||
<td><%= $allow %></td>
|
||||
<td><%= $cmmnt %></td>
|
||||
% my $remove_text = l('REMOVE'); # Localized text
|
||||
% my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
% my $actionRemove = qq{
|
||||
% <a href="portforwardingd?CsrfDef=$csrf_token&trt=DEL&sport=$sport&proto=$proto">
|
||||
% <button type='button' class="btn btn-primary" title='$remove_text' >
|
||||
% $remove_text
|
||||
% </button>
|
||||
% </a>
|
||||
% };
|
||||
|
||||
<td class="text-center"><%= $c->render_to_string(inline => $actionRemove) %></td>
|
||||
</tr>
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
</tbody>
|
||||
</table>
|
||||
%= hidden_field 'trt' => $pf_datas->{trt}
|
||||
<%= hidden_field 'trt' => $pf_datas->{trt} %>
|
||||
|
||||
</div>
|
||||
|
@ -5,28 +5,29 @@
|
||||
<div class="card-body">
|
||||
|
||||
% if (config->{debug} == 1) {
|
||||
<p>
|
||||
%= dumper "<pf>".$c->current_route
|
||||
%= dumper $c->stash("ret")
|
||||
%= dumper $c->stash("portforwarding")
|
||||
% my $ref = $pf_datas->{portforwarding};
|
||||
%= dumper $ref->{TCP}->[0]."</pf>"
|
||||
</p>
|
||||
<pre>
|
||||
<%= dumper "<pf>".$c->current_route %>
|
||||
<%= dumper $c->stash("ret") %>
|
||||
<%= dumper $c->stash("portforwarding") %>
|
||||
% my $ref = $pf_datas->{portforwarding}; %>
|
||||
<%= dumper $ref->{TCP}->[0]."</pf>" %>
|
||||
</pre>
|
||||
% }
|
||||
|
||||
<h1><%= $title%></h1>
|
||||
%= $modul
|
||||
|
||||
%= $modul
|
||||
|
||||
% if ($pf_datas->{trt} eq 'ADD') {
|
||||
%= include 'partials/_pf_add'
|
||||
%} elsif ($pf_datas->{trt} eq 'ADD1') {
|
||||
%= include 'partials/_pf_add'
|
||||
%} elsif ($pf_datas->{trt} eq 'DEL') {
|
||||
%= include 'partials/_pf_del'
|
||||
%} elsif ($pf_datas->{trt} eq 'DEL1'){
|
||||
%= include 'partials/_pf_list'
|
||||
%} else {
|
||||
%= include 'partials/_pf_list'
|
||||
<%= include 'partials/_pf_add' %>
|
||||
% } elsif ($pf_datas->{trt} eq 'ADD1') {
|
||||
<%= include 'partials/_pf_add' %>
|
||||
% } elsif ($pf_datas->{trt} eq 'DEL') {
|
||||
<%= include 'partials/_pf_del' %>
|
||||
% } elsif ($pf_datas->{trt} eq 'DEL1'){
|
||||
<%= include 'partials/_pf_list' %>
|
||||
% } else {
|
||||
<%= include 'partials/_pf_list' %>
|
||||
%}
|
||||
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user