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

(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 40-45 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
40
('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'),
40
('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'),
41
('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',''),
41
('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',''),
42
('AudioAlerts','0','','Enable circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.','YesNo'),
42
('AudioAlerts','0','','Enable circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.','YesNo'),
43
( 'AudioAlertsCustom', '', NULL, 'Custom audio alert triggers in json associative array format', 'free' ),
43
( 'AudioAlertSelectorWarning', '.audio-alert-warning', NULL, 'List of jQuery selectors that should trigger warning alert',  'free' ),
44
( 'AudioAlertSelectorWarning', '.audio-alert-warning', NULL, 'List of jQuery selectors that should trigger warning alert',  'free' ),
44
( 'AudioAlertSelectorAction',  '.audio-alert-action',  NULL, 'List of jQuery selectors that should trigger action alert',   'free' ),
45
( 'AudioAlertSelectorAction',  '.audio-alert-action',  NULL, 'List of jQuery selectors that should trigger action alert',   'free' ),
45
( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' ),
46
( '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 8619-8624 if ( CheckVersion($DBversion) ) { Link Here
8619
8619
8620
    $dbh->do(q{
8620
    $dbh->do(q{
8621
        INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES
8621
        INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES
8622
        ( 'AudioAlertsCustom',         '', NULL, 'Custom audio alert triggers in json associative array format',         'free' ),
8622
        ( 'OverrideAudioAlertWarning', '', NULL, 'URL to an audio file to replace the default warning sound.',           'free' ),
8623
        ( 'OverrideAudioAlertWarning', '', NULL, 'URL to an audio file to replace the default warning sound.',           'free' ),
8623
        ( 'OverrideAudioAlertAction',  '', NULL, 'URL to an audio file to replace the default "action required" sound.', 'free' ),
8624
        ( 'OverrideAudioAlertAction',  '', NULL, 'URL to an audio file to replace the default "action required" sound.', 'free' ),
8624
        ( 'OverrideAudioAlertSuccess', '', NULL, 'URL to an audio file to replace the default success sound.',           'free' ),
8625
        ( 'OverrideAudioAlertSuccess', '', NULL, 'URL to an audio file to replace the default success sound.',           'free' ),
Lines 8627-8633 if ( CheckVersion($DBversion) ) { Link Here
8627
        ( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' )
8628
        ( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' )
8628
    });
8629
    });
8629
8630
8630
    print "Upgrade to $DBversion done (Bug 11169 - Add OPACAcquisitionDetails syspref)\n";
8631
    print "Upgrade to $DBversion done (Bug 11431 - Add additional sound options for warnings)\n";
8631
    SetVersion($DBversion);
8632
    SetVersion($DBversion);
8632
}
8633
}
8633
8634
(-)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 128-134 function playSound( sound ) { Link Here
128
    if ( ! ( sound.charAt(4) == ':' && sound.charAt(5) == '/' && sound.charAt(6) == '/' ) ) {
128
    if ( ! ( sound.charAt(4) == ':' && sound.charAt(5) == '/' && sound.charAt(6) == '/' ) ) {
129
        sound = AUDIO_ALERT_PATH + sound;
129
        sound = AUDIO_ALERT_PATH + sound;
130
    }
130
    }
131
    document.getElementById("audio-alert").innerHTML = "<embed src='" + sound + "' hidden='true' autostart='true' loop='false' />";
131
    document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
132
}
132
}
133
133
134
function playSoundWarning() {
134
function playSoundWarning() {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +19 lines)
Lines 656-658 Circulation: Link Here
656
            - pref: AudioAlertSelectorSuccess
656
            - pref: AudioAlertSelectorSuccess
657
              class: url
657
              class: url
658
            - (This should be a list of jQuery selectors, separated by commas)
658
            - (This should be a list of jQuery selectors, separated by commas)
659
- 
659
        -
660
            - Use the following jQuery selectors to trigger the assigned sounds.
661
            - pref: AudioAlertsCustom
662
              type: textarea
663
              class: code
664
            - This should be a list of jQuery selectors, separated by commas, with the sound file name or url afterword, demarcated by ':'
665
            - <br/>
666
            - 'For example:'
667
            - <br/>
668
            - '".class1 .class2": "IM_notification.ogg",'
669
            - <br/>
670
            - '".class1 #id1": "http://domain.com/path/to/sound2.mp3"'
671
            - <br/>
672
            - would play Koha's internal IM_notification.ogg if any elements with classes of class1 or class2 are found on the page,
673
            - and sound2.mp3 would play if any element with both the id "id1" and class "class1".
674
            - <br/>
675
            - The priority is from top to bottom. The sound that matches first will be played.
676
            - <br/>
677
            - If no match is found, Koha will fall back to the system preferences for the alert, action, and warning sounds.

Return to bug 11431