summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoNavbar.java
blob: 4b0518008f5f06d6df695ce7d86a950d1b3196ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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, "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.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);
    }

}