Bugzilla – Attachment 44409 Details for
Bug 11431
Custom notification sounds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11431 [QA Followup] - Add ability to edit audio alerts
Bug-11431-QA-Followup---Add-ability-to-edit-audio-.patch (text/plain), 6.20 KB, created by
Kyle M Hall (khall)
on 2015-11-04 15:16:43 UTC
(
hide
)
Description:
Bug 11431 [QA Followup] - Add ability to edit audio alerts
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-11-04 15:16:43 UTC
Size:
6.20 KB
patch
obsolete
>From be0b03a39290e1a150eaf8dfe6bee6f7e896c96d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 23 Oct 2015 07:55:18 -0400 >Subject: [PATCH] Bug 11431 [QA Followup] - Add ability to edit audio alerts > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > admin/audio_alerts.pl | 15 ++++-- > .../prog/en/modules/admin/audio_alerts.tt | 49 ++++++++++++++++++-- > 2 files changed, 54 insertions(+), 10 deletions(-) > >diff --git a/admin/audio_alerts.pl b/admin/audio_alerts.pl >index d592be4..8470255 100755 >--- a/admin/audio_alerts.pl >+++ b/admin/audio_alerts.pl >@@ -45,7 +45,16 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-if ( $selector && $sound ) { >+if ( $id && $action && $where && $action eq 'move' ) { >+ Koha::AudioAlerts->find($id)->move($where); >+} >+elsif ( $id && $selector && $sound ) { >+ my $alert = Koha::AudioAlerts->find($id); >+ $alert->selector( $selector ); >+ $alert->sound( $sound ); >+ $alert->store(); >+} >+elsif ( $selector && $sound ) { > Koha::AudioAlert->new( { selector => $selector, sound => $sound } )->store(); > } > >@@ -54,10 +63,6 @@ if (@delete) { > Koha::AudioAlerts->fix_precedences(); > } > >-if ( $id && $action && $where && $action eq 'move' ) { >- Koha::AudioAlerts->find($id)->move($where); >-} >- > $template->param( AudioAlerts => 1, audio_alerts => scalar Koha::AudioAlerts->search() ); > > output_html_with_http_headers $cgi, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt >index 82b3b87..489c542 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt >@@ -4,6 +4,8 @@ > > <script type="text/javascript"> > $( document ).ready(function() { >+ $(".edit-alert").hide(); >+ > $('#koha-sounds').on('change', function() { > $('#sound').val( this.value ); > }); >@@ -17,6 +19,20 @@ $( document ).ready(function() { > return false; > }); > >+ $('#cancel-edit').on('click', function() { >+ $("#id").val(""); >+ $("#selector").val(""); >+ $("#sound").val(""); >+ >+ $(".edit-alert").hide(); >+ $(".create-alert").show(); >+ >+ $("#audio-alerts-table").find("td").each(function (i) { >+ $(this).removeClass('highlighted-row'); >+ }); >+ return false; >+ }); >+ > $('#new-alert-form').on('submit', function() { > if ( ! $('#selector').val() ) { > alert(_("You must enter a selector!")); >@@ -33,6 +49,22 @@ $( document ).ready(function() { > return confirm(_("Are you sure you want to delete the selected audio alerts?")); > }); > }); >+ >+function EditAlert( elt, id, precedence, selector, sound ) { >+ $("#audio-alerts-table").find("td").each(function (i) { >+ $(this).removeClass('highlighted-row'); >+ }); >+ >+ $(".create-alert").hide(); >+ $(".edit-alert").show(); >+ >+ $(elt).parent().parent().find("td").each(function (i) { >+ $(this).addClass('highlighted-row'); >+ }); >+ $("#id").val(id); >+ $("#selector").val(selector); >+ $("#sound").val(sound); >+} > </script> > > </head> >@@ -48,8 +80,9 @@ $( document ).ready(function() { > <div class="yui-b"> > <form id="new-alert-form" action="audio_alerts.pl" method="post"> > <fieldset class="form-inline"> >- <legend>Add new alert</legend> >+ <legend><span class="create-alert">Add new alert</span><span class="edit-alert">Edit alert</span></legend> > >+ <input id="id" name="id" type="hidden" value="" /> > <input id="selector" name="selector" type="text" class="input-large" placeholder="selector" /> > <input id="sound" name="sound" type="text" class="input-large" placeholder="sound" /> > >@@ -79,23 +112,28 @@ $( document ).ready(function() { > <option value="warning.ogg">warning.ogg</option> > </select> > >- <button id="save-alert" type="submit" class="btn"><i class="icon-hdd"></i> Save alert</button> >+ <p> >+ <button id="save-alert" type="submit" class="btn create-alert"><i class="icon-hdd"></i> Save alert</button> >+ <button id="save-edit" type="submit" class="btn edit-alert save-edit"><i class="icon-hdd"></i> Update alert</button> >+ <a id="cancel-edit" class="btn edit-alert cancel-edit"><i class="icon icon-remove-circle"></i> Cancel edit</a> >+ </p> > </fieldset> > </form> > > <form id="delete-alert-form" action="audio_alerts.pl" method="post"> >- <table> >- <thead> >+ <table id="audio-alerts-table"> >+ <thead id="audio-alerts-table-head"> > <tr> > <th> </th> > <th>Precedence</th> > <th> </th> > <th>Selector</th> > <th>Sound</th> >+ <th> </th> > </tr> > </thead> > >- <tbody> >+ <tbody id="audio-alerts-table-body"> > [% FOREACH a IN audio_alerts %] > <tr> > <td><input type="checkbox" name="delete" value="[% a.id %]" /></td> >@@ -119,6 +157,7 @@ $( document ).ready(function() { > </td> > <td>[% a.selector %]</td> > <td>[% a.sound %]</td> >+ <td><a class="btn btn-small" onclick="EditAlert( this, '[% a.id %]','[% a.precedence %]', '[% a.selector %]', '[% a.sound %]' )" ><i class="icon-pencil"></i> Edit</a></td> > </tr> > [% END %] > </tbody> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11431
:
29030
|
29031
|
29032
|
29033
|
29034
|
29035
|
29036
|
29037
|
29038
|
29039
|
29119
|
29120
|
29404
|
29764
|
29765
|
29766
|
29767
|
29768
|
29769
|
31145
|
31146
|
31147
|
31148
|
31149
|
31150
|
34637
|
34638
|
34639
|
34640
|
34641
|
34642
|
34643
|
34644
|
34645
|
34646
|
34647
|
34648
|
34649
|
34650
|
34651
|
34652
|
34653
|
34717
|
34718
|
34719
|
34720
|
34864
|
34865
|
34866
|
34867
|
35843
|
35844
|
35845
|
35846
|
38547
|
38548
|
40726
|
40727
|
40728
|
40729
|
40730
|
40731
|
40732
|
41634
|
41661
|
41662
|
42678
|
42679
|
42680
|
42681
|
42682
|
42683
|
42684
|
42685
|
42686
|
42687
|
42688
|
42689
|
42696
|
43753
|
43754
|
43755
|
43756
|
43757
|
43758
|
43759
|
43760
|
43761
|
43762
|
43763
|
43764
|
43765
|
43817
|
43820
|
43821
|
43822
|
43823
|
43824
|
43825
|
43887
|
43888
|
43889
|
43890
|
43891
|
43892
|
43893
|
43894
|
43895
|
43896
|
43897
|
43898
|
43899
|
43900
|
43901
|
43902
|
43903
|
44391
|
44392
|
44393
|
44394
|
44395
|
44396
|
44397
|
44398
|
44399
|
44400
|
44401
|
44402
|
44404
|
44405
|
44407
|
44408
| 44409 |
44411
|
44412
|
44599
|
45135