Bugzilla – Attachment 29119 Details for
Bug 11431
Custom notification sounds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11431 [6] - Add the ability to specify arbitarary audio alerts
Bug-11431-6---Add-the-ability-to-specify-arbitarar.patch (text/plain), 7.34 KB, created by
Kyle M Hall (khall)
on 2014-06-20 18:50:50 UTC
(
hide
)
Description:
Bug 11431 [6] - Add the ability to specify arbitarary audio alerts
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-06-20 18:50:50 UTC
Size:
7.34 KB
patch
obsolete
>From 48428f13f5f4b33696cff07b6ccaf216a29b8d64 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 20 Jun 2014 14:40:53 -0400 >Subject: [PATCH] Bug 11431 [6] - Add the ability to specify arbitarary audio alerts > >This patch further enhances our control over Koha audio alerts by >allowing a library to specify custom audio events. A new system >preference is added the combines the functions of the Selector and >Override systems preferences in a list of selector:sound combinations. >These definitions override the default sounds and thus gives the library >a way to completely redefine what events trigger and audio alert, and >what sounds are played! > >Test Plan: >1) Apply this patch >2) Run updatedatabase.pl >3) Edit the new AudioAlertsCustom system preference and enter the following: >"body:contains('Check in message')": "IM_notification.ogg" >4) Browse to the checkins page, you should hear the default sound >5) Attempt to return an invalid barcode, you should hear your custom sound! >--- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 1 + > .../prog/en/includes/doc-head-close.inc | 29 +++++++++++++++----- > .../en/modules/admin/preferences/circulation.pref | 19 +++++++++++++ > 4 files changed, 43 insertions(+), 7 deletions(-) > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 504548f..9c7b711 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -40,6 +40,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'), > ('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',''), > ('AudioAlerts','0','','Enable circulation sounds during checkin and checkout in the staff interface. Not supported by all web browsers yet.','YesNo'), >+( 'AudioAlertsCustom', '', NULL, 'Custom audio alert triggers in json associative array format', 'free' ), > ( 'AudioAlertSelectorWarning', '.audio-alert-warning', NULL, 'List of jQuery selectors that should trigger warning alert', 'free' ), > ( 'AudioAlertSelectorAction', '.audio-alert-action', NULL, 'List of jQuery selectors that should trigger action alert', 'free' ), > ( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' ), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 0989c2d..d6592d3 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8566,6 +8566,7 @@ if ( CheckVersion($DBversion) ) { > > $dbh->do(q{ > INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES >+ ( 'AudioAlertsCustom', '', NULL, 'Custom audio alert triggers in json associative array format', 'free' ), > ( 'OverrideAudioAlertWarning', '', NULL, 'URL to an audio file to replace the default warning sound.', 'free' ), > ( 'OverrideAudioAlertAction', '', NULL, 'URL to an audio file to replace the default "action required" sound.', 'free' ), > ( 'OverrideAudioAlertSuccess', '', NULL, 'URL to an audio file to replace the default success sound.', 'free' ), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index d8465cd..489f307 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -1,4 +1,5 @@ > [% USE Koha %] >+[% USE String %] > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> > <link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" /> > >@@ -73,17 +74,31 @@ > var AUDIO_ALERT_SELECTOR_ACTION = '[% Koha.Preference("AudioAlertSelectorAction") | replace( "'", "\\'" ) %]'; > var AUDIO_ALERT_SELECTOR_WARNING = '[% Koha.Preference("AudioAlertSelectorWarning") | replace( "'", "\\'" ) %]'; > var AUDIO_ALERT_SELECTOR_SUCCESS = '[% Koha.Preference("AudioAlertSelectorSuccess") | replace( "'", "\\'" ) %]'; >+ var AUDIO_ALERT_SELECTOR_CUSTOM = JSON.parse( '{ [% String.new( Koha.Preference("AudioAlertsCustom") ).collapse | replace( "'", "\\'" ) %] }' ); > //]]> > > $( document ).ready(function() { >- if ( $( AUDIO_ALERT_SELECTOR_ACTION ).length ) { >- playSoundAction(); >+ var no_sound_played = true; >+ if ( Object.keys(AUDIO_ALERT_SELECTOR_CUSTOM) ) { >+ for ( var k in AUDIO_ALERT_SELECTOR_CUSTOM ) { >+ if ( $(k).length ) { >+ playSound( AUDIO_ALERT_SELECTOR_CUSTOM[k] ); >+ no_sound_played = false; >+ break; >+ } >+ } > } >- else if ( $( AUDIO_ALERT_SELECTOR_WARNING ).length ) { >- playSoundWarning(); >- } >- else if ( $( AUDIO_ALERT_SELECTOR_SUCCESS ).length ) { >- playSoundSuccess(); >+ >+ if ( no_sound_played ) { >+ if ( $( AUDIO_ALERT_SELECTOR_ACTION ).length ) { >+ playSoundAction(); >+ } >+ else if ( $( AUDIO_ALERT_SELECTOR_WARNING ).length ) { >+ playSoundWarning(); >+ } >+ else if ( $( AUDIO_ALERT_SELECTOR_SUCCESS ).length ) { >+ playSoundSuccess(); >+ } > } > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index ea5614b..957d8df 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -656,3 +656,22 @@ Circulation: > - pref: AudioAlertSelectorSuccess > class: url > - (This should be a list of jQuery selectors, separated by commas) >+ - >+ - Use the following jQuery selectors to trigger the assigned sounds. >+ - pref: AudioAlertsCustom >+ type: textarea >+ class: code >+ - This should be a list of jQuery selectors, separated by commas, with the sound file name or url afterword, demarcated by ':' >+ - <br/> >+ - 'For example:' >+ - <br/> >+ - '".class1 .class2": "IM_notification.ogg",' >+ - <br/> >+ - '".class1 #id1": "http://domain.com/path/to/sound2.mp3"' >+ - <br/> >+ - would play Koha's internal IM_notification.ogg if any elements with classes of class1 or class2 are found on the page, >+ - and sound2.mp3 would play if any element with both the id "id1" and class "class1". >+ - <br/> >+ - The priority is from top to bottom. The sound that matches first will be played. >+ - <br/> >+ - If no match is found, Koha will fall back to the system preferences for the alert, action, and warning sounds. >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11431
:
29030
|
29031
|
29032
|
29033
|
29034
|
29035
|
29036
|
29037
|
29038
|
29039
|
29119
|
29120
|
29404
|
29764
|
29765
|
29766
|
29767
|
29768
|
29769
|
31145
|
31146
|
31147
|
31148
|
31149
|
31150
|
34637
|
34638
|
34639
|
34640
|
34641
|
34642
|
34643
|
34644
|
34645
|
34646
|
34647
|
34648
|
34649
|
34650
|
34651
|
34652
|
34653
|
34717
|
34718
|
34719
|
34720
|
34864
|
34865
|
34866
|
34867
|
35843
|
35844
|
35845
|
35846
|
38547
|
38548
|
40726
|
40727
|
40728
|
40729
|
40730
|
40731
|
40732
|
41634
|
41661
|
41662
|
42678
|
42679
|
42680
|
42681
|
42682
|
42683
|
42684
|
42685
|
42686
|
42687
|
42688
|
42689
|
42696
|
43753
|
43754
|
43755
|
43756
|
43757
|
43758
|
43759
|
43760
|
43761
|
43762
|
43763
|
43764
|
43765
|
43817
|
43820
|
43821
|
43822
|
43823
|
43824
|
43825
|
43887
|
43888
|
43889
|
43890
|
43891
|
43892
|
43893
|
43894
|
43895
|
43896
|
43897
|
43898
|
43899
|
43900
|
43901
|
43902
|
43903
|
44391
|
44392
|
44393
|
44394
|
44395
|
44396
|
44397
|
44398
|
44399
|
44400
|
44401
|
44402
|
44404
|
44405
|
44407
|
44408
|
44409
|
44411
|
44412
|
44599
|
45135