[sword-svn] r1890 - in trunk: bindings/corba bindings/corba/java
bindings/corba/orbitcpp src/modules/filters
scribe at crosswire.org
scribe at crosswire.org
Sat Jan 28 21:14:19 MST 2006
Author: scribe
Date: 2006-01-28 21:14:04 -0700 (Sat, 28 Jan 2006)
New Revision: 1890
Modified:
trunk/bindings/corba/java/Makefile
trunk/bindings/corba/orbitcpp/Makefile
trunk/bindings/corba/orbitcpp/swordorb-impl.cpp
trunk/bindings/corba/orbitcpp/swordorb-impl.hpp
trunk/bindings/corba/orbitcpp/testclient.cpp
trunk/bindings/corba/swordorb.idl
trunk/src/modules/filters/osiswebif.cpp
Log:
Added basic crossref/footnote support in web filters
Added a key parsing method to corba interface
Added a (bool filter) param to getEntryAttributes
Modified: trunk/bindings/corba/java/Makefile
===================================================================
--- trunk/bindings/corba/java/Makefile 2006-01-14 17:57:32 UTC (rev 1889)
+++ trunk/bindings/corba/java/Makefile 2006-01-29 04:14:04 UTC (rev 1890)
@@ -1,5 +1,5 @@
TOMCAT_HOME=/usr/local/tomcat
-instdir=/home/swordweb/livehtml
+instdir=/home/scribe/src/swordweb/webapp
all: src/org/crosswire/sword/orb/SWMgr.java classes/org/crosswire/sword/orb/SwordOrb.class
src/org/crosswire/sword/orb/SWMgr.java: ../swordorb.idl
Modified: trunk/bindings/corba/orbitcpp/Makefile
===================================================================
--- trunk/bindings/corba/orbitcpp/Makefile 2006-01-14 17:57:32 UTC (rev 1889)
+++ trunk/bindings/corba/orbitcpp/Makefile 2006-01-29 04:14:04 UTC (rev 1890)
@@ -11,9 +11,9 @@
CFLAGS += `pkg-config --cflags sword`
#comment out for release
-#CXXFLAGS += -g -O0
-#CFLAGS += -g -O0
-#LDFLAGS += -g -O0
+CXXFLAGS += -g -O0
+CFLAGS += -g -O0
+LDFLAGS += -g -O0
#----------------------------------
server: swordorb-common.o server.cpp swordorb-impl.o swordorb-cpp.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-cpp-skels.o swordorb-skels.o swordorb-cpp.o
Modified: trunk/bindings/corba/orbitcpp/swordorb-impl.cpp
===================================================================
--- trunk/bindings/corba/orbitcpp/swordorb-impl.cpp 2006-01-14 17:57:32 UTC (rev 1889)
+++ trunk/bindings/corba/orbitcpp/swordorb-impl.cpp 2006-01-29 04:14:04 UTC (rev 1890)
@@ -5,6 +5,7 @@
#include <treekeyidx.h>
#include <swbuf.h>
#include <localemgr.h>
+#include <vector>
/*
char* swordorb::SWModule_impl::helloWorld(const char* greeting) throw(CORBA::SystemException) {
@@ -126,6 +127,31 @@
}
+StringList *SWModule_impl::parseKeyList(const char *keyText) throw(CORBA::SystemException) {
+ sword::VerseKey *parser = dynamic_cast<VerseKey *>(delegate->getKey());
+ StringList *retVal = new StringList;
+ if (parser) {
+ sword::ListKey result;
+ result = parser->ParseVerseList(keyText, *parser, true);
+ int count = 0;
+ for (result = sword::TOP; !result.Error(); result++) {
+ count++;
+ }
+ retVal->length(count);
+ count = 0;
+ for (result = sword::TOP; !result.Error(); result++) {
+ (*retVal)[count++] = CORBA::string_dup((const char *)result);
+ }
+ }
+ else {
+ retVal->length(1);
+ (*retVal)[0] = CORBA::string_dup(keyText);
+ }
+
+ return retVal;
+}
+
+
SearchHitList *SWModule_impl::search(const char *istr, SearchType searchType, CORBA::Long flags, const char *scope) throw(CORBA::SystemException) {
int stype = 2;
sword::ListKey lscope;
@@ -158,33 +184,69 @@
}
-StringList *SWModule_impl::getEntryAttribute(const char *level1, const char *level2, const char *level3) throw(CORBA::SystemException) {
+StringList *SWModule_impl::getEntryAttribute(const char *level1, const char *level2, const char *level3, CORBA::Boolean filtered) throw(CORBA::SystemException) {
delegate->RenderText(); // force parse
- sword::AttributeTypeList &entryAttribs = delegate->getEntryAttributes();
- sword::AttributeTypeList::iterator i1 = entryAttribs.find(level1);
- sword::AttributeList::iterator i2;
- sword::AttributeValue::iterator i3, j3;
+ std::vector<SWBuf> results;
StringList *retVal = new StringList;
int count = 0;
- if (i1 != entryAttribs.end()) {
- i2 = i1->second.find(level2);
- if (i2 != i1->second.end()) {
- i3 = i2->second.find(level3);
- if (i3 != i2->second.end()) {
- for (j3 = i3; j3 != i2->second.end(); j3++)
- count++;
- retVal->length(count);
- count = 0;
- for (j3 = i3; j3 != i2->second.end(); j3++) {
- (*retVal)[count++] = CORBA::string_dup(i3->second.c_str());
- }
+ sword::AttributeTypeList &entryAttribs = delegate->getEntryAttributes();
+ sword::AttributeTypeList::iterator i1Start, i1End;
+ sword::AttributeList::iterator i2Start, i2End;
+ sword::AttributeValue::iterator i3Start, i3End;
+
+ if ((level1) && (*level1)) {
+ i1Start = entryAttribs.find(level1);
+ i1End = i1Start;
+ if (i1End != entryAttribs.end())
+ i1End++;
+ }
+ else {
+ i1Start = entryAttribs.begin();
+ i1End = entryAttribs.end();
+ }
+ for (;i1Start != i1End; i1Start++) {
+ if ((level2) && (*level2)) {
+ i2Start = i1Start->second.find(level2);
+ i2End = i2Start;
+ if (i2End != i1Start->second.end())
+ i2End++;
+ }
+ else {
+ i2Start = i1Start->second.begin();
+ i2End = i1Start->second.end();
+ }
+ for (;i2Start != i2End; i2Start++) {
+ if ((level3) && (*level3)) {
+ i3Start = i2Start->second.find(level3);
+ i3End = i3Start;
+ if (i3End != i2Start->second.end())
+ i3End++;
}
+ else {
+ i3Start = i2Start->second.begin();
+ i3End = i2Start->second.end();
+ }
+ for (;i3Start != i3End; i3Start++) {
+ results.push_back(i3Start->second);
+ }
+ if (i3Start != i3End)
+ break;
}
+ if (i2Start != i2End)
+ break;
}
- if (!count)
- retVal->length(count);
+ retVal->length(results.size());
+ for (int i = 0; i < results.size(); i++) {
+ if (filtered) {
+ (*retVal)[i] = CORBA::string_dup(delegate->RenderText(results[i].c_str()));
+ }
+ else {
+ (*retVal)[count++] = CORBA::string_dup(results[i].c_str());
+ }
+ }
+
return retVal;
}
Modified: trunk/bindings/corba/orbitcpp/swordorb-impl.hpp
===================================================================
--- trunk/bindings/corba/orbitcpp/swordorb-impl.hpp 2006-01-14 17:57:32 UTC (rev 1889)
+++ trunk/bindings/corba/orbitcpp/swordorb-impl.hpp 2006-01-29 04:14:04 UTC (rev 1890)
@@ -21,6 +21,7 @@
SWModule_impl(sword::SWModule *delegate) { this->delegate = delegate; }
SearchHitList *search(const char *istr, SearchType searchType, CORBA::Long flags, const char *scope) throw(CORBA::SystemException);
+ StringList *parseKeyList(const char *keyText) throw(CORBA::SystemException);
void terminateSearch() throw(CORBA::SystemException) { delegate->terminateSearch = true; }
char error() throw(CORBA::SystemException) { return delegate->Error(); }
CORBA::Long getEntrySize() throw(CORBA::SystemException) { return delegate->getEntrySize(); }
@@ -36,7 +37,7 @@
void next() throw(CORBA::SystemException) { delegate->increment(); }
void begin() throw(CORBA::SystemException) { delegate->setPosition(sword::TOP); }
char *getStripText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->StripText()); }
- StringList *getEntryAttribute(const char *level1, const char *level2, const char *level3) throw(CORBA::SystemException);
+ StringList *getEntryAttribute(const char *level1, const char *level2, const char *level3, CORBA::Boolean filtered) throw(CORBA::SystemException);
char *getRenderText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->RenderText()); }
char *getRawEntry() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->getRawEntry()); }
char *getConfigEntry(const char *key) throw(CORBA::SystemException) { return CORBA::string_dup(((char *)delegate->getConfigEntry(key)) ? (char *)delegate->getConfigEntry(key):SWNULL); }
Modified: trunk/bindings/corba/orbitcpp/testclient.cpp
===================================================================
--- trunk/bindings/corba/orbitcpp/testclient.cpp 2006-01-14 17:57:32 UTC (rev 1889)
+++ trunk/bindings/corba/orbitcpp/testclient.cpp 2006-01-29 04:14:04 UTC (rev 1890)
@@ -43,20 +43,29 @@
}
std::cout << "\n";
}
-*/
swordorb::StringList *localeNames = mgr->getAvailableLocales();
for (int i = 0; i < localeNames->length(); i++) {
std::cout << (*localeNames)[i] << "\n";
}
mgr->setDefaultLocale("de");
+*/
mgr->setJavascript(true);
mgr->setGlobalOption("Textual Variants", "Secondary Reading");
- module = mgr->getModuleByName("LXX");
+ mgr->setGlobalOption("Footnotes", "On");
+ module = mgr->getModuleByName("NASB");
+ module->setKeyText("jas.1.19");
+ swordorb::StringList *attr = module->getEntryAttribute("Footnote", "", "body", true);
+ std::cout << "length: " << attr->length() << "\n";
+ for (int i = 0; i < attr->length(); i++) {
+ std::cout << (*attr)[i] << "\n";
+ }
+/*
for (module->setKeyText("is.53.4"); !module->error(); module->next()) {
std::cout << "KeyText: " << module->getKeyText() << "\n";
std::cout << "Text: " << module->getRenderText() << "\n";
break;
}
+*/
/*
swordorb::SearchHitList *searchResults;
bool lucene = module->hasSearchFramework();
Modified: trunk/bindings/corba/swordorb.idl
===================================================================
--- trunk/bindings/corba/swordorb.idl 2006-01-14 17:57:32 UTC (rev 1889)
+++ trunk/bindings/corba/swordorb.idl 2006-01-29 04:14:04 UTC (rev 1890)
@@ -21,7 +21,7 @@
struct SearchHit {
string modName;
string key;
- long score;
+ long score;
};
typedef sequence<SearchHit> SearchHitList;
@@ -38,28 +38,29 @@
interface SWModule {
- void terminateSearch();
+ void terminateSearch();
SearchHitList search(in string istr, in SearchType searchType, in long flags, in string scope);
- char error();
- long getEntrySize();
- StringList getEntryAttribute(in string level1, in string level2, in string level3);
- void setKeyText(in string key);
- string getKeyText();
- boolean hasKeyChildren();
- StringList getKeyChildren();
- string getKeyParent();
- string getName();
- string getDescription();
- string getCategory();
- void previous();
- void next();
- void begin();
- string getStripText();
- string getRenderText();
- string getRawEntry();
- string getConfigEntry(in string key);
- void deleteSearchFramework();
- boolean hasSearchFramework();
+ char error();
+ long getEntrySize();
+ StringList getEntryAttribute(in string level1, in string level2, in string level3, in boolean filtered);
+ StringList parseKeyList(in string keyText);
+ void setKeyText(in string key);
+ string getKeyText();
+ boolean hasKeyChildren();
+ StringList getKeyChildren();
+ string getKeyParent();
+ string getName();
+ string getDescription();
+ string getCategory();
+ void previous();
+ void next();
+ void begin();
+ string getStripText();
+ string getRenderText();
+ string getRawEntry();
+ string getConfigEntry(in string key);
+ void deleteSearchFramework();
+ boolean hasSearchFramework();
};
@@ -68,21 +69,21 @@
//
interface SWMgr {
ModInfoList getModInfoList();
- SWModule getModuleByName(in string name);
- string getPrefixPath();
- string getConfigPath();
- void setGlobalOption(in string option, in string value);
- string getGlobalOption(in string option);
- string getGlobalOptionTip(in string option);
- string filterText(in string filterName, in string text);
- StringList getGlobalOptions();
- StringList getGlobalOptionValues(in string option);
- void setCipherKey(in string modName, in string key);
- void terminate();
- boolean testConnection();
- void setJavascript(in boolean val);
- StringList getAvailableLocales();
- void setDefaultLocale(in string name);
+ SWModule getModuleByName(in string name);
+ string getPrefixPath();
+ string getConfigPath();
+ void setGlobalOption(in string option, in string value);
+ string getGlobalOption(in string option);
+ string getGlobalOptionTip(in string option);
+ string filterText(in string filterName, in string text);
+ StringList getGlobalOptions();
+ StringList getGlobalOptionValues(in string option);
+ void setCipherKey(in string modName, in string key);
+ void terminate();
+ boolean testConnection();
+ void setJavascript(in boolean val);
+ StringList getAvailableLocales();
+ void setDefaultLocale(in string name);
};
};
Modified: trunk/src/modules/filters/osiswebif.cpp
===================================================================
--- trunk/src/modules/filters/osiswebif.cpp 2006-01-14 17:57:32 UTC (rev 1889)
+++ trunk/src/modules/filters/osiswebif.cpp 2006-01-29 04:14:04 UTC (rev 1890)
@@ -122,6 +122,7 @@
if (type != "strongsMarkup") { // leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
+ SWBuf modName = (u->module) ? u->module->Name() : "";
VerseKey *vkey;
// see if we have a VerseKey * or descendant
SWTRY {
@@ -131,6 +132,7 @@
if (vkey) {
char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
// buf.appendFormatted("<a href=\"noteID=%s.%c.%s\"><small><sup>*%c</sup></small></a> ", vkey->getText(), ch, footnoteNumber.c_str(), ch);
+ buf.appendFormatted("<span class=\"fn\" onclick=\"f(\'%s\',\'%s\',\'%s\');\" >%c</span>", modName.c_str(), u->key->getText(), footnoteNumber.c_str(), ch);
}
}
u->suspendTextPassThru = true;
@@ -138,6 +140,7 @@
}
if (tag.isEndTag()) {
u->suspendTextPassThru = false;
+
}
}
@@ -175,17 +178,18 @@
else { // all other types
if (!u->suspendTextPassThru)
buf += "<i>";
+ u->inBold = false;
}
}
else if (tag.isEndTag()) {
if(u->inBold) {
if (!u->suspendTextPassThru)
buf += "</b>";
- u->inBold = false;
}
- else
+ else {
if (!u->suspendTextPassThru)
buf += "</i>";
+ }
}
}
More information about the sword-cvs
mailing list