aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/notifications/views/default/notifications/subscriptions/jsfuncs.php')
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/jsfuncs.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php
new file mode 100644
index 000000000..5d8e6c101
--- /dev/null
+++ b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php
@@ -0,0 +1,52 @@
+<?php
+
+ global $NOTIFICATION_HANDLERS;
+
+?>
+
+<script type="text/javascript">
+
+$(document).ready(function () {
+<?php
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+?>
+ $('input[@type=checkbox]:checked').parent("a.<?php echo $method; ?>toggleOff").each(function(){
+ $(this).removeClass('<?php echo $method; ?>toggleOff').addClass('<?php echo $method; ?>toggleOn');
+ });
+
+<?php
+ }
+?>
+
+});
+
+<?php
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+?>
+function adjust<?php echo $method; ?>(linkId) {
+ var obj = $(this).prev("a");
+
+ if (obj.className == "<?php echo $method; ?>toggleOff") {
+ obj.className = "<?php echo $method; ?>toggleOn";
+ } else {
+ obj.className = "<?php echo $method; ?>toggleOff";
+ }
+ return false;
+}
+function adjust<?php echo $method; ?>_alt(linkId) {
+ var obj = document.getElementById(linkId);
+
+ if (obj.className == "<?php echo $method; ?>toggleOff") {
+ obj.className = "<?php echo $method; ?>toggleOn";
+ $('#' + linkId).children("INPUT[type='checkbox']").attr('checked', true);
+ } else {
+ obj.className = "<?php echo $method; ?>toggleOff";
+ $('#' + linkId).children("INPUT[type='checkbox']").attr('checked', false);
+ }
+ return false;
+}
+<?php
+ }
+?>
+
+</script> \ No newline at end of file