Hiding SMS messaging preferences if there is no SMSSendDriver defined in system prefe...
authorOwen Leonard <oleonard@myacpl.org>
Tue, 21 Oct 2008 19:57:27 +0000 (14:57 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Wed, 7 Jan 2009 02:29:53 +0000 (20:29 -0600)
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl
members/messaging.pl

index 955ce67..82f54d2 100644 (file)
@@ -1,6 +1,21 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
 <title>Koha &rsaquo; Patrons &rsaquo; <!-- TMPL_IF NAME="unknowuser" -->Patron does not exist<!-- TMPL_ELSE -->Patron Details for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<script type="text/javascript">//<![CDATA[
+       $(document).ready(function(){
+               $(".none").click(function(){
+                       if($(this).attr("checked")){
+                               var rowid = $(this).attr("id");
+                               newid = Number(rowid.replace("none","")) 
+                               $("#sms"+newid).attr("checked","");
+                               $("#email"+newid).attr("checked","");
+                               $("#digest"+newid).attr("checked","");
+                               $("#rss"+newid).attr("checked","");
+                       }
+               });
+       });
+//]]>
+</script>
 </head>
 <body>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
@@ -54,7 +69,7 @@
  <h3>Manage patron messaging settings</h3>
 
   <table>
-    <tr><th></th><th>Days in advance</th><th>SMS</th><th>Email</th><th>Digests only?</th><th>RSS</th><th>Do not notify</th></tr>
+    <tr><th></th><th>Days in advance</th><!-- TMPL_IF NAME="SMSSendDriver" --><th>SMS</th><!-- /TMPL_IF --><th>Email</th><th>Digests only?</th><th>RSS</th><th>Do not notify</th></tr>
     <!-- TMPL_LOOP name="messaging_preferences" -->
     <tr>
       <td><!-- TMPL_VAR NAME="message_name" --></td>
       <td>-</td>
       <!-- /TMPL_IF -->
       <!-- TMPL_IF NAME="transport-sms" -->
-      <td><input type="checkbox"
+      <!-- TMPL_IF NAME="SMSSendDriver" --><td><input type="checkbox"
                  id="sms<!-- TMPL_VAR NAME="message_attribute_id" -->"
                  name="<!-- TMPL_VAR NAME="message_attribute_id" -->"
                  value="sms" <!-- TMPL_VAR NAME="transport-sms"   --> onclick = "document.messaging.none<!-- TMPL_VAR NAME="message_attribute_id" -->.checked=false;" />
-      </td>
+      </td><!-- /TMPL_IF -->
       <!-- TMPL_ELSE -->
       <td>-</td>
       <!-- /TMPL_IF -->
       <td>-</td>
       <!-- /TMPL_IF -->
 
-      <td><input type="checkbox" id="none<!-- TMPL_VAR NAME="message_attribute_id" -->"
-                 onclick = "if ( document.messaging.none<!-- TMPL_VAR NAME="message_attribute_id" -->.checked == true ) {
-                            document.messaging.sms<!-- TMPL_VAR NAME="message_attribute_id" -->.checked=false;
-                            document.messaging.email<!-- TMPL_VAR NAME="message_attribute_id" -->.checked=false;
-                            document.messaging.digest<!-- TMPL_VAR NAME="message_attribute_id" -->.checked=false;
-                            document.messaging.rss<!-- TMPL_VAR NAME="message_attribute_id" -->.checked=false; }" /></td>
+      <td><input type="checkbox" class="none" id="none<!-- TMPL_VAR NAME="message_attribute_id" -->" /></td>
     </tr>
     <!-- /TMPL_LOOP -->
   </table>
 <!-- TMPL_IF NAME="transport-sms" --><p><label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="<!-- TMPL_VAR NAME="SMSnumber"  -->" /></p><!-- /TMPL_IF -->
 
-
-
 <fieldset class="action">
   <input type="submit" value="Submit Changes" /> <a class="cancel" href="/cgi-bin/koha/opac-user.pl">Cancel</a>
 </fieldset>
index c3479f4..850ba03 100755 (executable)
@@ -143,10 +143,11 @@ $template->param( messagingview               => 1,
                   DHTMLcalendar_dateformat    => C4::Dates->DHTMLcalendar(), 
                   borrowernumber              => $borrowernumber,
                   branchcode                  => $borrower->{'branchcode'},
-                 branchname                  => GetBranchName($borrower->{'branchcode'}),
+                  branchname                 => GetBranchName($borrower->{'branchcode'}),
                   dateformat                  => C4::Context->preference("dateformat"),
                   categoryname                => $borrower->{'description'},
                   $borrower->{'categorycode'} => 1,
+                  SMSSendDriver                =>  C4::Context->preference("SMSSendDriver")
 );
 
 $messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnumber'}