Lines 4-9
Link Here
|
4 |
|
4 |
|
5 |
<script type="text/javascript"> |
5 |
<script type="text/javascript"> |
6 |
$( document ).ready(function() { |
6 |
$( document ).ready(function() { |
|
|
7 |
$(".edit-alert").hide(); |
8 |
|
7 |
$('#koha-sounds').on('change', function() { |
9 |
$('#koha-sounds').on('change', function() { |
8 |
$('#sound').val( this.value ); |
10 |
$('#sound').val( this.value ); |
9 |
}); |
11 |
}); |
Lines 17-22
$( document ).ready(function() {
Link Here
|
17 |
return false; |
19 |
return false; |
18 |
}); |
20 |
}); |
19 |
|
21 |
|
|
|
22 |
$('#cancel-edit').on('click', function() { |
23 |
$("#id").val(""); |
24 |
$("#selector").val(""); |
25 |
$("#sound").val(""); |
26 |
|
27 |
$(".edit-alert").hide(); |
28 |
$(".create-alert").show(); |
29 |
|
30 |
$("#audio-alerts-table").find("td").each(function (i) { |
31 |
$(this).removeClass('highlighted-row'); |
32 |
}); |
33 |
return false; |
34 |
}); |
35 |
|
20 |
$('#new-alert-form').on('submit', function() { |
36 |
$('#new-alert-form').on('submit', function() { |
21 |
if ( ! $('#selector').val() ) { |
37 |
if ( ! $('#selector').val() ) { |
22 |
alert(_("You must enter a selector!")); |
38 |
alert(_("You must enter a selector!")); |
Lines 33-38
$( document ).ready(function() {
Link Here
|
33 |
return confirm(_("Are you sure you want to delete the selected audio alerts?")); |
49 |
return confirm(_("Are you sure you want to delete the selected audio alerts?")); |
34 |
}); |
50 |
}); |
35 |
}); |
51 |
}); |
|
|
52 |
|
53 |
function EditAlert( elt, id, precedence, selector, sound ) { |
54 |
$("#audio-alerts-table").find("td").each(function (i) { |
55 |
$(this).removeClass('highlighted-row'); |
56 |
}); |
57 |
|
58 |
$(".create-alert").hide(); |
59 |
$(".edit-alert").show(); |
60 |
|
61 |
$(elt).parent().parent().find("td").each(function (i) { |
62 |
$(this).addClass('highlighted-row'); |
63 |
}); |
64 |
$("#id").val(id); |
65 |
$("#selector").val(selector); |
66 |
$("#sound").val(sound); |
67 |
} |
36 |
</script> |
68 |
</script> |
37 |
|
69 |
|
38 |
</head> |
70 |
</head> |
Lines 48-55
$( document ).ready(function() {
Link Here
|
48 |
<div class="yui-b"> |
80 |
<div class="yui-b"> |
49 |
<form id="new-alert-form" action="audio_alerts.pl" method="post"> |
81 |
<form id="new-alert-form" action="audio_alerts.pl" method="post"> |
50 |
<fieldset class="form-inline"> |
82 |
<fieldset class="form-inline"> |
51 |
<legend>Add new alert</legend> |
83 |
<legend><span class="create-alert">Add new alert</span><span class="edit-alert">Edit alert</span></legend> |
52 |
|
84 |
|
|
|
85 |
<input id="id" name="id" type="hidden" value="" /> |
53 |
<input id="selector" name="selector" type="text" class="input-large" placeholder="selector" /> |
86 |
<input id="selector" name="selector" type="text" class="input-large" placeholder="selector" /> |
54 |
<input id="sound" name="sound" type="text" class="input-large" placeholder="sound" /> |
87 |
<input id="sound" name="sound" type="text" class="input-large" placeholder="sound" /> |
55 |
|
88 |
|
Lines 79-101
$( document ).ready(function() {
Link Here
|
79 |
<option value="warning.ogg">warning.ogg</option> |
112 |
<option value="warning.ogg">warning.ogg</option> |
80 |
</select> |
113 |
</select> |
81 |
|
114 |
|
82 |
<button id="save-alert" type="submit" class="btn"><i class="icon-hdd"></i> Save alert</button> |
115 |
<p> |
|
|
116 |
<button id="save-alert" type="submit" class="btn create-alert"><i class="icon-hdd"></i> Save alert</button> |
117 |
<button id="save-edit" type="submit" class="btn edit-alert save-edit"><i class="icon-hdd"></i> Update alert</button> |
118 |
<a id="cancel-edit" class="btn edit-alert cancel-edit"><i class="icon icon-remove-circle"></i> Cancel edit</a> |
119 |
</p> |
83 |
</fieldset> |
120 |
</fieldset> |
84 |
</form> |
121 |
</form> |
85 |
|
122 |
|
86 |
<form id="delete-alert-form" action="audio_alerts.pl" method="post"> |
123 |
<form id="delete-alert-form" action="audio_alerts.pl" method="post"> |
87 |
<table> |
124 |
<table id="audio-alerts-table"> |
88 |
<thead> |
125 |
<thead id="audio-alerts-table-head"> |
89 |
<tr> |
126 |
<tr> |
90 |
<th> </th> |
127 |
<th> </th> |
91 |
<th>Precedence</th> |
128 |
<th>Precedence</th> |
92 |
<th> </th> |
129 |
<th> </th> |
93 |
<th>Selector</th> |
130 |
<th>Selector</th> |
94 |
<th>Sound</th> |
131 |
<th>Sound</th> |
|
|
132 |
<th> </th> |
95 |
</tr> |
133 |
</tr> |
96 |
</thead> |
134 |
</thead> |
97 |
|
135 |
|
98 |
<tbody> |
136 |
<tbody id="audio-alerts-table-body"> |
99 |
[% FOREACH a IN audio_alerts %] |
137 |
[% FOREACH a IN audio_alerts %] |
100 |
<tr> |
138 |
<tr> |
101 |
<td><input type="checkbox" name="delete" value="[% a.id %]" /></td> |
139 |
<td><input type="checkbox" name="delete" value="[% a.id %]" /></td> |
Lines 119-124
$( document ).ready(function() {
Link Here
|
119 |
</td> |
157 |
</td> |
120 |
<td>[% a.selector %]</td> |
158 |
<td>[% a.selector %]</td> |
121 |
<td>[% a.sound %]</td> |
159 |
<td>[% a.sound %]</td> |
|
|
160 |
<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> |
122 |
</tr> |
161 |
</tr> |
123 |
[% END %] |
162 |
[% END %] |
124 |
</tbody> |
163 |
</tbody> |
125 |
- |
|
|