444 lines
31 KiB
Plaintext
444 lines
31 KiB
Plaintext
[% USE raw %]
|
|
[% USE Koha %]
|
|
[% USE AdditionalContents %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% PROCESS 'html_helpers.inc' %]
|
|
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
|
|
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title
|
|
>[% FILTER collapse %]
|
|
[% t("Your messaging settings") | html %]
|
|
› [% PROCESS 'library_name_title' %]
|
|
[% END %]</title
|
|
>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% BLOCK cssinclude %]
|
|
[% END %]
|
|
</head>
|
|
[% INCLUDE 'bodytag.inc' bodyid='opac-messaging' %]
|
|
[% INCLUDE 'masthead.inc' IsPatronPage=1 %]
|
|
|
|
<main class="main">
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Your messaging settings</span>
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col col-lg-2 order-2 order-lg-1">
|
|
<div id="navigation"> [% INCLUDE 'navigation.inc' IsPatronPage=1 %] </div>
|
|
</div>
|
|
<div class="col-md-12 col-lg-10 order-1">
|
|
[% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) || Koha.Preference('TranslateNotices') %]
|
|
<div id="usermessaging" class="maincontent">
|
|
<h1>Your messaging settings</h1>
|
|
[% IF ( settings_updated ) %]
|
|
<div class="alert alert-success"
|
|
><p><strong>Settings updated</strong></p></div
|
|
>
|
|
[% END %]
|
|
<form action="/cgi-bin/koha/opac-messaging.pl" method="post" name="opacmessaging">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<input type="hidden" name="op" value="cud-modify" />
|
|
|
|
[% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) %]
|
|
<table class="table table-bordered table-condensed table-striped">
|
|
<caption class="visually-hidden">Your messaging settings</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>[% t('Message type') | html %]</th>
|
|
<th>Days in advance</th>
|
|
[% IF ( SMSSendDriver ) %]<th>SMS</th>[% END %]
|
|
[% IF ( TalkingTechItivaPhone ) %]<th>Phone</th>[% END %]
|
|
[% IF Koha.Preference('PhoneNotification') %]<th>Phone</th>[% END %]
|
|
<th>Email</th>
|
|
<th
|
|
>Digests only
|
|
<i
|
|
id="info_digests"
|
|
data-bs-toggle="tooltip"
|
|
title="You can ask for a digest to reduce the number of messages. Messages will be saved and sent as a single message."
|
|
data-bs-placement="right"
|
|
class="fa fa-info-circle"
|
|
></i
|
|
></th>
|
|
<th class="dtr-control-col">[% t('Expand') | html %]</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH messaging_preference IN messaging_preferences %]
|
|
[% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
|
|
[% NEXT IF !Koha.Preference('MembershipExpiryDaysNotice') && messaging_preference.Patron_Expiry %]
|
|
[% NEXT IF messaging_preference.Patron_Expiry && enforce_expiry_notice %]
|
|
[% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
|
|
[% NEXT IF Koha.Preference('UseRecalls') != "off" && messaging_preference.message_name.match('^Recall_') %]
|
|
<tr id="[% messaging_preference.message_name _ "_message" | lower | html %]">
|
|
<td
|
|
>[% IF ( messaging_preference.Item_Due ) %]
|
|
<span>Item due</span>
|
|
[% ELSIF ( messaging_preference.Advance_Notice ) %]
|
|
<span>Advance notice</span>
|
|
[% ELSIF ( messaging_preference.Hold_Filled ) %]
|
|
<span>Hold filled</span>
|
|
[% ELSIF ( messaging_preference.Hold_Reminder ) %]
|
|
<span>Hold reminder</span>
|
|
[% ELSIF ( messaging_preference.Item_Check_in ) %]
|
|
<span>Item check-in</span>
|
|
[% ELSIF ( messaging_preference.Item_Checkout ) %]
|
|
[% IF Koha.Preference( 'RenewalSendNotice' ) %]
|
|
<span>Item checkout and renewal</span>
|
|
[% ELSE %]
|
|
<span>Item checkout</span>
|
|
[% END %]
|
|
[% ELSIF ( messaging_preference.Patron_Expiry ) %]
|
|
<span>Patron account expiry</span>
|
|
[% ELSIF ( messaging_preference.Ill_ready ) %]
|
|
<span>Interlibrary loan ready</span>
|
|
[% ELSIF ( messaging_preference.Ill_unavailable ) %]
|
|
<span>Interlibrary loan unavailable</span>
|
|
[% ELSIF ( messaging_preference.Ill_update ) %]
|
|
<span>Interlibrary loan updated</span>
|
|
[% ELSIF ( messaging_preference.Auto_Renewals ) %]
|
|
<span>Auto renewal</span>
|
|
[% ELSIF ( messaging_preference.Recall_Waiting ) %]
|
|
<span>Recall awaiting pickup</span>
|
|
[% ELSIF ( messaging_preference.Recall_Requested ) %]
|
|
<span>Return recalled item</span>
|
|
[% ELSE %]
|
|
<span>Unknown</span>
|
|
[% END %]</td
|
|
>
|
|
[% IF ( messaging_preference.takes_days ) %]
|
|
<td
|
|
><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS" aria-label="Choose how many days in advance you wish to receive the message">
|
|
[% FOREACH select_day IN messaging_preference.select_days %]
|
|
[% IF ( select_day.selected ) %]
|
|
<option value="[% select_day.day | html %]" selected="selected">[% select_day.day | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% select_day.day | html %]">[% select_day.day | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select></td
|
|
>
|
|
[% ELSE %]
|
|
<td>-</td>
|
|
[% END %]
|
|
[% IF ( SMSSendDriver ) %]
|
|
[% IF ( messaging_preference.transport_sms ) %]
|
|
<td class="selectcol">
|
|
[% IF ( messaging_preference.transports_sms ) %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Unselect SMS messaging"
|
|
class="pmp_sms"
|
|
id="sms[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="sms"
|
|
checked="checked"
|
|
/>
|
|
[% ELSE %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Select SMS messaging"
|
|
class="pmp_sms"
|
|
id="sms[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="sms"
|
|
/>
|
|
[% END %]
|
|
</td>
|
|
[% ELSE %]
|
|
<td>-</td>
|
|
[% END %]
|
|
[% END %]
|
|
[% IF Koha.Preference('PhoneNotification') %]
|
|
[% IF ( messaging_preference.transport_phone ) %]
|
|
<td class="selectcol">
|
|
[% IF ( messaging_preference.transports_phone ) %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Unselect notification by phone"
|
|
class="pmp_phone"
|
|
id="phone[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="phone"
|
|
checked="checked"
|
|
/>
|
|
[% ELSE %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Select notification by phone"
|
|
class="pmp_phone"
|
|
id="phone[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="phone"
|
|
/>
|
|
[% END %]
|
|
</td>
|
|
[% ELSE %]
|
|
<td>-</td>
|
|
[% END %]
|
|
[% END %]
|
|
[% IF ( TalkingTechItivaPhone ) %]
|
|
[% IF ( messaging_preference.transport_itiva ) %]
|
|
<td class="selectcol">
|
|
[% IF ( messaging_preference.transports_itiva ) %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Unselect itiva messaging"
|
|
class="itiva"
|
|
id="itiva[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="itiva"
|
|
checked="checked"
|
|
/>
|
|
[% ELSE %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Select itiva messaging"
|
|
class="itiva"
|
|
id="itiva[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="itiva"
|
|
/>
|
|
[% END %]
|
|
</td>
|
|
[% ELSE %]
|
|
<td>-</td>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF ( messaging_preference.transport_email ) %]
|
|
<td class="selectcol">
|
|
[% IF ( messaging_preference.transports_email ) %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Unselect email messaging"
|
|
class="pmp_email"
|
|
id="email[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="email"
|
|
checked="checked"
|
|
/>
|
|
[% ELSE %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Select email messaging"
|
|
class="pmp_email"
|
|
id="email[% messaging_preference.message_attribute_id | html %]"
|
|
name="[% messaging_preference.message_attribute_id | html %]"
|
|
value="email"
|
|
/>
|
|
[% END %]
|
|
</td>
|
|
[% ELSE %]
|
|
<td>-</td>
|
|
[% END %]
|
|
|
|
[% IF ( messaging_preference.has_digest ) %]
|
|
<td class="selectcol">
|
|
[% IF ( messaging_preference.digest ) %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Unselect digests"
|
|
id="digest[% messaging_preference.message_attribute_id | html %]"
|
|
value="[% messaging_preference.message_attribute_id | html %]"
|
|
name="digest"
|
|
checked="checked"
|
|
data-bs-toggle="tooltip"
|
|
title="You must select a digestible transport to select digests"
|
|
/>
|
|
[% ELSE %]
|
|
<input
|
|
type="checkbox"
|
|
aria-label="Select digests"
|
|
id="digest[% messaging_preference.message_attribute_id | html %]"
|
|
value="[% messaging_preference.message_attribute_id | html %]"
|
|
name="digest"
|
|
data-bs-toggle="tooltip"
|
|
title="You must select a digestible transport to select digests"
|
|
/>
|
|
[% END %]
|
|
</td>
|
|
[% ELSE %]
|
|
<td>-</td>
|
|
[% END %]
|
|
<td></td>
|
|
</tr>
|
|
[% END # / FOREACH messaging_preferences %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
|
|
[% IF ( SMSSendDriver || Koha.Preference('TranslateNotices') ) %]
|
|
<fieldset class="rows d-print-none">
|
|
<ol>
|
|
[% IF ( SMSSendDriver ) %]
|
|
<li> <strong>Notice:</strong> Some charges for text messages may be incurred when using this service. Please check with your mobile service provider if you have questions. </li>
|
|
<li>
|
|
<label for="SMSnumber">SMS number:</label>
|
|
<input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" pattern="^(\+[1-9]\d{0,2})?\d{1,12}$" />
|
|
<span class="hint sms_number_help">Please enter numbers only. Prefix the number with + or 00 if including the country code.</span>
|
|
</li>
|
|
|
|
[% IF ( SMSSendDriver == 'Email' ) %]
|
|
<li>
|
|
<label for="sms_provider_id">SMS provider:</label>
|
|
<select id="sms_provider_id" name="sms_provider_id">
|
|
<option value="">Unknown</option>
|
|
[% FOREACH s IN sms_providers %]
|
|
[% IF s.id == sms_provider_id %]
|
|
<option value="[% s.id | html %]" selected="selected">[% s.name | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% s.id | html %]">[% s.name | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
<div class="hint">Please contact a library staff member if you are unsure of your mobile service provider, or you do not see your provider in this list.</div>
|
|
</li>
|
|
[% END # /IF ( SMSSendDriver == 'Email' ) %]
|
|
[% END # /IF SMSSendDriver %]
|
|
|
|
[% IF Koha.Preference('TranslateNotices') %]
|
|
<li>
|
|
<label for="lang">Preferred language for notices: </label>
|
|
<select id="lang" name="lang">
|
|
<option value="default">Default</option>
|
|
[% FOR language IN languages %]
|
|
[% FOR sublanguage IN language.sublanguages_loop %]
|
|
[% IF language.plural %]
|
|
[% IF sublanguage.rfc4646_subtag == patron_lang %]
|
|
<option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected"
|
|
>[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option
|
|
>
|
|
[% ELSE %]
|
|
<option value="[% sublanguage.rfc4646_subtag | html %]"
|
|
>[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option
|
|
>
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% IF sublanguage.rfc4646_subtag == patron_lang %]
|
|
<option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
|
|
[% ELSE %]
|
|
<option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
|
|
[% END %]
|
|
[% END # /IF language.plural %]
|
|
[% END # /FOR sublanguage %]
|
|
[% END #/FOR language %]
|
|
</select>
|
|
<!-- /#lang -->
|
|
</li>
|
|
[% END #/IF Koha.Preference('TranslateNotices') %]
|
|
</ol>
|
|
</fieldset>
|
|
[% END #/IF SMSSendDriver || Koha.Preference('TranslateNotices') %]
|
|
|
|
<fieldset class="action">
|
|
<legend class="sr-only">Submit or cancel changes</legend>
|
|
<input type="submit" value="Submit changes" class="btn btn-primary" />
|
|
<a class="cancel" href="/cgi-bin/koha/opac-user.pl">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
<!-- / #usermessaging -->
|
|
[% ELSE %]
|
|
<p><strong>You are not allowed to call this page directly</strong></p>
|
|
[% END # /IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) %]
|
|
</div>
|
|
<!-- / .col-lg-10 -->
|
|
</div>
|
|
<!-- / .row -->
|
|
</div>
|
|
<!-- / .container-fluid -->
|
|
</main>
|
|
<!-- / .main -->
|
|
|
|
[% INCLUDE 'opac-bottom.inc' %]
|
|
[% BLOCK jsinclude %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
|
Koha.addPrefs({
|
|
PhoneNotification: [% Koha.Preference('PhoneNotification') ? 1 : 0 | html %],
|
|
TalkingTechItivaPhoneNotification: [% Koha.Preference('TalkingTechItivaPhoneNotification') ? 1 : 0 | html %],
|
|
OPACTableColExpandedByDefault: [% Koha.Preference('OPACTableColExpandedByDefault') ? 1 : 0 | html %],
|
|
});
|
|
</script>
|
|
<script nonce="[% Koha.CSPNonce | $raw %]">
|
|
$(document).ready(function () {
|
|
function toggle_digest(id) {
|
|
let phone_checked = Koha.prefs.TalkingTechItivaPhoneNotification ? false : Koha.prefs.PhoneNotification ? $("#phone" + id).prop("checked") : false;
|
|
|
|
if ($("#email" + id).prop("checked") || $("#sms" + id).prop("checked") || phone_checked) {
|
|
$("#digest" + id)
|
|
.attr("disabled", false)
|
|
.tooltip("disable");
|
|
} else {
|
|
$("#digest" + id)
|
|
.attr("disabled", true)
|
|
.prop("checked", false)
|
|
.tooltip("enable");
|
|
}
|
|
}
|
|
// At load time, we want digest disabled if no digest using transport is enabled
|
|
$(".pmp_email").each(function () {
|
|
toggle_digest(Number($(this).attr("id").replace("email", "")));
|
|
});
|
|
|
|
// If user clears all digest using transports for a notice, disable digest checkbox
|
|
$(".pmp_email").click(function () {
|
|
toggle_digest(Number($(this).attr("id").replace("email", "")));
|
|
});
|
|
$(".pmp_sms").click(function () {
|
|
toggle_digest(Number($(this).attr("id").replace("sms", "")));
|
|
});
|
|
$(".pmp_phone").click(function () {
|
|
toggle_digest(Number($(this).attr("id").replace("phone", "")));
|
|
});
|
|
});
|
|
|
|
function normalizeSMS(value) {
|
|
let has_plus = value.charAt(0) === "+";
|
|
let new_value = value.replace(/\D/g, "");
|
|
if (has_plus) new_value = "+" + new_value;
|
|
return new_value;
|
|
}
|
|
|
|
var sms_input = document.getElementById("SMSnumber");
|
|
|
|
if (typeof sms_input !== "undefined" && sms_input !== null) {
|
|
sms_input.addEventListener("keyup", function () {
|
|
var field = sms_input.value;
|
|
sms_input.value = normalizeSMS(field);
|
|
});
|
|
|
|
sms_input.addEventListener("paste", function (event) {
|
|
let paste = (event.clipboardData || window.clipboardData).getData("text");
|
|
setTimeout(function () {
|
|
sms_input.value = normalizeSMS(paste);
|
|
}, 100);
|
|
});
|
|
}
|
|
|
|
var responsive_display = Koha.prefs.OPACTableColExpandedByDefault ? DataTable.Responsive.display.childRowImmediate : DataTable.Responsive.display.childRow;
|
|
$(".table").kohaTable({
|
|
searching: false,
|
|
paging: false,
|
|
info: false,
|
|
responsive: {
|
|
details: {
|
|
display: responsive_display,
|
|
type: "column",
|
|
target: -1,
|
|
},
|
|
},
|
|
columnDefs: [{ className: "dtr-control", orderable: false, targets: -1 }],
|
|
});
|
|
</script>
|
|
[% END %]
|