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 56-61 Link Here
56
    .cm-sqlParams {
56
    .cm-sqlParams {
57
        color: #11917B;
57
        color: #11917B;
58
    }
58
    }
59
    .cm-columnPlaceholder {
60
        color: #BF2D5D;
61
    }
59
    #mana_search_errortext { font-family: monospace; font-weight: bold; }
62
    #mana_search_errortext { font-family: monospace; font-weight: bold; }
60
</style>
63
</style>
61
[% Asset.css("css/reports.css") | $raw %]
64
[% Asset.css("css/reports.css") | $raw %]
Lines 1347-1368 Link Here
1347
        }
1350
        }
1348
1351
1349
        /* overlay a syntax-highlighting definition on top of the existing sql one */
1352
        /* overlay a syntax-highlighting definition on top of the existing sql one */
1350
        CodeMirror.defineMode("sqlParams", function(config, parserConfig) {
1353
        CodeMirror.defineMode("sqlPlaceholders", function(config, parserConfig) {
1351
            var sqlParamsOverlay = {
1354
            var sqlPlaceholdersOverlay = {
1352
                token: function(stream, state) {
1355
                token: function(stream, state) {
1353
                var ch;
1356
                    var ch;
1354
                if (stream.match("<<")) {
1357
1355
                    while ((ch = stream.next()) != null)
1358
                    if (stream.match("<<")) {
1356
                    if (ch == ">" && stream.next() == ">") {
1359
                        while ((ch = stream.next()) != null)
1357
                        stream.eat(">");
1360
                        if (ch == ">" && stream.next() == ">") {
1358
                        return "sqlParams";
1361
                            stream.eat(">");
1362
                            return "sqlParams";
1363
                        }
1364
                    }
1365
1366
                    if (stream.match("[[")) {
1367
                        while ((ch = stream.next()) != null)
1368
                            if (ch == "]" && stream.next() == "]") break;
1369
                        stream.eat("]");
1370
                        return "columnPlaceholder";
1371
                    }
1372
1373
                    else if (stream.next() != null) {
1374
                        return null;
1359
                    }
1375
                    }
1360
                }
1361
                while (stream.next() != null && !stream.match("<<", false)) {}
1362
                return null;
1363
                }
1376
                }
1364
            };
1377
            };
1365
            return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlParamsOverlay);
1378
            return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlPlaceholdersOverlay);
1366
        });
1379
        });
1367
1380
1368
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1381
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
Lines 1381-1387 Link Here
1381
1394
1382
            var editor = CodeMirror.fromTextArea(sql, {
1395
            var editor = CodeMirror.fromTextArea(sql, {
1383
                lineNumbers: true,
1396
                lineNumbers: true,
1384
                mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1397
                mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
1385
                lineWrapping: true,
1398
                lineWrapping: true,
1386
                smartIndent: false
1399
                smartIndent: false
1387
            });
1400
            });
Lines 1403-1409 Link Here
1403
        [% IF ( showsql ) %]
1416
        [% IF ( showsql ) %]
1404
            var editor = CodeMirror.fromTextArea(sql, {
1417
            var editor = CodeMirror.fromTextArea(sql, {
1405
                lineNumbers: false,
1418
                lineNumbers: false,
1406
                mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1419
                mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
1407
                lineWrapping: true,
1420
                lineWrapping: true,
1408
                readOnly: true
1421
                readOnly: true
1409
            });
1422
            });
1410
- 

Return to bug 27747