Hiding SMS messaging preferences if there is no SMSSendDriver defined in system preferences.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Owen Leonard 2008-10-21 14:57:27 -05:00 committed by Galen Charlton
parent 3686361d3e
commit ac196cddcc
2 changed files with 21 additions and 12 deletions

View 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>
@ -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>

View file

@ -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'}