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.
- checksums.yaml +4 -4
- data/bin/sunspot-solr +2 -6
- data/lib/sunspot/solr/server.rb +2 -3
- data/solr/README.txt +181 -181
- data/solr/bin/post +29 -19
- data/solr/bin/solr +247 -428
- data/solr/bin/solr.cmd +102 -256
- data/solr/bin/solr.in.cmd +15 -7
- data/solr/bin/solr.in.sh +26 -12
- data/solr/server/README.txt +110 -113
- data/solr/server/contexts/solr-jetty-context.xml +8 -8
- data/solr/server/etc/jetty-http.xml +47 -0
- data/solr/server/etc/jetty-https-ssl.xml +175 -159
- data/solr/server/etc/jetty-https.xml +53 -0
- data/solr/server/etc/jetty-ssl.xml +46 -0
- data/solr/server/etc/jetty.xml +189 -167
- data/solr/server/etc/webdefault.xml +527 -527
- data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
- data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
- data/solr/server/modules/http.mod +9 -0
- data/solr/server/modules/https.mod +9 -0
- data/solr/server/modules/server.mod +11 -0
- data/solr/server/modules/ssl.mod +9 -0
- data/solr/server/resources/jetty-logging.properties +1 -0
- data/solr/server/resources/log4j.properties +24 -24
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
- 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
- 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
- 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
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
- data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
- data/solr/server/solr-webapp/webapp/admin.html +164 -163
- data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
- data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
- data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
- data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
- data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
- data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
- data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
- data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
- data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
- data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
- data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
- data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
- data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
- data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
- data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
- data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
- data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
- data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
- data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
- data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
- data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
- data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
- data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
- data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
- data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
- data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
- data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
- data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
- data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
- data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
- data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
- data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
- data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
- data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
- data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
- data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
- data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
- data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
- data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
- data/solr/server/solr-webapp/webapp/index.html +208 -0
- data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
- data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
- data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
- data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
- data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
- data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
- data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
- data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
- data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
- data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
- data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
- data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
- data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
- data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
- data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
- data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
- data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
- data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
- data/solr/server/solr-webapp/webapp/js/main.js +60 -58
- data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
- data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
- data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
- data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
- data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
- data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
- data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
- data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
- data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
- data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
- data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
- data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
- data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
- data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
- data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
- data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
- data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
- data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
- data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
- data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
- data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
- data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
- data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
- data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
- data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
- data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
- data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
- data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
- data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
- data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
- data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
- data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
- data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
- data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
- data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
- data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
- data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
- data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
- data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
- data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
- data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
- data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
- data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
- data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
- data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
- data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
- data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
- data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
- data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
- data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
- data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
- data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
- data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
- data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
- data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
- data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
- data/solr/server/solr/README.txt +77 -77
- data/solr/server/solr/solr.xml +51 -51
- data/solr/server/solr/zoo.cfg +17 -17
- data/solr/server/start.jar +0 -0
- data/spec/server_spec.rb +3 -8
- metadata +132 -43
- data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/servlet-api-3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/.gitignore +0 -1
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
- data/solr/server/webapps/solr.war +0 -0
@@ -1,1229 +1,1229 @@
|
|
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 current_core = null;
|
19
|
-
var cookie_schema_browser_autoload = 'schema-browser_autoload';
|
20
|
-
|
21
|
-
var luke_array_to_struct = function( array )
|
22
|
-
{
|
23
|
-
var struct = {
|
24
|
-
keys : [],
|
25
|
-
values : []
|
26
|
-
};
|
27
|
-
for( var i = 0; i < array.length; i += 2 )
|
28
|
-
{
|
29
|
-
struct.keys.push( array[i] );
|
30
|
-
struct.values.push( array[i+1] );
|
31
|
-
}
|
32
|
-
return struct;
|
33
|
-
}
|
34
|
-
|
35
|
-
var luke_array_to_hash = function( array )
|
36
|
-
{
|
37
|
-
var hash = {};
|
38
|
-
for( var i = 0; i < array.length; i += 2 )
|
39
|
-
{
|
40
|
-
hash[ array[i] ] = array[i+1];
|
41
|
-
}
|
42
|
-
return hash;
|
43
|
-
}
|
44
|
-
|
45
|
-
var load_terminfo = function( trigger_element, core_basepath, field, data_element, terminfo_element )
|
46
|
-
{
|
47
|
-
var luke_url = core_basepath + '/admin/luke?wt=json&fl=' + field;
|
48
|
-
var topterms_count_element = $( '.topterms-holder .head input', terminfo_element );
|
49
|
-
|
50
|
-
var term_load_count = parseInt( topterms_count_element.val(), 10 );
|
51
|
-
if( term_load_count )
|
52
|
-
{
|
53
|
-
luke_url += '&numTerms=' + term_load_count;
|
54
|
-
}
|
55
|
-
|
56
|
-
$.ajax
|
57
|
-
(
|
58
|
-
{
|
59
|
-
url : luke_url,
|
60
|
-
dataType : 'json',
|
61
|
-
context : terminfo_element,
|
62
|
-
beforeSend : function( xhr, settings )
|
63
|
-
{
|
64
|
-
$( 'span', trigger_element )
|
65
|
-
.addClass( 'loader' );
|
66
|
-
},
|
67
|
-
success : function( response, text_status, xhr )
|
68
|
-
{
|
69
|
-
var additional_styles = [];
|
70
|
-
var field_data = response.fields[field];
|
71
|
-
|
72
|
-
if( !field_data || !( field_data.topTerms && field_data.histogram ) )
|
73
|
-
{
|
74
|
-
terminfo_element
|
75
|
-
.addClass( 'disabled' );
|
76
|
-
|
77
|
-
return false;
|
78
|
-
}
|
79
|
-
|
80
|
-
var get_width = function get_width()
|
81
|
-
{
|
82
|
-
return $( this ).width();
|
83
|
-
}
|
84
|
-
|
85
|
-
var topterms_holder_element = $( '.topterms-holder', data_element );
|
86
|
-
var histogram_holder_element = $( '.histogram-holder', data_element );
|
87
|
-
|
88
|
-
if( !field_data.topTerms )
|
89
|
-
{
|
90
|
-
topterms_holder_element
|
91
|
-
.hide();
|
92
|
-
}
|
93
|
-
else
|
94
|
-
{
|
95
|
-
topterms_holder_element
|
96
|
-
.show();
|
97
|
-
|
98
|
-
var topterms_table_element = $( 'ul', topterms_holder_element );
|
99
|
-
|
100
|
-
var topterms = field_data.topTerms;
|
101
|
-
var topterms_count = topterms.length;
|
102
|
-
|
103
|
-
var topterms_content = '';
|
104
|
-
var topterms_frq_last = null;
|
105
|
-
|
106
|
-
for( var i = 0; i < topterms_count; i += 2 )
|
107
|
-
{
|
108
|
-
if( topterms_frq_last !== topterms[i+1] )
|
109
|
-
{
|
110
|
-
if( topterms_frq_last )
|
111
|
-
{
|
112
|
-
topterms_content += '</ul></li>' + "\n";
|
113
|
-
}
|
114
|
-
|
115
|
-
topterms_frq_last = topterms[i+1];
|
116
|
-
topterms_content += '<li class="clearfix">'
|
117
|
-
+ '<p><span>' + app.format_number( topterms_frq_last ) + '</span></p>' + "\n"
|
118
|
-
+ '<ul>' + "\n";
|
119
|
-
}
|
120
|
-
|
121
|
-
var target = '#/' + current_core + '/query?q=' + field.esc() + ':' + encodeURIComponent( '"' + topterms[i] + '"' );
|
122
|
-
topterms_content += '<li><a href="' + target + '">' + topterms[i].esc() + '</a></li>' + "\n";
|
123
|
-
}
|
124
|
-
|
125
|
-
topterms_content += '</li>';
|
126
|
-
|
127
|
-
topterms_count = topterms_count / 2;
|
128
|
-
|
129
|
-
$( 'input', trigger_element )
|
130
|
-
.val( topterms_count );
|
131
|
-
|
132
|
-
topterms_table_element
|
133
|
-
.html( topterms_content );
|
134
|
-
|
135
|
-
var max_width = 10 + Math.max.apply( Math, $( 'p', topterms_table_element ).map( get_width ).get() );
|
136
|
-
additional_styles.push
|
137
|
-
(
|
138
|
-
topterms_table_element.selector + ' p { width: ' + max_width + 'px !important; }' + "\n" +
|
139
|
-
topterms_table_element.selector + ' ul { margin-left: ' + ( max_width + 5 ) + 'px !important; }'
|
140
|
-
);
|
141
|
-
|
142
|
-
topterms_count_element
|
143
|
-
.val( topterms_count );
|
144
|
-
|
145
|
-
$( 'p.head .max', topterms_holder_element )
|
146
|
-
.html( field_data.distinct );
|
147
|
-
|
148
|
-
$( 'p.head #query_link', topterms_holder_element )
|
149
|
-
.attr( 'href', '#/' + current_core + '/query?q=' + field.esc() + ':[* TO *]' );
|
150
|
-
|
151
|
-
$( 'ul li:even', topterms_table_element )
|
152
|
-
.addClass( 'odd' );
|
153
|
-
}
|
154
|
-
|
155
|
-
if( !field_data.histogram )
|
156
|
-
{
|
157
|
-
histogram_holder_element
|
158
|
-
.hide();
|
159
|
-
}
|
160
|
-
else
|
161
|
-
{
|
162
|
-
histogram_holder_element
|
163
|
-
.show();
|
164
|
-
|
165
|
-
var histogram_values = luke_array_to_hash( field_data.histogram );
|
166
|
-
var histogram_entries = [];
|
167
|
-
|
168
|
-
var histogram_max = null;
|
169
|
-
for( var key in histogram_values )
|
170
|
-
{
|
171
|
-
histogram_max = Math.max( histogram_max, histogram_values[key] );
|
172
|
-
}
|
173
|
-
|
174
|
-
for( var key in histogram_values )
|
175
|
-
{
|
176
|
-
histogram_entries.push
|
177
|
-
(
|
178
|
-
'<li>' + "\n" +
|
179
|
-
' <dl class="clearfix" style="width: ' + ( ( histogram_values[key] / histogram_max ) * 100 ) + '%;">' + "\n" +
|
180
|
-
' <dt><span>' + app.format_number( key ) + '</span></dt>' + "\n" +
|
181
|
-
' <dd><span>' + app.format_number( histogram_values[key] ) + '</span></dd>' + "\n" +
|
182
|
-
' </dl>' + "\n" +
|
183
|
-
'</li>'
|
184
|
-
);
|
185
|
-
}
|
186
|
-
|
187
|
-
$( 'ul', histogram_holder_element )
|
188
|
-
.html( histogram_entries.join( "\n" ) );
|
189
|
-
|
190
|
-
$( 'ul li:even', histogram_holder_element )
|
191
|
-
.addClass( 'odd' );
|
192
|
-
|
193
|
-
var max_width = 10 + Math.max.apply( Math, $( 'dt', histogram_holder_element ).map( get_width ).get() );
|
194
|
-
additional_styles.push
|
195
|
-
(
|
196
|
-
histogram_holder_element.selector + ' ul { margin-left: ' + max_width + 'px !important; }' + "\n" +
|
197
|
-
histogram_holder_element.selector + ' li dt { left: ' + ( max_width * -1 ) + 'px !important; width: ' + max_width + 'px !important; }'
|
198
|
-
);
|
199
|
-
}
|
200
|
-
|
201
|
-
if( additional_styles )
|
202
|
-
{
|
203
|
-
terminfo_element
|
204
|
-
.prepend( '<style type="text/css">' + additional_styles.join( "\n" ) + '</style>' );
|
205
|
-
}
|
206
|
-
},
|
207
|
-
error : function( xhr, text_status, error_thrown)
|
208
|
-
{
|
209
|
-
terminfo_element
|
210
|
-
.addClass( 'disabled' );
|
211
|
-
},
|
212
|
-
complete : function( xhr, text_status )
|
213
|
-
{
|
214
|
-
$( 'span', trigger_element )
|
215
|
-
.removeClass( 'loader' );
|
216
|
-
}
|
217
|
-
}
|
218
|
-
);
|
219
|
-
}
|
220
|
-
|
221
|
-
sammy.bind
|
222
|
-
(
|
223
|
-
'schema_browser_navi',
|
224
|
-
function( event, params )
|
225
|
-
{
|
226
|
-
var related_navigation_element = $( '#related dl#f-df-t', params.schema_browser_element );
|
227
|
-
var related_navigation_meta = $( '#related dl.ukf-dsf', params.schema_browser_element );
|
228
|
-
var related_select_element = $( '#related select', params.schema_browser_element )
|
229
|
-
var type = 'index';
|
230
|
-
|
231
|
-
var sammy_basepath = app.core_menu.find( '.active a' ).attr( 'href' );
|
232
|
-
|
233
|
-
if( !related_navigation_meta.hasClass( 'done' ) )
|
234
|
-
{
|
235
|
-
if( app.schema_browser_data.unique_key_field )
|
236
|
-
{
|
237
|
-
$( '.unique-key-field', related_navigation_meta )
|
238
|
-
.show()
|
239
|
-
.after
|
240
|
-
(
|
241
|
-
'<dd class="unique-key-field"><a href="' + sammy_basepath + '?field=' +
|
242
|
-
app.schema_browser_data.unique_key_field + '">' +
|
243
|
-
app.schema_browser_data.unique_key_field + '</a></dd>'
|
244
|
-
);
|
245
|
-
}
|
246
|
-
|
247
|
-
if( app.schema_browser_data.default_search_field )
|
248
|
-
{
|
249
|
-
$( '.default-search-field', related_navigation_meta )
|
250
|
-
.show()
|
251
|
-
.after
|
252
|
-
(
|
253
|
-
'<dd class="default-search-field"><a href="' + sammy_basepath + '?field=' +
|
254
|
-
app.schema_browser_data.default_search_field + '">' +
|
255
|
-
app.schema_browser_data.default_search_field + '</a></dd>'
|
256
|
-
);
|
257
|
-
}
|
258
|
-
|
259
|
-
related_navigation_meta
|
260
|
-
.addClass( 'done' );
|
261
|
-
}
|
262
|
-
|
263
|
-
if( params.route_params )
|
264
|
-
{
|
265
|
-
var type = params.route_params.type;
|
266
|
-
var value = params.route_params.value;
|
267
|
-
|
268
|
-
var navigation_data = {
|
269
|
-
'fields' : [],
|
270
|
-
'copyfield_source' : [],
|
271
|
-
'copyfield_dest' : [],
|
272
|
-
'dynamic_fields' : [],
|
273
|
-
'types' : []
|
274
|
-
}
|
275
|
-
|
276
|
-
$( 'option[value="' + params.route_params.path + '"]', related_select_element )
|
277
|
-
.attr( 'selected', 'selected' );
|
278
|
-
|
279
|
-
related_select_element
|
280
|
-
.trigger( 'liszt:updated' );
|
281
|
-
|
282
|
-
if( 'field' === type )
|
283
|
-
{
|
284
|
-
navigation_data.fields.push( value );
|
285
|
-
|
286
|
-
if( app.schema_browser_data.relations.f_t[value] )
|
287
|
-
{
|
288
|
-
navigation_data.types.push( app.schema_browser_data.relations.f_t[value] );
|
289
|
-
}
|
290
|
-
|
291
|
-
if( app.schema_browser_data.relations.f_df[value] )
|
292
|
-
{
|
293
|
-
navigation_data.dynamic_fields.push( app.schema_browser_data.relations.f_df[value] );
|
294
|
-
}
|
295
|
-
|
296
|
-
if( app.schema_browser_data.fields[value].copySources && 0 !== app.schema_browser_data.fields[value].copySources.length )
|
297
|
-
{
|
298
|
-
navigation_data.copyfield_source = app.schema_browser_data.fields[value].copySources;
|
299
|
-
}
|
300
|
-
|
301
|
-
if( app.schema_browser_data.fields[value].copyDests && 0 !== app.schema_browser_data.fields[value].copyDests.length )
|
302
|
-
{
|
303
|
-
navigation_data.copyfield_dest = app.schema_browser_data.fields[value].copyDests;
|
304
|
-
}
|
305
|
-
}
|
306
|
-
else if( 'dynamic-field' === type )
|
307
|
-
{
|
308
|
-
navigation_data.dynamic_fields.push( value );
|
309
|
-
navigation_data.types.push( app.schema_browser_data.relations.df_t[value] );
|
310
|
-
|
311
|
-
if( app.schema_browser_data.relations.df_f[value] )
|
312
|
-
{
|
313
|
-
navigation_data.fields = app.schema_browser_data.relations.df_f[value];
|
314
|
-
}
|
315
|
-
}
|
316
|
-
else if( 'type' === type )
|
317
|
-
{
|
318
|
-
navigation_data.types.push( value );
|
319
|
-
|
320
|
-
if( app.schema_browser_data.relations.t_f[value] )
|
321
|
-
{
|
322
|
-
navigation_data.fields = app.schema_browser_data.relations.t_f[value];
|
323
|
-
}
|
324
|
-
|
325
|
-
if( app.schema_browser_data.relations.t_df[value] )
|
326
|
-
{
|
327
|
-
navigation_data.dynamic_fields = app.schema_browser_data.relations.t_df[value];
|
328
|
-
}
|
329
|
-
}
|
330
|
-
|
331
|
-
var navigation_content = '';
|
332
|
-
|
333
|
-
if( 0 !== navigation_data.fields.length )
|
334
|
-
{
|
335
|
-
navigation_data.fields.sort();
|
336
|
-
navigation_content += '<dt class="field">Field</dt>' + "\n";
|
337
|
-
for( var i in navigation_data.fields )
|
338
|
-
{
|
339
|
-
var href = sammy_basepath + '?field=' + navigation_data.fields[i];
|
340
|
-
navigation_content += '<dd class="field"><a href="' + href + '">' + navigation_data.fields[i] + '</a></dd>' + "\n";
|
341
|
-
}
|
342
|
-
}
|
343
|
-
|
344
|
-
if( 0 !== navigation_data.copyfield_source.length )
|
345
|
-
{
|
346
|
-
navigation_data.copyfield_source.sort();
|
347
|
-
navigation_content += '<dt class="copyfield">Copied from</dt>' + "\n";
|
348
|
-
for( var i in navigation_data.copyfield_source )
|
349
|
-
{
|
350
|
-
var href = sammy_basepath + '?field=' + navigation_data.copyfield_source[i];
|
351
|
-
navigation_content += '<dd class="copyfield"><a href="' + href + '">' + navigation_data.copyfield_source[i] + '</a></dd>' + "\n";
|
352
|
-
}
|
353
|
-
}
|
354
|
-
|
355
|
-
if( 0 !== navigation_data.copyfield_dest.length )
|
356
|
-
{
|
357
|
-
navigation_data.copyfield_dest.sort();
|
358
|
-
navigation_content += '<dt class="copyfield">Copied to</dt>' + "\n";
|
359
|
-
for( var i in navigation_data.copyfield_dest )
|
360
|
-
{
|
361
|
-
var href = sammy_basepath + '?field=' + navigation_data.copyfield_dest[i];
|
362
|
-
navigation_content += '<dd class="copyfield"><a href="' + href + '">' + navigation_data.copyfield_dest[i] + '</a></dd>' + "\n";
|
363
|
-
}
|
364
|
-
}
|
365
|
-
|
366
|
-
if( 0 !== navigation_data.dynamic_fields.length )
|
367
|
-
{
|
368
|
-
navigation_data.dynamic_fields.sort();
|
369
|
-
navigation_content += '<dt class="dynamic-field">Dynamic Field</dt>' + "\n";
|
370
|
-
for( var i in navigation_data.dynamic_fields )
|
371
|
-
{
|
372
|
-
var href = sammy_basepath + '?dynamic-field=' + navigation_data.dynamic_fields[i];
|
373
|
-
navigation_content += '<dd class="dynamic-field"><a href="' + href + '">' + navigation_data.dynamic_fields[i] + '</a></dd>' + "\n";
|
374
|
-
}
|
375
|
-
}
|
376
|
-
|
377
|
-
if( 0 !== navigation_data.types.length )
|
378
|
-
{
|
379
|
-
navigation_data.types.sort();
|
380
|
-
navigation_content += '<dt class="type">Type</dt>' + "\n";
|
381
|
-
for( var i in navigation_data.types )
|
382
|
-
{
|
383
|
-
var href = sammy_basepath + '?type=' + navigation_data.types[i];
|
384
|
-
navigation_content += '<dd class="type"><a href="' + href + '">' + navigation_data.types[i] + '</a></dd>' + "\n";
|
385
|
-
}
|
386
|
-
}
|
387
|
-
|
388
|
-
related_navigation_element
|
389
|
-
.show()
|
390
|
-
.attr( 'class', type )
|
391
|
-
.html( navigation_content );
|
392
|
-
}
|
393
|
-
else
|
394
|
-
{
|
395
|
-
related_navigation_element
|
396
|
-
.hide();
|
397
|
-
|
398
|
-
$( 'option:selected', related_select_element )
|
399
|
-
.removeAttr( 'selected' );
|
400
|
-
}
|
401
|
-
|
402
|
-
if( 'field' === type && value === app.schema_browser_data.unique_key_field )
|
403
|
-
{
|
404
|
-
$( '.unique-key-field', related_navigation_meta )
|
405
|
-
.addClass( 'active' );
|
406
|
-
}
|
407
|
-
else
|
408
|
-
{
|
409
|
-
$( '.unique-key-field', related_navigation_meta )
|
410
|
-
.removeClass( 'active' );
|
411
|
-
}
|
412
|
-
|
413
|
-
if( 'field' === type && value === app.schema_browser_data.default_search_field )
|
414
|
-
{
|
415
|
-
$( '.default-search-field', related_navigation_meta )
|
416
|
-
.addClass( 'active' );
|
417
|
-
}
|
418
|
-
else
|
419
|
-
{
|
420
|
-
$( '.default-search-field', related_navigation_meta )
|
421
|
-
.removeClass( 'active' );
|
422
|
-
}
|
423
|
-
|
424
|
-
if( params.callback )
|
425
|
-
{
|
426
|
-
params.callback( app.schema_browser_data, $( '#data', params.schema_browser_element ) );
|
427
|
-
}
|
428
|
-
}
|
429
|
-
);
|
430
|
-
|
431
|
-
sammy.bind
|
432
|
-
(
|
433
|
-
'schema_browser_load',
|
434
|
-
function( event, params )
|
435
|
-
{
|
436
|
-
var core_basepath = params.active_core.attr( 'data-basepath' );
|
437
|
-
var content_element = $( '#content' );
|
438
|
-
|
439
|
-
if( app.schema_browser_data )
|
440
|
-
{
|
441
|
-
params.schema_browser_element = $( '#schema-browser', content_element );
|
442
|
-
|
443
|
-
sammy.trigger
|
444
|
-
(
|
445
|
-
'schema_browser_navi',
|
446
|
-
params
|
447
|
-
);
|
448
|
-
}
|
449
|
-
else
|
450
|
-
{
|
451
|
-
content_element
|
452
|
-
.html( '<div id="schema-browser"><div class="loader">Loading ...</div></div>' );
|
453
|
-
|
454
|
-
$.ajax
|
455
|
-
(
|
456
|
-
{
|
457
|
-
url : core_basepath + '/admin/luke?numTerms=0&wt=json',
|
458
|
-
dataType : 'json',
|
459
|
-
beforeSend : function( xhr, settings )
|
460
|
-
{
|
461
|
-
},
|
462
|
-
success : function( response, text_status, xhr )
|
463
|
-
{
|
464
|
-
app.schema_browser_data = {
|
465
|
-
default_search_field : null,
|
466
|
-
unique_key_field : null,
|
467
|
-
key : {},
|
468
|
-
fields : {},
|
469
|
-
dynamic_fields : {},
|
470
|
-
types : {},
|
471
|
-
relations : {
|
472
|
-
f_df : {},
|
473
|
-
f_t : {},
|
474
|
-
df_f : {},
|
475
|
-
df_t : {},
|
476
|
-
t_f : {},
|
477
|
-
t_df : {}
|
478
|
-
}
|
479
|
-
};
|
480
|
-
|
481
|
-
app.schema_browser_data.fields = response.fields;
|
482
|
-
app.schema_browser_data.key = response.info.key;
|
483
|
-
|
484
|
-
$.ajax
|
485
|
-
(
|
486
|
-
{
|
487
|
-
url : core_basepath + '/admin/luke?show=schema&wt=json',
|
488
|
-
dataType : 'json',
|
489
|
-
beforeSend : function( xhr, settings )
|
490
|
-
{
|
491
|
-
},
|
492
|
-
success : function( response, text_status, xhr )
|
493
|
-
{
|
494
|
-
app.schema_browser_data.default_search_field = response.schema.defaultSearchField;
|
495
|
-
app.schema_browser_data.unique_key_field = response.schema.uniqueKeyField;
|
496
|
-
|
497
|
-
app.schema_browser_data.dynamic_fields = response.schema.dynamicFields;
|
498
|
-
app.schema_browser_data.types = response.schema.types;
|
499
|
-
|
500
|
-
for( var field in response.schema.fields )
|
501
|
-
{
|
502
|
-
app.schema_browser_data.fields[field] = $.extend
|
503
|
-
(
|
504
|
-
{},
|
505
|
-
app.schema_browser_data.fields[field],
|
506
|
-
response.schema.fields[field]
|
507
|
-
);
|
508
|
-
}
|
509
|
-
|
510
|
-
for( var field in app.schema_browser_data.fields )
|
511
|
-
{
|
512
|
-
var copy_dests = app.schema_browser_data.fields[field].copyDests;
|
513
|
-
for( var i in copy_dests )
|
514
|
-
{
|
515
|
-
var copy_dest = copy_dests[i];
|
516
|
-
if( !app.schema_browser_data.fields[copy_dest] )
|
517
|
-
{
|
518
|
-
app.schema_browser_data.fields[copy_dest] = {
|
519
|
-
partial : true,
|
520
|
-
copySources : []
|
521
|
-
};
|
522
|
-
}
|
523
|
-
|
524
|
-
if( app.schema_browser_data.fields[copy_dest].partial )
|
525
|
-
{
|
526
|
-
app.schema_browser_data.fields[copy_dest].copySources.push( field );
|
527
|
-
}
|
528
|
-
}
|
529
|
-
|
530
|
-
var copy_sources = app.schema_browser_data.fields[field].copySources;
|
531
|
-
for( var i in copy_sources )
|
532
|
-
{
|
533
|
-
var copy_source = copy_sources[i];
|
534
|
-
if( !app.schema_browser_data.fields[copy_source] )
|
535
|
-
{
|
536
|
-
app.schema_browser_data.fields[copy_source] = {
|
537
|
-
partial : true,
|
538
|
-
copyDests : []
|
539
|
-
};
|
540
|
-
}
|
541
|
-
|
542
|
-
if( app.schema_browser_data.fields[copy_source].partial )
|
543
|
-
{
|
544
|
-
app.schema_browser_data.fields[copy_source].copyDests.push( field );
|
545
|
-
}
|
546
|
-
}
|
547
|
-
|
548
|
-
app.schema_browser_data.relations.f_t[field] = app.schema_browser_data.fields[field].type;
|
549
|
-
|
550
|
-
if( !app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type] )
|
551
|
-
{
|
552
|
-
app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type] = [];
|
553
|
-
}
|
554
|
-
app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type].push( field );
|
555
|
-
|
556
|
-
if( app.schema_browser_data.fields[field].dynamicBase )
|
557
|
-
{
|
558
|
-
app.schema_browser_data.relations.f_df[field] = app.schema_browser_data.fields[field].dynamicBase;
|
559
|
-
|
560
|
-
if( !app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase] )
|
561
|
-
{
|
562
|
-
app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase] = [];
|
563
|
-
}
|
564
|
-
app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase].push( field );
|
565
|
-
}
|
566
|
-
}
|
567
|
-
|
568
|
-
for( var dynamic_field in app.schema_browser_data.dynamic_fields )
|
569
|
-
{
|
570
|
-
app.schema_browser_data.relations.df_t[dynamic_field] = app.schema_browser_data.dynamic_fields[dynamic_field].type;
|
571
|
-
|
572
|
-
if( !app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type] )
|
573
|
-
{
|
574
|
-
app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type] = [];
|
575
|
-
}
|
576
|
-
app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type].push( dynamic_field );
|
577
|
-
}
|
578
|
-
|
579
|
-
$.get
|
580
|
-
(
|
581
|
-
'tpl/schema-browser.html',
|
582
|
-
function( template )
|
583
|
-
{
|
584
|
-
content_element
|
585
|
-
.html( template );
|
586
|
-
|
587
|
-
var schema_browser_element = $( '#schema-browser', content_element );
|
588
|
-
var related_element = $( '#related', schema_browser_element );
|
589
|
-
var related_select_element = $( 'select', related_element );
|
590
|
-
var data_element = $( '#data', schema_browser_element );
|
591
|
-
|
592
|
-
var related_options = '';
|
593
|
-
|
594
|
-
var fields = [];
|
595
|
-
for( var field_name in app.schema_browser_data.fields )
|
596
|
-
{
|
597
|
-
fields.push
|
598
|
-
(
|
599
|
-
'<option value="?field=' + field_name + '">' + field_name + '</option>'
|
600
|
-
);
|
601
|
-
}
|
602
|
-
if( 0 !== fields.length )
|
603
|
-
{
|
604
|
-
fields.sort();
|
605
|
-
related_options += '<optgroup label="Fields">' + "\n";
|
606
|
-
related_options += fields.sort().join( "\n" ) + "\n";
|
607
|
-
related_options += '</optgroup>' + "\n";
|
608
|
-
}
|
609
|
-
|
610
|
-
var dynamic_fields = [];
|
611
|
-
for( var type_name in app.schema_browser_data.dynamic_fields )
|
612
|
-
{
|
613
|
-
dynamic_fields.push
|
614
|
-
(
|
615
|
-
'<option value="?dynamic-field=' + type_name + '">' + type_name + '</option>'
|
616
|
-
);
|
617
|
-
}
|
618
|
-
if( 0 !== dynamic_fields.length )
|
619
|
-
{
|
620
|
-
dynamic_fields.sort();
|
621
|
-
related_options += '<optgroup label="DynamicFields">' + "\n";
|
622
|
-
related_options += dynamic_fields.sort().join( "\n" ) + "\n";
|
623
|
-
related_options += '</optgroup>' + "\n";
|
624
|
-
}
|
625
|
-
|
626
|
-
var types = [];
|
627
|
-
for( var type_name in app.schema_browser_data.types )
|
628
|
-
{
|
629
|
-
types.push
|
630
|
-
(
|
631
|
-
'<option value="?type=' + type_name + '">' + type_name + '</option>'
|
632
|
-
);
|
633
|
-
}
|
634
|
-
if( 0 !== types.length )
|
635
|
-
{
|
636
|
-
types.sort();
|
637
|
-
related_options += '<optgroup label="Types">' + "\n";
|
638
|
-
related_options += types.sort().join( "\n" ) + "\n";
|
639
|
-
related_options += '</optgroup>' + "\n";
|
640
|
-
}
|
641
|
-
|
642
|
-
related_select_element
|
643
|
-
.attr( 'rel', app.core_menu.find( '.active a' ).attr( 'href' ) )
|
644
|
-
.append( related_options )
|
645
|
-
.chosen();
|
646
|
-
|
647
|
-
related_select_element
|
648
|
-
.die( 'change' )
|
649
|
-
.live
|
650
|
-
(
|
651
|
-
'change',
|
652
|
-
function( event )
|
653
|
-
{
|
654
|
-
var select_element = $( this );
|
655
|
-
var option_element = $( 'option:selected', select_element );
|
656
|
-
|
657
|
-
location.href = select_element.attr( 'rel' ) + option_element.val();
|
658
|
-
return false;
|
659
|
-
}
|
660
|
-
);
|
661
|
-
|
662
|
-
params.schema_browser_element = schema_browser_element;
|
663
|
-
sammy.trigger
|
664
|
-
(
|
665
|
-
'schema_browser_navi',
|
666
|
-
params
|
667
|
-
);
|
668
|
-
}
|
669
|
-
);
|
670
|
-
},
|
671
|
-
error : function( xhr, text_status, error_thrown)
|
672
|
-
{
|
673
|
-
},
|
674
|
-
complete : function( xhr, text_status )
|
675
|
-
{
|
676
|
-
}
|
677
|
-
}
|
678
|
-
);
|
679
|
-
|
680
|
-
},
|
681
|
-
error : function( xhr, text_status, error_thrown)
|
682
|
-
{
|
683
|
-
},
|
684
|
-
complete : function( xhr, text_status )
|
685
|
-
{
|
686
|
-
}
|
687
|
-
}
|
688
|
-
);
|
689
|
-
}
|
690
|
-
}
|
691
|
-
);
|
692
|
-
|
693
|
-
// #/:core/schema-browser
|
694
|
-
sammy.get
|
695
|
-
(
|
696
|
-
new RegExp( app.core_regex_base + '\\/(schema-browser)$' ),
|
697
|
-
function( context )
|
698
|
-
{
|
699
|
-
var core_basepath = this.active_core.attr( 'data-basepath' );
|
700
|
-
current_core = context.params.splat[0];
|
701
|
-
|
702
|
-
var trigger_params = {
|
703
|
-
active_core : this.active_core
|
704
|
-
};
|
705
|
-
|
706
|
-
var path = context.path.split( '?' );
|
707
|
-
if( path && path[1] )
|
708
|
-
{
|
709
|
-
var param = path[1].split( '=' );
|
710
|
-
trigger_params.route_params = {
|
711
|
-
path : '?' + path[1],
|
712
|
-
type : param[0],
|
713
|
-
value : param[1]
|
714
|
-
}
|
715
|
-
|
716
|
-
trigger_params.callback = function( schema_browser_data, data_element )
|
717
|
-
{
|
718
|
-
var field = trigger_params.route_params.value;
|
719
|
-
|
720
|
-
var type = trigger_params.route_params.type;
|
721
|
-
var is_f = 'field' === type;
|
722
|
-
var is_df = 'dynamic-field' === type;
|
723
|
-
var is_t = 'type' === type;
|
724
|
-
|
725
|
-
var options_element = $( '.options', data_element );
|
726
|
-
var sammy_basepath = context.path.indexOf( '/', context.path.indexOf( '/', 2 ) + 1 );
|
727
|
-
|
728
|
-
data_element
|
729
|
-
.show();
|
730
|
-
|
731
|
-
// -- head
|
732
|
-
|
733
|
-
var head_element = $( '.head', data_element );
|
734
|
-
if( is_f )
|
735
|
-
{
|
736
|
-
$( '.type', head_element ).html( 'Field' );
|
737
|
-
}
|
738
|
-
else if( is_df )
|
739
|
-
{
|
740
|
-
$( '.type', head_element ).html( 'Dynamic Field' );
|
741
|
-
}
|
742
|
-
else if( is_t )
|
743
|
-
{
|
744
|
-
$( '.type', head_element ).html( 'Type' );
|
745
|
-
}
|
746
|
-
$( '.name', head_element ).html( field.esc() );
|
747
|
-
|
748
|
-
|
749
|
-
var partial_state = false;
|
750
|
-
if( is_f )
|
751
|
-
{
|
752
|
-
partial_state = !!schema_browser_data.fields[field].partial;
|
753
|
-
}
|
754
|
-
|
755
|
-
$( '.partial', data_element )
|
756
|
-
.toggle( partial_state );
|
757
|
-
|
758
|
-
// -- docs
|
759
|
-
var docs_element = $( 'dt.docs', options_element );
|
760
|
-
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].docs )
|
761
|
-
{
|
762
|
-
$( 'dd.docs', options_element )
|
763
|
-
.remove();
|
764
|
-
|
765
|
-
var target = '#/' + current_core + '/query?q=' + field.esc() + ':[* TO *]';
|
766
|
-
docs_element
|
767
|
-
.show()
|
768
|
-
.after(
|
769
|
-
'<dd class="docs">'+
|
770
|
-
'<a href="'+target+'">' + schema_browser_data.fields[field].docs + '</a>' +
|
771
|
-
'</dd>' );
|
772
|
-
}
|
773
|
-
else
|
774
|
-
{
|
775
|
-
$( '.docs', options_element )
|
776
|
-
.hide();
|
777
|
-
}
|
778
|
-
|
779
|
-
// -- distinct
|
780
|
-
var distinct_element = $( 'dt.distinct', options_element );
|
781
|
-
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].distinct )
|
782
|
-
{
|
783
|
-
$( 'dd.distinct', options_element )
|
784
|
-
.remove();
|
785
|
-
|
786
|
-
distinct_element
|
787
|
-
.show()
|
788
|
-
.after( '<dd class="distinct">' + schema_browser_data.fields[field].distinct + '</dd>' );
|
789
|
-
}
|
790
|
-
else
|
791
|
-
{
|
792
|
-
$( '.distinct', options_element )
|
793
|
-
.hide();
|
794
|
-
}
|
795
|
-
|
796
|
-
// -- position-increment-gap
|
797
|
-
var pig_element = $( 'dt.position-increment-gap', options_element );
|
798
|
-
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].positionIncrementGap )
|
799
|
-
{
|
800
|
-
$( 'dd.position-increment-gap', options_element )
|
801
|
-
.remove();
|
802
|
-
|
803
|
-
pig_element
|
804
|
-
.show()
|
805
|
-
.after( '<dd class="position-increment-gap">' + schema_browser_data.fields[field].positionIncrementGap + '</dd>' );
|
806
|
-
}
|
807
|
-
else
|
808
|
-
{
|
809
|
-
$( '.position-increment-gap', options_element )
|
810
|
-
.hide();
|
811
|
-
}
|
812
|
-
|
813
|
-
var similarity_element = $( 'dt.similarity', options_element );
|
814
|
-
if ( is_t && schema_browser_data.types[field] && schema_browser_data.types[field].similarity ) {
|
815
|
-
var similarity = schema_browser_data.types[field].similarity
|
816
|
-
if (similarity.details && similarity.className) {
|
817
|
-
$( 'dd.similarity', options_element ).remove();
|
818
|
-
similarity_element
|
819
|
-
.show()
|
820
|
-
.after(['<dd class="similarity">', similarity.details.esc(), ' (', similarity.className.esc(), ') </dd>'].join(""));
|
821
|
-
}
|
822
|
-
} else {
|
823
|
-
$( '.similarity', options_element ).hide();
|
824
|
-
}
|
825
|
-
|
826
|
-
|
827
|
-
// -- flags table
|
828
|
-
var flags_table = $( 'table.flags', data_element );
|
829
|
-
|
830
|
-
var flags_arr = [];
|
831
|
-
for( var key in schema_browser_data.key )
|
832
|
-
{
|
833
|
-
flags_arr.push( '<th data-key="' + key + '">' + schema_browser_data.key[key] + '</th>' );
|
834
|
-
}
|
835
|
-
|
836
|
-
$( 'thead tr', flags_table )
|
837
|
-
.append( flags_arr.join( "\n" ) );
|
838
|
-
|
839
|
-
|
840
|
-
var flags_body = $( 'tbody', flags_table );
|
841
|
-
flags_body.empty();
|
842
|
-
|
843
|
-
var generate_flags_row = function generate_flags_row( flags_str, title )
|
844
|
-
{
|
845
|
-
var flags_arr = [ '<th>' + title.esc() + '</th>' ];
|
846
|
-
|
847
|
-
if( 0 === flags_str.indexOf( '(' ) )
|
848
|
-
{
|
849
|
-
flags_arr.push( '<td colspan="2" class="text">' + flags_str + '</td>' );
|
850
|
-
}
|
851
|
-
else
|
852
|
-
{
|
853
|
-
var i = 0;
|
854
|
-
for( var key in schema_browser_data.key )
|
855
|
-
{
|
856
|
-
var flag_match = key === flags_str[i];
|
857
|
-
|
858
|
-
var flag_cell = '<td '
|
859
|
-
+ ' data-key="' + key + '"'
|
860
|
-
+ ' class="' + ( flag_match ? 'check' : '' ) + '"'
|
861
|
-
+ '>'
|
862
|
-
+ ( flag_match ? '<span>√</span>' : ' ' )
|
863
|
-
+ '</td>';
|
864
|
-
|
865
|
-
flags_arr.push( flag_cell );
|
866
|
-
i++;
|
867
|
-
}
|
868
|
-
}
|
869
|
-
|
870
|
-
flags_body
|
871
|
-
.append( '<tr>' + flags_arr.join( "\n" ) + '</tr>' );
|
872
|
-
};
|
873
|
-
|
874
|
-
var flags = null;
|
875
|
-
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].flags )
|
876
|
-
{
|
877
|
-
flags = schema_browser_data.fields[field].flags;
|
878
|
-
}
|
879
|
-
else if( is_df && schema_browser_data.dynamic_fields[field] && schema_browser_data.dynamic_fields[field].flags )
|
880
|
-
{
|
881
|
-
flags = schema_browser_data.dynamic_fields[field].flags;
|
882
|
-
}
|
883
|
-
|
884
|
-
if( flags )
|
885
|
-
{
|
886
|
-
generate_flags_row( flags, 'Properties' );
|
887
|
-
}
|
888
|
-
|
889
|
-
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].schema )
|
890
|
-
{
|
891
|
-
generate_flags_row( schema_browser_data.fields[field].schema, 'Schema' );
|
892
|
-
}
|
893
|
-
|
894
|
-
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].index )
|
895
|
-
{
|
896
|
-
generate_flags_row( schema_browser_data.fields[field].index, 'Index' );
|
897
|
-
}
|
898
|
-
|
899
|
-
|
900
|
-
if( 0 !== $( 'tr', flags_body ).size() )
|
901
|
-
{
|
902
|
-
var col_count = 0;
|
903
|
-
for( var key in schema_browser_data.key )
|
904
|
-
{
|
905
|
-
var cols = $( '[data-key="' + key + '"]', flags_table );
|
906
|
-
|
907
|
-
var col_used = 0 !== cols.filter( '.check' ).size();
|
908
|
-
col_count += col_used;
|
909
|
-
|
910
|
-
cols.toggle( col_used );
|
911
|
-
}
|
912
|
-
|
913
|
-
$( 'td[colspan]', flags_body )
|
914
|
-
.attr( 'colspan', col_count );
|
915
|
-
|
916
|
-
flags_table.show();
|
917
|
-
}
|
918
|
-
else
|
919
|
-
{
|
920
|
-
flags_table.hide();
|
921
|
-
}
|
922
|
-
|
923
|
-
var analyzer_element = $( '.analyzer', data_element );
|
924
|
-
var analyzer_data = null;
|
925
|
-
|
926
|
-
var analysis_link = false;
|
927
|
-
var analysis_link_elements = $( 'p a', analyzer_element );
|
928
|
-
var analysis_target = '#/' + current_core + '/analysis?';
|
929
|
-
|
930
|
-
if( is_f )
|
931
|
-
{
|
932
|
-
analyzer_data = schema_browser_data.types[schema_browser_data.relations.f_t[field]];
|
933
|
-
|
934
|
-
analysis_link = true;
|
935
|
-
analysis_target += 'analysis.fieldname=' + field;
|
936
|
-
}
|
937
|
-
else if( is_df )
|
938
|
-
{
|
939
|
-
analyzer_data = schema_browser_data.types[schema_browser_data.relations.df_t[field]];
|
940
|
-
}
|
941
|
-
else if( is_t )
|
942
|
-
{
|
943
|
-
analyzer_data = schema_browser_data.types[field];
|
944
|
-
|
945
|
-
analysis_link = true;
|
946
|
-
analysis_target += 'analysis.fieldtype=' + field;
|
947
|
-
}
|
948
|
-
|
949
|
-
if( analysis_link )
|
950
|
-
{
|
951
|
-
analysis_link_elements
|
952
|
-
.addClass( 'analysis' )
|
953
|
-
.attr( 'href', analysis_target );
|
954
|
-
}
|
955
|
-
else
|
956
|
-
{
|
957
|
-
analysis_link_elements
|
958
|
-
.removeClass( 'analysis' )
|
959
|
-
.removeAttr( 'href' );
|
960
|
-
}
|
961
|
-
|
962
|
-
|
963
|
-
if( analyzer_data )
|
964
|
-
{
|
965
|
-
var transform_analyzer_data_into_list = function( analyzer_data )
|
966
|
-
{
|
967
|
-
var args = [];
|
968
|
-
for( var key in analyzer_data.args )
|
969
|
-
{
|
970
|
-
var arg_class = '';
|
971
|
-
var arg_content = '';
|
972
|
-
|
973
|
-
if( 'true' === analyzer_data.args[key] || '1' === analyzer_data.args[key] )
|
974
|
-
{
|
975
|
-
arg_class = 'ico-1';
|
976
|
-
arg_content = key;
|
977
|
-
}
|
978
|
-
else if( 'false' === analyzer_data.args[key] || '0' === analyzer_data.args[key] )
|
979
|
-
{
|
980
|
-
arg_class = 'ico-0';
|
981
|
-
arg_content = key;
|
982
|
-
}
|
983
|
-
else
|
984
|
-
{
|
985
|
-
arg_content = key + ': ';
|
986
|
-
|
987
|
-
if( 'synonyms' === key || 'words' === key )
|
988
|
-
{
|
989
|
-
// @TODO: set link target for file
|
990
|
-
arg_content += '<a>' + analyzer_data.args[key] + '</a>';
|
991
|
-
}
|
992
|
-
else
|
993
|
-
{
|
994
|
-
arg_content += analyzer_data.args[key];
|
995
|
-
}
|
996
|
-
}
|
997
|
-
|
998
|
-
args.push( '<dd class="' + arg_class + '">' + arg_content + '</dd>' );
|
999
|
-
}
|
1000
|
-
|
1001
|
-
var list_content = '<dt>' + analyzer_data.className + '</dt>';
|
1002
|
-
if( 0 !== args.length )
|
1003
|
-
{
|
1004
|
-
args.sort();
|
1005
|
-
list_content += args.join( "\n" );
|
1006
|
-
}
|
1007
|
-
|
1008
|
-
return list_content;
|
1009
|
-
}
|
1010
|
-
|
1011
|
-
// -- field-type
|
1012
|
-
var field_type_element = $( 'dt.field-type', options_element );
|
1013
|
-
|
1014
|
-
$( 'dd.field-type', options_element )
|
1015
|
-
.remove();
|
1016
|
-
|
1017
|
-
field_type_element
|
1018
|
-
.show()
|
1019
|
-
.after( '<dd class="field-type">' + analyzer_data.className + '</dd>' );
|
1020
|
-
|
1021
|
-
$( '.toggle', analyzer_element )
|
1022
|
-
.die( 'click' )
|
1023
|
-
.live
|
1024
|
-
(
|
1025
|
-
'click',
|
1026
|
-
function( event )
|
1027
|
-
{
|
1028
|
-
$( this ).closest( 'li' )
|
1029
|
-
.toggleClass( 'open' );
|
1030
|
-
|
1031
|
-
return false;
|
1032
|
-
}
|
1033
|
-
);
|
1034
|
-
|
1035
|
-
for( var key in analyzer_data )
|
1036
|
-
{
|
1037
|
-
var key_match = key.match( /^(.+)Analyzer$/ );
|
1038
|
-
if( !key_match )
|
1039
|
-
{
|
1040
|
-
continue;
|
1041
|
-
}
|
1042
|
-
|
1043
|
-
var analyzer_key_element = $( '.' + key_match[1], analyzer_element );
|
1044
|
-
var analyzer_key_data = analyzer_data[key];
|
1045
|
-
|
1046
|
-
analyzer_element.show();
|
1047
|
-
analyzer_key_element.show();
|
1048
|
-
|
1049
|
-
$( 'ul li', analyzer_key_element )
|
1050
|
-
.removeClass( 'data' )
|
1051
|
-
.hide();
|
1052
|
-
|
1053
|
-
for( var type in analyzer_key_data )
|
1054
|
-
{
|
1055
|
-
if( 'object' !== typeof analyzer_key_data[type] )
|
1056
|
-
{
|
1057
|
-
continue;
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
var type_element = $( '.' + type, analyzer_key_element );
|
1061
|
-
var type_content = [];
|
1062
|
-
|
1063
|
-
type_element
|
1064
|
-
.addClass( 'data' )
|
1065
|
-
.show();
|
1066
|
-
|
1067
|
-
if( analyzer_key_data[type].className )
|
1068
|
-
{
|
1069
|
-
type_content.push( transform_analyzer_data_into_list( analyzer_key_data[type] ) );
|
1070
|
-
}
|
1071
|
-
else
|
1072
|
-
{
|
1073
|
-
for( var entry in analyzer_key_data[type] )
|
1074
|
-
{
|
1075
|
-
type_content.push( transform_analyzer_data_into_list( analyzer_key_data[type][entry] ) );
|
1076
|
-
}
|
1077
|
-
}
|
1078
|
-
|
1079
|
-
$( 'dl', type_element )
|
1080
|
-
.empty()
|
1081
|
-
.append( type_content.join( "\n" ) );
|
1082
|
-
}
|
1083
|
-
|
1084
|
-
var name_element = $( 'dl:first dt a', analyzer_key_element );
|
1085
|
-
if( analyzer_key_data.className )
|
1086
|
-
{
|
1087
|
-
name_element
|
1088
|
-
.html( analyzer_key_data.className );
|
1089
|
-
}
|
1090
|
-
|
1091
|
-
0 === $( 'ul li.data', analyzer_key_element ).size()
|
1092
|
-
? name_element.removeClass( 'toggle' )
|
1093
|
-
: name_element.addClass( 'toggle' );
|
1094
|
-
}
|
1095
|
-
}
|
1096
|
-
|
1097
|
-
var terminfo_element = $( '.terminfo-holder', data_element );
|
1098
|
-
|
1099
|
-
terminfo_element
|
1100
|
-
.removeClass( 'disabled' )
|
1101
|
-
.removeClass( 'loaded' );
|
1102
|
-
|
1103
|
-
var trigger_element = $( '.trigger button', terminfo_element );
|
1104
|
-
var form_element = $( 'form', terminfo_element );
|
1105
|
-
|
1106
|
-
trigger_element
|
1107
|
-
.die( 'click' )
|
1108
|
-
.live
|
1109
|
-
(
|
1110
|
-
'click',
|
1111
|
-
function( event )
|
1112
|
-
{
|
1113
|
-
form_element
|
1114
|
-
.trigger( 'submit' );
|
1115
|
-
|
1116
|
-
return false;
|
1117
|
-
}
|
1118
|
-
);
|
1119
|
-
|
1120
|
-
form_element
|
1121
|
-
.clearForm()
|
1122
|
-
.die( 'submit' )
|
1123
|
-
.live
|
1124
|
-
(
|
1125
|
-
'submit',
|
1126
|
-
function( event )
|
1127
|
-
{
|
1128
|
-
load_terminfo( trigger_element, core_basepath, field, data_element, terminfo_element );
|
1129
|
-
|
1130
|
-
terminfo_element
|
1131
|
-
.addClass( 'loaded' );
|
1132
|
-
|
1133
|
-
return false;
|
1134
|
-
}
|
1135
|
-
);
|
1136
|
-
|
1137
|
-
$( '.max-holder', terminfo_element )
|
1138
|
-
.die( 'click' )
|
1139
|
-
.live
|
1140
|
-
(
|
1141
|
-
'click',
|
1142
|
-
function( event )
|
1143
|
-
{
|
1144
|
-
var element = $( this );
|
1145
|
-
|
1146
|
-
$( 'input', element.closest( 'form' ) )
|
1147
|
-
.val( $( '.max', element ).text() );
|
1148
|
-
|
1149
|
-
form_element
|
1150
|
-
.trigger( 'submit' );
|
1151
|
-
|
1152
|
-
return false;
|
1153
|
-
}
|
1154
|
-
);
|
1155
|
-
|
1156
|
-
$( '.trigger .autoload', terminfo_element )
|
1157
|
-
.die( 'click' )
|
1158
|
-
.live
|
1159
|
-
(
|
1160
|
-
'click',
|
1161
|
-
function( event )
|
1162
|
-
{
|
1163
|
-
$.cookie( cookie_schema_browser_autoload, $.cookie( cookie_schema_browser_autoload ) ? null : true );
|
1164
|
-
$( this ).trigger( 'state' );
|
1165
|
-
|
1166
|
-
return false;
|
1167
|
-
}
|
1168
|
-
)
|
1169
|
-
.die( 'state' )
|
1170
|
-
.live
|
1171
|
-
(
|
1172
|
-
'state',
|
1173
|
-
function( event )
|
1174
|
-
{
|
1175
|
-
$.cookie( cookie_schema_browser_autoload )
|
1176
|
-
? $( this ).addClass( 'on' )
|
1177
|
-
: $( this ).removeClass( 'on' );
|
1178
|
-
}
|
1179
|
-
)
|
1180
|
-
.die( 'init' )
|
1181
|
-
.live
|
1182
|
-
(
|
1183
|
-
'init',
|
1184
|
-
function( event )
|
1185
|
-
{
|
1186
|
-
if( !$.cookie( cookie_schema_browser_autoload ) )
|
1187
|
-
{
|
1188
|
-
return false;
|
1189
|
-
}
|
1190
|
-
|
1191
|
-
$( this ).trigger( 'state' );
|
1192
|
-
trigger_element.trigger( 'click' );
|
1193
|
-
}
|
1194
|
-
)
|
1195
|
-
.trigger( 'init' );
|
1196
|
-
|
1197
|
-
$( 'div[class$="-holder"]', terminfo_element )
|
1198
|
-
.hide();
|
1199
|
-
|
1200
|
-
if( !is_f )
|
1201
|
-
{
|
1202
|
-
terminfo_element
|
1203
|
-
.hide();
|
1204
|
-
}
|
1205
|
-
else
|
1206
|
-
{
|
1207
|
-
terminfo_element
|
1208
|
-
.show();
|
1209
|
-
}
|
1210
|
-
}
|
1211
|
-
}
|
1212
|
-
else
|
1213
|
-
{
|
1214
|
-
trigger_params.callback = function( schema_browser_data, data_element )
|
1215
|
-
{
|
1216
|
-
data_element
|
1217
|
-
.hide();
|
1218
|
-
};
|
1219
|
-
}
|
1220
|
-
|
1221
|
-
delete app.schema_browser_data;
|
1222
|
-
|
1223
|
-
sammy.trigger
|
1224
|
-
(
|
1225
|
-
'schema_browser_load',
|
1226
|
-
trigger_params
|
1227
|
-
);
|
1228
|
-
}
|
1229
|
-
);
|
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 current_core = null;
|
19
|
+
var cookie_schema_browser_autoload = 'schema-browser_autoload';
|
20
|
+
|
21
|
+
var luke_array_to_struct = function( array )
|
22
|
+
{
|
23
|
+
var struct = {
|
24
|
+
keys : [],
|
25
|
+
values : []
|
26
|
+
};
|
27
|
+
for( var i = 0; i < array.length; i += 2 )
|
28
|
+
{
|
29
|
+
struct.keys.push( array[i] );
|
30
|
+
struct.values.push( array[i+1] );
|
31
|
+
}
|
32
|
+
return struct;
|
33
|
+
}
|
34
|
+
|
35
|
+
var luke_array_to_hash = function( array )
|
36
|
+
{
|
37
|
+
var hash = {};
|
38
|
+
for( var i = 0; i < array.length; i += 2 )
|
39
|
+
{
|
40
|
+
hash[ array[i] ] = array[i+1];
|
41
|
+
}
|
42
|
+
return hash;
|
43
|
+
}
|
44
|
+
|
45
|
+
var load_terminfo = function( trigger_element, core_basepath, field, data_element, terminfo_element )
|
46
|
+
{
|
47
|
+
var luke_url = core_basepath + '/admin/luke?wt=json&fl=' + field;
|
48
|
+
var topterms_count_element = $( '.topterms-holder .head input', terminfo_element );
|
49
|
+
|
50
|
+
var term_load_count = parseInt( topterms_count_element.val(), 10 );
|
51
|
+
if( term_load_count )
|
52
|
+
{
|
53
|
+
luke_url += '&numTerms=' + term_load_count;
|
54
|
+
}
|
55
|
+
|
56
|
+
$.ajax
|
57
|
+
(
|
58
|
+
{
|
59
|
+
url : luke_url,
|
60
|
+
dataType : 'json',
|
61
|
+
context : terminfo_element,
|
62
|
+
beforeSend : function( xhr, settings )
|
63
|
+
{
|
64
|
+
$( 'span', trigger_element )
|
65
|
+
.addClass( 'loader' );
|
66
|
+
},
|
67
|
+
success : function( response, text_status, xhr )
|
68
|
+
{
|
69
|
+
var additional_styles = [];
|
70
|
+
var field_data = response.fields[field];
|
71
|
+
|
72
|
+
if( !field_data || !( field_data.topTerms && field_data.histogram ) )
|
73
|
+
{
|
74
|
+
terminfo_element
|
75
|
+
.addClass( 'disabled' );
|
76
|
+
|
77
|
+
return false;
|
78
|
+
}
|
79
|
+
|
80
|
+
var get_width = function get_width()
|
81
|
+
{
|
82
|
+
return $( this ).width();
|
83
|
+
}
|
84
|
+
|
85
|
+
var topterms_holder_element = $( '.topterms-holder', data_element );
|
86
|
+
var histogram_holder_element = $( '.histogram-holder', data_element );
|
87
|
+
|
88
|
+
if( !field_data.topTerms )
|
89
|
+
{
|
90
|
+
topterms_holder_element
|
91
|
+
.hide();
|
92
|
+
}
|
93
|
+
else
|
94
|
+
{
|
95
|
+
topterms_holder_element
|
96
|
+
.show();
|
97
|
+
|
98
|
+
var topterms_table_element = $( 'ul', topterms_holder_element );
|
99
|
+
|
100
|
+
var topterms = field_data.topTerms;
|
101
|
+
var topterms_count = topterms.length;
|
102
|
+
|
103
|
+
var topterms_content = '';
|
104
|
+
var topterms_frq_last = null;
|
105
|
+
|
106
|
+
for( var i = 0; i < topterms_count; i += 2 )
|
107
|
+
{
|
108
|
+
if( topterms_frq_last !== topterms[i+1] )
|
109
|
+
{
|
110
|
+
if( topterms_frq_last )
|
111
|
+
{
|
112
|
+
topterms_content += '</ul></li>' + "\n";
|
113
|
+
}
|
114
|
+
|
115
|
+
topterms_frq_last = topterms[i+1];
|
116
|
+
topterms_content += '<li class="clearfix">'
|
117
|
+
+ '<p><span>' + app.format_number( topterms_frq_last ) + '</span></p>' + "\n"
|
118
|
+
+ '<ul>' + "\n";
|
119
|
+
}
|
120
|
+
|
121
|
+
var target = '#/' + current_core + '/query?q=' + field.esc() + ':' + encodeURIComponent( '"' + topterms[i] + '"' );
|
122
|
+
topterms_content += '<li><a href="' + target + '">' + topterms[i].esc() + '</a></li>' + "\n";
|
123
|
+
}
|
124
|
+
|
125
|
+
topterms_content += '</li>';
|
126
|
+
|
127
|
+
topterms_count = topterms_count / 2;
|
128
|
+
|
129
|
+
$( 'input', trigger_element )
|
130
|
+
.val( topterms_count );
|
131
|
+
|
132
|
+
topterms_table_element
|
133
|
+
.html( topterms_content );
|
134
|
+
|
135
|
+
var max_width = 10 + Math.max.apply( Math, $( 'p', topterms_table_element ).map( get_width ).get() );
|
136
|
+
additional_styles.push
|
137
|
+
(
|
138
|
+
topterms_table_element.selector + ' p { width: ' + max_width + 'px !important; }' + "\n" +
|
139
|
+
topterms_table_element.selector + ' ul { margin-left: ' + ( max_width + 5 ) + 'px !important; }'
|
140
|
+
);
|
141
|
+
|
142
|
+
topterms_count_element
|
143
|
+
.val( topterms_count );
|
144
|
+
|
145
|
+
$( 'p.head .max', topterms_holder_element )
|
146
|
+
.html( field_data.distinct );
|
147
|
+
|
148
|
+
$( 'p.head #query_link', topterms_holder_element )
|
149
|
+
.attr( 'href', '#/' + current_core + '/query?q=' + field.esc() + ':[* TO *]' );
|
150
|
+
|
151
|
+
$( 'ul li:even', topterms_table_element )
|
152
|
+
.addClass( 'odd' );
|
153
|
+
}
|
154
|
+
|
155
|
+
if( !field_data.histogram )
|
156
|
+
{
|
157
|
+
histogram_holder_element
|
158
|
+
.hide();
|
159
|
+
}
|
160
|
+
else
|
161
|
+
{
|
162
|
+
histogram_holder_element
|
163
|
+
.show();
|
164
|
+
|
165
|
+
var histogram_values = luke_array_to_hash( field_data.histogram );
|
166
|
+
var histogram_entries = [];
|
167
|
+
|
168
|
+
var histogram_max = null;
|
169
|
+
for( var key in histogram_values )
|
170
|
+
{
|
171
|
+
histogram_max = Math.max( histogram_max, histogram_values[key] );
|
172
|
+
}
|
173
|
+
|
174
|
+
for( var key in histogram_values )
|
175
|
+
{
|
176
|
+
histogram_entries.push
|
177
|
+
(
|
178
|
+
'<li>' + "\n" +
|
179
|
+
' <dl class="clearfix" style="width: ' + ( ( histogram_values[key] / histogram_max ) * 100 ) + '%;">' + "\n" +
|
180
|
+
' <dt><span>' + app.format_number( key ) + '</span></dt>' + "\n" +
|
181
|
+
' <dd><span>' + app.format_number( histogram_values[key] ) + '</span></dd>' + "\n" +
|
182
|
+
' </dl>' + "\n" +
|
183
|
+
'</li>'
|
184
|
+
);
|
185
|
+
}
|
186
|
+
|
187
|
+
$( 'ul', histogram_holder_element )
|
188
|
+
.html( histogram_entries.join( "\n" ) );
|
189
|
+
|
190
|
+
$( 'ul li:even', histogram_holder_element )
|
191
|
+
.addClass( 'odd' );
|
192
|
+
|
193
|
+
var max_width = 10 + Math.max.apply( Math, $( 'dt', histogram_holder_element ).map( get_width ).get() );
|
194
|
+
additional_styles.push
|
195
|
+
(
|
196
|
+
histogram_holder_element.selector + ' ul { margin-left: ' + max_width + 'px !important; }' + "\n" +
|
197
|
+
histogram_holder_element.selector + ' li dt { left: ' + ( max_width * -1 ) + 'px !important; width: ' + max_width + 'px !important; }'
|
198
|
+
);
|
199
|
+
}
|
200
|
+
|
201
|
+
if( additional_styles )
|
202
|
+
{
|
203
|
+
terminfo_element
|
204
|
+
.prepend( '<style type="text/css">' + additional_styles.join( "\n" ) + '</style>' );
|
205
|
+
}
|
206
|
+
},
|
207
|
+
error : function( xhr, text_status, error_thrown)
|
208
|
+
{
|
209
|
+
terminfo_element
|
210
|
+
.addClass( 'disabled' );
|
211
|
+
},
|
212
|
+
complete : function( xhr, text_status )
|
213
|
+
{
|
214
|
+
$( 'span', trigger_element )
|
215
|
+
.removeClass( 'loader' );
|
216
|
+
}
|
217
|
+
}
|
218
|
+
);
|
219
|
+
}
|
220
|
+
|
221
|
+
sammy.bind
|
222
|
+
(
|
223
|
+
'schema_browser_navi',
|
224
|
+
function( event, params )
|
225
|
+
{
|
226
|
+
var related_navigation_element = $( '#related dl#f-df-t', params.schema_browser_element );
|
227
|
+
var related_navigation_meta = $( '#related dl.ukf-dsf', params.schema_browser_element );
|
228
|
+
var related_select_element = $( '#related select', params.schema_browser_element )
|
229
|
+
var type = 'index';
|
230
|
+
|
231
|
+
var sammy_basepath = app.core_menu.find( '.active a' ).attr( 'href' );
|
232
|
+
|
233
|
+
if( !related_navigation_meta.hasClass( 'done' ) )
|
234
|
+
{
|
235
|
+
if( app.schema_browser_data.unique_key_field )
|
236
|
+
{
|
237
|
+
$( '.unique-key-field', related_navigation_meta )
|
238
|
+
.show()
|
239
|
+
.after
|
240
|
+
(
|
241
|
+
'<dd class="unique-key-field"><a href="' + sammy_basepath + '?field=' +
|
242
|
+
app.schema_browser_data.unique_key_field + '">' +
|
243
|
+
app.schema_browser_data.unique_key_field + '</a></dd>'
|
244
|
+
);
|
245
|
+
}
|
246
|
+
|
247
|
+
if( app.schema_browser_data.default_search_field )
|
248
|
+
{
|
249
|
+
$( '.default-search-field', related_navigation_meta )
|
250
|
+
.show()
|
251
|
+
.after
|
252
|
+
(
|
253
|
+
'<dd class="default-search-field"><a href="' + sammy_basepath + '?field=' +
|
254
|
+
app.schema_browser_data.default_search_field + '">' +
|
255
|
+
app.schema_browser_data.default_search_field + '</a></dd>'
|
256
|
+
);
|
257
|
+
}
|
258
|
+
|
259
|
+
related_navigation_meta
|
260
|
+
.addClass( 'done' );
|
261
|
+
}
|
262
|
+
|
263
|
+
if( params.route_params )
|
264
|
+
{
|
265
|
+
var type = params.route_params.type;
|
266
|
+
var value = params.route_params.value;
|
267
|
+
|
268
|
+
var navigation_data = {
|
269
|
+
'fields' : [],
|
270
|
+
'copyfield_source' : [],
|
271
|
+
'copyfield_dest' : [],
|
272
|
+
'dynamic_fields' : [],
|
273
|
+
'types' : []
|
274
|
+
}
|
275
|
+
|
276
|
+
$( 'option[value="' + params.route_params.path.esc() + '"]', related_select_element )
|
277
|
+
.attr( 'selected', 'selected' );
|
278
|
+
|
279
|
+
related_select_element
|
280
|
+
.trigger( 'liszt:updated' );
|
281
|
+
|
282
|
+
if( 'field' === type )
|
283
|
+
{
|
284
|
+
navigation_data.fields.push( value );
|
285
|
+
|
286
|
+
if( app.schema_browser_data.relations.f_t[value] )
|
287
|
+
{
|
288
|
+
navigation_data.types.push( app.schema_browser_data.relations.f_t[value] );
|
289
|
+
}
|
290
|
+
|
291
|
+
if( app.schema_browser_data.relations.f_df[value] )
|
292
|
+
{
|
293
|
+
navigation_data.dynamic_fields.push( app.schema_browser_data.relations.f_df[value] );
|
294
|
+
}
|
295
|
+
|
296
|
+
if( app.schema_browser_data.fields[value].copySources && 0 !== app.schema_browser_data.fields[value].copySources.length )
|
297
|
+
{
|
298
|
+
navigation_data.copyfield_source = app.schema_browser_data.fields[value].copySources;
|
299
|
+
}
|
300
|
+
|
301
|
+
if( app.schema_browser_data.fields[value].copyDests && 0 !== app.schema_browser_data.fields[value].copyDests.length )
|
302
|
+
{
|
303
|
+
navigation_data.copyfield_dest = app.schema_browser_data.fields[value].copyDests;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
else if( 'dynamic-field' === type )
|
307
|
+
{
|
308
|
+
navigation_data.dynamic_fields.push( value );
|
309
|
+
navigation_data.types.push( app.schema_browser_data.relations.df_t[value] );
|
310
|
+
|
311
|
+
if( app.schema_browser_data.relations.df_f[value] )
|
312
|
+
{
|
313
|
+
navigation_data.fields = app.schema_browser_data.relations.df_f[value];
|
314
|
+
}
|
315
|
+
}
|
316
|
+
else if( 'type' === type )
|
317
|
+
{
|
318
|
+
navigation_data.types.push( value );
|
319
|
+
|
320
|
+
if( app.schema_browser_data.relations.t_f[value] )
|
321
|
+
{
|
322
|
+
navigation_data.fields = app.schema_browser_data.relations.t_f[value];
|
323
|
+
}
|
324
|
+
|
325
|
+
if( app.schema_browser_data.relations.t_df[value] )
|
326
|
+
{
|
327
|
+
navigation_data.dynamic_fields = app.schema_browser_data.relations.t_df[value];
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
var navigation_content = '';
|
332
|
+
|
333
|
+
if( 0 !== navigation_data.fields.length )
|
334
|
+
{
|
335
|
+
navigation_data.fields.sort();
|
336
|
+
navigation_content += '<dt class="field">Field</dt>' + "\n";
|
337
|
+
for( var i in navigation_data.fields )
|
338
|
+
{
|
339
|
+
var href = sammy_basepath + '?field=' + navigation_data.fields[i];
|
340
|
+
navigation_content += '<dd class="field"><a href="' + href + '">' + navigation_data.fields[i] + '</a></dd>' + "\n";
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
if( 0 !== navigation_data.copyfield_source.length )
|
345
|
+
{
|
346
|
+
navigation_data.copyfield_source.sort();
|
347
|
+
navigation_content += '<dt class="copyfield">Copied from</dt>' + "\n";
|
348
|
+
for( var i in navigation_data.copyfield_source )
|
349
|
+
{
|
350
|
+
var href = sammy_basepath + '?field=' + navigation_data.copyfield_source[i];
|
351
|
+
navigation_content += '<dd class="copyfield"><a href="' + href + '">' + navigation_data.copyfield_source[i] + '</a></dd>' + "\n";
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
if( 0 !== navigation_data.copyfield_dest.length )
|
356
|
+
{
|
357
|
+
navigation_data.copyfield_dest.sort();
|
358
|
+
navigation_content += '<dt class="copyfield">Copied to</dt>' + "\n";
|
359
|
+
for( var i in navigation_data.copyfield_dest )
|
360
|
+
{
|
361
|
+
var href = sammy_basepath + '?field=' + navigation_data.copyfield_dest[i];
|
362
|
+
navigation_content += '<dd class="copyfield"><a href="' + href + '">' + navigation_data.copyfield_dest[i] + '</a></dd>' + "\n";
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
if( 0 !== navigation_data.dynamic_fields.length )
|
367
|
+
{
|
368
|
+
navigation_data.dynamic_fields.sort();
|
369
|
+
navigation_content += '<dt class="dynamic-field">Dynamic Field</dt>' + "\n";
|
370
|
+
for( var i in navigation_data.dynamic_fields )
|
371
|
+
{
|
372
|
+
var href = sammy_basepath + '?dynamic-field=' + navigation_data.dynamic_fields[i];
|
373
|
+
navigation_content += '<dd class="dynamic-field"><a href="' + href + '">' + navigation_data.dynamic_fields[i] + '</a></dd>' + "\n";
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
if( 0 !== navigation_data.types.length )
|
378
|
+
{
|
379
|
+
navigation_data.types.sort();
|
380
|
+
navigation_content += '<dt class="type">Type</dt>' + "\n";
|
381
|
+
for( var i in navigation_data.types )
|
382
|
+
{
|
383
|
+
var href = sammy_basepath + '?type=' + navigation_data.types[i];
|
384
|
+
navigation_content += '<dd class="type"><a href="' + href + '">' + navigation_data.types[i] + '</a></dd>' + "\n";
|
385
|
+
}
|
386
|
+
}
|
387
|
+
|
388
|
+
related_navigation_element
|
389
|
+
.show()
|
390
|
+
.attr( 'class', type )
|
391
|
+
.html( navigation_content );
|
392
|
+
}
|
393
|
+
else
|
394
|
+
{
|
395
|
+
related_navigation_element
|
396
|
+
.hide();
|
397
|
+
|
398
|
+
$( 'option:selected', related_select_element )
|
399
|
+
.removeAttr( 'selected' );
|
400
|
+
}
|
401
|
+
|
402
|
+
if( 'field' === type && value === app.schema_browser_data.unique_key_field )
|
403
|
+
{
|
404
|
+
$( '.unique-key-field', related_navigation_meta )
|
405
|
+
.addClass( 'active' );
|
406
|
+
}
|
407
|
+
else
|
408
|
+
{
|
409
|
+
$( '.unique-key-field', related_navigation_meta )
|
410
|
+
.removeClass( 'active' );
|
411
|
+
}
|
412
|
+
|
413
|
+
if( 'field' === type && value === app.schema_browser_data.default_search_field )
|
414
|
+
{
|
415
|
+
$( '.default-search-field', related_navigation_meta )
|
416
|
+
.addClass( 'active' );
|
417
|
+
}
|
418
|
+
else
|
419
|
+
{
|
420
|
+
$( '.default-search-field', related_navigation_meta )
|
421
|
+
.removeClass( 'active' );
|
422
|
+
}
|
423
|
+
|
424
|
+
if( params.callback )
|
425
|
+
{
|
426
|
+
params.callback( app.schema_browser_data, $( '#data', params.schema_browser_element ) );
|
427
|
+
}
|
428
|
+
}
|
429
|
+
);
|
430
|
+
|
431
|
+
sammy.bind
|
432
|
+
(
|
433
|
+
'schema_browser_load',
|
434
|
+
function( event, params )
|
435
|
+
{
|
436
|
+
var core_basepath = params.active_core.attr( 'data-basepath' );
|
437
|
+
var content_element = $( '#content' );
|
438
|
+
|
439
|
+
if( app.schema_browser_data )
|
440
|
+
{
|
441
|
+
params.schema_browser_element = $( '#schema-browser', content_element );
|
442
|
+
|
443
|
+
sammy.trigger
|
444
|
+
(
|
445
|
+
'schema_browser_navi',
|
446
|
+
params
|
447
|
+
);
|
448
|
+
}
|
449
|
+
else
|
450
|
+
{
|
451
|
+
content_element
|
452
|
+
.html( '<div id="schema-browser"><div class="loader">Loading ...</div></div>' );
|
453
|
+
|
454
|
+
$.ajax
|
455
|
+
(
|
456
|
+
{
|
457
|
+
url : core_basepath + '/admin/luke?numTerms=0&wt=json',
|
458
|
+
dataType : 'json',
|
459
|
+
beforeSend : function( xhr, settings )
|
460
|
+
{
|
461
|
+
},
|
462
|
+
success : function( response, text_status, xhr )
|
463
|
+
{
|
464
|
+
app.schema_browser_data = {
|
465
|
+
default_search_field : null,
|
466
|
+
unique_key_field : null,
|
467
|
+
key : {},
|
468
|
+
fields : {},
|
469
|
+
dynamic_fields : {},
|
470
|
+
types : {},
|
471
|
+
relations : {
|
472
|
+
f_df : {},
|
473
|
+
f_t : {},
|
474
|
+
df_f : {},
|
475
|
+
df_t : {},
|
476
|
+
t_f : {},
|
477
|
+
t_df : {}
|
478
|
+
}
|
479
|
+
};
|
480
|
+
|
481
|
+
app.schema_browser_data.fields = response.fields;
|
482
|
+
app.schema_browser_data.key = response.info.key;
|
483
|
+
|
484
|
+
$.ajax
|
485
|
+
(
|
486
|
+
{
|
487
|
+
url : core_basepath + '/admin/luke?show=schema&wt=json',
|
488
|
+
dataType : 'json',
|
489
|
+
beforeSend : function( xhr, settings )
|
490
|
+
{
|
491
|
+
},
|
492
|
+
success : function( response, text_status, xhr )
|
493
|
+
{
|
494
|
+
app.schema_browser_data.default_search_field = response.schema.defaultSearchField;
|
495
|
+
app.schema_browser_data.unique_key_field = response.schema.uniqueKeyField;
|
496
|
+
|
497
|
+
app.schema_browser_data.dynamic_fields = response.schema.dynamicFields;
|
498
|
+
app.schema_browser_data.types = response.schema.types;
|
499
|
+
|
500
|
+
for( var field in response.schema.fields )
|
501
|
+
{
|
502
|
+
app.schema_browser_data.fields[field] = $.extend
|
503
|
+
(
|
504
|
+
{},
|
505
|
+
app.schema_browser_data.fields[field],
|
506
|
+
response.schema.fields[field]
|
507
|
+
);
|
508
|
+
}
|
509
|
+
|
510
|
+
for( var field in app.schema_browser_data.fields )
|
511
|
+
{
|
512
|
+
var copy_dests = app.schema_browser_data.fields[field].copyDests;
|
513
|
+
for( var i in copy_dests )
|
514
|
+
{
|
515
|
+
var copy_dest = copy_dests[i];
|
516
|
+
if( !app.schema_browser_data.fields[copy_dest] )
|
517
|
+
{
|
518
|
+
app.schema_browser_data.fields[copy_dest] = {
|
519
|
+
partial : true,
|
520
|
+
copySources : []
|
521
|
+
};
|
522
|
+
}
|
523
|
+
|
524
|
+
if( app.schema_browser_data.fields[copy_dest].partial )
|
525
|
+
{
|
526
|
+
app.schema_browser_data.fields[copy_dest].copySources.push( field );
|
527
|
+
}
|
528
|
+
}
|
529
|
+
|
530
|
+
var copy_sources = app.schema_browser_data.fields[field].copySources;
|
531
|
+
for( var i in copy_sources )
|
532
|
+
{
|
533
|
+
var copy_source = copy_sources[i];
|
534
|
+
if( !app.schema_browser_data.fields[copy_source] )
|
535
|
+
{
|
536
|
+
app.schema_browser_data.fields[copy_source] = {
|
537
|
+
partial : true,
|
538
|
+
copyDests : []
|
539
|
+
};
|
540
|
+
}
|
541
|
+
|
542
|
+
if( app.schema_browser_data.fields[copy_source].partial )
|
543
|
+
{
|
544
|
+
app.schema_browser_data.fields[copy_source].copyDests.push( field );
|
545
|
+
}
|
546
|
+
}
|
547
|
+
|
548
|
+
app.schema_browser_data.relations.f_t[field] = app.schema_browser_data.fields[field].type;
|
549
|
+
|
550
|
+
if( !app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type] )
|
551
|
+
{
|
552
|
+
app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type] = [];
|
553
|
+
}
|
554
|
+
app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type].push( field );
|
555
|
+
|
556
|
+
if( app.schema_browser_data.fields[field].dynamicBase )
|
557
|
+
{
|
558
|
+
app.schema_browser_data.relations.f_df[field] = app.schema_browser_data.fields[field].dynamicBase;
|
559
|
+
|
560
|
+
if( !app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase] )
|
561
|
+
{
|
562
|
+
app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase] = [];
|
563
|
+
}
|
564
|
+
app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase].push( field );
|
565
|
+
}
|
566
|
+
}
|
567
|
+
|
568
|
+
for( var dynamic_field in app.schema_browser_data.dynamic_fields )
|
569
|
+
{
|
570
|
+
app.schema_browser_data.relations.df_t[dynamic_field] = app.schema_browser_data.dynamic_fields[dynamic_field].type;
|
571
|
+
|
572
|
+
if( !app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type] )
|
573
|
+
{
|
574
|
+
app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type] = [];
|
575
|
+
}
|
576
|
+
app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type].push( dynamic_field );
|
577
|
+
}
|
578
|
+
|
579
|
+
$.get
|
580
|
+
(
|
581
|
+
'tpl/schema-browser.html',
|
582
|
+
function( template )
|
583
|
+
{
|
584
|
+
content_element
|
585
|
+
.html( template );
|
586
|
+
|
587
|
+
var schema_browser_element = $( '#schema-browser', content_element );
|
588
|
+
var related_element = $( '#related', schema_browser_element );
|
589
|
+
var related_select_element = $( 'select', related_element );
|
590
|
+
var data_element = $( '#data', schema_browser_element );
|
591
|
+
|
592
|
+
var related_options = '';
|
593
|
+
|
594
|
+
var fields = [];
|
595
|
+
for( var field_name in app.schema_browser_data.fields )
|
596
|
+
{
|
597
|
+
fields.push
|
598
|
+
(
|
599
|
+
'<option value="?field=' + field_name.esc() + '">' + field_name.esc() + '</option>'
|
600
|
+
);
|
601
|
+
}
|
602
|
+
if( 0 !== fields.length )
|
603
|
+
{
|
604
|
+
fields.sort();
|
605
|
+
related_options += '<optgroup label="Fields">' + "\n";
|
606
|
+
related_options += fields.sort().join( "\n" ) + "\n";
|
607
|
+
related_options += '</optgroup>' + "\n";
|
608
|
+
}
|
609
|
+
|
610
|
+
var dynamic_fields = [];
|
611
|
+
for( var type_name in app.schema_browser_data.dynamic_fields )
|
612
|
+
{
|
613
|
+
dynamic_fields.push
|
614
|
+
(
|
615
|
+
'<option value="?dynamic-field=' + type_name.esc() + '">' + type_name.esc() + '</option>'
|
616
|
+
);
|
617
|
+
}
|
618
|
+
if( 0 !== dynamic_fields.length )
|
619
|
+
{
|
620
|
+
dynamic_fields.sort();
|
621
|
+
related_options += '<optgroup label="DynamicFields">' + "\n";
|
622
|
+
related_options += dynamic_fields.sort().join( "\n" ) + "\n";
|
623
|
+
related_options += '</optgroup>' + "\n";
|
624
|
+
}
|
625
|
+
|
626
|
+
var types = [];
|
627
|
+
for( var type_name in app.schema_browser_data.types )
|
628
|
+
{
|
629
|
+
types.push
|
630
|
+
(
|
631
|
+
'<option value="?type=' + type_name.esc() + '">' + type_name.esc() + '</option>'
|
632
|
+
);
|
633
|
+
}
|
634
|
+
if( 0 !== types.length )
|
635
|
+
{
|
636
|
+
types.sort();
|
637
|
+
related_options += '<optgroup label="Types">' + "\n";
|
638
|
+
related_options += types.sort().join( "\n" ) + "\n";
|
639
|
+
related_options += '</optgroup>' + "\n";
|
640
|
+
}
|
641
|
+
|
642
|
+
related_select_element
|
643
|
+
.attr( 'rel', app.core_menu.find( '.active a' ).attr( 'href' ) )
|
644
|
+
.append( related_options )
|
645
|
+
.chosen();
|
646
|
+
|
647
|
+
related_select_element
|
648
|
+
.die( 'change' )
|
649
|
+
.live
|
650
|
+
(
|
651
|
+
'change',
|
652
|
+
function( event )
|
653
|
+
{
|
654
|
+
var select_element = $( this );
|
655
|
+
var option_element = $( 'option:selected', select_element );
|
656
|
+
|
657
|
+
location.href = select_element.attr( 'rel' ) + option_element.val();
|
658
|
+
return false;
|
659
|
+
}
|
660
|
+
);
|
661
|
+
|
662
|
+
params.schema_browser_element = schema_browser_element;
|
663
|
+
sammy.trigger
|
664
|
+
(
|
665
|
+
'schema_browser_navi',
|
666
|
+
params
|
667
|
+
);
|
668
|
+
}
|
669
|
+
);
|
670
|
+
},
|
671
|
+
error : function( xhr, text_status, error_thrown)
|
672
|
+
{
|
673
|
+
},
|
674
|
+
complete : function( xhr, text_status )
|
675
|
+
{
|
676
|
+
}
|
677
|
+
}
|
678
|
+
);
|
679
|
+
|
680
|
+
},
|
681
|
+
error : function( xhr, text_status, error_thrown)
|
682
|
+
{
|
683
|
+
},
|
684
|
+
complete : function( xhr, text_status )
|
685
|
+
{
|
686
|
+
}
|
687
|
+
}
|
688
|
+
);
|
689
|
+
}
|
690
|
+
}
|
691
|
+
);
|
692
|
+
|
693
|
+
// #/:core/schema-browser
|
694
|
+
sammy.get
|
695
|
+
(
|
696
|
+
new RegExp( app.core_regex_base + '\\/(schema-browser)$' ),
|
697
|
+
function( context )
|
698
|
+
{
|
699
|
+
var core_basepath = this.active_core.attr( 'data-basepath' );
|
700
|
+
current_core = context.params.splat[0];
|
701
|
+
|
702
|
+
var trigger_params = {
|
703
|
+
active_core : this.active_core
|
704
|
+
};
|
705
|
+
|
706
|
+
var path = context.path.split( '?' );
|
707
|
+
if( path && path[1] )
|
708
|
+
{
|
709
|
+
var param = path[1].split( '=' );
|
710
|
+
trigger_params.route_params = {
|
711
|
+
path : '?' + path[1],
|
712
|
+
type : param[0],
|
713
|
+
value : param[1]
|
714
|
+
}
|
715
|
+
|
716
|
+
trigger_params.callback = function( schema_browser_data, data_element )
|
717
|
+
{
|
718
|
+
var field = trigger_params.route_params.value;
|
719
|
+
|
720
|
+
var type = trigger_params.route_params.type;
|
721
|
+
var is_f = 'field' === type;
|
722
|
+
var is_df = 'dynamic-field' === type;
|
723
|
+
var is_t = 'type' === type;
|
724
|
+
|
725
|
+
var options_element = $( '.options', data_element );
|
726
|
+
var sammy_basepath = context.path.indexOf( '/', context.path.indexOf( '/', 2 ) + 1 );
|
727
|
+
|
728
|
+
data_element
|
729
|
+
.show();
|
730
|
+
|
731
|
+
// -- head
|
732
|
+
|
733
|
+
var head_element = $( '.head', data_element );
|
734
|
+
if( is_f )
|
735
|
+
{
|
736
|
+
$( '.type', head_element ).html( 'Field' );
|
737
|
+
}
|
738
|
+
else if( is_df )
|
739
|
+
{
|
740
|
+
$( '.type', head_element ).html( 'Dynamic Field' );
|
741
|
+
}
|
742
|
+
else if( is_t )
|
743
|
+
{
|
744
|
+
$( '.type', head_element ).html( 'Type' );
|
745
|
+
}
|
746
|
+
$( '.name', head_element ).html( field.esc() );
|
747
|
+
|
748
|
+
|
749
|
+
var partial_state = false;
|
750
|
+
if( is_f )
|
751
|
+
{
|
752
|
+
partial_state = !!schema_browser_data.fields[field].partial;
|
753
|
+
}
|
754
|
+
|
755
|
+
$( '.partial', data_element )
|
756
|
+
.toggle( partial_state );
|
757
|
+
|
758
|
+
// -- docs
|
759
|
+
var docs_element = $( 'dt.docs', options_element );
|
760
|
+
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].docs )
|
761
|
+
{
|
762
|
+
$( 'dd.docs', options_element )
|
763
|
+
.remove();
|
764
|
+
|
765
|
+
var target = '#/' + current_core + '/query?q=' + field.esc() + ':[* TO *]';
|
766
|
+
docs_element
|
767
|
+
.show()
|
768
|
+
.after(
|
769
|
+
'<dd class="docs">'+
|
770
|
+
'<a href="'+target+'">' + schema_browser_data.fields[field].docs + '</a>' +
|
771
|
+
'</dd>' );
|
772
|
+
}
|
773
|
+
else
|
774
|
+
{
|
775
|
+
$( '.docs', options_element )
|
776
|
+
.hide();
|
777
|
+
}
|
778
|
+
|
779
|
+
// -- distinct
|
780
|
+
var distinct_element = $( 'dt.distinct', options_element );
|
781
|
+
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].distinct )
|
782
|
+
{
|
783
|
+
$( 'dd.distinct', options_element )
|
784
|
+
.remove();
|
785
|
+
|
786
|
+
distinct_element
|
787
|
+
.show()
|
788
|
+
.after( '<dd class="distinct">' + schema_browser_data.fields[field].distinct + '</dd>' );
|
789
|
+
}
|
790
|
+
else
|
791
|
+
{
|
792
|
+
$( '.distinct', options_element )
|
793
|
+
.hide();
|
794
|
+
}
|
795
|
+
|
796
|
+
// -- position-increment-gap
|
797
|
+
var pig_element = $( 'dt.position-increment-gap', options_element );
|
798
|
+
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].positionIncrementGap )
|
799
|
+
{
|
800
|
+
$( 'dd.position-increment-gap', options_element )
|
801
|
+
.remove();
|
802
|
+
|
803
|
+
pig_element
|
804
|
+
.show()
|
805
|
+
.after( '<dd class="position-increment-gap">' + schema_browser_data.fields[field].positionIncrementGap + '</dd>' );
|
806
|
+
}
|
807
|
+
else
|
808
|
+
{
|
809
|
+
$( '.position-increment-gap', options_element )
|
810
|
+
.hide();
|
811
|
+
}
|
812
|
+
|
813
|
+
var similarity_element = $( 'dt.similarity', options_element );
|
814
|
+
if ( is_t && schema_browser_data.types[field] && schema_browser_data.types[field].similarity ) {
|
815
|
+
var similarity = schema_browser_data.types[field].similarity
|
816
|
+
if (similarity.details && similarity.className) {
|
817
|
+
$( 'dd.similarity', options_element ).remove();
|
818
|
+
similarity_element
|
819
|
+
.show()
|
820
|
+
.after(['<dd class="similarity">', similarity.details.esc(), ' (', similarity.className.esc(), ') </dd>'].join(""));
|
821
|
+
}
|
822
|
+
} else {
|
823
|
+
$( '.similarity', options_element ).hide();
|
824
|
+
}
|
825
|
+
|
826
|
+
|
827
|
+
// -- flags table
|
828
|
+
var flags_table = $( 'table.flags', data_element );
|
829
|
+
|
830
|
+
var flags_arr = [];
|
831
|
+
for( var key in schema_browser_data.key )
|
832
|
+
{
|
833
|
+
flags_arr.push( '<th data-key="' + key + '">' + schema_browser_data.key[key] + '</th>' );
|
834
|
+
}
|
835
|
+
|
836
|
+
$( 'thead tr', flags_table )
|
837
|
+
.append( flags_arr.join( "\n" ) );
|
838
|
+
|
839
|
+
|
840
|
+
var flags_body = $( 'tbody', flags_table );
|
841
|
+
flags_body.empty();
|
842
|
+
|
843
|
+
var generate_flags_row = function generate_flags_row( flags_str, title )
|
844
|
+
{
|
845
|
+
var flags_arr = [ '<th>' + title.esc() + '</th>' ];
|
846
|
+
|
847
|
+
if( 0 === flags_str.indexOf( '(' ) )
|
848
|
+
{
|
849
|
+
flags_arr.push( '<td colspan="2" class="text">' + flags_str + '</td>' );
|
850
|
+
}
|
851
|
+
else
|
852
|
+
{
|
853
|
+
var i = 0;
|
854
|
+
for( var key in schema_browser_data.key )
|
855
|
+
{
|
856
|
+
var flag_match = key === flags_str[i];
|
857
|
+
|
858
|
+
var flag_cell = '<td '
|
859
|
+
+ ' data-key="' + key + '"'
|
860
|
+
+ ' class="' + ( flag_match ? 'check' : '' ) + '"'
|
861
|
+
+ '>'
|
862
|
+
+ ( flag_match ? '<span>√</span>' : ' ' )
|
863
|
+
+ '</td>';
|
864
|
+
|
865
|
+
flags_arr.push( flag_cell );
|
866
|
+
i++;
|
867
|
+
}
|
868
|
+
}
|
869
|
+
|
870
|
+
flags_body
|
871
|
+
.append( '<tr>' + flags_arr.join( "\n" ) + '</tr>' );
|
872
|
+
};
|
873
|
+
|
874
|
+
var flags = null;
|
875
|
+
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].flags )
|
876
|
+
{
|
877
|
+
flags = schema_browser_data.fields[field].flags;
|
878
|
+
}
|
879
|
+
else if( is_df && schema_browser_data.dynamic_fields[field] && schema_browser_data.dynamic_fields[field].flags )
|
880
|
+
{
|
881
|
+
flags = schema_browser_data.dynamic_fields[field].flags;
|
882
|
+
}
|
883
|
+
|
884
|
+
if( flags )
|
885
|
+
{
|
886
|
+
generate_flags_row( flags, 'Properties' );
|
887
|
+
}
|
888
|
+
|
889
|
+
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].schema )
|
890
|
+
{
|
891
|
+
generate_flags_row( schema_browser_data.fields[field].schema, 'Schema' );
|
892
|
+
}
|
893
|
+
|
894
|
+
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].index )
|
895
|
+
{
|
896
|
+
generate_flags_row( schema_browser_data.fields[field].index, 'Index' );
|
897
|
+
}
|
898
|
+
|
899
|
+
|
900
|
+
if( 0 !== $( 'tr', flags_body ).size() )
|
901
|
+
{
|
902
|
+
var col_count = 0;
|
903
|
+
for( var key in schema_browser_data.key )
|
904
|
+
{
|
905
|
+
var cols = $( '[data-key="' + key + '"]', flags_table );
|
906
|
+
|
907
|
+
var col_used = 0 !== cols.filter( '.check' ).size();
|
908
|
+
col_count += col_used;
|
909
|
+
|
910
|
+
cols.toggle( col_used );
|
911
|
+
}
|
912
|
+
|
913
|
+
$( 'td[colspan]', flags_body )
|
914
|
+
.attr( 'colspan', col_count );
|
915
|
+
|
916
|
+
flags_table.show();
|
917
|
+
}
|
918
|
+
else
|
919
|
+
{
|
920
|
+
flags_table.hide();
|
921
|
+
}
|
922
|
+
|
923
|
+
var analyzer_element = $( '.analyzer', data_element );
|
924
|
+
var analyzer_data = null;
|
925
|
+
|
926
|
+
var analysis_link = false;
|
927
|
+
var analysis_link_elements = $( 'p a', analyzer_element );
|
928
|
+
var analysis_target = '#/' + current_core + '/analysis?';
|
929
|
+
|
930
|
+
if( is_f )
|
931
|
+
{
|
932
|
+
analyzer_data = schema_browser_data.types[schema_browser_data.relations.f_t[field]];
|
933
|
+
|
934
|
+
analysis_link = true;
|
935
|
+
analysis_target += 'analysis.fieldname=' + field;
|
936
|
+
}
|
937
|
+
else if( is_df )
|
938
|
+
{
|
939
|
+
analyzer_data = schema_browser_data.types[schema_browser_data.relations.df_t[field]];
|
940
|
+
}
|
941
|
+
else if( is_t )
|
942
|
+
{
|
943
|
+
analyzer_data = schema_browser_data.types[field];
|
944
|
+
|
945
|
+
analysis_link = true;
|
946
|
+
analysis_target += 'analysis.fieldtype=' + field;
|
947
|
+
}
|
948
|
+
|
949
|
+
if( analysis_link )
|
950
|
+
{
|
951
|
+
analysis_link_elements
|
952
|
+
.addClass( 'analysis' )
|
953
|
+
.attr( 'href', analysis_target );
|
954
|
+
}
|
955
|
+
else
|
956
|
+
{
|
957
|
+
analysis_link_elements
|
958
|
+
.removeClass( 'analysis' )
|
959
|
+
.removeAttr( 'href' );
|
960
|
+
}
|
961
|
+
|
962
|
+
|
963
|
+
if( analyzer_data )
|
964
|
+
{
|
965
|
+
var transform_analyzer_data_into_list = function( analyzer_data )
|
966
|
+
{
|
967
|
+
var args = [];
|
968
|
+
for( var key in analyzer_data.args )
|
969
|
+
{
|
970
|
+
var arg_class = '';
|
971
|
+
var arg_content = '';
|
972
|
+
|
973
|
+
if( 'true' === analyzer_data.args[key] || '1' === analyzer_data.args[key] )
|
974
|
+
{
|
975
|
+
arg_class = 'ico-1';
|
976
|
+
arg_content = key;
|
977
|
+
}
|
978
|
+
else if( 'false' === analyzer_data.args[key] || '0' === analyzer_data.args[key] )
|
979
|
+
{
|
980
|
+
arg_class = 'ico-0';
|
981
|
+
arg_content = key;
|
982
|
+
}
|
983
|
+
else
|
984
|
+
{
|
985
|
+
arg_content = key + ': ';
|
986
|
+
|
987
|
+
if( 'synonyms' === key || 'words' === key )
|
988
|
+
{
|
989
|
+
// @TODO: set link target for file
|
990
|
+
arg_content += '<a>' + analyzer_data.args[key] + '</a>';
|
991
|
+
}
|
992
|
+
else
|
993
|
+
{
|
994
|
+
arg_content += analyzer_data.args[key];
|
995
|
+
}
|
996
|
+
}
|
997
|
+
|
998
|
+
args.push( '<dd class="' + arg_class + '">' + arg_content + '</dd>' );
|
999
|
+
}
|
1000
|
+
|
1001
|
+
var list_content = '<dt>' + analyzer_data.className + '</dt>';
|
1002
|
+
if( 0 !== args.length )
|
1003
|
+
{
|
1004
|
+
args.sort();
|
1005
|
+
list_content += args.join( "\n" );
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
return list_content;
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
// -- field-type
|
1012
|
+
var field_type_element = $( 'dt.field-type', options_element );
|
1013
|
+
|
1014
|
+
$( 'dd.field-type', options_element )
|
1015
|
+
.remove();
|
1016
|
+
|
1017
|
+
field_type_element
|
1018
|
+
.show()
|
1019
|
+
.after( '<dd class="field-type">' + analyzer_data.className + '</dd>' );
|
1020
|
+
|
1021
|
+
$( '.toggle', analyzer_element )
|
1022
|
+
.die( 'click' )
|
1023
|
+
.live
|
1024
|
+
(
|
1025
|
+
'click',
|
1026
|
+
function( event )
|
1027
|
+
{
|
1028
|
+
$( this ).closest( 'li' )
|
1029
|
+
.toggleClass( 'open' );
|
1030
|
+
|
1031
|
+
return false;
|
1032
|
+
}
|
1033
|
+
);
|
1034
|
+
|
1035
|
+
for( var key in analyzer_data )
|
1036
|
+
{
|
1037
|
+
var key_match = key.match( /^(.+)Analyzer$/ );
|
1038
|
+
if( !key_match )
|
1039
|
+
{
|
1040
|
+
continue;
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
var analyzer_key_element = $( '.' + key_match[1], analyzer_element );
|
1044
|
+
var analyzer_key_data = analyzer_data[key];
|
1045
|
+
|
1046
|
+
analyzer_element.show();
|
1047
|
+
analyzer_key_element.show();
|
1048
|
+
|
1049
|
+
$( 'ul li', analyzer_key_element )
|
1050
|
+
.removeClass( 'data' )
|
1051
|
+
.hide();
|
1052
|
+
|
1053
|
+
for( var type in analyzer_key_data )
|
1054
|
+
{
|
1055
|
+
if( 'object' !== typeof analyzer_key_data[type] )
|
1056
|
+
{
|
1057
|
+
continue;
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
var type_element = $( '.' + type, analyzer_key_element );
|
1061
|
+
var type_content = [];
|
1062
|
+
|
1063
|
+
type_element
|
1064
|
+
.addClass( 'data' )
|
1065
|
+
.show();
|
1066
|
+
|
1067
|
+
if( analyzer_key_data[type].className )
|
1068
|
+
{
|
1069
|
+
type_content.push( transform_analyzer_data_into_list( analyzer_key_data[type] ) );
|
1070
|
+
}
|
1071
|
+
else
|
1072
|
+
{
|
1073
|
+
for( var entry in analyzer_key_data[type] )
|
1074
|
+
{
|
1075
|
+
type_content.push( transform_analyzer_data_into_list( analyzer_key_data[type][entry] ) );
|
1076
|
+
}
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
$( 'dl', type_element )
|
1080
|
+
.empty()
|
1081
|
+
.append( type_content.join( "\n" ) );
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
var name_element = $( 'dl:first dt a', analyzer_key_element );
|
1085
|
+
if( analyzer_key_data.className )
|
1086
|
+
{
|
1087
|
+
name_element
|
1088
|
+
.html( analyzer_key_data.className );
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
0 === $( 'ul li.data', analyzer_key_element ).size()
|
1092
|
+
? name_element.removeClass( 'toggle' )
|
1093
|
+
: name_element.addClass( 'toggle' );
|
1094
|
+
}
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
var terminfo_element = $( '.terminfo-holder', data_element );
|
1098
|
+
|
1099
|
+
terminfo_element
|
1100
|
+
.removeClass( 'disabled' )
|
1101
|
+
.removeClass( 'loaded' );
|
1102
|
+
|
1103
|
+
var trigger_element = $( '.trigger button', terminfo_element );
|
1104
|
+
var form_element = $( 'form', terminfo_element );
|
1105
|
+
|
1106
|
+
trigger_element
|
1107
|
+
.die( 'click' )
|
1108
|
+
.live
|
1109
|
+
(
|
1110
|
+
'click',
|
1111
|
+
function( event )
|
1112
|
+
{
|
1113
|
+
form_element
|
1114
|
+
.trigger( 'submit' );
|
1115
|
+
|
1116
|
+
return false;
|
1117
|
+
}
|
1118
|
+
);
|
1119
|
+
|
1120
|
+
form_element
|
1121
|
+
.clearForm()
|
1122
|
+
.die( 'submit' )
|
1123
|
+
.live
|
1124
|
+
(
|
1125
|
+
'submit',
|
1126
|
+
function( event )
|
1127
|
+
{
|
1128
|
+
load_terminfo( trigger_element, core_basepath, field, data_element, terminfo_element );
|
1129
|
+
|
1130
|
+
terminfo_element
|
1131
|
+
.addClass( 'loaded' );
|
1132
|
+
|
1133
|
+
return false;
|
1134
|
+
}
|
1135
|
+
);
|
1136
|
+
|
1137
|
+
$( '.max-holder', terminfo_element )
|
1138
|
+
.die( 'click' )
|
1139
|
+
.live
|
1140
|
+
(
|
1141
|
+
'click',
|
1142
|
+
function( event )
|
1143
|
+
{
|
1144
|
+
var element = $( this );
|
1145
|
+
|
1146
|
+
$( 'input', element.closest( 'form' ) )
|
1147
|
+
.val( $( '.max', element ).text() );
|
1148
|
+
|
1149
|
+
form_element
|
1150
|
+
.trigger( 'submit' );
|
1151
|
+
|
1152
|
+
return false;
|
1153
|
+
}
|
1154
|
+
);
|
1155
|
+
|
1156
|
+
$( '.trigger .autoload', terminfo_element )
|
1157
|
+
.die( 'click' )
|
1158
|
+
.live
|
1159
|
+
(
|
1160
|
+
'click',
|
1161
|
+
function( event )
|
1162
|
+
{
|
1163
|
+
$.cookie( cookie_schema_browser_autoload, $.cookie( cookie_schema_browser_autoload ) ? null : true );
|
1164
|
+
$( this ).trigger( 'state' );
|
1165
|
+
|
1166
|
+
return false;
|
1167
|
+
}
|
1168
|
+
)
|
1169
|
+
.die( 'state' )
|
1170
|
+
.live
|
1171
|
+
(
|
1172
|
+
'state',
|
1173
|
+
function( event )
|
1174
|
+
{
|
1175
|
+
$.cookie( cookie_schema_browser_autoload )
|
1176
|
+
? $( this ).addClass( 'on' )
|
1177
|
+
: $( this ).removeClass( 'on' );
|
1178
|
+
}
|
1179
|
+
)
|
1180
|
+
.die( 'init' )
|
1181
|
+
.live
|
1182
|
+
(
|
1183
|
+
'init',
|
1184
|
+
function( event )
|
1185
|
+
{
|
1186
|
+
if( !$.cookie( cookie_schema_browser_autoload ) )
|
1187
|
+
{
|
1188
|
+
return false;
|
1189
|
+
}
|
1190
|
+
|
1191
|
+
$( this ).trigger( 'state' );
|
1192
|
+
trigger_element.trigger( 'click' );
|
1193
|
+
}
|
1194
|
+
)
|
1195
|
+
.trigger( 'init' );
|
1196
|
+
|
1197
|
+
$( 'div[class$="-holder"]', terminfo_element )
|
1198
|
+
.hide();
|
1199
|
+
|
1200
|
+
if( !is_f )
|
1201
|
+
{
|
1202
|
+
terminfo_element
|
1203
|
+
.hide();
|
1204
|
+
}
|
1205
|
+
else
|
1206
|
+
{
|
1207
|
+
terminfo_element
|
1208
|
+
.show();
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
else
|
1213
|
+
{
|
1214
|
+
trigger_params.callback = function( schema_browser_data, data_element )
|
1215
|
+
{
|
1216
|
+
data_element
|
1217
|
+
.hide();
|
1218
|
+
};
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
delete app.schema_browser_data;
|
1222
|
+
|
1223
|
+
sammy.trigger
|
1224
|
+
(
|
1225
|
+
'schema_browser_load',
|
1226
|
+
trigger_params
|
1227
|
+
);
|
1228
|
+
}
|
1229
|
+
);
|