Edit template for controller - Refine params copy and bring DB opens up to spec with UTF8

This commit is contained in:
2025-10-06 10:57:00 +01:00
parent 29f8de63fd
commit ecb846fc6c
119 changed files with 10059 additions and 36 deletions

View File

@@ -0,0 +1,84 @@
<div id="hos_list">
% my $btn = l("hos_ADD_HOSTNAME");
%= form_for "/hostentries" => (method => "POST") => begin
<p>
%= submit_button "$btn", class => "action"
<br></p>
%= hidden_field "trt" => $hos_datas->{trt}
% end
% my %dom_hos = %{$dom_hosts};
% foreach my $domain ( sort ( keys %dom_hos ) ) {
<p><br><b>
%= $c->l("hos_CURRENT_HOSTNAMES_FOR_LOCAL_DOMAIN", $domain);
</b><br></p>
<table class="sme-border TableSort"><thead>
<tr>
<th class="sme-border">
%=l "Hostname"
</th>
<th class="sme-border">
%=l "Location"
</th>
<th class="sme-border">
%=l "IP_ADDRESS_OR_FQDN"
</th>
<th class="sme-border">
%=l "hos_ETHERNET_ADDRESS"
</th>
<th class="sme-border">
%=l "COMMENT"
</th>
<th class="sme-border">
%=l "ACTION"
</th>
</tr>
</thead><tbody>
% foreach (@{$dom_hos{$domain}{"HOSTS"}}) {
<tr>
%= t td => (class => "sme-border") => $_->{"HostName"};
%= t td => (class => "sme-border") => $_->{"HostType"};
%= t td => (class => "sme-border") => $_->{"IP"};
%= t td => (class => "sme-border") => $_->{"MACAddress"};
%= t td => (class => "sme-border") => $_->{"Comment"};
<td class="sme-border" style="min-width:15em">
%my ($actionModify, $actionRemove) = "&nbsp;";
%my $static = $_->{"static"} || "no";
%if ($static ne "yes") {
%my $modify_text = l("MODIFY"); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $hostentries_name = $_->{"HostName"}; # hostentries name extracted from the data structure
%$actionModify = qq{
% <a href="hostentriesd?CsrfDef=$csrf_token&trt=UPD&Hostname=$hostentries_name">
% <button type="button" class="sme-modify-button" title="$modify_text" >
% $modify_text
% </button>
% </a>
%};
%my $remove_text = l("REMOVE"); # Localized text
%$csrf_token = "TOKEN"; # CSRF token for security
%#my $hostentries_name = $_->{"HostName"}; # hostentries name extracted from the data structure
%$actionRemove = qq{
% <a href="hostentriesd?CsrfDef=$csrf_token&trt=DEL&Hostname=$hostentries_name">
% <button type="button" class="sme-remove-button" title="$remove_text" >
% $remove_text
% </button>
% </a>
%};
%}
<%= $c->render_to_string(inline => $actionModify) %> <%= $c->render_to_string(inline => $actionRemove) %>
</td>
</tr>
% }
</tbody>
</table>
% }
</div>

View File

@@ -0,0 +1,77 @@
<div id="hos_upd">
% my $btn = l("NEXT");
%= form_for "/hostentriesd" => (method => "POST") => begin
<p><h2>
% if ( $hos_datas->{trt} eq "ADD" ) {
%=l "hos_CREATE_TITLE"
% } else {
%=l "hos_MODIFY_TITLE"
% $btn = l("MODIFY");
% }
</h2></p>
<p>
%=l "Hostname_DESCRIPTION"
</p>
<p>
<span class=label>
%=l "Hostname", class => "label"
</span><span class=data>
% if ( $hos_datas->{trt} eq "ADD" ) {
% param "Name" => $hos_datas->{name} unless param "Name";
%= text_field "Name", class => "input"
% } else {
%= hidden_field "Name" => $hos_datas->{name}
%= $hos_datas->{name}, class => "data"
% }
</span>
</p>
<p>
<span class=label>
%=l "DOMAIN", class => "label"
</span><span class=data>
% if ( $hos_datas->{trt} eq "ADD" ) {
% param "Domain" => $hos_datas->{domain} unless param "Domain";
%= select_field "Domain", $c->domains_list(), class => "input"
% } else {
%= hidden_field "Domain" => $hos_datas->{domain}
%= $hos_datas->{domain}, class => "data"
% }
</span>
</p>
<p>
<span class=label>
%= $c->l("COMMENT", "");
</span><span class=data>
% param "Comment" => $hos_datas->{comment} unless param "Comment";
%= text_field "Comment", class => "input"
</span>
</p>
<p>
<span class=label>
%=l "LOCATION", class => "label"
</span><span class=data>
% param "Hosttype" => $hos_datas->{hosttype} unless param "Hosttype";
%= select_field "Hosttype", $c->hosttype_list(), class => "input"
</span>
</p>
<p><br>
%= submit_button "$btn", class => "action"
</p>
%= hidden_field "trt" => $hos_datas->{trt}
%= hidden_field "Hostname" => $hos_datas->{hostname}
%= hidden_field "Internalip" => $hos_datas->{internalip}
%= hidden_field "Externalip" => $hos_datas->{externalip}
%= hidden_field "Macaddress" => $hos_datas->{macaddress}
%end
</div>