summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine
diff options
context:
space:
mode:
Diffstat (limited to 'org/madore/damlengine')
-rw-r--r--org/madore/damlengine/TodoWXrefAttr.java16
-rw-r--r--org/madore/damlengine/WeblogServlet.java2
2 files changed, 11 insertions, 7 deletions
diff --git a/org/madore/damlengine/TodoWXrefAttr.java b/org/madore/damlengine/TodoWXrefAttr.java
index bb1c861..e35d06f 100644
--- a/org/madore/damlengine/TodoWXrefAttr.java
+++ b/org/madore/damlengine/TodoWXrefAttr.java
@@ -22,15 +22,17 @@ public class TodoWXrefAttr extends TodoAttr {
@Override
public void handle() {
String wxrefStr = attr.getValue();
- if ( wxrefStr.equals("##weblog-selection-older") ) {
+ if ( wxrefStr.equals("##weblog-selection-older")
+ || wxrefStr.equals("##weblog-selection-newer") ) {
if ( ctx.wsc == null )
throw new IllegalStateException("wxref attribute encountered with no weblog selection state");
- int prev = ctx.wsc.sel.first() - 1;
+ final int trgt = ctx.wsc.sel.first()
+ + (wxrefStr.equals("##weblog-selection-older") ? -1 : 1);
WeblogSummary sum = WeblogSummary.getSummary(ctx.dc);
if ( sum != null && sum.entries != null
- && sum.entries.containsKey(new Integer(prev)) ) {
+ && sum.entries.containsKey(new Integer(trgt)) ) {
WeblogSummary.EntrySummary ent
- = sum.entries.get(new Integer(prev));
+ = sum.entries.get(new Integer(trgt));
String target = "#d." + ent.date + "."
+ String.format("%04d", ent.id);
this.owner.removeAttributeNode(this.attr);
@@ -38,8 +40,10 @@ public class TodoWXrefAttr extends TodoAttr {
= ctx.doc.createAttributeNS(DamlEngine.DAML_NS, "d:wref");
newAttr.setValue(target);
this.owner.setAttributeNodeNS(newAttr);
- // Force linking to the month page.
- this.owner.setAttributeNS(DamlEngine.DAML_NS, "d:wrefcat", "@month");
+ if ( ! this.owner.hasAttributeNS(DamlEngine.DAML_NS, "d:wrefcat") ) {
+ if ( ctx.wsc instanceof Context.WeblogMonthSelectionContext )
+ this.owner.setAttributeNS(DamlEngine.DAML_NS, "d:wrefcat", "@month");
+ }
this.ownerDeque.registerAtStart(new TodoWrefAttr(newAttr, this.owner,
this.ctx, this));
} else {
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
index 444d1ed..39660e5 100644
--- a/org/madore/damlengine/WeblogServlet.java
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletResponse;
public class WeblogServlet extends HttpServlet {
- private static final long serialVersionUID = 2014101004L;
+ private static final long serialVersionUID = 2014101005L;
@Override
public void init(ServletConfig cfg)