@@ -, +, @@ column placeholders --- .../en/modules/reports/guided_reports_start.tt | 41 ++++++++++++++-------- 1 file changed, 27 insertions(+), 14 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -47,6 +47,9 @@ .cm-sqlParams { color: #11917B; } + .cm-columnPlaceholder { + color: #BF2D5D; + } #mana_search_errortext { font-family: monospace; font-weight: bold; } [% Asset.css("css/reports.css") | $raw %] @@ -1420,22 +1423,32 @@ } /* overlay a syntax-highlighting definition on top of the existing sql one */ - CodeMirror.defineMode("sqlParams", function(config, parserConfig) { - var sqlParamsOverlay = { + CodeMirror.defineMode("sqlPlaceholders", function(config, parserConfig) { + var sqlPlaceholdersOverlay = { token: function(stream, state) { - var ch; - if (stream.match("<<")) { - while ((ch = stream.next()) != null) - if (ch == ">" && stream.next() == ">") { - stream.eat(">"); - return "sqlParams"; + var ch; + + if (stream.match("<<")) { + while ((ch = stream.next()) != null) + if (ch == ">" && stream.next() == ">") { + stream.eat(">"); + return "sqlParams"; + } + } + + if (stream.match("[[")) { + while ((ch = stream.next()) != null) + if (ch == "]" && stream.next() == "]") break; + stream.eat("]"); + return "columnPlaceholder"; + } + + else if (stream.next() != null) { + return null; } - } - while (stream.next() != null && !stream.match("<<", false)) {} - return null; } }; - return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlParamsOverlay); + return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlPlaceholdersOverlay); }); var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone."); @@ -1454,7 +1467,7 @@ var editor = CodeMirror.fromTextArea(sql, { lineNumbers: true, - mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */ + mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */ lineWrapping: true, smartIndent: false }); @@ -1476,7 +1489,7 @@ [% IF ( showsql ) %] var editor = CodeMirror.fromTextArea(sql, { lineNumbers: false, - mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */ + mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */ lineWrapping: true, readOnly: true }); --