Lines 1-5
Link Here
|
1 |
[% USE raw %] |
1 |
[% USE raw %] |
2 |
[% USE Asset %] |
2 |
[% USE Asset %] |
|
|
3 |
[% USE AuthorisedValues %] |
3 |
[% USE KohaDates %] |
4 |
[% USE KohaDates %] |
4 |
[% USE Koha %] |
5 |
[% USE Koha %] |
5 |
[% USE TablesSettings %] |
6 |
[% USE TablesSettings %] |
Lines 1211-1220
Link Here
|
1211 |
|
1212 |
|
1212 |
<fieldset class="rows"> |
1213 |
<fieldset class="rows"> |
1213 |
<legend>SQL:</legend> |
1214 |
<legend>SQL:</legend> |
1214 |
<div style="margin:1em;"> |
1215 |
<div class="btn-group" style="margin-left:30px;"> |
|
|
1216 |
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
1217 |
Insert runtime parameter <span class="caret"></span> |
1218 |
</button> |
1219 |
<ul class="dropdown-menu"> |
1220 |
<li><a href="#" class="insertParam" id="insertAuthVal">Authorized value</a></li> |
1221 |
<li><a href="#" class="insertParam" id="insertDate">Date</a></li> |
1222 |
<li><a href="#" class="insertParam" id="insertItemtypes">Item types</a></li> |
1223 |
<li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li> |
1224 |
<li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li> |
1225 |
<li><a href="#" class="insertParam" id="insertText">Text field</a></li> |
1226 |
</ul> |
1227 |
</div> |
1215 |
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> |
1228 |
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> |
1216 |
<span class="required">Required</span> |
1229 |
<span class="required" style="margin-left:30px;">Required</span> |
1217 |
</div> |
|
|
1218 |
</fieldset> |
1230 |
</fieldset> |
1219 |
|
1231 |
|
1220 |
<fieldset class="action"> |
1232 |
<fieldset class="action"> |
Lines 1292-1297
Link Here
|
1292 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
1304 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
1293 |
</div> <!-- /.row --> |
1305 |
</div> <!-- /.row --> |
1294 |
|
1306 |
|
|
|
1307 |
<!-- Runtime Parameters Modal --> |
1308 |
<div class="modal" id="runtime_parameters" tabindex="-1" role="dialog" aria-labelledby="runtime_parametersLabel"> |
1309 |
<div class="modal-dialog" role="document"> |
1310 |
<div class="modal-content"> |
1311 |
<div class="modal-header"> |
1312 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
1313 |
<h4 class="modal-title" id="runtime_parametersLabel">Runtime parameter options</h4> |
1314 |
</div> |
1315 |
<form id="send_runtime_parameter"> |
1316 |
<input type="hidden" name="param_category" id="param_category" /> |
1317 |
<div class="modal-body"> |
1318 |
<div class="form-group"> |
1319 |
<label for="paramLabel">Parameter label: </label> |
1320 |
<input class="form-control" type="text" name="paramLabel" id="paramLabel"> |
1321 |
<div class="hint">Optional. The label for the field shown when the report is run, e.g. "Select a library."</div> |
1322 |
</div> |
1323 |
<div id="authorised_value_category" class="form-group" style="display:none"> |
1324 |
<label for="authorised_value">Authorized value category:</label> |
1325 |
<select class="form-control" name="authorised_value" id="authorised_value" size="1"> |
1326 |
<option value=""></option> |
1327 |
[% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %] |
1328 |
</select> |
1329 |
<div class="hint">Select which authorized value category the user will choose from.</div> |
1330 |
</div> |
1331 |
</div> <!-- /.modal-body --> |
1332 |
<div class="modal-footer"> |
1333 |
<button type="submit" id="sendParam" class="btn btn-default approve">Insert parameter</button> |
1334 |
<button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button> |
1335 |
</div> <!-- /.modal-footer --> |
1336 |
</form> <!-- /#send_runtime_parameter --> |
1337 |
</div> <!-- /.modal-content --> |
1338 |
</div> <!-- /.modal-dialog --> |
1339 |
</div> <!-- /#runtime_parameters --> |
1340 |
|
1295 |
[% MACRO jsinclude BLOCK %] |
1341 |
[% MACRO jsinclude BLOCK %] |
1296 |
[% Asset.js("js/charts.js") | $raw %] |
1342 |
[% Asset.js("js/charts.js") | $raw %] |
1297 |
[% Asset.js("lib/d3c3/d3.min.js") | $raw %] |
1343 |
[% Asset.js("lib/d3c3/d3.min.js") | $raw %] |
Lines 1375-1380
Link Here
|
1375 |
smartIndent: false |
1421 |
smartIndent: false |
1376 |
}); |
1422 |
}); |
1377 |
|
1423 |
|
|
|
1424 |
$(document).ready(function(){ |
1425 |
$(".insertParam").on("click", function(e){ |
1426 |
e.preventDefault(); |
1427 |
var category = this.id; |
1428 |
showParamModal( category ); |
1429 |
}); |
1430 |
|
1431 |
$("#runtime_parameters").on("shown.bs.modal", function(){ |
1432 |
$("#paramLabel").focus(); |
1433 |
}); |
1434 |
|
1435 |
$("#runtime_parameters").on("hide.bs.modal", function(){ |
1436 |
$("#send_runtime_parameter")[0].reset(); |
1437 |
$("#authorised_value_category").val("").hide(); |
1438 |
$("#authorised_value").prop("required", false ).removeAttr("required"); |
1439 |
}); |
1440 |
|
1441 |
$("#send_runtime_parameter").on("submit", function(e){ |
1442 |
e.preventDefault(); |
1443 |
/* Get form values */ |
1444 |
var paramLabel = $("#paramLabel").val(); |
1445 |
var param_category = $("#param_category").val(); |
1446 |
var categoryLabel = $("#authorised_value").val(); |
1447 |
// Get CodeMirror environment variables |
1448 |
var selection = editor.getSelection(); |
1449 |
var doc = editor.getDoc(); |
1450 |
var cursor = doc.getCursor(); |
1451 |
var pos = { |
1452 |
line: cursor.line, |
1453 |
ch: cursor.ch |
1454 |
} |
1455 |
/* Build runtime parameter text string */ |
1456 |
var text = ""; |
1457 |
if( paramLabel && param_category ){ |
1458 |
text += paramLabel + "|" + param_category; |
1459 |
} else if( paramLabel ) { |
1460 |
text += paramLabel; |
1461 |
} else if( param_category ){ |
1462 |
text += param_category; |
1463 |
} |
1464 |
if( text != "" ){ |
1465 |
text = " <<" + text + ">> "; |
1466 |
if( selection.length > 0){ |
1467 |
editor.replaceSelection(text); |
1468 |
} else { |
1469 |
doc.replaceRange(text, pos); |
1470 |
} |
1471 |
} |
1472 |
$("#runtime_parameters").modal("hide"); |
1473 |
}); |
1474 |
|
1475 |
$("#authorised_value").on("change", function(){ |
1476 |
$("#param_category").val( $(this).val() ); |
1477 |
}); |
1478 |
}) |
1479 |
|
1378 |
// https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232 |
1480 |
// https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232 |
1379 |
function clearValidation( formElement ){ |
1481 |
function clearValidation( formElement ){ |
1380 |
// formElement should be a jQuery object |
1482 |
// formElement should be a jQuery object |
Lines 1398-1403
Link Here
|
1398 |
}); |
1500 |
}); |
1399 |
[% END %] |
1501 |
[% END %] |
1400 |
|
1502 |
|
|
|
1503 |
function showParamModal( category ){ |
1504 |
var modal = $("#runtime_parameters"); |
1505 |
var modalTitle = $("#runtime_parametersLabel"); |
1506 |
switch ( category ){ |
1507 |
case "insertAuthVal": |
1508 |
modalTitle.text( _("Insert authorized value parameter") ); |
1509 |
$("#paramLabel").val("Authorized value") |
1510 |
$("#authorised_value_category").show(); |
1511 |
$("#authorised_value").prop("required", true ).attr("required", "required"); |
1512 |
break; |
1513 |
case "insertDate": |
1514 |
modalTitle.text( _("Insert date parameter") ); |
1515 |
$("#paramLabel").val("Date") |
1516 |
$("#param_category").val("date"); |
1517 |
break; |
1518 |
case "insertItemtypes": |
1519 |
modalTitle.text( _("Insert item types parameter") ); |
1520 |
$("#paramLabel").val("Item type") |
1521 |
$("#param_category").val("itemtypes"); |
1522 |
break; |
1523 |
case "insertBranches": |
1524 |
modalTitle.text( _("Insert libraries parameter") ); |
1525 |
$("#paramLabel").val("Library") |
1526 |
$("#param_category").val("branches"); |
1527 |
break; |
1528 |
case "insertCategorycode": |
1529 |
modalTitle.text( _("Insert patron category parameter") ); |
1530 |
$("#paramLabel").val("Patron category") |
1531 |
$("#param_category").val("categorycode"); |
1532 |
break; |
1533 |
case "insertText": |
1534 |
modalTitle.text( _("Insert text parameter") ); |
1535 |
$("#paramLabel").val("Text") |
1536 |
$("#param_category").val(""); |
1537 |
break; |
1538 |
} |
1539 |
$("#paramLabel").select(); |
1540 |
modal.modal("show"); |
1541 |
} |
1542 |
|
1401 |
function load_group_subgroups () { |
1543 |
function load_group_subgroups () { |
1402 |
var group = $("#group_select").val(); |
1544 |
var group = $("#group_select").val(); |
1403 |
var sg = $("#subgroup"); |
1545 |
var sg = $("#subgroup"); |
1404 |
- |
|
|