Solved some sorting errors with the servlet version.

Also if the service parameter thdlBanner=anything is sent, the THDL's
java script menu is displayed (if it is running on the thdl server). There is
still a bug. Menu goes away when pressing "translate" button. See:
http://iris.lib.virginia.edu/tibetan/servlet/org.thdl.tib.scanner.OnLineScannerFilter?thdlBanner=on
This commit is contained in:
amontano 2003-09-08 08:12:56 +00:00
parent e42d76b3b8
commit 07fbbcaf45
4 changed files with 88 additions and 14 deletions

View file

@ -339,7 +339,7 @@ outAHere:
*/
fin = init+1;
while (true)
while (fin < linea.length())
{
ch = linea.charAt(fin);
if (endOfParagraphMarks.indexOf(ch)>=0)

View file

@ -58,15 +58,30 @@ public class OnLineScannerFilter extends HttpServlet {
PrintWriter out = response.getWriter();
String parrafo = request.getParameter("parrafo"), checkboxName, script;
DictionarySource ds=null;
boolean checkedDicts[], allUnchecked, wantsTibetan;
boolean checkedDicts[], allUnchecked, wantsTibetan, useTHDLBanner = (request.getParameter("thdlBanner")!=null);
// int percent=100;
out.println("<html>");
if (useTHDLBanner)
{
out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\">");
}
else out.println("<html>");
out.println("<head>");
out.println("<META name=\"keywords\" content=\"tibetan, english, dictionary, jim valby, rangjung yeshe, jeffrey hopkins, tsig mdzod chen mo, online, translation, scanner, parser, buddhism, language, processing, font, dharma, chos, tibet\">");
out.println("<META NAME=\"Description\" CONTENT=\"This Java tool takes Tibetan language passages and divides the passages up into their component phrases and words, and displays corresponding dictionary definitions.\">");
out.println("<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">");
out.println("<title>The Online Tibetan to English Translation/Dictionary Tool</title>");
if (useTHDLBanner)
{
out.println(" <title>Tibetan and Himalayan Digital Library - The Online Tibetan to English Translation/Dictionary Tool</title>");
out.println(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
out.println(" <script type=\"text/javascript\" src=\"/tibet/scripts/thdl_scripts.js\"></script>");
out.println(" <link rel=\"stylesheet\" type=\"text/css\" href=\"/tibet/style/thdl-styles.css\"/>");
}
else
out.println(" <title>The Online Tibetan to English Translation/Dictionary Tool</title>");
out.println(" <META name=\"keywords\" content=\"tibetan, english, dictionary, jim valby, rangjung yeshe, jeffrey hopkins, tsig mdzod chen mo, online, translation, scanner, parser, buddhism, language, processing, font, dharma, chos, tibet\">");
out.println(" <META NAME=\"Description\" CONTENT=\"This Java tool takes Tibetan language passages and divides the passages up into their component phrases and words, and displays corresponding dictionary definitions.\">");
out.println(" <meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">");
script = request.getParameter("script");
/* script==null || makes default tibetan
@ -90,6 +105,43 @@ public class OnLineScannerFilter extends HttpServlet {
}
out.println("</head>");
out.println("<body>");
if (useTHDLBanner)
{
out.println("<div id=\"banner\">");
out.println(" <a id=\"logo\" href=\"/tibet/index.html\"><img id=\"test\" alt=\"THDL Logo\" src=\"/tibet/images/logo.png\"/></a>");
out.println(" <h1>Tibetan and Himalayan Digital Library</h1>");
out.println(" <div id=\"menubar\">");
out.println(" <script type=\'text/javascript\'>function Go(){return}</script>");
out.println(" <script type=\'text/javascript\' src=\'/tibet/scripts/new/thdl_menu_config.js\'></script>");
out.println(" <script type=\'text/javascript\' src=\'/tibet/scripts/new/menu_new.js\'></script>");
out.println(" <script type=\'text/javascript\' src=\'/tibet/scripts/new/menu9_com.js\'></script>");
out.println(" <noscript><p>Your browser does not support javascript.</p></noscript>");
out.println(" <div id=\'MenuPos\' >Menu Loading... </div>");
out.println(" </div><!--END menubar-->");
out.println("</div><!--END banner-->");
out.println("<div id=\"sub_banner\">");
out.println("<div id=\"search\">");
out.println(" <form method=\"get\" action=\"http://www.google.com/u/thdl\">");
out.println(" <p>");
out.println(" <input type=\"text\" name=\"q\" id=\"q\" size=\"15\" maxlength=\"255\" value=\"\" />");
out.println(" <input type=\"submit\" name=\"sa\" id=\"sa\" value=\"Search\"/>");
out.println(" <input type=\"hidden\" name=\"hq\" id=\"hq\" value=\"inurl:iris.lib.virginia.edu\"/>");
out.println(" </p>");
out.println(" </form>");
out.println(" </div>");
out.println(" <div id=\"breadcrumbs\">");
out.println(" <a href=\"/tibet/index.html\">Home</a> &gt; <a href=\"/tibet/reference/index.html\">Reference</a> &gt; Translation Tool |");
out.println(" <a href=\"http://www.people.virginia.edu/~am2zb/tibetan/TibetanEnglishTranslationTool.jnlp\">Tibetan Script Input Version </a> (<a target=\"_blank\" href=\"http://java.sun.com/getjava/\">Java</a> needed) |");
out.println(" <a href=\"http://www.people.virginia.edu/~am2zb/tibetan/\" target=\"_blank\">Documentation</a>");
out.println(" </div>");
out.println("</div><!--END sub_banner-->");
out.println("<div id=\"main\">");
}
out.println("<h3 align=\"center\">The Online Tibetan to English Translation/Dictionary Tool</h3>");
out.println("<form action=\"org.thdl.tib.scanner.OnLineScannerFilter\" method=POST>");
out.println("<table border=\"0\" width=\"100%\">");
@ -180,6 +232,7 @@ public class OnLineScannerFilter extends HttpServlet {
desglosar(parrafo, out, wantsTibetan);
out.println(TibetanScanner.copyrightHTML);
if (useTHDLBanner) out.println("</div><!--END main-->");
out.println("</body>");
out.println("</html>");
}

View file

@ -285,11 +285,11 @@ public abstract class TibetanScanner
public Token[] getTokenArray()
{
int i=0;
Token token[] = new Token[wordList.size()];
int n=wordList.size();
Token token[] = new Token[n];
SimplifiedListIterator li = wordList.listIterator();
while(li.hasNext())
token[i++] = (Token)li.next();
token[--n] = (Token)li.next();
return token;
}

View file

@ -91,7 +91,17 @@ public class Word extends Token
public String getBookmark(boolean tibetan)
{
String localWord;
if (tibetan) localWord = TibetanHTML.getHTML(super.token + " ");
if (tibetan)
{
try
{
localWord = TibetanHTML.getHTML(super.token + " ");
}
catch (Exception e)
{
localWord = "<b>" + super.token + "</b>";
}
}
else localWord = "<b>" + super.token + "</b>";
return "<a name=\"" + super.token + "\">" + localWord + "</a>";
}
@ -103,16 +113,27 @@ public class Word extends Token
public String getLink(boolean tibetan)
{
String localWord;
String localWord, result=null;
// String result;
if (wordSinDec==null) localWord = super.token;
else localWord = wordSinDec;
if (tibetan) localWord = TibetanHTML.getHTML(localWord + " ");
if (tibetan)
{
try
{
result = TibetanHTML.getHTML(localWord + " ");
}
catch (Exception e)
{
result = localWord;
}
}
else result = localWord;
/* result = "<a href=\"#" + word + "\">" + localWord;
if (tibetan) result+= "</a>";
else result+= "</a> ";
return result;*/
return "<a href=\"#" + super.token + "\">" + localWord + "</a> ";
return "<a href=\"#" + super.token + "\">" + result + "</a> ";
}
/** Called in order to redisplay the text with links keeping