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 / +2 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
            $self->_result()->set_column( $method, @_ );
259
            return $self;
259
        } else {
260
        } else {
260
            my $value = $self->_result()->get_column( $method );
261
            my $value = $self->_result()->get_column( $method );
261
            return $value;
262
            return $value;
(-)a/Koha/Template/Plugin/Koha.pm (-4 / +10 lines)
Lines 18-23 package Koha::Template::Plugin::Koha; Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Encode qw( encode );
22
use JSON;
21
23
22
use base qw( Template::Plugin );
24
use base qw( Template::Plugin );
23
25
Lines 47-62 sub Preference { Link Here
47
49
48
sub Version {
50
sub Version {
49
    my $version_string = Koha::version();
51
    my $version_string = Koha::version();
50
    my ($major,$minor,$maintenance,$development) = split('\.',$version_string);
52
    my ( $major, $minor, $maintenance, $development ) = split( '\.', $version_string );
51
53
52
    return {
54
    return {
53
        major       => $major,
55
        major       => $major,
54
        release     => $major . "." . $minor,
56
        release     => $major . "." . $minor,
55
        maintenance => $major . "." . $minor . "." . $maintenance,
57
        maintenance => $major . "." . $minor . "." . $maintenance,
56
        development => ( $development ne '000' )
58
        development => ( $development ne '000' ) ? $development : undef,
57
                            ? $development
58
                            : undef
59
    };
59
    };
60
}
60
}
61
61
62
sub AudioAlerts {
63
    my $dbh = C4::Context->dbh;
64
    my $audio_alerts = $dbh->selectall_arrayref( 'SELECT * FROM audio_alerts ORDER BY precedence', { Slice => {} } );
65
    return encode_json($audio_alerts);
66
}
67
62
1;
68
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 601-607 $template->param( Link Here
601
    is_child          => ($borrowernumber && $borrower->{'category_type'} eq 'C'),
601
    is_child          => ($borrowernumber && $borrower->{'category_type'} eq 'C'),
602
    $view             => 1,
602
    $view             => 1,
603
    batch_allowed     => $batch_allowed,
603
    batch_allowed     => $batch_allowed,
604
    soundon           => C4::Context->preference("SoundOn"),
604
    AudioAlerts           => C4::Context->preference("AudioAlerts"),
605
    fast_cataloging   => $fast_cataloging,
605
    fast_cataloging   => $fast_cataloging,
606
    CircAutoPrintQuickSlip   => C4::Context->preference("CircAutoPrintQuickSlip"),
606
    CircAutoPrintQuickSlip   => C4::Context->preference("CircAutoPrintQuickSlip"),
607
    activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
607
    activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
(-)a/circ/returns.pl (-1 / +1 lines)
Lines 620-626 $template->param( Link Here
620
    dropboxdate    => output_pref($dropboxdate),
620
    dropboxdate    => output_pref($dropboxdate),
621
    forgivemanualholdsexpire => $forgivemanualholdsexpire,
621
    forgivemanualholdsexpire => $forgivemanualholdsexpire,
622
    overduecharges => $overduecharges,
622
    overduecharges => $overduecharges,
623
    soundon        => C4::Context->preference("SoundOn"),
623
    AudioAlerts        => C4::Context->preference("AudioAlerts"),
624
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
624
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
625
);
625
);
626
626
(-)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 (-10 / +37 lines)
Lines 1-14 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" href="[% interface %]/lib/font-awesome/css/font-awesome.min.css" />
8
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/font-awesome/css/font-awesome.min.css" />
6
<link rel="stylesheet" type="text/css" media="print" href="[% themelang %]/css/print.css" />
9
<link rel="stylesheet" type="text/css" media="print" href="[% themelang %]/css/print.css" />
7
[% INCLUDE intranetstylesheet.inc %]
10
[% INCLUDE intranetstylesheet.inc %]
8
[% IF ( bidi ) %]
11
[% IF ( bidi )            %]<link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />[% END %]
9
   <link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
10
[% END %]
11
[% IF ( IntranetUserCSS ) %]<style type="text/css">[% IntranetUserCSS %]</style>[% END %]
12
[% IF ( IntranetUserCSS ) %]<style type="text/css">[% IntranetUserCSS %]</style>[% END %]
13
12
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
14
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
13
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui.js"></script>
15
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui.js"></script>
14
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
16
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
Lines 23-28 Link Here
23
25
24
<!-- koha core js -->
26
<!-- koha core js -->
25
<script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
27
<script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
28
26
[% INCLUDE 'validator-strings.inc' %]
29
[% INCLUDE 'validator-strings.inc' %]
27
[% IF ( IntranetUserJS ) %]
30
[% IF ( IntranetUserJS ) %]
28
    <script type="text/javascript">
31
    <script type="text/javascript">
Lines 31-36 Link Here
31
    //]]>
34
    //]]>
32
    </script>
35
    </script>
33
[% END %]
36
[% END %]
37
34
[% IF ( virtualshelves || intranetbookbag ) %]
38
[% IF ( virtualshelves || intranetbookbag ) %]
35
<script type="text/javascript">
39
<script type="text/javascript">
36
    //<![CDATA[
40
    //<![CDATA[
Lines 47-61 Link Here
47
        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.");
48
    //]]>
52
    //]]>
49
    </script>
53
    </script>
50
<script type="text/javascript" src="[% themelang %]/js/basket.js"></script>
54
55
    <script type="text/javascript" src="[% themelang %]/js/basket.js"></script>
51
[% END %]
56
[% END %]
57
52
[% IF LocalCoverImages %]
58
[% IF LocalCoverImages %]
53
<script type="text/javascript" src="[% themelang %]/js/localcovers.js"></script>
59
    <script type="text/javascript" src="[% themelang %]/js/localcovers.js"></script>
54
<script type="text/javascript">
60
    <script type="text/javascript">
55
//<![CDATA[
61
        //<![CDATA[
56
var NO_LOCAL_JACKET = _("No cover image available");
62
            var NO_LOCAL_JACKET = _("No cover image available");
57
//]]>
63
        //]]>
58
</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>
59
[% END %]
86
[% END %]
60
87
61
<!-- For keeping the text when navigating the search tabs -->
88
<!-- For keeping the text when navigating the search tabs -->
(-)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 111-116 Link Here
111
    <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
111
    <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
112
    <dt><a href="/cgi-bin/koha/admin/columns_settings.pl">Configure columns</a></dt>
112
    <dt><a href="/cgi-bin/koha/admin/columns_settings.pl">Configure columns</a></dt>
113
    <dd>Hide or show columns for tables.</dd>
113
    <dd>Hide or show columns for tables.</dd>
114
    <dt><a href="/cgi-bin/koha/admin/audio_alerts.pl">Audio alerts</a></dt>
115
    <dd>Define which events trigger which sounds</dd>
114
</dl>
116
</dl>
115
</div>
117
</div>
116
118
(-)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 id="admin_audio_alerts" class="admin">
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 704-710 Circulation: Link Here
704
                  yes: Show
698
                  yes: Show
705
                  no: "Don't show"
699
                  no: "Don't show"
706
            - "the print receipt popup dialog when self checkout is finished"
700
            - "the print receipt popup dialog when self checkout is finished"
707
708
    Course Reserves:
701
    Course Reserves:
709
        -
702
        -
710
            - pref: UseCourseReserves
703
            - pref: UseCourseReserves
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref (+6 lines)
Lines 134-136 Staff Client: Link Here
134
                  yes: Show
134
                  yes: Show
135
                  no: "Don't show"
135
                  no: "Don't show"
136
            - WYSIWYG editor when editing certain HTML system preferences.
136
            - WYSIWYG editor when editing certain HTML system preferences.
137
        -
138
            - pref: AudioAlerts
139
              choices:
140
                 yes: "Enable"
141
                 no: "Don't enable"
142
            - 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 209-215 $(document).ready(function() { Link Here
209
[% IF ( NEEDSCONFIRMATION ) %]
209
[% IF ( NEEDSCONFIRMATION ) %]
210
<div class="yui-g">
210
<div class="yui-g">
211
211
212
<div id="circ_needsconfirmation" class="dialog alert">
212
<div id="circ_needsconfirmation" class="dialog alert audio-alert-action">
213
[% IF CAN_user_circulate_force_checkout %]
213
[% IF CAN_user_circulate_force_checkout %]
214
  <h3>Please confirm checkout</h3>
214
  <h3>Please confirm checkout</h3>
215
[% ELSE %]
215
[% ELSE %]
Lines 403-414 $(document).ready(function() { Link Here
403
403
404
        [% IF ( IMPOSSIBLE ) %]
404
        [% IF ( IMPOSSIBLE ) %]
405
405
406
[% IF ( soundon ) %]
407
<audio src="[% interface %]/[% theme %]/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
408
[% END %]        
409
410
<div class="yui-g">
406
<div class="yui-g">
411
<div id="circ_impossible" class="dialog alert">
407
<div id="circ_impossible" class="dialog alert audio-alert-warning">
412
<!-- RESULT OF ISSUING REQUEST -->
408
<!-- RESULT OF ISSUING REQUEST -->
413
        <ul>
409
        <ul>
414
        [% IF ( STATS ) %]
410
        [% IF ( STATS ) %]
Lines 524-538 $(document).ready(function() { Link Here
524
520
525
</div></div>
521
</div></div>
526
[% ELSE %]
522
[% ELSE %]
527
[% IF ( soundon ) %]
528
<audio src="[% interface %]/[% theme %]/sound/beep.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
529
[% END %]
530
531
  [% IF (forceallow) %]
523
  [% IF (forceallow) %]
532
      <div id="overridden_debarment" class="dialog alert">Restriction overridden temporarily</div>
524
      <div id="overridden_debarment" class="dialog alert">Restriction overridden temporarily</div>
533
  [% END %]
525
  [% END %]
526
[% END %] <!-- /impossible -->
534
527
535
    [% END %] <!-- /impossible -->
528
<span class="audio-alert-success"></span>
536
529
537
[% IF ( issued ) %]
530
[% IF ( issued ) %]
538
<p>Item checked out</p>
531
<p>Item checked out</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-33 / +8 lines)
Lines 105-110 $(document).ready(function () { Link Here
105
</script>
105
</script>
106
</head>
106
</head>
107
<body id="circ_returns" class="circ">
107
<body id="circ_returns" class="circ">
108
<span class="audio-alert-success"></span>
108
109
109
[% INCLUDE 'header.inc' %]
110
[% INCLUDE 'header.inc' %]
110
[% INCLUDE 'checkin-search.inc' %]
111
[% INCLUDE 'checkin-search.inc' %]
Lines 199-209 $(document).ready(function () { Link Here
199
    [% IF ( waiting ) %]
200
    [% IF ( waiting ) %]
200
	<!-- waiting -->
201
	<!-- waiting -->
201
202
202
[% IF ( soundon ) %]
203
    <div id="hold-found1" class="dialog message audio-alert-action">
203
<audio src="[% interface %]/[% theme %]/sound/ending.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
204
[% END %]
205
206
<div id="hold-found1" class="dialog message">
207
        <h3>Hold found (item is already waiting):  <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
204
        <h3>Hold found (item is already waiting):  <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
208
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
205
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
209
        <h4>Hold for:</h4>
206
        <h4>Hold for:</h4>
Lines 251-260 $(document).ready(function () { Link Here
251
248
252
    [% IF ( diffbranch ) %]
249
    [% IF ( diffbranch ) %]
253
		<!-- diffbranch -->
250
		<!-- diffbranch -->
254
        [% IF ( soundon ) %]
251
        <div id="transfer-needed" class="dialog message audio-alert-action">
255
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
256
        [% END %]
257
        <div id="transfer-needed" class="dialog message">
258
		<h3>Hold needing transfer found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
252
		<h3>Hold needing transfer found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
259
                <h4>Hold for: </h4>
253
                <h4>Hold for: </h4>
260
                    <ul>
254
                    <ul>
Lines 298-317 $(document).ready(function () { Link Here
298
292
299
    [% IF ( transfer ) %]
293
    [% IF ( transfer ) %]
300
    <!-- transfer: item with no reservation, must be returned according to home library circulation rules -->
294
    <!-- transfer: item with no reservation, must be returned according to home library circulation rules -->
301
	<div id="return1" class="dialog message">
295
	<div id="return1" class="dialog message audio-alert-action">
302
            <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% Branches.GetName( returnbranch ) %]<br/>( <a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% returnbranch %]&amp;op=slip'); return true;">Print slip</a> )</h3>
296
            <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% Branches.GetName( returnbranch ) %]<br/>( <a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% returnbranch %]&amp;op=slip'); return true;">Print slip</a> )</h3>
303
        </div>
297
        </div>
304
        [% IF ( soundon ) %]
305
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
306
        [% END %]
307
    [% END %]
298
    [% END %]
308
299
309
    [% IF ( needstransfer ) %]
300
    [% IF ( needstransfer ) %]
310
	<!-- needstransfer -->
301
	<!-- needstransfer -->
311
        [% IF ( soundon ) %]
302
    <div id="item-transfer" class="dialog message audio-alert-action"><h3> This item needs to be transferred to [% Branches.GetName( returnbranch ) %]</h3>
312
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
313
        [% END %]
314
    <div id="item-transfer" class="dialog message"><h3> This item needs to be transferred to [% Branches.GetName( returnbranch ) %]</h3>
315
    Transfer now?<br />
303
    Transfer now?<br />
316
    <form method="post" action="returns.pl" name="mainform" id="mainform">
304
    <form method="post" action="returns.pl" name="mainform" id="mainform">
317
    [% IF itemnumber %]
305
    [% IF itemnumber %]
Lines 337-346 $(document).ready(function () { Link Here
337
325
338
    [% IF ( diffbranch ) %]
326
    [% IF ( diffbranch ) %]
339
	<!-- diffbranch -->
327
	<!-- diffbranch -->
340
        [% IF ( soundon ) %]
328
        <h3 class="audio-alert-action">Item consigned:</h3>
341
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
342
        [% END %]
343
        <h3>Item consigned:</h3>
344
        <table>
329
        <table>
345
        <caption><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a></caption>
330
        <caption><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a></caption>
346
        <tr>
331
        <tr>
Lines 369-379 $(document).ready(function () { Link Here
369
    [% IF ( reserved ) %]
354
    [% IF ( reserved ) %]
370
	<!--  reserved  -->
355
	<!--  reserved  -->
371
356
372
        [% IF ( soundon ) %]
357
    <div id="hold-found2" class="dialog message audio-alert-action">
373
        <audio src="[% interface %]/[% theme %]/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
374
        [% END %]
375
376
	<div id="hold-found2" class="dialog message">
377
      <h3>Hold found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
358
      <h3>Hold found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
378
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
359
        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
379
        <h5>Hold for:</h5>
360
        <h5>Hold for:</h5>
Lines 424-430 $(document).ready(function () { Link Here
424
[% END %]
405
[% END %]
425
406
426
[% IF ( errmsgloop ) %]
407
[% IF ( errmsgloop ) %]
427
    <div class="dialog alert">
408
    <div class="dialog alert audio-alert-warning">
428
        <h3>Check in message</h3>
409
        <h3>Check in message</h3>
429
        [% FOREACH errmsgloo IN errmsgloop %]
410
        [% FOREACH errmsgloo IN errmsgloop %]
430
                    [% IF ( errmsgloo.NotForLoanStatusUpdated ) %]
411
                    [% IF ( errmsgloo.NotForLoanStatusUpdated ) %]
Lines 483-495 $(document).ready(function () { Link Here
483
                    [% END %]
464
                    [% END %]
484
465
485
            [% END %]
466
            [% END %]
486
[% IF ( soundon ) %]
487
<audio src="[% interface %]/[% theme %]/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
488
[% END %]
489
        [% ELSE %]
467
        [% ELSE %]
490
[% IF ( soundon ) %]
491
<audio src="[% interface %]/[% theme %]/sound/beep.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
492
[% END %]
493
        [% END %]
468
        [% END %]
494
    </div>
469
    </div>
495
470
(-)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