|
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 1161-1166
Link Here
|
| 1161 |
<fieldset class="rows"> |
1162 |
<fieldset class="rows"> |
| 1162 |
<legend>SQL:</legend> |
1163 |
<legend>SQL:</legend> |
| 1163 |
<div style="margin:1em;"> |
1164 |
<div style="margin:1em;"> |
|
|
1165 |
[% PROCESS insert_runtime_parameter %] |
| 1164 |
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> |
1166 |
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> |
| 1165 |
<span class="required">Required</span> |
1167 |
<span class="required">Required</span> |
| 1166 |
</div> |
1168 |
</div> |
|
Lines 1270-1279
Link Here
|
| 1270 |
|
1272 |
|
| 1271 |
<fieldset class="rows"> |
1273 |
<fieldset class="rows"> |
| 1272 |
<legend>SQL:</legend> |
1274 |
<legend>SQL:</legend> |
| 1273 |
<div style="margin:1em;"> |
1275 |
[% PROCESS insert_runtime_parameter %] |
| 1274 |
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> |
1276 |
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> |
| 1275 |
<span class="required">Required</span> |
1277 |
<span class="required" style="margin-left:30px;">Required</span> |
| 1276 |
</div> |
|
|
| 1277 |
</fieldset> |
1278 |
</fieldset> |
| 1278 |
|
1279 |
|
| 1279 |
<fieldset class="action"> |
1280 |
<fieldset class="action"> |
|
Lines 1351-1356
Link Here
|
| 1351 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
1352 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
| 1352 |
</div> <!-- /.row --> |
1353 |
</div> <!-- /.row --> |
| 1353 |
|
1354 |
|
|
|
1355 |
<!-- Runtime Parameters Modal --> |
| 1356 |
<div class="modal" id="runtime_parameters" tabindex="-1" role="dialog" aria-labelledby="runtime_parametersLabel"> |
| 1357 |
<div class="modal-dialog" role="document"> |
| 1358 |
<div class="modal-content"> |
| 1359 |
<div class="modal-header"> |
| 1360 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 1361 |
<h4 class="modal-title" id="runtime_parametersLabel">Runtime parameter options</h4> |
| 1362 |
</div> |
| 1363 |
<form id="send_runtime_parameter"> |
| 1364 |
<input type="hidden" name="param_category" id="param_category" /> |
| 1365 |
<div class="modal-body"> |
| 1366 |
<div class="form-group"> |
| 1367 |
<label for="paramLabel">Parameter label: </label> |
| 1368 |
<input class="form-control" type="text" name="paramLabel" id="paramLabel"> |
| 1369 |
<div class="hint">Optional. The label for the field shown when the report is run, e.g. "Select a library."</div> |
| 1370 |
</div> |
| 1371 |
<div id="authorised_value_category" class="form-group" style="display:none"> |
| 1372 |
<label for="authorised_value">Authorized value category:</label> |
| 1373 |
<select class="form-control" name="authorised_value" id="authorised_value" size="1"> |
| 1374 |
<option value=""></option> |
| 1375 |
[% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %] |
| 1376 |
</select> |
| 1377 |
<div class="hint">Select which authorized value category the user will choose from.</div> |
| 1378 |
</div> |
| 1379 |
</div> <!-- /.modal-body --> |
| 1380 |
<div class="modal-footer"> |
| 1381 |
<button type="submit" id="sendParam" class="btn btn-default approve">Insert parameter</button> |
| 1382 |
<button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button> |
| 1383 |
</div> <!-- /.modal-footer --> |
| 1384 |
</form> <!-- /#send_runtime_parameter --> |
| 1385 |
</div> <!-- /.modal-content --> |
| 1386 |
</div> <!-- /.modal-dialog --> |
| 1387 |
</div> <!-- /#runtime_parameters --> |
| 1388 |
|
| 1354 |
[% MACRO jsinclude BLOCK %] |
1389 |
[% MACRO jsinclude BLOCK %] |
| 1355 |
[% Asset.js("js/charts.js") | $raw %] |
1390 |
[% Asset.js("js/charts.js") | $raw %] |
| 1356 |
[% Asset.js("lib/d3c3/d3.min.js") | $raw %] |
1391 |
[% Asset.js("lib/d3c3/d3.min.js") | $raw %] |
|
Lines 1457-1462
Link Here
|
| 1457 |
}); |
1492 |
}); |
| 1458 |
[% END %] |
1493 |
[% END %] |
| 1459 |
|
1494 |
|
|
|
1495 |
function showParamModal( category ){ |
| 1496 |
var modal = $("#runtime_parameters"); |
| 1497 |
var modalTitle = $("#runtime_parametersLabel"); |
| 1498 |
switch ( category ){ |
| 1499 |
case "insertAuthVal": |
| 1500 |
modalTitle.text( _("Insert authorized value parameter") ); |
| 1501 |
$("#paramLabel").val("Authorized value") |
| 1502 |
$("#authorised_value_category").show(); |
| 1503 |
$("#authorised_value").prop("required", true ).attr("required", "required"); |
| 1504 |
break; |
| 1505 |
case "insertDate": |
| 1506 |
modalTitle.text( _("Insert date parameter") ); |
| 1507 |
$("#paramLabel").val("Date") |
| 1508 |
$("#param_category").val("date"); |
| 1509 |
break; |
| 1510 |
case "insertItemtypes": |
| 1511 |
modalTitle.text( _("Insert item types parameter") ); |
| 1512 |
$("#paramLabel").val("Item type") |
| 1513 |
$("#param_category").val("itemtypes"); |
| 1514 |
break; |
| 1515 |
case "insertBranches": |
| 1516 |
modalTitle.text( _("Insert libraries parameter") ); |
| 1517 |
$("#paramLabel").val("Library") |
| 1518 |
$("#param_category").val("branches"); |
| 1519 |
break; |
| 1520 |
case "insertCategorycode": |
| 1521 |
modalTitle.text( _("Insert patron category parameter") ); |
| 1522 |
$("#paramLabel").val("Patron category") |
| 1523 |
$("#param_category").val("categorycode"); |
| 1524 |
break; |
| 1525 |
case "insertText": |
| 1526 |
modalTitle.text( _("Insert text parameter") ); |
| 1527 |
$("#paramLabel").val("Text") |
| 1528 |
$("#param_category").val(""); |
| 1529 |
break; |
| 1530 |
} |
| 1531 |
$("#paramLabel").select(); |
| 1532 |
modal.modal("show"); |
| 1533 |
} |
| 1534 |
|
| 1460 |
function load_group_subgroups () { |
1535 |
function load_group_subgroups () { |
| 1461 |
var group = $("#group_select").val(); |
1536 |
var group = $("#group_select").val(); |
| 1462 |
var sg = $("#subgroup"); |
1537 |
var sg = $("#subgroup"); |
|
Lines 1840-1845
Link Here
|
| 1840 |
$("#group_select").on("change",function(){ |
1915 |
$("#group_select").on("change",function(){ |
| 1841 |
load_group_subgroups(); |
1916 |
load_group_subgroups(); |
| 1842 |
}); |
1917 |
}); |
|
|
1918 |
|
| 1919 |
$(".insertParam").on("click", function(e){ |
| 1920 |
e.preventDefault(); |
| 1921 |
var category = this.id; |
| 1922 |
showParamModal( category ); |
| 1923 |
}); |
| 1924 |
|
| 1925 |
$("#runtime_parameters").on("shown.bs.modal", function(){ |
| 1926 |
$("#paramLabel").focus(); |
| 1927 |
}); |
| 1928 |
|
| 1929 |
$("#runtime_parameters").on("hide.bs.modal", function(){ |
| 1930 |
$("#send_runtime_parameter")[0].reset(); |
| 1931 |
$("#authorised_value_category").val("").hide(); |
| 1932 |
$("#authorised_value").prop("required", false ).removeAttr("required"); |
| 1933 |
}); |
| 1934 |
|
| 1935 |
$("#send_runtime_parameter").on("submit", function(e){ |
| 1936 |
e.preventDefault(); |
| 1937 |
/* Get form values */ |
| 1938 |
var paramLabel = $("#paramLabel").val(); |
| 1939 |
var param_category = $("#param_category").val(); |
| 1940 |
var categoryLabel = $("#authorised_value").val(); |
| 1941 |
// Get CodeMirror environment variables |
| 1942 |
var selection = editor.getSelection(); |
| 1943 |
var doc = editor.getDoc(); |
| 1944 |
var cursor = doc.getCursor(); |
| 1945 |
var pos = { |
| 1946 |
line: cursor.line, |
| 1947 |
ch: cursor.ch |
| 1948 |
} |
| 1949 |
/* Build runtime parameter text string */ |
| 1950 |
var text = ""; |
| 1951 |
if( paramLabel && param_category ){ |
| 1952 |
text += paramLabel + "|" + param_category; |
| 1953 |
} else if( paramLabel ) { |
| 1954 |
text += paramLabel; |
| 1955 |
} else if( param_category ){ |
| 1956 |
text += param_category; |
| 1957 |
} |
| 1958 |
if( text != "" ){ |
| 1959 |
text = " <<" + text + ">> "; |
| 1960 |
if( selection.length > 0){ |
| 1961 |
editor.replaceSelection(text); |
| 1962 |
} else { |
| 1963 |
doc.replaceRange(text, pos); |
| 1964 |
} |
| 1965 |
} |
| 1966 |
$("#runtime_parameters").modal("hide"); |
| 1967 |
}); |
| 1968 |
|
| 1969 |
$("#authorised_value").on("change", function(){ |
| 1970 |
$("#param_category").val( $(this).val() ); |
| 1971 |
}); |
| 1972 |
|
| 1843 |
[% END %] |
1973 |
[% END %] |
| 1844 |
|
1974 |
|
| 1845 |
$(".delete").on("click",function(){ |
1975 |
$(".delete").on("click",function(){ |
|
Lines 2109-2111
Link Here
|
| 2109 |
<input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" /> |
2239 |
<input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" /> |
| 2110 |
</li> |
2240 |
</li> |
| 2111 |
[% END %] |
2241 |
[% END %] |
| 2112 |
- |
2242 |
|
|
|
2243 |
[% BLOCK insert_runtime_parameter %] |
| 2244 |
<div class="btn-group" style="margin-left:30px;"> |
| 2245 |
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
| 2246 |
Insert runtime parameter <span class="caret"></span> |
| 2247 |
</button> |
| 2248 |
<ul class="dropdown-menu"> |
| 2249 |
<li><a href="#" class="insertParam" id="insertAuthVal">Authorized value</a></li> |
| 2250 |
<li><a href="#" class="insertParam" id="insertDate">Date</a></li> |
| 2251 |
<li><a href="#" class="insertParam" id="insertItemtypes">Item types</a></li> |
| 2252 |
<li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li> |
| 2253 |
<li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li> |
| 2254 |
<li><a href="#" class="insertParam" id="insertText">Text field</a></li> |
| 2255 |
</ul> |
| 2256 |
</div> |
| 2257 |
[% END %] |