[jsword-devel] Jsword and your dwr web front implementation
Yiguang Hu
yighu at yahoo.com
Mon Apr 7 05:18:46 MST 2008
Thanks Joe.
If I make the webfront work, I am very likely will
make it open so more people can contribute and improve
it. But I will let you review it to avoid any
potential interest conflict.
Yiguang
--- Joe Walker <joseph.walker at gmail.com> wrote:
> I've attached JSword.java, from which JSword.js is
> generated, by DWR.
> I think that I'm not able to open source the code,
> under my agreement with
> Godspeed computing, for whom I wrote the project,
> but at least you can take
> a look at how things work.
>
> Joe.
>
> On Sat, Apr 5, 2008 at 9:14 PM, Yiguang Hu
> <yighu at yahoo.com> wrote:
>
> > Joe,
> >
> > I am revisiting my attempt to build a web front
> based
> > jsword. I am looking at your studious
> implementation
> > and am now thinking this in the same line as your
> > implementation: DWR+html/jsp+javascript.
> >
> > Do you mind share your code that generate
> JSword.js?
> >
> > The stylesheet from JSword convert DOM into a
> complete
> > HTML so I can not put it into a div in the html
> > directly.
> > I'd like to see from your code what style you use
> to
> > generate the html segment that the client side can
> > pick it up and put it into the "display" node.
> > I am also interested in seeing how you change the
> > styles according to your front options.
> >
> > Thanks
> > Yiguang
> >
> > --- Joe Walker <joseph.walker at gmail.com> wrote:
> >
> > > You might be intereested in this page:
> > > http://eireneh.com/studious/
> > >
> > > It's built on jsword and dwr. If there are ideas
> or
> > > examples that you would
> > > like to use from that site then feel free to
> ask.
> > >
> > > Joe.
> > >
> > > On 9/13/05, Yiguang Hu <yighu at yahoo.com> wrote:
> > > >
> > > > Hello,
> > > >
> > > > My name is Yiguang Hu. I am the webmaster of
> > > > ccim.org-A volunteer supportted Chinese
> Christian
> > > > Internet Mission. We host many Chinese
> Church/Orgs
> > > web
> > > > sites and have a bible search engine and a
> > > E-library
> > > > and have several Chinese Christian web sites
> > > in/out of
> > > > USA.
> > > > I just found the jsword project a few days ago
> and
> > > it
> > > > is what I have been waiting for quite some
> time. I
> > > > played a little bit of the source code and
> wrote a
> > > web
> > > > interface using java server faces. I got the
> > > > bible/dictionary/commentary works with some
> search
> > > > result problems.
> > > > Because I just started, I may not be using the
> > > > search function correctly.
> > > > Before I spend more time on it, I am just
> > > wondering if
> > > > some one already started a web front effort. I
> > > will be
> > > > very glad to add my code into the CVS so more
> > > people
> > > > can help to improve it.
> > > >
> > > > The other question is is there a interface
> that
> > > put
> > > > the
> > > > search result in a collection of verses like a
> > > List so
> > > > I can display them like 20 verses/entry a page
> ?
> > > >
> > > > One more question is Is there a way I can
> search
> > > the
> > > > email archives instead of read the archive
> files
> > > one
> > > > by one so I can find if my question is already
> > > > answered or a duplicate ?
> > > >
> > > >
> > > > Thank you very much for this great work.
> > > > Yiguang
> > > >
> > > >
> __________________________________________________
> > > > Do You Yahoo!?
> > > > Tired of spam? Yahoo! Mail has the best spam
> > > protection around
> > > > http://mail.yahoo.com
> > > >
> _______________________________________________
> > > > jsword-devel mailing list
> > > > jsword-devel at crosswire.org
> > > >
> > >
> >
>
http://www.crosswire.org/mailman/listinfo/jsword-devel
> > > >
> > >
> >
> >
> >
> >
> >
>
____________________________________________________________________________________
> > You rock. That's why Blockbuster's offering you
> one month of Blockbuster
> > Total Access, No Cost.
> > http://tc.deals.yahoo.com/tc/blockbuster/text5.com
> >
> >
> > package com.eireneh.studious;
>
> import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
> import java.util.SortedSet;
> import java.util.TreeSet;
>
> import org.crosswire.common.xml.SAXEventProvider;
> import
> org.crosswire.common.xml.SerializingContentHandler;
> import org.crosswire.jsword.book.Book;
> import org.crosswire.jsword.book.BookData;
> import org.crosswire.jsword.book.BookException;
> import org.crosswire.jsword.book.BookFilters;
> import org.crosswire.jsword.book.Books;
> import org.crosswire.jsword.passage.Key;
> import
> org.crosswire.jsword.passage.NoSuchKeyException;
> import org.crosswire.jsword.passage.Passage;
> import org.xml.sax.ContentHandler;
> import org.xml.sax.SAXException;
>
> /**
> * @author Joe Walker [joe at eireneh dot com]
> */
> public class JSword
> {
> /**
> * The source to this method is an example of
> how to read the plain text of
> * a verse, and print it to stdout. Reading from
> a Commentary is just the
> * same as reading from a Bible.
> */
> public String getPlainText(String biblename,
> String passage) throws BookException,
> NoSuchKeyException
> {
> Book book = getBook(biblename);
>
> Key key = book.getKey(passage);
> BookData data = book.getData(key);
>
> return data.getPlainText();
> }
>
> /**
> * The source to this method is an example of
> how to read the plain text of
> * a verse, and print it to stdout. Reading from
> a Commentary is just the
> * same as reading from a Bible.
> */
> public SAXEventProvider getOSIS(String
> biblename, String passage) throws BookException,
> NoSuchKeyException
> {
> Book book = getBook(biblename);
>
> Key key = book.getKey(passage);
> if (key.getChildCount() > 100)
> {
> if (key instanceof Passage)
> {
> Passage ref = (Passage) key;
> ref.trimVerses(100);
> }
> else
> {
> throw new
> IllegalArgumentException("Too many verses.");
> }
> }
>
> BookData data = book.getData(key);
>
> return data.getSAXEventProvider();
> }
>
> /**
> * The source to this method is an example of
> how to read the plain text of
> * a verse, and print it to stdout. Reading from
> a Commentary is just the
> * same as reading from a Bible.
> */
> public String getOSISString(String biblename,
> String passage) throws BookException,
> NoSuchKeyException
> {
> try
> {
> SAXEventProvider sep =
> getOSIS(biblename, passage);
> ContentHandler ser = new
> SerializingContentHandler();
> sep.provideSAXEvents(ser);
> return ser.toString();
> }
> catch (SAXException ex)
> {
> throw new
> BookException(Msg.JSWORD_SAXPARSE, ex);
> }
> }
>
> /**
> * An example of how to search for various bits
> of data.
> */
> public String search(String biblename, String
> find) throws BookException
> {
> Book book = getBook(biblename);
>
> Key key = book.find(find);
> return key.getName();
> }
>
> /**
> *
> */
> public String[] matches(String biblename, String
> starts) throws BookException
> {
> Book book = getBook(biblename);
>
> SortedSet index = (SortedSet)
> indexCache.get(book);
> if (index == null)
> {
> index = new TreeSet();
>
> Key keys = book.getGlobalKeyList();
> for (Iterator it = keys.iterator();
> it.hasNext();)
> {
> Key subkey = (Key) it.next();
> String name = subkey.getName();
> index.add(name.toLowerCase());
> }
> }
>
> // Danger: there are probably some i18n
> issues with this trick - we
> // are getting everything that sorts bewteen
> the given elements. As
> // soon as people start searching for i18n
> chars then this might fail
> // I don't know enough about the i18n sort
> orders. I guess the default
> // locale has a lot to do with things
> starts = starts.toLowerCase();
> SortedSet reply = index.subSet(starts,
> starts + "zz");
>
> // Convert to an array. Normally we'd use
> Collection.toArray() however
> // we want to restrict the size of the
> reply, and that method insists
> // on giving you back everything even if you
> give it a smaller initial
> // array
> int size = reply.size();
> if (size > MAX_MATCHES)
> {
> size = MAX_MATCHES;
> }
>
> String[] a = new String[size];
>
> Iterator it = reply.iterator();
> for (int i=0; i<size; i++)
> {
> a[i] = (String) it.next();
> }
>
> if (a.length > size)
> {
> a[size] = null;
> }
>
> return a;
> }
>
> private Map indexCache = new HashMap();
>
> /**
> * This is an example of the different ways to
> select a Book from the
> * selection available.
> * @param filter The filter string
> * @see BookFilters#getCustom(java.lang.String)
> * @see Books
> */
> public String[][] getBooks(String filter)
> {
> List books =
>
Books.installed().getBooks(BookFilters.getCustom(filter));
>
=== message truncated ===
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
More information about the jsword-devel
mailing list