WRAPPER "opac/parts/myopac/base.tt2";
myopac_page = "prefs_notify";
parent="prefs";
- prefs_page = 'prefs_notify' %]
+ prefs_page = 'prefs_notify'
+%]
<h3>[% l('Notification Preferences') %]</h3>
-<form method='post'>
- [% setting = 'opac.hold_notify' %]
- <input name='[% setting %]' type="hidden"
- [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
- <table class="full-width table" id="acct_search_main"
- title="[% l('Notification Preferences') %]">
- <tbody>
+ [% IF ctx.affectedChgs %]
+ [% # get hash of sms cariers keyed by id:
+ temp = ctx.search_csc('active','t');
+ tcos = { '0' => 'None' };
+ FOR o IN temp;
+ id = o.id;
+ tcos.$id = o;
+ END;
+ %]
- [% IF ctx.updated_user_settings %]
- <tr><td colspan='2'>
- <div class='renew-summary'>
- [% l('Account Successfully Updated') %]
- </div>
- </td></tr>
- [% END %]
+ <h4 class="">[% l('You have updated notification preferences. Those changes only affect future holds. Would you like to update existing holds to use the new information?') %]</h4>
+ <form id="hold_updates_form" name="hold_updates_form" method='post' action="./prefs_notify_changed_holds" onsubmit='return updateHoldsCheck()'>
+ <table class="full-width table" id="acct_search_main"
+ title="[% l('Notification Preferences') %]">
+ <tbody>
+ [% SET blnk = l('Blank') %]
+ [% FOR c IN ctx.affectedChgs %]
+ <tr>
+ <td>
+ [% IF c.2 == 'sms_info' %]
+ <input type='hidden' name="[% c.2 %][]" value="[% c.0.carrier _ ',' _ c.0.sms | html %]" />
+ <input type='hidden' name="[% c.2 %][]" value="[% c.1.carrier _ ',' _ c.1.sms | html %]" />
+ [% ELSE %]
+ <input type='hidden' name="[% c.2 %][]" value="[% c.0 %]" />
+ <input type='hidden' name="[% c.2 %][]" value="[% c.1 %]" />
+ [% END %]
+ <input type='hidden' name="[% c.2 %][]" value="[% c.2 %]" />
+ <input type='hidden' name="[% c.2 %][]" value="[% FOREACH i IN c.3 %][% i %],[% END %]" />
+ <input id="[% c %]" type="checkbox" onchange="canSubmit(event)" name="[% c.2 %][]"/>
+ [% IF c.2 == 'sms_info' %]
+ [% SET disp_name = l('SMS carrier/number') %]
+ <label for="[% c %]">[% c.3.size %] hold(s) currently with [% disp_name %] set to '[% old = c.0.carrier; tcos.$old.name() ? tcos.$old.name() : blnk | html %]/[% c.0.sms ? c.0.sms : blnk | html %]'. Update to '[% new = c.1.carrier; tcos.$new.name() ? tcos.$new.name() : blnk | html %]/[% c.1.sms ? c.1.sms : blnk | html %]'?</label>
+ [% ELSIF c.2.match('_notify') %]
+ [% SET f_name = c.2.replace("_", " "); Y = l('YES'); N = l('NO') %]
+ <label for="[% c %]">[% c.3.size %] hold(s) currently with [% f_name %] set to [% c.0 == 'false' ? N : Y %]. Update to [% c.1 == 'false' ? N : Y %]?</label>
+ [% ELSE %]
+ [% SET f_name = c.2.replace("_", " ") %]
+ <label for="[% c %]">[% c.3.size %] hold(s) currently with [% f_name %] set to '[% c.0 ? c.0 : blnk %]'. Update to '[% c.1 ? c.1 : blnk %]'?</label>
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ <input type='submit' disabled value="[% l('Update') %]" class="opac-button" />
+ <a href='/eg/opac/myopac/prefs_notify'>[% l('Continue without updating') %]</a>
+ </form>
+ [% ELSE %]
+ <form id="hold_notify_form" name="hold_notify_form" method='post'>
[% setting = 'opac.hold_notify' %]
- <tr>
- [%# WCAG insists that labels for checkboxes contain the input
- or directly follow the input, which would not look right
- with the rest of the table. As an alternative, we can
- repeat the label as a title attr.
- http://www.w3.org/TR/WCAG20-TECHS/H44.html %]
- [% email_label = l('Notify by Email by default when a hold is ready for pickup?') %]
+ <input name='[% setting %]' type="hidden"
+ [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
- <td><label for='[% setting %].email'>[% email_label %]</label></td>
- <td>
- <input id='[% setting %].email' name='[% setting %].email'
- type="checkbox" title="[% email_label %]"
- [% IF (matches = ctx.user_setting_map.$setting.match('email')); %] checked='checked' [% END %]/>
- </td>
- </tr>
- [%- IF allow_phone_notifications == 'true';
- setting = 'opac.hold_notify';
- -%]
- <tr>
- [% phone_label = l('Notify by Phone by default when a hold is ready for pickup?') %]
- <td><label for='[% setting %].phone'>[% phone_label %]</label></td>
- <td>
- <input id='[% setting %].phone' name='[% setting %].phone'
- type="checkbox" title="[% phone_label %]"
- [% IF (matches = ctx.user_setting_map.$setting.match('phone')); %] checked='checked' [% END %]/>
- </td>
- </tr>
- [% setting = 'opac.default_phone' %]
- <tr>
- <td><label for='[% setting %]'>[% l('Default Phone Number') %]</label></td>
- <td>
- <input id='[% setting %]' name='[% setting %]' type="text"
- [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %] class="form-control"/>
- </td>
- </tr>
- [%- END %]
- [%- IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1;
- setting = 'opac.hold_notify';
- -%]
- <tr>
- [% sms_label = l('Notify by Text by default when a hold is ready for pickup?') %]
- <td><label for='[% setting %].sms'>[% sms_label %]</label></td>
- <td>
- <input id='[% setting %].sms' name='[% setting %].sms'
- type="checkbox" title="[% sms_label %]"
- [% IF (matches = ctx.user_setting_map.$setting.match('sms')); %] checked='checked' [% END %]/>
- </td>
- </tr>
- <tr>
- <td>[% l('Default Mobile Carrier') %]</td>
- <td>[% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %]</td>
- </tr>
- [% setting = 'opac.default_sms_notify' %]
- <tr>
- <td><label for='[% setting %]'>[% l('Default Mobile Number') %]</label></td>
- <td>
- <input id='[% setting %]' name='[% setting %]' type="text"
- [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
- [% l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); %]
- </td>
- </tr>
- [% END %]
- [% FOR optin IN ctx.opt_in_settings %]
- <tr>
- <td><label for='[% optin.cust.name | uri %]'>[% optin.cust.label | html %]</label></td>
- <td>
- <input type='checkbox' name='setting'
- value='[% optin.cust.name | uri %]'
- id='[% optin.cust.name | uri %]'
- title="[% optin.cust.label | html %]"
- [% IF optin.value %] checked='checked' [% END %]/>
- </td>
- </tr>
- [% END %]
- </tbody>
- </table>
+ <table class="full-width table" id="acct_search_main"
+ title="[% l('Notification Preferences') %]">
+ <tbody>
+
+ [% IF ctx.updated_user_settings %]
+ <tr><td colspan='2'>
+ <div class='renew-summary'>
+ [% l('Account Successfully Updated') %]
+ </div>
+ </td></tr>
+ [% END %]
+
+ [% setting = 'opac.hold_notify' %]
+ <tr>
+ [%# WCAG insists that labels for checkboxes contain the input
+ or directly follow the input, which would not look right
+ with the rest of the table. As an alternative, we can
+ repeat the label as a title attr.
+ http://www.w3.org/TR/WCAG20-TECHS/H44.html %]
+ [% email_label = l('Notify by Email by default when a hold is ready for pickup?') %]
+
+ <td><label for='[% setting %].email'>[% email_label %]</label></td>
+ <td>
+ <input onchange="record_change(event)" id='[% setting %].email' name='[% setting %].email'
+ type="checkbox" title="[% email_label %]"
+ [% IF (matches = ctx.user_setting_map.$setting.match('email')); %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ [%- IF allow_phone_notifications == 'true';
+ setting = 'opac.hold_notify';
+ -%]
+ <tr>
+ [% phone_label = l('Notify by Phone by default when a hold is ready for pickup?') %]
+ <td><label for='[% setting %].phone'>[% phone_label %]</label></td>
+ <td>
+ <input onchange="record_change(event)" id='[% setting %].phone' name='[% setting %].phone'
+ type="checkbox" title="[% phone_label %]"
+ [% IF (matches = ctx.user_setting_map.$setting.match('phone')); %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ [% setting = 'opac.default_phone' %]
+ <tr>
+ <td><label for='[% setting %]'>[% l('Default Phone Number') %]</label></td>
+ <td>
+ <input onchange="record_change(event)" id='[% setting %]' name='[% setting %]' type="text"
+ [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
+ </td>
+ </tr>
+ [%- END %]
+ [%- IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1;
+ setting = 'opac.hold_notify';
+ -%]
+ <tr>
+ [% sms_label = l('Notify by Text by default when a hold is ready for pickup?') %]
+ <td><label for='[% setting %].sms'>[% sms_label %]</label></td>
+ <td>
+ <input onchange="record_change(event)" id='[% setting %].sms' name='[% setting %].sms'
+ type="checkbox" title="[% sms_label %]"
+ [% IF (matches = ctx.user_setting_map.$setting.match('sms')); %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ <tr>
+ <td>[% l('Default Mobile Carrier') %]</td>
+ <td>[% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %]</td>
+ </tr>
+ [% setting = 'opac.default_sms_notify' %]
+ <tr id="test_notification_banner" style="display:none">
+ <td colspan="4">
+ [% INCLUDE "opac/myopac/test_notification.tt2" message_type = "sms" %]
+ </td>
+ </tr>
+ <tr>
+ <td><label for='[% setting %]'>[% l('Default Mobile Number') %]</label></td>
+ <td>
+ <input onchange="record_change(event)" id='[% setting %]' name='[% setting %]' type="text"
+ [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
+ [% IF ctx.user_setting_map.$setting; %]
+ <a href="#" onclick="sendTestSMS(
+ [% ctx.user.id %], '[% ctx.authtoken %]'
+ )"
+ title="[% l('Send Test Text Message') %]">[% l('Send Test Text Message') %]</a><br />
+ [% l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); %]
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
+ [% FOR optin IN ctx.opt_in_settings %]
+ <tr>
+ <td><label for='[% optin.cust.name | uri %]'>[% optin.cust.label | html %]</label></td>
+ <td>
+ <input type='checkbox' name='setting'
+ value='[% optin.cust.name | uri %]'
+ id='[% optin.cust.name | uri %]'
+ title="[% optin.cust.label | html %]"
+ [% IF optin.value %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
<button type='submit' class="btn btn-confirm"><i class="fas fa-save"></i> [% l('Save') %]</button>
</form>
+ [% END %]
[% END %]