Initial SM2 panels - WIP

This commit is contained in:
2025-05-19 12:51:54 +01:00
parent 12a24b7973
commit 76a4ff6b43
8 changed files with 709 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
/*
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-15 12:40:04
*/
.Remoteuseraccess-panel {}
.name {}
.rout {}
.head {}
.subh {}
.tabl1 {}
thead .tabl1 {}
tbody .tabl1 {}
.name {}
.rout {}
.head {}
.subh {}
.para1 {}
.para2 {}
.para3 {}
.para4 {}
.para5 {}
.text10 {}
.text11 {}
.sele1 {}
.sele2 {}
.sele3 {}
.sele4 {}
.text5 {}
.text6 {}
.subm7 {}

View File

@@ -0,0 +1,5 @@
//
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-15 12:40:04
//
$(document).ready(function() {
});

View File

@@ -0,0 +1,117 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-15 12:40:04
%#
<div id="Remoteuseraccess-PARAMS" class="partial Remoteuseraccess-PARAMS">
<!--
<script>
window.onload = function() {
SelectInput();
};
</script>
-->
% if (config->{debug} == 1) {
<pre>
%= dumper $rua_data
</pre>
% }
% my $btn = l('rua_APPLY');
%= form_for "remoteuseraccessu" => (method => 'POST') => begin
% param 'trt' => $rua_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $rua_data->{trt}
%= hidden_field 'Selected' => $c->param('Selected')
%# Inputs etc in here.
<h1 class='head'><%=l('rua_Change_user_remote_access_settings')%></h1>
<h2 class='subh'><%=l('rua_Edit_Remote_User_Access_settings:')%></h2>
<p class='paragraph para1'>
%=l('rua_Enabling_bash_shell_access_for')
</p>
<p class='paragraph para2'>
%=l('rua_Sudo_access_allows_users_to')
</p>
<p class='paragraph para3'>
%=l('rua_SHELL,_VPN_&amp;_FTP_access')
</p>
<p class='paragraph para4'>
%=l('rua_Select_an_FTP_Chroot_path')
</p>
<p class='paragraph para5'>
%=l('rua_Enter_the_public_SSH_Keys')
</p>
<p><span class=label>
%=l('rua_Account')
</span><span class=data>
% param 'Account' => $rua_data->{Account} unless param 'Account';
%= text_field 'Account', size => '50', class => 'textinput Account' , pattern=>'.*' , placeholder=>'Account', title =>'Pattern regex mismatch', id => 'Account_text'
<br></span></p>
<p><span class=label>
%=l('rua_User_Name')
</span><span class=data>
% param 'User_Name' => $rua_data->{User_Name} unless param 'User_Name';
%= text_field 'User_Name', size => '50', class => 'textinput User_Name' , pattern=>'.*' , placeholder=>'User_Name', title =>'Pattern regex mismatch', id => 'User_Name_text'
<br></span></p>
<p><span class=label>
%=l('rua_Shell_Access')
</span><span class=data>
% my @Shell_options = [['' => ''], ['/bin/bash' => '/bin/bash']];
% param 'Shell' => $rua_data->{Shell} unless param 'Shell';
%= select_field 'Shell' => @Shell_options, class => 'input', id => 'Shell_select'
<br></span> </p>
<p><span class=label>
%=l('rua_Sudo_Access')
</span><span class=data>
% my @Sudoer_options = [['No' => 'no'], ['Yes' => 'yes']];
% param 'Sudoer' => $rua_data->{Sudoer} unless param 'Sudoer';
%= select_field 'Sudoer' => @Sudoer_options, class => 'input', id => 'Sudoer_select'
<br></span> </p>
<p><span class=label>
%=l('rua_RSSH_+_VPN__ClientAccess')
</span><span class=data>
% my @VPNClientAccess_options = [['No' => 'no'], ['Yes' => 'yes']];
% param 'VPNClientAccess' => $rua_data->{VPNClientAccess} unless param 'VPNClientAccess';
%= select_field 'VPNClientAccess' => @VPNClientAccess_options, class => 'input', id => 'VPNClientAccess_select'
<br></span> </p>
<p><span class=label>
%=l('rua_Select_Chroot_path')
</span><span class=data>
% my @ChrootDir2_options = $c->get_chroot_dirs();
% param 'ChrootDir2' => $rua_data->{ChrootDir2} unless param 'ChrootDir2';
%= select_field 'ChrootDir2' => @ChrootDir2_options, class => 'input', id => 'ChrootDir2_select'
<br></span> </p>
<p><span class=label>
%=l('rua_ChrootDir')
</span><span class=data>
% param 'ChrootDir' => $rua_data->{ChrootDir} unless param 'ChrootDir';
%= text_field 'ChrootDir', size => '50', class => 'textinput ChrootDir' , pattern=>'.*' , placeholder=>'ChrootDir', title =>'Pattern regex mismatch', id => 'ChrootDir_text'
<br></span></p>
<p><span class=label>
%=l('rua_SSH_Keys')
</span><span class=data>
% param 'ssh_keys' => $rua_data->{ssh_keys} unless param 'ssh_keys';
%= text_area 'ssh_keys', cols=>40, rows=>10
<br></span></p>
<span class='data'>
%= submit_button l('rua_Save'), class => 'action subm7'
</span>
%# Probably finally by a submit.
%end
</div>

View File

@@ -0,0 +1,61 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-15 12:40:04
%#
<div id="Remoteuseraccess-USERTABLE" class="partial Remoteuseraccess-USERTABLE">
<script>
window.onload = function() {
SelectInput();
};
</script>
% if (config->{debug} == 1) {
<pre>
%= dumper $rua_data
</pre>
% }
% my $btn = l('rua_APPLY');
% $c->param(Selected => undef);
%= form_for "remoteuseraccessu" => (method => 'POST') => begin
% param 'trt' => $rua_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $rua_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('rua_Change_user_remote_access_settings')%></h1>
<h2 class='subh'><%=l('rua_Current_list_of_users')%></h2>
<br /><table class="sme-border TableSort sme-table tabl1 ">
<thead class='tabl1'>
<tr table-head-row>
<th class='sme-border table-head-col table-head-col-Account '><%=l('rua_Account')%></th>
<th class='sme-border table-head-col table-head-col-User Name '><%=l('rua_User_Name')%></th>
<th class='sme-border table-head-col table-head-col-Shell Access '><%=l('rua_Shell_Access')%></th>
<th class='sme-border table-head-col table-head-col-Sudo '><%=l('rua_Sudo')%></th>
<th class='sme-border table-head-col table-head-col-SSH Keys '><%=l('rua_SSH_Keys')%></th>
<th class='sme-border table-head-col table-head-col-Chroot Path '><%=l('rua_Chroot_Path')%></th>
<th class='sme-border table-head-col table-head-col-RSSH + VPN Access '><%=l('rua_RSSH_+_VPN_Access')%></th>
<th class='sme-border table-head-col table-head-col-Modify '><%=l('rua_Modify')%></th>
</tr>
</thead>
<tbody class='tabl1'>
% my $control_data = $c->stash('getAllUsers');
% foreach my $row (@$control_data) {
<tr class='table-row'>
<td class='sme-border table-col table-col-Account'><%=$c->render_to_string(inline=>$row->{'Account'})%></td>
<td class='sme-border table-col table-col-User_Name'><%=$c->render_to_string(inline=>$row->{'User_Name'})%></td>
<td class='sme-border table-col table-col-Shell_Access'><%=$c->render_to_string(inline=>$row->{'Shell_Access'})%></td>
<td class='sme-border table-col table-col-Sudo'><%=$c->render_to_string(inline=>$row->{'Sudo'})%></td>
<td class='sme-border table-col table-col-SSH_Keys'><%=$c->render_to_string(inline=>$row->{'SSH_Keys'})%></td>
<td class='sme-border table-col table-col-Chroot_Path'><%=$c->render_to_string(inline=>$row->{'Chroot_Path'})%></td>
<td class='sme-border table-col table-col-RSSH_+_VPN_Access'><%=$c->render_to_string(inline=>$row->{'RSSH_+_VPN_Access'})%></td>
<td class='sme-border table-col table-col-Modify'><%=$c->render_to_string(inline=>$row->{'Modify'})%></td>
</tr>
%}
</tbody>
</table>
%# Probably finally by a submit.
%end
</div>

View File

@@ -0,0 +1,60 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-15 12:40:04
%#
% layout 'default', title => "Sme server 2 - User Remote access", share_dir => './';
%# css specific to this panel:
% content_for 'module' => begin
%= stylesheet '/css/remoteuseraccess.css'
%= javascript '/js/remoteuseraccess.js'
<div id="module" class="module Remoteuseraccess-panel">
% if (config->{debug} == 1) {
<pre>
%= dumper $c->current_route
%= dumper $rua_data->{trt}
</pre>
% }
<h1><%=$title%></h1>
% if ( stash('modul')) {
%= $c->render_to_string(inline => stash('modul') );
% }
%if ($c->stash('first')) {
<br><p>
%=$c->render_to_string(inline =>$c->l($c->stash('first')))
</p>
%} elsif ($c->stash('success')) {
<div class='success '>
<p>
%= $c->l($c->stash('success'));
</p>
</div>
<br />
%} elsif ($c->stash('error')) {
<div class='sme-error'>
<p>
%= $c->l($c->stash('error'));
</p>
</div>
<br />
%}
%#Routing to partials according to trt parameter.
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
% if ($rua_data->{trt} eq "USERTABLE") {
%= include 'partials/_rua_USERTABLE'
%}
% if ($rua_data->{trt} eq "PARAMS") {
%= include 'partials/_rua_PARAMS'
%}
</div>
%end