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

(-)a/Koha/AudioAlert.pm (+79 lines)
Line 0 Link Here
1
package Koha::AudioAlert;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use base qw(Koha::Object);
27
28
=head1 NAME
29
30
Koha::AudioAlert - Koha Borrower Object class
31
32
=head1 API
33
34
=head2 Class Methods
35
36
=head3 store
37
38
Override base store to set default precedence
39
if there is not one set already.
40
41
=cut
42
43
sub store {
44
    my ($self) = @_;
45
46
    $self->precedence( Koha::AudioAlerts->get_next_precedence() ) unless defined $self->precedence();
47
48
    return $self->SUPER::store();
49
}
50
51
=head3 move
52
53
$alert->move('up');
54
55
Changes the alert's precedence up, down, top, or bottom
56
57
=cut
58
59
sub move {
60
    my ( $self, $where ) = @_;
61
62
    return Koha::AudioAlerts->move( { audio_alert => $self, where => $where } );
63
}
64
65
=head3 type
66
67
=cut
68
69
sub type {
70
    return 'AudioAlert';
71
}
72
73
=head1 AUTHOR
74
75
Kyle M Hall <kyle@bywatersolutions.com>
76
77
=cut
78
79
1;
(-)a/Koha/AudioAlerts.pm (+157 lines)
Line 0 Link Here
1
package Koha::AudioAlerts;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use Koha::AudioAlert;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::AudioAlert - Koha Borrower Object class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=head3 search
39
40
Overrides default search such that
41
the default ordering is by precedence
42
43
=cut
44
45
sub search {
46
    my ( $self, $params, $attributes ) = @_;
47
48
    $attributes->{order_by} ||= 'precedence';
49
50
    return $self->SUPER::search( $params, $attributes );
51
}
52
53
=head3 get_next_precedence
54
55
Gets the next precedence value for audio alerts
56
57
=cut
58
59
sub get_next_precedence {
60
    my ($self) = @_;
61
62
    return $self->get_last_precedence() + 1;
63
}
64
65
=head3 get_last_precedence
66
67
Gets the last precedence value for audio alerts
68
69
=cut
70
71
sub get_last_precedence {
72
    my ($self) = @_;
73
74
    return $self->_resultset()->get_column('precedence')->max();
75
}
76
77
=head3 move
78
79
Koha::AudioAlerts->move( { audio_alert => $audio_alert, where => $where } );
80
81
Moves the given alert precedence 'up', 'down', 'top' or 'bottom'
82
83
=cut
84
85
sub move {
86
    my ( $self, $params ) = @_;
87
88
    my $alert = $params->{audio_alert};
89
    my $where = $params->{where};
90
91
    return unless ( $alert && $where );
92
93
    if ( $where eq 'up' ) {
94
        unless ( $alert->precedence() == 1 ) {
95
            my ($other) = $self->search( { precedence => $alert->precedence() - 1 } );
96
            $other->precedence( $alert->precedence() )->store();
97
            $alert->precedence( $alert->precedence() - 1 )->store();
98
        }
99
    }
100
    elsif ( $where eq 'down' ) {
101
        unless ( $alert->precedence() == $self->get_last_precedence() ) {
102
            my ($other) = $self->search( { precedence => $alert->precedence() + 1 } );
103
            $other->precedence( $alert->precedence() )->store();
104
            $alert->precedence( $alert->precedence() + 1 )->store();
105
        }
106
    }
107
    elsif ( $where eq 'top' ) {
108
        $alert->precedence(0)->store();
109
        $self->fix_precedences();
110
    }
111
    elsif ( $where eq 'bottom' ) {
112
        $alert->precedence( $self->get_next_precedence() )->store();
113
        $self->fix_precedences();
114
    }
115
}
116
117
=head3 fix_precedences
118
119
Koha::AudioAlerts->fix_precedences();
120
121
Updates precedence numbers to start with 1
122
and to have no gaps
123
124
=cut
125
126
sub fix_precedences {
127
    my ($self) = @_;
128
129
    my @alerts = $self->search();
130
131
    my $i = 1;
132
    map { $_->precedence( $i++ )->store() } @alerts;
133
}
134
135
=head3 type
136
137
=cut
138
139
sub type {
140
    return 'AudioAlert';
141
}
142
143
=head3 object_class
144
145
=cut
146
147
sub object_class {
148
    return 'Koha::AudioAlert';
149
}
150
151
=head1 AUTHOR
152
153
Kyle M Hall <kyle@bywatersolutions.com>
154
155
=cut
156
157
1;
(-)a/Koha/Object.pm (-1 / +5 lines)
Lines 255-261 sub AUTOLOAD { Link Here
255
    # Using direct setter/getter like $item->barcode() or $item->barcode($barcode);
255
    # Using direct setter/getter like $item->barcode() or $item->barcode($barcode);
256
    if ( grep {/^$method$/} @columns ) {
256
    if ( grep {/^$method$/} @columns ) {
257
        if ( @_ ) {
257
        if ( @_ ) {
258
            return $self->_result()->set_column( $method, @_ );
258
            warn "METHOD: $method";
259
            warn "VAL: " . $_[0];
260
            carp "TEST";
261
            $self->_result()->set_column( $method, @_ );
262
            return $self;
259
        } else {
263
        } else {
260
            my $value = $self->_result()->get_column( $method );
264
            my $value = $self->_result()->get_column( $method );
261
            return $value;
265
            return $value;
(-)a/Koha/Objects.pm (-3 / +3 lines)
Lines 94-110 my @objects = Koha::Objects->search($params); Link Here
94
=cut
94
=cut
95
95
96
sub search {
96
sub search {
97
    my ( $self, $params ) = @_;
97
    my ( $self, $params, $attributes ) = @_;
98
98
99
    if (wantarray) {
99
    if (wantarray) {
100
        my @dbic_rows = $self->_resultset()->search($params);
100
        my @dbic_rows = $self->_resultset()->search($params, $attributes);
101
101
102
        return $self->_wrap(@dbic_rows);
102
        return $self->_wrap(@dbic_rows);
103
103
104
    }
104
    }
105
    else {
105
    else {
106
        my $class = ref($self) ? ref($self) : $self;
106
        my $class = ref($self) ? ref($self) : $self;
107
        my $rs = $self->_resultset()->search($params);
107
        my $rs = $self->_resultset()->search($params, $attributes);
108
108
109
        return $class->_new_from_dbic($rs);
109
        return $class->_new_from_dbic($rs);
110
    }
110
    }
(-)a/Koha/Template/Plugin/Koha.pm (+7 lines)
Lines 19-24 package Koha::Template::Plugin::Koha; Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Encode qw( encode );
21
use Encode qw( encode );
22
use JSON;
22
23
23
use base qw( Template::Plugin );
24
use base qw( Template::Plugin );
24
25
Lines 45-48 sub Preference { Link Here
45
    return encode('UTF-8', C4::Context->preference( $pref ) );
46
    return encode('UTF-8', C4::Context->preference( $pref ) );
46
}
47
}
47
48
49
sub AudioAlerts {
50
    my $dbh = C4::Context->dbh;
51
    my $audio_alerts = $dbh->selectall_arrayref( 'SELECT * FROM audio_alerts ORDER BY precedence', { Slice => {} } );
52
    return encode_json($audio_alerts);
53
}
54
48
1;
55
1;
(-)a/admin/audio_alerts.pl (+60 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2014 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
use C4::Auth;
24
use C4::Output;
25
use Koha::AudioAlert;
26
use Koha::AudioAlerts;
27
28
my $cgi = new CGI;
29
30
my $selector = $cgi->param('selector');
31
my $sound    = $cgi->param('sound');
32
my $id       = $cgi->param('id');
33
my $action     = $cgi->param('action');
34
my $where    = $cgi->param('where');
35
my @delete   = $cgi->param('delete');
36
37
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
38
    {
39
        template_name   => "admin/audio_alerts.tt",
40
        query           => $cgi,
41
        type            => "intranet",
42
        authnotrequired => 0,
43
        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
44
        debug           => 1,
45
    }
46
);
47
48
if ( $selector && $sound ) {
49
    Koha::AudioAlert->new( { selector => $selector, sound => $sound } )->store();
50
}
51
52
map { Koha::AudioAlerts->find($_)->delete() } @delete;
53
54
if ( $id && $action && $where && $action eq 'move' ) {
55
    Koha::AudioAlerts->find($id)->move($where);
56
}
57
58
$template->param( audio_alerts => scalar Koha::AudioAlerts->search() );
59
60
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 597-603 $template->param( Link Here
597
    inprocess         => $inprocess,
597
    inprocess         => $inprocess,
598
    is_child          => ($borrowernumber && $borrower->{'category_type'} eq 'C'),
598
    is_child          => ($borrowernumber && $borrower->{'category_type'} eq 'C'),
599
    circview => 1,
599
    circview => 1,
600
    soundon           => C4::Context->preference("SoundOn"),
600
    AudioAlerts           => C4::Context->preference("AudioAlerts"),
601
    fast_cataloging   => $fast_cataloging,
601
    fast_cataloging   => $fast_cataloging,
602
    CircAutoPrintQuickSlip   => C4::Context->preference("CircAutoPrintQuickSlip"),
602
    CircAutoPrintQuickSlip   => C4::Context->preference("CircAutoPrintQuickSlip"),
603
    activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
603
    activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
(-)a/circ/returns.pl (-1 / +1 lines)
Lines 591-597 $template->param( Link Here
591
    dropboxmode    => $dropboxmode,
591
    dropboxmode    => $dropboxmode,
592
    dropboxdate    => output_pref($dropboxdate),
592
    dropboxdate    => output_pref($dropboxdate),
593
    overduecharges => $overduecharges,
593
    overduecharges => $overduecharges,
594
    soundon        => C4::Context->preference("SoundOn"),
594
    AudioAlerts        => C4::Context->preference("AudioAlerts"),
595
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
595
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
596
);
596
);
597
597
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc (+1 lines)
Lines 64-69 Link Here
64
    <li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a></li>
64
    <li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a></li>
65
    <li><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></li>
65
    <li><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></li>
66
    <li><a href="/cgi-bin/koha/admin/columns_settings.pl">Columns settings</a></li>
66
    <li><a href="/cgi-bin/koha/admin/columns_settings.pl">Columns settings</a></li>
67
    <li><a href="/cgi-bin/koha/admin/audio_alerts.pl">Audio alerts</a></li>
67
</ul>
68
</ul>
68
</div>
69
</div>
69
</div>
70
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (-13 / +41 lines)
Lines 1-13 Link Here
1
[% USE Koha %]
2
[% USE String %]
1
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2
<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" />
5
3
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui.css" />
6
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui.css" />
4
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/bootstrap/bootstrap.min.css" />
7
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/bootstrap/bootstrap.min.css" />
5
<link rel="stylesheet" type="text/css" media="print" href="[% themelang %]/css/print.css" />
8
<link rel="stylesheet" type="text/css" media="print" href="[% themelang %]/css/print.css" />
6
[% INCLUDE intranetstylesheet.inc %]
9
[% INCLUDE intranetstylesheet.inc %]
7
[% IF ( bidi ) %]
10
[% IF ( bidi )            %]<link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />[% END %]
8
   <link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
9
[% END %]
10
[% IF ( IntranetUserCSS ) %]<style type="text/css">[% IntranetUserCSS %]</style>[% END %]
11
[% IF ( IntranetUserCSS ) %]<style type="text/css">[% IntranetUserCSS %]</style>[% END %]
12
11
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
13
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
12
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui.js"></script>
14
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui.js"></script>
13
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
15
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
Lines 22-35 Link Here
22
24
23
<!-- koha core js -->
25
<!-- koha core js -->
24
<script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
26
<script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
27
25
[% INCLUDE 'validator-strings.inc' %]
28
[% INCLUDE 'validator-strings.inc' %]
29
26
[% IF ( intranetuserjs ) %]
30
[% IF ( intranetuserjs ) %]
27
    <script type="text/javascript">
31
    <script type="text/javascript">
28
    //<![CDATA[
32
        //<![CDATA[
29
    [% intranetuserjs %]
33
            [% intranetuserjs %]
30
    //]]>
34
        //]]>
31
    </script>
35
    </script>
32
[% END %]
36
[% END %]
37
33
[% IF ( virtualshelves || intranetbookbag ) %]
38
[% IF ( virtualshelves || intranetbookbag ) %]
34
<script type="text/javascript">
39
<script type="text/javascript">
35
    //<![CDATA[
40
    //<![CDATA[
Lines 46-58 Link Here
46
        var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved.");
51
        var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved.");
47
    //]]>
52
    //]]>
48
    </script>
53
    </script>
49
<script type="text/javascript" src="[% themelang %]/js/basket.js"></script>
54
55
    <script type="text/javascript" src="[% themelang %]/js/basket.js"></script>
50
[% END %]
56
[% END %]
57
51
[% IF LocalCoverImages %]
58
[% IF LocalCoverImages %]
52
<script type="text/javascript" src="[% themelang %]/js/localcovers.js"></script>
59
    <script type="text/javascript" src="[% themelang %]/js/localcovers.js"></script>
53
<script type="text/javascript">
60
    <script type="text/javascript">
54
//<![CDATA[
61
        //<![CDATA[
55
var NO_LOCAL_JACKET = _("No cover image available");
62
            var NO_LOCAL_JACKET = _("No cover image available");
56
//]]>
63
        //]]>
57
</script>
64
    </script>
65
[% END %]
66
67
[% IF Koha.Preference('AudioAlerts') %]
68
    <script type="text/javascript">
69
        //<![CDATA[
70
            var AUDIO_ALERT_PATH = '[% interface %]/[% theme %]/sound/';
71
            var AUDIO_ALERTS = JSON.parse( '[% Koha.AudioAlerts | replace( "'", "\\'" ) %]' );
72
        //]]>
73
74
        $( document ).ready(function() {
75
            if ( AUDIO_ALERTS ) {
76
                for ( var k in AUDIO_ALERTS ) {
77
                    var alert = AUDIO_ALERTS[k];
78
                    if ( $( alert.selector ).length ) {
79
                        playSound( alert.sound );
80
                        break;
81
                    }
82
                }
83
            }
84
        });
85
    </script>
58
[% END %]
86
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc (+1 lines)
Lines 65-69 Link Here
65
        </div>
65
        </div>
66
    [% END %]
66
    [% END %]
67
[% END %]
67
[% END %]
68
    <span id="audio-alert"></span>
68
    </body>
69
    </body>
69
</html>
70
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js (+8 lines)
Lines 120-122 function toUC(f) { Link Here
120
function confirmDelete(message) {
120
function confirmDelete(message) {
121
    return (confirm(message) ? true : false);
121
    return (confirm(message) ? true : false);
122
}
122
}
123
124
function playSound( sound ) {
125
    // This is way faster than substring
126
    if ( ! ( sound.charAt(4) == ':' && sound.charAt(5) == '/' && sound.charAt(6) == '/' ) ) {
127
        sound = AUDIO_ALERT_PATH + sound;
128
    }
129
    document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
130
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+2 lines)
Lines 104-109 Link Here
104
    <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
104
    <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
105
    <dt><a href="/cgi-bin/koha/admin/columns_settings.pl">Configure columns</a></dt>
105
    <dt><a href="/cgi-bin/koha/admin/columns_settings.pl">Configure columns</a></dt>
106
    <dd>Hide or show columns for tables.</dd>
106
    <dd>Hide or show columns for tables.</dd>
107
    <dt><a href="/cgi-bin/koha/admin/audio_alerts.pl">Audio alerts</a></dt>
108
    <dd>Define which events trigger which sounds</dd>
107
</dl>
109
</dl>
108
</div>
110
</div>
109
111
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt (+131 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; Audio alerts</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
5
<script type="text/javascript">
6
$( document ).ready(function() {
7
    $.ajax({
8
        //This will retrieve the contents of the folder if the folder is configured as 'browsable'
9
        url: AUDIO_ALERT_PATH,
10
        success: function (data) {
11
            $("#fileNames").html('<ul>');
12
            //List all png or jpg or gif file names in the page
13
            $(data).find('a:contains("ogg")').each(function () {
14
                var filename = this.href.split('/').pop();
15
                $('#koha-sounds').append($('<option>', { value : filename }).text(filename));
16
            });
17
        }
18
    });
19
20
    $('#koha-sounds').on('change', function() {
21
        $('#sound').val( this.value );
22
    });
23
24
    $('#koha-sounds').on('change', function() {
25
        $('#sound').val( this.value );
26
    });
27
28
    $('#play-sound').on('click', function() {
29
        playSound( $('#sound').val() );
30
        return false;
31
    });
32
33
    $('#new-alert-form').on('submit', function() {
34
        if ( ! $('#selector').val() ) {
35
            alert(_("You must enter a selector!"));
36
            return false;
37
        } else if ( ! $('#sound').val() ) {
38
            alert(_("You must choose a sound!"));
39
            return false;
40
        } else {
41
            return true;
42
        }
43
    });
44
45
    $('#delete-alert-form').on('submit', function() {
46
        return confirm(_("Are you sure you want to delete the selected audio alerts?"));
47
    });
48
});
49
</script>
50
51
</head>
52
<body>
53
[% INCLUDE 'header.inc' %]
54
[% INCLUDE 'patrons-admin-search.inc' %]
55
56
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Audio alerts</div>
57
58
<div id="doc3" class="yui-t2">
59
    <div id="bd">
60
        <div id="yui-main">
61
            <div class="yui-b">
62
                <form id="new-alert-form" action="audio_alerts.pl" method="post">
63
                    <fieldset class="form-inline">
64
                        <legend>Add new alert</legend>
65
66
                        <input id="selector" name="selector" type="text" class="input-large" placeholder="selector" />
67
                        <input id="sound" name="sound" type="text" class="input-large" placeholder="sound" />
68
69
                        <button id="play-sound" class="btn"><i class="icon-play"></i> Play sound</button>
70
71
                        <br/>
72
73
                        <select id="koha-sounds">
74
                            <option value="">Select built-in sound</option>
75
                        </select>
76
77
                        <button id="save-alert" type="submit" class="btn"><i class="icon-hdd"></i> Save alert</button>
78
                    </fieldset>
79
                </form>
80
81
                <form id="delete-alert-form" action="audio_alerts.pl" method="post">
82
                    <table>
83
                        <thead>
84
                            <tr>
85
                                <th>&nbsp;</th>
86
                                <th>Precedence</th>
87
                                <th>&nbsp;</th>
88
                                <th>Selector</th>
89
                                <th>Sound</th>
90
                            </tr>
91
                        </thead>
92
93
                        <tbody>
94
                            [% FOREACH a IN audio_alerts %]
95
                                <tr>
96
                                    <td><input type="checkbox" name="delete" value="[% a.id %]" /></td>
97
                                    <td>[% a.precedence %]</td>
98
                                    <td style="white-space:nowrap;">
99
                                        <a title="Move alert up" href="audio_alerts.pl?action=move&amp;where=up&amp;id=[% a.id %]">
100
                                            <img src="[% interface %]/[% theme %]/img/go-up.png" border="0" alt="Go up" />
101
                                        </a>
102
103
                                        <a title="Move alert to top" href="audio_alerts.pl?action=move&amp;where=top&amp;id=[% a.id %]">
104
                                            <img src="[% interface %]/[% theme %]/img/go-top.png" border="0" alt="Go top" />
105
                                        </a>
106
107
                                        <a title="Move alert to bottom" href="audio_alerts.pl?action=move&amp;where=bottom&amp;id=[% a.id %]">
108
                                            <img src="[% interface %]/[% theme %]/img/go-bottom.png" border="0" alt="Go bottom" />
109
                                        </a>
110
111
                                        <a title="Move alert down" href="audio_alerts.pl?action=move&amp;where=down&amp;id=[% a.id %]">
112
                                            <img src="[% interface %]/[% theme %]/img/go-down.png" border="0" alt="Go down" />
113
                                        </a>
114
                                    </td>
115
                                    <td>[% a.selector %]</td>
116
                                    <td>[% a.sound %]</td>
117
                                </tr>
118
                            [% END %]
119
                        </tbody>
120
                    </table>
121
122
                    <p/>
123
                    <button id="delete-alerts" type="submit" class="btn"><i class="icon-trash"></i> Delete selected alerts</button>
124
                </form>
125
            </div>
126
        </div>
127
    <div class="yui-b">
128
[% INCLUDE 'admin-menu.inc' %]
129
</div>
130
</div>
131
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-7 lines)
Lines 40-51 Circulation: Link Here
40
                  desc: latest to earliest
40
                  desc: latest to earliest
41
            - due date.
41
            - due date.
42
        -
42
        -
43
            - pref: soundon
44
              choices: 
45
                 yes: "Enable"
46
                 no: "Don't enable"
47
            - circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.
48
        -
49
            - pref: SpecifyDueDate
43
            - pref: SpecifyDueDate
50
              choices:
44
              choices:
51
                  yes: Allow
45
                  yes: Allow
Lines 693-699 Circulation: Link Here
693
                  yes: Show
687
                  yes: Show
694
                  no: "Don't show"
688
                  no: "Don't show"
695
            - "the print receipt popup dialog when self checkout is finished"
689
            - "the print receipt popup dialog when self checkout is finished"
696
697
    Course Reserves:
690
    Course Reserves:
698
        -
691
        -
699
            - pref: UseCourseReserves
692
            - pref: UseCourseReserves
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref (+6 lines)
Lines 128-130 Staff Client: Link Here
128
                  yes: Enable
128
                  yes: Enable
129
                  no: Disable
129
                  no: Disable
130
            - item selection in record detail page.
130
            - item selection in record detail page.
131
        -
132
            - pref: AudioAlerts
133
              choices:
134
                 yes: "Enable"
135
                 no: "Don't enable"
136
            - audio alerts for events defined in the audio alerts section of administration.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-11 / +4 lines)
Lines 172-178 $(document).ready(function() { Link Here
172
[% IF ( NEEDSCONFIRMATION ) %]
172
[% IF ( NEEDSCONFIRMATION ) %]
173
<div class="yui-g">
173
<div class="yui-g">
174
174
175
<div id="circ_needsconfirmation" class="dialog alert">
175
<div id="circ_needsconfirmation" class="dialog alert audio-alert-action">
176
[% IF CAN_user_circulate_force_checkout %]
176
[% IF CAN_user_circulate_force_checkout %]
177
  <h3>Please confirm checkout</h3>
177
  <h3>Please confirm checkout</h3>
178
[% ELSE %]
178
[% ELSE %]
Lines 345-356 $(document).ready(function() { Link Here
345
345
346
        [% IF ( IMPOSSIBLE ) %]
346
        [% IF ( IMPOSSIBLE ) %]
347
347
348
[% IF ( soundon ) %]
349
<audio src="[% interface %]/[% theme %]/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
350
[% END %]        
351
352
<div class="yui-g">
348
<div class="yui-g">
353
<div id="circ_impossible" class="dialog alert">
349
<div id="circ_impossible" class="dialog alert audio-alert-warning">
354
<!-- RESULT OF ISSUING REQUEST -->
350
<!-- RESULT OF ISSUING REQUEST -->
355
        <ul>
351
        <ul>
356
        [% IF ( STATS ) %]
352
        [% IF ( STATS ) %]
Lines 462-476 $(document).ready(function() { Link Here
462
458
463
</div></div>
459
</div></div>
464
[% ELSE %]
460
[% ELSE %]
465
[% IF ( soundon ) %]
466
<audio src="[% interface %]/[% theme %]/sound/beep.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
467
[% END %]
468
469
  [% IF (forceallow) %]
461
  [% IF (forceallow) %]
470
      <div id="overridden_debarment" class="dialog alert">Restriction overridden temporarily</div>
462
      <div id="overridden_debarment" class="dialog alert">Restriction overridden temporarily</div>
471
  [% END %]
463
  [% END %]
464
[% END %] <!-- /impossible -->
472
465
473
    [% END %] <!-- /impossible -->
466
<span class="audio-alert-success"></span>
474
467
475
[% IF ( issued ) %]
468
[% IF ( issued ) %]
476
<p>Item checked out</p>
469
<p>Item checked out</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-33 / +8 lines)
Lines 89-94 $(document).ready(function () { Link Here
89
</script>
89
</script>
90
</head>
90
</head>
91
<body id="circ_returns" class="circ">
91
<body id="circ_returns" class="circ">
92
<span class="audio-alert-success"></span>
92
93
93
[% INCLUDE 'header.inc' %]
94
[% INCLUDE 'header.inc' %]
94
[% INCLUDE 'checkin-search.inc' %]
95
[% INCLUDE 'checkin-search.inc' %]
Lines 174-184 $(document).ready(function () { Link Here
174
    [% IF ( waiting ) %]
175
    [% IF ( waiting ) %]
175
	<!-- waiting -->
176
	<!-- waiting -->
176
177
177
[% IF ( soundon ) %]
178
    <div id="hold-found1" class="dialog message audio-alert-action">
178
<audio src="[% interface %]/[% theme %]/sound/ending.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
179
[% END %]
180
181
<div id="hold-found1" class="dialog message">
182
        <h3>Hold found (item is already waiting):  <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
179
        <h3>Hold found (item is already waiting):  <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
183
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
180
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
184
        <h4>Hold for:</h4>
181
        <h4>Hold for:</h4>
Lines 220-229 $(document).ready(function () { Link Here
220
217
221
    [% IF ( diffbranch ) %]
218
    [% IF ( diffbranch ) %]
222
		<!-- diffbranch -->
219
		<!-- diffbranch -->
223
        [% IF ( soundon ) %]
220
        <div id="transfer-needed" class="dialog message audio-alert-action">
224
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
225
        [% END %]
226
        <div id="transfer-needed" class="dialog message">
227
		<h3>Hold needing transfer found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
221
		<h3>Hold needing transfer found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
228
                <h4>Hold for: </h4>
222
                <h4>Hold for: </h4>
229
                    <ul>
223
                    <ul>
Lines 263-282 $(document).ready(function () { Link Here
263
257
264
    [% IF ( transfer ) %]
258
    [% IF ( transfer ) %]
265
    <!-- transfer: item with no reservation, must be returned to its home library -->
259
    <!-- transfer: item with no reservation, must be returned to its home library -->
266
	<div id="return1" class="dialog message">
260
    <div id="return1" class="dialog message audio-alert-action">
267
            <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% homebranchname %]<br/>( <a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print slip</a> )</h3>
261
            <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% homebranchname %]<br/>( <a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print slip</a> )</h3>
268
        </div>
262
        </div>
269
        [% IF ( soundon ) %]
270
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
271
        [% END %]
272
    [% END %]
263
    [% END %]
273
264
274
    [% IF ( needstransfer ) %]
265
    [% IF ( needstransfer ) %]
275
	<!-- needstransfer -->
266
	<!-- needstransfer -->
276
        [% IF ( soundon ) %]
267
    <div id="item-transfer" class="dialog message audio-alert-action"><h3> This item needs to be transferred to [% homebranchname %]</h3>
277
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
278
        [% END %]
279
	<div id="item-transfer" class="dialog message"><h3> This item needs to be transferred to [% homebranchname %]</h3>
280
    Transfer now?<br />
268
    Transfer now?<br />
281
    <form method="post" action="returns.pl" name="mainform" id="mainform">
269
    <form method="post" action="returns.pl" name="mainform" id="mainform">
282
    [% IF itemnumber %]
270
    [% IF itemnumber %]
Lines 301-310 $(document).ready(function () { Link Here
301
289
302
    [% IF ( diffbranch ) %]
290
    [% IF ( diffbranch ) %]
303
	<!-- diffbranch -->
291
	<!-- diffbranch -->
304
        [% IF ( soundon ) %]
292
        <h3 class="audio-alert-action">Item consigned:</h3>
305
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
306
        [% END %]
307
        <h3>Item consigned:</h3>
308
        <table>
293
        <table>
309
        <caption><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a></caption>
294
        <caption><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a></caption>
310
        <tr>
295
        <tr>
Lines 333-343 $(document).ready(function () { Link Here
333
    [% IF ( reserved ) %]
318
    [% IF ( reserved ) %]
334
	<!--  reserved  -->
319
	<!--  reserved  -->
335
320
336
        [% IF ( soundon ) %]
321
    <div id="hold-found2" class="dialog message audio-alert-action">
337
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
338
        [% END %]
339
340
	<div id="hold-found2" class="dialog message">
341
      <h3>Hold found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
322
      <h3>Hold found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
342
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
323
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
343
        <h5>Hold for:</h5>
324
        <h5>Hold for:</h5>
Lines 385-391 $(document).ready(function () { Link Here
385
[% END %]
366
[% END %]
386
367
387
[% IF ( errmsgloop ) %]
368
[% IF ( errmsgloop ) %]
388
    <div class="dialog alert">
369
    <div class="dialog alert audio-alert-warning">
389
        <h3>Check in message</h3>
370
        <h3>Check in message</h3>
390
        [% FOREACH errmsgloo IN errmsgloop %]
371
        [% FOREACH errmsgloo IN errmsgloop %]
391
                    [% IF ( errmsgloo.NotForLoanStatusUpdated ) %]
372
                    [% IF ( errmsgloo.NotForLoanStatusUpdated ) %]
Lines 444-456 $(document).ready(function () { Link Here
444
                    [% END %]
425
                    [% END %]
445
426
446
            [% END %]
427
            [% END %]
447
[% IF ( soundon ) %]
448
<audio src="[% interface %]/[% theme %]/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
449
[% END %]
450
        [% ELSE %]
428
        [% ELSE %]
451
[% IF ( soundon ) %]
452
<audio src="[% interface %]/[% theme %]/sound/beep.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
453
[% END %]
454
        [% END %]
429
        [% END %]
455
    </div>
430
    </div>
456
431
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/audio_alerts.tt (-1 / +29 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'help-top.inc' %]
2
3
<h1>Audio alerts</h1>
4
5
<p>This section of Koha lets you specify a given sound to play when a given jQuery selector is matched.</p>
6
7
<h2>Adding a new alert</h2>
8
9
<p>To add a new alert:</p>
10
11
<ul>
12
    <li>Locate the "Add new alert" form.</li>
13
    <li>Enter a selector in the "selector" input, you can see documentation on jQuery selectors <a href="http://api.jquery.com/category/selectors/">here</a>.
14
    <li>Enter a sound to be played, you can either select a built-in Koha sound using the pulldown selector, or you can enter a full URL to a sound file on another server</li>
15
    <li>At this point, you can preview your sound by clicking the "Play sound" button</li>
16
    <li>Click "Save alert" and your done!</li>
17
</ul>
18
19
<h2>Sound precedence</h2>
20
21
<p>Sounds will be played in order from top to bottom. That is, the first select that finds a match will have its sound played.</p>
22
23
<p>To change the precedence of a given alert, use the four arrows to move it up, down, or to the top or bottom of the list.</o>
24
25
<h2>Deleting alerts</h2>
26
27
<p>To delete one or more alerts, check the checkboxes for those alerts you wish to delete, then click the "Delete selected alerts" button and confirm you want to delete those alerts.
28
29
[% INCLUDE 'help-bottom.inc' %]

Return to bug 11431