View | Details | Raw Unified | Return to bug 11431
Collapse All | Expand All

(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 42-47 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
42
('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'),
42
('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'),
43
('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',''),
43
('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',''),
44
('AudioAlerts','0','','Enable circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.','YesNo'),
44
('AudioAlerts','0','','Enable circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.','YesNo'),
45
( 'AudioAlertsCustom', '', NULL, 'Custom audio alert triggers in json associative array format', 'free' ),
45
( 'AudioAlertSelectorWarning', '.audio-alert-warning', NULL, 'List of jQuery selectors that should trigger warning alert',  'free' ),
46
( 'AudioAlertSelectorWarning', '.audio-alert-warning', NULL, 'List of jQuery selectors that should trigger warning alert',  'free' ),
46
( 'AudioAlertSelectorAction',  '.audio-alert-action',  NULL, 'List of jQuery selectors that should trigger action alert',   'free' ),
47
( 'AudioAlertSelectorAction',  '.audio-alert-action',  NULL, 'List of jQuery selectors that should trigger action alert',   'free' ),
47
( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' ),
48
( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' ),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +2 lines)
Lines 9614-9619 if ( CheckVersion($DBversion) ) { Link Here
9614
9614
9615
    $dbh->do(q{
9615
    $dbh->do(q{
9616
        INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES
9616
        INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES
9617
        ( 'AudioAlertsCustom',         '', NULL, 'Custom audio alert triggers in json associative array format',         'free' ),
9617
        ( 'OverrideAudioAlertWarning', '', NULL, 'URL to an audio file to replace the default warning sound.',           'free' ),
9618
        ( 'OverrideAudioAlertWarning', '', NULL, 'URL to an audio file to replace the default warning sound.',           'free' ),
9618
        ( 'OverrideAudioAlertAction',  '', NULL, 'URL to an audio file to replace the default "action required" sound.', 'free' ),
9619
        ( 'OverrideAudioAlertAction',  '', NULL, 'URL to an audio file to replace the default "action required" sound.', 'free' ),
9619
        ( 'OverrideAudioAlertSuccess', '', NULL, 'URL to an audio file to replace the default success sound.',           'free' ),
9620
        ( 'OverrideAudioAlertSuccess', '', NULL, 'URL to an audio file to replace the default success sound.',           'free' ),
Lines 9622-9628 if ( CheckVersion($DBversion) ) { Link Here
9622
        ( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' )
9623
        ( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' )
9623
    });
9624
    });
9624
9625
9625
    print "Upgrade to $DBversion done (Bug 11169 - Add OPACAcquisitionDetails syspref)\n";
9626
    print "Upgrade to $DBversion done (Bug 11431 - Add additional sound options for warnings)\n";
9626
    SetVersion($DBversion);
9627
    SetVersion($DBversion);
9627
}
9628
}
9628
9629
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (-7 / +22 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE String %]
2
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
4
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
4
5
Lines 73-89 Link Here
73
            var AUDIO_ALERT_SELECTOR_ACTION  = '[% Koha.Preference("AudioAlertSelectorAction")  | replace( "'", "\\'" ) %]';
74
            var AUDIO_ALERT_SELECTOR_ACTION  = '[% Koha.Preference("AudioAlertSelectorAction")  | replace( "'", "\\'" ) %]';
74
            var AUDIO_ALERT_SELECTOR_WARNING = '[% Koha.Preference("AudioAlertSelectorWarning") | replace( "'", "\\'" ) %]';
75
            var AUDIO_ALERT_SELECTOR_WARNING = '[% Koha.Preference("AudioAlertSelectorWarning") | replace( "'", "\\'" ) %]';
75
            var AUDIO_ALERT_SELECTOR_SUCCESS = '[% Koha.Preference("AudioAlertSelectorSuccess") | replace( "'", "\\'" ) %]';
76
            var AUDIO_ALERT_SELECTOR_SUCCESS = '[% Koha.Preference("AudioAlertSelectorSuccess") | replace( "'", "\\'" ) %]';
77
            var AUDIO_ALERT_SELECTOR_CUSTOM = JSON.parse( '{ [% String.new( Koha.Preference("AudioAlertsCustom") ).collapse | replace( "'", "\\'" ) %] }' );
76
        //]]>
78
        //]]>
77
79
78
        $( document ).ready(function() {
80
        $( document ).ready(function() {
79
            if ( $( AUDIO_ALERT_SELECTOR_ACTION ).length ) {
81
            var no_sound_played = true;
80
                playSoundAction();
82
            if ( Object.keys(AUDIO_ALERT_SELECTOR_CUSTOM) ) {
83
                for ( var k in AUDIO_ALERT_SELECTOR_CUSTOM ) {
84
                    if ( $(k).length ) {
85
                        playSound( AUDIO_ALERT_SELECTOR_CUSTOM[k] );
86
                        no_sound_played = false;
87
                        break;
88
                    }
89
                }
81
            }
90
            }
82
            else if ( $( AUDIO_ALERT_SELECTOR_WARNING ).length ) {
91
83
                playSoundWarning();
92
            if ( no_sound_played ) {
84
            }
93
                if ( $( AUDIO_ALERT_SELECTOR_ACTION ).length ) {
85
            else if ( $( AUDIO_ALERT_SELECTOR_SUCCESS ).length ) {
94
                    playSoundAction();
86
                playSoundSuccess();
95
                }
96
                else if ( $( AUDIO_ALERT_SELECTOR_WARNING ).length ) {
97
                    playSoundWarning();
98
                }
99
                else if ( $( AUDIO_ALERT_SELECTOR_SUCCESS ).length ) {
100
                    playSoundSuccess();
101
                }
87
            }
102
            }
88
        });
103
        });
89
    </script>
104
    </script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js (-1 / +1 lines)
Lines 126-132 function playSound( sound ) { Link Here
126
    if ( ! ( sound.charAt(4) == ':' && sound.charAt(5) == '/' && sound.charAt(6) == '/' ) ) {
126
    if ( ! ( sound.charAt(4) == ':' && sound.charAt(5) == '/' && sound.charAt(6) == '/' ) ) {
127
        sound = AUDIO_ALERT_PATH + sound;
127
        sound = AUDIO_ALERT_PATH + sound;
128
    }
128
    }
129
    document.getElementById("audio-alert").innerHTML = "<embed src='" + sound + "' hidden='true' autostart='true' loop='false' />";
129
    document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
130
}
130
}
131
131
132
function playSoundWarning() {
132
function playSoundWarning() {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +19 lines)
Lines 732-734 Circulation: Link Here
732
            - pref: AudioAlertSelectorSuccess
732
            - pref: AudioAlertSelectorSuccess
733
              class: url
733
              class: url
734
            - (This should be a list of jQuery selectors, separated by commas)
734
            - (This should be a list of jQuery selectors, separated by commas)
735
- 
735
        -
736
            - Use the following jQuery selectors to trigger the assigned sounds.
737
            - pref: AudioAlertsCustom
738
              type: textarea
739
              class: code
740
            - This should be a list of jQuery selectors, separated by commas, with the sound file name or url afterword, demarcated by ':'
741
            - <br/>
742
            - 'For example:'
743
            - <br/>
744
            - '".class1 .class2": "IM_notification.ogg",'
745
            - <br/>
746
            - '".class1 #id1": "http://domain.com/path/to/sound2.mp3"'
747
            - <br/>
748
            - would play Koha's internal IM_notification.ogg if any elements with classes of class1 or class2 are found on the page,
749
            - and sound2.mp3 would play if any element with both the id "id1" and class "class1".
750
            - <br/>
751
            - The priority is from top to bottom. The sound that matches first will be played.
752
            - <br/>
753
            - If no match is found, Koha will fall back to the system preferences for the alert, action, and warning sounds.

Return to bug 11431