Bug 15735: Audio Alerts editor broken by use of of single quotes in editor
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 3 Feb 2016 19:05:19 +0000 (19:05 +0000)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Mon, 7 Mar 2016 19:56:49 +0000 (19:56 +0000)
Single quotes audio selector break ability to edit an alert

Test Plan:
1) Enable audio alerts
2) Add new a alert with a select containing single quotes such as: input[name*='test']
3) Note you cannot edit the alert
4) Apply this patch
5) Reload the page
6) You should now be able to edit the alert

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Bug 15734 applied on top. Works as advertised

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt

index b47e9dd..f0b812e 100644 (file)
@@ -69,7 +69,7 @@
     <script type="text/javascript">
         //<![CDATA[
             var AUDIO_ALERT_PATH = '[% interface %]/[% theme %]/sound/';
-            var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) %]' );
+            var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) | replace( '"', '\\"' ) %]' );
         //]]>
 
         $( document ).ready(function() {
index 489c542..434716c 100644 (file)
@@ -157,7 +157,7 @@ function EditAlert( elt, id, precedence, selector, sound ) {
                                     </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>
+                                    <td><a class="btn btn-small" onclick="EditAlert( this, '[% a.id %]','[% a.precedence %]', '[% a.selector | replace( "'", "\\'" ) | html %]', '[% a.sound %]' )" ><i class="icon-pencil"></i> Edit</a></td>
                                 </tr>
                             [% END %]
                         </tbody>