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 8576-8581 if ( CheckVersion($DBversion) ) { Link Here
8576
8576
8577
    $dbh->do(q{
8577
    $dbh->do(q{
8578
        INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES
8578
        INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES
8579
        ( 'AudioAlertsCustom',         '', NULL, 'Custom audio alert triggers in json associative array format',         'free' ),
8579
        ( 'OverrideAudioAlertWarning', '', NULL, 'URL to an audio file to replace the default warning sound.',           'free' ),
8580
        ( 'OverrideAudioAlertWarning', '', NULL, 'URL to an audio file to replace the default warning sound.',           'free' ),
8580
        ( 'OverrideAudioAlertAction',  '', NULL, 'URL to an audio file to replace the default "action required" sound.', 'free' ),
8581
        ( 'OverrideAudioAlertAction',  '', NULL, 'URL to an audio file to replace the default "action required" sound.', 'free' ),
8581
        ( 'OverrideAudioAlertSuccess', '', NULL, 'URL to an audio file to replace the default success sound.',           'free' ),
8582
        ( 'OverrideAudioAlertSuccess', '', NULL, 'URL to an audio file to replace the default success sound.',           'free' ),
Lines 8584-8590 if ( CheckVersion($DBversion) ) { Link Here
8584
        ( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' )
8585
        ( 'AudioAlertSelectorSuccess', '.audio-alert-success', NULL, 'List of jQuery selectors that should trigger successs alert', 'free' )
8585
    });
8586
    });
8586
8587
8587
    print "Upgrade to $DBversion done (Bug 11169 - Add OPACAcquisitionDetails syspref)\n";
8588
    print "Upgrade to $DBversion done (Bug 11431 - Add additional sound options for warnings)\n";
8588
    SetVersion($DBversion);
8589
    SetVersion($DBversion);
8589
}
8590
}
8590
8591
(-)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 123-129 function playSound( sound ) { Link Here
123
    if ( ! ( sound.charAt(4) == ':' && sound.charAt(5) == '/' && sound.charAt(6) == '/' ) ) {
123
    if ( ! ( sound.charAt(4) == ':' && sound.charAt(5) == '/' && sound.charAt(6) == '/' ) ) {
124
        sound = AUDIO_ALERT_PATH + sound;
124
        sound = AUDIO_ALERT_PATH + sound;
125
    }
125
    }
126
    document.getElementById("audio-alert").innerHTML = "<embed src='" + sound + "' hidden='true' autostart='true' loop='false' />";
126
    document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
127
}
127
}
128
128
129
function playSoundWarning() {
129
function playSoundWarning() {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +19 lines)
Lines 650-652 Circulation: Link Here
650
            - pref: AudioAlertSelectorSuccess
650
            - pref: AudioAlertSelectorSuccess
651
              class: url
651
              class: url
652
            - (This should be a list of jQuery selectors, separated by commas)
652
            - (This should be a list of jQuery selectors, separated by commas)
653
- 
653
        -
654
            - Use the following jQuery selectors to trigger the assigned sounds.
655
            - pref: AudioAlertsCustom
656
              type: textarea
657
              class: code 
658
            - This should be a list of jQuery selectors, separated by commas, with the sound file name or url afterword, demarcated by ':'
659
            - <br/>
660
            - 'For example:'
661
            - <br/>
662
            - '".class1 .class2": "IM_notification.ogg",'
663
            - <br/>
664
            - '".class1 #id1": "http://domain.com/path/to/sound2.mp3"'
665
            - <br/>
666
            - would play Koha's internal IM_notification.ogg if any elements with classes of class1 or class2 are found on the page,
667
            - and sound2.mp3 would play if any element with both the id "id1" and class "class1".
668
            - <br/>
669
            - The priority is from top to bottom. The sound that matches first will be played.
670
            - <br/>
671
            - If no match is found, Koha will fall back to the system preferences for the alert, action, and warning sounds.

Return to bug 11431