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

(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/sql.js (+268 lines)
Line 0 Link Here
1
CodeMirror.defineMode("sql", function(config, parserConfig) {
2
  "use strict";
3
4
  var client         = parserConfig.client || {},
5
      atoms          = parserConfig.atoms || {"false": true, "true": true, "null": true},
6
      builtin        = parserConfig.builtin || {},
7
      keywords       = parserConfig.keywords || {},
8
      operatorChars  = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/,
9
      support        = parserConfig.support || {},
10
      hooks          = parserConfig.hooks || {},
11
      dateSQL        = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true};
12
13
  function tokenBase(stream, state) {
14
    var ch = stream.next();
15
16
    // call hooks from the mime type
17
    if (hooks[ch]) {
18
      var result = hooks[ch](stream, state);
19
      if (result !== false) return result;
20
    }
21
22
    if ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/))
23
      || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/)) {
24
      // hex
25
      return "number";
26
    } else if (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/))
27
      || (ch == "0" && stream.match(/^b[01]+/))) {
28
      // bitstring
29
      return "number";
30
    } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) {
31
      // numbers
32
      stream.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/);
33
      return "number";
34
    } else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) {
35
      // placeholders
36
      return "variable-3";
37
    } else if (ch == '"' || ch == "'") {
38
      // strings
39
      state.tokenize = tokenLiteral(ch);
40
      return state.tokenize(stream, state);
41
    } else if (/^[\(\),\;\[\]]/.test(ch)) {
42
      // no highlightning
43
      return null;
44
    } else if (ch == "#" || (ch == "-" && stream.eat("-") && stream.eat(" "))) {
45
      // 1-line comments
46
      stream.skipToEnd();
47
      return "comment";
48
    } else if (ch == "/" && stream.eat("*")) {
49
      // multi-line comments
50
      state.tokenize = tokenComment;
51
      return state.tokenize(stream, state);
52
    } else if (ch == ".") {
53
      // .1 for 0.1
54
      if (stream.match(/^[0-9eE]+/) && support.zerolessFloat == true) {
55
        return "number";
56
      }
57
      // .table_name (ODBC)
58
      if (stream.match(/^[a-zA-Z_]+/) && support.ODBCdotTable == true) {
59
        return "variable-2";
60
      }
61
    } else if (operatorChars.test(ch)) {
62
      // operators
63
      stream.eatWhile(operatorChars);
64
      return null;
65
    } else if (ch == '{' &&
66
        (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) {
67
      // dates (weird ODBC syntax)
68
      return "number";
69
    } else {
70
      stream.eatWhile(/^[_\w\d]/);
71
      var word = stream.current().toLowerCase();
72
      // dates (standard SQL syntax)
73
      if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/)))
74
        return "number";
75
      if (atoms.hasOwnProperty(word)) return "atom";
76
      if (builtin.hasOwnProperty(word)) return "builtin";
77
      if (keywords.hasOwnProperty(word)) return "keyword";
78
      if (client.hasOwnProperty(word)) return "string-2";
79
      return null;
80
    }
81
  }
82
83
  // 'string', with char specified in quote escaped by '\'
84
  function tokenLiteral(quote) {
85
    return function(stream, state) {
86
      var escaped = false, ch;
87
      while ((ch = stream.next()) != null) {
88
        if (ch == quote && !escaped) {
89
          state.tokenize = tokenBase;
90
          break;
91
        }
92
        escaped = !escaped && ch == "\\";
93
      }
94
      return "string";
95
    };
96
  }
97
  function tokenComment(stream, state) {
98
    while (true) {
99
      if (stream.skipTo("*")) {
100
        stream.next();
101
        if (stream.eat("/")) {
102
          state.tokenize = tokenBase;
103
          break;
104
        }
105
      } else {
106
        stream.skipToEnd();
107
        break;
108
      }
109
    }
110
    return "comment";
111
  }
112
113
  function pushContext(stream, state, type) {
114
    state.context = {
115
      prev: state.context,
116
      indent: stream.indentation(),
117
      col: stream.column(),
118
      type: type
119
    };
120
  }
121
122
  function popContext(state) {
123
    state.indent = state.context.indent;
124
    state.context = state.context.prev;
125
  }
126
127
  return {
128
    startState: function() {
129
      return {tokenize: tokenBase, context: null};
130
    },
131
132
    token: function(stream, state) {
133
      if (stream.sol()) {
134
        if (state.context && state.context.align == null)
135
          state.context.align = false;
136
      }
137
      if (stream.eatSpace()) return null;
138
139
      var style = state.tokenize(stream, state);
140
      if (style == "comment") return style;
141
142
      if (state.context && state.context.align == null)
143
        state.context.align = true;
144
145
      var tok = stream.current();
146
      if (tok == "(")
147
        pushContext(stream, state, ")");
148
      else if (tok == "[")
149
        pushContext(stream, state, "]");
150
      else if (state.context && state.context.type == tok)
151
        popContext(state);
152
      return style;
153
    },
154
155
    indent: function(state, textAfter) {
156
      var cx = state.context;
157
      if (!cx) return CodeMirror.Pass;
158
      if (cx.align) return cx.col + (textAfter.charAt(0) == cx.type ? 0 : 1);
159
      else return cx.indent + config.indentUnit;
160
    }
161
  };
162
});
163
164
(function() {
165
  "use strict";
166
167
  // `identifier`
168
  function hookIdentifier(stream) {
169
    var escaped = false, ch;
170
    while ((ch = stream.next()) != null) {
171
      if (ch == "`" && !escaped) return "variable-2";
172
      escaped = !escaped && ch == "`";
173
    }
174
    return null;
175
  }
176
177
  // variable token
178
  function hookVar(stream) {
179
    // variables
180
    // @@ and prefix
181
    if (stream.eat("@")) {
182
      stream.match(/^session\./);
183
      stream.match(/^local\./);
184
      stream.match(/^global\./);
185
    }
186
187
    if (stream.eat("'")) {
188
      stream.match(/^.*'/);
189
      return "variable-2";
190
    } else if (stream.eat('"')) {
191
      stream.match(/^.*"/);
192
      return "variable-2";
193
    } else if (stream.eat("`")) {
194
      stream.match(/^.*`/);
195
      return "variable-2";
196
    } else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) {
197
      return "variable-2";
198
    }
199
    return null;
200
  };
201
202
  // short client keyword token
203
  function hookClient(stream) {
204
    // \g, etc
205
    return stream.match(/^[a-zA-Z]\b/) ? "variable-2" : null;
206
  }
207
208
  var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where ";
209
210
  function set(str) {
211
    var obj = {}, words = str.split(" ");
212
    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
213
    return obj;
214
  }
215
216
  CodeMirror.defineMIME("text/x-sql", {
217
    name: "sql",
218
    keywords: set(sqlKeywords + "begin"),
219
    builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),
220
    atoms: set("false true null unknown"),
221
    operatorChars: /^[*+\-%<>!=]/,
222
    dateSQL: set("date time timestamp"),
223
    support: set("ODBCdotTable")
224
  });
225
226
  CodeMirror.defineMIME("text/x-mysql", {
227
    name: "sql",
228
    client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
229
    keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
230
    builtin: set("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
231
    atoms: set("false true null unknown"),
232
    operatorChars: /^[*+\-%<>!=&|^]/,
233
    dateSQL: set("date time timestamp"),
234
    support: set("ODBCdotTable zerolessFloat"),
235
    hooks: {
236
      "@":   hookVar,
237
      "`":   hookIdentifier,
238
      "\\":  hookClient
239
    }
240
  });
241
242
  CodeMirror.defineMIME("text/x-mariadb", {
243
    name: "sql",
244
    client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
245
    keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
246
    builtin: set("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
247
    atoms: set("false true null unknown"),
248
    operatorChars: /^[*+\-%<>!=&|^]/,
249
    dateSQL: set("date time timestamp"),
250
    support: set("ODBCdotTable zerolessFloat"),
251
    hooks: {
252
      "@":   hookVar,
253
      "`":   hookIdentifier,
254
      "\\":  hookClient
255
    }
256
  });
257
258
  // this is based on Peter Raganitsch's 'plsql' mode
259
  CodeMirror.defineMIME("text/x-plsql", {
260
    name:       "sql",
261
    client:     set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
262
    keywords:   set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
263
    functions:  set("abs acos add_months ascii asin atan atan2 average bfilename ceil chartorowid chr concat convert cos cosh count decode deref dual dump dup_val_on_index empty error exp false floor found glb greatest hextoraw initcap instr instrb isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mod months_between new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null nvl others power rawtohex reftohex round rowcount rowidtochar rpad rtrim sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid upper user userenv variance vsize"),
264
    builtin:    set("bfile blob character clob dec float int integer mlslabel natural naturaln nchar nclob number numeric nvarchar2 real rowtype signtype smallint string varchar varchar2"),
265
    operatorChars: /^[*+\-%<>!=~]/,
266
    dateSQL:    set("date time timestamp")
267
  });
268
}());
(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/sql.min.js (+1 lines)
Line 0 Link Here
1
CodeMirror.defineMode("sql",function(e,t){"use strict";var r=t.client||{},a=t.atoms||{false:!0,true:!0,null:!0},n=t.builtin||{},i=t.keywords||{},o=t.operatorChars||/^[*+\-%<>!=&|~^]/,s=t.support||{},l=t.hooks||{},c=t.dateSQL||{date:!0,time:!0,timestamp:!0};function u(e,t){var m,p=e.next();if(l[p]){var b=l[p](e,t);if(!1!==b)return b}if("0"==p&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==p||"X"==p)&&e.match(/^'[0-9a-fA-F]+'/))return"number";if(("b"==p||"B"==p)&&e.match(/^'[01]+'/)||"0"==p&&e.match(/^b[01]+/))return"number";if(p.charCodeAt(0)>47&&p.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),"number";if("?"==p&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if('"'==p||"'"==p)return t.tokenize=(m=p,function(e,t){for(var r,a=!1;null!=(r=e.next());){if(r==m&&!a){t.tokenize=u;break}a=!a&&"\\"==r}return"string"}),t.tokenize(e,t);if(/^[\(\),\;\[\]]/.test(p))return null;if("#"==p||"-"==p&&e.eat("-")&&e.eat(" "))return e.skipToEnd(),"comment";if("/"==p&&e.eat("*"))return t.tokenize=d,t.tokenize(e,t);if("."!=p){if(o.test(p))return e.eatWhile(o),null;if("{"==p&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var g=e.current().toLowerCase();return c.hasOwnProperty(g)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":a.hasOwnProperty(g)?"atom":n.hasOwnProperty(g)?"builtin":i.hasOwnProperty(g)?"keyword":r.hasOwnProperty(g)?"string-2":null}return e.match(/^[0-9eE]+/)&&1==s.zerolessFloat?"number":e.match(/^[a-zA-Z_]+/)&&1==s.ODBCdotTable?"variable-2":void 0}function d(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=u;break}}return"comment"}function m(e,t,r){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:r}}return{startState:function(){return{tokenize:u,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var r=t.tokenize(e,t);if("comment"==r)return r;t.context&&null==t.context.align&&(t.context.align=!0);var a,n=e.current();return"("==n?m(e,t,")"):"["==n?m(e,t,"]"):t.context&&t.context.type==n&&((a=t).indent=a.context.indent,a.context=a.context.prev),r},indent:function(t,r){var a=t.context;return a?a.align?a.col+(r.charAt(0)==a.type?0:1):a.indent+e.indentUnit:CodeMirror.Pass}}}),function(){"use strict";function e(e){for(var t,r=!1;null!=(t=e.next());){if("`"==t&&!r)return"variable-2";r=!r&&"`"==t}return null}function t(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function r(e){return e.match(/^[a-zA-Z]\b/)?"variable-2":null}var a="alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where ";function n(e){for(var t={},r=e.split(" "),a=0;a<r.length;++a)t[r[a]]=!0;return t}CodeMirror.defineMIME("text/x-sql",{name:"sql",keywords:n(a+"begin"),builtin:n("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),atoms:n("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:n("date time timestamp"),support:n("ODBCdotTable")}),CodeMirror.defineMIME("text/x-mysql",{name:"sql",client:n("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:n(a+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:n("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:n("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:n("date time timestamp"),support:n("ODBCdotTable zerolessFloat"),hooks:{"@":t,"`":e,"\\":r}}),CodeMirror.defineMIME("text/x-mariadb",{name:"sql",client:n("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:n(a+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:n("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:n("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:n("date time timestamp"),support:n("ODBCdotTable zerolessFloat"),hooks:{"@":t,"`":e,"\\":r}}),CodeMirror.defineMIME("text/x-plsql",{name:"sql",client:n("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:n("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),functions:n("abs acos add_months ascii asin atan atan2 average bfilename ceil chartorowid chr concat convert cos cosh count decode deref dual dump dup_val_on_index empty error exp false floor found glb greatest hextoraw initcap instr instrb isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mod months_between new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null nvl others power rawtohex reftohex round rowcount rowidtochar rpad rtrim sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid upper user userenv variance vsize"),builtin:n("bfile blob character clob dec float int integer mlslabel natural naturaln nchar nclob number numeric nvarchar2 real rowtype signtype smallint string varchar varchar2"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:n("date time timestamp")})}();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-12 / +54 lines)
Lines 31-36 Link Here
31
[%- END -%]</title>
31
[%- END -%]</title>
32
32
33
[% INCLUDE 'doc-head-close.inc' %]
33
[% INCLUDE 'doc-head-close.inc' %]
34
[% Asset.css("lib/codemirror/codemirror.css") %]
34
<style type="text/css">
35
<style type="text/css">
35
    #sql { width: 90%; height: 9em;}
36
    #sql { width: 90%; height: 9em;}
36
    #update_sql .modal-dialog { width: 80%; }
37
    #update_sql .modal-dialog { width: 80%; }
Lines 49-54 Link Here
49
        padding: 3px 5px;
50
        padding: 3px 5px;
50
        white-space: nowrap;
51
        white-space: nowrap;
51
    }
52
    }
53
    .CodeMirror {
54
        box-sizing: content-box;
55
        font-size: 100%;
56
        margin-bottom: 1em;
57
    }
58
    [% IF ( create || editsql || save ) %]
59
        .CodeMirror {
60
            border-color: #666 #C4C4C4  #ddd   #666;
61
            border-width: 1px;
62
            border-style: solid;
63
        }
64
    [% ELSE %]
65
        .CodeMirror {
66
            height: auto;
67
        }
68
        .CodeMirror-scroll {
69
            height: auto;
70
        }
71
    [% END %]
72
    .CodeMirror-wrap pre {
73
        line-height: 1.5em;
74
    }
75
    .CodeMirror-linenumber {
76
        line-height: 1.5em;
77
        min-width: 40px;
78
    }
79
    .CodeMirror-scroll {
80
        padding-bottom: 0;
81
    }
82
    .CodeMirror-gutter-elt { left: -41px !important }
52
</style>
83
</style>
53
[% IF ( saved1 ) %]
84
[% IF ( saved1 ) %]
54
    [% Asset.css("css/datatables.css") %]
85
    [% Asset.css("css/datatables.css") %]
Lines 372-383 canned reports and writing custom SQL reports.</p> Link Here
372
</div>
403
</div>
373
<div class="yui-gb"><div class="yui-u first"></div>
404
<div class="yui-gb"><div class="yui-u first"></div>
374
405
375
<!--- Summary and Matrix reports have not yet been implemented-->
376
<!--<div class="yui-u">Summary:
377
<img src="[% interface %]/[% theme %]/img/reports-summary-graphic.gif" /></div>
378
<div class="yui-u">Matrix:
379
<img src="[% interface %]/[% theme %]/img/reports-matrix-graphic.gif" /></div>-->
380
381
[% END %]
406
[% END %]
382
407
383
[% IF ( build3 ) %]
408
[% IF ( build3 ) %]
Lines 749-759 canned reports and writing custom SQL reports.</p> Link Here
749
[% END %]
774
[% END %]
750
775
751
[% IF ( create ) %]
776
[% IF ( create ) %]
752
<script type="text/javascript">
753
$(document).ready(function() {
754
    load_group_subgroups();
755
});
756
</script>
757
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
777
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
758
<fieldset class="rows">
778
<fieldset class="rows">
759
<legend>Create report from SQL</legend>
779
<legend>Create report from SQL</legend>
Lines 933-938 $(document).ready(function() { Link Here
933
        [% INCLUDE 'datatables.inc' %]
953
        [% INCLUDE 'datatables.inc' %]
934
        [% INCLUDE 'columns_settings.inc' %]
954
        [% INCLUDE 'columns_settings.inc' %]
935
    [% END %]
955
    [% END %]
956
    [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) %]
957
    [% Asset.js( "lib/codemirror/sql.min.js" ) %]
936
    <script>
958
    <script>
937
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
959
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
938
        var group_subgroups = {};
960
        var group_subgroups = {};
Lines 946-951 $(document).ready(function() { Link Here
946
            [% END %]
968
            [% END %]
947
        [% END %]
969
        [% END %]
948
970
971
        [% IF ( create || editsql || save ) %]
972
            var editor = CodeMirror.fromTextArea(sql, {
973
                lineNumbers: true,
974
                mode: "text/x-sql",
975
                lineWrapping: true
976
            });
977
        [% END %]
978
979
        [% IF ( showsql ) %]
980
            var editor = CodeMirror.fromTextArea(sql, {
981
                lineNumbers: false,
982
                mode: "text/x-sql",
983
                lineWrapping: true,
984
                readOnly: true
985
            });
986
        [% END %]
987
949
        function load_group_subgroups () {
988
        function load_group_subgroups () {
950
            var group = $("#group_select").val();
989
            var group = $("#group_select").val();
951
            var sg = $("#subgroup");
990
            var sg = $("#subgroup");
Lines 964-969 $(document).ready(function() { Link Here
964
1003
965
        $(document).ready(function(){
1004
        $(document).ready(function(){
966
1005
1006
            [% IF ( create ) %]
1007
                load_group_subgroups();
1008
            [% END %]
1009
967
            $('[data-toggle="tooltip"]').tooltip();
1010
            $('[data-toggle="tooltip"]').tooltip();
968
            var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) %];
1011
            var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) %];
969
1012
970
- 

Return to bug 20260