From d218eb176ba3c2b6b512fca84c12c2004347d399 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Wed, 10 Jul 2024 17:04:36 +0000
Subject: [PATCH] Bug 37311: Tone down the SMTP servers administration page

This patch makes some structural and style changes to the SMTP servers
page to show information in a way that doesn't imply that the user has
to take action on it.

I also added an "Edit" link to the "current default configuration"
information section so that users wouldn't have to search through the
list of servers to find the right edit link..

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface)

- Go to Administration -> SMTP servers.
- If necessary, add multiple SMTP servers:
  - One in debug mode
  - One which isn't in debug mode
  - One which is the default
- Confirm that the list of SMTP servers looks good and that it's still
  easy to tell which servers are in debug mode and which is the default.
  - Confirm that the new "Edit" link in that area works correctly.
- Confirm that the display of the current default configuration looks
  good.
  - Test how this information looks when editing an existing server.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
---
 .../intranet-tmpl/prog/css/src/_tables.scss   |  8 -----
 .../prog/en/modules/admin/smtp_servers.tt     | 36 ++++++++++---------
 2 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/_tables.scss b/koha-tmpl/intranet-tmpl/prog/css/src/_tables.scss
index 504b005eb6..c3d1297bff 100644
--- a/koha-tmpl/intranet-tmpl/prog/css/src/_tables.scss
+++ b/koha-tmpl/intranet-tmpl/prog/css/src/_tables.scss
@@ -354,14 +354,6 @@ tr {
             font-weight: bold;
         }
     }
-
-    &.debug {
-        td {
-            color: #CC0000;
-            font-style: italic;
-            font-weight: bold;
-        }
-    }
 }
 
 .selections-table {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
index 83f76569db..e09e0828ca 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
@@ -255,6 +255,7 @@
 
     [% IF servers_count > 0 %]
         <div class="page-section">
+            <h3>All SMTP servers</h3>
             <table id="smtp_servers">
                 <thead>
                     <tr>
@@ -404,7 +405,7 @@
                                 return "[% tp("Active", "On") | html %]";
                             }
                             else {
-                                return _("Off");
+                                return _("");
                             }
                         },
                         "searchable": false,
@@ -413,10 +414,9 @@
                     {
                         "data": function( row, type, val, meta ) {
                             if ( row.is_default ) {
-                                return _("Yes");
-                            }
-                            else {
-                                return _("No");
+                                return _("Default");
+                            } else {
+                                return "";
                             }
                         },
                         "searchable": false,
@@ -434,7 +434,7 @@
                 ],
                 createdRow: function (row, data, dataIndex) {
                     if ( data.is_default ) {
-                        $(row).addClass('default warn');
+                        $(row).addClass('default');
                     }
                     if ( data.debug ) {
                         $(row).addClass('debug');
@@ -488,16 +488,20 @@
 [% END %]
 
 [% BLOCK default_server_info %]
-    <div class="alert alert-info" id="default_server_message">
-        <p>Current default configuration:</p>
-
-        <ul>
-            <li><strong>Host</strong>: [%- default_config.host | html -%]</li>
-            <li><strong>Port</strong>: [%- default_config.port | html -%]</li>
-            <li><strong>Timeout (secs)</strong>: [%- default_config.timeout | html -%]</li>
-            <li><strong>SSL</strong>: [%- IF default_config.ssl_mode == 'disabled' -%]<span>Disabled</span>[%- ELSIF default_config.ssl_mode == 'ssl' -%]<span>SSL</span>[%- ELSE -%]<span>STARTTLS</span>[%- END -%]</li>
-            <li><strong>Debug mode</strong>: [%- IF default_config.debug -%]Yes[%- ELSE -%]No[%- END -%]</li>
-        </ul>
+    <div class="page-section">
+        <div class="rows" id="default_server_message">
+            <h2>Current default configuration</h2>
+            <ul>
+                <li><span class="label">Host: </span> [%- default_config.host | html -%]</li>
+                <li><span class="label">Port: </span> [%- default_config.port | html -%]</li>
+                <li><span class="label">Timeout (secs): </span> [%- default_config.timeout | html -%]</li>
+                <li><span class="label">SSL: </span> [%- IF default_config.ssl_mode == 'disabled' -%]<span>Disabled</span>[%- ELSIF default_config.ssl_mode == 'ssl' -%]<span>SSL</span>[%- ELSE -%]<span>STARTTLS</span>[%- END -%]</li>
+                <li><span class="label">Debug mode: </span> [%- IF default_config.debug -%]Yes[%- ELSE -%]No[%- END -%]</li>
+                [% IF op == 'list' %]
+                    <li><a href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id=[% default_config.id | uri %]"><i class="fa fa-pencil"></i> Edit</a></li>
+                [% END %]
+            </ul>
+        </div>
     </div>
 [% END %]
 
-- 
2.39.2