Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
Victor Grousset/tuxayo 7758a0248e
Bug 30733: Simplify translatable strings
And a few minor fixes when they where causing issues for
translatability.
And rephrased a string about password reset to have it identical to
other strings with the same meaning.

Simplified via wrapping strings with <span> to split to huge
concatenated strings with a lot of %s everywhere.

== Test plan ==
This patch needs mainly proof reading. Still it's possible to do some
basic testing to demonstrate that adding a <span> in an IF doesn't
break anything.
Pick in one of the 110 modified templates a string that you know how to
display. Otherwise:
1. acquisitions => vendor => basket => add to basket =>
   search "from existing record" => add order
2. Cancel the order
3. You see without issue "Bibliographic record will not be deleted"
4. administration => Patron categories
5. Try to delete a used and unused category
6. You see as expected
   Category XXXX is in use. Deletion not possible!
   and
   Confirm deletion of category XXXX

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-17 10:16:34 -03:00

422 lines
18 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE raw %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
[% IF op == 'add_form' %]
New SMTP server &rsaquo; [% ELSIF op == 'edit_form' %]
Edit SMTP server &rsaquo; [% END %]
SMTP servers &rsaquo; Administration &rsaquo; Koha
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_smtp_servers" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
</li>
[% IF op == 'add_form' %]
<li>
<a href="/cgi-bin/koha/admin/smtp_servers.pl">SMTP servers</a>
</li>
<li>
<a href="#" aria-current="page">
New
</a>
</li>
[% ELSIF op == 'edit_form' %]
<li>
<a href="/cgi-bin/koha/admin/smtp_servers.pl">SMTP servers</a>
</li>
<li>
<a href="#" aria-current="page">
Edit
</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
SMTP servers
</a>
</li>
[% END %]
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% FOREACH m IN messages %]
<div class="dialog [% m.type | html %]" id="smtp_action_result_dialog">
[% SWITCH m.code %]
[% CASE 'error_on_update' %]
<span>An error occurred trying to open the server for editing. The passed id is invalid.</span>
[% CASE 'error_on_insert' %]
<span>An error occurred when adding the server. The library already has an SMTP server set.</span>
[% CASE 'success_on_update' %]
<span>Server updated successfully.</span>
[% CASE 'success_on_insert' %]
<span>Server added successfully.</span>
[% CASE %]
<span>[% m.code | html %]</span>
[% END %]
</div>
[% END %]
<div class="dialog message" id="smtp_delete_success" style="display: none;"></div>
<div class="dialog alert" id="smtp_delete_error" style="display: none;"></div>
[% IF op == 'add_form' %]
<h1>New SMTP server</h1>
<form action="/cgi-bin/koha/admin/smtp_servers.pl" id="add" name="add" class="validated" method="post">
<input type="hidden" name="op" value="add" />
<fieldset class="rows">
<ol>
<li>
<label for="smtp_name" class="required">Name: </label>
<input type="text" name="smtp_name" id="smtp_name" size="60" class="required" required="required" />
<span class="required">Required</span>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<ol>
<li>
<label for="smtp_host" class="required">Host: </label>
<input type="text" name="smtp_host" id="smtp_host" size="60" class="required"/>
<span class="required">Required</span>
</li>
<li>
<label for="smtp_port" class="required">Port: </label>
<input type="text" inputmode="numeric" pattern="[0-9]*" value="25" name="smtp_port" id="smtp_port" size="20" class="required"/>
<span class="required">Required</span>
</li>
<li>
<label for="smtp_timeout">Timeout (seconds): </label>
<input type="text" inputmode="numeric" pattern="[0-9]*" value="120" name="smtp_timeout" id="smtp_timeout" size="20" />
</li>
<li>
<label for="smtp_ssl_mode">SSL: </label>
<select name="smtp_ssl_mode" id="smtp_ssl_mode">
<option value="disabled" selected="selected">Disabled</option>
<option value="ssl">SSL</option>
<option value="starttls">STARTTLS</option>
</select>
</li>
<li>
<label for="smtp_user_name">User name: </label>
<input type="text" name="smtp_user_name" id="smtp_user_name" size="60" />
</li>
<li>
<label for="smtp_password">Password: </label>
<input type="password" name="smtp_password" id="smtp_password" size="60" />
</li>
<li>
<label for="smtp_debug_mode">Debug mode: </label>
<select name="smtp_debug_mode" id="smtp_debug_mode">
<option value="1">Enabled</option>
<option value="0" selected="selected">Disabled</option>
</select>
<span>Enables additional debug output in the logs</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<a class="cancel" href="/cgi-bin/koha/admin/smtp_servers.pl">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'edit_form' %]
<h1>Edit SMTP server</h1>
<form action="/cgi-bin/koha/admin/smtp_servers.pl" id="edit_save" name="edit_save" class="validated" method="post">
<input type="hidden" name="op" value="edit_save" />
<input type="hidden" name="smtp_server_id" value="[%- smtp_server.id | html -%]" />
<fieldset class="rows">
<ol>
<li>
<label for="smtp_name" class="required">Name: </label>
<input type="text" name="smtp_name" id="smtp_name" size="60" class="required" required="required" value="[%- smtp_server.name | html -%]"/>
<span class="required">Required</span>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<ol>
<li>
<label for="smtp_host" class="required">Host: </label>
<input type="text" name="smtp_host" id="smtp_host" size="60" class="required" value="[%- smtp_server.host | html -%]"/>
<span class="required">Required</span>
</li>
<li>
<label for="smtp_port" class="required">Port: </label>
<input type="text" inputmode="numeric" pattern="[0-9]*" name="smtp_port" id="smtp_port" size="20" class="required" value="[%- smtp_server.port | html -%]"/>
<span class="required">Required</span>
</li>
<li>
<label for="smtp_timeout">Timeout (seconds): </label>
<input type="text" inputmode="numeric" pattern="[0-9]*" name="smtp_timeout" id="smtp_timeout" size="20" value="[%- smtp_server.timeout | html -%]"/>
</li>
<li>
<label for="smtp_ssl_mode">SSL: </label>
<select name="smtp_ssl_mode" id="smtp_ssl_mode">
[%- IF smtp_server.ssl_mode == 'disabled' -%]
<option value="disabled" selected="selected">Disabled</option>
<option value="ssl">SSL</option>
<option value="starttls">STARTTLS</option>
[%- ELSIF smtp_server.ssl_mode == 'ssl' -%]
<option value="disabled">Disabled</option>
<option value="ssl" selected="selected">SSL</option>
<option value="starttls">STARTTLS</option>
[%- ELSE -%]
<option value="disabled">Disabled</option>
<option value="ssl">SSL</option>
<option value="starttls" selected="selected">STARTTLS</option>
[%- END -%]
</select>
</li>
<li>
<label for="smtp_user_name">User name: </label>
<input type="text" name="smtp_user_name" id="smtp_user_name" size="60" value="[%- smtp_server.user_name | html -%]"/>
</li>
<li>
<label for="smtp_password">Password: </label>
[% IF smtp_server.password %]
<input type="password" name="smtp_password" id="smtp_password" size="60" value="****"/>
[% ELSE %]
<input type="password" name="smtp_password" id="smtp_password" size="60" value=""/>
[% END %]
</li>
<li>
<label for="smtp_debug_mode">Debug mode: </label>
<select name="smtp_debug_mode" id="smtp_debug_mode">
[%- IF smtp_server.debug == 1 -%]
<option value="1" selected="selected">Enabled</option>
<option value="0">Disabled</option>
[%- ELSE -%]
<option value="1">Enabled</option>
<option value="0" selected="selected">Disabled</option>
[%- END -%]
</select>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<a class="cancel" href="/cgi-bin/koha/admin/smtp_servers.pl">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="new_smtp_server" href="/cgi-bin/koha/admin/smtp_servers.pl?op=add_form"><i class="fa fa-plus"></i> New SMTP server</a>
</div>
<h1>SMTP servers</h1>
<div class="dialog message" id="default_server_message">
<p>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>
[% IF servers_count > 0 %]
<table id="smtp_servers">
<thead>
<tr>
<th>Name</th>
<th>Host</th>
<th>Port</th>
<th>Timeout (secs)</th>
<th>SSL</th>
<th>Authenticated</th>
<th data-class-name="actions noExport">Actions</th>
</tr>
</thead>
</table>
[% END %]
[% END %]
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="delete_confirm_modal_label">Delete server</h3>
</div>
<div class="modal-body">
<div id="delete_confirm_dialog"></div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- #delete_confirm_modal -->
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
var smtp_servers_url = '/api/v1/config/smtp_servers';
window.smtp_servers = $("#smtp_servers").kohaTable({
"ajax": {
"url": smtp_servers_url
},
'language': {
'emptyTable': '<div class="dialog message">'+_("There are no SMTP servers defined.")+'</div>'
},
"columnDefs": [ {
"targets": [0,1],
"render": function (data, type, row, meta) {
if ( type == 'display' ) {
if ( data != null ) {
return data.escapeHtml();
}
else {
return "Default";
}
}
return data;
}
} ],
"columns": [
{
"data": "name",
"searchable": true,
"orderable": true
},
{
"data": "host",
"searchable": true,
"orderable": true
},
{
"data": "port",
"searchable": true,
"orderable": false
},
{
"data": "timeout",
"searchable": true,
"orderable": false
},
{
"data": "ssl_mode",
"render": function (data, type, row, meta) {
if (data == 'disabled') {
return _("Disabled");
}
else if (data == 'ssl') {
return _("SSL");
}
else {
return _("STARTTLS");
}
},
"searchable": false,
"orderable": false
},
{
"data": function( row, type, val, meta ) {
if ( row.user_name != null ) {
return _("Yes");
}
else {
return _("No");
}
},
"searchable": false,
"orderable": false
},
{
"data": function( row, type, val, meta ) {
var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&amp;smtp_server_id='+ encodeURIComponent(row.smtp_server_id) +'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
result += '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-smtp-server-id="'+ encodeURIComponent(row.smtp_server_id) +'" data-smtp-server-name="'+ encodeURIComponent(row.name.escapeHtml()) +'"><i class="fa fa-trash" aria-hidden="true"></i>'+_("Delete")+'</a>';
return result;
},
"searchable": false,
"orderable": false
}
],
createdRow: function (row, data, dataIndex) {
if ( data.debug ) {
$(row).addClass('debug');
}
},
});
$('#smtp_servers').on( "click", '.delete_server', function () {
var smtp_server_id = $(this).data('smtp-server-id');
var smtp_server_name = decodeURIComponent($(this).data('smtp-server-name'));
$("#delete_confirm_dialog").html(
_("You are about to delete the '%s' SMTP server.").format(smtp_server_name)
);
$("#delete_confirm_modal_button").data('smtp-server-id', smtp_server_id);
$("#delete_confirm_modal_button").data('smtp-server-name', smtp_server_name);
});
$("#delete_confirm_modal_button").on( "click", function () {
var smtp_server_id = $(this).data('smtp-server-id');
var smtp_server_name = $(this).data('smtp-server-name');
$.ajax({
method: "DELETE",
url: "/api/v1/config/smtp_servers/"+smtp_server_id
}).success(function() {
window.smtp_servers.api().ajax.reload(function (data) {
$("#smtp_action_result_dialog").hide();
$("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(smtp_server_name)).show();
});
}).fail(function () {
$("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs.").format(smtp_server_name)).show();
}).done(function () {
$("#delete_confirm_modal").modal('hide');
});
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]