rjack-solr 3.6.2.0-java → 4.0.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (315) hide show
  1. data/History.rdoc +5 -0
  2. data/Manifest.txt +268 -33
  3. data/NOTICE.txt +1 -1
  4. data/README.rdoc +6 -6
  5. data/assembly.xml +2 -2
  6. data/bin/rjack-solr-fg +1 -1
  7. data/init/rjack-solr +2 -2
  8. data/lib/rjack-solr.rb +7 -2
  9. data/lib/rjack-solr/base.rb +2 -2
  10. data/lib/rjack-solr/commons-cli-1.2.jar +0 -0
  11. data/lib/rjack-solr/config.rb +1 -1
  12. data/lib/rjack-solr/server.rb +1 -1
  13. data/lib/rjack-solr/solr-core-4.0.0.jar +0 -0
  14. data/lib/rjack-solr/solr-solrj-4.0.0.jar +0 -0
  15. data/pom.xml +19 -6
  16. data/test/test_solr.rb +7 -5
  17. data/webapp/META-INF/LICENSE.txt +0 -940
  18. data/webapp/META-INF/MANIFEST.MF +5 -5
  19. data/webapp/META-INF/NOTICE.txt +160 -93
  20. data/webapp/WEB-INF/web.xml +57 -43
  21. data/webapp/admin.html +140 -0
  22. data/webapp/css/chosen.css +392 -0
  23. data/webapp/css/styles/analysis.css +293 -0
  24. data/webapp/css/styles/cloud.css +331 -0
  25. data/webapp/css/styles/common.css +593 -0
  26. data/webapp/css/styles/cores.css +203 -0
  27. data/webapp/css/styles/dashboard.css +127 -0
  28. data/webapp/css/styles/dataimport.css +222 -0
  29. data/webapp/css/styles/index.css +195 -0
  30. data/webapp/css/styles/java-properties.css +33 -0
  31. data/webapp/css/styles/logging.css +323 -0
  32. data/webapp/css/styles/menu.css +272 -0
  33. data/webapp/css/styles/plugins.css +175 -0
  34. data/webapp/css/styles/query.css +137 -0
  35. data/webapp/css/styles/replication.css +494 -0
  36. data/webapp/css/styles/schema-browser.css +476 -0
  37. data/webapp/css/styles/threads.css +153 -0
  38. data/webapp/img/ZeroClipboard.swf +0 -0
  39. data/webapp/img/chosen-sprite.png +0 -0
  40. data/webapp/img/div.gif +0 -0
  41. data/webapp/{admin → img}/favicon.ico +0 -0
  42. data/webapp/img/filetypes/7z.png +0 -0
  43. data/webapp/img/filetypes/README +27 -0
  44. data/webapp/img/filetypes/ai.png +0 -0
  45. data/webapp/img/filetypes/aiff.png +0 -0
  46. data/webapp/img/filetypes/asc.png +0 -0
  47. data/webapp/img/filetypes/audio.png +0 -0
  48. data/webapp/img/filetypes/bin.png +0 -0
  49. data/webapp/img/filetypes/bz2.png +0 -0
  50. data/webapp/img/filetypes/c.png +0 -0
  51. data/webapp/img/filetypes/cfc.png +0 -0
  52. data/webapp/img/filetypes/cfm.png +0 -0
  53. data/webapp/img/filetypes/chm.png +0 -0
  54. data/webapp/img/filetypes/class.png +0 -0
  55. data/webapp/img/filetypes/conf.png +0 -0
  56. data/webapp/img/filetypes/cpp.png +0 -0
  57. data/webapp/img/filetypes/cs.png +0 -0
  58. data/webapp/img/filetypes/css.png +0 -0
  59. data/webapp/img/filetypes/csv.png +0 -0
  60. data/webapp/img/filetypes/deb.png +0 -0
  61. data/webapp/img/filetypes/divx.png +0 -0
  62. data/webapp/img/filetypes/doc.png +0 -0
  63. data/webapp/img/filetypes/dot.png +0 -0
  64. data/webapp/img/filetypes/eml.png +0 -0
  65. data/webapp/img/filetypes/enc.png +0 -0
  66. data/webapp/img/filetypes/file.png +0 -0
  67. data/webapp/img/filetypes/gif.png +0 -0
  68. data/webapp/img/filetypes/gz.png +0 -0
  69. data/webapp/img/filetypes/hlp.png +0 -0
  70. data/webapp/img/filetypes/htm.png +0 -0
  71. data/webapp/img/filetypes/html.png +0 -0
  72. data/webapp/img/filetypes/image.png +0 -0
  73. data/webapp/img/filetypes/iso.png +0 -0
  74. data/webapp/img/filetypes/jar.png +0 -0
  75. data/webapp/img/filetypes/java.png +0 -0
  76. data/webapp/img/filetypes/jpeg.png +0 -0
  77. data/webapp/img/filetypes/jpg.png +0 -0
  78. data/webapp/img/filetypes/js.png +0 -0
  79. data/webapp/img/filetypes/lua.png +0 -0
  80. data/webapp/img/filetypes/m.png +0 -0
  81. data/webapp/img/filetypes/mm.png +0 -0
  82. data/webapp/img/filetypes/mov.png +0 -0
  83. data/webapp/img/filetypes/mp3.png +0 -0
  84. data/webapp/img/filetypes/mpg.png +0 -0
  85. data/webapp/img/filetypes/odc.png +0 -0
  86. data/webapp/img/filetypes/odf.png +0 -0
  87. data/webapp/img/filetypes/odg.png +0 -0
  88. data/webapp/img/filetypes/odi.png +0 -0
  89. data/webapp/img/filetypes/odp.png +0 -0
  90. data/webapp/img/filetypes/ods.png +0 -0
  91. data/webapp/img/filetypes/odt.png +0 -0
  92. data/webapp/img/filetypes/ogg.png +0 -0
  93. data/webapp/img/filetypes/pdf.png +0 -0
  94. data/webapp/img/filetypes/pgp.png +0 -0
  95. data/webapp/img/filetypes/php.png +0 -0
  96. data/webapp/img/filetypes/pl.png +0 -0
  97. data/webapp/img/filetypes/png.png +0 -0
  98. data/webapp/img/filetypes/ppt.png +0 -0
  99. data/webapp/img/filetypes/ps.png +0 -0
  100. data/webapp/img/filetypes/py.png +0 -0
  101. data/webapp/img/filetypes/ram.png +0 -0
  102. data/webapp/img/filetypes/rar.png +0 -0
  103. data/webapp/img/filetypes/rb.png +0 -0
  104. data/webapp/img/filetypes/rm.png +0 -0
  105. data/webapp/img/filetypes/rpm.png +0 -0
  106. data/webapp/img/filetypes/rtf.png +0 -0
  107. data/webapp/img/filetypes/sig.png +0 -0
  108. data/webapp/img/filetypes/sql.png +0 -0
  109. data/webapp/img/filetypes/swf.png +0 -0
  110. data/webapp/img/filetypes/sxc.png +0 -0
  111. data/webapp/img/filetypes/sxd.png +0 -0
  112. data/webapp/img/filetypes/sxi.png +0 -0
  113. data/webapp/img/filetypes/sxw.png +0 -0
  114. data/webapp/img/filetypes/tar.png +0 -0
  115. data/webapp/img/filetypes/tex.png +0 -0
  116. data/webapp/img/filetypes/tgz.png +0 -0
  117. data/webapp/img/filetypes/txt.png +0 -0
  118. data/webapp/img/filetypes/vcf.png +0 -0
  119. data/webapp/img/filetypes/video.png +0 -0
  120. data/webapp/img/filetypes/vsd.png +0 -0
  121. data/webapp/img/filetypes/wav.png +0 -0
  122. data/webapp/img/filetypes/wma.png +0 -0
  123. data/webapp/img/filetypes/wmv.png +0 -0
  124. data/webapp/img/filetypes/xls.png +0 -0
  125. data/webapp/img/filetypes/xml.png +0 -0
  126. data/webapp/img/filetypes/xpi.png +0 -0
  127. data/webapp/img/filetypes/xvid.png +0 -0
  128. data/webapp/img/filetypes/zip.png +0 -0
  129. data/webapp/img/ico/arrow-000-small.png +0 -0
  130. data/webapp/img/ico/arrow-circle.png +0 -0
  131. data/webapp/img/ico/arrow-switch.png +0 -0
  132. data/webapp/img/ico/asterisk.png +0 -0
  133. data/webapp/img/ico/battery.png +0 -0
  134. data/webapp/img/ico/block-small.png +0 -0
  135. data/webapp/img/ico/block.png +0 -0
  136. data/webapp/img/ico/book-open-text.png +0 -0
  137. data/webapp/img/ico/box.png +0 -0
  138. data/webapp/img/ico/bug.png +0 -0
  139. data/webapp/img/ico/chart.png +0 -0
  140. data/webapp/img/ico/chevron-small-expand.png +0 -0
  141. data/webapp/img/ico/chevron-small.png +0 -0
  142. data/webapp/img/ico/clipboard-list.png +0 -0
  143. data/webapp/img/ico/clipboard-paste-document-text.png +0 -0
  144. data/webapp/img/ico/clipboard-paste.png +0 -0
  145. data/webapp/img/ico/clock-select-remain.png +0 -0
  146. data/webapp/img/ico/clock-select.png +0 -0
  147. data/webapp/img/ico/construction.png +0 -0
  148. data/webapp/img/ico/cross-0.png +0 -0
  149. data/webapp/img/ico/cross-1.png +0 -0
  150. data/webapp/img/ico/cross.png +0 -0
  151. data/webapp/img/ico/dashboard.png +0 -0
  152. data/webapp/img/ico/database.png +0 -0
  153. data/webapp/img/ico/databases.png +0 -0
  154. data/webapp/img/ico/disk-black.png +0 -0
  155. data/webapp/img/ico/document-convert.png +0 -0
  156. data/webapp/img/ico/document-import.png +0 -0
  157. data/webapp/img/ico/document-list.png +0 -0
  158. data/webapp/img/ico/document-text.png +0 -0
  159. data/webapp/img/ico/download-cloud.png +0 -0
  160. data/webapp/img/ico/exclamation-button.png +0 -0
  161. data/webapp/img/ico/eye.png +0 -0
  162. data/webapp/img/ico/folder-export.png +0 -0
  163. data/webapp/img/ico/folder-tree.png +0 -0
  164. data/webapp/img/ico/folder.png +0 -0
  165. data/webapp/img/ico/funnel-small.png +0 -0
  166. data/webapp/img/ico/funnel.png +0 -0
  167. data/webapp/img/ico/gear.png +0 -0
  168. data/webapp/img/ico/globe-network.png +0 -0
  169. data/webapp/img/ico/globe.png +0 -0
  170. data/webapp/img/ico/hammer-screwdriver.png +0 -0
  171. data/webapp/img/ico/hand.png +0 -0
  172. data/webapp/img/ico/highlighter-text.png +0 -0
  173. data/webapp/img/ico/hourglass--exclamation.png +0 -0
  174. data/webapp/img/ico/hourglass.png +0 -0
  175. data/webapp/img/ico/inbox-document-text.png +0 -0
  176. data/webapp/img/ico/information-button.png +0 -0
  177. data/webapp/img/ico/information-small.png +0 -0
  178. data/webapp/img/ico/information-white.png +0 -0
  179. data/webapp/img/ico/information.png +0 -0
  180. data/webapp/img/ico/jar.png +0 -0
  181. data/webapp/img/ico/magnifier.png +0 -0
  182. data/webapp/img/ico/mail.png +0 -0
  183. data/webapp/img/ico/memory.png +0 -0
  184. data/webapp/img/ico/molecule.png +0 -0
  185. data/webapp/img/ico/network-cloud.png +0 -0
  186. data/webapp/img/ico/network-status-away.png +0 -0
  187. data/webapp/img/ico/network-status-busy.png +0 -0
  188. data/webapp/img/ico/network-status-offline.png +0 -0
  189. data/webapp/img/ico/network-status.png +0 -0
  190. data/webapp/img/ico/network.png +0 -0
  191. data/webapp/img/ico/node-design.png +0 -0
  192. data/webapp/img/ico/node-master.png +0 -0
  193. data/webapp/img/ico/node-select.png +0 -0
  194. data/webapp/img/ico/node-slave.png +0 -0
  195. data/webapp/img/ico/node.png +0 -0
  196. data/webapp/img/ico/pencil-small.png +0 -0
  197. data/webapp/img/ico/plus-button.png +0 -0
  198. data/webapp/img/ico/processor.png +0 -0
  199. data/webapp/img/ico/prohibition.png +0 -0
  200. data/webapp/img/ico/property.png +0 -0
  201. data/webapp/img/ico/question-small-white.png +0 -0
  202. data/webapp/img/ico/question-white.png +0 -0
  203. data/webapp/img/ico/question.png +0 -0
  204. data/webapp/img/ico/receipt-invoice.png +0 -0
  205. data/webapp/img/ico/receipt.png +0 -0
  206. data/webapp/img/ico/script-code.png +0 -0
  207. data/webapp/img/ico/server-cast.png +0 -0
  208. data/webapp/img/ico/server.png +0 -0
  209. data/webapp/img/ico/sitemap.png +0 -0
  210. data/webapp/img/ico/slash.png +0 -0
  211. data/webapp/img/ico/status-away.png +0 -0
  212. data/webapp/img/ico/status-busy.png +0 -0
  213. data/webapp/img/ico/status-offline.png +0 -0
  214. data/webapp/img/ico/status.png +0 -0
  215. data/webapp/img/ico/system-monitor--exclamation.png +0 -0
  216. data/webapp/img/ico/system-monitor.png +0 -0
  217. data/webapp/img/ico/table.png +0 -0
  218. data/webapp/img/ico/terminal.png +0 -0
  219. data/webapp/img/ico/tick-circle.png +0 -0
  220. data/webapp/img/ico/tick-red.png +0 -0
  221. data/webapp/img/ico/tick.png +0 -0
  222. data/webapp/img/ico/toggle-small-expand.png +0 -0
  223. data/webapp/img/ico/toggle-small.png +0 -0
  224. data/webapp/img/ico/toolbox.png +0 -0
  225. data/webapp/img/ico/ui-accordion.png +0 -0
  226. data/webapp/img/ico/ui-address-bar.png +0 -0
  227. data/webapp/img/ico/ui-check-box-uncheck.png +0 -0
  228. data/webapp/img/ico/ui-check-box.png +0 -0
  229. data/webapp/img/ico/ui-radio-button-uncheck.png +0 -0
  230. data/webapp/img/ico/ui-radio-button.png +0 -0
  231. data/webapp/img/ico/ui-text-field-select.png +0 -0
  232. data/webapp/img/ico/users.png +0 -0
  233. data/webapp/img/ico/wooden-box.png +0 -0
  234. data/webapp/img/ico/zone.png +0 -0
  235. data/webapp/img/loader-light.gif +0 -0
  236. data/webapp/img/loader.gif +0 -0
  237. data/webapp/img/lucene-ico.png +0 -0
  238. data/webapp/img/solr-ico.png +0 -0
  239. data/webapp/{admin/solr_small.png → img/solr.png} +0 -0
  240. data/webapp/img/tree.png +0 -0
  241. data/webapp/js/lib/ZeroClipboard.js +317 -0
  242. data/webapp/js/lib/chosen.js +953 -0
  243. data/webapp/{admin/get-properties.jsp → js/lib/console.js} +13 -10
  244. data/webapp/js/lib/d3.js +9342 -0
  245. data/webapp/js/lib/highlight.js +1 -0
  246. data/webapp/{admin/jquery-1.4.3.min.js → js/lib/jquery-1.7.2.min.js} +0 -0
  247. data/webapp/js/lib/jquery.blockUI.js +499 -0
  248. data/webapp/js/lib/jquery.cookie.js +47 -0
  249. data/webapp/js/lib/jquery.form.js +782 -0
  250. data/webapp/js/lib/jquery.jstree.js +3510 -0
  251. data/webapp/js/lib/jquery.sammy.js +1856 -0
  252. data/webapp/js/lib/jquery.sparkline.js +1271 -0
  253. data/webapp/js/lib/jquery.timeago.js +165 -0
  254. data/webapp/js/lib/linker.js +48 -0
  255. data/webapp/js/lib/order.js +189 -0
  256. data/webapp/js/main.js +57 -0
  257. data/webapp/js/require.js +11319 -0
  258. data/webapp/js/scripts/analysis.js +549 -0
  259. data/webapp/js/scripts/app.js +368 -0
  260. data/webapp/js/scripts/cloud.js +719 -0
  261. data/webapp/js/scripts/cores.js +540 -0
  262. data/webapp/js/scripts/dashboard.js +540 -0
  263. data/webapp/js/scripts/dataimport.js +567 -0
  264. data/webapp/js/scripts/file.js +56 -0
  265. data/webapp/js/scripts/index.js +344 -0
  266. data/webapp/js/scripts/java-properties.js +107 -0
  267. data/webapp/js/scripts/logging.js +519 -0
  268. data/webapp/js/scripts/ping.js +72 -0
  269. data/webapp/js/scripts/plugins.js +426 -0
  270. data/webapp/js/scripts/query.js +170 -0
  271. data/webapp/js/scripts/replication.js +557 -0
  272. data/webapp/js/scripts/schema-browser.js +1206 -0
  273. data/webapp/js/scripts/threads.js +159 -0
  274. data/webapp/tpl/analysis.html +83 -0
  275. data/webapp/tpl/cloud.html +54 -0
  276. data/webapp/tpl/cores.html +215 -0
  277. data/webapp/tpl/dashboard.html +164 -0
  278. data/webapp/tpl/dataimport.html +123 -0
  279. data/webapp/tpl/index.html +250 -0
  280. data/webapp/tpl/logging.html +23 -0
  281. data/webapp/tpl/plugins.html +39 -0
  282. data/webapp/tpl/query.html +318 -0
  283. data/webapp/tpl/replication.html +207 -0
  284. data/webapp/tpl/schema-browser.html +178 -0
  285. data/webapp/tpl/threads.html +56 -0
  286. metadata +307 -40
  287. data/lib/rjack-solr/solr-core-3.6.2.jar +0 -0
  288. data/lib/rjack-solr/solr-solrj-3.6.2.jar +0 -0
  289. data/webapp/admin/_info.jsp +0 -120
  290. data/webapp/admin/action.jsp +0 -94
  291. data/webapp/admin/analysis.jsp +0 -496
  292. data/webapp/admin/analysis.xsl +0 -179
  293. data/webapp/admin/dataimport.jsp +0 -53
  294. data/webapp/admin/debug.jsp +0 -103
  295. data/webapp/admin/distributiondump.jsp +0 -160
  296. data/webapp/admin/form.jsp +0 -152
  297. data/webapp/admin/get-file.jsp +0 -72
  298. data/webapp/admin/header.jsp +0 -44
  299. data/webapp/admin/index.jsp +0 -162
  300. data/webapp/admin/meta.xsl +0 -34
  301. data/webapp/admin/ping.jsp +0 -52
  302. data/webapp/admin/ping.xsl +0 -71
  303. data/webapp/admin/raw-schema.jsp +0 -38
  304. data/webapp/admin/registry.jsp +0 -107
  305. data/webapp/admin/registry.xsl +0 -321
  306. data/webapp/admin/replication/header.jsp +0 -89
  307. data/webapp/admin/replication/index.jsp +0 -378
  308. data/webapp/admin/schema.jsp +0 -690
  309. data/webapp/admin/solr-admin.css +0 -215
  310. data/webapp/admin/stats.jsp +0 -92
  311. data/webapp/admin/stats.xsl +0 -220
  312. data/webapp/admin/tabular.xsl +0 -141
  313. data/webapp/admin/threaddump.jsp +0 -110
  314. data/webapp/admin/threaddump.xsl +0 -103
  315. data/webapp/index.jsp +0 -49
@@ -0,0 +1,549 @@
1
+ /*
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ */
17
+
18
+ // #/:core/analysis
19
+ sammy.get
20
+ (
21
+ /^#\/([\w\d-]+)\/(analysis)$/,
22
+ function( context )
23
+ {
24
+ var active_core = this.active_core;
25
+ var core_basepath = active_core.attr( 'data-basepath' );
26
+ var content_element = $( '#content' );
27
+
28
+ $.get
29
+ (
30
+ 'tpl/analysis.html',
31
+ function( template )
32
+ {
33
+ content_element
34
+ .html( template );
35
+
36
+ var analysis_element = $( '#analysis', content_element );
37
+ var analysis_form = $( 'form', analysis_element );
38
+ var analysis_result = $( '#analysis-result', analysis_element );
39
+ analysis_result.hide();
40
+
41
+ var verbose_link = $( '.verbose_output a', analysis_element );
42
+
43
+ var type_or_name = $( '#type_or_name', analysis_form );
44
+ var schema_browser_element = $( '#tor_schema' );
45
+ var schema_browser_path = $( 'p > a', active_core ).attr( 'href' ) + '/schema-browser'
46
+ var schema_browser_map = { 'fieldname' : 'field', 'fieldtype' : 'type' };
47
+
48
+ type_or_name
49
+ .die( 'change' )
50
+ .live
51
+ (
52
+ 'change',
53
+ function( event )
54
+ {
55
+ var info = $( this ).val().split( '=' );
56
+
57
+ schema_browser_element
58
+ .attr( 'href', schema_browser_path + '?' + schema_browser_map[info[0]] + '=' + info[1] );
59
+ }
60
+ );
61
+
62
+ $.ajax
63
+ (
64
+ {
65
+ url : core_basepath + '/admin/luke?wt=json&show=schema',
66
+ dataType : 'json',
67
+ context : type_or_name,
68
+ beforeSend : function( xhr, settings )
69
+ {
70
+ this
71
+ .html( '<option value="">Loading ... </option>' )
72
+ .addClass( 'loader' );
73
+ },
74
+ success : function( response, text_status, xhr )
75
+ {
76
+ var content = '';
77
+
78
+ var fields = [];
79
+ for( var field_name in response.schema.fields )
80
+ {
81
+ fields.push
82
+ (
83
+ '<option value="fieldname=' + field_name + '">' + field_name + '</option>'
84
+ );
85
+ }
86
+ if( 0 !== fields.length )
87
+ {
88
+ content += '<optgroup label="Fields">' + "\n";
89
+ content += fields.sort().join( "\n" ) + "\n";
90
+ content += '</optgroup>' + "\n";
91
+ }
92
+
93
+ var types = [];
94
+ for( var type_name in response.schema.types )
95
+ {
96
+ types.push
97
+ (
98
+ '<option value="fieldtype=' + type_name + '">' + type_name + '</option>'
99
+ );
100
+ }
101
+ if( 0 !== types.length )
102
+ {
103
+ content += '<optgroup label="Types">' + "\n";
104
+ content += types.sort().join( "\n" ) + "\n";
105
+ content += '</optgroup>' + "\n";
106
+ }
107
+
108
+ this
109
+ .html( content );
110
+
111
+ var defaultSearchField = 'fieldname\=' + ( context.params['analysis.fieldname'] || response.schema.defaultSearchField );
112
+
113
+ if( context.params['analysis.fieldtype'] )
114
+ {
115
+ defaultSearchField = 'fieldtype\=' + context.params['analysis.fieldtype'];
116
+ }
117
+
118
+ $( 'option[value="' + defaultSearchField + '"]', this )
119
+ .attr( 'selected', 'selected' );
120
+
121
+ this
122
+ .chosen()
123
+ .trigger( 'change' );
124
+
125
+ var fields = 0;
126
+ for( var key in context.params )
127
+ {
128
+ if( 'string' === typeof context.params[key] )
129
+ {
130
+ fields++;
131
+ $( '[name="' + key + '"]', analysis_form )
132
+ .val( decodeURIComponent( context.params[key].replace( /\+/g, '%20' ) ) );
133
+ }
134
+ }
135
+
136
+ if( 'undefined' !== typeof context.params.verbose_output )
137
+ {
138
+ verbose_link.trigger( 'toggle', !!context.params.verbose_output.match( /^(1|true)$/ ) );
139
+ }
140
+
141
+ if( 0 !== fields )
142
+ {
143
+ analysis_form
144
+ .trigger( 'execute' );
145
+ }
146
+ },
147
+ error : function( xhr, text_status, error_thrown)
148
+ {
149
+ },
150
+ complete : function( xhr, text_status )
151
+ {
152
+ this
153
+ .removeClass( 'loader' );
154
+ }
155
+ }
156
+ );
157
+
158
+ $( '.analysis-error .head a', analysis_element )
159
+ .die( 'click' )
160
+ .live
161
+ (
162
+ 'click',
163
+ function( event )
164
+ {
165
+ $( this ).parents( '.analysis-error' )
166
+ .toggleClass( 'expanded' );
167
+ }
168
+ );
169
+
170
+ var check_empty_spacer = function()
171
+ {
172
+ var spacer_holder = $( 'td.part.data.spacer .holder', analysis_result );
173
+
174
+ if( 0 === spacer_holder.size() )
175
+ {
176
+ return false;
177
+ }
178
+
179
+ var verbose_output = analysis_result.hasClass( 'verbose_output' );
180
+
181
+ spacer_holder
182
+ .each
183
+ (
184
+ function( index, element )
185
+ {
186
+ element = $( element );
187
+
188
+ if( verbose_output )
189
+ {
190
+ var cell = element.parent();
191
+ element.height( cell.height() );
192
+ }
193
+ else
194
+ {
195
+ element.removeAttr( 'style' );
196
+ }
197
+ }
198
+ );
199
+ }
200
+
201
+ verbose_link
202
+ .die( 'toggle' )
203
+ .live
204
+ (
205
+ 'toggle',
206
+ function( event, state )
207
+ {
208
+ $( this ).parent()
209
+ .toggleClass( 'active', state );
210
+
211
+ analysis_result
212
+ .toggleClass( 'verbose_output', state );
213
+
214
+ check_empty_spacer();
215
+ }
216
+ )
217
+ .die( 'click' )
218
+ .live
219
+ (
220
+ 'click',
221
+ function( event )
222
+ {
223
+ $( this ).parent()
224
+ .toggleClass( 'active' );
225
+
226
+ analysis_form.trigger( 'submit' );
227
+ }
228
+ );
229
+
230
+ var button = $( 'button', analysis_form )
231
+
232
+ var compute_analysis_params = function()
233
+ {
234
+ var params = analysis_form.formToArray();
235
+
236
+ var type_or_name = $( '#type_or_name', analysis_form ).val().split( '=' );
237
+ params.push( { name: 'analysis.' + type_or_name[0], value: type_or_name[1] } );
238
+ params.push( { name: 'verbose_output', value: $( '.verbose_output', analysis_element ).hasClass( 'active' ) ? 1 : 0 } );
239
+
240
+ return params;
241
+ }
242
+
243
+ analysis_form
244
+ .die( 'submit' )
245
+ .live
246
+ (
247
+ 'submit',
248
+ function( event )
249
+ {
250
+ var params = compute_analysis_params();
251
+
252
+ context.redirect( context.path.split( '?' ).shift() + '?' + $.param( params ) );
253
+ return false;
254
+ }
255
+ )
256
+ .die( 'execute' )
257
+ .live
258
+ (
259
+ 'execute',
260
+ function( event )
261
+ {
262
+ var url = core_basepath + '/analysis/field?wt=json&analysis.showmatch=true&' + context.path.split( '?' ).pop();
263
+ url = url.replace( /&verbose_output=\d/, '' );
264
+
265
+ $.ajax
266
+ (
267
+ {
268
+ url : url,
269
+ dataType : 'json',
270
+ beforeSend : function( xhr, settings )
271
+ {
272
+ loader.show( button );
273
+ button.attr( 'disabled', true );
274
+ },
275
+ success : function( response, status_text, xhr, form )
276
+ {
277
+ $( '.analysis-error', analysis_element )
278
+ .hide();
279
+
280
+ analysis_result
281
+ .empty()
282
+ .show();
283
+
284
+ for( var name in response.analysis.field_names )
285
+ {
286
+ build_analysis_table( 'name', name, response.analysis.field_names[name] );
287
+ }
288
+
289
+ for( var name in response.analysis.field_types )
290
+ {
291
+ build_analysis_table( 'type', name, response.analysis.field_types[name] );
292
+ }
293
+
294
+ check_empty_spacer();
295
+ },
296
+ error : function( xhr, text_status, error_thrown )
297
+ {
298
+ analysis_result
299
+ .empty()
300
+ .hide();
301
+
302
+ if( 404 === xhr.status )
303
+ {
304
+ $( '#analysis-handler-missing', analysis_element )
305
+ .show();
306
+ }
307
+ else
308
+ {
309
+ $( '#analysis-error', analysis_element )
310
+ .show();
311
+
312
+ var response = null;
313
+ try
314
+ {
315
+ eval( 'response = ' + xhr.responseText + ';' );
316
+ }
317
+ catch( e )
318
+ {
319
+ console.error( e );
320
+ }
321
+
322
+ $( '#analysis-error .body', analysis_element )
323
+ .text( response ? response.error.msg : xhr.responseText );
324
+ }
325
+ },
326
+ complete : function()
327
+ {
328
+ loader.hide( $( 'button', analysis_form ) );
329
+ button.removeAttr( 'disabled' );
330
+ }
331
+ }
332
+ );
333
+ }
334
+ );
335
+
336
+ var generate_class_name = function( type )
337
+ {
338
+ var classes = [type];
339
+ if( 'text' !== type )
340
+ {
341
+ classes.push( 'verbose_output' );
342
+ }
343
+ return classes.join( ' ' );
344
+ }
345
+
346
+ var build_analysis_table = function( field_or_name, name, analysis_data )
347
+ {
348
+ for( var type in analysis_data )
349
+ {
350
+ var type_length = analysis_data[type].length;
351
+ if( 0 !== type_length )
352
+ {
353
+ var global_elements_count = 0;
354
+ for( var i = 0; i < analysis_data[type].length; i += 2 )
355
+ {
356
+ if( 'string' === typeof analysis_data[type][i+1] )
357
+ {
358
+ analysis_data[type][i+1] = [{ 'text': analysis_data[type][i+1] }]
359
+ }
360
+
361
+ var tmp = {};
362
+ var cols = analysis_data[type][i+1].filter
363
+ (
364
+ function( obj )
365
+ {
366
+ var obj_position = obj.position || 0;
367
+ if( !tmp[obj_position] )
368
+ {
369
+ tmp[obj_position] = true;
370
+ return true;
371
+ }
372
+
373
+ return false;
374
+ }
375
+ );
376
+
377
+ global_elements_count = Math.max( global_elements_count, cols.length );
378
+ }
379
+
380
+ var content = '<div class="' + type + '">' + "\n";
381
+ content += '<table border="0" cellspacing="0" cellpadding="0">' + "\n";
382
+
383
+ for( var i = 0; i < analysis_data[type].length; i += 2 )
384
+ {
385
+ var colspan = 1;
386
+ var elements = analysis_data[type][i+1];
387
+ var elements_count = global_elements_count;
388
+
389
+ if( !elements[0] || !elements[0].positionHistory )
390
+ {
391
+ colspan = elements_count;
392
+ elements_count = 1;
393
+ }
394
+
395
+ var legend = [];
396
+ for( var key in elements[0] )
397
+ {
398
+ var key_parts = key.split( '#' );
399
+ var used_key = key_parts.pop();
400
+ var short_key = used_key;
401
+
402
+ if( 1 === key_parts.length )
403
+ {
404
+ used_key = '<abbr title="' + key + '">' + used_key + '</abbr>';
405
+ }
406
+
407
+ if( 'positionHistory' === short_key || 'match' === short_key )
408
+ {
409
+ continue;
410
+ }
411
+
412
+ legend.push
413
+ (
414
+ '<tr class="' + generate_class_name( short_key ) + '">' +
415
+ '<td>' + used_key + '</td>' +
416
+ '</tr>'
417
+ );
418
+ }
419
+
420
+ content += '<tbody>' + "\n";
421
+ content += '<tr class="step">' + "\n";
422
+
423
+ // analyzer
424
+ var analyzer_name = analysis_data[type][i].replace( /(\$1)+$/g, '' );
425
+
426
+ var analyzer_short = -1 !== analyzer_name.indexOf( '$' )
427
+ ? analyzer_name.split( '$' )[1]
428
+ : analyzer_name.split( '.' ).pop();
429
+ analyzer_short = analyzer_short.match( /[A-Z]/g ).join( '' );
430
+
431
+ content += '<td class="part analyzer"><div>' + "\n";
432
+ content += '<abbr title="' + analysis_data[type][i].esc() + '">' + "\n";
433
+ content += analyzer_short.esc() + '</abbr></div></td>' + "\n";
434
+
435
+ // legend
436
+ content += '<td class="part legend"><div class="holder">' + "\n";
437
+ content += '<table border="0" cellspacing="0" cellpadding="0">' + "\n";
438
+ content += '<tr><td>' + "\n";
439
+ content += '<table border="0" cellspacing="0" cellpadding="0">' + "\n";
440
+ content += legend.join( "\n" ) + "\n";
441
+ content += '</table></td></tr></table></td>' + "\n";
442
+
443
+ // data
444
+ var cell_content = '<td class="part data spacer" colspan="' + colspan + '"><div class="holder">&nbsp;</div></td>';
445
+ var cells = new Array( elements_count + 1 ).join( cell_content );
446
+ content += cells + "\n";
447
+
448
+ content += '</tr>' + "\n";
449
+ content += '</tbody>' + "\n";
450
+ }
451
+ content += '</table>' + "\n";
452
+ content += '</div>' + "\n";
453
+
454
+ $( '.' + type, analysis_result )
455
+ .remove();
456
+
457
+ analysis_result
458
+ .append( content );
459
+
460
+ var analysis_result_type = $( '.' + type, analysis_result );
461
+
462
+ for( var i = 0; i < analysis_data[type].length; i += 2 )
463
+ {
464
+ for( var j = 0; j < analysis_data[type][i+1].length; j += 1 )
465
+ {
466
+ var pos = analysis_data[type][i+1][j].positionHistory
467
+ ? analysis_data[type][i+1][j].positionHistory[0]
468
+ : 1;
469
+ var selector = 'tr.step:eq(' + ( i / 2 ) +') '
470
+ + 'td.data:eq(' + ( pos - 1 ) + ') '
471
+ + '.holder';
472
+ var cell = $( selector, analysis_result_type );
473
+
474
+ cell.parent()
475
+ .removeClass( 'spacer' );
476
+
477
+ var table = $( 'table tr.details', cell );
478
+ if( 0 === table.size() )
479
+ {
480
+ cell
481
+ .html
482
+ (
483
+ '<table border="0" cellspacing="0" cellpadding="0">' +
484
+ '<tr class="details"></tr></table>'
485
+ );
486
+ var table = $( 'table tr.details', cell );
487
+ }
488
+
489
+ var tokens = [];
490
+ for( var key in analysis_data[type][i+1][j] )
491
+ {
492
+ var short_key = key.split( '#' ).pop();
493
+
494
+ if( 'positionHistory' === short_key || 'match' === short_key )
495
+ {
496
+ continue;
497
+ }
498
+
499
+ var classes = [];
500
+ classes.push( generate_class_name( short_key ) );
501
+
502
+ var data = analysis_data[type][i+1][j][key];
503
+ if( 'object' === typeof data && data instanceof Array )
504
+ {
505
+ data = data.join( ' ' );
506
+ }
507
+ if( 'string' === typeof data )
508
+ {
509
+ data = data.esc();
510
+ }
511
+
512
+ if( null === data || 0 === data.length )
513
+ {
514
+ classes.push( 'empty' );
515
+ data = '&empty;';
516
+ }
517
+
518
+ if( analysis_data[type][i+1][j].match &&
519
+ ( 'text' === short_key || 'raw_bytes' === short_key ) )
520
+ {
521
+ classes.push( 'match' );
522
+ }
523
+
524
+ tokens.push
525
+ (
526
+ '<tr class="' + classes.join( ' ' ) + '">' +
527
+ '<td>' + data + '</td>' +
528
+ '</tr>'
529
+ );
530
+ }
531
+ table
532
+ .append
533
+ (
534
+ '<td class="details">' +
535
+ '<table border="0" cellspacing="0" cellpadding="0">' +
536
+ tokens.join( "\n" ) +
537
+ '</table></td>'
538
+ );
539
+ }
540
+ }
541
+
542
+ }
543
+ }
544
+ }
545
+
546
+ }
547
+ );
548
+ }
549
+ );