Finish Backup add Printers and small tweaks

This commit is contained in:
John Crisp
2025-06-12 18:52:32 +02:00
parent f3295483b2
commit 91105c83c9
9 changed files with 210 additions and 174 deletions

View File

@@ -8,7 +8,7 @@
% my %ret;
% unless (length($retref)) {%ret = (ret=>"");}
% else {%ret = %$retref;}
<!-- So at this point the next section is only relevant it ret is not defined -->
%# my $element_count = scalar(@ret);
@@ -40,9 +40,9 @@
% }
<br><br>
% my $btn = l('ln_LOCALNETWORK_ADD');
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
@@ -50,7 +50,7 @@
</div>
<br>
% my $numlocalnetworks = @$localnetworks;
% if ($numlocalnetworks == 0) {
<%= l 'ln_LOCAL_NETWORK_NONE' %>
@@ -72,11 +72,11 @@
% my $removable = $localnetwork->prop('Removable') || "yes";
% my $system = $localnetwork->prop('SystemLocalNetwork') || "no";
% if ( $system eq "yes" ) { $removable = "no"; }
<tr>
<td><%= $localnetwork->key %>
<td><%= $localnetwork->prop('Mask') %>
<td><%= $num_hosts %>
<td><%= $localnetwork->prop('Router') %>
<tr class="align-middle">
<td><%= $localnetwork->key %></td>
<td><%= $localnetwork->prop('Mask') %></td>
<td><%= $num_hosts %></td>
<td><%= $localnetwork->prop('Router') %></td>
% my $actionRemove = '&nbsp;';
% if ($removable eq "yes") {
%my $remove_text = l('REMOVE'); # Localized text
@@ -97,6 +97,6 @@
</table>
<%= hidden_field 'trt' => $ln_datas->{trt} %>
% }
</form>
</div>

View File

@@ -1,51 +1,61 @@
<div>
% my $btn = l('ADD');
<h2><%=l 'prt_CREATE_NEW_PRINTER' %></h2>
%= form_for '/printers2' => (method => 'POST') => begin
<p>
<h2>
%=l 'prt_CREATE_NEW_PRINTER'
</h2>
<br>
%=l 'prt_CREATE_NEW_DESC'
</p>
<br>
<p>
<span class="">
%=l 'prt_PRINTER_NAME', class => ""
</span>
<span class="">
%= text_field 'Name', class => ""
</span>
</p>
<form action="/smanager/printers2" method="POST">
<p>
<span class="">
%=l 'DESCRIPTION_BRIEF', class => ""
</span>
<span class="">
%= text_field 'Description', class => ""
</span>
</p>
<br>
<p>
<span class="">
%=l 'LOCATION', class => ""
</span>
<span class="">
%= select_field 'Location' => $c->printerLocation_list(), class => ""
</span>
</p>
<div>
<%= l 'prt_CREATE_NEW_DESC' %>
</div>
<p>
<br><br>
%= submit_button "$btn", class => ""
</p>
<br>
%= hidden_field 'trt' => $prt_datas->{trt}
% end
<div class="row g-3 align-items-center">
<div class="col-md-1">
<label for="inputPrinterName" class="col-form-label"><%= l 'prt_PRINTER_NAME' %></label>
</div>
<div class="col-auto">
<input type="text" name="Name" id="inputPrinterName" class="form-control" aria-describedby="Printer Name">
</div>
</div>
<br>
<div class="row g-3 align-items-center">
<div class="col-md-1">
<label for="inputPrinterDesc" class="col-form-label"><%= l 'DESCRIPTION_BRIEF' %></label>
</div>
<div class="col-auto">
<input type="text" name="Description" id="inputPrinterDesc" class="form-control" aria-describedby="Printer Description">
</div>
</div>
<br>
<div class="row g-3 align-items-center">
<div class="col-md-1">
<%= l 'LOCATION'%>
</div>
<div class="col-auto">
<%= select_field 'Location' => $c->printerLocation_list(), class => "form-select" %>
</div>
</div>
<br><br>
<%= hidden_field 'trt' => $prt_datas->{trt} %>
% my $btn = l('ADD');
<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>

View File

@@ -1,30 +1,38 @@
<div>
% my $btn = l('REMOVE');
%= form_for '/printers2' => (method => 'POST') => begin
<p>
<h2>
%=l 'prt_REMOVE_PRINTER'
</h2>
<br><br>
<%=l 'prt_ABOUT_TO_REMOVE'%> <%=$prt_datas->{printer}%>
(<%=$prt_datas->{description}%>)
<h2><%= l 'prt_REMOVE_PRINTER' %></h2>
<form action="/smanager/printers2" method="POST">
<br>
%=l 'prt_SPOOL_FILE_WARNING'
<div>
<%= l 'prt_ABOUT_TO_REMOVE'%> <%=$prt_datas->{printer}%> (<%=$prt_datas->{description}%>)
</div>
<br>
%=l 'prt_ARE_YOU_SURE'
</p>
<div class="text-danger">
<%= l 'prt_SPOOL_FILE_WARNING' %>
</div>
<p>
<br>
%= submit_button "$btn", class => ""
</p>
<div>
<%= l 'prt_ARE_YOU_SURE' %>
</div>
<br>
%= hidden_field 'trt' => $prt_datas->{trt}
%= hidden_field 'printer' => $prt_datas->{printer}
% end
% my $btn = l('REMOVE');
<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>

View File

@@ -1,82 +1,72 @@
<div>
% my $btn = l('prt_INITIAL_BTN');
%= form_for '/printers' => (method => 'POST') => begin
%= hidden_field 'trt' => 'ADD'
<p>
<br>
%= submit_button "$btn", class => ""
</p>
% end
<p>
<h2>
%=l 'prt_CURRENT_LIST'
</h2>
<form action="/smanager/printers" method="POST">
% my $btn = l('prt_INITIAL_BTN');
<%= hidden_field 'trt' => 'ADD' %>
<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>
<br>
<h2><%= l 'prt_CURRENT_LIST' %></h2>
<br><br>
% my $numPrinters = @$printerDrivers;
% if ($numPrinters == 0){
%=l 'prt_NO_PRINTERS'
% } else {
<table class="table table-bordered">
<thead>
<tr>
<th class="">
%=l 'NAME'
</th>
<th class="">
%=l 'DESCRIPTION'
</th>
<th class="">
%=l 'LOCATION'
</th>
<th class="">
%=l 'prt_REMOTE_ADDRESS'
</th>
<th class="">
%=l 'prt_REMOTE_NAME'
</th>
<th class="">
%=l 'ACTION'
</th>
</tr>
</thead>
<tbody>
% foreach my $printer (@$printerDrivers)
% {
% my $address = ($printer->prop('Location') eq 'remote')
% ? $printer->prop('Address') : 'N/A';
% my $remoteName = ($printer->prop('Location') eq 'remote')
% ? $printer->prop('RemoteName') : 'N/A';
% $remoteName = 'raw' unless ($remoteName);
<tr>
%= t td => (class => "") => $printer->key
%= t td => (class => "") => $printer->prop('Description')
%= t td => (class => "") => $printer->prop('Location')
%= t td => (class => "") => $address
%= t td => (class => "") => $remoteName
<td class="">
%my $remove_text = l('REMOVE'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $printer_name = $printer->key;
%my $actionRemove = qq{
% <a href="printers2?CsrfDef=$csrf_token&trt=DEL&&printer=$printer_name">
% <button type='button' class="" title='$remove_text' >
% $remove_text
% </button>
% </a>
%};
<%= $c->render_to_string(inline => $actionRemove) %>
</td>
</tr>
% }
</tbody>
</table>
<%} %>
</p>
% my $numPrinters = @$printerDrivers;
% if ($numPrinters == 0){
<%= l 'prt_NO_PRINTERS' %>
% } else {
<table class="table table-bordered">
<thead>
<tr>
<th><%= l 'NAME' %></th>
<th><%= l 'DESCRIPTION' %></th>
<th><%= l 'LOCATION' %></th>
<th><%= l 'prt_REMOTE_ADDRESS' %></th>
<th><%= l 'prt_REMOTE_NAME' %></th>
<th><%= l 'ACTION' %></th>
</tr>
</thead>
<tbody>
% foreach my $printer (@$printerDrivers) {
% my $address = ($printer->prop('Location') eq 'remote')
% ? $printer->prop('Address') : 'N/A';
% my $remoteName = ($printer->prop('Location') eq 'remote')
% ? $printer->prop('RemoteName') : 'N/A';
% $remoteName = 'raw' unless ($remoteName);
<tr class="align-middle">
<td><%= $printer->key %></td>
<td><%= $printer->prop('Description') %></td>
<td><%= $printer->prop('Location') %></td>
<td><%= $address %></td>
<td><%= $remoteName %></td>
<td>
% my $remove_text = l('REMOVE'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $printer_name = $printer->key;
% my $actionRemove = qq{
% <a href="printers2?CsrfDef=$csrf_token&trt=DEL&&printer=$printer_name">
% <button type='button' class="btn btn-primary" title='$remove_text' >
% $remove_text
% </button>
% </a>
% };
<%= $c->render_to_string(inline => $actionRemove) %>
</td>
</tr>
% }
</tbody>
</table>
% }
</div>

View File

@@ -22,7 +22,7 @@
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr class="">
<tr>
<th><%=l 'ACCOUNT' %></th>
<th><%=l 'USER_NAME' %></th>
<th><%=l 'usr_VPN_CLIENT_ACCESS' %></th>
@@ -54,7 +54,7 @@
% my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = '&nbsp;';
% my $thisdomain = $c->req->url->to_abs->host;
<tr>
<tr class="align-middle">
<td><%= $username %></td>
<td><%= $first %>&nbsp<%=$last %></td>
<td><%= $vpnaccess %></td>