package org.madore.damlengine; import org.w3c.dom.Element; public final class TodoNavbar extends TodoElement { public TodoNavbar(Element node, Context ctx, TodoItem caller) { super(node, ctx, caller); } @Override public void handle() { Element p = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "nav"); 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.gc.uriToTop==null)?"./":ctx.gc.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.gc.uriToTop==null)?"":ctx.gc.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.gc.uriToTop==null)?"":ctx.gc.uriToTop) +"weblog/")); p.appendChild(a); a.appendChild(ctx.doc.createTextNode("WebLog")); TodoElement it = TodoElement.getTodoElement(p, this.ctx, this); this.ownerDeque.registerAtStart(it); } }