View | Details | Raw Unified | Return to bug 27644
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+18 lines)
Lines 951-956 fieldset { Link Here
951
                width: unset;
951
                width: unset;
952
            }
952
            }
953
        }
953
        }
954
955
        .dropdown-menu {
956
            li {
957
                padding-bottom: 0;
958
            }
959
        }
954
    }
960
    }
955
}
961
}
956
962
Lines 1701-1706 i { Link Here
1701
    white-space: nowrap;
1707
    white-space: nowrap;
1702
}
1708
}
1703
1709
1710
.form-group {
1711
    label {
1712
        display: block;
1713
        margin-bottom: 5px;
1714
    }
1715
1716
    div {
1717
        &.hint {
1718
            margin: 5px 0;
1719
        }
1720
    }
1721
}
1704
1722
1705
.blocker {
1723
.blocker {
1706
    color: #990000;
1724
    color: #990000;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-4 / +149 lines)
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 1113-1118 Link Here
1113
                        <fieldset class="rows">
1114
                        <fieldset class="rows">
1114
                            <legend>SQL:</legend>
1115
                            <legend>SQL:</legend>
1115
                            <div style="margin:1em;">
1116
                            <div style="margin:1em;">
1117
                                [% PROCESS insert_runtime_parameter  %]
1116
                                <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1118
                                <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1117
                                <span class="required">Required</span>
1119
                                <span class="required">Required</span>
1118
                            </div>
1120
                            </div>
Lines 1222-1231 Link Here
1222
1224
1223
                        <fieldset class="rows">
1225
                        <fieldset class="rows">
1224
                            <legend>SQL:</legend>
1226
                            <legend>SQL:</legend>
1225
                            <div style="margin:1em;">
1227
                                [% PROCESS insert_runtime_parameter  %]
1226
                                <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>
1227
                                <span class="required">Required</span>
1229
                                <span class="required" style="margin-left:30px;">Required</span>
1228
                            </div>
1229
                        </fieldset>
1230
                        </fieldset>
1230
1231
1231
                        <fieldset class="action">
1232
                        <fieldset class="action">
Lines 1303-1308 Link Here
1303
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1304
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1304
    </div> <!-- /.row -->
1305
    </div> <!-- /.row -->
1305
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">&times;</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
1306
[% MACRO jsinclude BLOCK %]
1341
[% MACRO jsinclude BLOCK %]
1307
    [% Asset.js("js/charts.js") | $raw %]
1342
    [% Asset.js("js/charts.js") | $raw %]
1308
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1343
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
Lines 1409-1414 Link Here
1409
            });
1444
            });
1410
        [% END %]
1445
        [% END %]
1411
1446
1447
        function showParamModal( category ){
1448
            var modal = $("#runtime_parameters");
1449
            var modalTitle = $("#runtime_parametersLabel");
1450
            switch ( category ){
1451
                case "insertAuthVal":
1452
                    modalTitle.text( _("Insert authorized value parameter") );
1453
                    $("#paramLabel").val("Authorized value")
1454
                    $("#authorised_value_category").show();
1455
                    $("#authorised_value").prop("required", true ).attr("required", "required");
1456
                    break;
1457
                case "insertDate":
1458
                    modalTitle.text( _("Insert date parameter") );
1459
                    $("#paramLabel").val("Date")
1460
                    $("#param_category").val("date");
1461
                    break;
1462
                case "insertItemtypes":
1463
                    modalTitle.text( _("Insert item types parameter") );
1464
                    $("#paramLabel").val("Item type")
1465
                    $("#param_category").val("itemtypes");
1466
                    break;
1467
                case "insertBranches":
1468
                    modalTitle.text( _("Insert libraries parameter") );
1469
                    $("#paramLabel").val("Library")
1470
                    $("#param_category").val("branches");
1471
                    break;
1472
                case "insertCategorycode":
1473
                    modalTitle.text( _("Insert patron category parameter") );
1474
                    $("#paramLabel").val("Patron category")
1475
                    $("#param_category").val("categorycode");
1476
                    break;
1477
                case "insertText":
1478
                    modalTitle.text( _("Insert text parameter") );
1479
                    $("#paramLabel").val("Text")
1480
                    $("#param_category").val("");
1481
                    break;
1482
            }
1483
            $("#paramLabel").select();
1484
            modal.modal("show");
1485
        }
1486
1412
        function load_group_subgroups () {
1487
        function load_group_subgroups () {
1413
            var group = $("#group_select").val();
1488
            var group = $("#group_select").val();
1414
            var sg = $("#subgroup");
1489
            var sg = $("#subgroup");
Lines 1794-1799 Link Here
1794
                $("#group_select").on("change",function(){
1869
                $("#group_select").on("change",function(){
1795
                    load_group_subgroups();
1870
                    load_group_subgroups();
1796
                });
1871
                });
1872
1873
                $(".insertParam").on("click", function(e){
1874
                    e.preventDefault();
1875
                    var category = this.id;
1876
                    showParamModal( category );
1877
                });
1878
1879
                $("#runtime_parameters").on("shown.bs.modal", function(){
1880
                    $("#paramLabel").focus();
1881
                });
1882
1883
                $("#runtime_parameters").on("hide.bs.modal", function(){
1884
                    $("#send_runtime_parameter")[0].reset();
1885
                    $("#authorised_value_category").val("").hide();
1886
                    $("#authorised_value").prop("required", false ).removeAttr("required");
1887
                });
1888
1889
                $("#send_runtime_parameter").on("submit", function(e){
1890
                    e.preventDefault();
1891
                    /* Get form values */
1892
                    var paramLabel = $("#paramLabel").val();
1893
                    var param_category = $("#param_category").val();
1894
                    var categoryLabel = $("#authorised_value").val();
1895
                    // Get CodeMirror environment variables
1896
                    var selection = editor.getSelection();
1897
                    var doc = editor.getDoc();
1898
                    var cursor = doc.getCursor();
1899
                    var pos = {
1900
                        line: cursor.line,
1901
                        ch: cursor.ch
1902
                    }
1903
                    /* Build runtime parameter text string */
1904
                    var text = "";
1905
                    if( paramLabel && param_category ){
1906
                        text += paramLabel + "|" + param_category;
1907
                    } else if( paramLabel ) {
1908
                        text += paramLabel;
1909
                    } else if( param_category ){
1910
                        text += param_category;
1911
                    }
1912
                    if( text != "" ){
1913
                        text = " <<" + text + ">> ";
1914
                        if( selection.length > 0){
1915
                            editor.replaceSelection(text);
1916
                        } else {
1917
                            doc.replaceRange(text, pos);
1918
                        }
1919
                    }
1920
                    $("#runtime_parameters").modal("hide");
1921
                });
1922
1923
                $("#authorised_value").on("change", function(){
1924
                    $("#param_category").val( $(this).val() );
1925
                });
1926
1797
            [% END %]
1927
            [% END %]
1798
1928
1799
            $(".delete").on("click",function(){
1929
            $(".delete").on("click",function(){
Lines 2064-2066 Link Here
2064
        <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />
2194
        <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />
2065
    </li>
2195
    </li>
2066
[% END %]
2196
[% END %]
2067
- 
2197
2198
[% BLOCK insert_runtime_parameter %]
2199
    <div class="btn-group"  style="margin-left:30px;">
2200
        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2201
            Insert runtime parameter <span class="caret"></span>
2202
        </button>
2203
        <ul class="dropdown-menu">
2204
            <li><a href="#" class="insertParam" id="insertAuthVal">Authorized value</a></li>
2205
            <li><a href="#" class="insertParam" id="insertDate">Date</a></li>
2206
            <li><a href="#" class="insertParam" id="insertItemtypes">Item types</a></li>
2207
            <li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
2208
            <li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
2209
            <li><a href="#" class="insertParam" id="insertText">Text field</a></li>
2210
        </ul>
2211
    </div>
2212
[% END %]

Return to bug 27644