sunspot_solr 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sunspot-solr +2 -6
  3. data/lib/sunspot/solr/server.rb +2 -3
  4. data/solr/README.txt +181 -181
  5. data/solr/bin/post +29 -19
  6. data/solr/bin/solr +247 -428
  7. data/solr/bin/solr.cmd +102 -256
  8. data/solr/bin/solr.in.cmd +15 -7
  9. data/solr/bin/solr.in.sh +26 -12
  10. data/solr/server/README.txt +110 -113
  11. data/solr/server/contexts/solr-jetty-context.xml +8 -8
  12. data/solr/server/etc/jetty-http.xml +47 -0
  13. data/solr/server/etc/jetty-https-ssl.xml +175 -159
  14. data/solr/server/etc/jetty-https.xml +53 -0
  15. data/solr/server/etc/jetty-ssl.xml +46 -0
  16. data/solr/server/etc/jetty.xml +189 -167
  17. data/solr/server/etc/webdefault.xml +527 -527
  18. data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
  19. data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
  20. data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
  21. data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
  22. data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
  23. data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
  24. data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
  25. data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
  26. data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
  27. data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
  28. data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
  29. data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
  30. data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
  31. data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
  32. data/solr/server/modules/http.mod +9 -0
  33. data/solr/server/modules/https.mod +9 -0
  34. data/solr/server/modules/server.mod +11 -0
  35. data/solr/server/modules/ssl.mod +9 -0
  36. data/solr/server/resources/jetty-logging.properties +1 -0
  37. data/solr/server/resources/log4j.properties +24 -24
  38. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
  39. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
  40. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
  41. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
  42. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
  43. data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
  44. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
  45. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
  46. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
  47. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
  48. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
  49. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-common-5.0.0.jar → lucene-analyzers-common-5.3.1.jar} +0 -0
  50. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-kuromoji-5.0.0.jar → lucene-analyzers-kuromoji-5.3.1.jar} +0 -0
  51. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-phonetic-5.0.0.jar → lucene-analyzers-phonetic-5.3.1.jar} +0 -0
  52. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
  53. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
  54. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
  55. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
  56. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
  57. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
  58. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
  59. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
  60. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
  61. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
  62. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
  63. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
  64. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
  65. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
  66. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
  67. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
  68. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
  69. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
  70. data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
  71. data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
  72. data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
  73. data/solr/server/solr-webapp/webapp/admin.html +164 -163
  74. data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
  75. data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
  76. data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
  77. data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
  78. data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
  79. data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
  80. data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
  81. data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
  82. data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
  83. data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
  84. data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
  85. data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
  86. data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
  87. data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
  88. data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
  89. data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
  90. data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
  91. data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
  92. data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
  93. data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
  94. data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
  95. data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
  96. data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
  97. data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
  98. data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
  99. data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
  100. data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
  101. data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
  102. data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
  103. data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
  104. data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
  105. data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
  106. data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
  107. data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
  108. data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
  109. data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
  110. data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
  111. data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
  112. data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
  113. data/solr/server/solr-webapp/webapp/index.html +208 -0
  114. data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
  115. data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
  116. data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
  117. data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
  118. data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
  119. data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
  120. data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
  121. data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
  122. data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
  123. data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
  124. data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
  125. data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
  126. data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
  127. data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
  128. data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
  129. data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
  130. data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
  131. data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
  132. data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
  133. data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
  134. data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
  135. data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
  136. data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
  137. data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
  138. data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
  139. data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
  140. data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
  141. data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
  142. data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
  143. data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
  144. data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
  145. data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
  146. data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
  147. data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
  148. data/solr/server/solr-webapp/webapp/js/main.js +60 -58
  149. data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
  150. data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
  151. data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
  152. data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
  153. data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
  154. data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
  155. data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
  156. data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
  157. data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
  158. data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
  159. data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
  160. data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
  161. data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
  162. data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
  163. data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
  164. data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
  165. data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
  166. data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
  167. data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
  168. data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
  169. data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
  170. data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
  171. data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
  172. data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
  173. data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
  174. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
  175. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
  176. data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
  177. data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
  178. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
  179. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
  180. data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
  181. data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
  182. data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
  183. data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
  184. data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
  185. data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
  186. data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
  187. data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
  188. data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
  189. data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
  190. data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
  191. data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
  192. data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
  193. data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
  194. data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
  195. data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
  196. data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
  197. data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
  198. data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
  199. data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
  200. data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
  201. data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
  202. data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
  203. data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
  204. data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
  205. data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
  206. data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
  207. data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
  208. data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
  209. data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
  210. data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
  211. data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
  212. data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
  213. data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
  214. data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
  215. data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
  216. data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
  217. data/solr/server/solr/README.txt +77 -77
  218. data/solr/server/solr/solr.xml +51 -51
  219. data/solr/server/solr/zoo.cfg +17 -17
  220. data/solr/server/start.jar +0 -0
  221. data/spec/server_spec.rb +3 -8
  222. metadata +132 -43
  223. data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
  224. data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
  225. data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
  226. data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
  227. data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
  228. data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
  229. data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
  230. data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
  231. data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
  232. data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
  233. data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
  234. data/solr/server/lib/servlet-api-3.0.jar +0 -0
  235. data/solr/server/solr-webapp/webapp/.gitignore +0 -1
  236. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
  237. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
  238. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
  239. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
  240. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
  241. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
  242. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
  243. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
  244. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
  245. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
  246. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
  247. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
  248. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
  249. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
  250. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
  251. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
  252. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
  253. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
  254. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
  255. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
  256. data/solr/server/webapps/solr.war +0 -0
@@ -0,0 +1,94 @@
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
+ var MB_FACTOR = 1024*1024;
19
+
20
+ solrAdminApp.controller('SegmentsController', function($scope, $routeParams, $interval, Segments) {
21
+ $scope.resetMenu("segments");
22
+
23
+ $scope.refresh = function() {
24
+
25
+ Segments.get({core: $routeParams.core}, function(data) {
26
+ var segments = data.segments;
27
+
28
+ var segmentSizeInBytesMax = getLargestSegmentSize(segments);
29
+ $scope.segmentMB = Math.floor(segmentSizeInBytesMax / MB_FACTOR);
30
+ $scope.xaxis = calculateXAxis(segmentSizeInBytesMax);
31
+
32
+ $scope.documentCount = 0;
33
+ $scope.deletionCount = 0;
34
+
35
+ $scope.segments = [];
36
+ for (var name in segments) {
37
+ var segment = segments[name];
38
+
39
+ var segmentSizeInBytesLog = Math.log(segment.sizeInBytes);
40
+ var segmentSizeInBytesMaxLog = Math.log(segmentSizeInBytesMax);
41
+
42
+ segment.totalSize = Math.floor((segmentSizeInBytesLog / segmentSizeInBytesMaxLog ) * 100);
43
+
44
+ segment.deletedDocSize = Math.floor((segment.delCount / (segment.delCount + segment.totalSize)) * segment.totalSize);
45
+ if (segment.delDocSize <= 0.001) delete segment.deletedDocSize;
46
+
47
+ segment.aliveDocSize = segment.totalSize - segment.deletedDocSize;
48
+
49
+ $scope.segments.push(segment);
50
+
51
+ $scope.documentCount += segment.size;
52
+ $scope.deletionCount += segment.delCount;
53
+ }
54
+ $scope.deletionsPercentage = calculateDeletionsPercentage($scope.documentCount, $scope.deletionCount);
55
+ });
56
+ };
57
+
58
+ $scope.toggleAutoRefresh = function() {
59
+ $scope.autorefresh = !$scope.autorefresh;
60
+ if ($scope.autorefresh) {
61
+ $scope.interval = $interval($scope.refresh, 1000);
62
+ } else if ($scope.interval) {
63
+ $interval.cancel($scope.interval);
64
+ }
65
+ };
66
+ $scope.refresh();
67
+ });
68
+
69
+ var calculateXAxis = function(segmentInBytesMax) {
70
+ var steps = [];
71
+ var log = Math.log(segmentInBytesMax);
72
+
73
+ for (var j=0, step=log/4; j<3; j++, step+=log/4) {
74
+ steps.push({pos:j, value:Math.floor((Math.pow(Math.E, step))/MB_FACTOR)})
75
+ }
76
+ return steps;
77
+ };
78
+
79
+ var getLargestSegmentSize = function(segments) {
80
+ var max = 0;
81
+ for (var name in segments) {
82
+ max = Math.max(max, segments[name].sizeInBytes);
83
+ }
84
+ return max;
85
+ };
86
+
87
+ var calculateDeletionsPercentage = function(docCount, delCount) {
88
+ if (docCount == 0) {
89
+ return 0;
90
+ } else {
91
+ var percent = delCount / docCount * 100;
92
+ return Math.round(percent * 100) / 100;
93
+ }
94
+ };
@@ -0,0 +1,51 @@
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
+ solrAdminApp.controller('ThreadsController',
19
+ ["$scope", "Threads",
20
+ function($scope, Threads){
21
+ $scope.resetMenu("threads", true);
22
+ $scope.refresh = function() {
23
+ Threads.get(function(data) {
24
+ var threadDump = data.system.threadDump;
25
+ var threads = [];
26
+ for (var i=1; i<threadDump.length; i+=2) {
27
+ var thread = threadDump[i];
28
+ if (!!thread.stackTrace) {
29
+ var stackTrace = [];
30
+ for (var j=0; j<thread.stackTrace.length; j++) {
31
+ var trace = thread.stackTrace[j].replace("(", "\u200B("); // allow wrapping to happen, \u200B is a zero-width space
32
+ stackTrace.push({id:thread.id + ":" + j, trace: trace});
33
+ }
34
+ thread.stackTrace = stackTrace;
35
+ }
36
+ threads.push(thread);
37
+ }
38
+ $scope.threads = threads;
39
+ });
40
+ };
41
+ $scope.toggleStacktrace = function(thread) {
42
+ thread.showStackTrace = !thread.showStackTrace;
43
+ };
44
+ $scope.toggleStacktraces = function() {
45
+ $scope.showAllStacktraces = !$scope.showAllStacktraces;
46
+ for (var i=0; i<$scope.threads.length; i++) {
47
+ $scope.threads[i].showStackTrace = $scope.showAllStacktraces;
48
+ }
49
+ };
50
+ $scope.refresh();
51
+ }]);
@@ -0,0 +1,214 @@
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
+ var solrAdminServices = angular.module('solrAdminServices', ['ngResource']);
19
+
20
+ solrAdminServices.factory('System',
21
+ ['$resource', function($resource) {
22
+ return $resource('/solr/admin/info/system', {"wt":"json", "_":Date.now()});
23
+ }])
24
+ .factory('Cores',
25
+ ['$resource', function($resource) {
26
+ return $resource('/solr/admin/cores',
27
+ {'wt':'json', '_':Date.now()}, {
28
+ "query": {},
29
+ "list": {params:{indexInfo: false}},
30
+ "add": {params:{action: "CREATE"}},
31
+ "unload": {params:{action: "UNLOAD", core: "@core"}},
32
+ "rename": {params:{action: "RENAME"}},
33
+ "swap": {params:{}},
34
+ "reload": {method: "GET", params:{action:"RELOAD", core: "@core"}},
35
+ "optimize": {params:{}}
36
+ });
37
+ }])
38
+ .factory('Logging',
39
+ ['$resource', function($resource) {
40
+ return $resource('/solr/admin/info/logging', {'wt':'json', '_':Date.now()}, {
41
+ "events": {params: {since:'0'}},
42
+ "levels": {},
43
+ "setLevel": {}
44
+ });
45
+ }])
46
+ .factory('Zookeeper',
47
+ ['$resource', function($resource) {
48
+ return $resource('/solr/zookeeper', {wt:'json', _:Date.now()}, {
49
+ "simple": {},
50
+ "dump": {params: {dump: "true"}},
51
+ "liveNodes": {params: {path: '/live_nodes'}},
52
+ "clusterState": {params: {detail: "true", path: "/clusterstate.json"}},
53
+ "detail": {params: {detail: "true", path: "@path"}}
54
+ });
55
+ }])
56
+ .factory('Properties',
57
+ ['$resource', function($resource) {
58
+ return $resource('/solr/admin/info/properties', {'wt':'json', '_':Date.now()});
59
+ }])
60
+ .factory('Threads',
61
+ ['$resource', function($resource) {
62
+ return $resource('/solr/admin/info/threads', {'wt':'json', '_':Date.now()});
63
+ }])
64
+ .factory('Properties',
65
+ ['$resource', function($resource) {
66
+ return $resource('/solr/admin/info/properties', {'wt':'json', '_':Date.now()});
67
+ }])
68
+ .factory('Replication',
69
+ ['$resource', function($resource) {
70
+ return $resource('/solr/:core/replication', {'wt':'json', core: "@core", '_':Date.now()}, {
71
+ "details": {params: {command: "details"}},
72
+ "command": {params: {}}
73
+ });
74
+ }])
75
+ .factory('CoreSystem',
76
+ ['$resource', function($resource) {
77
+ return $resource('/solr/:core/admin/system', {wt:'json', core: "@core", _:Date.now()});
78
+ }])
79
+ .factory('Update',
80
+ ['$resource', function($resource) {
81
+ return $resource('/solr/:core/:handler', {core: '@core', wt:'json', _:Date.now(), handler:'update'}, {
82
+ "optimize": {params: { optimize: "true"}},
83
+ "commit": {params: {commit: "true"}},
84
+ "post": {headers: {'Content-type': 'application/json'}, method: "POST", params: {handler: '@handler'}},
85
+ "postJson": {headers: {'Content-type': 'application/json'}, method: "POST", params: {handler: '@handler'}},
86
+ "postXml": {headers: {'Content-type': 'text/xml'}, method: "POST", params: {handler: '@handler'}},
87
+ "postCsv": {headers: {'Content-type': 'application/csv'}, method: "POST", params: {handler: '@handler'}}
88
+ });
89
+ }])
90
+ .service('FileUpload', function ($http) {
91
+ this.upload = function(params, file, success, error){
92
+ var url = "/solr/" + params.core + "/" + params.handler + "?";
93
+ raw = params.raw;
94
+ delete params.core;
95
+ delete params.handler;
96
+ delete params.raw;
97
+ url += $.param(params);
98
+ if (raw && raw.length>0) {
99
+ if (raw[0] != "&") raw = "&" + raw;
100
+ url += raw;
101
+ }
102
+ var fd = new FormData();
103
+ fd.append('file', file);
104
+ $http.post(url, fd, {
105
+ transformRequest: angular.identity,
106
+ headers: {'Content-Type': undefined}
107
+ }).success(success).error(error);
108
+ }
109
+ })
110
+ .factory('Luke',
111
+ ['$resource', function($resource) {
112
+ return $resource('/solr/:core/admin/luke', {core: '@core', wt:'json', _:Date.now()}, {
113
+ "index": {params: {numTerms: 0}},
114
+ "schema": {params: {show:'schema'}},
115
+ "field": {},
116
+ "fields": {params: {show:'schema'}, interceptor: {
117
+ response: function(response) {
118
+ var fieldsAndTypes = [];
119
+ for (var field in response.data.schema.fields) {
120
+ fieldsAndTypes.push({group: "Fields", label: field, value: "fieldname=" + field});
121
+ }
122
+ for (var type in response.data.schema.types) {
123
+ fieldsAndTypes.push({group: "Types", label: type, value: "fieldtype=" + type});
124
+ }
125
+ return fieldsAndTypes;
126
+ }
127
+ }}
128
+ });
129
+ }])
130
+ .factory('Analysis',
131
+ ['$resource', function($resource) {
132
+ return $resource('/solr/:core/analysis/field', {core: '@core', wt:'json', _:Date.now()}, {
133
+ "field": {params: {"analysis.showmatch": true}}
134
+ });
135
+ }])
136
+ .factory('DataImport',
137
+ ['$resource', function($resource) {
138
+ return $resource('/solr/:core/dataimport', {core: '@core', indent:'on', wt:'json', _:Date.now()}, {
139
+ "config": {params: {command: "show-config", doNotIntercept: "true"},
140
+ transformResponse: function(data) {
141
+ return {config: data};
142
+ }
143
+ },
144
+ "status": {params: {command: "status", doNotIntercept: "true"}},
145
+ "reload": {params: {command: "reload-config"}},
146
+ "post": {method: "POST",
147
+ headers: {'Content-type': 'application/x-www-form-urlencoded'},
148
+ transformRequest: function(data) { return $.param(data) }}
149
+ });
150
+ }])
151
+ .factory('Ping',
152
+ ['$resource', function($resource) {
153
+ return $resource('/solr/:core/admin/ping', {wt:'json', core: '@core', ts:Date.now(), _:Date.now()}, {
154
+ "ping": {},
155
+ "status": {params:{action:"status"}}
156
+ });
157
+ }])
158
+ .factory('Mbeans',
159
+ ['$resource', function($resource) {
160
+ return $resource('/solr/:core/admin/mbeans', {'wt':'json', core: '@core', '_':Date.now()}, {
161
+ stats: {params: {stats: true}},
162
+ info: {},
163
+ reference: {
164
+ params: {wt: "xml", stats: true}, transformResponse: function (data) {
165
+ return {reference: data}
166
+ }
167
+ },
168
+ delta: {method: "POST",
169
+ params: {stats: true, diff:true},
170
+ headers: {'Content-type': 'application/x-www-form-urlencoded'},
171
+ transformRequest: function(data) {
172
+ return "stream.body=" + encodeURIComponent(data);
173
+ }
174
+ }
175
+ });
176
+ }])
177
+ .factory('Files',
178
+ ['$resource', function($resource) {
179
+ return $resource('/solr/:core/admin/file', {'wt':'json', core: '@core', '_':Date.now()}, {
180
+ "list": {},
181
+ "get": {method: "GET", interceptor: {
182
+ response: function(config) {return config;}
183
+ }}
184
+ });
185
+ }])
186
+ .factory('Query',
187
+ ['$resource', function($resource) {
188
+ var resource = $resource('/solr/:core:handler', {core: '@core', handler: '@handler'}, {
189
+ "query": {
190
+ method: "GET", transformResponse: function (data) {
191
+ return {data: data}
192
+ }
193
+ }
194
+ });
195
+ resource.url = function(params) {
196
+ var qs = [];
197
+ for (key in params) {
198
+ if (key != "core" && key != "handler" && key != "doNotIntercept") {
199
+ for (var i in params[key]) {
200
+ qs.push(key + "=" + params[key][i]);
201
+ }
202
+ }
203
+ }
204
+ return "/solr/" + params.core + params.handler + "?" + qs.join("&");
205
+ }
206
+ return resource;
207
+ }])
208
+ .factory('Segments',
209
+ ['$resource', function($resource) {
210
+ return $resource('/solr/:core/admin/segments', {'wt':'json', core: '@core', _:Date.now()}, {
211
+ get: {}
212
+ });
213
+ }
214
+ ]);
@@ -1,342 +1,342 @@
1
- /*
2
-
3
- The MIT License (MIT)
4
- Copyright (c) 2012 Jon Rohan, James M. Greene,
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
-
24
- */
25
-
26
- // Simple Set Clipboard System
27
- // Author: Joseph Huckaby
28
-
29
- var ZeroClipboard = {
30
-
31
- version: "1.0.7",
32
- clients: {}, // registered upload clients on page, indexed by id
33
- moviePath: 'ZeroClipboard.swf', // URL to movie
34
- nextId: 1, // ID of next movie
35
-
36
- $: function(thingy) {
37
- // simple DOM lookup utility function
38
- if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
39
- if (!thingy.addClass) {
40
- // extend element with a few useful methods
41
- thingy.hide = function() { this.style.display = 'none'; };
42
- thingy.show = function() { this.style.display = ''; };
43
- thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
44
- thingy.removeClass = function(name) {
45
- var classes = this.className.split(/\s+/);
46
- var idx = -1;
47
- for (var k = 0; k < classes.length; k++) {
48
- if (classes[k] == name) { idx = k; k = classes.length; }
49
- }
50
- if (idx > -1) {
51
- classes.splice( idx, 1 );
52
- this.className = classes.join(' ');
53
- }
54
- return this;
55
- };
56
- thingy.hasClass = function(name) {
57
- return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
58
- };
59
- }
60
- return thingy;
61
- },
62
-
63
- setMoviePath: function(path) {
64
- // set path to ZeroClipboard.swf
65
- this.moviePath = path;
66
- },
67
-
68
- dispatch: function(id, eventName, args) {
69
- // receive event from flash movie, send to client
70
- var client = this.clients[id];
71
- if (client) {
72
- client.receiveEvent(eventName, args);
73
- }
74
- },
75
-
76
- register: function(id, client) {
77
- // register new client to receive events
78
- this.clients[id] = client;
79
- },
80
-
81
- getDOMObjectPosition: function(obj, stopObj) {
82
- // get absolute coordinates for dom element
83
- var info = {
84
- left: 0,
85
- top: 0,
86
- width: obj.width ? obj.width : obj.offsetWidth,
87
- height: obj.height ? obj.height : obj.offsetHeight
88
- };
89
-
90
- while (obj && (obj != stopObj)) {
91
- info.left += obj.offsetLeft;
92
- info.top += obj.offsetTop;
93
- obj = obj.offsetParent;
94
- }
95
-
96
- return info;
97
- },
98
-
99
- Client: function(elem) {
100
- // constructor for new simple upload client
101
- this.handlers = {};
102
-
103
- // unique ID
104
- this.id = ZeroClipboard.nextId++;
105
- this.movieId = 'ZeroClipboardMovie_' + this.id;
106
-
107
- // register client with singleton to receive flash events
108
- ZeroClipboard.register(this.id, this);
109
-
110
- // create movie
111
- if (elem) this.glue(elem);
112
- }
113
- };
114
-
115
- ZeroClipboard.Client.prototype = {
116
-
117
- id: 0, // unique ID for us
118
- ready: false, // whether movie is ready to receive events or not
119
- movie: null, // reference to movie object
120
- clipText: '', // text to copy to clipboard
121
- handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
122
- cssEffects: true, // enable CSS mouse effects on dom container
123
- handlers: null, // user event handlers
124
-
125
- glue: function(elem, appendElem, stylesToAdd) {
126
- // glue to DOM element
127
- // elem can be ID or actual DOM element object
128
- this.domElement = ZeroClipboard.$(elem);
129
-
130
- // float just above object, or zIndex 99 if dom element isn't set
131
- var zIndex = 99;
132
- if (this.domElement.style.zIndex) {
133
- zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
134
- }
135
-
136
- if (typeof(appendElem) == 'string') {
137
- appendElem = ZeroClipboard.$(appendElem);
138
- }
139
- else if (typeof(appendElem) == 'undefined') {
140
- appendElem = document.getElementsByTagName('body')[0];
141
- }
142
-
143
- // find X/Y position of domElement
144
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
145
-
146
- // create floating DIV above element
147
- this.div = document.createElement('div');
148
- var style = this.div.style;
149
- style.position = 'absolute';
150
- style.left = '' + box.left + 'px';
151
- style.top = '' + box.top + 'px';
152
- style.width = '' + box.width + 'px';
153
- style.height = '' + box.height + 'px';
154
- style.zIndex = zIndex;
155
-
156
- style.left = '0px';
157
- style.top = '0px';
158
-
159
- if (typeof(stylesToAdd) == 'object') {
160
- for (addedStyle in stylesToAdd) {
161
- style[addedStyle] = stylesToAdd[addedStyle];
162
- }
163
- }
164
-
165
- // style.backgroundColor = '#f00'; // debug
166
-
167
- appendElem.appendChild(this.div);
168
-
169
- this.div.innerHTML = this.getHTML( box.width, box.height );
170
- },
171
-
172
- getHTML: function(width, height) {
173
- // return HTML for movie
174
- var html = '';
175
- var flashvars = 'id=' + this.id +
176
- '&width=' + width +
177
- '&height=' + height;
178
-
179
- if (navigator.userAgent.match(/MSIE/)) {
180
- // IE gets an OBJECT tag
181
- var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
182
- html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
183
- }
184
- else {
185
- // all other browsers get an EMBED tag
186
- html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
187
- }
188
- return html;
189
- },
190
-
191
- hide: function() {
192
- // temporarily hide floater offscreen
193
- if (this.div) {
194
- this.div.style.left = '-2000px';
195
- }
196
- },
197
-
198
- show: function() {
199
- // show ourselves after a call to hide()
200
- this.reposition();
201
- },
202
-
203
- destroy: function() {
204
- // destroy control and floater
205
- if (this.domElement && this.div) {
206
- this.hide();
207
- this.div.innerHTML = '';
208
-
209
- var body = document.getElementsByTagName('body')[0];
210
- try { body.removeChild( this.div ); } catch(e) {;}
211
-
212
- this.domElement = null;
213
- this.div = null;
214
- }
215
- },
216
-
217
- reposition: function(elem) {
218
- // reposition our floating div, optionally to new container
219
- // warning: container CANNOT change size, only position
220
- if (elem) {
221
- this.domElement = ZeroClipboard.$(elem);
222
- if (!this.domElement) this.hide();
223
- }
224
-
225
- console.debug( this.domElement, this.div );
226
-
227
- if (this.domElement && this.div) {
228
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
229
- console.debug( box );
230
- var style = this.div.style;
231
- style.left = '' + box.left + 'px';
232
- style.top = '' + box.top + 'px';
233
- }
234
- },
235
-
236
- setText: function(newText) {
237
- // set text to be copied to clipboard
238
- this.clipText = newText;
239
- if (this.ready) this.movie.setText(newText);
240
- },
241
-
242
- addEventListener: function(eventName, func) {
243
- // add user event listener for event
244
- // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
245
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
246
- if (!this.handlers[eventName]) this.handlers[eventName] = [];
247
- this.handlers[eventName].push(func);
248
- },
249
-
250
- setHandCursor: function(enabled) {
251
- // enable hand cursor (true), or default arrow cursor (false)
252
- this.handCursorEnabled = enabled;
253
- if (this.ready) this.movie.setHandCursor(enabled);
254
- },
255
-
256
- setCSSEffects: function(enabled) {
257
- // enable or disable CSS effects on DOM container
258
- this.cssEffects = !!enabled;
259
- },
260
-
261
- receiveEvent: function(eventName, args) {
262
- // receive event from flash
263
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
264
-
265
- // special behavior for certain events
266
- switch (eventName) {
267
- case 'load':
268
- // movie claims it is ready, but in IE this isn't always the case...
269
- // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
270
- this.movie = document.getElementById(this.movieId);
271
- if (!this.movie) {
272
- var self = this;
273
- setTimeout( function() { self.receiveEvent('load', null); }, 1 );
274
- return;
275
- }
276
-
277
- // firefox on pc needs a "kick" in order to set these in certain cases
278
- if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
279
- var self = this;
280
- setTimeout( function() { self.receiveEvent('load', null); }, 100 );
281
- this.ready = true;
282
- return;
283
- }
284
-
285
- this.ready = true;
286
- this.movie.setText( this.clipText );
287
- this.movie.setHandCursor( this.handCursorEnabled );
288
- break;
289
-
290
- case 'mouseover':
291
- if (this.domElement && this.cssEffects) {
292
- this.domElement.addClass('hover');
293
- if (this.recoverActive) this.domElement.addClass('active');
294
- }
295
- break;
296
-
297
- case 'mouseout':
298
- if (this.domElement && this.cssEffects) {
299
- this.recoverActive = false;
300
- if (this.domElement.hasClass('active')) {
301
- this.domElement.removeClass('active');
302
- this.recoverActive = true;
303
- }
304
- this.domElement.removeClass('hover');
305
- }
306
- break;
307
-
308
- case 'mousedown':
309
- if (this.domElement && this.cssEffects) {
310
- this.domElement.addClass('active');
311
- }
312
- break;
313
-
314
- case 'mouseup':
315
- if (this.domElement && this.cssEffects) {
316
- this.domElement.removeClass('active');
317
- this.recoverActive = false;
318
- }
319
- break;
320
- } // switch eventName
321
-
322
- if (this.handlers[eventName]) {
323
- for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
324
- var func = this.handlers[eventName][idx];
325
-
326
- if (typeof(func) == 'function') {
327
- // actual function reference
328
- func(this, args);
329
- }
330
- else if ((typeof(func) == 'object') && (func.length == 2)) {
331
- // PHP style object + method, i.e. [myObject, 'myMethod']
332
- func[0][ func[1] ](this, args);
333
- }
334
- else if (typeof(func) == 'string') {
335
- // name of function
336
- window[func](this, args);
337
- }
338
- } // foreach event handler defined
339
- } // user defined handler for event
340
- }
341
-
342
- };
1
+ /*
2
+
3
+ The MIT License (MIT)
4
+ Copyright (c) 2012 Jon Rohan, James M. Greene,
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
+
24
+ */
25
+
26
+ // Simple Set Clipboard System
27
+ // Author: Joseph Huckaby
28
+
29
+ var ZeroClipboard = {
30
+
31
+ version: "1.0.7",
32
+ clients: {}, // registered upload clients on page, indexed by id
33
+ moviePath: 'ZeroClipboard.swf', // URL to movie
34
+ nextId: 1, // ID of next movie
35
+
36
+ $: function(thingy) {
37
+ // simple DOM lookup utility function
38
+ if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
39
+ if (!thingy.addClass) {
40
+ // extend element with a few useful methods
41
+ thingy.hide = function() { this.style.display = 'none'; };
42
+ thingy.show = function() { this.style.display = ''; };
43
+ thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
44
+ thingy.removeClass = function(name) {
45
+ var classes = this.className.split(/\s+/);
46
+ var idx = -1;
47
+ for (var k = 0; k < classes.length; k++) {
48
+ if (classes[k] == name) { idx = k; k = classes.length; }
49
+ }
50
+ if (idx > -1) {
51
+ classes.splice( idx, 1 );
52
+ this.className = classes.join(' ');
53
+ }
54
+ return this;
55
+ };
56
+ thingy.hasClass = function(name) {
57
+ return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
58
+ };
59
+ }
60
+ return thingy;
61
+ },
62
+
63
+ setMoviePath: function(path) {
64
+ // set path to ZeroClipboard.swf
65
+ this.moviePath = path;
66
+ },
67
+
68
+ dispatch: function(id, eventName, args) {
69
+ // receive event from flash movie, send to client
70
+ var client = this.clients[id];
71
+ if (client) {
72
+ client.receiveEvent(eventName, args);
73
+ }
74
+ },
75
+
76
+ register: function(id, client) {
77
+ // register new client to receive events
78
+ this.clients[id] = client;
79
+ },
80
+
81
+ getDOMObjectPosition: function(obj, stopObj) {
82
+ // get absolute coordinates for dom element
83
+ var info = {
84
+ left: 0,
85
+ top: 0,
86
+ width: obj.width ? obj.width : obj.offsetWidth,
87
+ height: obj.height ? obj.height : obj.offsetHeight
88
+ };
89
+
90
+ while (obj && (obj != stopObj)) {
91
+ info.left += obj.offsetLeft;
92
+ info.top += obj.offsetTop;
93
+ obj = obj.offsetParent;
94
+ }
95
+
96
+ return info;
97
+ },
98
+
99
+ Client: function(elem) {
100
+ // constructor for new simple upload client
101
+ this.handlers = {};
102
+
103
+ // unique ID
104
+ this.id = ZeroClipboard.nextId++;
105
+ this.movieId = 'ZeroClipboardMovie_' + this.id;
106
+
107
+ // register client with singleton to receive flash events
108
+ ZeroClipboard.register(this.id, this);
109
+
110
+ // create movie
111
+ if (elem) this.glue(elem);
112
+ }
113
+ };
114
+
115
+ ZeroClipboard.Client.prototype = {
116
+
117
+ id: 0, // unique ID for us
118
+ ready: false, // whether movie is ready to receive events or not
119
+ movie: null, // reference to movie object
120
+ clipText: '', // text to copy to clipboard
121
+ handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
122
+ cssEffects: true, // enable CSS mouse effects on dom container
123
+ handlers: null, // user event handlers
124
+
125
+ glue: function(elem, appendElem, stylesToAdd) {
126
+ // glue to DOM element
127
+ // elem can be ID or actual DOM element object
128
+ this.domElement = ZeroClipboard.$(elem);
129
+
130
+ // float just above object, or zIndex 99 if dom element isn't set
131
+ var zIndex = 99;
132
+ if (this.domElement.style.zIndex) {
133
+ zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
134
+ }
135
+
136
+ if (typeof(appendElem) == 'string') {
137
+ appendElem = ZeroClipboard.$(appendElem);
138
+ }
139
+ else if (typeof(appendElem) == 'undefined') {
140
+ appendElem = document.getElementsByTagName('body')[0];
141
+ }
142
+
143
+ // find X/Y position of domElement
144
+ var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
145
+
146
+ // create floating DIV above element
147
+ this.div = document.createElement('div');
148
+ var style = this.div.style;
149
+ style.position = 'absolute';
150
+ style.left = '' + box.left + 'px';
151
+ style.top = '' + box.top + 'px';
152
+ style.width = '' + box.width + 'px';
153
+ style.height = '' + box.height + 'px';
154
+ style.zIndex = zIndex;
155
+
156
+ style.left = '0px';
157
+ style.top = '0px';
158
+
159
+ if (typeof(stylesToAdd) == 'object') {
160
+ for (addedStyle in stylesToAdd) {
161
+ style[addedStyle] = stylesToAdd[addedStyle];
162
+ }
163
+ }
164
+
165
+ // style.backgroundColor = '#f00'; // debug
166
+
167
+ appendElem.appendChild(this.div);
168
+
169
+ this.div.innerHTML = this.getHTML( box.width, box.height );
170
+ },
171
+
172
+ getHTML: function(width, height) {
173
+ // return HTML for movie
174
+ var html = '';
175
+ var flashvars = 'id=' + this.id +
176
+ '&width=' + width +
177
+ '&height=' + height;
178
+
179
+ if (navigator.userAgent.match(/MSIE/)) {
180
+ // IE gets an OBJECT tag
181
+ var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
182
+ html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
183
+ }
184
+ else {
185
+ // all other browsers get an EMBED tag
186
+ html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
187
+ }
188
+ return html;
189
+ },
190
+
191
+ hide: function() {
192
+ // temporarily hide floater offscreen
193
+ if (this.div) {
194
+ this.div.style.left = '-2000px';
195
+ }
196
+ },
197
+
198
+ show: function() {
199
+ // show ourselves after a call to hide()
200
+ this.reposition();
201
+ },
202
+
203
+ destroy: function() {
204
+ // destroy control and floater
205
+ if (this.domElement && this.div) {
206
+ this.hide();
207
+ this.div.innerHTML = '';
208
+
209
+ var body = document.getElementsByTagName('body')[0];
210
+ try { body.removeChild( this.div ); } catch(e) {;}
211
+
212
+ this.domElement = null;
213
+ this.div = null;
214
+ }
215
+ },
216
+
217
+ reposition: function(elem) {
218
+ // reposition our floating div, optionally to new container
219
+ // warning: container CANNOT change size, only position
220
+ if (elem) {
221
+ this.domElement = ZeroClipboard.$(elem);
222
+ if (!this.domElement) this.hide();
223
+ }
224
+
225
+ console.debug( this.domElement, this.div );
226
+
227
+ if (this.domElement && this.div) {
228
+ var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
229
+ console.debug( box );
230
+ var style = this.div.style;
231
+ style.left = '' + box.left + 'px';
232
+ style.top = '' + box.top + 'px';
233
+ }
234
+ },
235
+
236
+ setText: function(newText) {
237
+ // set text to be copied to clipboard
238
+ this.clipText = newText;
239
+ if (this.ready) this.movie.setText(newText);
240
+ },
241
+
242
+ addEventListener: function(eventName, func) {
243
+ // add user event listener for event
244
+ // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
245
+ eventName = eventName.toString().toLowerCase().replace(/^on/, '');
246
+ if (!this.handlers[eventName]) this.handlers[eventName] = [];
247
+ this.handlers[eventName].push(func);
248
+ },
249
+
250
+ setHandCursor: function(enabled) {
251
+ // enable hand cursor (true), or default arrow cursor (false)
252
+ this.handCursorEnabled = enabled;
253
+ if (this.ready) this.movie.setHandCursor(enabled);
254
+ },
255
+
256
+ setCSSEffects: function(enabled) {
257
+ // enable or disable CSS effects on DOM container
258
+ this.cssEffects = !!enabled;
259
+ },
260
+
261
+ receiveEvent: function(eventName, args) {
262
+ // receive event from flash
263
+ eventName = eventName.toString().toLowerCase().replace(/^on/, '');
264
+
265
+ // special behavior for certain events
266
+ switch (eventName) {
267
+ case 'load':
268
+ // movie claims it is ready, but in IE this isn't always the case...
269
+ // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
270
+ this.movie = document.getElementById(this.movieId);
271
+ if (!this.movie) {
272
+ var self = this;
273
+ setTimeout( function() { self.receiveEvent('load', null); }, 1 );
274
+ return;
275
+ }
276
+
277
+ // firefox on pc needs a "kick" in order to set these in certain cases
278
+ if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
279
+ var self = this;
280
+ setTimeout( function() { self.receiveEvent('load', null); }, 100 );
281
+ this.ready = true;
282
+ return;
283
+ }
284
+
285
+ this.ready = true;
286
+ this.movie.setText( this.clipText );
287
+ this.movie.setHandCursor( this.handCursorEnabled );
288
+ break;
289
+
290
+ case 'mouseover':
291
+ if (this.domElement && this.cssEffects) {
292
+ this.domElement.addClass('hover');
293
+ if (this.recoverActive) this.domElement.addClass('active');
294
+ }
295
+ break;
296
+
297
+ case 'mouseout':
298
+ if (this.domElement && this.cssEffects) {
299
+ this.recoverActive = false;
300
+ if (this.domElement.hasClass('active')) {
301
+ this.domElement.removeClass('active');
302
+ this.recoverActive = true;
303
+ }
304
+ this.domElement.removeClass('hover');
305
+ }
306
+ break;
307
+
308
+ case 'mousedown':
309
+ if (this.domElement && this.cssEffects) {
310
+ this.domElement.addClass('active');
311
+ }
312
+ break;
313
+
314
+ case 'mouseup':
315
+ if (this.domElement && this.cssEffects) {
316
+ this.domElement.removeClass('active');
317
+ this.recoverActive = false;
318
+ }
319
+ break;
320
+ } // switch eventName
321
+
322
+ if (this.handlers[eventName]) {
323
+ for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
324
+ var func = this.handlers[eventName][idx];
325
+
326
+ if (typeof(func) == 'function') {
327
+ // actual function reference
328
+ func(this, args);
329
+ }
330
+ else if ((typeof(func) == 'object') && (func.length == 2)) {
331
+ // PHP style object + method, i.e. [myObject, 'myMethod']
332
+ func[0][ func[1] ](this, args);
333
+ }
334
+ else if (typeof(func) == 'string') {
335
+ // name of function
336
+ window[func](this, args);
337
+ }
338
+ } // foreach event handler defined
339
+ } // user defined handler for event
340
+ }
341
+
342
+ };