much work toward the dtd-on-the-fly architecture for locale changing
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Aug 2005 21:03:36 +0000 (21:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Aug 2005 21:03:36 +0000 (21:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1621 dcc99617-32d9-48b4-a31d-7c20da2025e4

18 files changed:
Open-ILS/src/Makefile
Open-ILS/src/apachemods/Makefile
Open-ILS/src/apachemods/mod_xmltools.c
Open-ILS/src/apachemods/xmltools.c
Open-ILS/src/apachemods/xmltools.h
Open-ILS/src/webxml/advanced.xml
Open-ILS/src/webxml/index.xml
Open-ILS/src/webxml/locale/en-US/lang.dtd [new file with mode: 0644]
Open-ILS/src/webxml/login.xml
Open-ILS/src/webxml/mresult.xml
Open-ILS/src/webxml/myopac/index.xml
Open-ILS/src/webxml/result_common.xml
Open-ILS/src/webxml/rresult.xml
Open-ILS/src/webxml/sidebar.xml
OpenSRF/bin/opensrf_all
OpenSRF/src/router/router_config.xml.example
config.sh
install.sh

index 0ca3a4c..9734306 100644 (file)
@@ -1,9 +1,15 @@
-all: 
+export TMPDIR                  = $(TMP)/opensrf
+export LD_OPTS                 = -L $(TMPDIR) -L .
+export CC_OPTS                 = -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
+                                                               -I$(LIBXML2_HEADERS)/libxml  -I$(TMP) -I$(TMPDIR)
+
+all: mod_xmltools
 
-web-install:   web-templates-install javascript-install autojs-install
 
 install:       perl-install web-install string-templates-install storage-bootstrap xsl-install
 
+web-install:   web-templates-install javascript-install autojs-install  mod_xmltools-install webxml-install
+
 
 JSDIR=$(WEBDIR)/js
 
@@ -13,6 +19,16 @@ marcdumper:
 marcdumper-install:
        make -C extras/marcdumper install
 
+mod_xmltools:
+       make -C apachemods mod_xmltools.so
+
+mod_xmltools-install:
+       make -C apachemods mod_xmltools-install
+
+webxml-install:
+       mkdir -p $(WEBDIR)
+       cp -r webxml $(WEBDIR)
+
 perl-install:
        @echo "Installing Perl modules to $(PERLDIR)"
        mkdir -p $(PERLDIR)
@@ -52,8 +68,6 @@ string-templates-install:
        cp -r templates/strings $(TEMPLATEDIR)
 
 
-
-
 xsl-install:   
        @echo "Installing XSL files to $(XSLDIR)"
        mkdir -p $(XSLDIR)
@@ -62,3 +76,4 @@ xsl-install:
 clean:
        @echo "Cleaning..."
        make -C extras clean
+
index 0a717e7..5f39230 100644 (file)
@@ -1,6 +1,6 @@
 # ---------------------------------------------------------------------------------
-CC_OPTS = -I /usr/include/libxml2 -I /opt/include -g
-APXS2 = /home/erickson/sandbox/apache2/bin/apxs
+#CC_OPTS = -I /usr/include/libxml2 -I /opt/include -g
+#APXS2 = /home/erickson/sandbox/apache2/bin/apxs
 # ---------------------------------------------------------------------------------
 
 LD_OPTS        += -lxml2 -lc_utils
@@ -27,6 +27,8 @@ mod_xmltools-install:
                LoadModule mod_xmltools_module modules/mod_xmltools.so \n \
                to this: \n \
                LoadModule mod_xmltools    modules/mod_xmltools.so"
+       @echo "Also, you can add \nXMLToolsDefaultLocale <locale>\nand\n \
+                       XMLToolsLocaleDir  <web-locale-dir> to httpd.conf"
        @echo "-----------------------------------------------";
        @sleep 3;
 
index e96c781..6d801e4 100644 (file)
@@ -49,9 +49,6 @@ static int mod_xmltools_handler (request_rec* r) {
        char* locale_dir = cfg->locale_dir;
        char* default_locale = cfg->default_locale;
 
-       fprintf(stderr, "%s : %s\n", locale_dir, default_locale );
-       fflush(stderr);
-
        /* we accept get/post requests */
        r->allowed |= (AP_METHOD_BIT << M_GET);
        r->allowed |= (AP_METHOD_BIT << M_POST);
@@ -75,6 +72,8 @@ static int mod_xmltools_handler (request_rec* r) {
                return HTTP_INTERNAL_SERVER_ERROR;
        }
 
+       fflush(stderr);
+
        /* process xincludes */
        if( xmlXIncludeProcess(doc) < 0 ) {
                fprintf(stderr, "\n ^-- Error processing XIncludes for file %s\n", file);
@@ -82,6 +81,7 @@ static int mod_xmltools_handler (request_rec* r) {
                return HTTP_INTERNAL_SERVER_ERROR;
        }
 
+       fflush(stderr);
 
        /* replace the DTD */
        if(xmlReplaceDtd(doc, dtdfile) < 0) {
index c9f6c97..e2b9cb3 100644 (file)
@@ -1,5 +1,74 @@
 #include "xmltools.h"
 
+
+#ifdef XMLTOOLS_DEBUG // standalone debugging 
+
+int main(int argc, char* argv[]) {
+
+       char* file = argv[1];
+       char* dtdfile = argv[2];
+
+       xmlDocPtr doc;
+
+
+       /*
+       xmlSubstituteEntitiesDefault(0);
+       xmlParserCtxtPtr ctxt = xmlNewParserCtxt();
+       doc = xmlCtxtReadFile(ctxt, file, NULL, XML_PARSE_NOENT | XML_PARSE_RECOVER | XML_PARSE_XINCLUDE | XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
+       if(doc != NULL) 
+               fprintf(stderr, "What we have so far:\n%s\n", xmlDocToString(doc, 1));
+       else {
+               fprintf(stderr, "NO Doc\n");
+               return 0;
+       }
+
+       exit(99);
+       */
+
+       /* parse the doc */
+       if( (doc = xmlParseFile(file)) == NULL) {
+               fprintf(stderr, "\n ^-- Error parsing XML file %s\n", file);
+               fflush(stderr);
+               return 99;
+       }
+
+       /* process xincludes */
+       if( xmlXIncludeProcessFlags(doc, XML_PARSE_NOENT) < 0 ) {
+               fprintf(stderr, "\n ^-- Error processing XIncludes for file %s\n", file);
+               if(doc != NULL) 
+                       fprintf(stderr, "What we have so far:\n%s\n", xmlDocToString(doc, 1));
+               fflush(stderr);
+               return 99;
+       }
+
+
+       /* replace the DTD */
+       if(xmlReplaceDtd(doc, dtdfile) < 0) {
+               fprintf(stderr, "Error replacing DTD file with file %s\n", dtdfile);
+               fflush(stderr);
+               return 99;
+       }
+
+       /* force DTD entity replacement */
+       doc = xmlProcessDtdEntities(doc);
+
+       /* stringify */
+       char* xml = xmlDocToString(doc, 0);
+
+       fprintf(stderr, "%s\n", xml);
+
+       /* deallocate */
+       free(dtdfile);
+       free(xml);
+       xmlFreeDoc(doc);
+       xmlCleanupCharEncodingHandlers();
+       xmlCleanupParser();
+
+
+}
+
+#endif
+
 xmlDocPtr xmlProcessDtdEntities(xmlDocPtr doc) {
        char* xml = xmlDocToString(doc, 1);
        xmlFreeDoc(doc);
index b5baeed..c09f3cf 100644 (file)
@@ -11,8 +11,6 @@
 #include <libxml/xmlwriter.h>
 #include <libxml/xmlreader.h>
 
-#include "apachetools.h"
-
 
 #ifndef XMLTOOLS_H
 #define XMLTOOLS_H
index 4339885..0b520f1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "locale/en-US/lang.dtd"> %ent; ] >
 
 <!-- Advanced search page -->
 
index 2f2c41d..bf7f553 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "locale/en-US/lang.dtd"> %ent; ] >
 
 <html xmlns="http://www.w3.org/1999/xhtml" 
        xmlns:xi="http://www.w3.org/2001/XInclude" xml:lang="en" lang="en">
@@ -6,7 +7,7 @@
        <head>
                <title>Evergreen: Home</title>
                <link rel='stylesheet' type='text/css' href='/css/opac/opac.css'/>
-               <xi:include href="js_common.xml"/>
+               <xi:include href="js_common.xml#xpointer(//script)"/>
        </head>
 
        <body onload="init();">
diff --git a/Open-ILS/src/webxml/locale/en-US/lang.dtd b/Open-ILS/src/webxml/locale/en-US/lang.dtd
new file mode 100644 (file)
index 0000000..60b34cb
--- /dev/null
@@ -0,0 +1,9 @@
+<!ENTITY nbsp "  ">
+
+<!-- Navigations links -->
+<!ENTITY navigate.home "Home">
+<!ENTITY navigate.home.title "Go to the Home page">
+<!ENTITY navigate.advanced "Advanced Search">
+<!ENTITY navigate.advanced.title "Go to the Advanced Search Page">
+
+
index d74f513..4de66ed 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "locale/en-US/lang.dtd"> %ent; ] >
 
 
 <div id='login_box' class='hide_me'>
index aca23c7..b1da961 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "locale/en-US/lang.dtd"> %ent; ] >
 
 <html xmlns="http://www.w3.org/1999/xhtml" 
        xmlns:xi="http://www.w3.org/2001/XInclude" xml:lang="en" lang="en">
index d27a62a..b4d79fe 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "../locale/en-US/lang.dtd"> %ent; ] >
 
 <html xmlns="http://www.w3.org/1999/xhtml" 
        xmlns:xi="http://www.w3.org/2001/XInclude" xml:lang="en" lang="en">
index ff2d33a..adca4ae 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "locale/en-US/lang.dtd"> %ent; ] >
 
 <div id='canvas_main' xmlns:xi="http://www.w3.org/2001/XInclude" >
 
                                <!-- simple next/prev type navigation links -->
                                <td id='next_prev_links'>
                                        <a id='home_link' title="First results page">Start</a>
-                                       <span>&#160;</span>
+                                       <span> &nbsp; </span>
                                        <a id='prev_link' title='Previus page'> &lt;&lt; </a>
-                                       <span>&#160;</span>
+                                       <span> </span>
                                        <span id='page_numbers'> </span>
                                        <a id='next_link' title='Next Page'> &gt;&gt; </a>
-                                       <span>&#160;</span>
+                                       <span> </span>
                                        <a id='end_link' title="Last results page">End</a>
                                </td>
 
index 9d0b256..18f82bd 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "locale/en-US/lang.dtd"> %ent; ] >
 
 <html xmlns="http://www.w3.org/1999/xhtml" 
        xmlns:xi="http://www.w3.org/2001/XInclude" xml:lang="en" lang="en">
index 0df07d2..88a2c10 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0'?>
+<!DOCTYPE x [ <!ENTITY % ent SYSTEM "locale/en-US/lang.dtd"> %ent; ] >
 
 <!-- Navigation bar -->
 
@@ -6,14 +7,14 @@
 
        <div class='sidebar_chunk'>
 
-               <div title="Go to the Home Page
+               <div title="&navigate.home.title;
                        id='home_link_div' class="side_bar_item">
-                       <a href='/webxml/index.xml'>Home</a>
+                       <a href='/webxml/index.xml'>&navigate.home;</a>
                </div>
        
-               <div title="Go to the Advanced Search Page"
+               <div title="&navigate.advanced.title;"
                        id='advanced_link_div' class="side_bar_item">
-                       <a href='/webxml/advanced.xml'>Advanced Search</a>
+                       <a href='/webxml/advanced.xml'>&navigate.advanced;</a>
                </div>
 
                <div title="Got to the MyOPAC Page"
index ffa4489..78cb44f 100755 (executable)
@@ -40,7 +40,7 @@ OPENSRF="1";
 JSERVERSOCK="$PREFIX/var/sock/jserver.sock";   # jabber server socket file 
 JSERVERLOG="$LOGDIR/jserver.log" # jabber server log 
 JSERVERPORT=5222;                                              # jabber server port 
-JSERVERLEVEL=4; # can be 1-4, 4 is the highest
+JSERVERLEVEL=3; # can be 1-4, 4 is the highest
 ROUTERLOG="$LOGDIR/router.log" # jabber router log
 # --------------------------------------------------------------------------
 # --------------------------------------------------------------------------
index f9c90a7..f55b10b 100644 (file)
@@ -44,7 +44,7 @@
                        3 Info 
                        4 debug
                -->
-               <level>4</level>
+               <level>3</level>
        </log>
 
 
index 99d59a0..87d4cc0 100755 (executable)
--- a/config.sh
+++ b/config.sh
@@ -27,16 +27,6 @@ DEFAULT_CONFIG_FILE="install.conf.default";
 
 function buildConfig {
 
-#      if [ -f "$CONFIG_FILE" ]; then
-#              echo "";
-#              echo "Using existing config file \"$CONFIG_FILE\""; 
-#              echo "To generate a new config, remove \"$CONFIG_FILE\"";
-#              echo "";
-#              sleep 3;        
-#              exit 0;
-#      fi
-
-
        if [ -f "$DEFAULT_CONFIG_FILE" ]; then
                source "$DEFAULT_CONFIG_FILE";
        fi;
index 2536a43..252a4b1 100755 (executable)
@@ -154,8 +154,11 @@ function runInstall {
                                ;;
 
                        "opensrf_gateway" )
-                               if building;    then $MAKE -C "$OPENSRFDIR" "gateway"; fi;
-                               if building;    then $MAKE -C "$OPENSRFDIR" "rest_gateway"; fi;
+                               if building;    then 
+                                       $MAKE -C "$OPENSRFDIR" "gateway"; 
+                                       $MAKE -C "$OPENSRFDIR" "rest_gateway"; 
+                               fi;
+
                                if installing; then $MAKE -C "$OPENSRFDIR" "gateway-install"; fi;
                                ;;
 
@@ -185,6 +188,7 @@ function runInstall {
                                ;;
 
                        "openils_web" )
+                               if building; then $MAKE -C "$OPENILSDIR" "mod_xmltools"; fi;
                                if installing; then $MAKE -C "$OPENILSDIR" "web-install"; fi;
                                ;;