|
Lines 1-74
Link Here
|
| 1 |
/* global __ KohaTable table_settings */ |
1 |
/* global __ KohaTable table_settings */ |
| 2 |
$(document).ready(function() { |
2 |
$(document).ready(function () { |
| 3 |
window.modaction_legend_innerhtml = $("#modaction_legend").text(); |
3 |
window.modaction_legend_innerhtml = $("#modaction_legend").text(); |
| 4 |
window.action_submit_value = $("#action_submit").val(); |
4 |
window.action_submit_value = $("#action_submit").val(); |
| 5 |
|
5 |
|
| 6 |
$('#select_template').find("input:submit").hide(); |
6 |
$("#select_template").find("input:submit").hide(); |
| 7 |
$('#select_template').change(function() { |
7 |
$("#select_template").change(function () { |
| 8 |
$('#select_template').submit(); |
8 |
$("#select_template").submit(); |
| 9 |
}); |
9 |
}); |
| 10 |
$("span.match_regex_prefix" ).hide(); |
10 |
$("span.match_regex_prefix").hide(); |
| 11 |
$("span.match_regex_suffix" ).hide(); |
11 |
$("span.match_regex_suffix").hide(); |
| 12 |
|
12 |
|
| 13 |
$("#add_action").submit(function(){ |
13 |
$("#add_action").submit(function () { |
| 14 |
var action = $("#action").val(); |
14 |
var action = $("#action").val(); |
| 15 |
if ( action == 'move_field' || action == 'copy_field' || action == 'copy_and_replace_field') { |
15 |
if ( |
| 16 |
if ( $("#from_subfield").val().length != $("#to_subfield").val().length ) { |
16 |
action == "move_field" || |
| 17 |
alert( __("Both subfield values should be filled or empty.") ); |
17 |
action == "copy_field" || |
| 18 |
return false; |
18 |
action == "copy_and_replace_field" |
| 19 |
} |
19 |
) { |
| 20 |
if ( $("#to_field").val().length <= 0 ) { |
20 |
if ( |
| 21 |
alert( __("The destination should be filled.") ); |
21 |
$("#from_subfield").val().length != |
| 22 |
return false; |
22 |
$("#to_subfield").val().length |
|
|
23 |
) { |
| 24 |
if ( |
| 25 |
$("#to_field").val() >= 10 && |
| 26 |
$("#to_subfield").val().length > 0 && |
| 27 |
$("#from_field").val() >= 10 && |
| 28 |
$("#from_subfield").val().length > 0 |
| 29 |
) { |
| 30 |
alert( |
| 31 |
__("Both subfield values should be filled or empty.") |
| 32 |
); |
| 33 |
return false; |
| 34 |
} |
| 23 |
} |
35 |
} |
| 24 |
if ( ( $("#to_field").val() < 10 && $("#to_subfield").val().length > 0 ) || |
36 |
if ($("#to_field").val().length <= 0) { |
| 25 |
( $("#from_field").val() < 10 && $("#from_subfield").val().length > 0 ) ) { |
37 |
alert(__("The destination should be filled.")); |
| 26 |
alert( __("If the field is a control field, the subfield should be empty") ); |
|
|
| 27 |
return false; |
38 |
return false; |
| 28 |
} |
39 |
} |
| 29 |
if ( ( $("#from_field").val() < 10 && $("#to_field").val() >= 10 ) || |
40 |
if ( |
| 30 |
( $("#to_field").val() < 10 && $("#from_field").val() >= 10 ) ) { |
41 |
($("#to_field").val() < 10 && |
| 31 |
alert( __("A control field cannot be used with a regular field.") ); |
42 |
$("#to_subfield").val().length > 0) || |
|
|
43 |
($("#from_field").val() < 10 && |
| 44 |
$("#from_subfield").val().length > 0) |
| 45 |
) { |
| 46 |
alert( |
| 47 |
__( |
| 48 |
"If the field is a control field, the subfield should be empty" |
| 49 |
) |
| 50 |
); |
| 32 |
return false; |
51 |
return false; |
| 33 |
} |
52 |
} |
| 34 |
} |
53 |
} |
| 35 |
if ( action == 'update_field' ) { |
54 |
if (action == "update_field") { |
| 36 |
if ( $("#from_subfield").val().length <= 0 ) { |
55 |
if ($("#from_subfield").val().length <= 0) { |
| 37 |
alert( __("The source subfield should be filled for update.") ); |
56 |
alert(__("The source subfield should be filled for update.")); |
| 38 |
return false; |
57 |
return false; |
| 39 |
} |
58 |
} |
| 40 |
} |
59 |
} |
| 41 |
if ( $("#from_field").val().length <= 0 ) { |
60 |
if ($("#from_field").val().length <= 0) { |
| 42 |
alert( __("The source field should be filled.") ); |
61 |
alert(__("The source field should be filled.")); |
| 43 |
return false; |
62 |
return false; |
| 44 |
} |
63 |
} |
| 45 |
if ( $("#conditional").val() == 'if' || $("#conditional").val() == 'unless' ) { |
64 |
if ( |
| 46 |
if ( $("#conditional_field").val() == '' ) { |
65 |
$("#conditional").val() == "if" || |
| 47 |
alert( __("The conditional field should be filled.") ); |
66 |
$("#conditional").val() == "unless" |
|
|
67 |
) { |
| 68 |
if ($("#conditional_field").val() == "") { |
| 69 |
alert(__("The conditional field should be filled.")); |
| 48 |
return false; |
70 |
return false; |
| 49 |
} |
71 |
} |
| 50 |
if ( $("#conditional_comparison").val() == '' ) { |
72 |
if ($("#conditional_comparison").val() == "") { |
| 51 |
alert( __("The conditional comparison operator should be filled.") ); |
73 |
alert( |
|
|
74 |
__("The conditional comparison operator should be filled.") |
| 75 |
); |
| 52 |
return false; |
76 |
return false; |
| 53 |
} |
77 |
} |
| 54 |
if ( $("#conditional_value").val() == '' && |
78 |
if ( |
| 55 |
( $("#conditional_comparison").val() == 'equals' || $("#conditional_comparison").val() == 'not_equals' ) ) { |
79 |
$("#conditional_value").val() == "" && |
| 56 |
if ( document.getElementById('conditional_regex').checked == true ) { |
80 |
($("#conditional_comparison").val() == "equals" || |
| 57 |
alert( __("The conditional regular expression should be filled.") ); |
81 |
$("#conditional_comparison").val() == "not_equals") |
|
|
82 |
) { |
| 83 |
if ( |
| 84 |
document.getElementById("conditional_regex").checked == true |
| 85 |
) { |
| 86 |
alert( |
| 87 |
__( |
| 88 |
"The conditional regular expression should be filled." |
| 89 |
) |
| 90 |
); |
| 58 |
return false; |
91 |
return false; |
| 59 |
} else { |
92 |
} else { |
| 60 |
alert( __("The conditional value should be filled.") ); |
93 |
alert(__("The conditional value should be filled.")); |
| 61 |
return false; |
94 |
return false; |
| 62 |
} |
95 |
} |
| 63 |
} |
96 |
} |
| 64 |
} |
97 |
} |
| 65 |
}); |
98 |
}); |
| 66 |
|
99 |
|
| 67 |
$("#conditional_field,#from_field").change(function(){ |
100 |
$("#conditional_field,#from_field").change(function () { |
| 68 |
updateAllEvery(); |
101 |
updateAllEvery(); |
| 69 |
}); |
102 |
}); |
| 70 |
|
103 |
|
| 71 |
$(".new_action").on("click",function(e){ |
104 |
$(".new_action").on("click", function (e) { |
| 72 |
e.preventDefault(); |
105 |
e.preventDefault(); |
| 73 |
cancelEditAction(); |
106 |
cancelEditAction(); |
| 74 |
$("#no_defined_actions").hide(); |
107 |
$("#no_defined_actions").hide(); |
|
Lines 76-129
$(document).ready(function() {
Link Here
|
| 76 |
$("#action").focus(); |
109 |
$("#action").focus(); |
| 77 |
}); |
110 |
}); |
| 78 |
|
111 |
|
| 79 |
$(".duplicate_template").on("click",function(e){ |
112 |
$(".duplicate_template").on("click", function (e) { |
| 80 |
e.preventDefault(); |
113 |
e.preventDefault(); |
| 81 |
var template_id = $(this).data("template_id"); |
114 |
var template_id = $(this).data("template_id"); |
| 82 |
$("#duplicate_a_template").val(template_id); |
115 |
$("#duplicate_a_template").val(template_id); |
| 83 |
$("#duplicate_current_template").val(1); |
116 |
$("#duplicate_current_template").val(1); |
| 84 |
}); |
117 |
}); |
| 85 |
|
118 |
|
| 86 |
$('#createTemplate').on('shown.bs.modal', function (e) { |
119 |
$("#createTemplate").on("shown.bs.modal", function (e) { |
| 87 |
e.preventDefault(); |
120 |
e.preventDefault(); |
| 88 |
$("#template_name").focus(); |
121 |
$("#template_name").focus(); |
| 89 |
}); |
122 |
}); |
| 90 |
|
123 |
|
| 91 |
$("#duplicate_a_template").on("change",function(e){ |
124 |
$("#duplicate_a_template").on("change", function (e) { |
| 92 |
e.preventDefault(); |
125 |
e.preventDefault(); |
| 93 |
if( this.value === '' ){ |
126 |
if (this.value === "") { |
| 94 |
$("#duplicate_current_template").val(""); |
127 |
$("#duplicate_current_template").val(""); |
| 95 |
} else { |
128 |
} else { |
| 96 |
$("#duplicate_current_template").val(1); |
129 |
$("#duplicate_current_template").val(1); |
| 97 |
} |
130 |
} |
| 98 |
}); |
131 |
}); |
| 99 |
|
132 |
|
| 100 |
$(".edit_action").on("click", function(){ |
133 |
$(".edit_action").on("click", function () { |
| 101 |
var mmta_id = $(this).data("mmta_id"); |
134 |
var mmta_id = $(this).data("mmta_id"); |
| 102 |
var mmta = $.grep(mmtas, function(elt, id) { |
135 |
var mmta = $.grep(mmtas, function (elt, id) { |
| 103 |
return elt['mmta_id'] == mmta_id; |
136 |
return elt["mmta_id"] == mmta_id; |
| 104 |
}); |
137 |
}); |
| 105 |
editAction( mmta[0] ); |
138 |
editAction(mmta[0]); |
| 106 |
updateAllEvery(); |
139 |
updateAllEvery(); |
| 107 |
}); |
140 |
}); |
| 108 |
|
141 |
|
| 109 |
KohaTable("templatest", { |
142 |
KohaTable("templatest", {}, table_settings); |
| 110 |
}, table_settings); |
|
|
| 111 |
|
143 |
|
| 112 |
$(".confirm-delete-action").on("click", function(){ |
144 |
$(".confirm-delete-action").on("click", function () { |
| 113 |
return confirm( __("Are you sure you wish to delete this template action?") ); |
145 |
return confirm( |
|
|
146 |
__("Are you sure you wish to delete this template action?") |
| 147 |
); |
| 114 |
}); |
148 |
}); |
| 115 |
|
149 |
|
| 116 |
$(".confirm-delete-template").on("click", function(){ |
150 |
$(".confirm-delete-template").on("click", function () { |
| 117 |
return confirm( __("Are you sure you wish to delete this template?") ); |
151 |
return confirm(__("Are you sure you wish to delete this template?")); |
| 118 |
}); |
152 |
}); |
| 119 |
}); |
153 |
}); |
| 120 |
|
154 |
|
| 121 |
function updateAllEvery(){ |
155 |
function updateAllEvery() { |
| 122 |
if ( $("#conditional_field").is(":visible") ) { |
156 |
if ($("#conditional_field").is(":visible")) { |
| 123 |
if ( $("#conditional_field").val() == $("#from_field").val() && $("#from_field").val().length > 0 ) { |
157 |
if ( |
| 124 |
$("#field_number option[value='0']").html( __("Every") ); |
158 |
$("#conditional_field").val() == $("#from_field").val() && |
|
|
159 |
$("#from_field").val().length > 0 |
| 160 |
) { |
| 161 |
$("#field_number option[value='0']").html(__("Every")); |
| 125 |
} else { |
162 |
} else { |
| 126 |
$("#field_number option[value='0']").html( __("All") ); |
163 |
$("#field_number option[value='0']").html(__("All")); |
| 127 |
} |
164 |
} |
| 128 |
} |
165 |
} |
| 129 |
} |
166 |
} |
|
Lines 135-177
function onActionChange(selectObj) {
Link Here
|
| 135 |
// get the value of the selected option |
172 |
// get the value of the selected option |
| 136 |
var action = selectObj.options[idx].value; |
173 |
var action = selectObj.options[idx].value; |
| 137 |
|
174 |
|
| 138 |
switch( action ) { |
175 |
switch (action) { |
| 139 |
case 'delete_field': |
176 |
case "delete_field": |
| 140 |
show('field_number_block'); |
177 |
show("field_number_block"); |
| 141 |
hide('with_value_block'); |
178 |
hide("with_value_block"); |
| 142 |
hide('to_field_block'); |
179 |
hide("to_field_block"); |
| 143 |
break; |
180 |
break; |
| 144 |
|
181 |
|
| 145 |
case 'add_field': |
182 |
case "add_field": |
| 146 |
hide('field_number_block'); |
183 |
hide("field_number_block"); |
| 147 |
show('with_value_block'); |
184 |
show("with_value_block"); |
| 148 |
hide('to_field_block'); |
185 |
hide("to_field_block"); |
| 149 |
break; |
186 |
break; |
| 150 |
|
187 |
|
| 151 |
case 'update_field': |
188 |
case "update_field": |
| 152 |
hide('field_number_block'); |
189 |
hide("field_number_block"); |
| 153 |
show('with_value_block'); |
190 |
show("with_value_block"); |
| 154 |
hide('to_field_block'); |
191 |
hide("to_field_block"); |
| 155 |
break; |
192 |
break; |
| 156 |
|
193 |
|
| 157 |
case 'move_field': |
194 |
case "move_field": |
| 158 |
show('field_number_block'); |
195 |
show("field_number_block"); |
| 159 |
hide('with_value_block'); |
196 |
hide("with_value_block"); |
| 160 |
show('to_field_block'); |
197 |
show("to_field_block"); |
| 161 |
break; |
198 |
break; |
| 162 |
|
199 |
|
| 163 |
case 'copy_field': |
200 |
case "copy_field": |
| 164 |
show('field_number_block'); |
201 |
show("field_number_block"); |
| 165 |
hide('with_value_block'); |
202 |
hide("with_value_block"); |
| 166 |
show('to_field_block'); |
203 |
show("to_field_block"); |
| 167 |
break; |
204 |
break; |
| 168 |
|
205 |
|
| 169 |
case 'copy_and_replace_field': |
206 |
case "copy_and_replace_field": |
| 170 |
show('field_number_block'); |
207 |
show("field_number_block"); |
| 171 |
hide('with_value_block'); |
208 |
hide("with_value_block"); |
| 172 |
show('to_field_block'); |
209 |
show("to_field_block"); |
| 173 |
break; |
210 |
break; |
| 174 |
|
|
|
| 175 |
} |
211 |
} |
| 176 |
} |
212 |
} |
| 177 |
|
213 |
|
|
Lines 182-195
function onConditionalChange(selectObj) {
Link Here
|
| 182 |
// get the value of the selected option |
218 |
// get the value of the selected option |
| 183 |
var action = selectObj.options[idx].value; |
219 |
var action = selectObj.options[idx].value; |
| 184 |
|
220 |
|
| 185 |
switch( action ) { |
221 |
switch (action) { |
| 186 |
case '': |
222 |
case "": |
| 187 |
hide('conditional_block'); |
223 |
hide("conditional_block"); |
| 188 |
break; |
224 |
break; |
| 189 |
|
225 |
|
| 190 |
case 'if': |
226 |
case "if": |
| 191 |
case 'unless': |
227 |
case "unless": |
| 192 |
show('conditional_block'); |
228 |
show("conditional_block"); |
| 193 |
break; |
229 |
break; |
| 194 |
} |
230 |
} |
| 195 |
} |
231 |
} |
|
Lines 201-255
function onConditionalComparisonChange(selectObj) {
Link Here
|
| 201 |
// get the value of the selected option |
237 |
// get the value of the selected option |
| 202 |
var action = selectObj.options[idx].value; |
238 |
var action = selectObj.options[idx].value; |
| 203 |
|
239 |
|
| 204 |
switch( action ) { |
240 |
switch (action) { |
| 205 |
case 'equals': |
241 |
case "equals": |
| 206 |
case 'not_equals': |
242 |
case "not_equals": |
| 207 |
show('conditional_comparison_block'); |
243 |
show("conditional_comparison_block"); |
| 208 |
break; |
244 |
break; |
| 209 |
|
245 |
|
| 210 |
default: |
246 |
default: |
| 211 |
hide('conditional_comparison_block'); |
247 |
hide("conditional_comparison_block"); |
| 212 |
break; |
248 |
break; |
| 213 |
} |
249 |
} |
| 214 |
} |
250 |
} |
| 215 |
|
251 |
|
| 216 |
function onToFieldRegexChange( checkboxObj ) { |
252 |
function onToFieldRegexChange(checkboxObj) { |
| 217 |
if ( checkboxObj.checked ) { |
253 |
if (checkboxObj.checked) { |
| 218 |
show('to_field_regex_value_block'); |
254 |
show("to_field_regex_value_block"); |
| 219 |
} else { |
255 |
} else { |
| 220 |
hide('to_field_regex_value_block'); |
256 |
hide("to_field_regex_value_block"); |
| 221 |
} |
257 |
} |
| 222 |
} |
258 |
} |
| 223 |
|
259 |
|
| 224 |
function onConditionalRegexChange( checkboxObj ) { |
260 |
function onConditionalRegexChange(checkboxObj) { |
| 225 |
if ( checkboxObj.checked ) { |
261 |
if (checkboxObj.checked) { |
| 226 |
$("span.match_regex_prefix" ).show(); |
262 |
$("span.match_regex_prefix").show(); |
| 227 |
$("span.match_regex_suffix" ).show(); |
263 |
$("span.match_regex_suffix").show(); |
| 228 |
} else { |
264 |
} else { |
| 229 |
$("span.match_regex_prefix" ).hide(); |
265 |
$("span.match_regex_prefix").hide(); |
| 230 |
$("span.match_regex_suffix" ).hide(); |
266 |
$("span.match_regex_suffix").hide(); |
| 231 |
} |
267 |
} |
| 232 |
} |
268 |
} |
| 233 |
|
269 |
|
| 234 |
function show(eltId) { |
270 |
function show(eltId) { |
| 235 |
elt = document.getElementById( eltId ); |
271 |
elt = document.getElementById(eltId); |
| 236 |
elt.style.display='inline'; |
272 |
elt.style.display = "inline"; |
| 237 |
} |
273 |
} |
| 238 |
|
274 |
|
| 239 |
function hide(eltId) { |
275 |
function hide(eltId) { |
| 240 |
clearFormElements( eltId ); |
276 |
clearFormElements(eltId); |
| 241 |
elt = document.getElementById( eltId ); |
277 |
elt = document.getElementById(eltId); |
| 242 |
elt.style.display='none'; |
278 |
elt.style.display = "none"; |
| 243 |
} |
279 |
} |
| 244 |
|
280 |
|
| 245 |
function clearFormElements(divId) { |
281 |
function clearFormElements(divId) { |
| 246 |
myBlock = document.getElementById( divId ); |
282 |
myBlock = document.getElementById(divId); |
| 247 |
|
283 |
|
| 248 |
var inputElements = myBlock.getElementsByTagName( "input" ); |
284 |
var inputElements = myBlock.getElementsByTagName("input"); |
| 249 |
for (var i = 0; i < inputElements.length; i++) { |
285 |
for (var i = 0; i < inputElements.length; i++) { |
| 250 |
switch( inputElements[i].type ) { |
286 |
switch (inputElements[i].type) { |
| 251 |
case "text": |
287 |
case "text": |
| 252 |
inputElements[i].value = ''; |
288 |
inputElements[i].value = ""; |
| 253 |
break; |
289 |
break; |
| 254 |
case "checkbox": |
290 |
case "checkbox": |
| 255 |
inputElements[i].checked = false; |
291 |
inputElements[i].checked = false; |
|
Lines 257-364
function clearFormElements(divId) {
Link Here
|
| 257 |
} |
293 |
} |
| 258 |
} |
294 |
} |
| 259 |
|
295 |
|
| 260 |
var selectElements = myBlock.getElementsByTagName( "select" ); |
296 |
var selectElements = myBlock.getElementsByTagName("select"); |
| 261 |
for (var i = 0; i < selectElements.length; i++) { |
297 |
for (var i = 0; i < selectElements.length; i++) { |
| 262 |
selectElements[i].selectedIndex = 0; |
298 |
selectElements[i].selectedIndex = 0; |
| 263 |
} |
299 |
} |
| 264 |
|
|
|
| 265 |
} |
300 |
} |
| 266 |
|
301 |
|
| 267 |
var modaction_legend_innerhtml; |
302 |
var modaction_legend_innerhtml; |
| 268 |
var action_submit_value; |
303 |
var action_submit_value; |
| 269 |
|
304 |
|
| 270 |
function editAction( mmta ) { |
305 |
function editAction(mmta) { |
| 271 |
$("#add_action").show(); |
306 |
$("#add_action").show(); |
| 272 |
document.getElementById('mmta_id').value = mmta['mmta_id']; |
307 |
document.getElementById("mmta_id").value = mmta["mmta_id"]; |
| 273 |
|
308 |
|
| 274 |
setSelectByValue( 'action', mmta['action'] ); |
309 |
setSelectByValue("action", mmta["action"]); |
| 275 |
$('#action').change(); |
310 |
$("#action").change(); |
| 276 |
|
311 |
|
| 277 |
setSelectByValue( 'field_number', mmta['field_number'] ); |
312 |
setSelectByValue("field_number", mmta["field_number"]); |
| 278 |
|
313 |
|
| 279 |
document.getElementById('from_field').value = mmta['from_field']; |
314 |
document.getElementById("from_field").value = mmta["from_field"]; |
| 280 |
document.getElementById('from_subfield').value = mmta['from_subfield']; |
315 |
document.getElementById("from_subfield").value = mmta["from_subfield"]; |
| 281 |
document.getElementById('field_value').value = mmta['field_value']; |
316 |
document.getElementById("field_value").value = mmta["field_value"]; |
| 282 |
document.getElementById('to_field').value = mmta['to_field']; |
317 |
document.getElementById("to_field").value = mmta["to_field"]; |
| 283 |
document.getElementById('to_subfield').value = mmta['to_subfield']; |
318 |
document.getElementById("to_subfield").value = mmta["to_subfield"]; |
| 284 |
if ( mmta['regex_search'] == '' && mmta['to_regex_replace'] == '' && mmta['to_regex_modifiers'] == '' ) { |
319 |
if ( |
| 285 |
$('#to_field_regex').prop('checked', false).change(); |
320 |
mmta["regex_search"] == "" && |
|
|
321 |
mmta["to_regex_replace"] == "" && |
| 322 |
mmta["to_regex_modifiers"] == "" |
| 323 |
) { |
| 324 |
$("#to_field_regex").prop("checked", false).change(); |
| 286 |
} else { |
325 |
} else { |
| 287 |
$('#to_field_regex').prop('checked', true).change(); |
326 |
$("#to_field_regex").prop("checked", true).change(); |
| 288 |
$("#to_regex_search").val(mmta['to_regex_search']); |
327 |
$("#to_regex_search").val(mmta["to_regex_search"]); |
| 289 |
$("#to_regex_replace").val(mmta['to_regex_replace']); |
328 |
$("#to_regex_replace").val(mmta["to_regex_replace"]); |
| 290 |
$("#to_regex_modifiers").val(mmta['to_regex_modifiers']); |
329 |
$("#to_regex_modifiers").val(mmta["to_regex_modifiers"]); |
| 291 |
} |
330 |
} |
| 292 |
|
331 |
|
| 293 |
setSelectByValue( 'conditional', mmta['conditional'] ); |
332 |
setSelectByValue("conditional", mmta["conditional"]); |
| 294 |
$('#conditional').change(); |
333 |
$("#conditional").change(); |
| 295 |
|
334 |
|
| 296 |
document.getElementById('conditional_field').value = mmta['conditional_field']; |
335 |
document.getElementById("conditional_field").value = |
| 297 |
document.getElementById('conditional_subfield').value = mmta['conditional_subfield']; |
336 |
mmta["conditional_field"]; |
|
|
337 |
document.getElementById("conditional_subfield").value = |
| 338 |
mmta["conditional_subfield"]; |
| 298 |
|
339 |
|
| 299 |
setSelectByValue( 'conditional_comparison', mmta['conditional_comparison'] ); |
340 |
setSelectByValue("conditional_comparison", mmta["conditional_comparison"]); |
| 300 |
$('#conditional_comparison').change(); |
341 |
$("#conditional_comparison").change(); |
| 301 |
|
342 |
|
| 302 |
document.getElementById('conditional_value').value = mmta['conditional_value']; |
343 |
document.getElementById("conditional_value").value = |
|
|
344 |
mmta["conditional_value"]; |
| 303 |
|
345 |
|
| 304 |
document.getElementById('conditional_regex').checked = parseInt( mmta['conditional_regex'] ); |
346 |
document.getElementById("conditional_regex").checked = parseInt( |
| 305 |
$('#conditional_regex').change(); |
347 |
mmta["conditional_regex"] |
|
|
348 |
); |
| 349 |
$("#conditional_regex").change(); |
| 306 |
|
350 |
|
| 307 |
document.getElementById('description').value = mmta['description']; |
351 |
document.getElementById("description").value = mmta["description"]; |
| 308 |
|
352 |
|
| 309 |
window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML; |
353 |
window.modaction_legend_innerhtml = |
| 310 |
document.getElementById('modaction_legend').innerHTML = __("Edit action %s").format(mmta['ordering']); |
354 |
document.getElementById("modaction_legend").innerHTML; |
|
|
355 |
document.getElementById("modaction_legend").innerHTML = __( |
| 356 |
"Edit action %s" |
| 357 |
).format(mmta["ordering"]); |
| 311 |
|
358 |
|
| 312 |
window.action_submit_value = document.getElementById('action_submit').value; |
359 |
window.action_submit_value = document.getElementById("action_submit").value; |
| 313 |
document.getElementById('action_submit').value = __("Update action"); |
360 |
document.getElementById("action_submit").value = __("Update action"); |
| 314 |
} |
361 |
} |
| 315 |
|
362 |
|
| 316 |
function cancelEditAction() { |
363 |
function cancelEditAction() { |
| 317 |
document.getElementById('mmta_id').value = ''; |
364 |
document.getElementById("mmta_id").value = ""; |
| 318 |
|
365 |
|
| 319 |
setSelectByValue( 'action', 'delete_field' ); |
366 |
setSelectByValue("action", "delete_field"); |
| 320 |
$('#action').change(); |
367 |
$("#action").change(); |
| 321 |
|
368 |
|
| 322 |
document.getElementById('from_field').value = ''; |
369 |
document.getElementById("from_field").value = ""; |
| 323 |
document.getElementById('from_subfield').value = ''; |
370 |
document.getElementById("from_subfield").value = ""; |
| 324 |
document.getElementById('field_value').value = ''; |
371 |
document.getElementById("field_value").value = ""; |
| 325 |
document.getElementById('to_field').value = ''; |
372 |
document.getElementById("to_field").value = ""; |
| 326 |
document.getElementById('to_subfield').value = ''; |
373 |
document.getElementById("to_subfield").value = ""; |
| 327 |
$("#to_regex_search").val(""); |
374 |
$("#to_regex_search").val(""); |
| 328 |
$("#to_regex_replace").val(""); |
375 |
$("#to_regex_replace").val(""); |
| 329 |
$("#to_regex_modifiers").val(""); |
376 |
$("#to_regex_modifiers").val(""); |
| 330 |
$("#description").val(""); |
377 |
$("#description").val(""); |
| 331 |
|
378 |
|
| 332 |
$('#to_field_regex').prop('checked', false).change(); |
379 |
$("#to_field_regex").prop("checked", false).change(); |
| 333 |
|
380 |
|
| 334 |
setSelectByValue( 'conditional', '' ); |
381 |
setSelectByValue("conditional", ""); |
| 335 |
$('#conditional').change(); |
382 |
$("#conditional").change(); |
| 336 |
|
383 |
|
| 337 |
document.getElementById('conditional_field').value = ''; |
384 |
document.getElementById("conditional_field").value = ""; |
| 338 |
document.getElementById('conditional_subfield').value = ''; |
385 |
document.getElementById("conditional_subfield").value = ""; |
| 339 |
|
386 |
|
| 340 |
setSelectByValue( 'conditional_comparison', '' ); |
387 |
setSelectByValue("conditional_comparison", ""); |
| 341 |
$('#conditional_comparison').change(); |
388 |
$("#conditional_comparison").change(); |
| 342 |
|
389 |
|
| 343 |
document.getElementById('conditional_value').value = ''; |
390 |
document.getElementById("conditional_value").value = ""; |
| 344 |
|
391 |
|
| 345 |
document.getElementById('conditional_regex').checked = false; |
392 |
document.getElementById("conditional_regex").checked = false; |
| 346 |
|
393 |
|
| 347 |
document.getElementById('modaction_legend').innerHTML = window.modaction_legend_innerhtml; |
394 |
document.getElementById("modaction_legend").innerHTML = |
| 348 |
document.getElementById('action_submit').value = window.action_submit_value; |
395 |
window.modaction_legend_innerhtml; |
|
|
396 |
document.getElementById("action_submit").value = window.action_submit_value; |
| 349 |
|
397 |
|
| 350 |
if( $("#template_actions").length < 1 ){ |
398 |
if ($("#template_actions").length < 1) { |
| 351 |
$("#no_defined_actions").show(); |
399 |
$("#no_defined_actions").show(); |
| 352 |
} |
400 |
} |
| 353 |
|
401 |
|
| 354 |
$("#add_action").hide(); |
402 |
$("#add_action").hide(); |
| 355 |
} |
403 |
} |
| 356 |
|
404 |
|
| 357 |
function setSelectByValue( selectId, value ) { |
405 |
function setSelectByValue(selectId, value) { |
| 358 |
s = document.getElementById( selectId ); |
406 |
s = document.getElementById(selectId); |
| 359 |
|
407 |
|
| 360 |
for ( i = 0; i < s.options.length; i++ ) { |
408 |
for (i = 0; i < s.options.length; i++) { |
| 361 |
if ( s.options[i].value == value ) { |
409 |
if (s.options[i].value == value) { |
| 362 |
s.selectedIndex = i; |
410 |
s.selectedIndex = i; |
| 363 |
} |
411 |
} |
| 364 |
} |
412 |
} |
| 365 |
- |
|
|