SOLR-1497 - remove solrjs

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@824396 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2009-10-12 16:01:51 +00:00
parent 1f9e0eb390
commit 2e4b1427fa
188 changed files with 5 additions and 20531 deletions

View File

@ -1,64 +0,0 @@
==============================================================
Apache Solr / Contrib Javascript
Copyright 2006-2008 The Apache Software Foundation
==============================================================
=========================================================================
== jQuery -- http://www.jquery.com/ ==
=========================================================================
Copyright (c) 2008 John Resig, http://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================================================
== JsDoc Toolkit -- http://www.jsdoctoolkit.org/ ==
=========================================================================
JsDoc Toolkit
All code specific to JsDoc Toolkit are free, open source and licensed
for use under the X11/MIT License.
JsDoc Toolkit is Copyright (c)2008 Michael Mathews <micmath@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms below.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: The above copyright notice and this
permission notice must be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,5 @@
For a Solr JavaScript Client, see:
http://evolvingweb.github.com/ajax-solr/
For information on (now deprecated) SorlJS, see:
http://wiki.apache.org/solr/SolrJS

View File

@ -1,137 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="solrjs" default="dist" basedir=".">
<!-- our current version -->
<property name="version" value="1.4-dev"/>
<!-- a filelist for the core js files in correct order -->
<filelist id="src_core" dir="src/core" >
<file name="Core.js"/>
<file name="QueryItem.js"/>
<file name="Manager.js"/>
<file name="AbstractWidget.js"/>
<file name="AbstractServerSideWidget.js"/>
<file name="AbstractClientSideWidget.js"/>
</filelist>
<!-- a fileset for the server side widget files -->
<fileset id="src_serverside" dir="src/serverside" >
<include name="*.js"/>
</fileset>
<!-- a fileset for the client side widget files -->
<fileset id="src_clientside" dir="src/clientside" >
<include name="*.js"/>
</fileset>
<!-- create dist -->
<target name="clean">
<delete dir="dist" quiet="true"/>
<delete dir="doc" quiet="true"/>
</target>
<target name="create-dist-folder" depends="clean">
<mkdir dir="dist" />
</target>
<!-- create a single js file -->
<target name="concat" depends="create-dist-folder">
<concat destfile="dist/solrjs-${version}.js" fixlastline="true">
<filelist refid="src_core"/>
<fileset refid="src_serverside"/>
<fileset refid="src_clientside"/>
</concat>
</target>
<target name="dist" depends="concat,docs">
<jar destfile="dist/solrjs-${version}-templates.jar">
<fileset dir="src/templates" >
<include name="*.vm"/>
</fileset>
</jar>
</target>
<!-- create docs -->
<target name="docs">
<delete dir="dist/doc"/>
<mkdir dir="dist/doc"/>
<java jar="lib/jsdoc/jsdoc-toolkit/jsrun.jar" fork="true" failonerror="true">
<arg value="lib/jsdoc/jsdoc-toolkit/app/run.js"/>
<arg value="-r=4" />
<arg value="src/" />
<arg value="-t=lib/jsdoc/jsdoc-toolkit/templates/jsdoc"/>
<arg value="-d=dist/doc"/>
<arg value="-p"/>
</java>
</target>
<!--+
| Reuters example
+-->
<!-- start solr server, using example/reuters/testsolr/solr -->
<target name="reuters-start">
<copy todir="example/reuters/testsolr/solr/lib" overwrite="true">
<fileset dir="../../contrib/velocity/src/main/solr/lib/" />
</copy>
<copy file="dist/solrjs-${version}-templates.jar" todir="example/reuters/testsolr/solr/lib" />
<java jar="../../example/start.jar" fork="true" failonerror="true" dir="../../example">
<sysproperty key="solr.solr.home" value="../client/javascript/example/reuters/testsolr/solr"/>
</java>
</target>
<!-- import testdata (server has to be online via reuters-start) -->
<target name="reuters-import">
<javac srcdir="example/reuters/importer/java">
<classpath>
<fileset dir="../../lib">
<include name="*.jar"/>
</fileset>
<fileset dir="../../dist">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
<java classname="org.apache.solr.solrjs.ReutersService" fork="true" dir="example/reuters/testdata">
<arg value="http://localhost:8983/solr/" />
<arg value="." />
<classpath>
<fileset dir="../../lib">
<include name="*.jar"/>
</fileset>
<fileset dir="../../dist">
<include name="*.jar"/>
</fileset>
<fileset dir="../../dist/solrj-lib">
<include name="*.jar"/>
</fileset>
<path location="example/reuters/importer/java"/>
</classpath>
</java>
</target>
<!-- do nothing for now, required for generate maven artifacts -->
<target name="build"/>
<target name="example"/>
<target name="javadoc"/>
<target name="test"/> <!-- TODO: Tests would be nice :) -->
</project>

View File

@ -1,75 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<style type="text/css">
body { font-family: Arial, sans; font-size: 0.8em}
</style>
<script src="../../lib/jquery/jquery-1.2.6.js"></script>
<script src="../../src/core/Core.js"></script>
<script src="../../src/core/QueryItem.js"></script>
<script src="../../src/core/Manager.js"></script>
<script src="../../src/core/AbstractWidget.js"></script>
<script src="../../src/core/AbstractServerSideWidget.js"></script>
<script src="../../src/core/AbstractClientSideWidget.js"></script>
<script src="../../src/clientside/ExtensibleResultWidget.js"/></script>
<script src="../../src/clientside/FacetWidget.js"/></script>
<script>
var $sj = jQuery.noConflict();
</script>
<script>
var solrjsManager;
$sj(document).ready(function(){
solrjsManager = new $sj.solrjs.Manager({solrUrl:"http://localhost:8983/solr/select"});
// a custom result widget
var resultWidget = new $sj.solrjs.ExtensibleResultWidget({
id:"result",
target:"#result",
rows:20,
renderResult : function(docs, pageSize, offset) {
var container = jQuery("<div/>");
$sj.each(docs, function(i, item) {
jQuery("<h3/>").html(item["id"]).appendTo(container);
if (item["cat"] != null) {
jQuery("<p/>").html(item["cat"].toString()).appendTo(container);
}
jQuery("<hr/>").appendTo(container);
});
container.appendTo(this.target);
}
});
solrjsManager.addWidget(resultWidget);
solrjsManager.addWidget(new $sj.solrjs.FacetWidget({id:"cat", target:"#cat", fieldName:"cat"}));
solrjsManager.doRequestAll();
});
</script>
<style>img{ height: 100px; float: left; }</style>
</head>
<body>
<div id="facets" style="float:left;width:300px;">
<h3 style="margin-top:0px">cat</h3>
<div id="cat"></div>
</div>
<div id="result" style="margin-left:300px;"></div>
</body>
</html>

View File

@ -1,69 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<style type="text/css">
body { font-family: Arial, sans; font-size: 0.8em}
</style>
<script src="../../lib/jquery/jquery-1.2.6.js"></script>
<script src="../../src/core/Core.js"></script>
<script src="../../src/core/QueryItem.js"></script>
<script src="../../src/core/Manager.js"></script>
<script src="../../src/core/AbstractWidget.js"></script>
<script src="../../src/core/AbstractServerSideWidget.js"></script>
<script src="../../src/core/AbstractClientSideWidget.js"></script>
<script src="../../src/serverside/SimpleServerSideWidget.js"/></script>
<script src="../../src/serverside/FacetServerSideWidget.js"/></script>
<script>
var $sj = jQuery.noConflict();
</script>
<script>
var solrjsManager;
$sj(document).ready(function(){
solrjsManager = new $sj.solrjs.Manager({solrUrl:"http://localhost:8983/solr/select"});
// a custom result widget
var resultWidget = new $sj.solrjs.SimpleServerSideWidget({
id:"result",
target:"#result",
rows:5,
templateName:"testresult"
});
solrjsManager.addWidget(resultWidget);
solrjsManager.addWidget(new $sj.solrjs.FacetServerSideWidget({id:"cat", target:"#cat", fieldName:"cat"}));
solrjsManager.doRequestAll();
});
</script>
</head>
<body>
<body>
<div id="facets" style="float:left;width:300px;">
<h3 style="margin-top:0px">cat</h3>
<div id="cat"></div>
</div>
<div id="result" style="margin-left:300px;"></div>
</body>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

View File

@ -1,267 +0,0 @@
package org.apache.solr.solrjs;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.apache.solr.common.SolrInputDocument;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class ReutersService {
private Map<String, String> countryCodesMap = new HashMap<String, String>();
public static void main(String[] args) throws XPathExpressionException, IOException, ParserConfigurationException, SAXException, SolrServerException, ParseException {
String usage = "Usage: java -jar reutersimporter.jar <solrUrl> <datadir>";
URL solrUrl = null;
try {
solrUrl = new URL(args[0]);
} catch (Exception e) {
System.out.println("First argument needs to be an URL!");
System.out.println(usage);
}
File baseDir = null;
try {
baseDir = new File(args[1]);
if (!baseDir.exists() || !baseDir.isDirectory()) {
System.out.println("Second argument needs to be an existing directory!");;
System.out.println(usage);
}
} catch (Exception e) {
System.out.println("Second argument needs to be an existing directory!");;
System.out.println(usage);
}
if (solrUrl != null && baseDir!= null && baseDir.exists() && baseDir.isDirectory()) {
ReutersService reutersService = new ReutersService(solrUrl.toExternalForm());
reutersService.readDirectory(baseDir);
}
}
/**
* The Solr Server to use
*/
private SolrServer solrServer;
/**
* A shared xpath instance
*/
private final XPath xPath = XPathFactory.newInstance().newXPath();
/**
* The format used in the sgml files.
* eg. 26-FEB-1987 15:01:01.79
*/
private final SimpleDateFormat reutersDateFormat = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SS", Locale.ENGLISH);
/**
* A service that inputs the reuters TODO dataset.
* @param solrUrl The url of the solr server.
*/
public ReutersService(String solrUrl) {
try {
this.solrServer = new CommonsHttpSolrServer(solrUrl);
this.solrServer.ping();
} catch (Exception e) {
throw new RuntimeException("unable to connect to solr server: " + solrUrl, e );
}
}
/**
* Takes a <REUTERS> node and converts it into a SolrInoutDocument.
* @param element A <REUTERS> node.
* @throws XPathExpressionException
* @throws SolrServerException
* @throws IOException
* @throws ParseException
*/
public void readDocument(Element element) throws XPathExpressionException, SolrServerException, IOException, ParseException {
SolrInputDocument inputDocument = new SolrInputDocument();
inputDocument.addField("id", element.getAttribute("NEWID"));
inputDocument.addField("title", xPath.evaluate("TEXT/TITLE", element));
inputDocument.addField("dateline", xPath.evaluate("TEXT/DATELINE", element).trim());
inputDocument.addField("text", xPath.evaluate("TEXT/BODY", element).trim());
inputDocument.addField("places", readList("PLACES/D", element));
inputDocument.addField("topics", readList("TOPICS/D", element));
inputDocument.addField("organisations", readList("ORGS/D", element));
inputDocument.addField("exchanges", readList("EXCHANGES/D", element));
inputDocument.addField("companies", readList("COMPANIES/D", element));
try {
inputDocument.addField("date", this.reutersDateFormat.parse(xPath.evaluate("DATE", element)));
} catch (ParseException e) {
inputDocument.addField("date", this.reutersDateFormat.parse("0" + xPath.evaluate("DATE", element)));
}
for (Object place : inputDocument.getFieldValues("places")) {
String code = this.countryCodesMap.get(place);
if (code == null) {
try {
code = getCodeForPlace((String) place);
this.countryCodesMap.put((String) place, code);
} catch (SAXException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
}
inputDocument.addField("countryCodes", code);
}
this.solrServer.add(inputDocument);
System.out.println(inputDocument.getField("title"));
}
private String getCodeForPlace(String place) throws MalformedURLException, SAXException, IOException, ParserConfigurationException, XPathExpressionException {
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.parse(new URL("http://ws.geonames.org/search?q=" + place).openStream());
return xPath.evaluate("/geonames/geoname/countryCode", doc);
}
/**
* Reads a whole .sgml file.
* @param file The sgml reuters file.
* @throws XPathExpressionException
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
* @throws SolrServerException
* @throws ParseException
*/
public void readFile(File file) throws XPathExpressionException, IOException, ParserConfigurationException, SAXException, SolrServerException, ParseException {
String documentString = readFileAsString(file);
// remove "bad" entities
documentString = documentString.replaceAll("&#\\d;", "");
documentString = documentString.replaceAll("&#\\d\\d;", "");
// remove doctype declaration
documentString = documentString.replaceAll("<!DOCTYPE lewis SYSTEM \"lewis.dtd\">", "");
// add a document root
documentString = "<root>" + documentString + "</root>";
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.parse(new ByteArrayInputStream(documentString.getBytes()));
NodeList nodeList = (NodeList) xPath.evaluate("/root/REUTERS", doc, XPathConstants.NODESET);
System.out.println("READING FILE: " + file.getAbsoluteFile());
for (int i=0; i< nodeList.getLength(); i++) {
System.out.print(" - " + file.getName() + "(" + i + ") ");
readDocument((Element) nodeList.item(i));
}
this.solrServer.commit();
}
/**
* Reads a whole directory containing reuters .sgml files-
* @param directory
* @throws XPathExpressionException
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
* @throws SolrServerException
* @throws ParseException
*/
public void readDirectory(File directory) throws XPathExpressionException, IOException, ParserConfigurationException, SAXException, SolrServerException, ParseException {
File[] files = directory.listFiles(new FileFilter() {
public boolean accept(File pathname) {
if (pathname.getName().contains(".sgm")) {
return true;
}
return false;
}
});
if (files.length == 0) {
throw new RuntimeException("Directory doesn't contain sgml files!");
}
for (int i = 0; i < files.length; i++) {
File file = files[i];
readFile(file);
}
}
/**
* Helper that converts a listnode into a java list.
* @param path
* @param element
* @return
* @throws XPathExpressionException
*/
private List<String> readList(String path, Element element) throws XPathExpressionException {
List<String> list = new ArrayList<String>();
NodeList nodeList = (NodeList) xPath.evaluate(path, element, XPathConstants.NODESET);
for (int i=0; i< nodeList.getLength(); i++) {
list.add(nodeList.item(i).getTextContent());
}
return list;
}
/**
* Helper that reads a file into a string.
* @param file
* @return
* @throws java.io.IOException
*/
private static String readFileAsString(File file) throws java.io.IOException {
StringBuilder fileData = new StringBuilder(1000);
BufferedReader reader = new BufferedReader(new FileReader(file));
char[] buf = new char[1024];
int numRead=0;
while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
buf = new char[1024];
}
reader.close();
return fileData.toString();
}
}

View File

@ -1,199 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SolrJS</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../../src/css/solrjs.css" />
<link rel="stylesheet" type="text/css" href="../../lib/jquery-autocomplete/jquery.autocomplete.css" />
<script src="../../lib/jquery/jquery-1.2.6.js"></script>
<script src="../../lib/jquery-autocomplete/jquery.autocomplete.js"</script>
<script src="../../src/core/Core.js"></script>
<script src="../../src/core/QueryItem.js"></script>
<script src="../../src/core/Manager.js"></script>
<script src="../../src/core/AbstractSelectionView.js"></script>
<script src="../../src/core/AbstractWidget.js"></script>
<script src="../../src/core/AbstractServerSideWidget.js"></script>
<script src="../../src/core/AbstractClientSideWidget.js"></script>
<script src="../../src/clientside/ExtensibleResultWidget.js"/></script>
<script src="../../src/clientside/AutocompleteWidget.js"/></script>
<script src="../../src/clientside/CalendarWidget.js"/></script>
<script src="../../src/clientside/TagcloudWidget.js"/></script>
<script src="../../src/clientside/CountryCodeWidget.js"/></script>
<link rel="stylesheet" type="text/css" media="all" href="../../lib/jscalendar/aqua/theme.css" title="Aqua" />
<script type="text/javascript" src="../../lib/jscalendar/calendar.js"></script>
<script type="text/javascript" src="../../lib/jscalendar/lang/calendar-en.js"></script>
<script>
var $sj = jQuery.noConflict();
var solrjsManager;
$sj(document).ready(function(){
solrjsManager = new $sj.solrjs.Manager({solrUrl:"http://localhost:8983/solr/select", resourcesBase: "../../src/resources"});
var resultWidget = new $sj.solrjs.ExtensibleResultWidget({
id:"result",
target:"#result",
rows:10,
showLoadingDiv: true,
renderResult : function(docs, pageSize, offset, numFound) {
var container = jQuery("<div/>");
// paging
jQuery("<a/>").html("<<").attr("href", "javascript:solrjsManager.doRequest(0, true)").appendTo(container);
jQuery("<a/>").html("<").attr("href", "javascript:solrjsManager.doRequest(" + Math.max(0, (parseInt(offset) - parseInt(pageSize))) + ", true)").appendTo(container);
jQuery("<a/>").html(">").attr("href", "javascript:solrjsManager.doRequest(" + Math.min((parseInt(numFound) - parseInt(pageSize)), (parseInt(offset) + parseInt(pageSize))) + ", true)").appendTo(container);
jQuery("<a/>").html(">>").attr("href", "javascript:solrjsManager.doRequest(" + (parseInt(numFound) - parseInt(pageSize)) + ", true)").appendTo(container);
jQuery("<span/>").html("displaying " + (parseInt(offset) + 1) + " to " + Math.min(numFound, (parseInt(offset) + parseInt(pageSize))) + " of " + numFound ).appendTo(container);
jQuery("<hr/>").appendTo(container);
// result
$sj.each(docs, function(i, item) {
jQuery("<h2/>").html(item["title"]).appendTo(container);
var topics = jQuery("<p/>").appendTo(container);
if (item["topics"] != null) {
$sj.each(item["topics"], function(i, topic) {
var items = "[new jQuery.solrjs.QueryItem({field:'topics',value:'" + topic + "'})]";
jQuery("<a/>").html(topic).attr("href", "javascript:solrjsManager.clearSelection();solrjsManager.selectItems('result'," + items + ")").appendTo(topics);
});
}
if (item["organisations"] != null) {
$sj.each(item["organisations"], function(i, topic) {
var items = "[new jQuery.solrjs.QueryItem({field:'organisations' ,value:'" + topic + "'})]";
jQuery("<a/>").html(topic).attr("href", "javascript:solrjsManager.clearSelection();solrjsManager.selectItems('result'," + items + ")").appendTo(topics);
});
}
if (item["exchanges"] != null) {
$sj.each(item["exchanges"], function(i, topic) {
var items = "[new jQuery.solrjs.QueryItem({field:'exchanges' ,value:'" + topic + "'})]";
jQuery("<a/>").html(topic).attr("href", "javascript:solrjsManager.clearSelection();solrjsManager.selectItems('result'," + items + ")").appendTo(topics);
});
}
if (item["text"].length > 300) {
var short = jQuery("<p/>").attr("id", "short_" + item["id"]).html(item["dateline"] + " " + item["text"].substring(0,Math.min(300,item["text"].length))).appendTo(container).css("display", "block");
jQuery("<p/>").attr("id", "long_" + item["id"]).html(item["dateline"] + " " + item["text"]).appendTo(container).css("display", "none");
jQuery("<a/>").html(" more").attr("href", "javascript:toggle('#short_" + item['id'] + "', '#long_" + item['id'] + "');").appendTo(short);
} else {
jQuery("<p/>").attr("id", "long_" + item["id"]).html(item["dateline"] + " " + item["text"]).appendTo(container);
}
});
container.appendTo(this.target);
}
});
solrjsManager.addWidget(resultWidget);
solrjsManager.addWidget(new $sj.solrjs.AutocompleteWidget({id:"search", target:"#search", fulltextFieldName:"allText", fieldNames:["topics", "organisations", "exchanges"]}));
solrjsManager.addWidget(new $sj.solrjs.TagcloudWidget({id:"topics", target:"#topics", fieldName:"topics", size:50}));
solrjsManager.addWidget(new $sj.solrjs.TagcloudWidget({id:"organisations", target:"#organisations", fieldName:"organisations", size:20}));
solrjsManager.addWidget(new $sj.solrjs.TagcloudWidget({id:"exchanges", target:"#exchanges", fieldName:"exchanges", size:20}));
solrjsManager.addWidget(new $sj.solrjs.CountryCodeWidget({id:"countries", target:"#countries", fieldName:"countryCodes"}));
solrjsManager.addWidget(new $sj.solrjs.CalendarWidget({id:"calendar", target:"#calendar", fieldName:"date", startDate: new Date(1987,01,01), endDate: new Date(1987,10,31)}));
var selectionView = new $sj.solrjs.AbstractSelectionView({
id:"selectionView",
target:"#selection",
displaySelection : function(selectedItems) {
jQuery(this.target).empty();
if(selectedItems.length == 0) {
jQuery("<div/>").html("Viewing all documents!").appendTo(this.target);
return;
} else if(selectedItems.length > 1) {
jQuery("<a/>").html("remove all").attr("href", "javascript:solrjsManager.doRequestAll()").appendTo(this.target);
}
for (var i = 0; i < selectedItems.length; ++i) {
var item = selectedItems[i];
jQuery("<a/>").html("(x) " + item.field + ":" + item.value).attr("href", "javascript:solrjsManager.deselectItem('" + item.toSolrQuery() + "')").appendTo(this.target);
}
}
});
solrjsManager.addSelectionView(selectionView);
solrjsManager.doRequestAll();
});
function toggle(id1, id2) {
$sj(id1).css("display", "none");
$sj(id2).css("display", "block");
}
</script>
</head>
<body>
<div id="wrap">
<div id="header">
<h1><a href="#">SolrJS Demonstration</a></h1>
<h2>Browse REUTERS business news from 1987</h2>
</div>
<div class="right">
<div id="result">
<div id="navigation"></div>
<div id="docs"></div>
</div>
</div>
<div class="left">
<h2>Current Selection</h2>
<ul>
<li> <div id="selection"></div> </li>
</ul>
<h2>Search</h2>
<ul>
<li>
<span style="font-size:80%"> ( press ESC to close suggestions) </span>
<div id="search"></div>
</li>
</ul>
<h2>Top Topics</h2>
<ul>
<li> <div id="topics"></div> </li>
</ul>
<h2>Top Organisations</h2>
<ul>
<li> <div id="organisations"></div> </li>
</ul>
<h2>Top Exchanges</h2>
<ul>
<li> <div id="exchanges"></div> </li>
</ul>
<h2>By Country</h2>
<ul>
<li> <div id="countries"></div> </li>
<li> <div id="preview"></div> </li>
</ul>
<h2>By Date</h2>
<ul>
<li> <div id="calendar" style="width:160px"></div> </li>
</ul>
<div style="clear:both"></div>
</div>
<div style="clear: both;"> </div>
</div>
<div class="footer">
Design by <a href="http://www.free-css-templates.com/">Free CSS Templates</a> - Thanks to <a href="http://www.dubaiapartments.biz/">Dubai Villas</a>
</div>
</body>
</html>

View File

@ -1,128 +0,0 @@
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
* {
padding: 0;
margin: 0;
}
body {
background: #fff url(images/header.gif) repeat-x;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 18px;
color: #333333;;
}
img { border: none; }
a { color: #6998F0; text-decoration: none; }
a:hover { text-decoration: underline; color : #000; }
#wrap {
width: 1000px;
margin: 0px auto;
}
#header {
height: 90px;
}
#header h1 {
padding: 20px 0 5px 10px;
font-size: 20px;
letter-spacing: -2px;
}
#header h1 a {
color: #000;
text-decoration: none;
}
#header h1 a:hover {
text-decoration: none;
color: #666;
}
#header h2 {
padding-left: 11px;
font-size: 14px;
color: #666;
font-weight: 100;
}
.right {
float: right;
width: 538px;
text-align: justify;
padding: 10px 20px 10px 40px;
border-left: 1px solid #aaa;
min-height:1000px;
}
.right h2 {
color: #B4241B;
font-size: 20px;
letter-spacing: -2px;
font-weight: 100;
padding : 15px 0 5px 0;
}
.right h2 a {
}
.right h2 a:hover {
}
.left {
float: left;
width: 400px;
padding: 10px 0 10px 0px;
}
.left h2 {
font-size: 13px;
color: #333;
padding: 5px 0 2px 10px;
}
.left ul {
list-style-type: none;
padding: 5px 0 10px 5px;
}
.left ul li {
padding: 2px 20px;
}
.left ul li a {
display: block;
color: #6998F0;
}
.left ul li a:hover {
color: #ff0000;
}
.footer {
text-align: center;
color: #666;
font-size: 11px;
padding: 10px;
background: #f7f7f7;
border-top: 1px solid #aaa;
}
.footer a { color: #666; }
#result a {
margin-right:5px;
}
#search input {
width:350px;
}

View File

@ -1,4 +0,0 @@
wget http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz
tar xvf reuters21578.tar.gz
wget http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz
tar xvf reuters21578.tar.gz

View File

@ -1,31 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The content of this page will be statically included into the top
of the admin page. Uncomment this as an example to see there the content
will show up.
<hr>
<i>This line will appear before the first table</i>
<tr>
<td colspan="2">
This row will be appended to the end of the first table
</td>
</tr>
<hr>
-->

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- If this file is found in the config directory, it will only be
loaded once at startup. If it is found in Solr's data
directory, it will be re-loaded every commit.
-->
<elevate>
<query text="foo bar">
<doc id="1" />
<doc id="2" />
<doc id="3" />
</query>
<query text="ipod">
<doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
<doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
</query>
</elevate>

View File

@ -1,21 +0,0 @@
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-----------------------------------------------------------------------
# Use a protected word file to protect against the stemmer reducing two
# unrelated words to the same base word.
# Some non-words that normally won't be encountered,
# just to test that they won't be stemmed.
dontstems
zwhacky

View File

@ -1,251 +0,0 @@
<schema name="example" version="1.1">
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
behavior of the fieldType.
Class names starting with "solr" refer to java classes in the
org.apache.solr.analysis package.
-->
<!-- The StrField type is not analyzed, but indexed/stored verbatim.
- StrField and TextField support an optional compressThreshold which
limits compression (if enabled in the derived fields) to values which
exceed a certain size (in characters).
-->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<!-- boolean type: "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
<!-- The optional sortMissingLast and sortMissingFirst attributes are
currently supported on types that are sorted internally as strings.
- If sortMissingLast="true", then a sort on this field will cause documents
without the field to come after documents with the field,
regardless of the requested sort order (asc or desc).
- If sortMissingFirst="true", then a sort on this field will cause documents
without the field to come before documents with the field,
regardless of the requested sort order.
- If sortMissingLast="false" and sortMissingFirst="false" (the default),
then default lucene sorting will be used which places docs without the
field first in an ascending sort and last in a descending sort.
-->
<!-- numeric field types that store and index the text
value verbatim (and hence don't support range queries, since the
lexicographic ordering isn't equal to the numeric ordering) -->
<fieldType name="integer" class="solr.IntField" omitNorms="true"/>
<fieldType name="long" class="solr.LongField" omitNorms="true"/>
<fieldType name="float" class="solr.FloatField" omitNorms="true"/>
<fieldType name="double" class="solr.DoubleField" omitNorms="true"/>
<!-- Numeric field types that manipulate the value into
a string value that isn't human-readable in its internal form,
but with a lexicographic ordering the same as the numeric ordering,
so that range queries work correctly. -->
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
is a more restricted form of the canonical representation of dateTime
http://www.w3.org/TR/xmlschema-2/#dateTime
The trailing "Z" designates UTC time and is mandatory.
Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
All other components are mandatory.
Expressions can also be used to denote calculations that should be
performed relative to "NOW" to determine the value, ie...
NOW/HOUR
... Round to the start of the current hour
NOW-1DAY
... Exactly 1 day prior to now
NOW/DAY+6MONTHS+3DAYS
... 6 months and 3 days in the future from the start of
the current day
Consult the DateField javadocs for more information.
-->
<fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
<!-- The "RandomSortField" is not used to store or search any
data. You can declare fields of this type it in your schema
to generate psuedo-random orderings of your docs for sorting
purposes. The ordering is generated based on the field name
and the version of the index, As long as the index version
remains unchanged, and the same field name is reused,
the ordering of the docs will be consistent.
If you want differend psuedo-random orderings of documents,
for the same version of the index, use a dynamicField and
change the name
-->
<fieldType name="random" class="solr.RandomSortField" indexed="true" />
<!-- solr.TextField allows the specification of custom text analyzers
specified as a tokenizer and a list of token filters. Different
analyzers may be specified for indexing and querying.
The optional positionIncrementGap puts space between multiple fields of
this type on the same document, with the purpose of preventing false phrase
matching across fields.
For more info on customizing your analyzer chain, please see
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
-->
<!-- One can also specify an existing Analyzer class that has a
default constructor via the class attribute on the analyzer element
<fieldType name="text_greek" class="solr.TextField">
<analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
</fieldType>
-->
<!-- A text field that only splits on whitespace for exact matching of words -->
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>
<!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
Synonyms and stopwords are customized by external files, and stemming is enabled.
Duplicate tokens at the same position (which may result from Stemmed Synonyms or
WordDelim parts) are removed.
-->
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<!-- Case insensitive stop word removal.
enablePositionIncrements=true ensures that a 'gap' is left to
allow for accurate phrase queries.
-->
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<!-- Less flexible matching, but less false matches. Probably not ideal for product names,
but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
<fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<!--
Setup simple analysis for spell checking
-->
<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<!-- This is an example of using the KeywordTokenizer along
With various TokenFilterFactories to produce a sortable field
that does not include some properties of the source text
-->
<fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
<analyzer>
<!-- KeywordTokenizer does no actual tokenizing, so the entire
input string is preserved as a single token
-->
<tokenizer class="solr.KeywordTokenizerFactory"/>
<!-- The LowerCase TokenFilter does what you expect, which can be
when you want your sorting to be case insensitive
-->
<filter class="solr.LowerCaseFilterFactory" />
<!-- The TrimFilter removes any leading or trailing whitespace -->
<filter class="solr.TrimFilterFactory" />
<!-- The PatternReplaceFilter gives you the flexibility to use
Java Regular expression to replace any sequence of characters
matching a pattern with an arbitrary replacement string,
which may include back refrences to portions of the orriginal
string matched by the pattern.
See the Java Regular Expression documentation for more
infomation on pattern and replacement string syntax.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
-->
<filter class="solr.PatternReplaceFilterFactory"
pattern="([^a-z])" replacement="" replace="all"
/>
</analyzer>
</fieldType>
<!-- since fields of this type are by default not stored or indexed, any data added to
them will be ignored outright
-->
<fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
</types>
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="title" type="text" indexed="true" stored="true"/>
<field name="text" type="text" indexed="true" stored="true"/>
<field name="date" type="date" indexed="true" stored="true"/>
<field name="dateline" type="text" indexed="true" stored="true"/>
<field name="places" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="countryCodes" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="topics" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="organisations" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="exchanges" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="companies" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="allText" type="text" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
</fields>
<copyField source="title" dest="allText"/>
<copyField source="text" dest="allText"/>
<copyField source="places" dest="allText"/>
<copyField source="topics" dest="allText"/>
<copyField source="companies" dest="allText"/>
<copyField source="exchanges" dest="allText"/>
<uniqueKey>id</uniqueKey>
<defaultSearchField>text</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
</schema>

View File

@ -1,24 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
user=
solr_hostname=localhost
solr_port=8983
rsyncd_port=18983
data_dir=
webapp_name=solr
master_host=
master_data_dir=
master_status_dir=

View File

@ -1,698 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<config>
<!-- Set this to 'false' if you want solr to continue working after it has
encountered an severe configuration error. In a production environment,
you may want solr to keep working even if one handler is mis-configured.
You may also set this to false using by setting the system property:
-Dsolr.abortOnConfigurationError=false
-->
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
<!-- Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home.
If replication is in use, this should match the replication configuration. -->
<dataDir>${solr.data.dir:./solr/data}</dataDir>
<indexDefaults>
<!-- Values here affect all index writers and act as a default unless overridden. -->
<useCompoundFile>false</useCompoundFile>
<mergeFactor>10</mergeFactor>
<!--
If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
-->
<!--<maxBufferedDocs>1000</maxBufferedDocs>-->
<!-- Tell Lucene when to flush documents to disk.
Giving Lucene more memory for indexing means faster indexing at the cost of more RAM
If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
-->
<ramBufferSizeMB>32</ramBufferSizeMB>
<maxMergeDocs>2147483647</maxMergeDocs>
<maxFieldLength>10000</maxFieldLength>
<writeLockTimeout>1000</writeLockTimeout>
<commitLockTimeout>10000</commitLockTimeout>
<!--
Expert: Turn on Lucene's auto commit capability.
This causes intermediate segment flushes to write a new lucene
index descriptor, enabling it to be opened by an external
IndexReader.
NOTE: Despite the name, this value does not have any relation to Solr's autoCommit functionality
-->
<!--<luceneAutoCommit>false</luceneAutoCommit>-->
<!--
Expert:
The Merge Policy in Lucene controls how merging is handled by Lucene. The default in 2.3 is the LogByteSizeMergePolicy, previous
versions used LogDocMergePolicy.
LogByteSizeMergePolicy chooses segments to merge based on their size. The Lucene 2.2 default, LogDocMergePolicy chose when
to merge based on number of documents
Other implementations of MergePolicy must have a no-argument constructor
-->
<!--<mergePolicy>org.apache.lucene.index.LogByteSizeMergePolicy</mergePolicy>-->
<!--
Expert:
The Merge Scheduler in Lucene controls how merges are performed. The ConcurrentMergeScheduler (Lucene 2.3 default)
can perform merges in the background using separate threads. The SerialMergeScheduler (Lucene 2.2 default) does not.
-->
<!--<mergeScheduler>org.apache.lucene.index.ConcurrentMergeScheduler</mergeScheduler>-->
<!--
This option specifies which Lucene LockFactory implementation to use.
single = SingleInstanceLockFactory - suggested for a read-only index
or when there is no possibility of another process trying
to modify the index.
native = NativeFSLockFactory
simple = SimpleFSLockFactory
(For backwards compatibility with Solr 1.2, 'simple' is the default
if not specified.)
-->
<lockType>single</lockType>
</indexDefaults>
<mainIndex>
<!-- options specific to the main on-disk lucene index -->
<useCompoundFile>false</useCompoundFile>
<ramBufferSizeMB>32</ramBufferSizeMB>
<mergeFactor>10</mergeFactor>
<!-- Deprecated -->
<!--<maxBufferedDocs>1000</maxBufferedDocs>-->
<maxMergeDocs>2147483647</maxMergeDocs>
<maxFieldLength>10000</maxFieldLength>
<!-- If true, unlock any held write or commit locks on startup.
This defeats the locking mechanism that allows multiple
processes to safely access a lucene index, and should be
used with care.
This is not needed if lock type is 'none' or 'single'
-->
<unlockOnStartup>false</unlockOnStartup>
</mainIndex>
<!-- Enables JMX if and only if an existing MBeanServer is found, use
this if you want to configure JMX through JVM parameters. Remove
this to disable exposing Solr configuration and statistics to JMX.
If you want to connect to a particular server, specify the agentId
e.g. <jmx agentId="myAgent" />
If you want to start a new MBeanServer, specify the serviceUrl
e.g <jmx serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr" />
For more details see http://wiki.apache.org/solr/SolrJmx
-->
<jmx />
<!-- the default high-performance update handler -->
<updateHandler class="solr.DirectUpdateHandler2">
<!-- A prefix of "solr." for class names is an alias that
causes solr to search appropriate packages, including
org.apache.solr.(search|update|request|core|analysis)
-->
<!-- Perform a <commit/> automatically under certain conditions:
maxDocs - number of updates since last commit is greater than this
maxTime - oldest uncommited update (in ms) is this long ago
<autoCommit>
<maxDocs>10000</maxDocs>
<maxTime>1000</maxTime>
</autoCommit>
-->
<!-- The RunExecutableListener executes an external command.
exe - the name of the executable to run
dir - dir to use as the current working directory. default="."
wait - the calling thread waits until the executable returns. default="true"
args - the arguments to pass to the program. default=nothing
env - environment variables to set. default=nothing
-->
<!-- A postCommit event is fired after every commit or optimize command
<listener event="postCommit" class="solr.RunExecutableListener">
<str name="exe">solr/bin/snapshooter</str>
<str name="dir">.</str>
<bool name="wait">true</bool>
<arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
<arr name="env"> <str>MYVAR=val1</str> </arr>
</listener>
-->
<!-- A postOptimize event is fired only after every optimize command, useful
in conjunction with index distribution to only distribute optimized indicies
<listener event="postOptimize" class="solr.RunExecutableListener">
<str name="exe">snapshooter</str>
<str name="dir">solr/bin</str>
<bool name="wait">true</bool>
</listener>
-->
</updateHandler>
<query>
<!-- Maximum number of clauses in a boolean query... can affect
range or prefix queries that expand to big boolean
queries. An exception is thrown if exceeded. -->
<maxBooleanClauses>1024</maxBooleanClauses>
<!-- Cache used by SolrIndexSearcher for filters (DocSets),
unordered sets of *all* documents that match a query.
When a new searcher is opened, its caches may be prepopulated
or "autowarmed" using data from caches in the old searcher.
autowarmCount is the number of items to prepopulate. For LRUCache,
the autowarmed items will be the most recently accessed items.
Parameters:
class - the SolrCache implementation (currently only LRUCache)
size - the maximum number of entries in the cache
initialSize - the initial capacity (number of entries) of
the cache. (seel java.util.HashMap)
autowarmCount - the number of entries to prepopulate from
and old cache.
-->
<filterCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="128"/>
<!-- queryResultCache caches results of searches - ordered lists of
document ids (DocList) based on a query, a sort, and the range
of documents requested. -->
<queryResultCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="32"/>
<!-- documentCache caches Lucene Document objects (the stored fields for each document).
Since Lucene internal document ids are transient, this cache will not be autowarmed. -->
<documentCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="0"/>
<!-- If true, stored fields that are not requested will be loaded lazily.
This can result in a significant speed improvement if the usual case is to
not load all stored fields, especially if the skipped fields are large compressed
text fields.
-->
<enableLazyFieldLoading>true</enableLazyFieldLoading>
<!-- Example of a generic cache. These caches may be accessed by name
through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().
The purpose is to enable easy caching of user/application level data.
The regenerator argument should be specified as an implementation
of solr.search.CacheRegenerator if autowarming is desired. -->
<!--
<cache name="myUserCache"
class="solr.LRUCache"
size="4096"
initialSize="1024"
autowarmCount="1024"
regenerator="org.mycompany.mypackage.MyRegenerator"
/>
-->
<!-- An optimization that attempts to use a filter to satisfy a search.
If the requested sort does not include score, then the filterCache
will be checked for a filter matching the query. If found, the filter
will be used as the source of document ids, and then the sort will be
applied to that.
<useFilterForSortedQuery>true</useFilterForSortedQuery>
-->
<!-- An optimization for use with the queryResultCache. When a search
is requested, a superset of the requested number of document ids
are collected. For example, if a search for a particular query
requests matching documents 10 through 19, and queryWindowSize is 50,
then documents 0 through 49 will be collected and cached. Any further
requests in that range can be satisfied via the cache. -->
<queryResultWindowSize>50</queryResultWindowSize>
<!-- Maximum number of documents to cache for any entry in the
queryResultCache. -->
<queryResultMaxDocsCached>200</queryResultMaxDocsCached>
<!-- This entry enables an int hash representation for filters (DocSets)
when the number of items in the set is less than maxSize. For smaller
sets, this representation is more memory efficient, more efficient to
iterate over, and faster to take intersections. -->
<HashDocSet maxSize="3000" loadFactor="0.75"/>
<!-- a newSearcher event is fired whenever a new searcher is being prepared
and there is a current searcher handling requests (aka registered). -->
<!-- QuerySenderListener takes an array of NamedList and executes a
local query request for each NamedList in sequence. -->
<listener event="newSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst><str name="q">static newSearcher warming query from solrconfig.xml</str></lst>
</arr>
</listener>
<!-- a firstSearcher event is fired whenever a new searcher is being
prepared but there is no current registered searcher to handle
requests or to gain autowarming data from. -->
<listener event="firstSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<lst> <str name="q">fast_warm</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst><str name="q">static firstSearcher warming query from solrconfig.xml</str></lst>
</arr>
</listener>
<!-- If a search request comes in and there is no current registered searcher,
then immediately register the still warming searcher and use it. If
"false" then all requests will block until the first searcher is done
warming. -->
<useColdSearcher>false</useColdSearcher>
<!-- Maximum number of searchers that may be warming in the background
concurrently. An error is returned if this limit is exceeded. Recommend
1-2 for read-only slaves, higher for masters w/o cache warming. -->
<maxWarmingSearchers>2</maxWarmingSearchers>
</query>
<!--
Let the dispatch filter handler /select?qt=XXX
handleSelect=true will use consistent error handling for /select and /update
handleSelect=false will use solr1.1 style error formatting
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
<!-- Set HTTP caching related parameters (for proxy caches and clients).
To get the behaviour of Solr 1.2 (ie: no caching related headers)
use the never304="true" option and do not specify a value for
<cacheControl>
-->
<!-- <httpCaching never304="true"> -->
<httpCaching lastModifiedFrom="openTime"
etagSeed="Solr">
<!-- lastModFrom="openTime" is the default, the Last-Modified value
(and validation against If-Modified-Since requests) will all be
relative to when the current Searcher was opened.
You can change it to lastModFrom="dirLastMod" if you want the
value to exactly corrispond to when the physical index was last
modified.
etagSeed="..." is an option you can change to force the ETag
header (and validation against If-None-Match requests) to be
differnet even if the index has not changed (ie: when making
significant changes to your config file)
lastModifiedFrom and etagSeed are both ignored if you use the
never304="true" option.
-->
<!-- If you include a <cacheControl> directive, it will be used to
generate a Cache-Control header, as well as an Expires header
if the value contains "max-age="
By default, no Cache-Control header is generated.
You can use the <cacheControl> option even if you have set
never304="true"
-->
<!-- <cacheControl>max-age=30, public</cacheControl> -->
</httpCaching>
</requestDispatcher>
<!-- requestHandler plugins... incoming queries will be dispatched to the
correct handler based on the path or the qt (query type) param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
If no qt is defined, the requestHandler that declares default="true"
will be used.
-->
<requestHandler name="standard" class="solr.SearchHandler" default="true">
<!-- default values for query parameters -->
<lst name="defaults">
<str name="echoParams">explicit</str>
<!--
<int name="rows">10</int>
<str name="fl">*</str>
<str name="version">2.1</str>
-->
</lst>
</requestHandler>
<!-- DisMaxRequestHandler allows easy searching across multiple fields
for simple user-entered phrases. It's implementation is now
just the standard SearchHandler with a default query type
of "dismax".
see http://wiki.apache.org/solr/DisMaxRequestHandler
-->
<requestHandler name="dismax" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="qf">
text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
</str>
<str name="pf">
text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9
</str>
<str name="bf">
ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3
</str>
<str name="fl">
id,name,price,score
</str>
<str name="mm">
2&lt;-1 5&lt;-2 6&lt;90%
</str>
<int name="ps">100</int>
<str name="q.alt">*:*</str>
<!-- example highlighter config, enable per-query with hl=true -->
<str name="hl.fl">text features name</str>
<!-- for this field, we want no fragmenting, just highlighting -->
<str name="f.name.hl.fragsize">0</str>
<!-- instructs Solr to return the field itself if no query terms are
found -->
<str name="f.name.hl.alternateField">name</str>
<str name="f.text.hl.fragmenter">regex</str> <!-- defined below -->
</lst>
</requestHandler>
<!-- Note how you can register the same handler multiple times with
different names (and different init parameters)
-->
<requestHandler name="partitioned" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str>
<str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
<!-- This is an example of using Date Math to specify a constantly
moving date range in a config...
-->
<str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str>
</lst>
<!-- In addition to defaults, "appends" params can be specified
to identify values which should be appended to the list of
multi-val params from the query (or the existing "defaults").
In this example, the param "fq=instock:true" will be appended to
any query time fq params the user may specify, as a mechanism for
partitioning the index, independent of any user selected filtering
that may also be desired (perhaps as a result of faceted searching).
NOTE: there is *absolutely* nothing a client can do to prevent these
"appends" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<lst name="appends">
<str name="fq">inStock:true</str>
</lst>
<!-- "invariants" are a way of letting the Solr maintainer lock down
the options available to Solr clients. Any params values
specified here are used regardless of what values may be specified
in either the query, the "defaults", or the "appends" params.
In this example, the facet.field and facet.query params are fixed,
limiting the facets clients can use. Faceting is not turned on by
default - but if the client does specify facet=true in the request,
these are the only facets they will be able to see counts for;
regardless of what other facet.field or facet.query params they
may specify.
NOTE: there is *absolutely* nothing a client can do to prevent these
"invariants" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<lst name="invariants">
<str name="facet.field">cat</str>
<str name="facet.field">manu_exact</str>
<str name="facet.query">price:[* TO 500]</str>
<str name="facet.query">price:[500 TO *]</str>
</lst>
</requestHandler>
<!--
Search components are registered to SolrCore and used by Search Handlers
By default, the following components are avaliable:
<searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" />
<searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" />
<searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" />
<searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" />
<searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" />
Default configuration in a requestHandler would look like:
<arr name="components">
<str>query</str>
<str>facet</str>
<str>mlt</str>
<str>highlight</str>
<str>debug</str>
</arr>
If you register a searchComponent to one of the standard names, that will be used instead.
To insert handlers before or after the 'standard' components, use:
<arr name="first-components">
<str>myFirstComponentName</str>
</arr>
<arr name="last-components">
<str>myLastComponentName</str>
</arr>
-->
<!-- The spell check component can return a list of alternative spelling
suggestions. -->
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<str name="queryAnalyzerFieldType">textSpell</str>
<lst name="spellchecker">
<str name="name">default</str>
<str name="field">spell</str>
<str name="spellcheckIndexDir">./spellchecker1</str>
</lst>
<lst name="spellchecker">
<str name="name">jarowinkler</str>
<str name="field">spell</str>
<!-- Use a different Distance Measure -->
<str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
<str name="spellcheckIndexDir">./spellchecker2</str>
</lst>
<lst name="spellchecker">
<str name="classname">solr.FileBasedSpellChecker</str>
<str name="name">file</str>
<str name="sourceLocation">spellings.txt</str>
<str name="characterEncoding">UTF-8</str>
<str name="spellcheckIndexDir">./spellcheckerFile</str>
</lst>
</searchComponent>
<!-- a request handler utilizing the spellcheck component -->
<requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">
<lst name="defaults">
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
<!-- a search component that enables you to configure the top results for
a given query regardless of the normal lucene scoring.-->
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
<!-- pick a fieldType to analyze queries -->
<str name="queryFieldType">string</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
<!-- a request handler utilizing the elevator component -->
<requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="echoParams">explicit</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
<!-- Update request handler.
Note: Since solr1.1 requestHandlers requires a valid content type header if posted in
the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'
The response format differs from solr1.1 formatting and returns a standard error code.
To enable solr1.1 behavior, remove the /update handler or change its path
-->
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
<!--
Analysis request handler. Since Solr 1.3. Use to returnhow a document is analyzed. Useful
for debugging and as a token server for other types of applications
-->
<requestHandler name="/analysis" class="solr.AnalysisRequestHandler" />
<!-- CSV update handler, loaded on demand -->
<requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
<!--
Admin Handlers - This will register all the standard admin RequestHandlers. Adding
this single handler is equivalent to registering:
<requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />
<requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" />
<requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" />
<requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" />
<requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" />
<requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using:
<requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
<lst name="invariants">
<str name="hidden">synonyms.txt</str>
<str name="hidden">anotherfile.txt</str>
</lst>
</requestHandler>
-->
<requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
<!-- ping/healthcheck -->
<requestHandler name="/admin/ping" class="PingRequestHandler">
<lst name="defaults">
<str name="qt">standard</str>
<str name="q">solrpingquery</str>
<str name="echoParams">all</str>
</lst>
</requestHandler>
<!-- Echo the request contents back to the client -->
<requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
<lst name="defaults">
<str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
<str name="echoHandler">true</str>
</lst>
</requestHandler>
<highlighting>
<!-- Configure the standard fragmenter -->
<!-- This could most likely be commented out in the "default" case -->
<fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
<lst name="defaults">
<int name="hl.fragsize">100</int>
</lst>
</fragmenter>
<!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->
<fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
<lst name="defaults">
<!-- slightly smaller fragsizes work better because of slop -->
<int name="hl.fragsize">70</int>
<!-- allow 50% slop on fragment sizes -->
<float name="hl.regex.slop">0.5</float>
<!-- a basic sentence pattern -->
<str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
</lst>
</fragmenter>
<!-- Configure the standard formatter -->
<formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
<lst name="defaults">
<str name="hl.simple.pre"><![CDATA[<em>]]></str>
<str name="hl.simple.post"><![CDATA[</em>]]></str>
</lst>
</formatter>
</highlighting>
<!-- queryResponseWriter plugins... query responses will be written using the
writer specified by the 'wt' request parameter matching the name of a registered
writer.
The "default" writer is the default and will be used if 'wt' is not specified
in the request. XMLResponseWriter will be used if nothing is specified here.
The json, python, and ruby writers are also available by default.
<queryResponseWriter name="xml" class="org.apache.solr.request.XMLResponseWriter" default="true"/>
<queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
<queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>
<queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
<queryResponseWriter name="php" class="org.apache.solr.request.PHPResponseWriter"/>
<queryResponseWriter name="phps" class="org.apache.solr.request.PHPSerializedResponseWriter"/>
<queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>
-->
<!-- XSLT response writer transforms the XML output by any xslt file found
in Solr's conf/xslt directory. Changes to xslt files are checked for
every xsltCacheLifetimeSeconds.
-->
<queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
<int name="xsltCacheLifetimeSeconds">5</int>
</queryResponseWriter>
<queryResponseWriter name="velocity" class="org.apache.solr.request.VelocityResponseWriter"/>
<!-- example of registering a query parser
<queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>
-->
<!-- example of registering a custom function parser
<valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" />
-->
<!-- config for the admin interface -->
<admin>
<defaultQuery>solr</defaultQuery>
<!-- configure a healthcheck file for servers behind a loadbalancer
<healthcheck type="file">server-enabled</healthcheck>
-->
</admin>
</config>

View File

@ -1,2 +0,0 @@
pizza
history

View File

@ -1,57 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-----------------------------------------------------------------------
# a couple of test stopwords to test that the words are really being
# configured from this file:
stopworda
stopwordb
#Standard english stop words taken from Lucene's StopAnalyzer
an
and
are
as
at
be
but
by
for
if
in
into
is
it
no
not
of
on
or
s
such
t
that
the
their
then
there
these
they
this
to
was
will
with

View File

@ -1,31 +0,0 @@
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-----------------------------------------------------------------------
#some test synonym mappings unlikely to appear in real input text
aaa => aaaa
bbb => bbbb1 bbbb2
ccc => cccc1,cccc2
a\=>a => b\=>b
a\,a => b\,b
fooaaa,baraaa,bazaaa
# Some synonym groups specific to this example
GB,gib,gigabyte,gigabytes
MB,mib,megabyte,megabytes
Television, Televisions, TV, TVs
#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
#after us won't split it into two words.
# Synonym mappings can be used for spelling correction too
pixima => pixma

View File

@ -1,36 +0,0 @@
#macro(url_for_filters $filter_queries)
/solr/itas?fq=$filter_queries
#end
#macro(url_for_home)/solr/itas#end
#macro(url_for_start $start)/solr/itas?start=$start#end
#macro(url_for_nested_facet $field $value)/solr/itas?fq=$field:$value#end
#macro(link_to_previous_page $text)
#if($page.current_page_number > 1)
#set($prev_start = $page.start - $page.results_per_page)
<a class="prev-page" href="#url_for_start($prev_start)">$text</a>
#end
#end
#macro(link_to_next_page $text)
#if($page.current_page_number < $page.page_count)
#set($next_start = $page.start + $page.results_per_page)
<a class="next-page" href="#url_for_start($next_start)">$text</a>
#end
#end
#macro(link_to_page $page_number $text)
#if($page_number == $page.current_page_number)
$text
#else
#if($page_number <= $page.page_count)
#set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
<a class="page" href="#url_for_start($page_start)">$text</a>
#end
#end
#end
#macro(param $key)$request.params.get($key)#end

View File

@ -1,70 +0,0 @@
#set($doclist=$response.values.response)
#set($searcher=$request.searcher)
#set($params=$request.params)
#set($fields=$response.returnFields)
<html>
## TODO: Implement layouts
<head>
<title>#param('title')</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="/solr/admin/jquery-1.2.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="/solr/admin/file?file=/velocity/main.css&contentType=text/css"/>
</head>
<body>
<div>
#parse("header.vm")
#set($filter_queries = $params.getParams('fq'))
#foreach($fq in $filter_queries)
&gt; <a href="#url_for_filters($filter_queries.subList(0,$velocityCount))">$fq</a>
#end
</div>
<div class="query-box">
<form id="query-form" action="/solr/itas" method="GET">
Query: <input type="text" name="q" value="$!params.get('q')"/>
</form>
</div>
<div class="facet-fields">
#foreach($field in $response.values.facet_counts.facet_fields)
<span class="facet-field">$field.key</span>
<ul>
#foreach($facet in $field.value)
#set($facetURL = "#url_for_nested_facet($field.key, $facet.key)")
#if ($facetURL != '')
<li><a href="$facetURL">$facet.key</a> ($facet.value)</li>
#end
#end
</ul>
#end
</div>
<div class="pagination">
<span><span class="results-found">$page.results_found</span> results found in ${response.responseHeader.QTime} ms</span>
</div>
<div class="results">
#foreach($id in $doclist.iterator())
#set($doc = $searcher.doc($id,$response.returnFields))
#parse("hit.vm")
#end
</div>
<div class="pagination">
#link_to_previous_page("previous")
<span class="results-found">$page.results_found</span> results found.
Page <span class="page-num">$page.current_page_number</span> of <span
class="page-count">$page.page_count</span>
#link_to_next_page("next")
<br/>
</div>
<div>
#parse("footer.vm")
</div>
</body>
</html>

View File

@ -1,18 +0,0 @@
<div class="result-document">
#foreach($field in $doc.fields)
#if($response.returnFields.contains("*") || $response.returnFields.contains($field.name()))
<p>
<span class="field-name">$field.name() :</span>
<span>
##TODO: Need to provide helpers for field values, including HTML escaping and highlighting
#foreach($value in $doc.getFieldables($field.name()))
$request.schema.getFieldType($field.name()).toExternal($value)
#end
</span>
</p>
#end
#end
#if($params.getBool("debugQuery",false))
<a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle explain</a> <pre style="display:none">$response.values.debug.explain.get($doc.get('id'))</pre>
#end
</div>

View File

@ -1,96 +0,0 @@
.array-field {
border: 2px solid #474747;
background: #FFE9D8;
padding: 5px;
margin: 5px;
}
.array-field-list li {
list-style: circle;
margin-left: 20px;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
.constraints-title {
background: gray;
}
.facet-fields {
float: left;
margin: 5px;
margin-top: 0px;
background: #FEC293;
border: 2px solid #474747;
width: 185px;
padding: 2px;
}
.facet-field {
font-weight: bold;
}
.highlight {
color: white;
background-color: gray;
border: 1px black solid;
}
.highlight-box {
margin-left: 15px;
}
.field-name {
font-weight: bold;
}
.highlighted-facet-field {
background: white;
}
#logo {
margin: 10px;
}
.query-box, .constraints {
padding: 5px;
margin: 5px;
border: 3px solid #474747;
color: white;
background: #FD9644;
font-weight: bold;
font-size: 16px;
}
.query-box input {
margin-left: 8px;
width: 85%;
}
.pagination {
padding-left: 33%;
font-weight: bold;
background: gray;
color: white;
margin: 5px;
margin-left: 200px;
}
.result-document {
border: 3px solid #474747;
background: #FEC293;
padding: 5px;
margin: 5px;
margin-left: 200px;
}
.selected-facet-field {
font-weight: bold;
}
li.show {
list-style: disc;
}

View File

@ -1,132 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!--
Simple transform of Solr query results to HTML
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
>
<xsl:output media-type="text/html; charset=UTF-8" encoding="UTF-8"/>
<xsl:variable name="title" select="concat('Solr search results (',response/result/@numFound,' documents)')"/>
<xsl:template match='/'>
<html>
<head>
<title><xsl:value-of select="$title"/></title>
<xsl:call-template name="css"/>
</head>
<body>
<h1><xsl:value-of select="$title"/></h1>
<div class="note">
This has been formatted by the sample "example.xsl" transform -
use your own XSLT to get a nicer page
</div>
<xsl:apply-templates select="response/result/doc"/>
</body>
</html>
</xsl:template>
<xsl:template match="doc">
<xsl:variable name="pos" select="position()"/>
<div class="doc">
<table width="100%">
<xsl:apply-templates>
<xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param>
</xsl:apply-templates>
</table>
</div>
</xsl:template>
<xsl:template match="doc/*[@name='score']" priority="100">
<xsl:param name="pos"></xsl:param>
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:value-of select="."/>
<xsl:if test="boolean(//lst[@name='explain'])">
<xsl:element name="a">
<!-- can't allow whitespace here -->
<xsl:attribute name="href">javascript:toggle("<xsl:value-of select="concat('exp-',$pos)" />");</xsl:attribute>?</xsl:element>
<br/>
<xsl:element name="div">
<xsl:attribute name="class">exp</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="concat('exp-',$pos)" />
</xsl:attribute>
<xsl:value-of select="//lst[@name='explain']/str[position()=$pos]"/>
</xsl:element>
</xsl:if>
</td>
</tr>
</xsl:template>
<xsl:template match="doc/arr" priority="100">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<ul>
<xsl:for-each select="*">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
</td>
</tr>
</xsl:template>
<xsl:template match="doc/*">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<xsl:template match="*"/>
<xsl:template name="css">
<script>
function toggle(id) {
var obj = document.getElementById(id);
obj.style.display = (obj.style.display != 'block') ? 'block' : 'none';
}
</script>
<style type="text/css">
body { font-family: "Lucida Grande", sans-serif }
td.name { font-style: italic; font-size:80%; }
td { vertical-align: top; }
ul { margin: 0px; margin-left: 1em; padding: 0px; }
.note { font-size:80%; }
.doc { margin-top: 1em; border-top: solid grey 1px; }
.exp { display: none; font-family: monospace; white-space: pre; }
</style>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,67 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!--
Simple transform of Solr query results to Atom
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output
method="xml"
encoding="utf-8"
media-type="text/xml; charset=UTF-8"
/>
<xsl:template match='/'>
<xsl:variable name="query" select="response/lst[@name='responseHeader']/lst[@name='params']/str[@name='q']"/>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Solr Atom 1.0 Feed</title>
<subtitle>
This has been formatted by the sample "example_atom.xsl" transform -
use your own XSLT to get a nicer Atom feed.
</subtitle>
<author>
<name>Apache Solr</name>
<email>solr-user@lucene.apache.org</email>
</author>
<link rel="self" type="application/atom+xml"
href="http://localhost:8983/solr/q={$query}&amp;wt=xslt&amp;tr=atom.xsl"/>
<updated>
<xsl:value-of select="response/result/doc[position()=1]/date[@name='timestamp']"/>
</updated>
<id>tag:localhost,2007:example</id>
<xsl:apply-templates select="response/result/doc"/>
</feed>
</xsl:template>
<!-- search results xslt -->
<xsl:template match="doc">
<xsl:variable name="id" select="str[@name='id']"/>
<entry>
<title><xsl:value-of select="str[@name='name']"/></title>
<link href="http://localhost:8983/solr/select?q={$id}"/>
<id>tag:localhost,2007:<xsl:value-of select="$id"/></id>
<summary><xsl:value-of select="arr[@name='features']"/></summary>
<updated><xsl:value-of select="date[@name='timestamp']"/></updated>
</entry>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,66 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!--
Simple transform of Solr query results to RSS
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output
method="xml"
encoding="utf-8"
media-type="text/xml; charset=UTF-8"
/>
<xsl:template match='/'>
<rss version="2.0">
<channel>
<title>Example Solr RSS 2.0 Feed</title>
<link>http://localhost:8983/solr</link>
<description>
This has been formatted by the sample "example_rss.xsl" transform -
use your own XSLT to get a nicer RSS feed.
</description>
<language>en-us</language>
<docs>http://localhost:8983/solr</docs>
<xsl:apply-templates select="response/result/doc"/>
</channel>
</rss>
</xsl:template>
<!-- search results xslt -->
<xsl:template match="doc">
<xsl:variable name="id" select="str[@name='id']"/>
<xsl:variable name="timestamp" select="date[@name='timestamp']"/>
<item>
<title><xsl:value-of select="str[@name='name']"/></title>
<link>
http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
</link>
<description>
<xsl:value-of select="arr[@name='features']"/>
</description>
<pubDate><xsl:value-of select="$timestamp"/></pubDate>
<guid>
http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
</guid>
</item>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,337 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Display the luke request handler with graphs
-->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
version="1.0"
>
<xsl:output
method="html"
encoding="UTF-8"
media-type="text/html; charset=UTF-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
/>
<xsl:variable name="title">Solr Luke Request Handler Response</xsl:variable>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css"/>
<link rel="icon" href="favicon.ico" type="image/ico"/>
<link rel="shortcut icon" href="favicon.ico" type="image/ico"/>
<title>
<xsl:value-of select="$title"/>
</title>
<xsl:call-template name="css"/>
</head>
<body>
<h1>
<xsl:value-of select="$title"/>
</h1>
<div class="doc">
<ul>
<xsl:if test="response/lst[@name='index']">
<li>
<a href="#index">Index Statistics</a>
</li>
</xsl:if>
<xsl:if test="response/lst[@name='fields']">
<li>
<a href="#fields">Field Statistics</a>
<ul>
<xsl:for-each select="response/lst[@name='fields']/lst">
<li>
<a href="#{@name}">
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="response/lst[@name='doc']">
<li>
<a href="#doc">Document statistics</a>
</li>
</xsl:if>
</ul>
</div>
<xsl:if test="response/lst[@name='index']">
<h2><a name="index"/>Index Statistics</h2>
<xsl:apply-templates select="response/lst[@name='index']"/>
</xsl:if>
<xsl:if test="response/lst[@name='fields']">
<h2><a name="fields"/>Field Statistics</h2>
<xsl:apply-templates select="response/lst[@name='fields']"/>
</xsl:if>
<xsl:if test="response/lst[@name='doc']">
<h2><a name="doc"/>Document statistics</h2>
<xsl:apply-templates select="response/lst[@name='doc']"/>
</xsl:if>
</body>
</html>
</xsl:template>
<xsl:template match="lst">
<xsl:if test="parent::lst">
<tr>
<td colspan="2">
<div class="doc">
<xsl:call-template name="list"/>
</div>
</td>
</tr>
</xsl:if>
<xsl:if test="not(parent::lst)">
<div class="doc">
<xsl:call-template name="list"/>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="list">
<xsl:if test="count(child::*)>0">
<table>
<thead>
<tr>
<th colspan="2">
<p>
<a name="{@name}"/>
</p>
<xsl:value-of select="@name"/>
</th>
</tr>
</thead>
<tbody>
<xsl:choose>
<xsl:when
test="@name='histogram'">
<tr>
<td colspan="2">
<xsl:call-template name="histogram"/>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</tbody>
</table>
</xsl:if>
</xsl:template>
<xsl:template name="histogram">
<div class="doc">
<xsl:call-template name="barchart">
<xsl:with-param name="max_bar_width">50</xsl:with-param>
<xsl:with-param name="iwidth">800</xsl:with-param>
<xsl:with-param name="iheight">160</xsl:with-param>
<xsl:with-param name="fill">blue</xsl:with-param>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template name="barchart">
<xsl:param name="max_bar_width"/>
<xsl:param name="iwidth"/>
<xsl:param name="iheight"/>
<xsl:param name="fill"/>
<xsl:variable name="max">
<xsl:for-each select="int">
<xsl:sort data-type="number" order="descending"/>
<xsl:if test="position()=1">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="bars">
<xsl:value-of select="count(int)"/>
</xsl:variable>
<xsl:variable name="bar_width">
<xsl:choose>
<xsl:when test="$max_bar_width &lt; ($iwidth div $bars)">
<xsl:value-of select="$max_bar_width"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$iwidth div $bars"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<table class="histogram">
<tbody>
<tr>
<xsl:for-each select="int">
<td>
<xsl:value-of select="."/>
<div class="histogram">
<xsl:attribute name="style">background-color: <xsl:value-of select="$fill"/>; width: <xsl:value-of select="$bar_width"/>px; height: <xsl:value-of select="($iheight*number(.)) div $max"/>px;</xsl:attribute>
</div>
</td>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="int">
<td>
<xsl:value-of select="@name"/>
</td>
</xsl:for-each>
</tr>
</tbody>
</table>
</xsl:template>
<xsl:template name="keyvalue">
<xsl:choose>
<xsl:when test="@name">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="int|bool|long|float|double|uuid|date">
<xsl:call-template name="keyvalue"/>
</xsl:template>
<xsl:template match="arr">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<ul>
<xsl:for-each select="child::*">
<li>
<xsl:apply-templates/>
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</xsl:template>
<xsl:template match="str">
<xsl:choose>
<xsl:when test="@name='schema' or @name='index' or @name='flags'">
<xsl:call-template name="schema"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="keyvalue"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="schema">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:if test="contains(.,'unstored')">
<xsl:value-of select="."/>
</xsl:if>
<xsl:if test="not(contains(.,'unstored'))">
<xsl:call-template name="infochar2string">
<xsl:with-param name="charList">
<xsl:value-of select="."/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</td>
</tr>
</xsl:template>
<xsl:template name="infochar2string">
<xsl:param name="i">1</xsl:param>
<xsl:param name="charList"/>
<xsl:variable name="char">
<xsl:value-of select="substring($charList,$i,1)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$char='I'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='I']"/> - </xsl:when>
<xsl:when test="$char='T'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='T']"/> - </xsl:when>
<xsl:when test="$char='S'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='S']"/> - </xsl:when>
<xsl:when test="$char='M'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='M']"/> - </xsl:when>
<xsl:when test="$char='V'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='V']"/> - </xsl:when>
<xsl:when test="$char='o'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='o']"/> - </xsl:when>
<xsl:when test="$char='p'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='p']"/> - </xsl:when>
<xsl:when test="$char='O'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='O']"/> - </xsl:when>
<xsl:when test="$char='L'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='L']"/> - </xsl:when>
<xsl:when test="$char='B'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='B']"/> - </xsl:when>
<xsl:when test="$char='C'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='C']"/> - </xsl:when>
<xsl:when test="$char='f'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='f']"/> - </xsl:when>
<xsl:when test="$char='l'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='l']"/> -
</xsl:when>
</xsl:choose>
<xsl:if test="not($i>=string-length($charList))">
<xsl:call-template name="infochar2string">
<xsl:with-param name="i">
<xsl:value-of select="$i+1"/>
</xsl:with-param>
<xsl:with-param name="charList">
<xsl:value-of select="$charList"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="css">
<style type="text/css">
<![CDATA[
td.name {font-style: italic; font-size:80%; }
.doc { margin: 0.5em; border: solid grey 1px; }
.exp { display: none; font-family: monospace; white-space: pre; }
div.histogram { background: none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;}
table.histogram { width: auto; vertical-align: bottom; }
table.histogram td, table.histogram th { text-align: center; vertical-align: bottom; border-bottom: 1px solid #ff9933; width: auto; }
]]>
</style>
</xsl:template>
</xsl:stylesheet>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

View File

@ -1,189 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SolrJS</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../../src/css/solrjs.css" />
<link rel="stylesheet" type="text/css" href="../../lib/jquery-autocomplete/jquery.autocomplete.css" />
<script src="../../lib/jquery/jquery-1.2.6.js"></script>
<script src="../../lib/jquery-autocomplete/jquery.autocomplete.js"</script>
<script src="../../src/core/Core.js"></script>
<script src="../../src/core/QueryItem.js"></script>
<script src="../../src/core/Manager.js"></script>
<script src="../../src/core/AbstractSelectionView.js"></script>
<script src="../../src/core/AbstractWidget.js"></script>
<script src="../../src/core/AbstractServerSideWidget.js"></script>
<script src="../../src/core/AbstractClientSideWidget.js"></script>
<script src="../../src/clientside/ExtensibleResultWidget.js"/></script>
<script src="../../src/clientside/AutocompleteWidget.js"/></script>
<script src="../../src/clientside/TagcloudWidget.js"/></script>
<script src="../../src/clientside/CountryCodeWidget.js"/></script>
<script>
var $sj = jQuery.noConflict();
var solrjsManager;
$sj(document).ready(function(){
solrjsManager = new $sj.solrjs.Manager({solrUrl:"http://localhost:8983/solr/select", resourcesBase: "../../src/resources"});
var resultWidget = new $sj.solrjs.ExtensibleResultWidget({
id:"result",
target:"#result",
rows:10,
showLoadingDiv: true,
renderResult : function(docs, pageSize, offset, numFound) {
var container = jQuery("<div/>");
// paging
jQuery("<a/>").html("<<").attr("href", "javascript:solrjsManager.doRequest(0, true)").appendTo(container);
jQuery("<a/>").html("<").attr("href", "javascript:solrjsManager.doRequest(" + Math.max(0, (parseInt(offset) - parseInt(pageSize))) + ", true)").appendTo(container);
jQuery("<a/>").html(">").attr("href", "javascript:solrjsManager.doRequest(" + Math.min((parseInt(numFound) - parseInt(pageSize)), (parseInt(offset) + parseInt(pageSize))) + ", true)").appendTo(container);
jQuery("<a/>").html(">>").attr("href", "javascript:solrjsManager.doRequest(" + (parseInt(numFound) - parseInt(pageSize)) + ", true)").appendTo(container);
jQuery("<span/>").html("displaying " + (parseInt(offset) + 1) + " to " + Math.min(numFound, (parseInt(offset) + parseInt(pageSize))) + " of " + numFound ).appendTo(container);
jQuery("<hr/>").appendTo(container);
// result
$sj.each(docs, function(i, item) {
jQuery("<h2/>").html(item["title"]).appendTo(container);
var topics = jQuery("<p/>").appendTo(container);
if (item["topics"] != null) {
$sj.each(item["topics"], function(i, topic) {
var items = "[new jQuery.solrjs.QueryItem({field:'topics',value:'" + topic + "'})]";
jQuery("<a/>").html(topic).attr("href", "javascript:solrjsManager.clearSelection();solrjsManager.selectItems('result'," + items + ")").appendTo(topics);
});
}
if (item["organisations"] != null) {
$sj.each(item["organisations"], function(i, topic) {
var items = "[new jQuery.solrjs.QueryItem({field:'organisations' ,value:'" + topic + "'})]";
jQuery("<a/>").html(topic).attr("href", "javascript:solrjsManager.clearSelection();solrjsManager.selectItems('result'," + items + ")").appendTo(topics);
});
}
if (item["exchanges"] != null) {
$sj.each(item["exchanges"], function(i, topic) {
var items = "[new jQuery.solrjs.QueryItem({field:'exchanges' ,value:'" + topic + "'})]";
jQuery("<a/>").html(topic).attr("href", "javascript:solrjsManager.clearSelection();solrjsManager.selectItems('result'," + items + ")").appendTo(topics);
});
}
if (item["text"].length > 300) {
var short = jQuery("<p/>").attr("id", "short_" + item["id"]).html(item["dateline"] + " " + item["text"].substring(0,Math.min(300,item["text"].length))).appendTo(container).css("display", "block");
jQuery("<p/>").attr("id", "long_" + item["id"]).html(item["dateline"] + " " + item["text"]).appendTo(container).css("display", "none");
jQuery("<a/>").html(" more").attr("href", "javascript:toggle('#short_" + item['id'] + "', '#long_" + item['id'] + "');").appendTo(short);
} else {
jQuery("<p/>").attr("id", "long_" + item["id"]).html(item["dateline"] + " " + item["text"]).appendTo(container);
}
});
container.appendTo(this.target);
}
});
solrjsManager.addWidget(resultWidget);
solrjsManager.addWidget(new $sj.solrjs.AutocompleteWidget({id:"search", target:"#search", fulltextFieldName:"allText", fieldNames:["topics", "organisations", "exchanges"]}));
solrjsManager.addWidget(new $sj.solrjs.TagcloudWidget({id:"topics", target:"#topics", fieldName:"topics", size:50}));
solrjsManager.addWidget(new $sj.solrjs.TagcloudWidget({id:"organisations", target:"#organisations", fieldName:"organisations", size:20}));
solrjsManager.addWidget(new $sj.solrjs.TagcloudWidget({id:"exchanges", target:"#exchanges", fieldName:"exchanges", size:20}));
solrjsManager.addWidget(new $sj.solrjs.CountryCodeWidget({id:"countries", target:"#countries", fieldName:"countryCodes"}));
var selectionView = new $sj.solrjs.AbstractSelectionView({
id:"selectionView",
target:"#selection",
displaySelection : function(selectedItems) {
jQuery(this.target).empty();
if(selectedItems.length == 0) {
jQuery("<div/>").html("Viewing all documents!").appendTo(this.target);
return;
} else if(selectedItems.length > 1) {
jQuery("<a/>").html("remove all").attr("href", "javascript:solrjsManager.doRequestAll()").appendTo(this.target);
}
for (var i = 0; i < selectedItems.length; ++i) {
var item = selectedItems[i];
jQuery("<a/>").html("(x) " + item.field + ":" + item.value).attr("href", "javascript:solrjsManager.deselectItem('" + item.toSolrQuery() + "')").appendTo(this.target);
}
}
});
solrjsManager.addSelectionView(selectionView);
solrjsManager.doRequestAll();
});
function toggle(id1, id2) {
$sj(id1).css("display", "none");
$sj(id2).css("display", "block");
}
</script>
</head>
<body>
<div id="wrap">
<div id="header">
<h1><a href="#">SolrJS Demonstration</a></h1>
<h2>Browse REUTERS business news from 1987</h2>
</div>
<div class="right">
<div id="result">
<div id="navigation"></div>
<div id="docs"></div>
</div>
</div>
<div class="left">
<h2>Current Selection</h2>
<ul>
<li> <div id="selection"></div> </li>
</ul>
<h2>Search</h2>
<ul>
<li>
<span style="font-size:80%"> ( press ESC to close suggestions) </span>
<div id="search"></div>
</li>
</ul>
<h2>Top Topics</h2>
<ul>
<li> <div id="topics"></div> </li>
</ul>
<h2>Top Organisations</h2>
<ul>
<li> <div id="organisations"></div> </li>
</ul>
<h2>Top Exchanges</h2>
<ul>
<li> <div id="exchanges"></div> </li>
</ul>
<h2>By Country</h2>
<ul>
<li> <div id="countries"></div> </li>
<li> <div id="preview"></div> </li>
</ul>
<div style="clear:both"></div>
</div>
<div style="clear: both;"> </div>
</div>
<div class="footer">
Design by <a href="http://www.free-css-templates.com/">Free CSS Templates</a> - Thanks to <a href="http://www.dubaiapartments.biz/">Dubai Villas</a>
</div>
</body>
</html>

View File

@ -1,128 +0,0 @@
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
* {
padding: 0;
margin: 0;
}
body {
background: #fff url(images/header.gif) repeat-x;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 18px;
color: #333333;;
}
img { border: none; }
a { color: #6998F0; text-decoration: none; }
a:hover { text-decoration: underline; color : #000; }
#wrap {
width: 1000px;
margin: 0px auto;
}
#header {
height: 90px;
}
#header h1 {
padding: 20px 0 5px 10px;
font-size: 20px;
letter-spacing: -2px;
}
#header h1 a {
color: #000;
text-decoration: none;
}
#header h1 a:hover {
text-decoration: none;
color: #666;
}
#header h2 {
padding-left: 11px;
font-size: 14px;
color: #666;
font-weight: 100;
}
.right {
float: right;
width: 538px;
text-align: justify;
padding: 10px 20px 10px 40px;
border-left: 1px solid #aaa;
min-height:1000px;
}
.right h2 {
color: #B4241B;
font-size: 20px;
letter-spacing: -2px;
font-weight: 100;
padding : 15px 0 5px 0;
}
.right h2 a {
}
.right h2 a:hover {
}
.left {
float: left;
width: 400px;
padding: 10px 0 10px 0px;
}
.left h2 {
font-size: 13px;
color: #333;
padding: 5px 0 2px 10px;
}
.left ul {
list-style-type: none;
padding: 5px 0 10px 5px;
}
.left ul li {
padding: 2px 20px;
}
.left ul li a {
display: block;
color: #6998F0;
}
.left ul li a:hover {
color: #ff0000;
}
.footer {
text-align: center;
color: #666;
font-size: 11px;
padding: 10px;
background: #f7f7f7;
border-top: 1px solid #aaa;
}
.footer a { color: #666; }
#result a {
margin-right:5px;
}
#search input {
width:350px;
}

View File

@ -1,69 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<style type="text/css">
body { font-family: Arial, sans; font-size: 0.8em}
</style>
<script src="../lib/jquery/jquery-1.2.6.js"></script>
<script src="../src/core/Core.js"></script>
<script src="../src/core/QueryItem.js"></script>
<script src="../src/core/Manager.js"></script>
<script src="../src/core/AbstractWidget.js"></script>
<script src="../src/core/AbstractServerSideWidget.js"></script>
<script src="../src/core/AbstractClientSideWidget.js"></script>
<script src="../src/serverside/SimpleServerSideWidget.js"/></script>
<script src="../src/serverside/FacetServerSideWidget.js"/></script>
<script>
var $sj = jQuery.noConflict();
</script>
<script>
var solrjsManager;
$sj(document).ready(function(){
solrjsManager = new $sj.solrjs.Manager({solrUrl:"http://localhost:8983/solr/select"});
// a custom result widget
var resultWidget = new $sj.solrjs.SimpleServerSideWidget({
id:"result",
target:"#result",
rows:5,
templateName:"result"
});
solrjsManager.addWidget(resultWidget);
solrjsManager.addWidget(new $sj.solrjs.FacetServerSideWidget({id:"topics", target:"#topics", fieldName:"topics"}));
solrjsManager.doRequestAll();
});
</script>
</head>
<body>
<body>
<div id="facets" style="float:left;width:300px;">
<h3 style="margin-top:0px">topics</h3>
<div id="topics"></div>
</div>
<div id="result" style="margin-left:300px;"></div>
</body>
</body>
</html>

View File

@ -1,31 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The content of this page will be statically included into the top
of the admin page. Uncomment this as an example to see there the content
will show up.
<hr>
<i>This line will appear before the first table</i>
<tr>
<td colspan="2">
This row will be appended to the end of the first table
</td>
</tr>
<hr>
-->

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- If this file is found in the config directory, it will only be
loaded once at startup. If it is found in Solr's data
directory, it will be re-loaded every commit.
-->
<elevate>
<query text="foo bar">
<doc id="1" />
<doc id="2" />
<doc id="3" />
</query>
<query text="ipod">
<doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
<doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
</query>
</elevate>

View File

@ -1,21 +0,0 @@
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-----------------------------------------------------------------------
# Use a protected word file to protect against the stemmer reducing two
# unrelated words to the same base word.
# Some non-words that normally won't be encountered,
# just to test that they won't be stemmed.
dontstems
zwhacky

View File

@ -1,412 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This is the Solr schema file. This file should be named "schema.xml" and
should be in the conf directory under the solr home
(i.e. ./solr/conf/schema.xml by default)
or located where the classloader for the Solr webapp can find it.
This example schema is the recommended starting point for users.
It should be kept correct and concise, usable out-of-the-box.
For more information, on how to customize this file, please see
http://wiki.apache.org/solr/SchemaXml
-->
<schema name="example" version="1.1">
<!-- attribute "name" is the name of this schema and is only used for display purposes.
Applications should change this to reflect the nature of the search collection.
version="1.1" is Solr's version number for the schema syntax and semantics. It should
not normally be changed by applications.
1.0: multiValued attribute did not exist, all fields are multiValued by nature
1.1: multiValued attribute introduced, false by default -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
behavior of the fieldType.
Class names starting with "solr" refer to java classes in the
org.apache.solr.analysis package.
-->
<!-- The StrField type is not analyzed, but indexed/stored verbatim.
- StrField and TextField support an optional compressThreshold which
limits compression (if enabled in the derived fields) to values which
exceed a certain size (in characters).
-->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<!-- boolean type: "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
<!-- The optional sortMissingLast and sortMissingFirst attributes are
currently supported on types that are sorted internally as strings.
- If sortMissingLast="true", then a sort on this field will cause documents
without the field to come after documents with the field,
regardless of the requested sort order (asc or desc).
- If sortMissingFirst="true", then a sort on this field will cause documents
without the field to come before documents with the field,
regardless of the requested sort order.
- If sortMissingLast="false" and sortMissingFirst="false" (the default),
then default lucene sorting will be used which places docs without the
field first in an ascending sort and last in a descending sort.
-->
<!-- numeric field types that store and index the text
value verbatim (and hence don't support range queries, since the
lexicographic ordering isn't equal to the numeric ordering) -->
<fieldType name="integer" class="solr.IntField" omitNorms="true"/>
<fieldType name="long" class="solr.LongField" omitNorms="true"/>
<fieldType name="float" class="solr.FloatField" omitNorms="true"/>
<fieldType name="double" class="solr.DoubleField" omitNorms="true"/>
<!-- Numeric field types that manipulate the value into
a string value that isn't human-readable in its internal form,
but with a lexicographic ordering the same as the numeric ordering,
so that range queries work correctly. -->
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
is a more restricted form of the canonical representation of dateTime
http://www.w3.org/TR/xmlschema-2/#dateTime
The trailing "Z" designates UTC time and is mandatory.
Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
All other components are mandatory.
Expressions can also be used to denote calculations that should be
performed relative to "NOW" to determine the value, ie...
NOW/HOUR
... Round to the start of the current hour
NOW-1DAY
... Exactly 1 day prior to now
NOW/DAY+6MONTHS+3DAYS
... 6 months and 3 days in the future from the start of
the current day
Consult the DateField javadocs for more information.
-->
<fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
<!-- The "RandomSortField" is not used to store or search any
data. You can declare fields of this type it in your schema
to generate psuedo-random orderings of your docs for sorting
purposes. The ordering is generated based on the field name
and the version of the index, As long as the index version
remains unchanged, and the same field name is reused,
the ordering of the docs will be consistent.
If you want differend psuedo-random orderings of documents,
for the same version of the index, use a dynamicField and
change the name
-->
<fieldType name="random" class="solr.RandomSortField" indexed="true" />
<!-- solr.TextField allows the specification of custom text analyzers
specified as a tokenizer and a list of token filters. Different
analyzers may be specified for indexing and querying.
The optional positionIncrementGap puts space between multiple fields of
this type on the same document, with the purpose of preventing false phrase
matching across fields.
For more info on customizing your analyzer chain, please see
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
-->
<!-- One can also specify an existing Analyzer class that has a
default constructor via the class attribute on the analyzer element
<fieldType name="text_greek" class="solr.TextField">
<analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
</fieldType>
-->
<!-- A text field that only splits on whitespace for exact matching of words -->
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>
<!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
Synonyms and stopwords are customized by external files, and stemming is enabled.
Duplicate tokens at the same position (which may result from Stemmed Synonyms or
WordDelim parts) are removed.
-->
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<!-- Case insensitive stop word removal.
add enablePositionIncrements=true in both the index and query
analyzers to leave a 'gap' for more accurate phrase queries.
-->
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<!-- Less flexible matching, but less false matches. Probably not ideal for product names,
but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
<fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<!--
Setup simple analysis for spell checking
-->
<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<!-- charFilter + "CharStream aware" WhitespaceTokenizer -->
<!--
<fieldType name="textCharNorm" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.CharStreamAwareWhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>
-->
<!-- This is an example of using the KeywordTokenizer along
With various TokenFilterFactories to produce a sortable field
that does not include some properties of the source text
-->
<fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
<analyzer>
<!-- KeywordTokenizer does no actual tokenizing, so the entire
input string is preserved as a single token
-->
<tokenizer class="solr.KeywordTokenizerFactory"/>
<!-- The LowerCase TokenFilter does what you expect, which can be
when you want your sorting to be case insensitive
-->
<filter class="solr.LowerCaseFilterFactory" />
<!-- The TrimFilter removes any leading or trailing whitespace -->
<filter class="solr.TrimFilterFactory" />
<!-- The PatternReplaceFilter gives you the flexibility to use
Java Regular expression to replace any sequence of characters
matching a pattern with an arbitrary replacement string,
which may include back refrences to portions of the orriginal
string matched by the pattern.
See the Java Regular Expression documentation for more
infomation on pattern and replacement string syntax.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
-->
<filter class="solr.PatternReplaceFilterFactory"
pattern="([^a-z])" replacement="" replace="all"
/>
</analyzer>
</fieldType>
<fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" >
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
</analyzer>
</fieldtype>
<!-- since fields of this type are by default not stored or indexed, any data added to
them will be ignored outright
-->
<fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
</types>
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the <types> section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
compressed: [false] if this field should be stored using gzip compression
(this will only apply if the field type is compressable; among
the standard field types, only TextField and StrField are)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
boosting for the field, and saves some memory). Only full-text
fields or fields that need an index-time boost need norms.
termVectors: [false] set to true to store the term vector for a given field.
When using MoreLikeThis, fields used for similarity should be stored for
best performance.
termPositions: Store position information with the term vector. This will increase storage costs.
termOffsets: Store offset information with the term vector. This will increase storage costs.
-->
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
<field name="name" type="text" indexed="true" stored="true"/>
<field name="nameSort" type="string" indexed="true" stored="false"/>
<field name="alphaNameSort" type="alphaOnlySort" indexed="true" stored="false"/>
<field name="manu" type="text" indexed="true" stored="true" omitNorms="true"/>
<field name="cat" type="text_ws" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="features" type="text" indexed="true" stored="true" multiValued="true" termVectors="true" termPositions="true" termOffsets="true"/>
<field name="includes" type="text" indexed="true" stored="true"/>
<field name="weight" type="sfloat" indexed="true" stored="true"/>
<field name="price" type="sfloat" indexed="true" stored="true"/>
<!-- "default" values can be specified for fields, indicating which
value should be used if no value is specified when adding a document.
-->
<field name="popularity" type="sint" indexed="true" stored="true" default="0"/>
<field name="inStock" type="boolean" indexed="true" stored="true"/>
<!-- Some sample docs exists solely to demonstrate the spellchecker
functionality, this is the only field they container.
Typically you might build the spellchecker of "catchall" type field
containing all of the text in each document
-->
<field name="word" type="string" indexed="true" stored="true"/>
<!-- catchall field, containing all other searchable text fields (implemented
via copyField further on in this schema -->
<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
<!-- non-tokenized version of manufacturer to make it easier to sort or group
results by manufacturer. copied from "manu" via copyField -->
<field name="manu_exact" type="string" indexed="true" stored="false"/>
<!-- Here, default is used to create a "timestamp" field indicating
When each document was indexed.
-->
<field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
<field name="spell" type="textSpell" indexed="true" stored="true" multiValued="true"/>
<!-- Dynamic field definitions. If a field name is not found, dynamicFields
will be used if the name matches any of the patterns.
RESTRICTION: the glob-like pattern in the name attribute must have
a "*" only at the start or the end.
EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
Longer patterns will be matched first. if equal size patterns
both match, the first appearing in the schema will be used. -->
<dynamicField name="*_i" type="sint" indexed="true" stored="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
<dynamicField name="*_l" type="slong" indexed="true" stored="true"/>
<dynamicField name="*_t" type="text" indexed="true" stored="true"/>
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_f" type="sfloat" indexed="true" stored="true"/>
<dynamicField name="*_d" type="sdouble" indexed="true" stored="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<dynamicField name="random*" type="random" />
<!-- uncomment the following to ignore any fields that don't already match an existing
field name or dynamic field, rather than reporting them as an error.
alternately, change the type="ignored" to some other type e.g. "text" if you want
unknown fields indexed and/or stored by default -->
<!--dynamicField name="*" type="ignored" /-->
</fields>
<!-- Field to use to determine and enforce document uniqueness.
Unless this field is marked with required="false", it will be a required field
-->
<uniqueKey>id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
<solrQueryParser defaultOperator="OR"/>
<!-- copyField commands copy one field to another at the time a document
is added to the index. It's used either to index the same field differently,
or to add multiple fields to the same field for easier/faster searching. -->
<copyField source="id" dest="sku"/>
<copyField source="incubationdate_dt" dest="incubationdate_s"/>
<copyField source="cat" dest="text"/>
<copyField source="name" dest="text"/>
<copyField source="name" dest="nameSort"/>
<copyField source="name" dest="alphaNameSort"/>
<copyField source="manu" dest="text"/>
<copyField source="features" dest="text"/>
<copyField source="includes" dest="text"/>
<copyField source="manu" dest="manu_exact"/>
<copyField source="name" dest="spell"/>
<!-- Similarity is the scoring routine for each document vs. a query.
A custom similarity may be specified here, but the default is fine
for most applications. -->
<!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
<!-- ... OR ...
Specify a SimilarityFactory class name implementation
allowing parameters to be used.
-->
<!--
<similarity class="com.example.solr.CustomSimilarityFactory">
<str name="paramkey">param value</str>
</similarity>
-->
</schema>

View File

@ -1,24 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
user=
solr_hostname=localhost
solr_port=8983
rsyncd_port=18983
data_dir=
webapp_name=solr
master_host=
master_data_dir=
master_status_dir=

View File

@ -1,698 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<config>
<!-- Set this to 'false' if you want solr to continue working after it has
encountered an severe configuration error. In a production environment,
you may want solr to keep working even if one handler is mis-configured.
You may also set this to false using by setting the system property:
-Dsolr.abortOnConfigurationError=false
-->
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
<!-- Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home.
If replication is in use, this should match the replication configuration. -->
<dataDir>${solr.data.dir:./solr/data}</dataDir>
<indexDefaults>
<!-- Values here affect all index writers and act as a default unless overridden. -->
<useCompoundFile>false</useCompoundFile>
<mergeFactor>10</mergeFactor>
<!--
If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
-->
<!--<maxBufferedDocs>1000</maxBufferedDocs>-->
<!-- Tell Lucene when to flush documents to disk.
Giving Lucene more memory for indexing means faster indexing at the cost of more RAM
If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
-->
<ramBufferSizeMB>32</ramBufferSizeMB>
<maxMergeDocs>2147483647</maxMergeDocs>
<maxFieldLength>10000</maxFieldLength>
<writeLockTimeout>1000</writeLockTimeout>
<commitLockTimeout>10000</commitLockTimeout>
<!--
Expert: Turn on Lucene's auto commit capability.
This causes intermediate segment flushes to write a new lucene
index descriptor, enabling it to be opened by an external
IndexReader.
NOTE: Despite the name, this value does not have any relation to Solr's autoCommit functionality
-->
<!--<luceneAutoCommit>false</luceneAutoCommit>-->
<!--
Expert:
The Merge Policy in Lucene controls how merging is handled by Lucene. The default in 2.3 is the LogByteSizeMergePolicy, previous
versions used LogDocMergePolicy.
LogByteSizeMergePolicy chooses segments to merge based on their size. The Lucene 2.2 default, LogDocMergePolicy chose when
to merge based on number of documents
Other implementations of MergePolicy must have a no-argument constructor
-->
<!--<mergePolicy>org.apache.lucene.index.LogByteSizeMergePolicy</mergePolicy>-->
<!--
Expert:
The Merge Scheduler in Lucene controls how merges are performed. The ConcurrentMergeScheduler (Lucene 2.3 default)
can perform merges in the background using separate threads. The SerialMergeScheduler (Lucene 2.2 default) does not.
-->
<!--<mergeScheduler>org.apache.lucene.index.ConcurrentMergeScheduler</mergeScheduler>-->
<!--
This option specifies which Lucene LockFactory implementation to use.
single = SingleInstanceLockFactory - suggested for a read-only index
or when there is no possibility of another process trying
to modify the index.
native = NativeFSLockFactory
simple = SimpleFSLockFactory
(For backwards compatibility with Solr 1.2, 'simple' is the default
if not specified.)
-->
<lockType>single</lockType>
</indexDefaults>
<mainIndex>
<!-- options specific to the main on-disk lucene index -->
<useCompoundFile>false</useCompoundFile>
<ramBufferSizeMB>32</ramBufferSizeMB>
<mergeFactor>10</mergeFactor>
<!-- Deprecated -->
<!--<maxBufferedDocs>1000</maxBufferedDocs>-->
<maxMergeDocs>2147483647</maxMergeDocs>
<maxFieldLength>10000</maxFieldLength>
<!-- If true, unlock any held write or commit locks on startup.
This defeats the locking mechanism that allows multiple
processes to safely access a lucene index, and should be
used with care.
This is not needed if lock type is 'none' or 'single'
-->
<unlockOnStartup>false</unlockOnStartup>
</mainIndex>
<!-- Enables JMX if and only if an existing MBeanServer is found, use
this if you want to configure JMX through JVM parameters. Remove
this to disable exposing Solr configuration and statistics to JMX.
If you want to connect to a particular server, specify the agentId
e.g. <jmx agentId="myAgent" />
If you want to start a new MBeanServer, specify the serviceUrl
e.g <jmx serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr" />
For more details see http://wiki.apache.org/solr/SolrJmx
-->
<jmx />
<!-- the default high-performance update handler -->
<updateHandler class="solr.DirectUpdateHandler2">
<!-- A prefix of "solr." for class names is an alias that
causes solr to search appropriate packages, including
org.apache.solr.(search|update|request|core|analysis)
-->
<!-- Perform a <commit/> automatically under certain conditions:
maxDocs - number of updates since last commit is greater than this
maxTime - oldest uncommited update (in ms) is this long ago
<autoCommit>
<maxDocs>10000</maxDocs>
<maxTime>1000</maxTime>
</autoCommit>
-->
<!-- The RunExecutableListener executes an external command.
exe - the name of the executable to run
dir - dir to use as the current working directory. default="."
wait - the calling thread waits until the executable returns. default="true"
args - the arguments to pass to the program. default=nothing
env - environment variables to set. default=nothing
-->
<!-- A postCommit event is fired after every commit or optimize command
<listener event="postCommit" class="solr.RunExecutableListener">
<str name="exe">solr/bin/snapshooter</str>
<str name="dir">.</str>
<bool name="wait">true</bool>
<arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
<arr name="env"> <str>MYVAR=val1</str> </arr>
</listener>
-->
<!-- A postOptimize event is fired only after every optimize command, useful
in conjunction with index distribution to only distribute optimized indicies
<listener event="postOptimize" class="solr.RunExecutableListener">
<str name="exe">snapshooter</str>
<str name="dir">solr/bin</str>
<bool name="wait">true</bool>
</listener>
-->
</updateHandler>
<query>
<!-- Maximum number of clauses in a boolean query... can affect
range or prefix queries that expand to big boolean
queries. An exception is thrown if exceeded. -->
<maxBooleanClauses>1024</maxBooleanClauses>
<!-- Cache used by SolrIndexSearcher for filters (DocSets),
unordered sets of *all* documents that match a query.
When a new searcher is opened, its caches may be prepopulated
or "autowarmed" using data from caches in the old searcher.
autowarmCount is the number of items to prepopulate. For LRUCache,
the autowarmed items will be the most recently accessed items.
Parameters:
class - the SolrCache implementation (currently only LRUCache)
size - the maximum number of entries in the cache
initialSize - the initial capacity (number of entries) of
the cache. (seel java.util.HashMap)
autowarmCount - the number of entries to prepopulate from
and old cache.
-->
<filterCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="128"/>
<!-- queryResultCache caches results of searches - ordered lists of
document ids (DocList) based on a query, a sort, and the range
of documents requested. -->
<queryResultCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="32"/>
<!-- documentCache caches Lucene Document objects (the stored fields for each document).
Since Lucene internal document ids are transient, this cache will not be autowarmed. -->
<documentCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="0"/>
<!-- If true, stored fields that are not requested will be loaded lazily.
This can result in a significant speed improvement if the usual case is to
not load all stored fields, especially if the skipped fields are large compressed
text fields.
-->
<enableLazyFieldLoading>true</enableLazyFieldLoading>
<!-- Example of a generic cache. These caches may be accessed by name
through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().
The purpose is to enable easy caching of user/application level data.
The regenerator argument should be specified as an implementation
of solr.search.CacheRegenerator if autowarming is desired. -->
<!--
<cache name="myUserCache"
class="solr.LRUCache"
size="4096"
initialSize="1024"
autowarmCount="1024"
regenerator="org.mycompany.mypackage.MyRegenerator"
/>
-->
<!-- An optimization that attempts to use a filter to satisfy a search.
If the requested sort does not include score, then the filterCache
will be checked for a filter matching the query. If found, the filter
will be used as the source of document ids, and then the sort will be
applied to that.
<useFilterForSortedQuery>true</useFilterForSortedQuery>
-->
<!-- An optimization for use with the queryResultCache. When a search
is requested, a superset of the requested number of document ids
are collected. For example, if a search for a particular query
requests matching documents 10 through 19, and queryWindowSize is 50,
then documents 0 through 49 will be collected and cached. Any further
requests in that range can be satisfied via the cache. -->
<queryResultWindowSize>50</queryResultWindowSize>
<!-- Maximum number of documents to cache for any entry in the
queryResultCache. -->
<queryResultMaxDocsCached>200</queryResultMaxDocsCached>
<!-- This entry enables an int hash representation for filters (DocSets)
when the number of items in the set is less than maxSize. For smaller
sets, this representation is more memory efficient, more efficient to
iterate over, and faster to take intersections. -->
<HashDocSet maxSize="3000" loadFactor="0.75"/>
<!-- a newSearcher event is fired whenever a new searcher is being prepared
and there is a current searcher handling requests (aka registered). -->
<!-- QuerySenderListener takes an array of NamedList and executes a
local query request for each NamedList in sequence. -->
<listener event="newSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst><str name="q">static newSearcher warming query from solrconfig.xml</str></lst>
</arr>
</listener>
<!-- a firstSearcher event is fired whenever a new searcher is being
prepared but there is no current registered searcher to handle
requests or to gain autowarming data from. -->
<listener event="firstSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<lst> <str name="q">fast_warm</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst><str name="q">static firstSearcher warming query from solrconfig.xml</str></lst>
</arr>
</listener>
<!-- If a search request comes in and there is no current registered searcher,
then immediately register the still warming searcher and use it. If
"false" then all requests will block until the first searcher is done
warming. -->
<useColdSearcher>false</useColdSearcher>
<!-- Maximum number of searchers that may be warming in the background
concurrently. An error is returned if this limit is exceeded. Recommend
1-2 for read-only slaves, higher for masters w/o cache warming. -->
<maxWarmingSearchers>2</maxWarmingSearchers>
</query>
<!--
Let the dispatch filter handler /select?qt=XXX
handleSelect=true will use consistent error handling for /select and /update
handleSelect=false will use solr1.1 style error formatting
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
<!-- Set HTTP caching related parameters (for proxy caches and clients).
To get the behaviour of Solr 1.2 (ie: no caching related headers)
use the never304="true" option and do not specify a value for
<cacheControl>
-->
<!-- <httpCaching never304="true"> -->
<httpCaching lastModifiedFrom="openTime"
etagSeed="Solr">
<!-- lastModFrom="openTime" is the default, the Last-Modified value
(and validation against If-Modified-Since requests) will all be
relative to when the current Searcher was opened.
You can change it to lastModFrom="dirLastMod" if you want the
value to exactly corrispond to when the physical index was last
modified.
etagSeed="..." is an option you can change to force the ETag
header (and validation against If-None-Match requests) to be
differnet even if the index has not changed (ie: when making
significant changes to your config file)
lastModifiedFrom and etagSeed are both ignored if you use the
never304="true" option.
-->
<!-- If you include a <cacheControl> directive, it will be used to
generate a Cache-Control header, as well as an Expires header
if the value contains "max-age="
By default, no Cache-Control header is generated.
You can use the <cacheControl> option even if you have set
never304="true"
-->
<!-- <cacheControl>max-age=30, public</cacheControl> -->
</httpCaching>
</requestDispatcher>
<!-- requestHandler plugins... incoming queries will be dispatched to the
correct handler based on the path or the qt (query type) param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
If no qt is defined, the requestHandler that declares default="true"
will be used.
-->
<requestHandler name="standard" class="solr.SearchHandler" default="true">
<!-- default values for query parameters -->
<lst name="defaults">
<str name="echoParams">explicit</str>
<!--
<int name="rows">10</int>
<str name="fl">*</str>
<str name="version">2.1</str>
-->
</lst>
</requestHandler>
<!-- DisMaxRequestHandler allows easy searching across multiple fields
for simple user-entered phrases. It's implementation is now
just the standard SearchHandler with a default query type
of "dismax".
see http://wiki.apache.org/solr/DisMaxRequestHandler
-->
<requestHandler name="dismax" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="qf">
text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
</str>
<str name="pf">
text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9
</str>
<str name="bf">
ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3
</str>
<str name="fl">
id,name,price,score
</str>
<str name="mm">
2&lt;-1 5&lt;-2 6&lt;90%
</str>
<int name="ps">100</int>
<str name="q.alt">*:*</str>
<!-- example highlighter config, enable per-query with hl=true -->
<str name="hl.fl">text features name</str>
<!-- for this field, we want no fragmenting, just highlighting -->
<str name="f.name.hl.fragsize">0</str>
<!-- instructs Solr to return the field itself if no query terms are
found -->
<str name="f.name.hl.alternateField">name</str>
<str name="f.text.hl.fragmenter">regex</str> <!-- defined below -->
</lst>
</requestHandler>
<!-- Note how you can register the same handler multiple times with
different names (and different init parameters)
-->
<requestHandler name="partitioned" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str>
<str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
<!-- This is an example of using Date Math to specify a constantly
moving date range in a config...
-->
<str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str>
</lst>
<!-- In addition to defaults, "appends" params can be specified
to identify values which should be appended to the list of
multi-val params from the query (or the existing "defaults").
In this example, the param "fq=instock:true" will be appended to
any query time fq params the user may specify, as a mechanism for
partitioning the index, independent of any user selected filtering
that may also be desired (perhaps as a result of faceted searching).
NOTE: there is *absolutely* nothing a client can do to prevent these
"appends" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<lst name="appends">
<str name="fq">inStock:true</str>
</lst>
<!-- "invariants" are a way of letting the Solr maintainer lock down
the options available to Solr clients. Any params values
specified here are used regardless of what values may be specified
in either the query, the "defaults", or the "appends" params.
In this example, the facet.field and facet.query params are fixed,
limiting the facets clients can use. Faceting is not turned on by
default - but if the client does specify facet=true in the request,
these are the only facets they will be able to see counts for;
regardless of what other facet.field or facet.query params they
may specify.
NOTE: there is *absolutely* nothing a client can do to prevent these
"invariants" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<lst name="invariants">
<str name="facet.field">cat</str>
<str name="facet.field">manu_exact</str>
<str name="facet.query">price:[* TO 500]</str>
<str name="facet.query">price:[500 TO *]</str>
</lst>
</requestHandler>
<!--
Search components are registered to SolrCore and used by Search Handlers
By default, the following components are avaliable:
<searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" />
<searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" />
<searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" />
<searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" />
<searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" />
Default configuration in a requestHandler would look like:
<arr name="components">
<str>query</str>
<str>facet</str>
<str>mlt</str>
<str>highlight</str>
<str>debug</str>
</arr>
If you register a searchComponent to one of the standard names, that will be used instead.
To insert handlers before or after the 'standard' components, use:
<arr name="first-components">
<str>myFirstComponentName</str>
</arr>
<arr name="last-components">
<str>myLastComponentName</str>
</arr>
-->
<!-- The spell check component can return a list of alternative spelling
suggestions. -->
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<str name="queryAnalyzerFieldType">textSpell</str>
<lst name="spellchecker">
<str name="name">default</str>
<str name="field">spell</str>
<str name="spellcheckIndexDir">./spellchecker1</str>
</lst>
<lst name="spellchecker">
<str name="name">jarowinkler</str>
<str name="field">spell</str>
<!-- Use a different Distance Measure -->
<str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
<str name="spellcheckIndexDir">./spellchecker2</str>
</lst>
<lst name="spellchecker">
<str name="classname">solr.FileBasedSpellChecker</str>
<str name="name">file</str>
<str name="sourceLocation">spellings.txt</str>
<str name="characterEncoding">UTF-8</str>
<str name="spellcheckIndexDir">./spellcheckerFile</str>
</lst>
</searchComponent>
<!-- a request handler utilizing the spellcheck component -->
<requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">
<lst name="defaults">
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
<!-- a search component that enables you to configure the top results for
a given query regardless of the normal lucene scoring.-->
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
<!-- pick a fieldType to analyze queries -->
<str name="queryFieldType">string</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
<!-- a request handler utilizing the elevator component -->
<requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="echoParams">explicit</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
<!-- Update request handler.
Note: Since solr1.1 requestHandlers requires a valid content type header if posted in
the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'
The response format differs from solr1.1 formatting and returns a standard error code.
To enable solr1.1 behavior, remove the /update handler or change its path
-->
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
<!--
Analysis request handler. Since Solr 1.3. Use to returnhow a document is analyzed. Useful
for debugging and as a token server for other types of applications
-->
<requestHandler name="/analysis" class="solr.AnalysisRequestHandler" />
<!-- CSV update handler, loaded on demand -->
<requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
<!--
Admin Handlers - This will register all the standard admin RequestHandlers. Adding
this single handler is equivalent to registering:
<requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />
<requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" />
<requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" />
<requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" />
<requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" />
<requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using:
<requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
<lst name="invariants">
<str name="hidden">synonyms.txt</str>
<str name="hidden">anotherfile.txt</str>
</lst>
</requestHandler>
-->
<requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
<!-- ping/healthcheck -->
<requestHandler name="/admin/ping" class="PingRequestHandler">
<lst name="defaults">
<str name="qt">standard</str>
<str name="q">solrpingquery</str>
<str name="echoParams">all</str>
</lst>
</requestHandler>
<!-- Echo the request contents back to the client -->
<requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
<lst name="defaults">
<str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
<str name="echoHandler">true</str>
</lst>
</requestHandler>
<highlighting>
<!-- Configure the standard fragmenter -->
<!-- This could most likely be commented out in the "default" case -->
<fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
<lst name="defaults">
<int name="hl.fragsize">100</int>
</lst>
</fragmenter>
<!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->
<fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
<lst name="defaults">
<!-- slightly smaller fragsizes work better because of slop -->
<int name="hl.fragsize">70</int>
<!-- allow 50% slop on fragment sizes -->
<float name="hl.regex.slop">0.5</float>
<!-- a basic sentence pattern -->
<str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
</lst>
</fragmenter>
<!-- Configure the standard formatter -->
<formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
<lst name="defaults">
<str name="hl.simple.pre"><![CDATA[<em>]]></str>
<str name="hl.simple.post"><![CDATA[</em>]]></str>
</lst>
</formatter>
</highlighting>
<!-- queryResponseWriter plugins... query responses will be written using the
writer specified by the 'wt' request parameter matching the name of a registered
writer.
The "default" writer is the default and will be used if 'wt' is not specified
in the request. XMLResponseWriter will be used if nothing is specified here.
The json, python, and ruby writers are also available by default.
<queryResponseWriter name="xml" class="org.apache.solr.request.XMLResponseWriter" default="true"/>
<queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
<queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>
<queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
<queryResponseWriter name="php" class="org.apache.solr.request.PHPResponseWriter"/>
<queryResponseWriter name="phps" class="org.apache.solr.request.PHPSerializedResponseWriter"/>
<queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>
-->
<!-- XSLT response writer transforms the XML output by any xslt file found
in Solr's conf/xslt directory. Changes to xslt files are checked for
every xsltCacheLifetimeSeconds.
-->
<queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
<int name="xsltCacheLifetimeSeconds">5</int>
</queryResponseWriter>
<queryResponseWriter name="velocity" class="org.apache.solr.request.VelocityResponseWriter"/>
<!-- example of registering a query parser
<queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>
-->
<!-- example of registering a custom function parser
<valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" />
-->
<!-- config for the admin interface -->
<admin>
<defaultQuery>solr</defaultQuery>
<!-- configure a healthcheck file for servers behind a loadbalancer
<healthcheck type="file">server-enabled</healthcheck>
-->
</admin>
</config>

View File

@ -1,2 +0,0 @@
pizza
history

View File

@ -1,58 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-----------------------------------------------------------------------
# a couple of test stopwords to test that the words are really being
# configured from this file:
stopworda
stopwordb
#Standard english stop words taken from Lucene's StopAnalyzer
a
an
and
are
as
at
be
but
by
for
if
in
into
is
it
no
not
of
on
or
s
such
t
that
the
their
then
there
these
they
this
to
was
will
with

View File

@ -1,31 +0,0 @@
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-----------------------------------------------------------------------
#some test synonym mappings unlikely to appear in real input text
aaa => aaaa
bbb => bbbb1 bbbb2
ccc => cccc1,cccc2
a\=>a => b\=>b
a\,a => b\,b
fooaaa,baraaa,bazaaa
# Some synonym groups specific to this example
GB,gib,gigabyte,gigabytes
MB,mib,megabyte,megabytes
Television, Televisions, TV, TVs
#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
#after us won't split it into two words.
# Synonym mappings can be used for spelling correction too
pixima => pixma

View File

@ -1,36 +0,0 @@
#macro(url_for_filters $filter_queries)
/solr/itas?fq=$filter_queries
#end
#macro(url_for_home)/solr/itas#end
#macro(url_for_start $start)/solr/itas?start=$start#end
#macro(url_for_nested_facet $field $value)/solr/itas?fq=$field:$value#end
#macro(link_to_previous_page $text)
#if($page.current_page_number > 1)
#set($prev_start = $page.start - $page.results_per_page)
<a class="prev-page" href="#url_for_start($prev_start)">$text</a>
#end
#end
#macro(link_to_next_page $text)
#if($page.current_page_number < $page.page_count)
#set($next_start = $page.start + $page.results_per_page)
<a class="next-page" href="#url_for_start($next_start)">$text</a>
#end
#end
#macro(link_to_page $page_number $text)
#if($page_number == $page.current_page_number)
$text
#else
#if($page_number <= $page.page_count)
#set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
<a class="page" href="#url_for_start($page_start)">$text</a>
#end
#end
#end
#macro(param $key)$request.params.get($key)#end

View File

@ -1,70 +0,0 @@
#set($doclist=$response.values.response)
#set($searcher=$request.searcher)
#set($params=$request.params)
#set($fields=$response.returnFields)
<html>
## TODO: Implement layouts
<head>
<title>#param('title')</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="/solr/admin/jquery-1.2.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="/solr/admin/file?file=/velocity/main.css&contentType=text/css"/>
</head>
<body>
<div>
#parse("header.vm")
#set($filter_queries = $params.getParams('fq'))
#foreach($fq in $filter_queries)
&gt; <a href="#url_for_filters($filter_queries.subList(0,$velocityCount))">$fq</a>
#end
</div>
<div class="query-box">
<form id="query-form" action="/solr/itas" method="GET">
Query: <input type="text" name="q" value="$!params.get('q')"/>
</form>
</div>
<div class="facet-fields">
#foreach($field in $response.values.facet_counts.facet_fields)
<span class="facet-field">$field.key</span>
<ul>
#foreach($facet in $field.value)
#set($facetURL = "#url_for_nested_facet($field.key, $facet.key)")
#if ($facetURL != '')
<li><a href="$facetURL">$facet.key</a> ($facet.value)</li>
#end
#end
</ul>
#end
</div>
<div class="pagination">
<span><span class="results-found">$page.results_found</span> results found in ${response.responseHeader.QTime} ms</span>
</div>
<div class="results">
#foreach($id in $doclist.iterator())
#set($doc = $searcher.doc($id,$response.returnFields))
#parse("hit.vm")
#end
</div>
<div class="pagination">
#link_to_previous_page("previous")
<span class="results-found">$page.results_found</span> results found.
Page <span class="page-num">$page.current_page_number</span> of <span
class="page-count">$page.page_count</span>
#link_to_next_page("next")
<br/>
</div>
<div>
#parse("footer.vm")
</div>
</body>
</html>

View File

@ -1,18 +0,0 @@
<div class="result-document">
#foreach($field in $doc.fields)
#if($response.returnFields.contains("*") || $response.returnFields.contains($field.name()))
<p>
<span class="field-name">$field.name() :</span>
<span>
##TODO: Need to provide helpers for field values, including HTML escaping and highlighting
#foreach($value in $doc.getFieldables($field.name()))
$request.schema.getFieldType($field.name()).toExternal($value)
#end
</span>
</p>
#end
#end
#if($params.getBool("debugQuery",false))
<a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle explain</a> <pre style="display:none">$response.values.debug.explain.get($doc.get('id'))</pre>
#end
</div>

View File

@ -1,96 +0,0 @@
.array-field {
border: 2px solid #474747;
background: #FFE9D8;
padding: 5px;
margin: 5px;
}
.array-field-list li {
list-style: circle;
margin-left: 20px;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
.constraints-title {
background: gray;
}
.facet-fields {
float: left;
margin: 5px;
margin-top: 0px;
background: #FEC293;
border: 2px solid #474747;
width: 185px;
padding: 2px;
}
.facet-field {
font-weight: bold;
}
.highlight {
color: white;
background-color: gray;
border: 1px black solid;
}
.highlight-box {
margin-left: 15px;
}
.field-name {
font-weight: bold;
}
.highlighted-facet-field {
background: white;
}
#logo {
margin: 10px;
}
.query-box, .constraints {
padding: 5px;
margin: 5px;
border: 3px solid #474747;
color: white;
background: #FD9644;
font-weight: bold;
font-size: 16px;
}
.query-box input {
margin-left: 8px;
width: 85%;
}
.pagination {
padding-left: 33%;
font-weight: bold;
background: gray;
color: white;
margin: 5px;
margin-left: 200px;
}
.result-document {
border: 3px solid #474747;
background: #FEC293;
padding: 5px;
margin: 5px;
margin-left: 200px;
}
.selected-facet-field {
font-weight: bold;
}
li.show {
list-style: disc;
}

View File

@ -1,132 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!--
Simple transform of Solr query results to HTML
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
>
<xsl:output media-type="text/html; charset=UTF-8" encoding="UTF-8"/>
<xsl:variable name="title" select="concat('Solr search results (',response/result/@numFound,' documents)')"/>
<xsl:template match='/'>
<html>
<head>
<title><xsl:value-of select="$title"/></title>
<xsl:call-template name="css"/>
</head>
<body>
<h1><xsl:value-of select="$title"/></h1>
<div class="note">
This has been formatted by the sample "example.xsl" transform -
use your own XSLT to get a nicer page
</div>
<xsl:apply-templates select="response/result/doc"/>
</body>
</html>
</xsl:template>
<xsl:template match="doc">
<xsl:variable name="pos" select="position()"/>
<div class="doc">
<table width="100%">
<xsl:apply-templates>
<xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param>
</xsl:apply-templates>
</table>
</div>
</xsl:template>
<xsl:template match="doc/*[@name='score']" priority="100">
<xsl:param name="pos"></xsl:param>
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:value-of select="."/>
<xsl:if test="boolean(//lst[@name='explain'])">
<xsl:element name="a">
<!-- can't allow whitespace here -->
<xsl:attribute name="href">javascript:toggle("<xsl:value-of select="concat('exp-',$pos)" />");</xsl:attribute>?</xsl:element>
<br/>
<xsl:element name="div">
<xsl:attribute name="class">exp</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="concat('exp-',$pos)" />
</xsl:attribute>
<xsl:value-of select="//lst[@name='explain']/str[position()=$pos]"/>
</xsl:element>
</xsl:if>
</td>
</tr>
</xsl:template>
<xsl:template match="doc/arr" priority="100">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<ul>
<xsl:for-each select="*">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
</td>
</tr>
</xsl:template>
<xsl:template match="doc/*">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<xsl:template match="*"/>
<xsl:template name="css">
<script>
function toggle(id) {
var obj = document.getElementById(id);
obj.style.display = (obj.style.display != 'block') ? 'block' : 'none';
}
</script>
<style type="text/css">
body { font-family: "Lucida Grande", sans-serif }
td.name { font-style: italic; font-size:80%; }
td { vertical-align: top; }
ul { margin: 0px; margin-left: 1em; padding: 0px; }
.note { font-size:80%; }
.doc { margin-top: 1em; border-top: solid grey 1px; }
.exp { display: none; font-family: monospace; white-space: pre; }
</style>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,67 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!--
Simple transform of Solr query results to Atom
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output
method="xml"
encoding="utf-8"
media-type="text/xml; charset=UTF-8"
/>
<xsl:template match='/'>
<xsl:variable name="query" select="response/lst[@name='responseHeader']/lst[@name='params']/str[@name='q']"/>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Solr Atom 1.0 Feed</title>
<subtitle>
This has been formatted by the sample "example_atom.xsl" transform -
use your own XSLT to get a nicer Atom feed.
</subtitle>
<author>
<name>Apache Solr</name>
<email>solr-user@lucene.apache.org</email>
</author>
<link rel="self" type="application/atom+xml"
href="http://localhost:8983/solr/q={$query}&amp;wt=xslt&amp;tr=atom.xsl"/>
<updated>
<xsl:value-of select="response/result/doc[position()=1]/date[@name='timestamp']"/>
</updated>
<id>tag:localhost,2007:example</id>
<xsl:apply-templates select="response/result/doc"/>
</feed>
</xsl:template>
<!-- search results xslt -->
<xsl:template match="doc">
<xsl:variable name="id" select="str[@name='id']"/>
<entry>
<title><xsl:value-of select="str[@name='name']"/></title>
<link href="http://localhost:8983/solr/select?q={$id}"/>
<id>tag:localhost,2007:<xsl:value-of select="$id"/></id>
<summary><xsl:value-of select="arr[@name='features']"/></summary>
<updated><xsl:value-of select="date[@name='timestamp']"/></updated>
</entry>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,66 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!--
Simple transform of Solr query results to RSS
-->
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output
method="xml"
encoding="utf-8"
media-type="text/xml; charset=UTF-8"
/>
<xsl:template match='/'>
<rss version="2.0">
<channel>
<title>Example Solr RSS 2.0 Feed</title>
<link>http://localhost:8983/solr</link>
<description>
This has been formatted by the sample "example_rss.xsl" transform -
use your own XSLT to get a nicer RSS feed.
</description>
<language>en-us</language>
<docs>http://localhost:8983/solr</docs>
<xsl:apply-templates select="response/result/doc"/>
</channel>
</rss>
</xsl:template>
<!-- search results xslt -->
<xsl:template match="doc">
<xsl:variable name="id" select="str[@name='id']"/>
<xsl:variable name="timestamp" select="date[@name='timestamp']"/>
<item>
<title><xsl:value-of select="str[@name='name']"/></title>
<link>
http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
</link>
<description>
<xsl:value-of select="arr[@name='features']"/>
</description>
<pubDate><xsl:value-of select="$timestamp"/></pubDate>
<guid>
http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
</guid>
</item>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,337 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Display the luke request handler with graphs
-->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
version="1.0"
>
<xsl:output
method="html"
encoding="UTF-8"
media-type="text/html; charset=UTF-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
/>
<xsl:variable name="title">Solr Luke Request Handler Response</xsl:variable>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css"/>
<link rel="icon" href="favicon.ico" type="image/ico"/>
<link rel="shortcut icon" href="favicon.ico" type="image/ico"/>
<title>
<xsl:value-of select="$title"/>
</title>
<xsl:call-template name="css"/>
</head>
<body>
<h1>
<xsl:value-of select="$title"/>
</h1>
<div class="doc">
<ul>
<xsl:if test="response/lst[@name='index']">
<li>
<a href="#index">Index Statistics</a>
</li>
</xsl:if>
<xsl:if test="response/lst[@name='fields']">
<li>
<a href="#fields">Field Statistics</a>
<ul>
<xsl:for-each select="response/lst[@name='fields']/lst">
<li>
<a href="#{@name}">
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="response/lst[@name='doc']">
<li>
<a href="#doc">Document statistics</a>
</li>
</xsl:if>
</ul>
</div>
<xsl:if test="response/lst[@name='index']">
<h2><a name="index"/>Index Statistics</h2>
<xsl:apply-templates select="response/lst[@name='index']"/>
</xsl:if>
<xsl:if test="response/lst[@name='fields']">
<h2><a name="fields"/>Field Statistics</h2>
<xsl:apply-templates select="response/lst[@name='fields']"/>
</xsl:if>
<xsl:if test="response/lst[@name='doc']">
<h2><a name="doc"/>Document statistics</h2>
<xsl:apply-templates select="response/lst[@name='doc']"/>
</xsl:if>
</body>
</html>
</xsl:template>
<xsl:template match="lst">
<xsl:if test="parent::lst">
<tr>
<td colspan="2">
<div class="doc">
<xsl:call-template name="list"/>
</div>
</td>
</tr>
</xsl:if>
<xsl:if test="not(parent::lst)">
<div class="doc">
<xsl:call-template name="list"/>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="list">
<xsl:if test="count(child::*)>0">
<table>
<thead>
<tr>
<th colspan="2">
<p>
<a name="{@name}"/>
</p>
<xsl:value-of select="@name"/>
</th>
</tr>
</thead>
<tbody>
<xsl:choose>
<xsl:when
test="@name='histogram'">
<tr>
<td colspan="2">
<xsl:call-template name="histogram"/>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</tbody>
</table>
</xsl:if>
</xsl:template>
<xsl:template name="histogram">
<div class="doc">
<xsl:call-template name="barchart">
<xsl:with-param name="max_bar_width">50</xsl:with-param>
<xsl:with-param name="iwidth">800</xsl:with-param>
<xsl:with-param name="iheight">160</xsl:with-param>
<xsl:with-param name="fill">blue</xsl:with-param>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template name="barchart">
<xsl:param name="max_bar_width"/>
<xsl:param name="iwidth"/>
<xsl:param name="iheight"/>
<xsl:param name="fill"/>
<xsl:variable name="max">
<xsl:for-each select="int">
<xsl:sort data-type="number" order="descending"/>
<xsl:if test="position()=1">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="bars">
<xsl:value-of select="count(int)"/>
</xsl:variable>
<xsl:variable name="bar_width">
<xsl:choose>
<xsl:when test="$max_bar_width &lt; ($iwidth div $bars)">
<xsl:value-of select="$max_bar_width"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$iwidth div $bars"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<table class="histogram">
<tbody>
<tr>
<xsl:for-each select="int">
<td>
<xsl:value-of select="."/>
<div class="histogram">
<xsl:attribute name="style">background-color: <xsl:value-of select="$fill"/>; width: <xsl:value-of select="$bar_width"/>px; height: <xsl:value-of select="($iheight*number(.)) div $max"/>px;</xsl:attribute>
</div>
</td>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="int">
<td>
<xsl:value-of select="@name"/>
</td>
</xsl:for-each>
</tr>
</tbody>
</table>
</xsl:template>
<xsl:template name="keyvalue">
<xsl:choose>
<xsl:when test="@name">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="int|bool|long|float|double|uuid|date">
<xsl:call-template name="keyvalue"/>
</xsl:template>
<xsl:template match="arr">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<ul>
<xsl:for-each select="child::*">
<li>
<xsl:apply-templates/>
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</xsl:template>
<xsl:template match="str">
<xsl:choose>
<xsl:when test="@name='schema' or @name='index' or @name='flags'">
<xsl:call-template name="schema"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="keyvalue"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="schema">
<tr>
<td class="name">
<xsl:value-of select="@name"/>
</td>
<td class="value">
<xsl:if test="contains(.,'unstored')">
<xsl:value-of select="."/>
</xsl:if>
<xsl:if test="not(contains(.,'unstored'))">
<xsl:call-template name="infochar2string">
<xsl:with-param name="charList">
<xsl:value-of select="."/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</td>
</tr>
</xsl:template>
<xsl:template name="infochar2string">
<xsl:param name="i">1</xsl:param>
<xsl:param name="charList"/>
<xsl:variable name="char">
<xsl:value-of select="substring($charList,$i,1)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$char='I'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='I']"/> - </xsl:when>
<xsl:when test="$char='T'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='T']"/> - </xsl:when>
<xsl:when test="$char='S'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='S']"/> - </xsl:when>
<xsl:when test="$char='M'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='M']"/> - </xsl:when>
<xsl:when test="$char='V'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='V']"/> - </xsl:when>
<xsl:when test="$char='o'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='o']"/> - </xsl:when>
<xsl:when test="$char='p'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='p']"/> - </xsl:when>
<xsl:when test="$char='O'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='O']"/> - </xsl:when>
<xsl:when test="$char='L'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='L']"/> - </xsl:when>
<xsl:when test="$char='B'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='B']"/> - </xsl:when>
<xsl:when test="$char='C'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='C']"/> - </xsl:when>
<xsl:when test="$char='f'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='f']"/> - </xsl:when>
<xsl:when test="$char='l'">
<xsl:value-of select="/response/lst[@name='info']/lst/str[@name='l']"/> -
</xsl:when>
</xsl:choose>
<xsl:if test="not($i>=string-length($charList))">
<xsl:call-template name="infochar2string">
<xsl:with-param name="i">
<xsl:value-of select="$i+1"/>
</xsl:with-param>
<xsl:with-param name="charList">
<xsl:value-of select="$charList"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="css">
<style type="text/css">
<![CDATA[
td.name {font-style: italic; font-size:80%; }
.doc { margin: 0.5em; border: solid grey 1px; }
.exp { display: none; font-family: monospace; white-space: pre; }
div.histogram { background: none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;}
table.histogram { width: auto; vertical-align: bottom; }
table.histogram td, table.histogram th { text-align: center; vertical-align: bottom; border-bottom: 1px solid #ff9933; width: auto; }
]]>
</style>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,48 +0,0 @@
.ac_results {
padding: 0px;
border: 1px solid black;
background-color: white;
overflow: hidden;
z-index: 99999;
}
.ac_results ul {
width: 100%;
list-style-position: outside;
list-style: none;
padding: 0;
margin: 0;
}
.ac_results li {
margin: 0px;
padding: 2px 5px;
cursor: default;
display: block;
/*
if width will be 100% horizontal scrollbar will apear
when scroll mode will be used
*/
/*width: 100%;*/
font: menu;
font-size: 12px;
/*
it is very important, if line-height not setted or setted
in relative units scroll will be broken in firefox
*/
line-height: 16px;
overflow: hidden;
}
.ac_loading {
background: white url('indicator.gif') right center no-repeat;
}
.ac_odd {
background-color: #eee;
}
.ac_over {
background-color: #0A246A;
color: white;
}

View File

@ -1,759 +0,0 @@
/*
* Autocomplete - jQuery plugin 1.0.2
*
* Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $
*
*/
;(function($) {
$.fn.extend({
autocomplete: function(urlOrData, options) {
var isUrl = typeof urlOrData == "string";
options = $.extend({}, $.Autocompleter.defaults, {
url: isUrl ? urlOrData : null,
data: isUrl ? null : urlOrData,
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
max: options && !options.scroll ? 10 : 150
}, options);
// if highlight is set to false, replace it with a do-nothing function
options.highlight = options.highlight || function(value) { return value; };
// if the formatMatch option is not specified, then use formatItem for backwards compatibility
options.formatMatch = options.formatMatch || options.formatItem;
return this.each(function() {
new $.Autocompleter(this, options);
});
},
result: function(handler) {
return this.bind("result", handler);
},
search: function(handler) {
return this.trigger("search", [handler]);
},
flushCache: function() {
return this.trigger("flushCache");
},
setOptions: function(options){
return this.trigger("setOptions", [options]);
},
unautocomplete: function() {
return this.trigger("unautocomplete");
}
});
$.Autocompleter = function(input, options) {
var KEY = {
UP: 38,
DOWN: 40,
DEL: 46,
TAB: 9,
RETURN: 13,
ESC: 27,
COMMA: 188,
PAGEUP: 33,
PAGEDOWN: 34,
BACKSPACE: 8
};
// Create $ object for input element
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
var timeout;
var previousValue = "";
var cache = $.Autocompleter.Cache(options);
var hasFocus = 0;
var lastKeyPressCode;
var config = {
mouseDownOnSelect: false
};
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
var blockSubmit;
// prevent form submit in opera when selecting with return key
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
if (blockSubmit) {
blockSubmit = false;
return false;
}
});
// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
// track last key pressed
lastKeyPressCode = event.keyCode;
switch(event.keyCode) {
case KEY.UP:
event.preventDefault();
if ( select.visible() ) {
select.prev();
} else {
onChange(0, true);
}
break;
case KEY.DOWN:
event.preventDefault();
if ( select.visible() ) {
select.next();
} else {
onChange(0, true);
}
break;
case KEY.PAGEUP:
event.preventDefault();
if ( select.visible() ) {
select.pageUp();
} else {
onChange(0, true);
}
break;
case KEY.PAGEDOWN:
event.preventDefault();
if ( select.visible() ) {
select.pageDown();
} else {
onChange(0, true);
}
break;
// matches also semicolon
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
case KEY.TAB:
case KEY.RETURN:
if( selectCurrent() ) {
// stop default to prevent a form submit, Opera needs special handling
event.preventDefault();
blockSubmit = true;
return false;
}
break;
case KEY.ESC:
select.hide();
break;
default:
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay);
break;
}
}).focus(function(){
// track whether the field has focus, we shouldn't process any
// results if the field no longer has focus
hasFocus++;
}).blur(function() {
hasFocus = 0;
if (!config.mouseDownOnSelect) {
hideResults();
}
}).click(function() {
// show select when clicking in a focused field
if ( hasFocus++ > 1 && !select.visible() ) {
onChange(0, true);
}
}).bind("search", function() {
// TODO why not just specifying both arguments?
var fn = (arguments.length > 1) ? arguments[1] : null;
function findValueCallback(q, data) {
var result;
if( data && data.length ) {
for (var i=0; i < data.length; i++) {
if( data[i].result.toLowerCase() == q.toLowerCase() ) {
result = data[i];
break;
}
}
}
if( typeof fn == "function" ) fn(result);
else $input.trigger("result", result && [result.data, result.value]);
}
$.each(trimWords($input.val()), function(i, value) {
request(value, findValueCallback, findValueCallback);
});
}).bind("flushCache", function() {
cache.flush();
}).bind("setOptions", function() {
$.extend(options, arguments[1]);
// if we've updated the data, repopulate
if ( "data" in arguments[1] )
cache.populate();
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
});
function selectCurrent() {
var selected = select.selected();
if( !selected )
return false;
var v = selected.result;
previousValue = v;
if ( options.multiple ) {
var words = trimWords($input.val());
if ( words.length > 1 ) {
v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
}
v += options.multipleSeparator;
}
$input.val(v);
hideResultsNow();
$input.trigger("result", [selected.data, selected.value]);
return true;
}
function onChange(crap, skipPrevCheck) {
if( lastKeyPressCode == KEY.DEL ) {
select.hide();
return;
}
var currentValue = $input.val();
if ( !skipPrevCheck && currentValue == previousValue )
return;
previousValue = currentValue;
currentValue = lastWord(currentValue);
if ( currentValue.length >= options.minChars) {
$input.addClass(options.loadingClass);
if (!options.matchCase)
currentValue = currentValue.toLowerCase();
request(currentValue, receiveData, hideResultsNow);
} else {
stopLoading();
select.hide();
}
};
function trimWords(value) {
if ( !value ) {
return [""];
}
var words = value.split( options.multipleSeparator );
var result = [];
$.each(words, function(i, value) {
if ( $.trim(value) )
result[i] = $.trim(value);
});
return result;
}
function lastWord(value) {
if ( !options.multiple )
return value;
var words = trimWords(value);
return words[words.length - 1];
}
// fills in the input box w/the first match (assumed to be the best match)
// q: the term entered
// sValue: the first matching result
function autoFill(q, sValue){
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
// if the last user key pressed was backspace, don't autofill
if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
// fill in the value (keep the case the user has typed)
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
// select the portion of the value not typed by the user (so the next character will erase)
$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
}
};
function hideResults() {
clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
};
function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
clearTimeout(timeout);
stopLoading();
if (options.mustMatch) {
// call search and run callback
$input.search(
function (result){
// if no value found, clear the input box
if( !result ) {
if (options.multiple) {
var words = trimWords($input.val()).slice(0, -1);
$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
}
else
$input.val( "" );
}
}
);
}
if (wasVisible)
// position cursor at end of input field
$.Autocompleter.Selection(input, input.value.length, input.value.length);
};
function receiveData(q, data) {
if ( data && data.length && hasFocus ) {
stopLoading();
select.display(data, q);
autoFill(q, data[0].value);
select.show();
} else {
hideResultsNow();
}
};
function request(term, success, failure) {
if (!options.matchCase)
term = term.toLowerCase();
var data = cache.load(term);
// recieve the cached data
if (data && data.length) {
success(term, data);
// if an AJAX url has been supplied, try loading the data now
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
var extraParams = {
timestamp: +new Date()
};
$.each(options.extraParams, function(key, param) {
extraParams[key] = typeof param == "function" ? param() : param;
});
$.ajax({
// try to leverage ajaxQueue plugin to abort previous requests
mode: "abort",
// limit abortion to this input
port: "autocomplete" + input.name,
dataType: options.dataType,
url: options.url,
data: $.extend({
q: lastWord(term),
limit: options.max
}, extraParams),
success: function(data) {
var parsed = options.parse && options.parse(data) || parse(data);
cache.add(term, parsed);
success(term, parsed);
}
});
} else {
// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
select.emptyList();
failure(term);
}
};
function parse(data) {
var parsed = [];
var rows = data.split("\n");
for (var i=0; i < rows.length; i++) {
var row = $.trim(rows[i]);
if (row) {
row = row.split("|");
parsed[parsed.length] = {
data: row,
value: row[0],
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
};
}
}
return parsed;
};
function stopLoading() {
$input.removeClass(options.loadingClass);
};
};
$.Autocompleter.defaults = {
inputClass: "ac_input",
resultsClass: "ac_results",
loadingClass: "ac_loading",
minChars: 1,
delay: 400,
matchCase: false,
matchSubset: true,
matchContains: false,
cacheLength: 10,
max: 100,
mustMatch: false,
extraParams: {},
selectFirst: true,
formatItem: function(row) { return row[0]; },
formatMatch: null,
autoFill: false,
width: 0,
multiple: false,
multipleSeparator: ", ",
highlight: function(value, term) {
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
},
scroll: true,
scrollHeight: 180
};
$.Autocompleter.Cache = function(options) {
var data = {};
var length = 0;
function matchSubset(s, sub) {
if (!options.matchCase)
s = s.toLowerCase();
var i = s.indexOf(sub);
if (i == -1) return false;
return i == 0 || options.matchContains;
};
function add(q, value) {
if (length > options.cacheLength){
flush();
}
if (!data[q]){
length++;
}
data[q] = value;
}
function populate(){
if( !options.data ) return false;
// track the matches
var stMatchSets = {},
nullData = 0;
// no url was specified, we need to adjust the cache length to make sure it fits the local data store
if( !options.url ) options.cacheLength = 1;
// track all options for minChars = 0
stMatchSets[""] = [];
// loop through the array and create a lookup structure
for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
var rawValue = options.data[i];
// if rawValue is a string, make an array otherwise just reference the array
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
var value = options.formatMatch(rawValue, i+1, options.data.length);
if ( value === false )
continue;
var firstChar = value.charAt(0).toLowerCase();
// if no lookup array for this character exists, look it up now
if( !stMatchSets[firstChar] )
stMatchSets[firstChar] = [];
// if the match is a string
var row = {
value: value,
data: rawValue,
result: options.formatResult && options.formatResult(rawValue) || value
};
// push the current match into the set list
stMatchSets[firstChar].push(row);
// keep track of minChars zero items
if ( nullData++ < options.max ) {
stMatchSets[""].push(row);
}
};
// add the data items to the cache
$.each(stMatchSets, function(i, value) {
// increase the cache size
options.cacheLength++;
// add to the cache
add(i, value);
});
}
// populate any existing data
setTimeout(populate, 25);
function flush(){
data = {};
length = 0;
}
return {
flush: flush,
add: add,
populate: populate,
load: function(q) {
if (!options.cacheLength || !length)
return null;
/*
* if dealing w/local data and matchContains than we must make sure
* to loop through all the data collections looking for matches
*/
if( !options.url && options.matchContains ){
// track all matches
var csub = [];
// loop through all the data grids for matches
for( var k in data ){
// don't search through the stMatchSets[""] (minChars: 0) cache
// this prevents duplicates
if( k.length > 0 ){
var c = data[k];
$.each(c, function(i, x) {
// if we've got a match, add it to the array
if (matchSubset(x.value, q)) {
csub.push(x);
}
});
}
}
return csub;
} else
// if the exact item exists, use it
if (data[q]){
return data[q];
} else
if (options.matchSubset) {
for (var i = q.length - 1; i >= options.minChars; i--) {
var c = data[q.substr(0, i)];
if (c) {
var csub = [];
$.each(c, function(i, x) {
if (matchSubset(x.value, q)) {
csub[csub.length] = x;
}
});
return csub;
}
}
}
return null;
}
};
};
$.Autocompleter.Select = function (options, input, select, config) {
var CLASSES = {
ACTIVE: "ac_over"
};
var listItems,
active = -1,
data,
term = "",
needsInit = true,
element,
list;
// Create results
function init() {
if (!needsInit)
return;
element = $("<div/>")
.hide()
.addClass(options.resultsClass)
.css("position", "absolute")
.appendTo(document.body);
list = $("<ul/>").appendTo(element).mouseover( function(event) {
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
$(target(event)).addClass(CLASSES.ACTIVE);
}
}).click(function(event) {
$(target(event)).addClass(CLASSES.ACTIVE);
select();
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
input.focus();
return false;
}).mousedown(function() {
config.mouseDownOnSelect = true;
}).mouseup(function() {
config.mouseDownOnSelect = false;
});
if( options.width > 0 )
element.css("width", options.width);
needsInit = false;
}
function target(event) {
var element = event.target;
while(element && element.tagName != "LI")
element = element.parentNode;
// more fun with IE, sometimes event.target is empty, just ignore it then
if(!element)
return [];
return element;
}
function moveSelect(step) {
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
movePosition(step);
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
if(options.scroll) {
var offset = 0;
listItems.slice(0, active).each(function() {
offset += this.offsetHeight;
});
if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
} else if(offset < list.scrollTop()) {
list.scrollTop(offset);
}
}
};
function movePosition(step) {
active += step;
if (active < 0) {
active = listItems.size() - 1;
} else if (active >= listItems.size()) {
active = 0;
}
}
function limitNumberOfItems(available) {
return options.max && options.max < available
? options.max
: available;
}
function fillList() {
list.empty();
var max = limitNumberOfItems(data.length);
for (var i=0; i < max; i++) {
if (!data[i])
continue;
var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
if ( formatted === false )
continue;
var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
$.data(li, "ac_data", data[i]);
}
listItems = list.find("li");
if ( options.selectFirst ) {
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
active = 0;
}
// apply bgiframe if available
if ( $.fn.bgiframe )
list.bgiframe();
}
return {
display: function(d, q) {
init();
data = d;
term = q;
fillList();
},
next: function() {
moveSelect(1);
},
prev: function() {
moveSelect(-1);
},
pageUp: function() {
if (active != 0 && active - 8 < 0) {
moveSelect( -active );
} else {
moveSelect(-8);
}
},
pageDown: function() {
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
moveSelect( listItems.size() - 1 - active );
} else {
moveSelect(8);
}
},
hide: function() {
element && element.hide();
listItems && listItems.removeClass(CLASSES.ACTIVE);
active = -1;
},
visible : function() {
return element && element.is(":visible");
},
current: function() {
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
},
show: function() {
var offset = $(input).offset();
element.css({
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
top: offset.top + input.offsetHeight,
left: offset.left
}).show();
if(options.scroll) {
list.scrollTop(0);
list.css({
maxHeight: options.scrollHeight,
overflow: 'auto'
});
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
var listHeight = 0;
listItems.each(function() {
listHeight += this.offsetHeight;
});
var scrollbarsVisible = listHeight > options.scrollHeight;
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
if (!scrollbarsVisible) {
// IE doesn't recalculate width when scrollbar disappears
listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
}
}
}
},
selected: function() {
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
return selected && selected.length && $.data(selected[0], "ac_data");
},
emptyList: function (){
list && list.empty();
},
unbind: function() {
element && element.remove();
}
};
};
$.Autocompleter.Selection = function(field, start, end) {
if( field.createTextRange ){
var selRange = field.createTextRange();
selRange.collapse(true);
selRange.moveStart("character", start);
selRange.moveEnd("character", end);
selRange.select();
} else if( field.setSelectionRange ){
field.setSelectionRange(start, end);
} else {
if( field.selectionStart ){
field.selectionStart = start;
field.selectionEnd = end;
}
}
field.focus();
};
})(jQuery);

View File

@ -1,216 +0,0 @@
/* Main Style Sheet for jQuery UI date picker */
#ui-datepicker-div, .ui-datepicker-inline {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
padding: 0;
margin: 0;
background: #ddd;
width: 185px;
}
#ui-datepicker-div {
display: none;
border: 1px solid #777;
z-index: 100; /*must have*/
}
.ui-datepicker-inline {
float: left;
display: block;
border: 0;
}
.ui-datepicker-rtl {
direction: rtl;
}
.ui-datepicker-dialog {
padding: 5px !important;
border: 4px ridge #ddd !important;
}
.ui-datepicker-disabled {
position: absolute;
z-index: 100;
background-color: white;
opacity: 0.5;
}
button.ui-datepicker-trigger {
width: 25px;
}
img.ui-datepicker-trigger {
margin: 2px;
vertical-align: middle;
}
.ui-datepicker-prompt {
float: left;
padding: 2px;
background: #ddd;
color: #000;
}
* html .ui-datepicker-prompt {
width: 185px;
}
.ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {
clear: both;
float: left;
width: 100%;
color: #fff;
}
.ui-datepicker-control {
background: #400;
padding: 2px 0px;
}
.ui-datepicker-links {
background: #000;
padding: 2px 0px;
}
.ui-datepicker-control, .ui-datepicker-links {
font-weight: bold;
font-size: 80%;
}
.ui-datepicker-links label { /* disabled links */
padding: 2px 5px;
color: #888;
}
.ui-datepicker-clear, .ui-datepicker-prev {
float: left;
width: 34%;
}
.ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {
float: right;
text-align: right;
}
.ui-datepicker-current {
float: left;
width: 30%;
text-align: center;
}
.ui-datepicker-close, .ui-datepicker-next {
float: right;
width: 34%;
text-align: right;
}
.ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {
float: left;
text-align: left;
}
.ui-datepicker-header {
padding: 1px 0 3px;
background: #333;
text-align: center;
font-weight: bold;
height: 1.3em;
}
.ui-datepicker-header select {
background: #333;
color: #fff;
border: 0px;
font-weight: bold;
}
.ui-datepicker {
background: #ccc;
text-align: center;
font-size: 100%;
}
.ui-datepicker a {
display: block;
width: 100%;
}
.ui-datepicker-title-row {
background: #777;
}
.ui-datepicker-days-row {
background: #eee;
color: #666;
}
.ui-datepicker-week-col {
background: #777;
color: #fff;
}
.ui-datepicker-days-cell {
color: #000;
height:40px;
width:50px;
vertical-align:top;
border: 1px solid #ddd;
}
.ui-datepicker-days-cell a{
display: block;
}
.ui-datepicker-week-end-cell {
background: #ddd;
}
.ui-datepicker-title-row .ui-datepicker-week-end-cell {
background: #777;
}
.ui-datepicker-days-cell-over {
background: #fff;
border: 1px solid #777;
}
.ui-datepicker-unselectable {
color: #888;
}
.ui-datepicker-today {
background: #fcc !important;
}
.ui-datepicker-current-day {
background: #999 !important;
}
.ui-datepicker-status {
background: #ddd;
width: 100%;
font-size: 80%;
text-align: center;
}
/* ________ Datepicker Links _______
** Reset link properties and then override them with !important */
#ui-datepicker-div a, .ui-datepicker-inline a {
cursor: pointer;
margin: 0;
padding: 0;
background: none;
color: #000;
}
.ui-datepicker-inline .ui-datepicker-links a {
padding: 0 5px !important;
}
.ui-datepicker-control a, .ui-datepicker-links a {
padding: 2px 5px !important;
color: #eee !important;
}
.ui-datepicker-title-row a {
color: #eee !important;
}
.ui-datepicker-control a:hover {
background: #fdd !important;
color: #333 !important;
}
.ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {
background: #ddd !important;
color: #333 !important;
}
/* ___________ MULTIPLE MONTHS _________*/
.ui-datepicker-multi .ui-datepicker {
border: 1px solid #777;
}
.ui-datepicker-one-month {
float: left;
width: 185px;
}
.ui-datepicker-new-row {
clear: left;
}
/* ___________ IE6 IFRAME FIX ________ */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}

View File

@ -1,195 +0,0 @@
;(function($){$.ui={plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}
var tmp=$('<div class="ui-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css('cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}
return $.ui.cssCache[name];},disableSelection:function(el){$(el).attr('unselectable','on').css('MozUserSelect','none');},enableSelection:function(el){$(el).attr('unselectable','off').css('MozUserSelect','');},hasScroll:function(e,a){var scroll=/top/.test(a||"top")?'scrollTop':'scrollLeft',has=false;if(e[scroll]>0)return true;e[scroll]=1;has=e[scroll]>0?true:false;e[scroll]=0;return has;}};var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).triggerHandler("remove");return _remove.apply(this,arguments);};function getter(namespace,plugin,method){var methods=$[namespace][plugin].getter||[];methods=(typeof methods=="string"?methods.split(/,?\s+/):methods);return($.inArray(method,methods)!=-1);}
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&getter(namespace,name,options)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}
return this.each(function(){var instance=$.data(this,name);if(isMethodCall&&instance&&$.isFunction(instance[options])){instance[options].apply(instance,args);}else if(!isMethodCall){$.data(this,name,new $[namespace][name](this,options));}});};$[namespace][name]=function(element,options){var self=this;this.widgetName=name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,options);this.element=$(element).bind('setData.'+name,function(e,key,value){return self.setData(key,value);}).bind('getData.'+name,function(e,key){return self.getData(key);}).bind('remove',function(){return self.destroy();});this.init();};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);};$.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName);},getData:function(key){return this.options[key];},setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled');}},enable:function(){this.setData('disabled',false);},disable:function(){this.setData('disabled',true);}};$.widget.defaults={disabled:false};$.ui.mouse={mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(e){return self.mouseDown(e);});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}
this.started=false;},mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},mouseDown:function(e){(this._mouseStarted&&this.mouseUp(e));this._mouseDownEvent=e;var self=this,btnIsLeft=(e.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(e.target).parents().add(e.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this.mouseCapture(e)){return true;}
this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self._mouseDelayMet=true;},this.options.delay);}
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true;}}
this._mouseMoveDelegate=function(e){return self.mouseMove(e);};this._mouseUpDelegate=function(e){return self.mouseUp(e);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);return false;},mouseMove:function(e){if($.browser.msie&&!e.button){return this.mouseUp(e);}
if(this._mouseStarted){this.mouseDrag(e);return false;}
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,e)!==false);(this._mouseStarted?this.mouseDrag(e):this.mouseUp(e));}
return!this._mouseStarted;},mouseUp:function(e){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(e);}
return false;},mouseDistanceMet:function(e){return(Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance);},mouseDelayMet:function(e){return this._mouseDelayMet;},mouseStart:function(e){},mouseDrag:function(e){},mouseStop:function(e){},mouseCapture:function(e){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){var PROP_NAME='datepicker';function Datepicker(){this.debug=false;this._curInst=null;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId='ui-datepicker-div';this._appendClass='ui-datepicker-append';this._triggerClass='ui-datepicker-trigger';this._dialogClass='ui-datepicker-dialog';this._promptClass='ui-datepicker-prompt';this._unselectableClass='ui-datepicker-unselectable';this._currentClass='ui-datepicker-current-day';this.regional=[];this.regional['']={clearText:'Clear',clearStatus:'Erase the current date',closeText:'Close',closeStatus:'Close without change',prevText:'&#x3c;Prev',prevStatus:'Show the previous month',nextText:'Next&#x3e;',nextStatus:'Show the next month',currentText:'Today',currentStatus:'Show the current month',monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],monthNamesShort:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],monthStatus:'Show a different month',yearStatus:'Show a different year',weekHeader:'Wk',weekStatus:'Week of the year',dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Mo','Tu','We','Th','Fr','Sa'],dayStatus:'Set DD as first week day',dateStatus:'Select DD, M d',dateFormat:'mm/dd/yy',firstDay:0,initStatus:'Select a date',isRTL:false};this._defaults={showOn:'focus',showAnim:'show',showOptions:{},defaultDate:null,appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:false,closeAtTop:true,mandatory:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:true,changeYear:true,yearRange:'-10:+10',changeFirstDay:true,highlightWeek:false,showOtherMonths:false,showWeeks:false,calculateWeek:this.iso8601Week,shortYearCutoff:'+10',showStatus:false,statusForDate:this.dateStatus,minDate:null,maxDate:null,duration:'normal',beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,stepMonths:1,rangeSelect:false,rangeSeparator:' - ',altField:'',altFormat:''};$.extend(this._defaults,this.regional['']);this.dpDiv=$('<div id="'+this._mainDivId+'" style="display: none;"></div>');}
$.extend(Datepicker.prototype,{markerClassName:'hasDatepicker',log:function(){if(this.debug)
console.log.apply('',arguments);},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this;},_attachDatepicker:function(target,settings){var inlineSettings=null;for(attrName in this._defaults){var attrValue=target.getAttribute('date:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}catch(err){inlineSettings[attrName]=attrValue;}}}
var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=='div'||nodeName=='span');if(!target.id)
target.id='dp'+new Date().getTime();var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=='input'){this._connectDatepicker(target,inst);}else if(inline){this._inlineDatepicker(target,inst);}},_newInst:function(target,inline){return{id:target[0].id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="ui-datepicker-inline"></div>'))};},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName))
return;var appendText=this._get(inst,'appendText');var isRTL=this._get(inst,'isRTL');if(appendText)
input[isRTL?'before':'after']('<span class="'+this._appendClass+'">'+appendText+'</span>');var showOn=this._get(inst,'showOn');if(showOn=='focus'||showOn=='both')
input.focus(this._showDatepicker);if(showOn=='button'||showOn=='both'){var buttonText=this._get(inst,'buttonText');var buttonImage=this._get(inst,'buttonImage');var trigger=$(this._get(inst,'buttonImageOnly')?$('<img/>').addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==''?buttonText:$('<img/>').attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?'before':'after'](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target)
$.datepicker._hideDatepicker();else
$.datepicker._showDatepicker(target);return false;});}
input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);},_inlineDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName))
return;input.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);},_inlineShow:function(inst){var numMonths=this._getNumberOfMonths(inst);inst.dpDiv.width(numMonths[1]*$('.ui-datepicker',inst.dpDiv[0]).width());},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id='dp'+new Date().getTime();this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$('body').append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst);}
extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY];}
this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI)
$.blockUI(this.dpDiv);$.data(this._dialogInput[0],PROP_NAME,inst);return this;},_destroyDatepicker:function(target){var nodeName=target.nodeName.toLowerCase();var $target=$(target);$.removeData(target,PROP_NAME);if(nodeName=='input'){$target.siblings('.'+this._appendClass).remove().end().siblings('.'+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind('focus',this._showDatepicker).unbind('keydown',this._doKeyDown).unbind('keypress',this._doKeyPress);}else if(nodeName=='div'||nodeName=='span')
$target.removeClass(this.markerClassName).empty();},_enableDatepicker:function(target){target.disabled=false;$(target).siblings('button.'+this._triggerClass).each(function(){this.disabled=false;}).end().siblings('img.'+this._triggerClass).css({opacity:'1.0',cursor:''});this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});},_disableDatepicker:function(target){target.disabled=true;$(target).siblings('button.'+this._triggerClass).each(function(){this.disabled=true;}).end().siblings('img.'+this._triggerClass).css({opacity:'0.5',cursor:'default'});this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});this._disabledInputs[this._disabledInputs.length]=target;},_isDisabledDatepicker:function(target){if(!target)
return false;for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target)
return true;}
return false;},_changeDatepicker:function(target,name,value){var settings=name||{};if(typeof name=='string'){settings={};settings[name]=value;}
if(inst=$.data(target,PROP_NAME)){extendRemove(inst.settings,settings);this._updateDatepicker(inst);}},_setDateDatepicker:function(target,date,endDate){var inst=$.data(target,PROP_NAME);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);}},_getDateDatepicker:function(target){var inst=$.data(target,PROP_NAME);if(inst)
this._setDateFromField(inst);return(inst?this._getDate(inst):null);},_doKeyDown:function(e){var inst=$.data(e.target,PROP_NAME);var handled=true;if($.datepicker._datepickerShowing)
switch(e.keyCode){case 9:$.datepicker._hideDatepicker(null,'');break;case 13:$.datepicker._selectDay(e.target,inst.selectedMonth,inst.selectedYear,$('td.ui-datepicker-days-cell-over',inst.dpDiv)[0]);return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,'duration'));break;case 33:$.datepicker._adjustDate(e.target,(e.ctrlKey?-1:-$.datepicker._get(inst,'stepMonths')),(e.ctrlKey?'Y':'M'));break;case 34:$.datepicker._adjustDate(e.target,(e.ctrlKey?+1:+$.datepicker._get(inst,'stepMonths')),(e.ctrlKey?'Y':'M'));break;case 35:if(e.ctrlKey)$.datepicker._clearDate(e.target);break;case 36:if(e.ctrlKey)$.datepicker._gotoToday(e.target);break;case 37:if(e.ctrlKey)$.datepicker._adjustDate(e.target,-1,'D');break;case 38:if(e.ctrlKey)$.datepicker._adjustDate(e.target,-7,'D');break;case 39:if(e.ctrlKey)$.datepicker._adjustDate(e.target,+1,'D');break;case 40:if(e.ctrlKey)$.datepicker._adjustDate(e.target,+7,'D');break;default:handled=false;}
else if(e.keyCode==36&&e.ctrlKey)
$.datepicker._showDatepicker(this);else
handled=false;if(handled){e.preventDefault();e.stopPropagation();}},_doKeyPress:function(e){var inst=$.data(e.target,PROP_NAME);var chars=$.datepicker._possibleChars($.datepicker._get(inst,'dateFormat'));var chr=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return e.ctrlKey||(chr<' '||!chars||chars.indexOf(chr)>-1);},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!='input')
input=$('input',input.parentNode)[0];if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input)
return;var inst=$.data(input,PROP_NAME);var beforeShow=$.datepicker._get(inst,'beforeShow');extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,'');$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog)
input.value='';if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;}
var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css('position')=='fixed';return!isFixed;});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop;}
var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:'absolute',display:'block',top:'-1000px'});$.datepicker._updateDatepicker(inst);inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1]*$('.ui-datepicker',inst.dpDiv[0])[0].offsetWidth);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?'static':(isFixed?'fixed':'absolute')),display:'none',left:offset.left+'px',top:offset.top+'px'});if(!inst.inline){var showAnim=$.datepicker._get(inst,'showAnim')||'show';var duration=$.datepicker._get(inst,'duration');var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version)<7)
$('iframe.ui-datepicker-cover').css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4});};if($.effects&&$.effects[showAnim])
inst.dpDiv.show(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else
inst.dpDiv[showAnim](duration,postProcess);if(duration=='')
postProcess();if(inst.input[0].type!='hidden')
inst.input[0].focus();$.datepicker._curInst=inst;}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};inst.dpDiv.empty().append(this._generateDatepicker(inst)).find('iframe.ui-datepicker-cover').css({width:dims.width,height:dims.height});var numMonths=this._getNumberOfMonths(inst);inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?'add':'remove')+'Class']('ui-datepicker-multi');inst.dpDiv[(this._get(inst,'isRTL')?'add':'remove')+'Class']('ui-datepicker-rtl');if(inst.input&&inst.input[0].type!='hidden')
$(inst.input[0]).focus();},_checkOffset:function(inst,offset,isFixed){var pos=inst.input?this._findPos(inst.input[0]):null;var browserWidth=window.innerWidth||document.documentElement.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;if(this._get(inst,'isRTL')||(offset.left+inst.dpDiv.width()-scrollX)>browserWidth)
offset.left=Math.max((isFixed?0:scrollX),pos[0]+(inst.input?inst.input.width():0)-(isFixed?scrollX:0)-inst.dpDiv.width()-
(isFixed&&$.browser.opera?document.documentElement.scrollLeft:0));else
offset.left-=(isFixed?scrollX:0);if((offset.top+inst.dpDiv.height()-scrollY)>browserHeight)
offset.top=Math.max((isFixed?0:scrollY),pos[1]-(isFixed?scrollY:0)-(this._inDialog?0:inst.dpDiv.height())-
(isFixed&&$.browser.opera?document.documentElement.scrollTop:0));else
offset.top-=(isFixed?scrollY:0);return offset;},_findPos:function(obj){while(obj&&(obj.type=='hidden'||obj.nodeType!=1)){obj=obj.nextSibling;}
var position=$(obj).offset();return[position.left,position.top];},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst)
return;var rangeSelect=this._get(inst,'rangeSelect');if(rangeSelect&&this._stayOpen)
this._selectDate('#'+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));this._stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,'duration'));var showAnim=this._get(inst,'showAnim');var postProcess=function(){$.datepicker._tidyDialog(inst);};if(duration!=''&&$.effects&&$.effects[showAnim])
inst.dpDiv.hide(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else
inst.dpDiv[(duration==''?'hide':(showAnim=='slideDown'?'slideUp':(showAnim=='fadeIn'?'fadeOut':'hide')))](duration,postProcess);if(duration=='')
this._tidyDialog(inst);var onClose=this._get(inst,'onClose');if(onClose)
onClose.apply((inst.input?inst.input[0]:null),[this._getDate(inst),inst]);this._datepickerShowing=false;this._lastInput=null;inst.settings.prompt=null;if(this._inDialog){this._dialogInput.css({position:'absolute',left:'0',top:'-100px'});if($.blockUI){$.unblockUI();$('body').append(this.dpDiv);}}
this._inDialog=false;}
this._curInst=null;},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker');$('.'+this._promptClass,inst.dpDiv).remove();},_checkExternalClick:function(event){if(!$.datepicker._curInst)
return;var $target=$(event.target);if(($target.parents('#'+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI))
$.datepicker._hideDatepicker(null,'');},_adjustDate:function(id,offset,period){var target=$(id);var inst=$.data(target[0],PROP_NAME);this._adjustInstDate(inst,offset,period);this._updateDatepicker(inst);},_gotoToday:function(id){var target=$(id);var inst=$.data(target[0],PROP_NAME);if(this._get(inst,'gotoCurrent')&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear;}
else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();}
this._adjustDate(target);this._notifyChange(inst);},_selectMonthYear:function(id,select,period){var target=$(id);var inst=$.data(target[0],PROP_NAME);inst._selectingMonthYear=false;inst[period=='M'?'drawMonth':'drawYear']=select.options[select.selectedIndex].value-0;this._adjustDate(target);this._notifyChange(inst);},_clickMonthYear:function(id){var target=$(id);var inst=$.data(target[0],PROP_NAME);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie)
inst.input[0].focus();inst._selectingMonthYear=!inst._selectingMonthYear;},_changeFirstDay:function(id,day){var target=$(id);var inst=$.data(target[0],PROP_NAME);inst.settings.firstDay=day;this._updateDatepicker(inst);},_selectDay:function(id,month,year,td){if($(td).hasClass(this._unselectableClass))
return;var target=$(id);var inst=$.data(target[0],PROP_NAME);var rangeSelect=this._get(inst,'rangeSelect');if(rangeSelect){this._stayOpen=!this._stayOpen;if(this._stayOpen){$('.ui-datepicker td').removeClass(this._currentClass);$(td).addClass(this._currentClass);}}
inst.selectedDay=inst.currentDay=$('a',td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(this._stayOpen){inst.endDay=inst.endMonth=inst.endYear=null;}
else if(rangeSelect){inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear;}
this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(this._stayOpen){inst.rangeStart=new Date(inst.currentYear,inst.currentMonth,inst.currentDay);this._updateDatepicker(inst);}
else if(rangeSelect){inst.selectedDay=inst.currentDay=inst.rangeStart.getDate();inst.selectedMonth=inst.currentMonth=inst.rangeStart.getMonth();inst.selectedYear=inst.currentYear=inst.rangeStart.getFullYear();inst.rangeStart=null;if(inst.inline)
this._updateDatepicker(inst);}},_clearDate:function(id){var target=$(id);var inst=$.data(target[0],PROP_NAME);if(this._get(inst,'mandatory'))
return;this._stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,'');},_selectDate:function(id,dateStr){var target=$(id);var inst=$.data(target[0],PROP_NAME);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(this._get(inst,'rangeSelect')&&dateStr)
dateStr=(inst.rangeStart?this._formatDate(inst,inst.rangeStart):dateStr)+this._get(inst,'rangeSeparator')+dateStr;if(inst.input)
inst.input.val(dateStr);this._updateAlternate(inst);var onSelect=this._get(inst,'onSelect');if(onSelect)
onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);else if(inst.input)
inst.input.trigger('change');if(inst.inline)
this._updateDatepicker(inst);else if(!this._stayOpen){this._hideDatepicker(null,this._get(inst,'duration'));this._lastInput=inst.input[0];if(typeof(inst.input[0])!='object')
inst.input[0].focus();this._lastInput=null;}},_updateAlternate:function(inst){var altField=this._get(inst,'altField');if(altField){var altFormat=this._get(inst,'altFormat');var date=this._getDate(inst);dateStr=(isArray(date)?(!date[0]&&!date[1]?'':this.formatDate(altFormat,date[0],this._getFormatConfig(inst))+
this._get(inst,'rangeSeparator')+this.formatDate(altFormat,date[1]||date[0],this._getFormatConfig(inst))):this.formatDate(altFormat,date,this._getFormatConfig(inst)));$(altField).each(function(){$(this).val(dateStr);});}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),''];},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate(),(date.getTimezoneOffset()/-60));var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate);}else if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){checkDate.setDate(checkDate.getDate()+3);return $.datepicker.iso8601Week(checkDate);}}
return Math.floor(((checkDate-firstMon)/86400000)/7)+1;},dateStatus:function(date,inst){return $.datepicker.formatDate($.datepicker._get(inst,'dateStatus'),date,$.datepicker._getFormatConfig(inst));},parseDate:function(format,value,settings){if(format==null||value==null)
throw'Invalid arguments';value=(typeof value=='object'?value.toString():value+'');if(value=='')
return null;var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches)
iFormat++;return matches;};var getNumber=function(match){lookAhead(match);var origSize=(match=='@'?14:(match=='y'?4:2));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>='0'&&value.charAt(iValue)<='9'){num=num*10+(value.charAt(iValue++)-0);size--;}
if(size==origSize)
throw'Missing number at position '+iValue;return num;};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++)
size=Math.max(size,names[j].length);var name='';var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++)
if(name==names[i])
return i+1;size--;}
throw'Unknown name at position '+iInit;};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat))
throw'Unexpected literal at position '+iValue;iValue++;};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal)
if(format.charAt(iFormat)=="'"&&!lookAhead("'"))
literal=false;else
checkLiteral();else
switch(format.charAt(iFormat)){case'd':day=getNumber('d');break;case'D':getName('D',dayNamesShort,dayNames);break;case'm':month=getNumber('m');break;case'M':month=getName('M',monthNamesShort,monthNames);break;case'y':year=getNumber('y');break;case'@':var date=new Date(getNumber('@'));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'"))
checkLiteral();else
literal=true;break;default:checkLiteral();}}
if(year<100)
year+=new Date().getFullYear()-new Date().getFullYear()%100+
(year<=shortYearCutoff?0:-100);var date=new Date(year,month-1,day);if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day)
throw'Invalid date';return date;},ATOM:'yy-mm-dd',COOKIE:'D, dd M yy',ISO_8601:'yy-mm-dd',RFC_822:'D, d M y',RFC_850:'DD, dd-M-y',RFC_1036:'D, d M y',RFC_1123:'D, d M yy',RFC_2822:'D, d M yy',RSS:'D, d M y',TIMESTAMP:'@',W3C:'yy-mm-dd',formatDate:function(format,date,settings){if(!date)
return'';var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches)
iFormat++;return matches;};var formatNumber=function(match,value){return(lookAhead(match)&&value<10?'0':'')+value;};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value]);};var output='';var literal=false;if(date)
for(var iFormat=0;iFormat<format.length;iFormat++){if(literal)
if(format.charAt(iFormat)=="'"&&!lookAhead("'"))
literal=false;else
output+=format.charAt(iFormat);else
switch(format.charAt(iFormat)){case'd':output+=formatNumber('d',date.getDate());break;case'D':output+=formatName('D',date.getDay(),dayNamesShort,dayNames);break;case'm':output+=formatNumber('m',date.getMonth()+1);break;case'M':output+=formatName('M',date.getMonth(),monthNamesShort,monthNames);break;case'y':output+=(lookAhead('y')?date.getFullYear():(date.getYear()%100<10?'0':'')+date.getYear()%100);break;case'@':output+=date.getTime();break;case"'":if(lookAhead("'"))
output+="'";else
literal=true;break;default:output+=format.charAt(iFormat);}}
return output;},_possibleChars:function(format){var chars='';var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++)
if(literal)
if(format.charAt(iFormat)=="'"&&!lookAhead("'"))
literal=false;else
chars+=format.charAt(iFormat);else
switch(format.charAt(iFormat)){case'd':case'm':case'y':case'@':chars+='0123456789';break;case'D':case'M':return null;case"'":if(lookAhead("'"))
chars+="'";else
literal=true;break;default:chars+=format.charAt(iFormat);}
return chars;},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name];},_setDateFromField:function(inst){var dateFormat=this._get(inst,'dateFormat');var dates=inst.input?inst.input.val().split(this._get(inst,'rangeSeparator')):null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);if(dates.length>0){var settings=this._getFormatConfig(inst);if(dates.length>1){date=this.parseDate(dateFormat,dates[1],settings)||defaultDate;inst.endDay=date.getDate();inst.endMonth=date.getMonth();inst.endYear=date.getFullYear();}
try{date=this.parseDate(dateFormat,dates[0],settings)||defaultDate;}catch(e){this.log(e);date=defaultDate;}}
inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates[0]?date.getDate():0);inst.currentMonth=(dates[0]?date.getMonth():0);inst.currentYear=(dates[0]?date.getFullYear():0);this._adjustInstDate(inst);},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,'defaultDate'),new Date());var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date;},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setUTCDate(date.getUTCDate()+offset);return date;};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||'d'){case'd':case'D':day+=(matches[1]-0);break;case'w':case'W':day+=(matches[1]*7);break;case'm':case'M':month+=(matches[1]-0);day=Math.min(day,getDaysInMonth(year,month));break;case'y':case'Y':year+=(matches[1]-0);day=Math.min(day,getDaysInMonth(year,month));break;}
matches=pattern.exec(offset);}
return new Date(year,month,day);};return(date==null?defaultDate:(typeof date=='string'?offsetString(date,this._getDaysInMonth):(typeof date=='number'?offsetNumeric(date):date)));},_setDate:function(inst,date,endDate){var clear=!(date);date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(this._get(inst,'rangeSelect')){if(endDate){endDate=this._determineDate(endDate,null);inst.endDay=endDate.getDate();inst.endMonth=endDate.getMonth();inst.endYear=endDate.getFullYear();}else{inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear;}}
this._adjustInstDate(inst);if(inst.input)
inst.input.val(clear?'':this._formatDate(inst)+
(!this._get(inst,'rangeSelect')?'':this._get(inst,'rangeSeparator')+
this._formatDate(inst,inst.endDay,inst.endMonth,inst.endYear)));},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=='')?null:new Date(inst.currentYear,inst.currentMonth,inst.currentDay));if(this._get(inst,'rangeSelect')){return[inst.rangeStart||startDate,(!inst.endYear?null:new Date(inst.endYear,inst.endMonth,inst.endDay))];}else
return startDate;},_generateDatepicker:function(inst){var today=new Date();today=new Date(today.getFullYear(),today.getMonth(),today.getDate());var showStatus=this._get(inst,'showStatus');var isRTL=this._get(inst,'isRTL');var clear=(this._get(inst,'mandatory')?'':'<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#'+inst.id+'\');"'+
(showStatus?this._addStatus(inst,this._get(inst,'clearStatus')||'&#xa0;'):'')+'>'+
this._get(inst,'clearText')+'</a></div>');var controls='<div class="ui-datepicker-control">'+(isRTL?'':clear)+'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"'+
(showStatus?this._addStatus(inst,this._get(inst,'closeStatus')||'&#xa0;'):'')+'>'+
this._get(inst,'closeText')+'</a></div>'+(isRTL?clear:'')+'</div>';var prompt=this._get(inst,'prompt');var closeAtTop=this._get(inst,'closeAtTop');var hideIfNoPrevNext=this._get(inst,'hideIfNoPrevNext');var navigationAsDateFormat=this._get(inst,'navigationAsDateFormat');var numMonths=this._getNumberOfMonths(inst);var stepMonths=this._get(inst,'stepMonths');var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=(!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay));var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');var drawMonth=inst.drawMonth;var drawYear=inst.drawYear;if(maxDate){var maxDraw=new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate());maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(new Date(drawYear,drawMonth,1)>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--;}}}
var prevText=this._get(inst,'prevText');prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,new Date(drawYear,drawMonth-stepMonths,1),this._getFormatConfig(inst)));var prev='<div class="ui-datepicker-prev">'+(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a onclick="jQuery.datepicker._adjustDate(\'#'+inst.id+'\', -'+stepMonths+', \'M\');"'+
(showStatus?this._addStatus(inst,this._get(inst,'prevStatus')||'&#xa0;'):'')+'>'+prevText+'</a>':(hideIfNoPrevNext?'':'<label>'+prevText+'</label>'))+'</div>';var nextText=this._get(inst,'nextText');nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,new Date(drawYear,drawMonth+stepMonths,1),this._getFormatConfig(inst)));var next='<div class="ui-datepicker-next">'+(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a onclick="jQuery.datepicker._adjustDate(\'#'+inst.id+'\', +'+stepMonths+', \'M\');"'+
(showStatus?this._addStatus(inst,this._get(inst,'nextStatus')||'&#xa0;'):'')+'>'+nextText+'</a>':(hideIfNoPrevNext?'':'<label>'+nextText+'</label>'))+'</div>';var currentText=this._get(inst,'currentText');currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,today,this._getFormatConfig(inst)));var html=(prompt?'<div class="'+this._promptClass+'">'+prompt+'</div>':'')+
(closeAtTop&&!inst.inline?controls:'')+'<div class="ui-datepicker-links">'+(isRTL?next:prev)+
(this._isInRange(inst,(this._get(inst,'gotoCurrent')&&inst.currentDay?currentDate:today))?'<div class="ui-datepicker-current">'+'<a onclick="jQuery.datepicker._gotoToday(\'#'+inst.id+'\');"'+
(showStatus?this._addStatus(inst,this._get(inst,'currentStatus')||'&#xa0;'):'')+'>'+
currentText+'</a></div>':'')+(isRTL?prev:next)+'</div>';var firstDay=this._get(inst,'firstDay');var changeFirstDay=this._get(inst,'changeFirstDay');var dayNames=this._get(inst,'dayNames');var dayNamesShort=this._get(inst,'dayNamesShort');var dayNamesMin=this._get(inst,'dayNamesMin');var monthNames=this._get(inst,'monthNames');var beforeShowDay=this._get(inst,'beforeShowDay');var highlightWeek=this._get(inst,'highlightWeek');var showOtherMonths=this._get(inst,'showOtherMonths');var showWeeks=this._get(inst,'showWeeks');var calculateWeek=this._get(inst,'calculateWeek')||this.iso8601Week;var status=(showStatus?this._get(inst,'dayStatus')||'&#xa0;':'');var dateStatus=this._get(inst,'statusForDate')||this.dateStatus;var endDate=inst.endDay?new Date(inst.endYear,inst.endMonth,inst.endDay):currentDate;for(var row=0;row<numMonths[0];row++)
for(var col=0;col<numMonths[1];col++){var selectedDate=new Date(drawYear,drawMonth,inst.selectedDay);html+='<div class="ui-datepicker-one-month'+(col==0?' ui-datepicker-new-row':'')+'">'+
this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,showStatus,monthNames)+'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>'+'<tr class="ui-datepicker-title-row">'+
(showWeeks?'<td>'+this._get(inst,'weekHeader')+'</td>':'');for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;var dayStatus=(status.indexOf('DD')>-1?status.replace(/DD/,dayNames[day]):status.replace(/D/,dayNamesShort[day]));html+='<td'+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end-cell"':'')+'>'+
(!changeFirstDay?'<span':'<a onclick="jQuery.datepicker._changeFirstDay(\'#'+inst.id+'\', '+day+');"')+
(showStatus?this._addStatus(inst,dayStatus):'')+' title="'+dayNames[day]+'">'+
dayNamesMin[day]+(changeFirstDay?'</a>':'</span>')+'</td>';}
html+='</tr></thead><tbody>';var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth)
inst.selectedDay=Math.min(inst.selectedDay,daysInMonth);var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var printDate=new Date(drawYear,drawMonth,1-leadDays);var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="ui-datepicker-days-row">'+
(showWeeks?'<td class="ui-datepicker-week-col">'+calculateWeek(printDate)+'</td>':'');for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,'']);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="ui-datepicker-days-cell'+
((dow+firstDay+6)%7>=5?' ui-datepicker-week-end-cell':'')+
(otherMonth?' ui-datepicker-otherMonth':'')+
(printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth?' ui-datepicker-days-cell-over':'')+
(unselectable?' '+this._unselectableClass:'')+
(otherMonth&&!showOtherMonths?'':' '+daySettings[1]+
(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' '+this._currentClass:'')+
(printDate.getTime()==today.getTime()?' ui-datepicker-today':''))+'"'+
((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':'')+
(unselectable?(highlightWeek?' onmouseover="jQuery(this).parent().addClass(\'ui-datepicker-week-over\');"'+' onmouseout="jQuery(this).parent().removeClass(\'ui-datepicker-week-over\');"':''):' onmouseover="jQuery(this).addClass(\'ui-datepicker-days-cell-over\')'+
(highlightWeek?'.parent().addClass(\'ui-datepicker-week-over\')':'')+';'+
(!showStatus||(otherMonth&&!showOtherMonths)?'':'jQuery(\'#ui-datepicker-status-'+
inst.id+'\').html(\''+(dateStatus.apply((inst.input?inst.input[0]:null),[printDate,inst])||'&#xa0;')+'\');')+'"'+' onmouseout="jQuery(this).removeClass(\'ui-datepicker-days-cell-over\')'+
(highlightWeek?'.parent().removeClass(\'ui-datepicker-week-over\')':'')+';'+
(!showStatus||(otherMonth&&!showOtherMonths)?'':'jQuery(\'#ui-datepicker-status-'+
inst.id+'\').html(\'&#xa0;\');')+'" onclick="jQuery.datepicker._selectDay(\'#'+
inst.id+'\','+drawMonth+','+drawYear+', this);"')+'>'+
(otherMonth?(showOtherMonths?printDate.getDate():'&#xa0;'):(unselectable?printDate.getDate():'<a>'+printDate.getDate()+'</a>'))+'</td>';printDate.setUTCDate(printDate.getUTCDate()+1);}
html+='</tr>';}
drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;}
html+='</tbody></table></div>';}
html+=(showStatus?'<div style="clear: both;"></div><div id="ui-datepicker-status-'+inst.id+'" class="ui-datepicker-status">'+(this._get(inst,'initStatus')||'&#xa0;')+'</div>':'')+
(!closeAtTop&&!inst.inline?controls:'')+'<div style="clear: both;"></div>'+
($.browser.msie&&parseInt($.browser.version)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>':'');return html;},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,showStatus,monthNames){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var html='<div class="ui-datepicker-header">';if(secondary||!this._get(inst,'changeMonth'))
html+=monthNames[drawMonth]+'&#xa0;';else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);html+='<select class="ui-datepicker-new-month" '+'onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'M\');" '+'onclick="jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+
(showStatus?this._addStatus(inst,this._get(inst,'monthStatus')||'&#xa0;'):'')+'>';for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth()))
html+='<option value="'+month+'"'+
(month==drawMonth?' selected="selected"':'')+'>'+monthNames[month]+'</option>';}
html+='</select>';}
if(secondary||!this._get(inst,'changeYear'))
html+=drawYear;else{var years=this._get(inst,'yearRange').split(':');var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10;}else if(years[0].charAt(0)=='+'||years[0].charAt(0)=='-'){year=endYear=new Date().getFullYear();year+=parseInt(years[0],10);endYear+=parseInt(years[1],10);}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10);}
year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-new-year" '+'onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'Y\');" '+'onclick="jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+
(showStatus?this._addStatus(inst,this._get(inst,'yearStatus')||'&#xa0;'):'')+'>';for(;year<=endYear;year++){html+='<option value="'+year+'"'+
(year==drawYear?' selected="selected"':'')+'>'+year+'</option>';}
html+='</select>';}
html+='</div>';return html;},_addStatus:function(inst,text){return' onmouseover="jQuery(\'#ui-datepicker-status-'+inst.id+'\').html(\''+text+'\');" '+'onmouseout="jQuery(\'#ui-datepicker-status-'+inst.id+'\').html(\'&#xa0;\');"';},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=='Y'?offset:0);var month=inst.drawMonth+(period=='M'?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+
(period=='D'?offset:0);var date=new Date(year,month,day);var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=='M'||period=='Y')
this._notifyChange(inst);},_notifyChange:function(inst){var onChange=this._get(inst,'onChangeMonthYear');if(onChange)
onChange.apply((inst.input?inst.input[0]:null),[new Date(inst.selectedYear,inst.selectedMonth,1),inst]);},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,'numberOfMonths');return(numMonths==null?[1,1]:(typeof numMonths=='number'?[1,numMonths]:numMonths));},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+'Date'),null);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0);}
return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date));},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1);if(offset<0)
date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));return this._isInRange(inst,date);},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,'min');var maxDate=this._getMinMaxDate(inst,'max');return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate));},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,'shortYearCutoff');shortYearCutoff=(typeof shortYearCutoff!='string'?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,'dayNamesShort'),dayNames:this._get(inst,'dayNames'),monthNamesShort:this._get(inst,'monthNamesShort'),monthNames:this._get(inst,'monthNames')};},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear;}
var date=(day?(typeof day=='object'?day:new Date(year,month,day)):new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,'dateFormat'),date,this._getFormatConfig(inst));}});function extendRemove(target,props){$.extend(target,props);for(var name in props)
if(props[name]==null||props[name]==undefined)
target[name]=props[name];return target;};function isArray(a){return(a&&(($.browser.safari&&typeof a=='object'&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))));};$.fn.datepicker=function(options){var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=='string'&&(options=='isDisabled'||options=='getDate'))
return $.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this[0]].concat(otherArgs));return this.each(function(){typeof options=='string'?$.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options);});};$.datepicker=new Datepicker();$(document).ready(function(){$(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick);});})(jQuery);

File diff suppressed because it is too large Load Diff

View File

@ -1,151 +0,0 @@
======================================================================
DESCRIPTION:
** NOTICE ** THIS VERSION OF THE SOFTWARE IS "BETA," MEANING IT IS IS
NOT YET READY FOR USE IN A PRODUCTION ENVIRONEMNT. IT IS MADE
AVAILABLE FOR PREVIEW AND TESTING PURPOSES ONLY.
This is Version 2 of JsDoc Toolkit, an automatic documentation
generation tool for JavaScript. It is written in JavaScript and is run
from a command line (or terminal) using the Java runtime engine.
Using this tool you can automatically turn JavaDoc-like comments in
your JavaScript source code into published output files, such as HTML
or XML.
For more information, to report a bug, or to browse the technical
documentation for this tool please visit the official JsDoc Toolkit
project homepage at http://code.google.com/p/jsdoc-toolkit/
For the most up-to-date documentation on Version 2 of JsDoc Toolkit
see the Verion 2 wiki at http://jsdoctoolkit.org/wiki
======================================================================
REQUIREMENTS:
JsDoc Toolkit is known to work with:
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
on Windows XP,
and java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
on Mac OS X 10.4.
Other versions of java may or may not work with JsDoc Toolkit.
======================================================================
USAGE:
Running JsDoc Toolkit requires you to have Java installed on your
computer. For more information see http://www.java.com/getjava/
Before running the JsDoc Toolkit app you should change your current
working directory to the jsdoc-toolkit folder. Then follow the
examples below, or as shown on the project wiki.
On a computer running Windows a valid command line to run JsDoc
Toolkit might look like this:
> java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode.js
On Mac OS X or Linux the same command would look like this:
$ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc mycode.js
The above assumes your current working directory contains jsrun.jar,
the "app" and "templates" subdirectories from the standard JsDoc
Toolkit distribution and that the relative path to the code you wish
to document is "mycode.js".
The output documentation files will be saved to a new directory named
"out" (by default) in the current directory, or if you specify a
-d=somewhere_else option, to the somewhere_else directory.
For help (usage notes) enter this on the command line:
$ java -jar jsrun.jar app/run.js --help
More information about the various command line options used by JsDoc
Toolkit are available on the project wiki.
======================================================================
TESTING:
To run the suite of unit tests included with JsDoc Toolkit enter this
on the command line:
$ java -jar jsrun.jar app/run.js -T
To see a dump of the internal data structure that JsDoc Toolkit has
built from your source files use this command:
$ java -jar jsrun.jar app/run.js mycode.js -Z
======================================================================
LICENSE:
JSDoc.pm
This project is based on the JSDoc.pm tool, created by Michael
Mathews and Gabriel Reid. More information on JsDoc.pm can
be found on the JSDoc.pm homepage: http://jsdoc.sourceforge.net/
Complete documentation on JsDoc Toolkit can be found on the project
wiki at http://code.google.com/p/jsdoc-toolkit/w/list
Rhino
Rhino (JavaScript in Java) is open source and licensed by Mozilla
under the MPL 1.1 or later/GPL 2.0 or later licenses, the text of
which is available at http://www.mozilla.org/MPL/
You can obtain the source code for Rhino from the Mozilla web site at
http://www.mozilla.org/rhino/download.html
JsDoc Toolkit is a larger work that uses the Rhino JavaScript engine
but is not derived from it in any way. The Rhino library is used
without modification and without any claims whatsoever.
The Rhino Debugger
You can obtain more information about the Rhino Debugger from the
Mozilla web site at http://www.mozilla.org/rhino/debugger.html
JsDoc Toolkit is a larger work that uses the Rhino Debugger but
is not derived from it in any way. The Rhino Debugger is used
without modification and without any claims whatsoever.
JsDoc Toolkit
All code specific to JsDoc Toolkit are free, open source and licensed
for use under the X11/MIT License.
JsDoc Toolkit is Copyright (c)2008 Michael Mathews <micmath@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms below.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: The above copyright notice and this
permission notice must be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,33 +0,0 @@
IO.include("frame/Opt.js");
IO.include("frame/Chain.js");
IO.include("frame/Link.js");
IO.include("frame/String.js");
IO.include("frame/Hash.js");
IO.include("frame/Namespace.js");
IO.include("frame/Reflection.js");
/** A few helper functions to make life a little easier. */
function defined(o) {
return (o !== undefined);
}
function copy(o) { // todo check for circular refs
if (o == null || typeof(o) != 'object') return o;
var c = new o.constructor();
for(var p in o) c[p] = copy(o[p]);
return c;
}
function isUnique(arr) {
var l = arr.length;
for(var i = 0; i < l; i++ ) {
if (arr.lastIndexOf(arr[i]) > i) return false;
}
return true;
}
/** Returns the given string with all regex meta characters backslashed. */
RegExp.escapeMeta = function(str) {
return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1");
}

View File

@ -1,102 +0,0 @@
/**@constructor*/
function ChainNode(object, link) {
this.value = object;
this.link = link; // describes this node's relationship to the previous node
}
/**@constructor*/
function Chain(valueLinks) {
this.nodes = [];
this.cursor = -1;
if (valueLinks && valueLinks.length > 0) {
this.push(valueLinks[0], "//");
for (var i = 1, l = valueLinks.length; i < l; i+=2) {
this.push(valueLinks[i+1], valueLinks[i]);
}
}
}
Chain.prototype.push = function(o, link) {
if (this.nodes.length > 0 && link) this.nodes.push(new ChainNode(o, link));
else this.nodes.push(new ChainNode(o));
}
Chain.prototype.unshift = function(o, link) {
if (this.nodes.length > 0 && link) this.nodes[0].link = link;
this.nodes.unshift(new ChainNode(o));
this.cursor++;
}
Chain.prototype.get = function() {
if (this.cursor < 0 || this.cursor > this.nodes.length-1) return null;
return this.nodes[this.cursor];
}
Chain.prototype.first = function() {
this.cursor = 0;
return this.get();
}
Chain.prototype.last = function() {
this.cursor = this.nodes.length-1;
return this.get();
}
Chain.prototype.next = function() {
this.cursor++;
return this.get();
}
Chain.prototype.prev = function() {
this.cursor--;
return this.get();
}
Chain.prototype.toString = function() {
var string = "";
for (var i = 0, l = this.nodes.length; i < l; i++) {
if (this.nodes[i].link) string += " -("+this.nodes[i].link+")-> ";
string += this.nodes[i].value.toString();
}
return string;
}
Chain.prototype.joinLeft = function() {
var result = "";
for (var i = 0, l = this.cursor; i < l; i++) {
if (result && this.nodes[i].link) result += this.nodes[i].link;
result += this.nodes[i].value.toString();
}
return result;
}
/* USAGE:
var path = "one/two/three.four/five-six";
var pathChain = new Chain(path.split(/([\/.-])/));
print(pathChain);
var lineage = new Chain();
lineage.push("Port");
lineage.push("Les", "son");
lineage.push("Dawn", "daughter");
lineage.unshift("Purdie", "son");
print(lineage);
// walk left
for (var node = lineage.last(); node !== null; node = lineage.prev()) {
print("< "+node.value);
}
// walk right
var node = lineage.first()
while (node !== null) {
print(node.value);
node = lineage.next();
if (node && node.link) print("had a "+node.link+" named");
}
*/

View File

@ -1,144 +0,0 @@
/**
* @class
<pre>
This is a lightly modified version of Kevin Jones' JavaScript
library Data.Dump. To download the original visit:
<a href="http://openjsan.org/doc/k/ke/kevinj/Data/Dump/">http://openjsan.org/doc/k/ke/kevinj/Data/Dump/</a>
AUTHORS
The Data.Dump JavaScript module is written by Kevin Jones
(kevinj@cpan.org), based on Data::Dump by Gisle Aas (gisle@aas.no),
based on Data::Dumper by Gurusamy Sarathy (gsar@umich.edu).
COPYRIGHT
Copyright 2007 Kevin Jones. Copyright 1998-2000,2003-2004 Gisle Aas.
Copyright 1996-1998 Gurusamy Sarathy.
This program is free software; you can redistribute it and/or modify
it under the terms of the Perl Artistic License
See http://www.perl.com/perl/misc/Artistic.html
</pre>
* @static
*/
Dumper = {
/** @param [...] The objects to dump. */
dump: function () {
if (arguments.length > 1)
return this._dump(arguments);
else if (arguments.length == 1)
return this._dump(arguments[0]);
else
return "()";
},
_dump: function (obj) {
if (typeof obj == 'undefined') return 'undefined';
var out;
if (obj.serialize) { return obj.serialize(); }
var type = this._typeof(obj);
if (obj.circularReference) obj.circularReference++;
switch (type) {
case 'circular':
out = "{ //circularReference\n}";
break;
case 'object':
var pairs = new Array;
for (var prop in obj) {
if (prop != "circularReference" && obj.hasOwnProperty(prop)) { //hide inherited properties
pairs.push(prop + ': ' + this._dump(obj[prop]));
}
}
out = '{' + this._format_list(pairs) + '}';
break;
case 'string':
for (var prop in Dumper.ESC) {
if (Dumper.ESC.hasOwnProperty(prop)) {
obj = obj.replace(prop, Dumper.ESC[prop]);
}
}
// Escape UTF-8 Strings
if (obj.match(/^[\x00-\x7f]*$/)) {
out = '"' + obj.replace(/\"/g, "\\\"").replace(/([\n\r]+)/g, "\\$1") + '"';
}
else {
out = "unescape('"+escape(obj)+"')";
}
break;
case 'array':
var elems = new Array;
for (var i=0; i<obj.length; i++) {
elems.push( this._dump(obj[i]) );
}
out = '[' + this._format_list(elems) + ']';
break;
case 'date':
// firefox returns GMT strings from toUTCString()...
var utc_string = obj.toUTCString().replace(/GMT/,'UTC');
out = 'new Date("' + utc_string + '")';
break;
case 'element':
// DOM element
out = this._dump_dom(obj);
break;
default:
out = obj;
}
out = String(out).replace(/\n/g, '\n ');
out = out.replace(/\n (.*)$/,"\n$1");
return out;
},
_format_list: function (list) {
if (!list.length) return '';
var nl = list.toString().length > 60 ? '\n' : ' ';
return nl + list.join(',' + nl) + nl;
},
_typeof: function (obj) {
if (obj && obj.circularReference && obj.circularReference > 1) return 'circular';
if (Array.prototype.isPrototypeOf(obj)) return 'array';
if (Date.prototype.isPrototypeOf(obj)) return 'date';
if (typeof obj.nodeType != 'undefined') return 'element';
return typeof(obj);
},
_dump_dom: function (obj) {
return '"' + Dumper.nodeTypes[obj.nodeType] + '"';
}
};
Dumper.ESC = {
"\t": "\\t",
"\n": "\\n",
"\f": "\\f"
};
Dumper.nodeTypes = {
1: "ELEMENT_NODE",
2: "ATTRIBUTE_NODE",
3: "TEXT_NODE",
4: "CDATA_SECTION_NODE",
5: "ENTITY_REFERENCE_NODE",
6: "ENTITY_NODE",
7: "PROCESSING_INSTRUCTION_NODE",
8: "COMMENT_NODE",
9: "DOCUMENT_NODE",
10: "DOCUMENT_TYPE_NODE",
11: "DOCUMENT_FRAGMENT_NODE",
12: "NOTATION_NODE"
};

View File

@ -1,47 +0,0 @@
/**@constructor*/
function Hash() {
this.reset();
}
Hash.prototype.reset = function() {
this.elements = {};
}
Hash.prototype.put = function() {
for (var i = 0, l = arguments.length; i < l; i++) {
this.elements[arguments[i]] = arguments[++i];
}
}
Hash.prototype.has = function(key) {
return this.elements.hasOwnProperty(key);
}
Hash.prototype.get = function(key) {
return (this.has(key)) ? this.elements[key] : undefined;
}
Hash.prototype.drop = function(key) {
if (this.has(key)) {
delete this.elements[key];
}
}
Hash.prototype.rename = function(oldKey, newKey) {
if (oldKey != newKey && this.has(oldKey)) {
this.elements[newKey] = this.elements[oldKey];
delete this.elements[oldKey];
}
}
Hash.prototype.keys = function() {
var keys = [];
for (var key in this.elements) if (this.has(key)) keys.push(key);
return keys;
}
Hash.prototype.values = function() {
var values = [];
for (var key in this.elements) if (this.has(key)) values.push(this.get(key));
return values;
}

View File

@ -1,142 +0,0 @@
/** Handle the creation of HTML links to documented symbols.
@constructor
*/
function Link() {
this.alias = "";
this.src = "";
this.file = "";
this.text = "";
this.innerName = "";
this.classLink = false;
this.targetName = "";
this.target = function(targetName) {
if (defined(targetName)) this.targetName = targetName;
return this;
}
this.inner = function(inner) {
if (defined(inner)) this.innerName = inner;
return this;
}
this.withText = function(text) {
if (defined(text)) this.text = text;
return this;
}
this.toSrc = function(filename) {
if (defined(filename)) this.src = filename;
return this;
}
this.toSymbol = function(alias) {
if (defined(alias)) this.alias = new String(alias);
return this;
}
this.toClass = function(alias) {
this.classLink = true;
return this.toSymbol(alias);
}
this.toFile = function(file) {
if (defined(file)) this.file = file;
return this;
}
this.toString = function() {
var linkString;
var thisLink = this;
if (this.alias) {
linkString = this.alias.replace(/(^|[^a-z$0-9_#.:-])([|a-z$0-9_#.:-]+)($|[^a-z$0-9_#.:-])/i,
function(match, prematch, symbolName, postmatch) {
var symbolNames = symbolName.split("|");
var links = [];
for (var i = 0, l = symbolNames.length; i < l; i++) {
thisLink.alias = symbolNames[i];
links.push(thisLink._makeSymbolLink(symbolNames[i]));
}
return prematch+links.join("|")+postmatch;
}
);
}
else if (this.src) {
linkString = thisLink._makeSrcLink(this.src);
}
else if (this.file) {
linkString = thisLink._makeFileLink(this.file);
}
return linkString;
}
}
/** prefixed for hashes */
Link.hashPrefix = "";
/** Appended to the front of relative link paths. */
Link.base = "";
Link.symbolNameToLinkName = function(symbol) {
var linker = "";
if (symbol.isStatic) linker = ".";
else if (symbol.isInner) linker = "-";
return Link.hashPrefix+linker+symbol.name;
}
/** Create a link to a snother symbol. */
Link.prototype._makeSymbolLink = function(alias) {
var linkBase = Link.base+publish.conf.symbolsDir;
var linkTo = Link.symbolSet.getSymbol(alias);
var linkPath;
var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
// is it an internal link?
if (alias.charAt(0) == "#") var linkPath = alias;
// if there is no symbol by that name just return the name unaltered
else if (!linkTo) return this.text || alias;
// it's a symbol in another file
else {
if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
linkPath = escape(linkTo.memberOf) || "_global_";
linkPath += publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo);
}
else {
linkPath = escape(linkTo.alias);
linkPath += publish.conf.ext + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
}
linkPath = linkBase + linkPath
}
var linkText = this.text || alias;
var link = {linkPath: linkPath, linkText: linkText};
if (typeof JSDOC.PluginManager != "undefined") {
JSDOC.PluginManager.run("onSymbolLink", link);
}
return "<a href=\""+link.linkPath+"\""+target+">"+link.linkText+"</a>";
}
/** Create a link to a source file. */
Link.prototype._makeSrcLink = function(srcFilePath) {
var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
// transform filepath into a filename
var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "_");
var outFilePath = Link.base + publish.conf.srcDir + srcFile + publish.conf.ext;
if (!this.text) this.text = FilePath.fileName(srcFilePath);
return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
}
/** Create a link to a source file. */
Link.prototype._makeFileLink = function(filePath) {
var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
var outFilePath = Link.base + filePath;
if (!this.text) this.text = filePath;
return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
}

View File

@ -1,10 +0,0 @@
_global_ = this;
function Namespace(name, f) {
var n = name.split(".");
for (var o = _global_, i = 0, l = n.length; i < l; i++) {
o = o[n[i]] = o[n[i]] || {};
}
if (f) f();
}

View File

@ -1,134 +0,0 @@
/** @namespace */
Opt = {
/**
* Get commandline option values.
* @param {Array} args Commandline arguments. Like ["-a=xml", "-b", "--class=new", "--debug"]
* @param {object} optNames Map short names to long names. Like {a:"accept", b:"backtrace", c:"class", d:"debug"}.
* @return {object} Short names and values. Like {a:"xml", b:true, c:"new", d:true}
*/
get: function(args, optNames) {
var opt = {"_": []}; // the unnamed option allows multiple values
for (var i = 0; i < args.length; i++) {
var arg = new String(args[i]);
var name;
var value;
if (arg.charAt(0) == "-") {
if (arg.charAt(1) == "-") { // it's a longname like --foo
arg = arg.substring(2);
var m = arg.split("=");
name = m.shift();
value = m.shift();
if (typeof value == "undefined") value = true;
for (var n in optNames) { // convert it to a shortname
if (name == optNames[n]) {
name = n;
}
}
}
else { // it's a shortname like -f
arg = arg.substring(1);
var m = arg.split("=");
name = m.shift();
value = m.shift();
if (typeof value == "undefined") value = true;
for (var n in optNames) { // find the matching key
if (name == n || name+'[]' == n) {
name = n;
break;
}
}
}
if (name.match(/(.+)\[\]$/)) { // it's an array type like n[]
name = RegExp.$1;
if (!opt[name]) opt[name] = [];
}
if (opt[name] && opt[name].push) {
opt[name].push(value);
}
else {
opt[name] = value;
}
}
else { // not associated with any optname
opt._.push(args[i]);
}
}
return opt;
}
}
/*t:
plan(11, "Testing Opt.");
is(
typeof Opt,
"object",
"Opt is an object."
);
is(
typeof Opt.get,
"function",
"Opt.get is a function."
);
var optNames = {a:"accept", b:"backtrace", c:"class", d:"debug", "e[]":"exceptions"};
var t_options = Opt.get(["-a=xml", "-b", "--class=new", "--debug", "-e=one", "-e=two", "foo", "bar"], optNames);
is(
t_options.a,
"xml",
"an option defined with a short name can be accessed by its short name."
);
is(
t_options.b,
true,
"an option defined with a short name and no value are true."
);
is(
t_options.c,
"new",
"an option defined with a long name can be accessed by its short name."
);
is(
t_options.d,
true,
"an option defined with a long name and no value are true."
);
is(
typeof t_options.e,
"object",
"an option that can accept multiple values is defined."
);
is(
t_options.e.length,
2,
"an option that can accept multiple values can have more than one value."
);
is(
t_options.e[1],
"two",
"an option that can accept multiple values can be accessed as an array."
);
is(
typeof t_options._,
"object",
"the property '_' is defined for unnamed options."
);
is(
t_options._[0],
"foo",
"the property '_' can be accessed as an array."
);
*/

View File

@ -1,26 +0,0 @@
/**@constructor*/
function Reflection(obj) {
this.obj = obj;
}
Reflection.prototype.getConstructorName = function() {
if (this.obj.constructor.name) return this.obj.constructor.name;
var src = this.obj.constructor.toSource();
var name = src.substring(name.indexOf("function")+8, src.indexOf('(')).replace(/ /g,'');
return name;
}
Reflection.prototype.getMethod = function(name) {
for (var p in this.obj) {
if (p == name && typeof(this.obj[p]) == "function") return this.obj[p];
}
return null;
}
Reflection.prototype.getParameterNames = function() {
var src = this.obj.toSource();
src = src.substring(
src.indexOf("(", 8)+1, src.indexOf(")")
);
return src.split(/, ?/);
}

View File

@ -1,93 +0,0 @@
/**
@name String
@class Additions to the core string object.
*/
/** @author Steven Levithan, released as public domain. */
String.prototype.trim = function() {
var str = this.replace(/^\s+/, '');
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1);
break;
}
}
return str;
}
/*t:
plan(6, "Testing String.prototype.trim.");
var s = " a bc ".trim();
is(s, "a bc", "multiple spaces front and back are trimmed.");
s = "a bc\n\n".trim();
is(s, "a bc", "newlines only in back are trimmed.");
s = "\ta bc".trim();
is(s, "a bc", "tabs only in front are trimmed.");
s = "\n \t".trim();
is(s, "", "an all-space string is trimmed to empty.");
s = "a b\nc".trim();
is(s, "a b\nc", "a string with no spaces in front or back is trimmed to itself.");
s = "".trim();
is(s, "", "an empty string is trimmed to empty.");
*/
String.prototype.balance = function(open, close) {
var i = 0;
while (this.charAt(i) != open) {
if (i == this.length) return [-1, -1];
i++;
}
var j = i+1;
var balance = 1;
while (j < this.length) {
if (this.charAt(j) == open) balance++;
if (this.charAt(j) == close) balance--;
if (balance == 0) break;
j++;
if (j == this.length) return [-1, -1];
}
return [i, j];
}
/*t:
plan(16, "Testing String.prototype.balance.");
var s = "{abc}".balance("{","}");
is(s[0], 0, "opener in first is found.");
is(s[1], 4, "closer in last is found.");
s = "ab{c}de".balance("{","}");
is(s[0], 2, "opener in middle is found.");
is(s[1], 4, "closer in middle is found.");
s = "a{b{c}de}f".balance("{","}");
is(s[0], 1, "nested opener is found.");
is(s[1], 8, "nested closer is found.");
s = "{}".balance("{","}");
is(s[0], 0, "opener with no content is found.");
is(s[1], 1, "closer with no content is found.");
s = "".balance("{","}");
is(s[0], -1, "empty string opener is -1.");
is(s[1], -1, "empty string closer is -1.");
s = "{abc".balance("{","}");
is(s[0], -1, "opener with no closer returns -1.");
is(s[1], -1, "no closer returns -1.");
s = "abc".balance("{","}");
is(s[0], -1, "no opener or closer returns -1 for opener.");
is(s[1], -1, "no opener or closer returns -1 for closer.");
s = "a<bc}de".balance("<","}");
is(s[0], 1, "unmatching opener is found.");
is(s[1], 4, "unmatching closer is found.");
*/

View File

@ -1,129 +0,0 @@
/**
* @fileOverview
* @name JsTestrun
* @author Michael Mathews micmath@gmail.com
* @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-2.0.1/jsdoc-toolkit/app/frame/Testrun.js $
* @revision $Id: Testrun.js 418 2008-01-15 21:40:33Z micmath $
* @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
* (See the accompanying README file for full details.)
*/
/**
Yet another unit testing tool for JavaScript.
@author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
@param {object} testCases Properties are testcase names, values are functions to execute as tests.
*/
function testrun(testCases) {
var ran = 0;
for (t in testCases) {
var result = testCases[t]();
ran++;
}
return testrun.reportOut+"-------------------------------\n"+((testrun.fails>0)? ":( Failed "+testrun.fails+"/" : ":) Passed all ")+testrun.count+" test"+((testrun.count == 1)? "":"s")+".\n";
}
testrun.count = 0;
testrun.current = null;
testrun.passes = 0;
testrun.fails = 0;
testrun.reportOut = "";
/** @private */
testrun.report = function(text) {
testrun.reportOut += text+"\n";
}
/**
Check if test evaluates to true.
@param {string} test To be evaluated.
@param {string} message Optional. To be displayed in the report.
@return {boolean} True if the string test evaluates to true.
*/
ok = function(test, message) {
testrun.count++;
var result;
try {
result = eval(test);
if (result) {
testrun.passes++;
testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
}
else {
testrun.fails++;
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
}
}
catch(e) {
testrun.fails++
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
}
}
/**
Check if test is same as expected.
@param {string} test To be evaluated.
@param {string} expected
@param {string} message Optional. To be displayed in the report.
@return {boolean} True if (test == expected). Note that the comparison is not a strict equality check.
*/
is = function(test, expected, message) {
testrun.count++;
var result;
try {
result = eval(test);
if (result == expected) {
testrun.passes++
testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
}
else {
testrun.fails++
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
testrun.report("expected: "+expected);
testrun.report(" got: "+result);
}
}
catch(e) {
testrun.fails++
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
testrun.report("expected: "+expected);
testrun.report(" got: "+result);}
}
/**
Check if test matches pattern.
@param {string} test To be evaluated.
@param {string} pattern Used to create a RegExp.
@param {string} message Optional. To be displayed in the report.
@return {boolean} True if test matches pattern.
*/
like = function(test, pattern, message) {
testrun.count++;
var result;
try {
result = eval(test);
var rgx = new RegExp(pattern);
if (rgx.test(result)) {
testrun.passes++
testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
}
else {
testrun.fails++
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
testrun.report(" this: "+result);
testrun.report("is not like: "+pattern);
}
}
catch(e) {
testrun.fails++
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
}
}

View File

@ -1,26 +0,0 @@
/**
This is the main container for the FOODOC handler.
@namespace
*/
FOODOC = {
};
/** The current version string of this application. */
FOODOC.VERSION = "1.0";
FOODOC.handle = function(srcFile, src) {
LOG.inform("Handling file '" + srcFile + "'");
return [
new JSDOC.Symbol(
"foo",
[],
"VIRTUAL",
new JSDOC.DocComment("/** This is a foo. */")
)
];
};
FOODOC.publish = function(symbolgroup) {
LOG.inform("Publishing symbolgroup.");
};

View File

@ -1,26 +0,0 @@
/**
* This is the main container for the XMLDOC handler.
* @namespace
* @author Brett Fattori (bfattori@fry.com)
* @version $Revision: 498 $
*/
XMLDOC = {
};
/** The current version string of this application. */
XMLDOC.VERSION = "1.0";
/** Include the library necessary to handle XML files */
IO.includeDir("handlers/XMLDOC/");
/**
* @type Symbol[]
*/
XMLDOC.handle = function(srcFile, src) {
};
XMLDOC.publish = function(symbolgroup) {
}

View File

@ -1,159 +0,0 @@
LOG.inform("XMLDOC.DomReader loaded");
XMLDOC.DomReader = function(root) {
this.dom = root;
/**
* The current node the reader is on
*/
this.node = root;
/**
* Get the current node the reader is on
* @type XMLDOC.Parser.node
*/
XMLDOC.DomReader.prototype.getNode = function() {
return this.node;
};
/**
* Set the node the reader should be positioned on.
* @param node {XMLDOC.Parser.node}
*/
XMLDOC.DomReader.prototype.setNode = function(node) {
this.node = node;
};
/**
* A helper method to make sure the current node will
* never return null, unless null is passed as the root.
* @param step {String} An expression to evaluate - should return a node or null
*/
XMLDOC.DomReader.prototype.navigate = function(step) {
var n;
if ((n = step) != null)
{
this.node = n;
return this.node;
}
return null;
};
/**
* Get the root node of the current node's document.
*/
XMLDOC.DomReader.prototype.root = function() {
this.navigate(this.dom);
};
/**
* Get the parent of the current node.
*/
XMLDOC.DomReader.prototype.parent = function() {
return this.navigate(this.node.parentNode());
};
/**
* Get the first child of the current node.
*/
XMLDOC.DomReader.prototype.firstChild = function() {
return this.navigate(this.node.firstChild());
};
/**
* Get the last child of the current node.
*/
XMLDOC.DomReader.prototype.lastChild = function() {
return this.navigate(this.node.lastChild());
};
/**
* Get the next sibling of the current node.
*/
XMLDOC.DomReader.prototype.nextSibling = function() {
return this.navigate(this.node.nextSibling());
};
/**
* Get the previous sibling of the current node.
*/
XMLDOC.DomReader.prototype.prevSibling = function() {
return this.navigate(this.node.prevSibling());
};
//===============================================================================================
// Support methods
/**
* Walk the tree starting with the current node, calling the plug-in for
* each node visited. Each time the plug-in is called, the DomReader
* is passed as the only parameter. Use the {@link XMLDOC.DomReader#getNode} method
* to access the current node. <i>This method uses a depth first traversal pattern.</i>
*
* @param srcFile {String} The source file being evaluated
*/
XMLDOC.DomReader.prototype.getSymbols = function(srcFile)
{
XMLDOC.DomReader.symbols = [];
XMLDOC.DomReader.currentFile = srcFile;
JSDOC.Symbol.srcFile = (srcFile || "");
if (defined(JSDOC.PluginManager)) {
JSDOC.PluginManager.run("onDomGetSymbols", this);
}
return XMLDOC.DomReader.symbols;
};
/**
* Find the node with the given name using a depth first traversal.
* Does not modify the DomReader's current node.
*
* @param name {String} The name of the node to find
* @return the node that was found, or null if not found
*/
XMLDOC.DomReader.prototype.findNode = function(name)
{
var findNode = null;
// Start at the current node and move into the subtree,
// looking for the node with the given name
function deeper(node, find)
{
var look = null;
if (node) {
if (node.name == find)
{
return node;
}
if (node.firstChild())
{
look = deeper(node.firstChild(), find);
}
if (!look && node.nextSibling())
{
look = deeper(node.nextSibling(), find);
}
}
return look;
}
return deeper(this.getNode().firstChild(), name);
};
/**
* Find the next node with the given name using a depth first traversal.
*
* @param name {String} The name of the node to find
*/
XMLDOC.DomReader.prototype.findPreviousNode = function(name)
{
};
};

View File

@ -1,16 +0,0 @@
LOG.inform("XMLDOC.symbolize loaded");
/**
* Convert the source file to a set of symbols
*/
XMLDOC.symbolize = function(srcFile, src) {
LOG.inform("Symbolizing file '" + srcFile + "'");
// XML files already have a defined structure, so we don't need to
// do anything but parse them. The DOM reader can create a symbol
// table from the parsed XML.
var dr = new XMLDOC.DomReader(XMLDOC.Parser.parse(src));
return dr.getSymbols(srcFile);
};

View File

@ -1,292 +0,0 @@
LOG.inform("XMLDOC.Parser loaded");
/**
* XML Parser object. Returns an {@link #XMLDOC.Parser.node} which is
* the root element of the parsed document.
* <p/>
* By default, this parser will only handle well formed XML. To
* allow the parser to handle HTML, set the <tt>XMLDOC.Parser.strictMode</tt>
* variable to <tt>false</tt> before calling <tt>XMLDOC.Parser.parse()</tt>.
* <p/>
* <i>Note: If you pass poorly formed XML, it will cause the parser to throw
* an exception.</i>
*
* @author Brett Fattori (bfattori@fry.com)
* @author $Author: micmath $
* @version $Revision: 497 $
*/
XMLDOC.Parser = {};
/**
* Strict mode setting. Setting this to false allows HTML-style source to
* be parsed. Normally, well formed XML has defined end tags, or empty tags
* are properly formed. Default: <tt>true</tt>
* @type Boolean
*/
XMLDOC.Parser.strictMode = true;
/**
* A node in an XML Document. Node types are ROOT, ELEMENT, COMMENT, PI, and TEXT.
* @param parent {XMLDOC.Parser.node} The parent node
* @param name {String} The node name
* @param type {String} One of the types
*/
XMLDOC.Parser.node = function(parent, name, type)
{
this.name = name;
this.type = type || "ELEMENT";
this.parent = parent;
this.charData = "";
this.attrs = {};
this.nodes = [];
this.cPtr = 0;
XMLDOC.Parser.node.prototype.getAttributeNames = function() {
var a = [];
for (var o in this.attrs)
{
a.push(o);
}
return a;
};
XMLDOC.Parser.node.prototype.getAttribute = function(attr) {
return this.attrs[attr];
};
XMLDOC.Parser.node.prototype.setAttribute = function(attr, val) {
this.attrs[attr] = val;
};
XMLDOC.Parser.node.prototype.getChild = function(idx) {
return this.nodes[idx];
};
XMLDOC.Parser.node.prototype.parentNode = function() {
return this.parent;
};
XMLDOC.Parser.node.prototype.firstChild = function() {
return this.nodes[0];
};
XMLDOC.Parser.node.prototype.lastChild = function() {
return this.nodes[this.nodes.length - 1];
};
XMLDOC.Parser.node.prototype.nextSibling = function() {
var p = this.parent;
if (p && (p.nodes.indexOf(this) + 1 != p.nodes.length))
{
return p.getChild(p.nodes.indexOf(this) + 1);
}
return null;
};
XMLDOC.Parser.node.prototype.prevSibling = function() {
var p = this.parent;
if (p && (p.nodes.indexOf(this) - 1 >= 0))
{
return p.getChild(p.nodes.indexOf(this) - 1);
}
return null;
};
};
/**
* Parse an XML Document from the specified source. The XML should be
* well formed, unless strict mode is disabled, then the parser will
* handle HTML-style XML documents.
* @param src {String} The source to parse
*/
XMLDOC.Parser.parse = function(src)
{
var A = [];
// Normailize whitespace
A = src.split("\r\n");
src = A.join("\n");
A = src.split("\r");
src = A.join("\n");
// Remove XML and DOCTYPE specifier
src.replace(/<\?XML .*\?>/i, "");
src.replace(/<!DOCTYPE .*\>/i, "");
// The document is the root node and cannot be modified or removed
var doc = new XMLDOC.Parser.node(null, "ROOT", "DOCUMENT");
// Let's break it down
XMLDOC.Parser.eat(doc, src);
return doc;
};
/**
* The XML fragment processing routine. This method is private and should not be called
* directly.
* @param parentNode {XMLDOC.Parser.node} The node which is the parent of this fragment
* @param src {String} The source within the fragment to process
* @private
*/
XMLDOC.Parser.eat = function(parentNode, src)
{
// A simple tag def
var reTag = new RegExp("<(!|)(\\?|--|)((.|\\s)*?)\\2>","g");
// Special tag types
var reCommentTag = /<!--((.|\s)*?)-->/;
var rePITag = /<\?((.|\s)*?)\?>/;
// A start tag (with potential empty marker)
var reStartTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*(\/)?>/;
// An empty HTML style tag (not proper XML, but we'll accept it so we can process HTML)
var reHTMLEmptyTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*>/;
// Fully enclosing tag with nested tags
var reEnclosingTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*?)\4)*>((.|\s)*?)<\/\1>/;
// Breaks down attributes
var reAttributes = new RegExp(" +([\\w_\\-]*)=(\"|')(.*?)\\2","g");
// Find us a tag
var tag;
while ((tag = reTag.exec(src)) != null)
{
if (tag.index > 0)
{
// The next tag has some text before it
var text = src.substring(0, tag.index).replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
if (text.length > 0 && (text != "\n"))
{
var txtnode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
txtnode.charData = text;
// Append the new text node
parentNode.nodes.push(txtnode);
}
// Reset the lastIndex of reTag
reTag.lastIndex -= src.substring(0, tag.index).length;
// Eat the text
src = src.substring(tag.index);
}
if (reCommentTag.test(tag[0]))
{
// Is this a comment?
var comment = new XMLDOC.Parser.node(parentNode, "", "COMMENT");
comment.charData = reCommentTag.exec(tag[0])[1];
// Append the comment
parentNode.nodes.push(comment);
// Move the lastIndex of reTag
reTag.lastIndex -= tag[0].length;
// Eat the tag
src = src.replace(reCommentTag, "");
}
else if (rePITag.test(tag[0]))
{
// Is this a processing instruction?
var pi = new XMLDOC.Parser.node(parentNode, "", "PI");
pi.charData = rePITag.exec(tag[0])[1];
// Append the processing instruction
parentNode.nodes.push(pi);
// Move the lastIndex of reTag
reTag.lastIndex -= tag[0].length;
// Eat the tag
src = src.replace(rePITag, "");
}
else if (reStartTag.test(tag[0]))
{
// Break it down
var e = reStartTag.exec(tag[0]);
var elem = new XMLDOC.Parser.node(parentNode, e[1], "ELEMENT");
// Get attributes from the tag
var a;
while ((a = reAttributes.exec(e[2])) != null )
{
elem.attrs[a[1]] = a[3];
}
// Is this an empty XML-style tag?
if (e[6] == "/")
{
// Append the empty element
parentNode.nodes.push(elem);
// Move the lastIndex of reTag (include the start tag length)
reTag.lastIndex -= e[0].length;
// Eat the tag
src = src.replace(reStartTag, "");
}
else
{
// Check for malformed XML tags
var htmlParsed = false;
var htmlStartTag = reHTMLEmptyTag.exec(src);
// See if there isn't an end tag within this block
var reHTMLEndTag = new RegExp("</" + htmlStartTag[1] + ">");
var htmlEndTag = reHTMLEndTag.exec(src);
if (XMLDOC.Parser.strictMode && htmlEndTag == null)
{
// Poorly formed XML fails in strict mode
var err = new Error("Malformed XML passed to XMLDOC.Parser... Error contains malformed 'src'");
err.src = src;
throw err;
}
else if (htmlEndTag == null)
{
// This is an HTML-style empty tag, store the element for it in non-strict mode
parentNode.nodes.push(elem);
// Eat the tag
src = src.replace(reHTMLEmptyTag, "");
htmlParsed = true;
}
// If we didn't parse HTML-style, it must be an enclosing tag
if (!htmlParsed)
{
var enc = reEnclosingTag.exec(src);
// Go deeper into the document
XMLDOC.Parser.eat(elem, enc[6]);
// Append the new element node
parentNode.nodes.push(elem);
// Eat the tag
src = src.replace(reEnclosingTag, "");
}
}
// Reset the lastIndex of reTag
reTag.lastIndex = 0;
}
}
// No tag was found... append the text if there is any
src = src.replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
if (src.length > 0 && (src != "\n"))
{
var txtNode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
txtNode.charData = src;
// Append the new text node
parentNode.nodes.push(txtNode);
}
};

View File

@ -1,97 +0,0 @@
/**
@overview
@date $Date: 2008-06-08 22:57:25 +0100 (Sun, 08 Jun 2008) $
@version $Revision: 638 $
@location $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-2.0.1/jsdoc-toolkit/app/lib/JSDOC.js $
*/
/**
This is the main container for the JSDOC application.
@namespace
*/
JSDOC = {
};
/**
@requires Opt
*/
if (typeof arguments == "undefined") arguments = [];
JSDOC.opt = Opt.get(
arguments,
{
d: "directory",
c: "conf",
t: "template",
r: "recurse",
x: "ext",
p: "private",
a: "allfunctions",
e: "encoding",
n: "nocode",
o: "out",
s: "suppress",
T: "testmode",
h: "help",
v: "verbose",
"D[]": "define",
"H[]": "handler"
}
);
/** The current version string of this application. */
JSDOC.VERSION = "2.0.1";
/** Print out usage information and quit. */
JSDOC.usage = function() {
print("USAGE: java -jar jsrun.jar app/run.js [OPTIONS] <SRC_DIR> <SRC_FILE> ...");
print("");
print("OPTIONS:");
print(" -a or --allfunctions\n Include all functions, even undocumented ones.\n");
print(" -c or --conf\n Load a configuration file.\n");
print(" -d=<PATH> or --directory=<PATH>\n Output to this directory (defaults to \"out\").\n");
print(" -D=\"myVar:My value\" or --define=\"myVar:My value\"\n Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.myVar\n");
print(" -e=<ENCODING> or --encoding=<ENCODING>\n Use this encoding to read and write files.\n");
print(" -h or --help\n Show this message and exit.\n");
//print(" -H=ext:handler or --handler=ext:handler\n Multiple. Load handlers/handler.js to handle files with .ext names.\n");
print(" -n or --nocode\n Ignore all code, only document comments with @name tags.\n");
print(" -o=<PATH> or --out=<PATH>\n Print log messages to a file (defaults to stdout).\n");
print(" -p or --private\n Include symbols tagged as private, underscored and inner symbols.\n");
print(" -r=<DEPTH> or --recurse=<DEPTH>\n Descend into src directories.\n");
print(" -s or --suppress\n Suppress source code output.\n");
print(" -t=<PATH> or --template=<PATH>\n Required. Use this template to format the output.\n");
print(" -T or --test\n Run all unit tests and exit.\n");
print(" -v or --verbose\n Provide verbose feedback about what is happening.\n");
print(" -x=<EXT>[,EXT]... or --ext=<EXT>[,EXT]...\n Scan source files with the given extension/s (defaults to js).\n");
quit();
}
/*t:
plan(4, "Testing JSDOC namespace.");
is(
typeof JSDOC,
"object",
"JSDOC.usage is a function."
);
is(
typeof JSDOC.VERSION,
"string",
"JSDOC.VERSION is a string."
);
is(
typeof JSDOC.usage,
"function",
"JSDOC.usage is a function."
);
is(
typeof JSDOC.opt,
"object",
"JSDOC.opt is a object."
);
*/
if (this.IO) IO.includeDir("lib/JSDOC/");

View File

@ -1,200 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/**
Create a new DocComment. This takes a raw documentation comment,
and wraps it in useful accessors.
@class Represents a documentation comment object.
*/
JSDOC.DocComment = function(/**String*/comment) {
this.init();
if (typeof comment != "undefined") {
this.parse(comment);
}
}
JSDOC.DocComment.prototype.init = function() {
this.isUserComment = true;
this.src = "";
this.meta = "";
this.tagTexts = [];
this.tags = [];
}
/**
@requires JSDOC.DocTag
*/
JSDOC.DocComment.prototype.parse = function(/**String*/comment) {
if (comment == "") {
comment = "/** @desc */";
this.isUserComment = false;
}
this.src = JSDOC.DocComment.unwrapComment(comment);
this.meta = "";
if (this.src.indexOf("#") == 0) {
this.src.match(/#(.+[+-])([\s\S]*)$/);
if (RegExp.$1) this.meta = RegExp.$1;
if (RegExp.$2) this.src = RegExp.$2;
}
this.fixDesc();
if (typeof JSDOC.PluginManager != "undefined") {
JSDOC.PluginManager.run("onDocCommentSrc", this);
}
this.src = JSDOC.DocComment.shared+"\n"+this.src;
this.tagTexts =
this.src
.split(/(^|[\r\n])\s*@/)
.filter(function($){return $.match(/\S/)});
/**
The tags found in the comment.
@type JSDOC.DocTag[]
*/
this.tags = this.tagTexts.map(function($){return new JSDOC.DocTag($)});
if (typeof JSDOC.PluginManager != "undefined") {
JSDOC.PluginManager.run("onDocCommentTags", this);
}
}
/*t:
plan(5, "testing JSDOC.DocComment");
requires("../frame/String.js");
requires("../lib/JSDOC/DocTag.js");
var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
is(com.tagTexts[0], "foo some\ncomment here", "first tag text is found.");
is(com.tags[0].title, "foo", "the title is found in a comment with one tag.");
var com = new JSDOC.DocComment("/** @foo first\n* @bar second*"+"/");
is(com.getTag("bar").length, 1, "getTag() returns one tag by that title.");
JSDOC.DocComment.shared = "@author John Smith";
var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
is(com.tags[0].title, "author", "shared comment is added.");
is(com.tags[1].title, "foo", "shared comment is added to existing tag.");
*/
/**
If no @desc tag is provided, this function will add it.
*/
JSDOC.DocComment.prototype.fixDesc = function() {
if (this.meta && this.meta != "@+") return;
if (/^\s*[^@\s]/.test(this.src)) {
this.src = "@desc "+this.src;
}
}
/*t:
plan(5, "testing JSDOC.DocComment#fixDesc");
var com = new JSDOC.DocComment();
com.src = "this is a desc\n@author foo";
com.fixDesc();
is(com.src, "@desc this is a desc\n@author foo", "if no @desc tag is provided one is added.");
com.src = "x";
com.fixDesc();
is(com.src, "@desc x", "if no @desc tag is provided one is added to a single character.");
com.src = "\nx";
com.fixDesc();
is(com.src, "@desc \nx", "if no @desc tag is provided one is added to return and character.");
com.src = " ";
com.fixDesc();
is(com.src, " ", "if no @desc tag is provided one is not added to just whitespace.");
com.src = "";
com.fixDesc();
is(com.src, "", "if no @desc tag is provided one is not added to empty.");
*/
/**
Remove slash-star comment wrapper from a raw comment string.
@type String
*/
JSDOC.DocComment.unwrapComment = function(/**String*/comment) {
if (!comment) return "";
var unwrapped = comment.replace(/(^\/\*\*|\*\/$)/g, "").replace(/^\s*\* ?/gm, "");
return unwrapped;
}
/*t:
plan(5, "testing JSDOC.DocComment.unwrapComment");
var com = "/**x*"+"/";
var unwrapped = JSDOC.DocComment.unwrapComment(com);
is(unwrapped, "x", "a single character jsdoc is found.");
com = "/***x*"+"/";
unwrapped = JSDOC.DocComment.unwrapComment(com);
is(unwrapped, "x", "three stars are allowed in the opener.");
com = "/****x*"+"/";
unwrapped = JSDOC.DocComment.unwrapComment(com);
is(unwrapped, "*x", "fourth star in the opener is kept.");
com = "/**x\n * y\n*"+"/";
unwrapped = JSDOC.DocComment.unwrapComment(com);
is(unwrapped, "x\ny\n", "leading stars and spaces are trimmed.");
com = "/**x\n * y\n*"+"/";
unwrapped = JSDOC.DocComment.unwrapComment(com);
is(unwrapped, "x\n y\n", "only first space after leading stars are trimmed.");
*/
/**
Provides a printable version of the comment.
@type String
*/
JSDOC.DocComment.prototype.toString = function() {
return this.src;
}
/*t:
plan(1, "testing JSDOC.DocComment#fixDesc");
var com = new JSDOC.DocComment();
com.src = "foo";
is(""+com, "foo", "stringifying a comment returns the unwrapped src.");
*/
/**
Given the title of a tag, returns all tags that have that title.
@type JSDOC.DocTag[]
*/
JSDOC.DocComment.prototype.getTag = function(/**String*/tagTitle) {
return this.tags.filter(function($){return $.title == tagTitle});
}
/*t:
plan(1, "testing JSDOC.DocComment#getTag");
requires("../frame/String.js");
requires("../lib/JSDOC/DocTag.js");
var com = new JSDOC.DocComment("/**@foo some\n* @bar\n* @bar*"+"/");
is(com.getTag("bar").length, 2, "getTag returns expected number of tags.");
*/
/**
Used to store the currently shared tag text.
*/
JSDOC.DocComment.shared = "";
/*t:
plan(2, "testing JSDOC.DocComment.shared");
requires("../frame/String.js");
requires("../lib/JSDOC/DocTag.js");
JSDOC.DocComment.shared = "@author Michael";
var com = new JSDOC.DocComment("/**@foo\n* @foo*"+"/");
is(com.getTag("author").length, 1, "getTag returns shared tag.");
is(com.getTag("foo").length, 2, "getTag returns unshared tags too.");
*/

View File

@ -1,294 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/**
@constructor
*/
JSDOC.DocTag = function(src) {
this.init();
if (typeof src != "undefined") {
this.parse(src);
}
}
/**
Create and initialize the properties of this.
*/
JSDOC.DocTag.prototype.init = function() {
this.title = "";
this.type = "";
this.name = "";
this.isOptional = false;
this.defaultValue = "";
this.desc = "";
return this;
}
/**
Populate the properties of this from the given tag src.
@param {string} src
*/
JSDOC.DocTag.prototype.parse = function(src) {
if (typeof src != "string") throw "src must be a string not "+(typeof src);
try {
src = this.nibbleTitle(src);
if (JSDOC.PluginManager) {
JSDOC.PluginManager.run("onDocTagSynonym", this);
}
src = this.nibbleType(src);
// only some tags are allowed to have names.
if (this.title == "param" || this.title == "property" || this.title == "config") { // @config is deprecated
src = this.nibbleName(src);
}
}
catch(e) {
if (LOG) LOG.warn(e);
else throw e;
}
this.desc = src; // whatever is left
// example tags need to have whitespace preserved
if (this.title != "example") this.desc = this.desc.trim();
if (JSDOC.PluginManager) {
JSDOC.PluginManager.run("onDocTag", this);
}
}
/**
Automatically called when this is stringified.
*/
JSDOC.DocTag.prototype.toString = function() {
return this.desc;
}
/*t:
plan(1, "testing JSDOC.DocTag#toString");
var tag = new JSDOC.DocTag("param {object} date A valid date.");
is(""+tag, "A valid date.", "stringifying a tag returns the desc.");
*/
/**
Find and shift off the title of a tag.
@param {string} src
@return src
*/
JSDOC.DocTag.prototype.nibbleTitle = function(src) {
if (typeof src != "string") throw "src must be a string not "+(typeof src);
var parts = src.match(/^\s*(\S+)(?:\s([\s\S]*))?$/);
if (parts && parts[1]) this.title = parts[1];
if (parts && parts[2]) src = parts[2];
else src = "";
return src;
}
/*t:
plan(8, "testing JSDOC.DocTag#nibbleTitle");
var tag = new JSDOC.DocTag();
tag.init().nibbleTitle("aTitleGoesHere");
is(tag.title, "aTitleGoesHere", "a title can be found in a single-word string.");
var src = tag.init().nibbleTitle("aTitleGoesHere and the rest");
is(tag.title, "aTitleGoesHere", "a title can be found in a multi-word string.");
is(src, "and the rest", "the rest is returned when the title is nibbled off.");
src = tag.init().nibbleTitle("");
is(tag.title, "", "given an empty string the title is empty.");
is(src, "", "the rest is empty when the tag is empty.");
var src = tag.init().nibbleTitle(" aTitleGoesHere\n a description");
is(tag.title, "aTitleGoesHere", "leading and trailing spaces are not part of the title.");
is(src, " a description", "leading spaces (less one) are part of the description.");
tag.init().nibbleTitle("a.Title::Goes_Here foo");
is(tag.title, "a.Title::Goes_Here", "titles with punctuation are allowed.");
*/
/**
Find and shift off the type of a tag.
@requires frame/String.js
@param {string} src
@return src
*/
JSDOC.DocTag.prototype.nibbleType = function(src) {
if (typeof src != "string") throw "src must be a string not "+(typeof src);
if (src.match(/^\s*\{/)) {
var typeRange = src.balance("{", "}");
if (typeRange[1] == -1) {
throw "Malformed comment tag ignored. Tag type requires an opening { and a closing }: "+src;
}
this.type = src.substring(typeRange[0]+1, typeRange[1]).trim();
this.type = this.type.replace(/\s*,\s*/g, "|"); // multiples can be separated by , or |
src = src.substring(typeRange[1]+1);
}
return src;
}
/*t:
plan(5, "testing JSDOC.DocTag.parser.nibbleType");
requires("../frame/String.js");
var tag = new JSDOC.DocTag();
tag.init().nibbleType("{String[]} aliases");
is(tag.type, "String[]", "type can have non-alpha characters.");
tag.init().nibbleType("{ aTypeGoesHere } etc etc");
is(tag.type, "aTypeGoesHere", "type is trimmed.");
tag.init().nibbleType("{ oneType, twoType ,\n threeType } etc etc");
is(tag.type, "oneType|twoType|threeType", "multiple types can be separated by commas.");
var error;
try { tag.init().nibbleType("{widget foo"); }
catch(e) { error = e; }
is(typeof error, "string", "malformed tag type throws error.");
isnt(error.indexOf("Malformed"), -1, "error message tells tag is malformed.");
*/
/**
Find and shift off the name of a tag.
@requires frame/String.js
@param {string} src
@return src
*/
JSDOC.DocTag.prototype.nibbleName = function(src) {
if (typeof src != "string") throw "src must be a string not "+(typeof src);
src = src.trim();
// is optional?
if (src.charAt(0) == "[") {
var nameRange = src.balance("[", "]");
if (nameRange[1] == -1) {
throw "Malformed comment tag ignored. Tag optional name requires an opening [ and a closing ]: "+src;
}
this.name = src.substring(nameRange[0]+1, nameRange[1]).trim();
this.isOptional = true;
src = src.substring(nameRange[1]+1);
// has default value?
var nameAndValue = this.name.split("=");
if (nameAndValue.length) {
this.name = nameAndValue.shift().trim();
this.defaultValue = nameAndValue.join("=");
}
}
else {
var parts = src.match(/^(\S+)(?:\s([\s\S]*))?$/);
if (parts) {
if (parts[1]) this.name = parts[1];
if (parts[2]) src = parts[2].trim();
else src = "";
}
}
return src;
}
/*t:
requires("../frame/String.js");
plan(9, "testing JSDOC.DocTag.parser.nibbleName");
var tag = new JSDOC.DocTag();
tag.init().nibbleName("[foo] This is a description.");
is(tag.isOptional, true, "isOptional syntax is detected.");
is(tag.name, "foo", "optional param name is found.");
tag.init().nibbleName("[foo] This is a description.");
is(tag.isOptional, true, "isOptional syntax is detected when no type.");
is(tag.name, "foo", "optional param name is found when no type.");
tag.init().nibbleName("[foo=7] This is a description.");
is(tag.name, "foo", "optional param name is found when default value.");
is(tag.defaultValue, 7, "optional param default value is found when default value.");
//tag.init().nibbleName("[foo= a value] This is a description.");
//is(tag.defaultValue, " a value", "optional param default value is found when default value has spaces (issue #112).");
tag.init().nibbleName("[foo=[]] This is a description.");
is(tag.defaultValue, "[]", "optional param default value is found when default value is [] (issue #95).");
tag.init().nibbleName("[foo=a=b] This is a description.");
is(tag.name, "foo", "optional param name is found when default value is a=b.");
is(tag.defaultValue, "a=b", "optional param default value is found when default value is a=b.")
*/
/*t:
plan(32, "Testing JSDOC.DocTag.parser.");
requires("../frame/String.js");
var tag = new JSDOC.DocTag();
is(typeof tag, "object", "JSDOC.DocTag.parser with an empty string returns an object.");
is(typeof tag.title, "string", "returned object has a string property 'title'.");
is(typeof tag.type, "string", "returned object has a string property 'type'.");
is(typeof tag.name, "string", "returned object has a string property 'name'.");
is(typeof tag.defaultValue, "string", "returned object has a string property 'defaultValue'.");
is(typeof tag.isOptional, "boolean", "returned object has a boolean property 'isOptional'.");
is(typeof tag.desc, "string", "returned object has a string property 'desc'.");
tag = new JSDOC.DocTag("param {widget} foo");
is(tag.title, "param", "param title is found.");
is(tag.name, "foo", "param name is found when desc is missing.");
is(tag.desc, "", "param desc is empty when missing.");
tag = new JSDOC.DocTag("param {object} date A valid date.");
is(tag.name, "date", "param name is found with a type.");
is(tag.type, "object", "param type is found.");
is(tag.desc, "A valid date.", "param desc is found with a type.");
tag = new JSDOC.DocTag("param aName a description goes\n here.");
is(tag.name, "aName", "param name is found without a type.");
is(tag.desc, "a description goes\n here.", "param desc is found without a type.");
tag = new JSDOC.DocTag("param {widget}");
is(tag.name, "", "param name is empty when it is not given.");
tag = new JSDOC.DocTag("param {widget} [foo] This is a description.");
is(tag.name, "foo", "optional param name is found.");
tag = new JSDOC.DocTag("return {aType} This is a description.");
is(tag.type, "aType", "when return tag has no name, type is found.");
is(tag.desc, "This is a description.", "when return tag has no name, desc is found.");
tag = new JSDOC.DocTag("author Joe Coder <jcoder@example.com>");
is(tag.title, "author", "author tag has a title.");
is(tag.type, "", "the author tag has no type.");
is(tag.name, "", "the author tag has no name.");
is(tag.desc, "Joe Coder <jcoder@example.com>", "author tag has desc.");
tag = new JSDOC.DocTag("private \t\n ");
is(tag.title, "private", "private tag has a title.");
is(tag.type, "", "the private tag has no type.");
is(tag.name, "", "the private tag has no name.");
is(tag.desc, "", "private tag has no desc.");
tag = new JSDOC.DocTag("example\n example(code);\n more();");
is(tag.desc, " example(code);\n more();", "leading whitespace (less one) in examples code is preserved.");
tag = new JSDOC.DocTag("param theName \n");
is(tag.name, "theName", "name only is found.");
tag = new JSDOC.DocTag("type theDesc \n");
is(tag.desc, "theDesc", "desc only is found.");
tag = new JSDOC.DocTag("type {theType} \n");
is(tag.type, "theType", "type only is found.");
tag = new JSDOC.DocTag("");
is(tag.title, "", "title is empty when tag is empty.");
*/

View File

@ -1,162 +0,0 @@
/**
@constructor
@param [opt] Used to override the commandline options. Useful for testing.
@version $Id: JsDoc.js 592 2008-05-09 07:43:33Z micmath $
*/
JSDOC.JsDoc = function(/**object*/ opt) {
if (opt) {
JSDOC.opt = opt;
}
// the -c option: use a configuration file
if (JSDOC.opt.c) {
eval("JSDOC.conf = " + IO.readFile(JSDOC.opt.c));
LOG.inform("Using configuration file at '"+JSDOC.opt.c+"'.");
for (var c in JSDOC.conf) {
if (c !== "D" && !defined(JSDOC.opt[c])) { // commandline overrules config file
JSDOC.opt[c] = JSDOC.conf[c];
}
}
if (typeof JSDOC.conf["_"] != "undefined") {
JSDOC.opt["_"] = JSDOC.opt["_"].concat(JSDOC.conf["_"]);
}
LOG.inform("With configuration: ");
for (var o in JSDOC.opt) {
LOG.inform(" "+o+": "+JSDOC.opt[o]);
}
}
if (JSDOC.opt.h) {
JSDOC.usage();
quit();
}
// defend against options that are not sane
if (JSDOC.opt._.length == 0) {
LOG.warn("No source files to work on. Nothing to do.");
quit();
}
if (JSDOC.opt.t === true || JSDOC.opt.d === true) {
JSDOC.usage();
}
if (typeof JSDOC.opt.d == "string") {
if (!JSDOC.opt.d.charAt(JSDOC.opt.d.length-1).match(/[\\\/]/)) {
JSDOC.opt.d = JSDOC.opt.d+"/";
}
LOG.inform("Output directory set to '"+JSDOC.opt.d+"'.");
IO.mkPath(JSDOC.opt.d);
}
if (JSDOC.opt.e) IO.setEncoding(JSDOC.opt.e);
// the -r option: scan source directories recursively
if (typeof JSDOC.opt.r == "boolean") JSDOC.opt.r = 10;
else if (!isNaN(parseInt(JSDOC.opt.r))) JSDOC.opt.r = parseInt(JSDOC.opt.r);
else JSDOC.opt.r = 1;
// the -D option: define user variables
var D = {};
if (JSDOC.opt.D) {
for (var i = 0; i < JSDOC.opt.D.length; i++) {
var defineParts = JSDOC.opt.D[i].split(":", 2);
if (defineParts) D[defineParts[0]] = defineParts[1];
}
}
JSDOC.opt.D = D;
// combine any conf file D options with the commandline D options
if (defined(JSDOC.conf)) for (var c in JSDOC.conf.D) {
if (!defined(JSDOC.opt.D[c])) {
JSDOC.opt.D[c] = JSDOC.conf.D[c];
}
}
// Load additional file handlers
// the -H option: filetype handlers
JSDOC.handlers = {};
/*
if (JSDOC.opt.H) {
for (var i = 0; i < JSDOC.opt.H.length; i++) {
var handlerDef = JSDOC.opt.H[i].split(":");
LOG.inform("Adding '." + handlerDef[0] + "' content handler from handlers/" + handlerDef[1] + ".js");
IO.include("handlers/" + handlerDef[1] + ".js");
if (!eval("typeof "+handlerDef[1])) {
LOG.warn(handlerDef[1] + "is not defined in "+handlerDef[1] + ".js");
}
else {
JSDOC.handlers[handlerDef[0]] = eval(handlerDef[1]);
}
}
}
*/
// Give plugins a chance to initialize
if (defined(JSDOC.PluginManager)) {
JSDOC.PluginManager.run("onInit", this);
}
JSDOC.opt.srcFiles = this._getSrcFiles();
this._parseSrcFiles();
//var handler = symbols.handler;
this.symbolSet = JSDOC.Parser.symbols;
//this.symbolGroup.handler = handler;
}
/**
Retrieve source file list.
@returns {String[]} The pathnames of the files to be parsed.
*/
JSDOC.JsDoc.prototype._getSrcFiles = function() {
this.srcFiles = [];
var ext = ["js"];
if (JSDOC.opt.x) {
ext = JSDOC.opt.x.split(",").map(function($) {return $.toLowerCase()});
}
for (var i = 0; i < JSDOC.opt._.length; i++) {
this.srcFiles = this.srcFiles.concat(
IO.ls(JSDOC.opt._[i], JSDOC.opt.r).filter(
function($) {
var thisExt = $.split(".").pop().toLowerCase();
return (ext.indexOf(thisExt) > -1 || thisExt in JSDOC.handlers); // we're only interested in files with certain extensions
}
)
);
}
return this.srcFiles;
}
JSDOC.JsDoc.prototype._parseSrcFiles = function() {
JSDOC.Parser.init();
for (var i = 0, l = this.srcFiles.length; i < l; i++) {
var srcFile = this.srcFiles[i];
try {
var src = IO.readFile(srcFile);
}
catch(e) {
LOG.warn("Can't read source file '"+srcFile+"': "+e.message);
}
// Check to see if there is a handler for this file type
// var ext = FilePath.fileExtension(srcFile);
// if (JSDOC.handlers[ext]) {
// LOG.inform(" Using external handler for '" + ext + "'");
//
// symbols = symbols.concat(JSDOC.handlers[ext].handle(srcFile, src));
// symbols.handler = JSDOC.handlers[ext];
// }
// else {
// The default (JSDOC) handler
var tr = new JSDOC.TokenReader();
var ts = new JSDOC.TokenStream(tr.tokenize(new JSDOC.TextStream(src)));
JSDOC.Parser.parse(ts, srcFile);
// }
}
JSDOC.Parser.finish();
}

View File

@ -1,100 +0,0 @@
/**
@constructor
*/
JSDOC.JsPlate = function(templateFile) {
if (templateFile) this.template = IO.readFile(templateFile);
this.templateFile = templateFile;
this.code = "";
this.parse();
}
JSDOC.JsPlate.prototype.parse = function() {
this.template = this.template.replace(/\{#[\s\S]+?#\}/gi, "");
this.code = "var output=``"+this.template;
this.code = this.code.replace(
/<for +each="(.+?)" +in="(.+?)" *>/gi,
function (match, eachName, inName) {
return "``;\rvar $"+eachName+"_keys = keys("+inName+");\rfor(var $"+eachName+"_i = 0; $"+eachName+"_i < $"+eachName+"_keys.length; $"+eachName+"_i++) {\rvar $"+eachName+"_last = ($"+eachName+"_i == $"+eachName+"_keys.length-1);\rvar $"+eachName+"_key = $"+eachName+"_keys[$"+eachName+"_i];\rvar "+eachName+" = "+inName+"[$"+eachName+"_key];\routput+=``";
}
);
this.code = this.code.replace(/<if test="(.+?)">/g, "``;\rif ($1) { output+=``");
this.code = this.code.replace(/<elseif test="(.+?)"\s*\/>/g, "``;}\relse if ($1) { output+=``");
this.code = this.code.replace(/<else\s*\/>/g, "``;}\relse { output+=``");
this.code = this.code.replace(/<\/(if|for)>/g, "``;\r};\routput+=``");
this.code = this.code.replace(
/\{\+\s*([\s\S]+?)\s*\+\}/gi,
function (match, code) {
code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
code = code.replace(/(\r?\n)/g, " ");
return "``+ ("+code+") +``";
}
);
this.code = this.code.replace(
/\{!\s*([\s\S]+?)\s*!\}/gi,
function (match, code) {
code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
code = code.replace(/(\n)/g, " ");
return "``; "+code+";\routput+=``";
}
);
this.code = this.code+"``;";
this.code = this.code.replace(/(\r?\n)/g, "\\n");
this.code = this.code.replace(/"/g, "\\\"");
this.code = this.code.replace(/``/g, "\"");
}
JSDOC.JsPlate.prototype.toCode = function() {
return this.code;
}
JSDOC.JsPlate.keys = function(obj) {
var keys = [];
if (obj.constructor.toString().indexOf("Array") > -1) {
for (var i = 0; i < obj.length; i++) {
keys.push(i);
}
}
else {
for (var i in obj) {
keys.push(i);
}
}
return keys;
};
JSDOC.JsPlate.values = function(obj) {
var values = [];
if (obj.constructor.toString().indexOf("Array") > -1) {
for (var i = 0; i < obj.length; i++) {
values.push(obj[i]);
}
}
else {
for (var i in obj) {
values.push(obj[i]);
}
}
return values;
};
JSDOC.JsPlate.prototype.process = function(data) {
var keys = JSDOC.JsPlate.keys;
var values = JSDOC.JsPlate.values;
try {
eval(this.code);
}
catch (e) {
print(">> There was an error evaluating the compiled code from template: "+this.templateFile);
print(" The error was on line "+e.lineNumber+" "+e.name+": "+e.message);
var lines = this.code.split("\r");
if (e.lineNumber-2 >= 0) print("line "+(e.lineNumber-1)+": "+lines[e.lineNumber-2]);
print("line "+e.lineNumber+": "+lines[e.lineNumber-1]);
print("");
}
/*debug*///print(this.code);
return output;
}

View File

@ -1,144 +0,0 @@
/**
@namespace
*/
JSDOC.Lang = {
}
JSDOC.Lang.isBuiltin = function(name) {
return (JSDOC.Lang.isBuiltin.coreObjects.indexOf(name) > -1);
}
JSDOC.Lang.isBuiltin.coreObjects = ['_global_', 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String'];
JSDOC.Lang.whitespace = function(ch) {
return JSDOC.Lang.whitespace.names[ch];
}
JSDOC.Lang.whitespace.names = {
" ": "SPACE",
"\f": "FORMFEED",
"\t": "TAB",
"\u0009": "UNICODE_TAB",
"\u000A": "UNICODE_NBR",
"\u0008": "VERTICAL_TAB"
};
JSDOC.Lang.newline = function(ch) {
return JSDOC.Lang.newline.names[ch];
}
JSDOC.Lang.newline.names = {
"\n": "NEWLINE",
"\r": "RETURN",
"\u000A": "UNICODE_LF",
"\u000D": "UNICODE_CR",
"\u2029": "UNICODE_PS",
"\u2028": "UNICODE_LS"
};
JSDOC.Lang.keyword = function(word) {
return JSDOC.Lang.keyword.names["="+word];
}
JSDOC.Lang.keyword.names = {
"=break": "BREAK",
"=case": "CASE",
"=catch": "CATCH",
"=const": "VAR",
"=continue": "CONTINUE",
"=default": "DEFAULT",
"=delete": "DELETE",
"=do": "DO",
"=else": "ELSE",
"=false": "FALSE",
"=finally": "FINALLY",
"=for": "FOR",
"=function": "FUNCTION",
"=if": "IF",
"=in": "IN",
"=instanceof": "INSTANCEOF",
"=new": "NEW",
"=null": "NULL",
"=return": "RETURN",
"=switch": "SWITCH",
"=this": "THIS",
"=throw": "THROW",
"=true": "TRUE",
"=try": "TRY",
"=typeof": "TYPEOF",
"=void": "VOID",
"=while": "WHILE",
"=with": "WITH",
"=var": "VAR"
};
JSDOC.Lang.punc = function(ch) {
return JSDOC.Lang.punc.names[ch];
}
JSDOC.Lang.punc.names = {
";": "SEMICOLON",
",": "COMMA",
"?": "HOOK",
":": "COLON",
"||": "OR",
"&&": "AND",
"|": "BITWISE_OR",
"^": "BITWISE_XOR",
"&": "BITWISE_AND",
"===": "STRICT_EQ",
"==": "EQ",
"=": "ASSIGN",
"!==": "STRICT_NE",
"!=": "NE",
"<<": "LSH",
"<=": "LE",
"<": "LT",
">>>": "URSH",
">>": "RSH",
">=": "GE",
">": "GT",
"++": "INCREMENT",
"--": "DECREMENT",
"+": "PLUS",
"-": "MINUS",
"*": "MUL",
"/": "DIV",
"%": "MOD",
"!": "NOT",
"~": "BITWISE_NOT",
".": "DOT",
"[": "LEFT_BRACKET",
"]": "RIGHT_BRACKET",
"{": "LEFT_CURLY",
"}": "RIGHT_CURLY",
"(": "LEFT_PAREN",
")": "RIGHT_PAREN"
};
JSDOC.Lang.matching = function(name) {
return JSDOC.Lang.matching.names[name];
}
JSDOC.Lang.matching.names = {
"LEFT_PAREN": "RIGHT_PAREN",
"RIGHT_PAREN": "LEFT_PAREN",
"LEFT_CURLY": "RIGHT_CURLY",
"RIGHT_CURLY": "LEFT_CURLY",
"LEFT_BRACE": "RIGHT_BRACE",
"RIGHT_BRACE": "LEFT_BRACE"
}
JSDOC.Lang.isNumber = function(str) {
return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str);
}
JSDOC.Lang.isHexDec = function(str) {
return /^0x[0-9A-F]+$/i.test(str);
}
JSDOC.Lang.isWordChar = function(str) {
return /^[a-zA-Z0-9$_.]+$/.test(str);
}
JSDOC.Lang.isSpace = function(str) {
return (typeof JSDOC.Lang.whitespace(str) != "undefined");
}
JSDOC.Lang.isNewline = function(str) {
return (typeof JSDOC.Lang.newline(str) != "undefined");
}

View File

@ -1,109 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/**
@namespace
@requires JSDOC.Walker
@requires JSDOC.Symbol
@requires JSDOC.DocComment
*/
JSDOC.Parser = {
conf: {
ignoreCode: JSDOC.opt.n,
ignoreAnonymous: true, // factory: true
treatUnderscoredAsPrivate: true, // factory: true
explain: false // factory: false
},
addSymbol: function(symbol) {
// if a symbol alias is documented more than once the last one with the user docs wins
if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) {
var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias);
if (oldSymbol.comment.isUserComment) {
if (symbol.comment.isUserComment) { // old and new are both documented
LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
}
else { // old is documented but new isn't
return;
}
}
}
// we don't document anonymous things
if (JSDOC.Parser.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return;
// uderscored things may be treated as if they were marked private, this cascades
if (JSDOC.Parser.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) {
symbol.isPrivate = true;
}
// -p flag is required to document private things
if ((symbol.isInner || symbol.isPrivate) && !JSDOC.opt.p) return;
// ignored things are not documented, this doesn't cascade
if (symbol.isIgnored) return;
JSDOC.Parser.symbols.addSymbol(symbol);
},
addBuiltin: function(name) {
var builtin = new JSDOC.Symbol(name, [], "CONSTRUCTOR", new JSDOC.DocComment(""));
builtin.isNamespace = true;
builtin.srcFile = "";
builtin.isPrivate = false;
JSDOC.Parser.addSymbol(builtin);
return builtin;
},
init: function() {
JSDOC.Parser.symbols = new JSDOC.SymbolSet();
JSDOC.Parser.walker = new JSDOC.Walker();
},
finish: function() {
JSDOC.Parser.symbols.relate();
// make a litle report about what was found
if (JSDOC.Parser.conf.explain) {
var symbols = JSDOC.Parser.symbols.toArray();
var srcFile = "";
for (var i = 0, l = symbols.length; i < l; i++) {
var symbol = symbols[i];
if (srcFile != symbol.srcFile) {
srcFile = symbol.srcFile;
print("\n"+srcFile+"\n-------------------");
}
print(i+":\n alias => "+symbol.alias + "\n name => "+symbol.name+ "\n isa => "+symbol.isa + "\n memberOf => " + symbol.memberOf + "\n isStatic => " + symbol.isStatic + ", isInner => " + symbol.isInner);
}
print("-------------------\n");
}
}
}
JSDOC.Parser.parse = function(/**JSDOC.TokenStream*/ts, /**String*/srcFile) {
JSDOC.Symbol.srcFile = (srcFile || "");
JSDOC.DocComment.shared = ""; // shared comments don't cross file boundaries
if (!JSDOC.Parser.walker) JSDOC.Parser.init();
JSDOC.Parser.walker.walk(ts); // adds to our symbols
// filter symbols by option
for (p in JSDOC.Parser.symbols._index) {
var symbol = JSDOC.Parser.symbols.getSymbol(p);
if (!symbol) continue;
if (symbol.is("FILE") || symbol.is("GLOBAL")) {
continue;
}
else if (!JSDOC.opt.a && !symbol.comment.isUserComment) {
JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
}
if (/#$/.test(symbol.alias)) { // we don't document prototypes
JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
}
}
return JSDOC.Parser.symbols.toArray();
}

View File

@ -1,33 +0,0 @@
/**
@namespace Holds functionality related to running plugins.
*/
JSDOC.PluginManager = {
}
/**
@param name A unique name that identifies that plugin.
@param handlers A collection of named functions. The names correspond to hooks in the core code.
*/
JSDOC.PluginManager.registerPlugin = function(/**String*/name, /**Object*/handlers) {
if (!defined(JSDOC.PluginManager.plugins))
/** The collection of all plugins. Requires a unique name for each.
*/
JSDOC.PluginManager.plugins = {};
JSDOC.PluginManager.plugins[name] = handlers;
}
/**
@param hook The name of the hook that is being caught.
@param target Any object. This will be passed as the only argument to the handler whose
name matches the hook name. Handlers cannot return a value, so must modify the target
object to have an effect.
*/
JSDOC.PluginManager.run = function(/**String*/hook, /**Mixed*/target) {
for (var name in JSDOC.PluginManager.plugins) {
if (defined(JSDOC.PluginManager.plugins[name][hook])) {
JSDOC.PluginManager.plugins[name][hook](target);
}
}
}

View File

@ -1,600 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/**
Create a new Symbol.
@class Represents a symbol in the source code.
*/
JSDOC.Symbol = function() {
this.init();
if (arguments.length) this.populate.apply(this, arguments);
}
JSDOC.Symbol.prototype.init = function() {
this.$args = [];
this.addOn = "";
this.alias = "";
this.augments = [];
this.author = "";
this.classDesc = "";
this.comment = {};
this.defaultValue = undefined;
this.deprecated = "";
this.desc = "";
this.events = [];
this.example = [];
this.exceptions = [];
this.inherits = [];
this.inheritsFrom = [];
this.isa = "OBJECT";
this.isEvent = false;
this.isConstant = false;
this.isIgnored = false;
this.isInner = false;
this.isNamespace = false;
this.isPrivate = false;
this.isStatic = false;
this.memberOf = "";
this.methods = [];
this._name = "";
this._params = [];
this.properties = [];
this.requires = [];
this.returns = [];
this.see = [];
this.since = "";
this.srcFile = {};
this.type = "";
this.version = "";
}
JSDOC.Symbol.prototype.serialize = function() {
var keys = [];
for (var p in this) {
keys.push (p);
}
keys = keys.sort();
var out = "";
for (var i in keys) {
if (typeof this[keys[i]] == "function") continue;
out += keys[i]+" => "+Dumper.dump(this[keys[i]])+",\n";
}
return "\n{\n" + out + "}\n";
}
JSDOC.Symbol.prototype.clone = function() {
var clone = new JSDOC.Symbol();
clone.populate.apply(clone, this.$args); // repopulate using the original arguments
clone.srcFile = this.srcFile; // not the current srcFile, the one when the original was made
return clone;
}
JSDOC.Symbol.prototype.__defineSetter__("name",
function(n) { n = n.replace(/^_global_[.#-]/, ""); n = n.replace(/\.prototype\.?/g, '#'); this._name = n; }
);
JSDOC.Symbol.prototype.__defineGetter__("name",
function() { return this._name; }
);
JSDOC.Symbol.prototype.__defineSetter__("params",
function(v) {
for (var i = 0, l = v.length; i < l; i++) {
if (v[i].constructor != JSDOC.DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
this._params[i] = new JSDOC.DocTag("param"+((v[i].type)?" {"+v[i].type+"}":"")+" "+v[i].name);
}
else {
this._params[i] = v[i];
}
}
}
);
JSDOC.Symbol.prototype.__defineGetter__("params",
function() { return this._params; }
);
JSDOC.Symbol.prototype.populate = function(
/** String */ name,
/** Object[] */ params,
/** String */ isa,
/** JSDOC.DocComment */ comment
) {
this.$args = arguments;
this.name = name;
this.alias = this.name;
this.params = params;
this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
this.comment = comment || new JSDOC.DocComment("");
this.srcFile = JSDOC.Symbol.srcFile;
if (this.is("FILE") && !this.alias) this.alias = this.srcFile;
this.setTags();
if (typeof JSDOC.PluginManager != "undefined") {
JSDOC.PluginManager.run("onSymbol", this);
}
}
JSDOC.Symbol.prototype.setTags = function() {
// @author
var authors = this.comment.getTag("author");
if (authors.length) {
this.author = authors.map(function($){return $.desc;}).join(", ");
}
/*t:
plan(34, "testing JSDOC.Symbol");
requires("../lib/JSDOC/DocComment.js");
requires("../frame/String.js");
requires("../lib/JSDOC/DocTag.js");
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@author Joe Smith*"+"/"));
is(sym.author, "Joe Smith", "@author tag, author is found.");
*/
// @desc
var descs = this.comment.getTag("desc");
if (descs.length) {
this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@desc This is a description.*"+"/"));
is(sym.desc, "This is a description.", "@desc tag, description is found.");
*/
// @overview
if (this.is("FILE")) {
if (!this.alias) this.alias = this.srcFile;
var overviews = this.comment.getTag("overview");
if (overviews.length) {
this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n");
}
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@overview This is an overview.*"+"/"));
is(sym.desc, "\nThis is an overview.", "@overview tag, description is found.");
*/
// @since
var sinces = this.comment.getTag("since");
if (sinces.length) {
this.since = sinces.map(function($){return $.desc;}).join(", ");
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@since 1.01*"+"/"));
is(sym.since, "1.01", "@since tag, description is found.");
*/
// @constant
if (this.comment.getTag("constant").length) {
this.isConstant = true;
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@constant*"+"/"));
is(sym.isConstant, true, "@constant tag, isConstant set.");
*/
// @version
var versions = this.comment.getTag("version");
if (versions.length) {
this.version = versions.map(function($){return $.desc;}).join(", ");
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@version 2.0x*"+"/"));
is(sym.version, "2.0x", "@version tag, version is found.");
*/
// @deprecated
var deprecateds = this.comment.getTag("deprecated");
if (deprecateds.length) {
this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n");
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@deprecated Use other method.*"+"/"));
is(sym.deprecated, "Use other method.", "@deprecated tag, desc is found.");
*/
// @example
var examples = this.comment.getTag("example");
if (examples.length) {
this.example = examples.map(
// trim trailing whitespace
function($) {
$.desc = $.desc.replace(/\s+$/, "");
return $;
}
);
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@example This\n is an example. \n*"+"/"));
isnt(typeof sym.example[0], "undefined", "@example tag, creates sym.example array.");
is(sym.example[0], "This\n is an example.", "@example tag, desc is found.");
*/
// @see
var sees = this.comment.getTag("see");
if (sees.length) {
var thisSee = this.see;
sees.map(function($){thisSee.push($.desc);});
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@see The other thing.*"+"/"));
is(sym.see, "The other thing.", "@see tag, desc is found.");
*/
// @class
var classes = this.comment.getTag("class");
if (classes.length) {
this.isa = "CONSTRUCTOR";
this.classDesc = classes[0].desc; // desc can't apply to the constructor as there is none.
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@class This describes the class.*"+"/"));
is(sym.isa, "CONSTRUCTOR", "@class tag, makes symbol a constructor.");
is(sym.classDesc, "This describes the class.", "@class tag, class description is found.");
*/
// @namespace
var namespaces = this.comment.getTag("namespace");
if (namespaces.length) {
this.classDesc = namespaces[0].desc+"\n"+this.desc; // desc can't apply to the constructor as there is none.
this.isNamespace = true;
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@namespace This describes the namespace.*"+"/"));
is(sym.classDesc, "This describes the namespace.\n", "@namespace tag, class description is found.");
*/
// @param
var params = this.comment.getTag("param");
if (params.length) {
// user-defined params overwrite those with same name defined by the parser
var thisParams = this.params;
if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in
this.params = params;
}
else { // need to overlay these user-defined params on to existing parser-defined params
for (var i = 0, l = params.length; i < l; i++) {
if (thisParams[i]) {
if (params[i].type) thisParams[i].type = params[i].type;
thisParams[i].name = params[i].name;
thisParams[i].desc = params[i].desc;
thisParams[i].isOptional = params[i].isOptional;
thisParams[i].defaultValue = params[i].defaultValue;
}
else thisParams[i] = params[i];
}
}
}
/*t:
var sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.*"+"/"));
is(sym.params.length, 1, "parser defined param is found.");
sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages*"+"/"));
is(sym.params.length, 1, "user defined param is found.");
is(sym.params[0].type, "array", "user defined param type is found.");
is(sym.params[0].name, "pages", "user defined param name is found.");
sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
is(sym.params.length, 1, "user defined param overwrites parser defined param.");
is(sym.params[0].type, "string", "user defined param type overwrites parser defined param type.");
is(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name.");
sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
is(sym.params.length, 2, "user defined params overlay parser defined params.");
is(sym.params[1].type, "number", "user defined param type overlays parser defined param type.");
is(sym.params[1].name, "count", "user defined param name overlays parser defined param name.");
sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages The pages description.*"+"/"));
is(sym.params.length, 1, "user defined param with description is found.");
is(sym.params[0].desc, "The pages description.", "user defined param description is found.");
*/
// @constructor
if (this.comment.getTag("constructor").length) {
this.isa = "CONSTRUCTOR";
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@constructor*"+"/"));
is(sym.isa, "CONSTRUCTOR", "@constructor tag, makes symbol a constructor.");
*/
// @static
if (this.comment.getTag("static").length) {
this.isStatic = true;
if (this.isa == "CONSTRUCTOR") {
this.isNamespace = true;
}
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@static\n@constructor*"+"/"));
is(sym.isStatic, true, "@static tag, makes isStatic true.");
is(sym.isNamespace, true, "@static and @constructor tag, makes isNamespace true.");
*/
// @inner
if (this.comment.getTag("inner").length) {
this.isInner = true;
this.isStatic = false;
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@inner*"+"/"));
is(sym.isStatic, false, "@inner tag, makes isStatic false.");
is(sym.isInner, true, "@inner makes isInner true.");
*/
// @field
if (this.comment.getTag("field").length) {
this.isa = "OBJECT";
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**@field*"+"/"));
is(sym.isa, "OBJECT", "@field tag, makes symbol an object.");
*/
// @function
if (this.comment.getTag("function").length) {
this.isa = "FUNCTION";
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@function*"+"/"));
is(sym.isa, "FUNCTION", "@function tag, makes symbol a function.");
*/
// @event
var events = this.comment.getTag("event");
if (events.length) {
this.isa = "FUNCTION";
this.isEvent = true;
}
/*t:
var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@event*"+"/"));
is(sym.isa, "FUNCTION", "@event tag, makes symbol a function.");
is(sym.isEvent, true, "@event makes isEvent true.");
*/
// @name
var names = this.comment.getTag("name");
if (names.length) {
this.name = names[0].desc;
}
/*t:
// todo
*/
// @property
var properties = this.comment.getTag("property");
if (properties.length) {
thisProperties = this.properties;
for (var i = 0; i < properties.length; i++) {
var property = new JSDOC.Symbol(this.alias+"#"+properties[i].name, [], "OBJECT", new JSDOC.DocComment("/**"+properties[i].desc+"\n@name "+properties[i].name+"\n@memberOf "+this.alias+"#*/"));
// TODO: shouldn't the following happen in the addProperty method of Symbol?
property.name = properties[i].name;
property.memberOf = this.alias;
if (properties[i].type) property.type = properties[i].type;
if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue;
this.addProperty(property);
JSDOC.Parser.addSymbol(property);
}
}
/*t:
// todo
*/
// @return
var returns = this.comment.getTag("return");
if (returns.length) { // there can be many return tags in a single doclet
this.returns = returns;
this.type = returns.map(function($){return $.type}).join(", ");
}
/*t:
// todo
*/
// @exception
this.exceptions = this.comment.getTag("throws");
/*t:
// todo
*/
// @requires
var requires = this.comment.getTag("requires");
if (requires.length) {
this.requires = requires.map(function($){return $.desc});
}
/*t:
// todo
*/
// @type
var types = this.comment.getTag("type");
if (types.length) {
this.type = types[0].desc; //multiple type tags are ignored
}
/*t:
// todo
*/
// @private
if (this.comment.getTag("private").length || this.isInner) {
this.isPrivate = true;
}
// @ignore
if (this.comment.getTag("ignore").length) {
this.isIgnored = true;
}
/*t:
// todo
*/
// @inherits ... as ...
var inherits = this.comment.getTag("inherits");
if (inherits.length) {
for (var i = 0; i < inherits.length; i++) {
if (/^\s*([a-z$0-9_.#-]+)(?:\s+as\s+([a-z$0-9_.#]+))?/i.test(inherits[i].desc)) {
var inAlias = RegExp.$1;
var inAs = RegExp.$2 || inAlias;
if (inAlias) inAlias = inAlias.replace(/\.prototype\.?/g, "#");
if (inAs) {
inAs = inAs.replace(/\.prototype\.?/g, "#");
inAs = inAs.replace(/^this\.?/, "#");
}
if (inAs.indexOf(inAlias) != 0) { //not a full namepath
var joiner = ".";
if (this.alias.charAt(this.alias.length-1) == "#" || inAs.charAt(0) == "#") {
joiner = "";
}
inAs = this.alias + joiner + inAs;
}
}
this.inherits.push({alias: inAlias, as: inAs});
}
}
/*t:
// todo
*/
// @augments
this.augments = this.comment.getTag("augments");
// @default
var defaults = this.comment.getTag("default");
if (defaults.length) {
if (this.is("OBJECT")) {
this.defaultValue = defaults[0].desc;
}
}
/*t:
// todo
*/
// @memberOf
var memberOfs = this.comment.getTag("memberOf");
if (memberOfs.length) {
this.memberOf = memberOfs[0].desc;
this.memberOf = this.memberOf.replace(/\.prototype\.?/g, "#");
}
/*t:
// todo
*/
// @public
if (this.comment.getTag("public").length) {
this.isPrivate = false;
}
/*t:
// todo
*/
}
JSDOC.Symbol.prototype.is = function(what) {
return this.isa === what;
}
JSDOC.Symbol.prototype.isBuiltin = function() {
return JSDOC.Lang.isBuiltin(this.alias);
}
JSDOC.Symbol.prototype.setType = function(/**String*/comment, /**Boolean*/overwrite) {
if (!overwrite && this.type) return;
var typeComment = JSDOC.DocComment.unwrapComment(comment);
this.type = typeComment;
}
JSDOC.Symbol.prototype.inherit = function(symbol) {
if (!this.hasMember(symbol.name) && !symbol.isInner) {
if (symbol.is("FUNCTION"))
this.methods.push(symbol);
else if (symbol.is("OBJECT"))
this.properties.push(symbol);
}
}
JSDOC.Symbol.prototype.hasMember = function(name) {
return (this.hasMethod(name) || this.hasProperty(name));
}
JSDOC.Symbol.prototype.addMember = function(symbol) {
if (symbol.is("FUNCTION")) { this.addMethod(symbol); }
else if (symbol.is("OBJECT")) { this.addProperty(symbol); }
}
JSDOC.Symbol.prototype.hasMethod = function(name) {
var thisMethods = this.methods;
for (var i = 0, l = thisMethods.length; i < l; i++) {
if (thisMethods[i].name == name) return true;
if (thisMethods[i].alias == name) return true;
}
return false;
}
JSDOC.Symbol.prototype.addMethod = function(symbol) {
var methodAlias = symbol.alias;
var thisMethods = this.methods;
for (var i = 0, l = thisMethods.length; i < l; i++) {
if (thisMethods[i].alias == methodAlias) {
thisMethods[i] = symbol; // overwriting previous method
return;
}
}
thisMethods.push(symbol); // new method with this alias
}
JSDOC.Symbol.prototype.hasProperty = function(name) {
var thisProperties = this.properties;
for (var i = 0, l = thisProperties.length; i < l; i++) {
if (thisProperties[i].name == name) return true;
if (thisProperties[i].alias == name) return true;
}
return false;
}
JSDOC.Symbol.prototype.addProperty = function(symbol) {
var propertyAlias = symbol.alias;
var thisProperties = this.properties;
for (var i = 0, l = thisProperties.length; i < l; i++) {
if (thisProperties[i].alias == propertyAlias) {
thisProperties[i] = symbol; // overwriting previous property
return;
}
}
thisProperties.push(symbol); // new property with this alias
}
JSDOC.Symbol.srcFile = ""; //running reference to the current file being parsed

View File

@ -1,220 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/** @constructor */
JSDOC.SymbolSet = function() {
this.init();
}
JSDOC.SymbolSet.prototype.init = function() {
this._index = {};
}
JSDOC.SymbolSet.prototype.keys = function() {
var found = [];
for (var p in this._index) {
found.push(p);
}
return found;
}
JSDOC.SymbolSet.prototype.hasSymbol = function(alias) {
return this._index.hasOwnProperty(alias);
}
JSDOC.SymbolSet.prototype.addSymbol = function(symbol) {
if (this.hasSymbol(symbol.alias)) {
LOG.warn("Overwriting symbol documentation for: "+symbol.alias + ".");
}
this._index[symbol.alias] = symbol;
}
JSDOC.SymbolSet.prototype.getSymbol = function(alias) {
if (this.hasSymbol(alias)) return this._index[alias];
}
JSDOC.SymbolSet.prototype.getSymbolByName = function(name) {
for (var p in this._index) {
var symbol = this.getSymbol(p);
if (symbol.name == name) return symbol;
}
}
JSDOC.SymbolSet.prototype.toArray = function() {
var found = [];
for (var p in this._index) {
found.push(this._index[p]);
}
return found;
}
JSDOC.SymbolSet.prototype.deleteSymbol = function(alias) {
if (!this.hasSymbol(alias)) return;
delete this._index[alias];
}
JSDOC.SymbolSet.prototype.renameSymbol = function(oldName, newName) {
// todo: should check if oldname or newname already exist
this._index[newName] = this._index[oldName];
this.deleteSymbol(oldName);
this._index[newName].alias = newName;
return newName;
}
JSDOC.SymbolSet.prototype.relate = function() {
this.resolveBorrows();
this.resolveMemberOf();
this.resolveAugments();
}
JSDOC.SymbolSet.prototype.resolveBorrows = function() {
for (p in this._index) {
var symbol = this._index[p];
if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
var borrows = symbol.inherits;
for (var i = 0; i < borrows.length; i++) {
var borrowed = this.getSymbol(borrows[i].alias);
if (!borrowed) {
LOG.warn("Can't borrow undocumented "+borrows[i].alias+".");
continue;
}
var borrowAsName = borrows[i].as;
var borrowAsAlias = borrowAsName;
if (!borrowAsName) {
LOG.warn("Malformed @borrow, 'as' is required.");
continue;
}
if (borrowAsName.length > symbol.alias.length && borrowAsName.indexOf(symbol.alias) == 0) {
borrowAsName = borrowAsName.replace(borrowed.alias, "")
}
else {
var joiner = "";
if (borrowAsName.charAt(0) != "#") joiner = ".";
borrowAsAlias = borrowed.alias + joiner + borrowAsName;
}
borrowAsName = borrowAsName.replace(/^[#.]/, "");
if (this.hasSymbol(borrowAsAlias)) continue;
var clone = borrowed.clone();
clone.name = borrowAsName;
clone.alias = borrowAsAlias;
this.addSymbol(clone);
}
}
}
JSDOC.SymbolSet.prototype.resolveMemberOf = function() {
for (var p in this._index) {
var symbol = this.getSymbol(p);
if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
// the memberOf value was provided in the @memberOf tag
else if (symbol.memberOf) {
var parts = symbol.alias.match(new RegExp("^("+symbol.memberOf+"[.#-])(.+)$"));
// like foo.bar is a memberOf foo
if (parts) {
symbol.memberOf = parts[1];
symbol.name = parts[2];
}
// like bar is a memberOf foo
else {
var joiner = symbol.memberOf.charAt(symbol.memberOf.length-1);
if (!/[.#-]/.test(joiner)) symbol.memberOf += ".";
this.renameSymbol(p, symbol.memberOf + symbol.name);
}
}
// the memberOf must be calculated
else {
var parts = symbol.alias.match(/^(.*[.#-])([^.#-]+)$/);
if (parts) {
symbol.memberOf = parts[1];
symbol.name = parts[2];
}
}
// set isStatic, isInner
if (symbol.memberOf) {
switch (symbol.memberOf.charAt(symbol.memberOf.length-1)) {
case '#' :
symbol.isStatic = false;
symbol.isInner = false;
break;
case '.' :
symbol.isStatic = true;
symbol.isInner = false;
break;
case '-' :
symbol.isStatic = false;
symbol.isInner = true;
break;
}
}
// unowned methods and fields belong to the global object
if (!symbol.is("CONSTRUCTOR") && !symbol.isNamespace && symbol.memberOf == "") {
symbol.memberOf = "_global_";
}
// clean up
if (symbol.memberOf.match(/[.#-]$/)) {
symbol.memberOf = symbol.memberOf.substr(0, symbol.memberOf.length-1);
}
// add to parent's methods or properties list
if (symbol.memberOf) {
var container = this.getSymbol(symbol.memberOf);
if (!container) {
if (JSDOC.Lang.isBuiltin(symbol.memberOf)) container = JSDOC.Parser.addBuiltin(symbol.memberOf);
else {
LOG.warn("Can't document "+symbol.name +" as a member of undocumented symbol "+symbol.memberOf+".");
}
}
if (container) container.addMember(symbol);
}
}
}
JSDOC.SymbolSet.prototype.resolveAugments = function() {
for (var p in this._index) {
var symbol = this.getSymbol(p);
if (symbol.alias == "_global_" || symbol.is("FILE")) continue;
JSDOC.SymbolSet.prototype.walk.apply(this, [symbol]);
}
}
JSDOC.SymbolSet.prototype.walk = function(symbol) {
var augments = symbol.augments;
for(var i = 0; i < augments.length; i++) {
var contributer = this.getSymbol(augments[i]);
if (contributer) {
if (contributer.augments.length) {
JSDOC.SymbolSet.prototype.walk.apply(this, [contributer]);
}
symbol.inheritsFrom.push(contributer.alias);
if (!isUnique(symbol.inheritsFrom)) {
//LOG.warn("Can't resolve augments: Circular reference: "+symbol.alias+" inherits from "+contributer.alias+" more than once.");
}
else {
var cmethods = contributer.methods;
var cproperties = contributer.properties;
for (var ci = 0, cl = cmethods.length; ci < cl; ci++)
symbol.inherit(cmethods[ci]);
for (var ci = 0, cl = cproperties.length; ci < cl; ci++)
symbol.inherit(cproperties[ci]);
}
}
else LOG.warn("Can't augment contributer: "+augments[i]+", not found.");
}
}

View File

@ -1,41 +0,0 @@
/**
@constructor
*/
JSDOC.TextStream = function(text) {
if (typeof(text) == "undefined") text = "";
text = ""+text;
this.text = text;
this.cursor = 0;
}
JSDOC.TextStream.prototype.look = function(n) {
if (typeof n == "undefined") n = 0;
if (this.cursor+n < 0 || this.cursor+n >= this.text.length) {
var result = new String("");
result.eof = true;
return result;
}
return this.text.charAt(this.cursor+n);
}
JSDOC.TextStream.prototype.next = function(n) {
if (typeof n == "undefined") n = 1;
if (n < 1) return null;
var pulled = "";
for (var i = 0; i < n; i++) {
if (this.cursor+i < this.text.length) {
pulled += this.text.charAt(this.cursor+i);
}
else {
var result = new String("");
result.eof = true;
return result;
}
}
this.cursor += n;
return pulled;
}

View File

@ -1,18 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/**
@constructor
*/
JSDOC.Token = function(data, type, name) {
this.data = data;
this.type = type;
this.name = name;
}
JSDOC.Token.prototype.toString = function() {
return "<"+this.type+" name=\""+this.name+"\">"+this.data+"</"+this.type+">";
}
JSDOC.Token.prototype.is = function(what) {
return this.name === what || this.type === what;
}

View File

@ -1,323 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/**
@class Search a {@link JSDOC.TextStream} for language tokens.
*/
JSDOC.TokenReader = function() {
this.keepDocs = true;
this.keepWhite = false;
this.keepComments = false;
}
/**
@type {JSDOC.Token[]}
*/
JSDOC.TokenReader.prototype.tokenize = function(/**JSDOC.TextStream*/stream) {
var tokens = [];
/**@ignore*/ tokens.last = function() { return tokens[tokens.length-1]; }
while (!stream.look().eof) {
if (this.read_mlcomment(stream, tokens)) continue;
if (this.read_slcomment(stream, tokens)) continue;
if (this.read_dbquote(stream, tokens)) continue;
if (this.read_snquote(stream, tokens)) continue;
if (this.read_regx(stream, tokens)) continue;
if (this.read_numb(stream, tokens)) continue;
if (this.read_punc(stream, tokens)) continue;
if (this.read_space(stream, tokens)) continue;
if (this.read_newline(stream, tokens)) continue;
if (this.read_word(stream, tokens)) continue;
// if execution reaches here then an error has happened
tokens.push(new JSDOC.Token(stream.next(), "TOKN", "UNKNOWN_TOKEN"));
}
return tokens;
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_word = function(/**JSDOC.TokenStream*/stream, tokens) {
var found = "";
while (!stream.look().eof && JSDOC.Lang.isWordChar(stream.look())) {
found += stream.next();
}
if (found === "") {
return false;
}
else {
var name;
if ((name = JSDOC.Lang.keyword(found))) tokens.push(new JSDOC.Token(found, "KEYW", name));
else tokens.push(new JSDOC.Token(found, "NAME", "NAME"));
return true;
}
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_punc = function(/**JSDOC.TokenStream*/stream, tokens) {
var found = "";
var name;
while (!stream.look().eof && JSDOC.Lang.punc(found+stream.look())) {
found += stream.next();
}
if (found === "") {
return false;
}
else {
tokens.push(new JSDOC.Token(found, "PUNC", JSDOC.Lang.punc(found)));
return true;
}
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_space = function(/**JSDOC.TokenStream*/stream, tokens) {
var found = "";
while (!stream.look().eof && JSDOC.Lang.isSpace(stream.look())) {
found += stream.next();
}
if (found === "") {
return false;
}
else {
if (this.collapseWhite) found = " ";
if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "SPACE"));
return true;
}
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_newline = function(/**JSDOC.TokenStream*/stream, tokens) {
var found = "";
while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look())) {
found += stream.next();
}
if (found === "") {
return false;
}
else {
if (this.collapseWhite) found = "\n";
if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "NEWLINE"));
return true;
}
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_mlcomment = function(/**JSDOC.TokenStream*/stream, tokens) {
if (stream.look() == "/" && stream.look(1) == "*") {
var found = stream.next(2);
while (!stream.look().eof && !(stream.look(-1) == "/" && stream.look(-2) == "*")) {
found += stream.next();
}
// to start doclet we allow /** or /*** but not /**/ or /****
if (/^\/\*\*([^\/]|\*[^*])/.test(found) && this.keepDocs) tokens.push(new JSDOC.Token(found, "COMM", "JSDOC"));
else if (this.keepComments) tokens.push(new JSDOC.Token(found, "COMM", "MULTI_LINE_COMM"));
return true;
}
return false;
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_slcomment = function(/**JSDOC.TokenStream*/stream, tokens) {
var found;
if (
(stream.look() == "/" && stream.look(1) == "/" && (found=stream.next(2)))
||
(stream.look() == "<" && stream.look(1) == "!" && stream.look(2) == "-" && stream.look(3) == "-" && (found=stream.next(4)))
) {
while (!stream.look().eof && !JSDOC.Lang.isNewline(stream.look())) {
found += stream.next();
}
if (this.keepComments) {
tokens.push(new JSDOC.Token(found, "COMM", "SINGLE_LINE_COMM"));
}
return true;
}
return false;
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_dbquote = function(/**JSDOC.TokenStream*/stream, tokens) {
if (stream.look() == "\"") {
// find terminator
var string = stream.next();
while (!stream.look().eof) {
if (stream.look() == "\\") {
if (JSDOC.Lang.isNewline(stream.look(1))) {
do {
stream.next();
} while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look()));
string += "\\\n";
}
else {
string += stream.next(2);
}
}
else if (stream.look() == "\"") {
string += stream.next();
tokens.push(new JSDOC.Token(string, "STRN", "DOUBLE_QUOTE"));
return true;
}
else {
string += stream.next();
}
}
}
return false; // error! unterminated string
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_snquote = function(/**JSDOC.TokenStream*/stream, tokens) {
if (stream.look() == "'") {
// find terminator
var string = stream.next();
while (!stream.look().eof) {
if (stream.look() == "\\") { // escape sequence
string += stream.next(2);
}
else if (stream.look() == "'") {
string += stream.next();
tokens.push(new JSDOC.Token(string, "STRN", "SINGLE_QUOTE"));
return true;
}
else {
string += stream.next();
}
}
}
return false; // error! unterminated string
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_numb = function(/**JSDOC.TokenStream*/stream, tokens) {
if (stream.look() === "0" && stream.look(1) == "x") {
return this.read_hex(stream, tokens);
}
var found = "";
while (!stream.look().eof && JSDOC.Lang.isNumber(found+stream.look())){
found += stream.next();
}
if (found === "") {
return false;
}
else {
if (/^0[0-7]/.test(found)) tokens.push(new JSDOC.Token(found, "NUMB", "OCTAL"));
else tokens.push(new JSDOC.Token(found, "NUMB", "DECIMAL"));
return true;
}
}
/*t:
requires("../lib/JSDOC/TextStream.js");
requires("../lib/JSDOC/Token.js");
requires("../lib/JSDOC/Lang.js");
plan(3, "testing JSDOC.TokenReader.prototype.read_numb");
//// setup
var src = "function foo(num){while (num+8.0 >= 0x20 && num < 0777){}}";
var tr = new JSDOC.TokenReader();
var tokens = tr.tokenize(new JSDOC.TextStream(src));
var hexToken, octToken, decToken;
for (var i = 0; i < tokens.length; i++) {
if (tokens[i].name == "HEX_DEC") hexToken = tokens[i];
if (tokens[i].name == "OCTAL") octToken = tokens[i];
if (tokens[i].name == "DECIMAL") decToken = tokens[i];
}
////
is(decToken.data, "8.0", "decimal number is found in source.");
is(hexToken.data, "0x20", "hexdec number is found in source (issue #99).");
is(octToken.data, "0777", "octal number is found in source.");
*/
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_hex = function(/**JSDOC.TokenStream*/stream, tokens) {
var found = stream.next(2);
while (!stream.look().eof) {
if (JSDOC.Lang.isHexDec(found) && !JSDOC.Lang.isHexDec(found+stream.look())) { // done
tokens.push(new JSDOC.Token(found, "NUMB", "HEX_DEC"));
return true;
}
else {
found += stream.next();
}
}
return false;
}
/**
@returns {Boolean} Was the token found?
*/
JSDOC.TokenReader.prototype.read_regx = function(/**JSDOC.TokenStream*/stream, tokens) {
if (
stream.look() == "/"
&&
(
!tokens.last()
||
(
!tokens.last().is("NUMB")
&& !tokens.last().is("NAME")
&& !tokens.last().is("RIGHT_PAREN")
&& !tokens.last().is("RIGHT_BRACKET")
)
)
) {
var regex = stream.next();
while (!stream.look().eof) {
if (stream.look() == "\\") { // escape sequence
regex += stream.next(2);
}
else if (stream.look() == "/") {
regex += stream.next();
while (/[gmi]/.test(stream.look())) {
regex += stream.next();
}
tokens.push(new JSDOC.Token(regex, "REGX", "REGX"));
return true;
}
else {
regex += stream.next();
}
}
// error: unterminated regex
}
return false;
}

View File

@ -1,133 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/**
@constructor
*/
JSDOC.TokenStream = function(tokens) {
this.tokens = (tokens || []);
this.rewind();
}
/**
@constructor
@private
*/
function VoidToken(/**String*/type) {
this.toString = function() {return "<VOID type=\""+type+"\">"};
this.is = function(){return false;}
}
JSDOC.TokenStream.prototype.rewind = function() {
this.cursor = -1;
}
/**
@type JSDOC.Token
*/
JSDOC.TokenStream.prototype.look = function(/**Number*/n, /**Boolean*/considerWhitespace) {
if (typeof n == "undefined") n = 0;
if (considerWhitespace == true) {
if (this.cursor+n < 0 || this.cursor+n > this.tokens.length) return {};
return this.tokens[this.cursor+n];
}
else {
var count = 0;
var i = this.cursor;
while (true) {
if (i < 0) return new JSDOC.Token("", "VOID", "START_OF_STREAM");
else if (i > this.tokens.length) return new JSDOC.Token("", "VOID", "END_OF_STREAM");
if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("SPACE") || this.tokens[i].is("NEWLINE"))) {
if (n < 0) i--; else i++;
continue;
}
if (count == Math.abs(n)) {
return this.tokens[i];
}
count++;
(n < 0)? i-- : i++;
}
return new JSDOC.Token("", "VOID", "STREAM_ERROR"); // because null isn't an object and caller always expects an object
}
}
/**
@type JSDOC.Token|JSDOC.Token[]
*/
JSDOC.TokenStream.prototype.next = function(/**Number*/howMany) {
if (typeof howMany == "undefined") howMany = 1;
if (howMany < 1) return null;
var got = [];
for (var i = 1; i <= howMany; i++) {
if (this.cursor+i >= this.tokens.length) {
return null;
}
got.push(this.tokens[this.cursor+i]);
}
this.cursor += howMany;
if (howMany == 1) {
return got[0];
}
else return got;
}
/**
@type JSDOC.Token[]
*/
JSDOC.TokenStream.prototype.balance = function(/**String*/start, /**String*/stop) {
if (!stop) stop = JSDOC.Lang.matching(start);
var depth = 0;
var got = [];
var started = false;
while ((token = this.look())) {
if (token.is(start)) {
depth++;
started = true;
}
if (started) {
got.push(token);
}
if (token.is(stop)) {
depth--;
if (depth == 0) return got;
}
if (!this.next()) break;
}
}
JSDOC.TokenStream.prototype.getMatchingToken = function(/**String*/start, /**String*/stop) {
var depth = 0;
var cursor = this.cursor;
if (!start) {
start = JSDOC.Lang.matching(stop);
depth = 1;
}
if (!stop) stop = JSDOC.Lang.matching(start);
while ((token = this.tokens[cursor])) {
if (token.is(start)) {
depth++;
}
if (token.is(stop) && cursor) {
depth--;
if (depth == 0) return this.tokens[cursor];
}
cursor++;
}
}
JSDOC.TokenStream.prototype.insertAhead = function(/**JSDOC.Token*/token) {
this.tokens.splice(this.cursor+1, 0, token);
}

View File

@ -1,32 +0,0 @@
/**
* @namespace
* @deprecated Use {@link FilePath} instead.
*/
JSDOC.Util = {
}
/**
* @deprecated Use {@link FilePath.fileName} instead.
*/
JSDOC.Util.fileName = function(path) {
LOG.warn("JSDOC.Util.fileName is deprecated. Use FilePath.fileName instead.");
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
return path.substring(nameStart);
}
/**
* @deprecated Use {@link FilePath.fileExtension} instead.
*/
JSDOC.Util.fileExtension = function(filename) {
LOG.warn("JSDOC.Util.fileExtension is deprecated. Use FilePath.fileExtension instead.");
return filename.split(".").pop().toLowerCase();
};
/**
* @deprecated Use {@link FilePath.dir} instead.
*/
JSDOC.Util.dir = function(path) {
LOG.warn("JSDOC.Util.dir is deprecated. Use FilePath.dir instead.");
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
return path.substring(0, nameStart-1);
}

View File

@ -1,416 +0,0 @@
if (typeof JSDOC == "undefined") JSDOC = {};
/** @constructor */
JSDOC.Walker = function(/**JSDOC.TokenStream*/ts) {
this.init();
if (typeof ts != "undefined") {
this.walk(ts);
}
}
JSDOC.Walker.prototype.init = function() {
this.ts = null;
var globalSymbol = new JSDOC.Symbol("_global_", [], "GLOBAL", new JSDOC.DocComment(""));
globalSymbol.isNamespace = true;
globalSymbol.srcFile = "";
globalSymbol.isPrivate = false;
JSDOC.Parser.addSymbol(globalSymbol);
this.lastDoc = null;
this.token = null;
/**
The chain of symbols under which we are currently nested.
@type Array
*/
this.namescope = [globalSymbol];
this.namescope.last = function(n){ if (!n) n = 0; return this[this.length-(1+n)] || "" };
}
JSDOC.Walker.prototype.walk = function(/**JSDOC.TokenStream*/ts) {
this.ts = ts;
while (this.token = this.ts.look()) {
if (this.token.popNamescope) {
var symbol = this.namescope.pop();
if (symbol.is("FUNCTION")) {
if (this.ts.look(1).is("LEFT_PAREN") && symbol.comment.getTag("function").length == 0) {
symbol.isa = "OBJECT";
}
}
}
this.step();
if (!this.ts.next()) break;
}
}
JSDOC.Walker.prototype.step = function() {
if (this.token.is("JSDOC")) { // it's a doc comment
var doc = new JSDOC.DocComment(this.token.data);
if (doc.getTag("lends").length > 0) { // it's a new namescope
var lends = doc.getTag("lends")[0];
var name = lends.desc
if (!name) throw "@lends tag requires a value.";
var symbol = new JSDOC.Symbol(name, [], "OBJECT", doc);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
this.lastDoc = null;
return true;
}
else if (doc.getTag("name").length > 0 && doc.getTag("overview").length == 0) { // it's a virtual symbol
var virtualName = doc.getTag("name")[0].desc;
if (!virtualName) throw "@name tag requires a value.";
var symbol = new JSDOC.Symbol(virtualName, [], "VIRTUAL", doc);
JSDOC.Parser.addSymbol(symbol);
this.lastDoc = null;
return true;
}
else if (doc.meta) { // it's a meta doclet
if (doc.meta == "@+") JSDOC.DocComment.shared = doc.src;
else if (doc.meta == "@-") JSDOC.DocComment.shared = "";
else if (doc.meta == "nocode+") JSDOC.Parser.conf.ignoreCode = true;
else if (doc.meta == "nocode-") JSDOC.Parser.conf.ignoreCode = JSDOC.opt.n;
else throw "Unrecognized meta comment: "+doc.meta;
this.lastDoc = null;
return true;
}
else if (doc.getTag("overview").length > 0) { // it's a file overview
symbol = new JSDOC.Symbol("", [], "FILE", doc);
JSDOC.Parser.addSymbol(symbol);
this.lastDoc = null;
return true;
}
else {
this.lastDoc = doc;
return false;
}
}
else if (!JSDOC.Parser.conf.ignoreCode) { // it's code
if (this.token.is("NAME")) {
var symbol;
var name = this.token.data;
var doc = null; if (this.lastDoc) doc = this.lastDoc;
var params = [];
// it's inside an anonymous object
if (this.ts.look(1).is("COLON") && this.ts.look(-1).is("LEFT_CURLY") && !(this.ts.look(-2).is("JSDOC") || this.namescope.last().comment.getTag("lends").length || this.ts.look(-2).is("ASSIGN") || this.ts.look(-2).is("COLON"))) {
name = "$anonymous";
name = this.namescope.last().alias+"-"+name
params = [];
symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
JSDOC.Parser.addSymbol(symbol);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken(null, "RIGHT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
// function foo() {}
else if (this.ts.look(-1).is("FUNCTION") && this.ts.look(1).is("LEFT_PAREN")) {
var isInner;
if (this.lastDoc) doc = this.lastDoc;
name = this.namescope.last().alias+"-"+name;
if (!this.namescope.last().is("GLOBAL")) isInner = true;
params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
if (isInner) symbol.isInner = true;
JSDOC.Parser.addSymbol(symbol);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
// foo = function() {}
else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("FUNCTION")) {
var isInner;
if (this.ts.look(-1).is("VAR") || this.isInner) {
name = this.namescope.last().alias+"-"+name
if (!this.namescope.last().is("GLOBAL")) isInner = true;
}
else if (name.indexOf("this.") == 0) {
name = this.resolveThis(name);
}
if (this.lastDoc) doc = this.lastDoc;
params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
if (isInner) symbol.isInner = true;
JSDOC.Parser.addSymbol(symbol);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
// foo = new function() {}
else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("NEW") && this.ts.look(3).is("FUNCTION")) {
var isInner;
if (this.ts.look(-1).is("VAR") || this.isInner) {
name = this.namescope.last().alias+"-"+name
if (!this.namescope.last().is("GLOBAL")) isInner = true;
}
else if (name.indexOf("this.") == 0) {
name = this.resolveThis(name);
}
if (this.lastDoc) doc = this.lastDoc;
params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
if (isInner) symbol.isInner = true;
JSDOC.Parser.addSymbol(symbol);
symbol.scopeType = "INSTANCE";
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
// foo: function() {}
else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("FUNCTION")) {
name = (this.namescope.last().alias+"."+name).replace("#.", "#");
if (this.lastDoc) doc = this.lastDoc;
params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
if (doc && doc.getTag("constructs").length) {
name = name.replace(/\.prototype(\.|$)/, "#");
if (name.indexOf("#") > -1) name = name.match(/(^[^#]+)/)[0];
else name = this.namescope.last().alias;
symbol = new JSDOC.Symbol(name, params, "CONSTRUCTOR", doc);
}
else {
symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
}
JSDOC.Parser.addSymbol(symbol);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
// foo = {}
else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("LEFT_CURLY")) {
var isInner;
if (this.ts.look(-1).is("VAR") || this.isInner) {
name = this.namescope.last().alias+"-"+name
if (!this.namescope.last().is("GLOBAL")) isInner = true;
}
else if (name.indexOf("this.") == 0) {
name = this.resolveThis(name);
}
if (this.lastDoc) doc = this.lastDoc;
symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
if (isInner) symbol.isInner = true;
if (doc) JSDOC.Parser.addSymbol(symbol);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
// foo = x
else if (this.ts.look(1).is("ASSIGN")) {
var isInner;
if (this.ts.look(-1).is("VAR") || this.isInner) {
name = this.namescope.last().alias+"-"+name
if (!this.namescope.last().is("GLOBAL")) isInner = true;
}
else if (name.indexOf("this.") == 0) {
name = this.resolveThis(name);
}
if (this.lastDoc) doc = this.lastDoc;
symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
if (isInner) symbol.isInner = true;
if (doc) JSDOC.Parser.addSymbol(symbol);
}
// foo: {}
else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("LEFT_CURLY")) {
name = (this.namescope.last().alias+"."+name).replace("#.", "#");
if (this.lastDoc) doc = this.lastDoc;
symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
if (doc) JSDOC.Parser.addSymbol(symbol);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
// foo: x
else if (this.ts.look(1).is("COLON")) {
name = (this.namescope.last().alias+"."+name).replace("#.", "#");;
if (this.lastDoc) doc = this.lastDoc;
symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
if (doc) JSDOC.Parser.addSymbol(symbol);
}
// foo(...)
else if (this.ts.look(1).is("LEFT_PAREN")) {
var functionCall = {name: name};
if (!this.ts.look(2).is("RIGHT_PAREN")) functionCall.arg1 = this.ts.look(2).data;
if (typeof JSDOC.PluginManager != "undefined") {
JSDOC.PluginManager.run("onFunctionCall", functionCall);
if (functionCall.doc) {
this.ts.insertAhead(new JSDOC.Token(functionCall.doc, "COMM", "JSDOC"));
}
}
}
this.lastDoc = null;
}
else if (this.token.is("FUNCTION")) { // it's an anonymous function
if (
(!this.ts.look(-1).is("COLON") || !this.ts.look(-1).is("ASSIGN"))
&& !this.ts.look(1).is("NAME")
) {
if (this.lastDoc) doc = this.lastDoc;
name = "$anonymous";
name = this.namescope.last().alias+"-"+name
params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
JSDOC.Parser.addSymbol(symbol);
this.namescope.push(symbol);
var matching = this.ts.getMatchingToken("LEFT_CURLY");
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code.");
}
}
}
return true;
}
/**
Resolves what "this." means when it appears in a name.
@param name The name that starts with "this.".
@returns The name with "this." resolved.
*/
JSDOC.Walker.prototype.resolveThis = function(name) {
name.match(/^this\.(.+)$/)
var nameFragment = RegExp.$1;
if (!nameFragment) return name;
var symbol = this.namescope.last();
var scopeType = symbol.scopeType || symbol.isa;
// if we are in a constructor function, `this` means the instance
if (scopeType == "CONSTRUCTOR") {
name = symbol.alias+"#"+nameFragment;
}
// if we are in an anonymous constructor function, `this` means the instance
else if (scopeType == "INSTANCE") {
name = symbol.alias+"."+nameFragment;
}
// if we are in a function, `this` means the container (possibly the global)
else if (scopeType == "FUNCTION") {
// in a method of a prototype, so `this` means the constructor
if (symbol.alias.match(/(^.*)[#.-][^#.-]+/)) {
var parentName = RegExp.$1;
var parent = JSDOC.Parser.symbols.getSymbol(parentName);
if (!parent) {
if (JSDOC.Lang.isBuiltin(parentName)) parent = JSDOC.Parser.addBuiltin(parentName);
else {
if (symbol.alias.indexOf("$anonymous") < 0) // these will be ignored eventually
LOG.warn("Can't document "+symbol.alias+" without first documenting "+parentName+".");
}
}
if (parent) name = parentName+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment;
}
else {
parent = this.namescope.last(1);
name = parent.alias+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment;
}
}
// otherwise it means the global
else {
name = nameFragment;
}
return name;
}
JSDOC.Walker.onParamList = function(/**Array*/paramTokens) {
if (!paramTokens) {
LOG.warn("Malformed parameter list. Can't parse code.");
return [];
}
var params = [];
for (var i = 0, l = paramTokens.length; i < l; i++) {
if (paramTokens[i].is("JSDOC")) {
var paramType = paramTokens[i].data.replace(/(^\/\*\* *| *\*\/$)/g, "");
if (paramTokens[i+1] && paramTokens[i+1].is("NAME")) {
i++;
params.push({type: paramType, name: paramTokens[i].data});
}
}
else if (paramTokens[i].is("NAME")) {
params.push({name: paramTokens[i].data});
}
}
return params;
}

View File

@ -1,74 +0,0 @@
/**
* @version $Id: main.js 570 2008-04-07 23:54:50Z micmath $
*/
function main() {
IO.include("lib/JSDOC.js");
IO.includeDir("plugins/");
if (JSDOC.opt.v) LOG.verbose = true;
if (JSDOC.opt.o) LOG.out = IO.open(JSDOC.opt.o);
if (JSDOC.opt.T) {
LOG.inform("JsDoc Toolkit running in test mode at "+new Date()+".");
IO.include("frame/Testrun.js");
IO.include("test.js");
}
else {
LOG.inform("JsDoc Toolkit main() running at "+new Date()+".");
LOG.inform("With options: ");
for (var o in JSDOC.opt) {
LOG.inform(" "+o+": "+JSDOC.opt[o]);
}
var jsdoc = new JSDOC.JsDoc();
if (JSDOC.opt.Z) { // secret debugging option
LOG.warn("So you want to see the data structure, eh? This might hang if you have circular refs...");
IO.include("frame/Dumper.js");
var symbols = jsdoc.symbolSet.toArray();
for (var i = 0, l = symbols.length; i < l; i++) {
var symbol = symbols[i];
print("// symbol: " + symbol.alias);
print(symbol.serialize());
}
}
else {
var template = JSDOC.opt.t || System.getProperty("jsdoc.template.dir");
var handler = jsdoc.symbolSet.handler;
if (handler && handler.publish) {
handler.publish(jsdoc.symbolSet);
}
else {
if (typeof template != "undefined") {
try {
load(template+"/publish.js");
if (!publish) {
LOG.warn("No publish() function is defined in that template so nothing to do.");
}
else {
publish(jsdoc.symbolSet);
}
}
catch(e) {
LOG.warn("Sorry, that doesn't seem to be a valid template: "+template+"/publish.js : "+e);
}
}
else {
LOG.warn("No template or handlers given. Might as well read the usage notes.");
JSDOC.usage();
}
}
}
}
if (LOG.warnings.length) {
print(LOG.warnings.length+" warning"+(LOG.warnings.length != 1? "s":"")+".");
}
if (LOG.out) {
LOG.out.flush();
LOG.out.close();
}
}

View File

@ -1,19 +0,0 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.commentSrcJson",
{
onDocCommentSrc: function(commentSrc) {
var json;
if (/^\s*@json\b/.test(commentSrc)) {
commentSrc = commentSrc.replace("@json", "");
eval("json = "+commentSrc);
var tagged = "";
for (var i in json) {
var tag = json[i];
// todo handle cases where tag is an object
tagged += "@"+i+" "+tag+"\n";
}
return tagged;
}
}
}
);

View File

@ -1,16 +0,0 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.frameworkPrototype",
{
onPrototypeClassCreate: function(classCreator) {
var desc = "";
if (classCreator.comment) {
desc = classCreator.comment;
}
var insert = desc+"/** @name "+classCreator.name+"\n@constructor\n@scope "+classCreator.name+".prototype */"
insert = insert.replace(/\*\/\/\*\*/g, "\n");
/*DEBUG*///print("insert is "+insert);
classCreator.addComment.data = insert;
}
}
);

View File

@ -1,10 +0,0 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.functionCall",
{
onFunctionCall: function(functionCall) {
if (functionCall.name == "dojo.define" && functionCall.arg1) {
functionCall.doc = "/** @lends "+eval(functionCall.arg1)+".prototype */";
}
}
}
);

View File

@ -1,62 +0,0 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.publishSrcHilite",
{
onPublishSrc: function(src) {
if (src.path in JsHilite.cache) {
return; // already generated src code
}
else JsHilite.cache[src.path] = true;
try {
var sourceCode = IO.readFile(src.path);
}
catch(e) {
print(e.message);
quit();
}
var hiliter = new JsHilite(sourceCode, src.charset);
src.hilited = hiliter.hilite();
}
}
);
function JsHilite(src, charset) {
var tr = new JSDOC.TokenReader();
tr.keepComments = true;
tr.keepDocs = true;
tr.keepWhite = true;
this.tokens = tr.tokenize(new JSDOC.TextStream(src));
// TODO is redefining toString() the best way?
JSDOC.Token.prototype.toString = function() {
return "<span class=\""+this.type+"\">"+this.data.replace(/</g, "&lt;")+"</span>";
}
if (!charset) charset = "utf-8";
this.header = '<html><head><meta http-equiv="content-type" content="text/html; charset='+charset+'"> '+
"<style>\n\
.KEYW {color: #933;}\n\
.COMM {color: #bbb; font-style: italic;}\n\
.NUMB {color: #393;}\n\
.STRN {color: #393;}\n\
.REGX {color: #339;}\n\
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}\n\
</style></head><body><pre>";
this.footer = "</pre></body></html>";
this.showLinenumbers = true;
}
JsHilite.cache = {};
JsHilite.prototype.hilite = function() {
var hilited = this.tokens.join("");
var line = 1;
if (this.showLinenumbers) hilited = hilited.replace(/(^|\n)/g, function(m){return m+"<span class='line'>"+((line<10)? " ":"")+((line<100)? " ":"")+(line++)+"</span> "});
return this.header+hilited+this.footer;
}

View File

@ -1,9 +0,0 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.symbolLink",
{
onSymbolLink: function(link) {
// modify link.linkPath
// or link.linkText here
}
}
);

View File

@ -1,31 +0,0 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.tagParamConfig",
{
onDocCommentTags: function(comment) {
var currentParam = null;
var tags = comment.tags;
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].title == "param") {
if (tags[i].name.indexOf(".") == -1) {
currentParam = i;
}
}
else if (tags[i].title == "config") {
tags[i].title = "param";
if (currentParam == null) {
tags[i].name = "arguments"+"."+tags[i].name;
}
else if (tags[i].name.indexOf(tags[currentParam].name+".") != 0) {
tags[i].name = tags[currentParam].name+"."+tags[i].name;
}
currentParam != null
//tags[currentParam].properties.push(tags[i]);
}
else {
currentParam = null;
}
}
}
}
);

View File

@ -1,43 +0,0 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.tagSynonyms",
{
onDocCommentSrc: function(comment) {
comment.src = comment.src.replace(/@methodOf\b/i, "@function\n@memberOf");
comment.src = comment.src.replace(/@fieldOf\b/i, "@field\n@memberOf");
},
onDocCommentTags: function(comment) {
for (var i = 0, l = comment.tags.length; i < l; i++) {
var title = comment.tags[i].title.toLowerCase();
var syn;
if ((syn = JSDOC.tagSynonyms.synonyms["="+title])) {
comment.tags[i].title = syn;
}
}
}
}
);
new Namespace(
"JSDOC.tagSynonyms",
function() {
JSDOC.tagSynonyms.synonyms = {
"=member": "memberOf",
"=memberof": "memberOf",
"=description": "desc",
"=exception": "throws",
"=argument": "param",
"=returns": "return",
"=classdescription": "class",
"=fileoverview": "overview",
"=extends": "augments",
"=base": "augments",
"=projectdescription": "overview",
"=classdescription": "class",
"=link": "see",
"=borrows": "inherits",
"=scope": "lends",
"=construct": "constructor"
}
}
);

View File

@ -1,346 +0,0 @@
/**
* @fileOverview
* A bootstrap script that creates some basic required objects
* for loading other scripts.
* @author Michael Mathews, micmath@gmail.com
* @version $Id: run.js 554 2008-04-01 00:12:25Z micmath $
*/
/**
* @namespace Keep track of any messages from the running script.
*/
LOG = {
warn: function(msg, e) {
if (e) msg = e.fileName+", line "+e.lineNumber+": "+msg;
msg = ">> WARNING: "+msg;
LOG.warnings.push(msg);
if (LOG.out) LOG.out.write(msg+"\n");
else print(msg);
},
inform: function(msg) {
msg = " > "+msg;
if (LOG.out) LOG.out.write(msg+"\n");
else if (typeof LOG.verbose != "undefined" && LOG.verbose) print(msg);
}
};
LOG.warnings = [];
LOG.verbose = false
LOG.out = undefined;
/**
* @class Manipulate a filepath.
*/
function FilePath(absPath, separator) {
this.slash = separator || "/";
this.root = this.slash;
this.path = [];
this.file = "";
var parts = absPath.split(/[\\\/]/);
if (parts) {
if (parts.length) this.root = parts.shift() + this.slash;
if (parts.length) this.file = parts.pop()
if (parts.length) this.path = parts;
}
this.path = this.resolvePath();
}
/** Collapse any dot-dot or dot items in a filepath. */
FilePath.prototype.resolvePath = function() {
var resolvedPath = [];
for (var i = 0; i < this.path.length; i++) {
if (this.path[i] == "..") resolvedPath.pop();
else if (this.path[i] != ".") resolvedPath.push(this.path[i]);
}
return resolvedPath;
}
/** Trim off the filename. */
FilePath.prototype.toDir = function() {
if (this.file) this.file = "";
return this;
}
/** Go up a directory. */
FilePath.prototype.upDir = function() {
this.toDir();
if (this.path.length) this.path.pop();
return this;
}
FilePath.prototype.toString = function() {
return this.root
+ this.path.join(this.slash)
+ ((this.path.length > 0)? this.slash : "")
+ this.file;
}
/**
* Turn a path into just the name of the file.
*/
FilePath.fileName = function(path) {
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
return path.substring(nameStart);
}
/**
* Get the extension of a filename
*/
FilePath.fileExtension = function(filename) {
return filename.split(".").pop().toLowerCase();
};
/**
* Turn a path into just the directory part.
*/
FilePath.dir = function(path) {
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
return path.substring(0, nameStart-1);
}
importClass(java.lang.System);
/**
* @namespace A collection of information about your system.
*/
SYS = {
/**
* Information about your operating system: arch, name, version.
* @type string
*/
os: [
new String(System.getProperty("os.arch")),
new String(System.getProperty("os.name")),
new String(System.getProperty("os.version"))
].join(", "),
/**
* Which way does your slash lean.
* @type string
*/
slash: System.getProperty("file.separator")||"/",
/**
* The path to the working directory where you ran java.
* @type string
*/
userDir: new String(System.getProperty("user.dir")),
/**
* Where is Java's home folder.
* @type string
*/
javaHome: new String(System.getProperty("java.home")),
/**
* The absolute path to the directory containing this script.
* @type string
*/
pwd: undefined
};
// jsrun appends an argument, with the path to here.
if (arguments[arguments.length-1].match(/^-j=(.+)/)) {
if (RegExp.$1.charAt(0) == SYS.slash || RegExp.$1.charAt(1) == ":") { // absolute path to here
SYS.pwd = new FilePath(RegExp.$1).toDir().toString();
}
else { // relative path to here
SYS.pwd = new FilePath(SYS.userDir + SYS.slash + RegExp.$1).toDir().toString();
}
arguments.pop();
}
else {
print("The run.js script requires you use jsrun.jar.");
quit();
}
// shortcut
var File = Packages.java.io.File;
/**
* @namespace A collection of functions that deal with reading a writing to disk.
*/
IO = {
/**
* Create a new file in the given directory, with the given name and contents.
*/
saveFile: function(/**string*/ outDir, /**string*/ fileName, /**string*/ content) {
var out = new Packages.java.io.PrintWriter(
new Packages.java.io.OutputStreamWriter(
new Packages.java.io.FileOutputStream(outDir+SYS.slash+fileName),
IO.encoding
)
);
out.write(content);
out.flush();
out.close();
},
/**
* @type string
*/
readFile: function(/**string*/ path) {
if (!IO.exists(path)) {
throw "File doesn't exist there: "+path;
}
return readFile(path, IO.encoding);
},
/**
* @param inFile
* @param outDir
* @param [fileName=The original filename]
*/
copyFile: function(/**string*/ inFile, /**string*/ outDir, /**string*/ fileName) {
if (fileName == null) fileName = FilePath.fileName(inFile);
var inFile = new File(inFile);
var outFile = new File(outDir+SYS.slash+fileName);
var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096);
var bos = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outFile), 4096);
var theChar;
while ((theChar = bis.read()) != -1) {
bos.write(theChar);
}
bos.close();
bis.close();
},
/**
* Creates a series of nested directories.
*/
mkPath: function(/**Array*/ path) {
if (path.constructor != Array) path = path.split(/[\\\/]/);
var make = "";
for (var i = 0, l = path.length; i < l; i++) {
make += path[i] + SYS.slash;
if (! IO.exists(make)) {
IO.makeDir(make);
}
}
},
/**
* Creates a directory at the given path.
*/
makeDir: function(/**string*/ path) {
(new File(path)).mkdir();
},
/**
* @type string[]
* @param dir The starting directory to look in.
* @param [recurse=1] How many levels deep to scan.
* @returns An array of all the paths to files in the given dir.
*/
ls: function(/**string*/ dir, /**number*/ recurse, _allFiles, _path) {
if (_path === undefined) { // initially
var _allFiles = [];
var _path = [dir];
}
if (_path.length == 0) return _allFiles;
if (recurse === undefined) recurse = 1;
dir = new File(dir);
if (!dir.directory) return [String(dir)];
var files = dir.list();
for (var f = 0; f < files.length; f++) {
var file = String(files[f]);
if (file.match(/^\.[^\.\/\\]/)) continue; // skip dot files
if ((new File(_path.join(SYS.slash)+SYS.slash+file)).list()) { // it's a directory
_path.push(file);
if (_path.length-1 < recurse) IO.ls(_path.join(SYS.slash), recurse, _allFiles, _path);
_path.pop();
}
else {
_allFiles.push((_path.join(SYS.slash)+SYS.slash+file).replace(SYS.slash+SYS.slash, SYS.slash));
}
}
return _allFiles;
},
/**
* @type boolean
*/
exists: function(/**string*/ path) {
file = new File(path);
if (file.isDirectory()){
return true;
}
if (!file.exists()){
return false;
}
if (!file.canRead()){
return false;
}
return true;
},
/**
*
*/
open: function(/**string*/ path, /**string*/ append) {
var append = true;
var outFile = new File(path);
var out = new Packages.java.io.PrintWriter(
new Packages.java.io.OutputStreamWriter(
new Packages.java.io.FileOutputStream(outFile, append),
IO.encoding
)
);
return out;
},
/**
* Sets {@link IO.encoding}.
* Encoding is used when reading and writing text to files,
* and in the meta tags of HTML output.
*/
setEncoding: function(/**string*/ encoding) {
if (/ISO-8859-([0-9]+)/i.test(encoding)) {
IO.encoding = "ISO8859_"+RegExp.$1;
}
else {
IO.encoding = encoding;
}
},
/**
* @default "utf-8"
* @private
*/
encoding: "utf-8",
/**
* Load the given script.
*/
include: function(relativePath) {
load(SYS.pwd+relativePath);
},
/**
* Loads all scripts from the given directory path.
*/
includeDir: function(path) {
if (!path) return;
for (var lib = IO.ls(SYS.pwd+path), i = 0; i < lib.length; i++)
load(lib[i]);
}
}
// now run the application
IO.include("frame.js");
IO.include("main.js");
main();

Some files were not shown because too many files have changed in this diff Show More