marty 2.4.7 → 2.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile.dummy +8 -5
  3. data/Gemfile.lock +1 -1
  4. data/README.md +8 -0
  5. data/app/assets/javascripts/marty/application.js +1 -0
  6. data/app/assets/javascripts/marty/codemirror/codemirror.js +9730 -0
  7. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/delorean/delorean.js +0 -0
  8. data/app/assets/javascripts/marty/codemirror/mode/javascript/javascript.js +900 -0
  9. data/app/assets/javascripts/marty/codemirror/mode/python/python.js +399 -0
  10. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/ruby/ruby.js +135 -34
  11. data/app/{components/marty/script_form/client/Ext.ux.form.field.CodeMirror.js → assets/javascripts/marty/extjs/extensions/marty.js} +87 -6
  12. data/app/assets/stylesheets/marty/application.css +1 -13
  13. data/app/assets/stylesheets/marty/codemirror/codemirror.css +346 -0
  14. data/app/{components/marty/script_form/client → assets/stylesheets/marty/codemirror}/delorean.css +0 -0
  15. data/app/components/marty/auth_app/client/auth_app.js +82 -80
  16. data/app/components/marty/data_grid_view.rb +1 -54
  17. data/app/components/marty/data_grid_view/client/data_grid_view.js +49 -0
  18. data/app/components/marty/form.rb +1 -5
  19. data/app/components/marty/form/client/form.js +5 -0
  20. data/app/components/marty/grid.rb +1 -146
  21. data/app/components/marty/grid/client/grid.js +146 -0
  22. data/app/components/marty/import_view.rb +1 -32
  23. data/app/components/marty/import_view/client/import_view.js +32 -0
  24. data/app/components/marty/live_search_grid_panel.rb +1 -21
  25. data/app/components/marty/live_search_grid_panel/client/live_search_grid_panel.js +27 -0
  26. data/app/components/marty/main_auth_app.rb +4 -145
  27. data/app/components/marty/main_auth_app/client/main_auth_app.js +124 -0
  28. data/app/components/marty/mcfly_grid_panel.rb +1 -17
  29. data/app/components/marty/mcfly_grid_panel/client/mcfly_grid_panel.js +37 -0
  30. data/app/components/marty/new_posting_form.rb +1 -6
  31. data/app/components/marty/new_posting_form/client/new_posting_form.js +6 -0
  32. data/app/components/marty/panel.rb +1 -5
  33. data/app/components/marty/panel/client/panel.js +5 -0
  34. data/app/components/marty/posting_grid.rb +4 -55
  35. data/app/components/marty/posting_grid/client/posting_grid.js +50 -0
  36. data/app/components/marty/promise_view.rb +2 -75
  37. data/app/components/marty/promise_view/client/promise_view.css +12 -9
  38. data/app/components/marty/promise_view/client/promise_view.js +57 -0
  39. data/app/components/marty/report_form.rb +3 -69
  40. data/app/components/marty/report_form/client/report_form.js +78 -0
  41. data/app/components/marty/report_select.rb +1 -45
  42. data/app/components/marty/report_select/client/report_select.js +50 -0
  43. data/app/components/marty/reporting.rb +1 -8
  44. data/app/components/marty/reporting/client/reporting.js +8 -0
  45. data/app/components/marty/script_form.rb +2 -63
  46. data/app/components/marty/script_form/client/script_form.js +44 -0
  47. data/app/components/marty/script_tester.rb +1 -7
  48. data/app/components/marty/script_tester/client/script_tester.js +7 -0
  49. data/app/components/marty/scripting.rb +1 -55
  50. data/app/components/marty/scripting/client/scripting.js +62 -0
  51. data/app/components/marty/simple_app/client/simple_app.js +21 -13
  52. data/app/models/marty/promise.rb +22 -1
  53. data/app/views/layouts/marty/application.html.erb +8 -6
  54. data/docker-compose.dummy.yml +2 -0
  55. data/lib/marty/monkey.rb +0 -16
  56. data/lib/marty/version.rb +1 -1
  57. data/spec/dummy/config/initializers/assets.rb +1 -0
  58. data/spec/features/reporting_spec.rb +1 -0
  59. data/spec/features/scripting_spec.rb +4 -4
  60. data/spec/spec_helper.rb +1 -0
  61. data/spec/support/chromedriver.rb +5 -1
  62. data/spec/support/shared_connection_db_helpers.rb +42 -2
  63. metadata +29 -168
  64. data/app/assets/images/marty/.gitkeep +0 -0
  65. data/app/components/marty/mcfly_grid_panel/client/dup_in_form.js +0 -20
  66. data/app/components/marty/script_form/client/codemirror.css +0 -172
  67. data/app/components/marty/script_form/client/codemirror.js +0 -3130
  68. data/app/components/marty/script_form/client/mode/clike/clike.js +0 -284
  69. data/app/components/marty/script_form/client/mode/clike/index.html +0 -102
  70. data/app/components/marty/script_form/client/mode/clike/scala.html +0 -766
  71. data/app/components/marty/script_form/client/mode/clojure/clojure.js +0 -206
  72. data/app/components/marty/script_form/client/mode/clojure/index.html +0 -67
  73. data/app/components/marty/script_form/client/mode/coffeescript/LICENSE +0 -22
  74. data/app/components/marty/script_form/client/mode/coffeescript/coffeescript.js +0 -346
  75. data/app/components/marty/script_form/client/mode/coffeescript/index.html +0 -728
  76. data/app/components/marty/script_form/client/mode/commonlisp/commonlisp.js +0 -101
  77. data/app/components/marty/script_form/client/mode/commonlisp/index.html +0 -165
  78. data/app/components/marty/script_form/client/mode/css/css.js +0 -448
  79. data/app/components/marty/script_form/client/mode/css/index.html +0 -58
  80. data/app/components/marty/script_form/client/mode/css/test.js +0 -501
  81. data/app/components/marty/script_form/client/mode/diff/diff.js +0 -32
  82. data/app/components/marty/script_form/client/mode/diff/index.html +0 -105
  83. data/app/components/marty/script_form/client/mode/ecl/ecl.js +0 -203
  84. data/app/components/marty/script_form/client/mode/ecl/index.html +0 -42
  85. data/app/components/marty/script_form/client/mode/erlang/erlang.js +0 -463
  86. data/app/components/marty/script_form/client/mode/erlang/index.html +0 -63
  87. data/app/components/marty/script_form/client/mode/gfm/gfm.js +0 -150
  88. data/app/components/marty/script_form/client/mode/gfm/index.html +0 -48
  89. data/app/components/marty/script_form/client/mode/go/go.js +0 -170
  90. data/app/components/marty/script_form/client/mode/go/index.html +0 -73
  91. data/app/components/marty/script_form/client/mode/groovy/groovy.js +0 -210
  92. data/app/components/marty/script_form/client/mode/groovy/index.html +0 -72
  93. data/app/components/marty/script_form/client/mode/haskell/haskell.js +0 -242
  94. data/app/components/marty/script_form/client/mode/haskell/index.html +0 -61
  95. data/app/components/marty/script_form/client/mode/haxe/haxe.js +0 -429
  96. data/app/components/marty/script_form/client/mode/haxe/index.html +0 -91
  97. data/app/components/marty/script_form/client/mode/htmlembedded/htmlembedded.js +0 -72
  98. data/app/components/marty/script_form/client/mode/htmlembedded/index.html +0 -50
  99. data/app/components/marty/script_form/client/mode/htmlmixed/htmlmixed.js +0 -84
  100. data/app/components/marty/script_form/client/mode/htmlmixed/index.html +0 -52
  101. data/app/components/marty/script_form/client/mode/javascript/index.html +0 -78
  102. data/app/components/marty/script_form/client/mode/javascript/javascript.js +0 -361
  103. data/app/components/marty/script_form/client/mode/jinja2/index.html +0 -38
  104. data/app/components/marty/script_form/client/mode/jinja2/jinja2.js +0 -42
  105. data/app/components/marty/script_form/client/mode/less/index.html +0 -740
  106. data/app/components/marty/script_form/client/mode/less/less.js +0 -266
  107. data/app/components/marty/script_form/client/mode/lua/index.html +0 -73
  108. data/app/components/marty/script_form/client/mode/lua/lua.js +0 -140
  109. data/app/components/marty/script_form/client/mode/markdown/index.html +0 -343
  110. data/app/components/marty/script_form/client/mode/markdown/markdown.js +0 -382
  111. data/app/components/marty/script_form/client/mode/markdown/test.js +0 -1084
  112. data/app/components/marty/script_form/client/mode/mysql/index.html +0 -42
  113. data/app/components/marty/script_form/client/mode/mysql/mysql.js +0 -186
  114. data/app/components/marty/script_form/client/mode/ntriples/index.html +0 -33
  115. data/app/components/marty/script_form/client/mode/ntriples/ntriples.js +0 -172
  116. data/app/components/marty/script_form/client/mode/ocaml/index.html +0 -130
  117. data/app/components/marty/script_form/client/mode/ocaml/ocaml.js +0 -114
  118. data/app/components/marty/script_form/client/mode/pascal/LICENSE +0 -7
  119. data/app/components/marty/script_form/client/mode/pascal/index.html +0 -49
  120. data/app/components/marty/script_form/client/mode/pascal/pascal.js +0 -94
  121. data/app/components/marty/script_form/client/mode/perl/LICENSE +0 -19
  122. data/app/components/marty/script_form/client/mode/perl/index.html +0 -63
  123. data/app/components/marty/script_form/client/mode/perl/perl.js +0 -816
  124. data/app/components/marty/script_form/client/mode/php/index.html +0 -49
  125. data/app/components/marty/script_form/client/mode/php/php.js +0 -148
  126. data/app/components/marty/script_form/client/mode/pig/index.html +0 -43
  127. data/app/components/marty/script_form/client/mode/pig/pig.js +0 -172
  128. data/app/components/marty/script_form/client/mode/plsql/index.html +0 -63
  129. data/app/components/marty/script_form/client/mode/plsql/plsql.js +0 -217
  130. data/app/components/marty/script_form/client/mode/properties/index.html +0 -41
  131. data/app/components/marty/script_form/client/mode/properties/properties.js +0 -63
  132. data/app/components/marty/script_form/client/mode/python/LICENSE.txt +0 -21
  133. data/app/components/marty/script_form/client/mode/python/index.html +0 -123
  134. data/app/components/marty/script_form/client/mode/python/python.js +0 -338
  135. data/app/components/marty/script_form/client/mode/r/LICENSE +0 -24
  136. data/app/components/marty/script_form/client/mode/r/index.html +0 -74
  137. data/app/components/marty/script_form/client/mode/r/r.js +0 -141
  138. data/app/components/marty/script_form/client/mode/rpm/changes/changes.js +0 -19
  139. data/app/components/marty/script_form/client/mode/rpm/changes/index.html +0 -54
  140. data/app/components/marty/script_form/client/mode/rpm/spec/index.html +0 -100
  141. data/app/components/marty/script_form/client/mode/rpm/spec/spec.css +0 -5
  142. data/app/components/marty/script_form/client/mode/rpm/spec/spec.js +0 -66
  143. data/app/components/marty/script_form/client/mode/rst/index.html +0 -526
  144. data/app/components/marty/script_form/client/mode/rst/rst.js +0 -326
  145. data/app/components/marty/script_form/client/mode/ruby/LICENSE +0 -24
  146. data/app/components/marty/script_form/client/mode/ruby/index.html +0 -172
  147. data/app/components/marty/script_form/client/mode/rust/index.html +0 -49
  148. data/app/components/marty/script_form/client/mode/rust/rust.js +0 -432
  149. data/app/components/marty/script_form/client/mode/scheme/index.html +0 -65
  150. data/app/components/marty/script_form/client/mode/scheme/scheme.js +0 -230
  151. data/app/components/marty/script_form/client/mode/shell/index.html +0 -50
  152. data/app/components/marty/script_form/client/mode/shell/shell.js +0 -118
  153. data/app/components/marty/script_form/client/mode/sieve/LICENSE +0 -23
  154. data/app/components/marty/script_form/client/mode/sieve/index.html +0 -81
  155. data/app/components/marty/script_form/client/mode/sieve/sieve.js +0 -156
  156. data/app/components/marty/script_form/client/mode/smalltalk/index.html +0 -56
  157. data/app/components/marty/script_form/client/mode/smalltalk/smalltalk.js +0 -139
  158. data/app/components/marty/script_form/client/mode/smarty/index.html +0 -83
  159. data/app/components/marty/script_form/client/mode/smarty/smarty.js +0 -148
  160. data/app/components/marty/script_form/client/mode/sparql/index.html +0 -41
  161. data/app/components/marty/script_form/client/mode/sparql/sparql.js +0 -143
  162. data/app/components/marty/script_form/client/mode/stex/index.html +0 -98
  163. data/app/components/marty/script_form/client/mode/stex/stex.js +0 -182
  164. data/app/components/marty/script_form/client/mode/stex/test.js +0 -343
  165. data/app/components/marty/script_form/client/mode/tiddlywiki/index.html +0 -141
  166. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.css +0 -14
  167. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.js +0 -384
  168. data/app/components/marty/script_form/client/mode/tiki/index.html +0 -83
  169. data/app/components/marty/script_form/client/mode/tiki/tiki.css +0 -26
  170. data/app/components/marty/script_form/client/mode/tiki/tiki.js +0 -309
  171. data/app/components/marty/script_form/client/mode/vb/LICENSE.txt +0 -21
  172. data/app/components/marty/script_form/client/mode/vb/index.html +0 -89
  173. data/app/components/marty/script_form/client/mode/vb/vb.js +0 -260
  174. data/app/components/marty/script_form/client/mode/vbscript/index.html +0 -43
  175. data/app/components/marty/script_form/client/mode/vbscript/vbscript.js +0 -26
  176. data/app/components/marty/script_form/client/mode/velocity/index.html +0 -104
  177. data/app/components/marty/script_form/client/mode/velocity/velocity.js +0 -146
  178. data/app/components/marty/script_form/client/mode/verilog/index.html +0 -211
  179. data/app/components/marty/script_form/client/mode/verilog/verilog.js +0 -194
  180. data/app/components/marty/script_form/client/mode/xml/index.html +0 -45
  181. data/app/components/marty/script_form/client/mode/xml/xml.js +0 -318
  182. data/app/components/marty/script_form/client/mode/xquery/LICENSE +0 -20
  183. data/app/components/marty/script_form/client/mode/xquery/index.html +0 -223
  184. data/app/components/marty/script_form/client/mode/xquery/test/index.html +0 -27
  185. data/app/components/marty/script_form/client/mode/xquery/test/testBase.js +0 -42
  186. data/app/components/marty/script_form/client/mode/xquery/test/testEmptySequenceKeyword.js +0 -16
  187. data/app/components/marty/script_form/client/mode/xquery/test/testMultiAttr.js +0 -16
  188. data/app/components/marty/script_form/client/mode/xquery/test/testNamespaces.js +0 -91
  189. data/app/components/marty/script_form/client/mode/xquery/test/testProcessingInstructions.js +0 -16
  190. data/app/components/marty/script_form/client/mode/xquery/test/testQuotes.js +0 -19
  191. data/app/components/marty/script_form/client/mode/xquery/xquery.js +0 -451
  192. data/app/components/marty/script_form/client/mode/yaml/index.html +0 -68
  193. data/app/components/marty/script_form/client/mode/yaml/yaml.js +0 -95
  194. data/app/components/marty/script_form/client/theme/ambiance.css +0 -81
  195. data/app/components/marty/script_form/client/theme/blackboard.css +0 -25
  196. data/app/components/marty/script_form/client/theme/cobalt.css +0 -18
  197. data/app/components/marty/script_form/client/theme/eclipse.css +0 -25
  198. data/app/components/marty/script_form/client/theme/elegant.css +0 -10
  199. data/app/components/marty/script_form/client/theme/erlang-dark.css +0 -21
  200. data/app/components/marty/script_form/client/theme/lesser-dark.css +0 -44
  201. data/app/components/marty/script_form/client/theme/monokai.css +0 -28
  202. data/app/components/marty/script_form/client/theme/neat.css +0 -9
  203. data/app/components/marty/script_form/client/theme/night.css +0 -21
  204. data/app/components/marty/script_form/client/theme/rubyblue.css +0 -21
  205. data/app/components/marty/script_form/client/theme/vibrant-ink.css +0 -27
  206. data/app/components/marty/script_form/client/theme/xq-dark.css +0 -46
  207. data/app/components/marty/script_form/client/util/closetag.js +0 -164
  208. data/app/components/marty/script_form/client/util/dialog.css +0 -27
  209. data/app/components/marty/script_form/client/util/dialog.js +0 -70
  210. data/app/components/marty/script_form/client/util/foldcode.js +0 -196
  211. data/app/components/marty/script_form/client/util/formatting.js +0 -193
  212. data/app/components/marty/script_form/client/util/javascript-hint.js +0 -134
  213. data/app/components/marty/script_form/client/util/loadmode.js +0 -51
  214. data/app/components/marty/script_form/client/util/match-highlighter.js +0 -44
  215. data/app/components/marty/script_form/client/util/multiplex.js +0 -77
  216. data/app/components/marty/script_form/client/util/overlay.js +0 -54
  217. data/app/components/marty/script_form/client/util/pig-hint.js +0 -123
  218. data/app/components/marty/script_form/client/util/runmode-standalone.js +0 -90
  219. data/app/components/marty/script_form/client/util/runmode.js +0 -53
  220. data/app/components/marty/script_form/client/util/search.js +0 -118
  221. data/app/components/marty/script_form/client/util/searchcursor.js +0 -119
  222. data/app/components/marty/script_form/client/util/simple-hint.css +0 -16
  223. data/app/components/marty/script_form/client/util/simple-hint.js +0 -97
  224. data/app/components/marty/script_form/client/util/xml-hint.js +0 -137
  225. data/lib/marty/javascript/grid_view_in_form.js +0 -81
@@ -0,0 +1,78 @@
1
+ {
2
+ netzkeOnForeground: function () {
3
+ var values = this.getForm().getValues();
4
+ var data = Ext.encode(values);
5
+
6
+ var params = {
7
+ data: data,
8
+ reptitle: this.reptitle
9
+ };
10
+
11
+ // very hacky -- when selected_testing is set, we assume we're
12
+ // testing and try to inline the result.
13
+ if (values["selected_testing"]) {
14
+ this.repformat = "txt";
15
+ params["disposition"] = "inline";
16
+ }
17
+
18
+ var form = document.createElement("form");
19
+
20
+ form.setAttribute("method", "post");
21
+ form.setAttribute("action", this.mountPath() + "/report." + this.repformat);
22
+
23
+ // set authenticity token
24
+ var hiddenField = document.createElement("input");
25
+ hiddenField.setAttribute("type", "hidden");
26
+ hiddenField.setAttribute("name", "authenticity_token");
27
+ hiddenField.setAttribute("value", this.authenticityToken);
28
+ form.appendChild(hiddenField);
29
+
30
+ for (var key in params) {
31
+ if (params.hasOwnProperty(key)) {
32
+ var hiddenField = document.createElement("input");
33
+ hiddenField.setAttribute("type", "hidden");
34
+ hiddenField.setAttribute("name", key);
35
+ hiddenField.setAttribute("value", params[key]);
36
+
37
+ form.appendChild(hiddenField);
38
+ }
39
+ }
40
+
41
+ document.body.appendChild(form);
42
+ form.submit();
43
+ document.body.removeChild(form);
44
+ },
45
+
46
+ netzkeOnLink: function () {
47
+ var values = this.getForm().getValues();
48
+
49
+ // check for early url generation and exit with error message
50
+ if (values['selected_script_name'] == null) {
51
+ alert("Please select a report before generating url.");
52
+ return;
53
+ }
54
+
55
+ params = {
56
+ "format": this.repformat,
57
+ "reptitle": this.reptitle
58
+ }
59
+
60
+ for (var key in values) {
61
+ if (values[key] == "") {
62
+ delete values[key]
63
+ }
64
+ }
65
+ data = Ext.encode(values)
66
+
67
+ // construct url
68
+ var proto_host = location.protocol + '//' + location.host
69
+ var url = proto_host + '/report?data=' + data
70
+ for (var key in params) {
71
+ if (params[key] == "") continue;
72
+ url += '&' + key + '=' + params[key];
73
+ }
74
+ url = encodeURI(url)
75
+ var win = window.open('');
76
+ win.document.write(url.link(url));
77
+ }
78
+ }
@@ -47,51 +47,7 @@ class Marty::ReportSelect < Marty::Form
47
47
 
48
48
  client_class do |c|
49
49
  c.header = false
50
-
51
- c.init_component = l(<<-JS)
52
- function() {
53
- var me = this;
54
- me.callParent();
55
-
56
- var tag_grid = me.netzkeGetComponent('tag_grid').getView();
57
- var script_grid = me.netzkeGetComponent('script_grid').getView();
58
- var nodename = me.getForm().findField('nodename');
59
-
60
- nodename.on('select', function(self, record) {
61
- if(record instanceof Array) {
62
- record = record[0]
63
- }
64
- var data = record && record.data;
65
- me.server.selectNode({node: data.value});
66
- });
67
-
68
- tag_grid.getSelectionModel().on('selectionchange',
69
- function(self, records) {
70
- var tag_id = records[0].get('id');
71
- me.server.selectTag({tag_id: tag_id});
72
- script_grid.getStore().load();
73
- }, me);
74
-
75
- script_grid.getSelectionModel().on('selectionchange',
76
- function(self, records) {
77
- if(script_grid.getStore().isLoading() == true) return;
78
-
79
- if(records[0] == null)
80
- return;
81
-
82
- var script_name = records[0].get('name');
83
- me.server.selectScript({script_name: script_name});
84
- nodename.reset();
85
- nodename.store.load({params: {}});
86
- }, me);
87
- }
88
- JS
89
-
90
- c.parent_select_report = l(<<-JS)
91
- function() {
92
- this.netzkeGetParentComponent().selectReport();
93
- }
94
- JS
50
+ c.include :report_select
95
51
  end
96
52
 
97
53
  # FIXME: should be in a library
@@ -0,0 +1,50 @@
1
+ {
2
+ initComponent: function () {
3
+ var me = this;
4
+ me.callParent();
5
+
6
+ var tag_grid = me.netzkeGetComponent('tag_grid').getView();
7
+ var script_grid = me.netzkeGetComponent('script_grid').getView();
8
+ var nodename = me.getForm().findField('nodename');
9
+
10
+ nodename.on('select', function (self, record) {
11
+ if (record instanceof Array) {
12
+ record = record[0]
13
+ }
14
+ var data = record && record.data;
15
+ me.server.selectNode({
16
+ node: data.value
17
+ });
18
+ });
19
+
20
+ tag_grid.getSelectionModel().on('selectionchange',
21
+ function (self, records) {
22
+ var tag_id = records[0].get('id');
23
+ me.server.selectTag({
24
+ tag_id: tag_id
25
+ });
26
+ script_grid.getStore().load();
27
+ }, me);
28
+
29
+ script_grid.getSelectionModel().on('selectionchange',
30
+ function (self, records) {
31
+ if (script_grid.getStore().isLoading() == true) return;
32
+
33
+ if (records[0] == null)
34
+ return;
35
+
36
+ var script_name = records[0].get('name');
37
+ me.server.selectScript({
38
+ script_name: script_name
39
+ });
40
+ nodename.reset();
41
+ nodename.store.load({
42
+ params: {}
43
+ });
44
+ }, me);
45
+ },
46
+
47
+ parentSelectReport: function () {
48
+ this.netzkeGetParentComponent().selectReport();
49
+ }
50
+ }
@@ -12,14 +12,7 @@ class Marty::Reporting < Netzke::Base
12
12
  c.layout = :border
13
13
  c.defaults = {body_style: 'padding:0px'}
14
14
 
15
- c.select_report = l(<<-JS)
16
- function() {
17
- // this.netzkeGetComponent('report_form').netzkeLoad({});
18
- // FIXME: NetzkeReload() doesn't work when performed on
19
- // ReportForm. So, reload all of Reporting.
20
- this.netzkeReload();
21
- }
22
- JS
15
+ c.include :reporting
23
16
  end
24
17
 
25
18
  component :report_form do |c|
@@ -0,0 +1,8 @@
1
+ {
2
+ selectReport: function () {
3
+ // this.netzkeGetComponent('report_form').netzkeLoad({});
4
+ // FIXME: NetzkeReload() doesn't work when performed on
5
+ // ReportForm. So, reload all of Reporting.
6
+ this.netzkeReload();
7
+ }
8
+ }
@@ -1,69 +1,8 @@
1
1
  class Marty::ScriptForm < Marty::Form
2
2
  DASH = 0x2012.chr('utf-8')
3
3
 
4
- client_styles do |c|
5
- c.require :codemirror
6
- c.require :delorean
7
- end
8
-
9
4
  client_class do |c|
10
- c.require :"Ext.ux.form.field.CodeMirror"
11
- c.require :codemirror
12
- c.require File.dirname(__FILE__) +
13
- "/script_form/client/mode/delorean/delorean.js"
14
-
15
- c.set_action_modes = l(<<-JS)
16
- function(a) {
17
- this.actions.apply.setDisabled(!a["save"]);
18
- // style input field text based on whether it is editable
19
- this.getForm().findField('body').editor.setOption(
20
- "readOnly", !a["save"]);
21
- }
22
- JS
23
-
24
- c.get_script_id = l(<<-JS)
25
- function() {
26
- return this.getForm().findField('id').getValue();
27
- }
28
- JS
29
-
30
- # Sets an editor line class (unset any previous line class). For
31
- # now, only one line is classed at a time.
32
- c.set_line_error = l(<<-JS)
33
- function(line) {
34
- line -= 1;
35
- var editor = this.getForm().findField('body').editor;
36
- if (editor.oldline) {
37
- editor.oldline.className = null;
38
- }
39
- if (line > -1) {
40
- editor.oldline = editor.setLineClass(line, "errorline");
41
- }
42
- editor.refresh();
43
- }
44
- JS
45
-
46
- ######################################################################
47
-
48
- c.refresh_parent = l(<<-JS)
49
- function(script_name) {
50
- this.netzkeGetParentComponent().scriptRefresh(script_name);
51
- }
52
- JS
53
-
54
- ######################################################################
55
-
56
- c.netzke_on_do_print = l(<<-JS)
57
- function(params) {
58
- this.server.doPrint(this.getScriptId());
59
- }
60
- JS
61
-
62
- c.get_report = l(<<-JS)
63
- function(report_path) {
64
- window.location = report_path;
65
- }
66
- JS
5
+ c.include :script_form
67
6
  end
68
7
 
69
8
  ######################################################################
@@ -215,13 +154,13 @@ class Marty::ScriptForm < Marty::Form
215
154
  c.items =
216
155
  [
217
156
  {
218
- mode: "text/x-delorean",
219
157
  line_numbers: true,
220
158
  indent_unit: 4,
221
159
  tab_mode: "shift",
222
160
  match_brackets: true,
223
161
  hide_label: true,
224
162
  xtype: :codemirror,
163
+ mode: "text/x-delorean",
225
164
  name: :body,
226
165
  empty_text: "No script selected.",
227
166
  getter: lambda { |r| r.body },
@@ -0,0 +1,44 @@
1
+ {
2
+ setActionModes: function (a) {
3
+ this.actions.apply.setDisabled(!a["save"]);
4
+ // style input field text based on whether it is editable
5
+ this.getForm().findField('body').editor.setOption(
6
+ "readOnly", !a["save"]);
7
+ },
8
+
9
+ getScriptId: function () {
10
+ return this.getForm().findField('id').getValue();
11
+ },
12
+
13
+ setLineError: function (idx) {
14
+
15
+ idx -= 1;
16
+ var editor = this.getForm().findField('body').editor;
17
+
18
+ if (idx > -1) {
19
+ var line = editor.getLine(idx)
20
+ editor.markText({
21
+ line: idx,
22
+ ch: 0
23
+ }, {
24
+ line: idx,
25
+ ch: line.length
26
+ }, {
27
+ className: "errorline"
28
+ });
29
+ }
30
+ editor.refresh();
31
+ },
32
+
33
+ refreshParent: function (script_name) {
34
+ this.netzkeGetParentComponent().scriptRefresh(script_name);
35
+ },
36
+
37
+ netzkeOnDoPrint: function (params) {
38
+ this.server.doPrint(this.getScriptId());
39
+ },
40
+
41
+ getReport: function (report_path) {
42
+ window.location = report_path;
43
+ }
44
+ }
@@ -31,13 +31,7 @@ class Marty::ScriptTester < Marty::Form
31
31
  end
32
32
 
33
33
  client_class do |c|
34
- c.set_result = l(<<-JS)
35
- function(html) {
36
- var result = this.netzkeGetComponent('result');
37
- result.updateBodyHtml(html);
38
- }
39
- JS
40
-
34
+ c.include :script_tester
41
35
  end
42
36
 
43
37
  def new_engine
@@ -0,0 +1,7 @@
1
+ {
2
+ setResult: function (val) {
3
+ var result = this.netzkeGetComponent('result');
4
+ result.updateBodyHtml(val);
5
+ }
6
+
7
+ }
@@ -30,63 +30,9 @@ class Marty::Scripting < Netzke::Base
30
30
  end
31
31
 
32
32
  client_class do |c|
33
-
34
33
  c.header = false
35
34
  c.layout = :border
36
-
37
- c.init_component = l(<<-JS)
38
- function() {
39
- var me = this;
40
- me.callParent();
41
-
42
- var tag_grid = me.netzkeGetComponent('tag_grid').getView();
43
- var script_grid = me.netzkeGetComponent('script_grid').getView();
44
- var script_form = me.netzkeGetComponent('script_form');
45
-
46
- tag_grid.getSelectionModel().on('selectionchange',
47
- function(self, records) {
48
-
49
- if(records[0] == null)
50
- return;
51
-
52
- var tag_id = records[0].get('id');
53
- me.server.selectTag({tag_id: tag_id});
54
- script_grid.getStore().load();
55
- var script_name = null;
56
- script_form.server.netzkeLoad({script_name: script_name});
57
- }, me);
58
-
59
- script_grid.getSelectionModel().on('selectionchange',
60
- function(self, records) {
61
-
62
- if(script_grid.getStore().isLoading() == true)
63
- return;
64
-
65
- if(records[0] == null)
66
- return;
67
-
68
- var script_name = records[0].get('name');
69
- me.server.selectScript({script_name: script_name});
70
- script_form.server.netzkeLoad({script_name: script_name});
71
- }, me);
72
- }
73
- JS
74
-
75
- c.script_refresh = l(<<-JS)
76
- function(script_name) {
77
- if (!script_name) {
78
- this.server.selectScript({});
79
- this.netzkeReload();
80
- }
81
- else {
82
- this.server.selectScript({script_name: script_name});
83
- this.netzkeGetComponent('tag_grid').getStore().load();
84
- this.netzkeGetComponent('script_grid').getStore().load();
85
- this.netzkeGetComponent('script_form').server.netzkeLoad(
86
- {script_name: script_name});
87
- }
88
- }
89
- JS
35
+ c.include :scripting
90
36
  end
91
37
 
92
38
  endpoint :select_tag do |params|
@@ -0,0 +1,62 @@
1
+ {
2
+ initComponent: function () {
3
+ var me = this;
4
+ me.callParent();
5
+
6
+ var tag_grid = me.netzkeGetComponent('tag_grid').getView();
7
+ var script_grid = me.netzkeGetComponent('script_grid').getView();
8
+ var script_form = me.netzkeGetComponent('script_form');
9
+
10
+ tag_grid.getSelectionModel().on('selectionchange',
11
+ function (self, records) {
12
+
13
+ if (records[0] == null)
14
+ return;
15
+
16
+ var tag_id = records[0].get('id');
17
+ me.server.selectTag({
18
+ tag_id: tag_id
19
+ });
20
+ script_grid.getStore().load();
21
+ var script_name = null;
22
+ script_form.server.netzkeLoad({
23
+ script_name: script_name
24
+ });
25
+ }, me);
26
+
27
+ script_grid.getSelectionModel().on('selectionchange',
28
+ function (self, records) {
29
+
30
+ if (script_grid.getStore().isLoading() == true)
31
+ return;
32
+
33
+ if (records[0] == null)
34
+ return;
35
+
36
+ var script_name = records[0].get('name');
37
+ me.server.selectScript({
38
+ script_name: script_name
39
+ });
40
+ script_form.server.netzkeLoad({
41
+ script_name: script_name
42
+ });
43
+ }, me);
44
+ },
45
+
46
+ scriptRefresh: function (script_name) {
47
+ if (!script_name) {
48
+ this.server.selectScript({});
49
+ this.netzkeReload();
50
+ } else {
51
+ this.server.selectScript({
52
+ script_name: script_name
53
+ });
54
+ this.netzkeGetComponent('tag_grid').getStore().load();
55
+ this.netzkeGetComponent('script_grid').getStore().load();
56
+ this.netzkeGetComponent('script_form').server.netzkeLoad({
57
+ script_name: script_name
58
+ });
59
+ }
60
+ },
61
+
62
+ }