Move more code to html and work on forms
This commit is contained in:
parent
b42afb227a
commit
0d7f87c6aa
@ -14,7 +14,7 @@
|
||||
% if ( stash 'error' ) {
|
||||
<br><div class="">
|
||||
%= $c->render_to_string(inline => stash 'error')
|
||||
</div>
|
||||
</div>
|
||||
%}
|
||||
|
||||
<h1><%= $title%></h1>
|
||||
|
@ -12,6 +12,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
%= content_for 'head_contrib'
|
||||
|
||||
% if (config 'hasJquery') {
|
||||
%= include 'partials/_js_imports'
|
||||
%= include 'common_js'
|
||||
@ -28,9 +29,6 @@
|
||||
%= include 'partials/_nutups_overrides'
|
||||
% }
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="sidebar-expand-lg bg-body-tertiary">
|
||||
|
@ -1,7 +1,6 @@
|
||||
<div>
|
||||
<!--<HR class="">-->
|
||||
<a href="https://mojolicious.org" target="_blank"><img src="images/sme-mojo-logo-white.png" style="position:relative;"></a>
|
||||
<font>
|
||||
% if ( $c->is_logged_in && $c->is_admin) {
|
||||
SME Server <%= session 'releaseVersion' %>-<%= $c->app->VERSION %> Manager II
|
||||
% my $mode;
|
||||
@ -11,4 +10,3 @@
|
||||
<br>Copyright 1999-2006 Mitel Corporation<br>
|
||||
%= session 'copyRight'
|
||||
<br>Copyright (c) 2013-2024 Koozali Foundation Inc.<br>
|
||||
</font>
|
@ -1,40 +1,34 @@
|
||||
|
||||
<!-- Both Theme drop downs but only the first works curently -->
|
||||
|
||||
<div id="">
|
||||
% my $btn = l('swt_THEME');
|
||||
%= form_for $c->url_for('swttheme') => (method => 'POST') => begin
|
||||
% my $value = $c->session->{'CurrentTheme'};
|
||||
% $value = session 'CurrentTheme';
|
||||
<div>
|
||||
%# content_for 'module' => begin
|
||||
|
||||
% param 'Theme' => $value unless param 'Theme';
|
||||
%= select_field 'Theme' => $c->theme_list(), class => ""
|
||||
%= hidden_field 'From' => $c->tx->req->url
|
||||
%= submit_button "$btn"
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%# my $value = $c->session->{'CurrentTheme'};
|
||||
% my $value = $c->session->{'CurrentTheme'};
|
||||
% $value = session 'CurrentTheme';
|
||||
% my $formUrl = $c->url_for('swttheme');
|
||||
% param 'Theme' => $value unless param 'Theme';
|
||||
% my @themes = $c->theme_list();
|
||||
|
||||
%# my @themes = $c->theme_list();
|
||||
|
||||
%#= dumper $c
|
||||
|
||||
%#= my $size = keys ($c->theme_list)
|
||||
|
||||
% my @themeList = $c->theme_list();
|
||||
%# = dumper @themeList
|
||||
% my @themes = $themeList[0];
|
||||
|
||||
|
||||
% param 'Theme' => $value unless param 'Theme';
|
||||
|
||||
<form action="<%= $formUrl %>" method="POST" >
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-auto">
|
||||
<label class="visually-hidden" for="inlineFormSelectPref">Preference</label>
|
||||
<select class="form-select" id="inlineFormSelectPref">
|
||||
<option selected><%= $value %></option>
|
||||
% foreach my $theme (@themes) {
|
||||
<option value="<%= $theme %>"><%= $theme %></option>
|
||||
% };
|
||||
</select>
|
||||
|
||||
%= select_field 'Theme' => $c->theme_list(), class => "form-select"
|
||||
|
||||
%= hidden_field 'From' => $c->tx->req->url
|
||||
</div>
|
||||
|
||||
@ -45,4 +39,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
% end
|
||||
%# end
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -5,10 +5,9 @@
|
||||
|
||||
%= form_for '/useraccounts' => (method => 'POST') => begin
|
||||
|
||||
<p>
|
||||
<br>
|
||||
%= submit_button "$btn", class => ""
|
||||
</p>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary"><%= $btn %> </button>
|
||||
</div>
|
||||
|
||||
% end
|
||||
|
||||
@ -23,132 +22,134 @@
|
||||
% } else {
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
%=l 'ACCOUNT'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'USER_NAME'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'usr_VPN_CLIENT_ACCESS'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'usr_FORWARDING_ADDRESS'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'ACTION'
|
||||
</th>
|
||||
</tr>
|
||||
</thead><tbody>
|
||||
|
||||
% foreach my $user (@$users) {
|
||||
|
||||
% my $username = $user->key();
|
||||
% my $first = $user->prop('FirstName');
|
||||
% my $last = $user->prop('LastName');
|
||||
% my $lockable = $user->prop('Lockable') || 'yes';
|
||||
% my $removable = $user->prop('Removable') || 'yes';
|
||||
% my $fwd = (($user->prop('EmailForward') || 'local') =~ m/^forward|both$/) ?
|
||||
% $user->prop('ForwardAddress') : '';
|
||||
% my $vpnaccess = $user->prop('VPNClientAccess') || 'no';
|
||||
% $vpnaccess = $vpnaccess eq 'yes' ? $c->l('YES') : $c->l('NO');
|
||||
% my $password_set = $user->prop('PasswordSet');
|
||||
|
||||
<tr>
|
||||
%= t td => (class => "") => $username
|
||||
%= t td => (class => "") => "$first $last"
|
||||
%= t td => (class => "") => $vpnaccess
|
||||
%= t td => (class => "") => $fwd
|
||||
% my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = ' ';
|
||||
% my $modify_text = l('MODIFY'); # Localized text
|
||||
% my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
|
||||
% my $password_text = l("PASSWORD_RESET");
|
||||
%if ($useraccounts_user_name eq 'admin') {
|
||||
%$actionModify = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name">
|
||||
% <button type='button' class="" title='$modify_text'>
|
||||
% $modify_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%$actionResetPw = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWS&user=$useraccounts_user_name">
|
||||
% <button type='button' class="" title='$password_text' >
|
||||
% $password_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%} else {
|
||||
%$actionModify = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPD&user=$useraccounts_user_name">
|
||||
% <button type='button' class="" title='$modify_text' >
|
||||
% $modify_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%}
|
||||
%if ($password_set ne 'yes') {
|
||||
%$actionLock = l('ACCOUNT_LOCKED');
|
||||
%$actionResetPw = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
|
||||
% <button type='button' class="" title="$password_text - currently unset" style = background:pink; >
|
||||
% $password_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%} elsif ($useraccounts_user_name ne 'admin') {
|
||||
% my $lock_text = l('ACCOUNT LOCKED'); # Localized text
|
||||
% my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
|
||||
%$actionLock = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=LCK&user=$useraccounts_user_name">
|
||||
% <button type='button' class="" title='$lock_text' >
|
||||
% $lock_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%$actionResetPw = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
|
||||
% <button type='button' class="" title='$password_text' >
|
||||
% $password_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%}
|
||||
%if ( $removable eq 'yes' ) {
|
||||
% my $remove_text = l('REMOVE'); # Localized text
|
||||
% my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
%$actionRemove = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=DEL&user=$useraccounts_user_name">
|
||||
% <button type='button' class="" title='$remove_text' >
|
||||
% $remove_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%}
|
||||
|
||||
% my $thisdomain = $c->req->url->to_abs->host;
|
||||
% my $roundcube_text = l('Webmail'); # Localized text
|
||||
% $csrf_token = "TOKEN"; # CSRF token for security
|
||||
% $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
|
||||
% $actionroundcube = qq{
|
||||
%<a href="roundcubepanel?CsrfDef=$csrf_token&url=https://$thisdomain/roundcube?_user=$useraccounts_user_name&height=600px">
|
||||
% <button type='button' class="" title='$roundcube_text' >
|
||||
% $roundcube_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
<td class="">
|
||||
<%= $c->render_to_string(inline => $actionModify) %>
|
||||
<%= $c->render_to_string(inline => $actionResetPw) %>
|
||||
<%= $c->render_to_string(inline => $actionLock) %>
|
||||
<%= $c->render_to_string(inline => $actionRemove) %>
|
||||
<%= $c->render_to_string(inline => $actionroundcube) %>
|
||||
</td>
|
||||
<th>
|
||||
%=l 'ACCOUNT'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'USER_NAME'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'usr_VPN_CLIENT_ACCESS'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'usr_FORWARDING_ADDRESS'
|
||||
</th>
|
||||
<th>
|
||||
%=l 'ACTION'
|
||||
</th>
|
||||
</tr>
|
||||
% }
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
% foreach my $user (@$users) {
|
||||
|
||||
% my $username = $user->key();
|
||||
% my $first = $user->prop('FirstName');
|
||||
% my $last = $user->prop('LastName');
|
||||
% my $lockable = $user->prop('Lockable') || 'yes';
|
||||
% my $removable = $user->prop('Removable') || 'yes';
|
||||
% my $fwd = (($user->prop('EmailForward') || 'local') =~ m/^forward|both$/) ?
|
||||
% $user->prop('ForwardAddress') : '';
|
||||
% my $vpnaccess = $user->prop('VPNClientAccess') || 'no';
|
||||
% $vpnaccess = $vpnaccess eq 'yes' ? $c->l('YES') : $c->l('NO');
|
||||
% my $password_set = $user->prop('PasswordSet');
|
||||
|
||||
<tr>
|
||||
<td><%= $username %></td>
|
||||
<td><%=$first %> <%=$last %></td>
|
||||
<td><%= $vpnaccess %></td>
|
||||
<td><%= $fwd %></td>
|
||||
|
||||
% my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = ' ';
|
||||
% my $modify_text = l('MODIFY'); # Localized text
|
||||
% my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
|
||||
% my $password_text = l("PASSWORD_RESET");
|
||||
%if ($useraccounts_user_name eq 'admin') {
|
||||
%$actionModify = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name">
|
||||
% <button type='button' class="btn btn-primary" title='$modify_text'>
|
||||
% $modify_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%$actionResetPw = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWS&user=$useraccounts_user_name">
|
||||
% <button type='button' class="btn btn-primary" title='$password_text' >
|
||||
% $password_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%} else {
|
||||
%$actionModify = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPD&user=$useraccounts_user_name">
|
||||
% <button type='button' class="btn btn-primary" title='$modify_text' >
|
||||
% $modify_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%}
|
||||
%if ($password_set ne 'yes') {
|
||||
%$actionLock = l('ACCOUNT_LOCKED');
|
||||
%$actionResetPw = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
|
||||
% <button type='button' class="btn btn-primary" title="$password_text - currently unset" style = background:pink; >
|
||||
% $password_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%} elsif ($useraccounts_user_name ne 'admin') {
|
||||
% my $lock_text = l('ACCOUNT LOCKED'); # Localized text
|
||||
% my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
|
||||
%$actionLock = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=LCK&user=$useraccounts_user_name">
|
||||
% <button type='button' class="btn btn-primary" title='$lock_text' >
|
||||
% $lock_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%$actionResetPw = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
|
||||
% <button type='button' class="btn btn-primary" title='$password_text' >
|
||||
% $password_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%}
|
||||
%if ( $removable eq 'yes' ) {
|
||||
% my $remove_text = l('REMOVE'); # Localized text
|
||||
% my $csrf_token = "TOKEN"; # CSRF token for security
|
||||
%$actionRemove = qq{
|
||||
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=DEL&user=$useraccounts_user_name">
|
||||
% <button type='button' class="btn btn-primary" title='$remove_text' >
|
||||
% $remove_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
%}
|
||||
|
||||
% my $thisdomain = $c->req->url->to_abs->host;
|
||||
% my $roundcube_text = l('Webmail'); # Localized text
|
||||
% $csrf_token = "TOKEN"; # CSRF token for security
|
||||
% $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
|
||||
% $actionroundcube = qq{
|
||||
%<a href="roundcubepanel?CsrfDef=$csrf_token&url=https://$thisdomain/roundcube?_user=$useraccounts_user_name&height=600px">
|
||||
% <button type='button' class="btn btn-primary" title='$roundcube_text' >
|
||||
% $roundcube_text
|
||||
% </button>
|
||||
%</a>
|
||||
%};
|
||||
<td>
|
||||
<%= $c->render_to_string(inline => $actionModify) %>
|
||||
<%= $c->render_to_string(inline => $actionResetPw) %>
|
||||
<%= $c->render_to_string(inline => $actionLock) %>
|
||||
<%= $c->render_to_string(inline => $actionRemove) %>
|
||||
<%= $c->render_to_string(inline => $actionroundcube) %>
|
||||
</td>
|
||||
</tr>
|
||||
% }
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -157,3 +158,8 @@
|
||||
%= hidden_field 'trt' => $usr_datas->{trt}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
</div>
|
@ -1,3 +1,99 @@
|
||||
% content_for 'module' => begin
|
||||
|
||||
<div class="container-sm">
|
||||
<br>
|
||||
<h2><%= l 'usr_MODIFY_ADMIN_TITLE' %></h2>
|
||||
|
||||
<%= l 'usr_ACCOUNT_NAME' %> : <%= $usr_datas->{user} %>
|
||||
|
||||
|
||||
|
||||
<form>
|
||||
% param 'FirstName' => $usr_datas->{firstname} unless param 'FirstName';
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-auto p-33">
|
||||
<label for="inputFirstName" class="col-form-label"><%= l 'usr_FIRSTNAME' %></label>
|
||||
</div>
|
||||
<div class="col-auto p-3">
|
||||
<input type="text" id="inputFirstName" class="form-control" aria-describedby="FirstName" value=<%= $usr_datas->{firstname} %> >
|
||||
</div>
|
||||
<div class="col-auto p-3">
|
||||
<span id="passwordHelpInline" class="form-text">
|
||||
First Name
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
% param 'LastName' => $usr_datas->{lastname} unless param 'LastName';
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-auto p-33">
|
||||
<label for="inputLastNAme" class="col-form-label"><%= l 'usr_LASTNAME' %></label>
|
||||
</div>
|
||||
<div class="col-auto p-3">
|
||||
<input type="text" id="inputLastName" class="form-control" aria-describedby="LastName" value=<%= $usr_datas->{lastname} %>>
|
||||
</div>
|
||||
<div class="col-auto p-3">
|
||||
<span id="passwordHelpInline" class="form-text">
|
||||
Last Name
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
% param 'EmailForward' => $usr_datas->{emailforward} unless param 'EmailForward';
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-auto p-33">
|
||||
<label for="inputEmailDelivery" class="col-form-label"><%= l 'usr_EMAIL_DELIVERY' %></label>
|
||||
</div>
|
||||
<div class="col-auto p-3">
|
||||
%= select_field 'EmailForward' => $c->emailForward_list(), class => "form-select"
|
||||
</div>
|
||||
|
||||
|
||||
% param 'ForwardAddress' => $usr_datas->{forwardaddress} unless param 'ForwardAddress';
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-auto">
|
||||
<label for="inputForwardAddress" class="col-form-label"><%= l 'usr_FORWARDING_ADDRESS' %></label>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="password" id="inputPassword6" class="form-control" aria-describedby="passwordHelpInline">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span id="passwordHelpInline" class="form-text">
|
||||
Email forwarding address
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
% param 'VPNClientAccess' => $usr_datas->{vpnclientaccess} unless param 'VPNClientAccess';
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-auto p-33">
|
||||
<label for="inputVPNClientAccess" class="col-form-label"><%= l 'usr_VPN_CLIENT_ACCESS' %></label>
|
||||
</div>
|
||||
<div class="col-auto p-3">
|
||||
%= select_field 'VPNClientAccess' => [[ (l 'NO') => 'no'], [ (l 'YES') => 'yes']], class => "form-select"
|
||||
</div>
|
||||
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-auto p-33">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
% end
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
% my $btn = l('SAVE');
|
||||
|
@ -3,9 +3,6 @@
|
||||
% content_for 'module' => begin
|
||||
|
||||
|
||||
%#= include 'partials/_panel_card_top'
|
||||
%#= include 'partials/_panel_card_header'
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<h1> <%= $title %> </h1>
|
||||
@ -25,7 +22,5 @@
|
||||
|
||||
</div>
|
||||
|
||||
%#= include 'partials/_panel_card_footer'
|
||||
%#= include 'partials/_panel_card_bottom'
|
||||
|
||||
% end
|
@ -1,6 +1,6 @@
|
||||
%define name smeserver-manager-AdminLTE
|
||||
%define version 11.0.0
|
||||
%define release 8
|
||||
%define release 9
|
||||
Summary: AdminLTE is an html framework for admin consoles - this rpm adds it to smeserver manager2
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
@ -26,6 +26,11 @@ AdminLTE is an html framework for admin consoles
|
||||
wget https://github.com/ColorlibHQ/AdminLTE/archive/master.zip
|
||||
|
||||
%changelog
|
||||
* Sat Apr 19 2025 John Crisp <jcrisp@safeandsoundit.co.uk> 11.0.0-9.sme
|
||||
- Starting to update forms
|
||||
- Moving as much formatting to simple html as possible
|
||||
- Use Mojo helpers for some parts eg theme chooser - may come back to that
|
||||
|
||||
* Fri Apr 18 2025 John Crisp <jcrisp@safeandsoundit.co.uk> 11.0.0-8.sme
|
||||
- More cleanup
|
||||
- Add Card support across all panels except login
|
||||
|
Loading…
x
Reference in New Issue
Block a user