Bug 23901: Fix indentation
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-messaging.tt
1 [% USE Koha %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>[% IF ( LibraryNameTitle ) %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your messaging settings</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% BLOCK cssinclude %][% END %]
6 </head>
7 [% INCLUDE 'bodytag.inc' bodyid='opac-messaging' %]
8 [% INCLUDE 'masthead.inc' %]
9
10 <div class="main">
11     <ul class="breadcrumb">
12         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
13         <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
14         <li><a href="#">Your messaging settings</a></li>
15     </ul>
16
17     <div class="container-fluid">
18         <div class="row-fluid">
19             <div class="span2">
20                 <div id="navigation">
21                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
22                 </div>
23             </div>
24             <div class="span10">
25                 [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' )  %]
26                 <div id="usermessaging">
27                     <h3>Your messaging settings</h3>
28                     [% IF ( settings_updated ) %]
29                         <div class="alert alert-success"><h4>Settings updated</h4></div>
30                     [% END %]
31                     <form action="/cgi-bin/koha/opac-messaging.pl" method="get" name="opacmessaging">
32                         <input type="hidden" name="modify" value="yes" />
33
34                             <table class="table table-bordered table-condensed table-striped">
35                                 <thead>
36                                     <tr>
37                                         <th>&nbsp;</th>
38                                         <th>Days in advance</th>
39                                         [% IF ( SMSSendDriver ) %]<th>SMS</th>[% END %]
40                                         [% IF ( TalkingTechItivaPhone ) %]<th>Phone</th>[% END %]
41                                         <th>Email</th>
42                                         <th>Digests only <i id="info_digests" data-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-placement="right" class="fa fa-info-circle"></i></th>
43                                     </tr>
44                                 </thead>
45                                 <tbody>
46                                 [% FOREACH messaging_preference IN messaging_preferences %]
47                                     <tr>
48                                         <td>[% IF ( messaging_preference.Item_Due ) %]Item due
49                                               [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice
50                                               [% ELSIF ( messaging_preference.Upcoming_Events ) %]Upcoming events
51                                               [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold filled
52                                               [% ELSIF ( messaging_preference.Item_Check_in ) %]Item check-in
53                                               [% ELSIF ( messaging_preference.Item_Checkout ) %]Item checkout
54                                               [% ELSE %]Unknown [% END %]</td>
55                                         [% IF ( messaging_preference.takes_days ) %]
56                                             <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">
57                                             [% FOREACH select_day IN messaging_preference.select_days %]
58                                                 [% IF ( select_day.selected ) %]
59                                                     <option value="[% select_day.day | html %]" selected="selected">[% select_day.day | html %]</option>
60                                                 [% ELSE %]
61                                                     <option value="[% select_day.day | html %]">[% select_day.day | html %]</option>
62                                                 [% END %]
63                                             [% END %]
64                                             </select></td>
65                                         [% ELSE %]
66                                             <td>-</td>
67                                         [% END %]
68                                         [% IF ( SMSSendDriver ) %]
69                                             [% IF ( messaging_preference.transport_sms ) %]
70                                                 <td>
71                                                     [% IF ( messaging_preference.transports_sms ) %]
72                                                       <input type="checkbox" id="sms[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="sms" checked="checked" />
73                                                     [% ELSE %]
74                                                         <input type="checkbox" id="sms[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="sms" />
75                                                     [% END %]
76                                                 </td>
77                                             [% ELSE %]
78                                                 <td>-</td>
79                                             [% END %]
80                                         [% END %]
81                                         [% IF ( TalkingTechItivaPhone ) %]
82                                             [% IF ( messaging_preference.transport_phone ) %]
83                                             <td>
84                                               [% IF ( messaging_preference.transports_phone ) %]
85                                               <input type="checkbox"
86                                                          id="phone[% messaging_preference.message_attribute_id | html %]"
87                                                          name="[% messaging_preference.message_attribute_id | html %]"
88                                                          value="phone" checked="checked" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" />
89                                               [% ELSE %]
90                                               <input type="checkbox"
91                                                          id="phone[% messaging_preference.message_attribute_id | html %]"
92                                                          name="[% messaging_preference.message_attribute_id | html %]"
93                                                          value="phone" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" />
94                                               [% END %]
95                                             </td>
96                                             [% ELSE %]
97                                                 <td>-</td>
98                                             [% END %]
99                                         [% END %]
100
101                                         [% IF ( messaging_preference.transport_email ) %]
102                                             <td>
103                                                 [% IF ( messaging_preference.transports_email ) %]
104                                                     <input type="checkbox" id="email[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="email" checked="checked" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" />
105                                                 [% ELSE %]
106                                                     <input type="checkbox" id="email[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="email" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" />
107                                                 [% END %]
108                                             </td>
109                                         [% ELSE %]
110                                             <td>-</td>
111                                         [% END %]
112
113                                         [% IF ( messaging_preference.has_digest ) %]
114                                             <td>
115                                                 [% IF ( messaging_preference.digest ) %]
116                                                     <input type="checkbox" id="digest[% messaging_preference.message_attribute_id | html %]" value="[% messaging_preference.message_attribute_id | html %]" name="digest" checked="checked" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" />
117                                                 [% ELSE %]
118                                                     <input type="checkbox" id="digest[% messaging_preference.message_attribute_id | html %]" value="[% messaging_preference.message_attribute_id | html %]" name="digest" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" />
119                                                 [% END %]
120                                             </td>
121                                         [% ELSE %]
122                                         <td>-</td>
123                                         [% END %]
124
125                                     </tr>
126                                 [% END # / FOREACH messaging_preferences%]
127                             </tbody>
128                         </table>
129
130                         <fieldset class="rows">
131                             [% IF ( SMSSendDriver ) %]
132                                 <ol><li><label>Notice:</label>Some charges for text messages may be incurred when using this service. Please check with your mobile service provider if you have questions.</li></ol>
133                                 <ol><li>
134                                     <label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" pattern="^\+?[1-9]\d{1,14}$" />
135                                     <i>Please enter numbers only. <b>(123) 456-7890</b> would be entered as <b>1234567890</b>.</i>
136                                 </li></ol>
137                             [% END %]
138
139                             [% IF ( SMSSendDriver == 'Email' ) %]
140                                 <ol><li>
141                                     <label for="sms_provider_id">SMS provider:</label>
142                                     <select id="sms_provider_id" name="sms_provider_id">
143                                         <option value="">Unknown</option>
144                                         [% FOREACH s IN sms_providers %]
145                                             [% IF s.id == sms_provider_id %]
146                                                 <option value="[% s.id | html %]" selected="selected">[% s.name | html %]</option>
147                                             [% ELSE %]
148                                                 <option value="[% s.id | html %]">[% s.name | html %]</option>
149                                             [% END %]
150                                         [% END %]
151                                     </select>
152                                     <i>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.</i>
153                                 </li></ol>
154                             [% END %]
155                         </fieldset>
156
157                         <fieldset class="action">
158                           <input type="submit" value="Submit changes" class="btn" /> <a class="cancel" href="/cgi-bin/koha/opac-user.pl">Cancel</a>
159                         </fieldset>
160                     </form>
161                 </div> <!-- / #usermessaging -->
162                 [% ELSE %]
163                     <h4>You are not allowed to call this page directly</h4>
164                 [% END %]
165            </div> <!-- / .span10 -->
166         </div> <!-- / .row-fluid -->
167     </div> <!-- / .container-fluid -->
168 </div> <!-- / .main -->
169
170 [% INCLUDE 'opac-bottom.inc' %]
171 [% BLOCK jsinclude %]
172 <script>//<![CDATA[
173   $(document).ready(function(){
174     $(".none").click(function(){
175       if($(this).attr("checked")){
176         var rowid = $(this).attr("id");
177         newid = Number(rowid.replace("none",""))
178           $("#sms"+newid).removeAttr("checked");
179           $("#email"+newid).removeAttr("checked");
180           $("#digest"+newid).removeAttr("checked");
181           $("#rss"+newid).removeAttr("checked");
182       }
183     });
184     $("#info_digests").tooltip();
185   });
186
187 function normalizeSMS(value){
188   let has_plus = value.charAt(0) === '+';
189   let new_value = value.replace(/\D/g,'');
190   if ( has_plus ) new_value = '+' + new_value;
191   return new_value;
192 }
193
194 var sms_input = document.getElementById('SMSnumber');
195
196 if (typeof sms_input !== 'undefined' && sms_input !== null) {
197   sms_input.addEventListener('keyup', function(){
198     var field = sms_input.value;
199     sms_input.value = normalizeSMS(field);
200   });
201
202   sms_input.addEventListener('paste', function(event) {
203     let paste = (event.clipboardData || window.clipboardData).getData('text');
204     setTimeout(function () {
205       sms_input.value = normalizeSMS(paste);
206     }, 100);
207   });
208 }
209
210 //]]>
211 </script>
212 [% END %]