[Koha-patches] [PATCH] Hiding SMS messaging preferences if there is no SMSSendDriver defined in system preferences.

Owen Leonard oleonard at myacpl.org
Tue Oct 21 21:57:27 CEST 2008


---
 .../prog/en/modules/members/messaging.tmpl         |   30 ++++++++++++-------
 members/messaging.pl                               |    3 +-
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl
index 955ce67..82f54d2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl
@@ -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>
@@ -71,11 +86,11 @@
       <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 -->
@@ -110,19 +125,12 @@
       <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>
diff --git a/members/messaging.pl b/members/messaging.pl
index c3479f4..850ba03 100755
--- a/members/messaging.pl
+++ b/members/messaging.pl
@@ -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'}
-- 
1.5.5.GIT




More information about the Koha-patches mailing list