summaryrefslogtreecommitdiffstats
path: root/org/madore
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-04-19 10:34:05 +0200
committerDavid A. Madore <david+git@madore.org>2010-04-19 10:34:05 +0200
commit88ef0fa3b0f0ec58cff7d819f9447064be9b6fad (patch)
tree8346bf32e434dd7f48e59a5681a98504e81632ab /org/madore
parente3ea5520c145114784091097bc5fa67a7bbe1b19 (diff)
downloaddamlengine-88ef0fa3b0f0ec58cff7d819f9447064be9b6fad.tar.gz
damlengine-88ef0fa3b0f0ec58cff7d819f9447064be9b6fad.tar.bz2
damlengine-88ef0fa3b0f0ec58cff7d819f9447064be9b6fad.zip
Navbar.
Diffstat (limited to 'org/madore')
-rw-r--r--org/madore/damlengine/TodoBodyElement.java2
-rw-r--r--org/madore/damlengine/TodoNavbar.java60
2 files changed, 61 insertions, 1 deletions
diff --git a/org/madore/damlengine/TodoBodyElement.java b/org/madore/damlengine/TodoBodyElement.java
index 2ee2286..be1a563 100644
--- a/org/madore/damlengine/TodoBodyElement.java
+++ b/org/madore/damlengine/TodoBodyElement.java
@@ -38,7 +38,7 @@ public class TodoBodyElement extends TodoDefaultElement {
"d:implicit-do-navbar");
bodyNode.appendChild(ctx.doc.createTextNode("\n"));
bodyNode.appendChild(token);
- // toProcess.add(new TodoNavbar(token, this.ctx, this));
+ toProcess.add(new TodoNavbar(token, this.ctx, this));
}
if ( node.getAttributeNS(null, "notranslations").equals("") ) {
Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS,
diff --git a/org/madore/damlengine/TodoNavbar.java b/org/madore/damlengine/TodoNavbar.java
new file mode 100644
index 0000000..7c6448c
--- /dev/null
+++ b/org/madore/damlengine/TodoNavbar.java
@@ -0,0 +1,60 @@
+package org.madore.damlengine;
+
+import org.w3c.dom.Element;
+
+public class TodoNavbar extends TodoElement {
+
+ public TodoNavbar(Element node,
+ Context ctx,
+ TodoItem caller) {
+ super(node, ctx, caller);
+ }
+
+ public void handle() {
+ Element p = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "p");
+ String lang = LangHelper.getLangRec(node);
+ String explicitLang = LangHelper.getLangNorec(node);
+ if ( lang == null || ! ( lang.equals("en") || lang.equals("fr") ) ) {
+ System.err.println("warning: will use English navbar");
+ lang = "en";
+ explicitLang = "en";
+ }
+ if ( explicitLang != null )
+ LangHelper.setLangNorec(p, explicitLang);
+ p.setAttributeNS(null, "class", "navbar");
+ node.getParentNode().replaceChild(p, node);
+ Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
+ a.setAttributeNS(null, "href", "http://www.madore.org/~david/");
+ p.appendChild(a);
+ a.appendChild(ctx.doc.createTextNode("David Madore"));
+ p.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "br"));
+ a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
+ a.setAttributeNS(null, "href", "http://perso.enst.fr/~madore/");
+ p.appendChild(a);
+ a.appendChild(ctx.doc.createTextNode(lang.equals("fr")?"Site prof."
+ :"Prof. site"));
+ p.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "br"));
+ a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
+ a.setAttributeNS(null, "href", (ctx.uriToTop==null)?"./":ctx.uriToTop);
+ p.appendChild(a);
+ a.appendChild(ctx.doc.createTextNode(lang.equals("fr")?"Racine du site"
+ :"Site Root"));
+ p.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "br"));
+ a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
+ a.setAttributeNS(null, "href", (((ctx.uriToTop==null)?"":ctx.uriToTop)
+ +"sitemap.html"));
+ p.appendChild(a);
+ a.appendChild(ctx.doc.createTextNode(lang.equals("fr")?"Plan du site"
+ :"Site Map"));
+ p.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "br"));
+ a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
+ a.setAttributeNS(null, "href", (((ctx.uriToTop==null)?"":ctx.uriToTop)
+ +"weblog/"));
+ p.appendChild(a);
+ a.appendChild(ctx.doc.createTextNode("WebLog"));
+ TodoElement it
+ = TodoElement.getTodoElement(p, this.ctx, this);
+ this.ownerDeque.registerAtStart(it);
+ }
+
+}