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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-15 / +27 lines)
Lines 47-52 Link Here
47
    .cm-sqlParams {
47
    .cm-sqlParams {
48
        color: #11917B;
48
        color: #11917B;
49
    }
49
    }
50
    .cm-columnPlaceholder {
51
        color: #BF2D5D;
52
    }
50
    #mana_search_errortext { font-family: monospace; font-weight: bold; }
53
    #mana_search_errortext { font-family: monospace; font-weight: bold; }
51
</style>
54
</style>
52
[% Asset.css("css/reports.css") | $raw %]
55
[% Asset.css("css/reports.css") | $raw %]
Lines 1420-1441 Link Here
1420
        }
1423
        }
1421
1424
1422
        /* overlay a syntax-highlighting definition on top of the existing sql one */
1425
        /* overlay a syntax-highlighting definition on top of the existing sql one */
1423
        CodeMirror.defineMode("sqlParams", function(config, parserConfig) {
1426
        CodeMirror.defineMode("sqlPlaceholders", function(config, parserConfig) {
1424
            var sqlParamsOverlay = {
1427
            var sqlPlaceholdersOverlay = {
1425
                token: function(stream, state) {
1428
                token: function(stream, state) {
1426
                var ch;
1429
                    var ch;
1427
                if (stream.match("<<")) {
1430
1428
                    while ((ch = stream.next()) != null)
1431
                    if (stream.match("<<")) {
1429
                    if (ch == ">" && stream.next() == ">") {
1432
                        while ((ch = stream.next()) != null)
1430
                        stream.eat(">");
1433
                        if (ch == ">" && stream.next() == ">") {
1431
                        return "sqlParams";
1434
                            stream.eat(">");
1435
                            return "sqlParams";
1436
                        }
1437
                    }
1438
1439
                    if (stream.match("[[")) {
1440
                        while ((ch = stream.next()) != null)
1441
                            if (ch == "]" && stream.next() == "]") break;
1442
                        stream.eat("]");
1443
                        return "columnPlaceholder";
1444
                    }
1445
1446
                    else if (stream.next() != null) {
1447
                        return null;
1432
                    }
1448
                    }
1433
                }
1434
                while (stream.next() != null && !stream.match("<<", false)) {}
1435
                return null;
1436
                }
1449
                }
1437
            };
1450
            };
1438
            return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlParamsOverlay);
1451
            return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlPlaceholdersOverlay);
1439
        });
1452
        });
1440
1453
1441
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1454
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
Lines 1454-1460 Link Here
1454
1467
1455
            var editor = CodeMirror.fromTextArea(sql, {
1468
            var editor = CodeMirror.fromTextArea(sql, {
1456
                lineNumbers: true,
1469
                lineNumbers: true,
1457
                mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1470
                mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
1458
                lineWrapping: true,
1471
                lineWrapping: true,
1459
                smartIndent: false
1472
                smartIndent: false
1460
            });
1473
            });
Lines 1476-1482 Link Here
1476
        [% IF ( showsql ) %]
1489
        [% IF ( showsql ) %]
1477
            var editor = CodeMirror.fromTextArea(sql, {
1490
            var editor = CodeMirror.fromTextArea(sql, {
1478
                lineNumbers: false,
1491
                lineNumbers: false,
1479
                mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1492
                mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
1480
                lineWrapping: true,
1493
                lineWrapping: true,
1481
                readOnly: true
1494
                readOnly: true
1482
            });
1495
            });
1483
- 

Return to bug 27747