summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
+ }
+
+}