2005-12-07 jrandom
* Expand the thread we're viewing to its leaf * Bugfix on intraday ordering (children are always newer than parents)
This commit is contained in:
@ -53,8 +53,10 @@ class ThreadNodeImpl implements ThreadNode {
|
||||
void summarizeThread() {
|
||||
_recursiveAuthors.add(_entry.getKeyHash());
|
||||
_recursiveEntries.add(_entry);
|
||||
_mostRecentPostDate = _entry.getEntryId();
|
||||
_mostRecentPostAuthor = _entry.getKeyHash();
|
||||
// children are always 'newer' than parents, even if their dates are older
|
||||
// (e.g. post #1 for a child on tuesday is 'newer' than post #5 for the parent on tuesday)
|
||||
_mostRecentPostDate = -1;
|
||||
_mostRecentPostAuthor = null;
|
||||
|
||||
// we need to go through all children (recursively), in case the
|
||||
// tree is out of order (which it shouldn't be, if its built carefully...)
|
||||
@ -71,6 +73,22 @@ class ThreadNodeImpl implements ThreadNode {
|
||||
_recursiveAuthors.addAll(node.getRecursiveAuthors());
|
||||
_recursiveEntries.addAll(node.getRecursiveEntries());
|
||||
}
|
||||
|
||||
if (_mostRecentPostDate < 0) {
|
||||
_mostRecentPostDate = _entry.getEntryId();
|
||||
_mostRecentPostAuthor = _entry.getKeyHash();
|
||||
}
|
||||
|
||||
// now reorder the children
|
||||
TreeSet ordered = new TreeSet(new WritableThreadIndex.NewestNodeFirstComparator());
|
||||
for (int i = 0; i < _children.size(); i++) {
|
||||
ThreadNodeImpl kid = (ThreadNodeImpl)_children.get(i);
|
||||
ordered.add(kid);
|
||||
}
|
||||
List kids = new ArrayList(ordered.size());
|
||||
for (Iterator iter = ordered.iterator(); iter.hasNext(); )
|
||||
kids.add(iter.next());
|
||||
_children = kids;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -152,7 +152,7 @@ class WritableThreadIndex extends ThreadIndex {
|
||||
}
|
||||
}
|
||||
/** sort ThreadNodeImpl instances with the highest entryId first */
|
||||
private class NewestNodeFirstComparator implements Comparator {
|
||||
public static class NewestNodeFirstComparator implements Comparator {
|
||||
public int compare(Object lhs, Object rhs) {
|
||||
ThreadNodeImpl left = (ThreadNodeImpl)lhs;
|
||||
ThreadNodeImpl right = (ThreadNodeImpl)rhs;
|
||||
|
@ -650,7 +650,7 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
|
||||
if (l.location != null)
|
||||
_postBodyBuffer.append("location=").append(sanitizeURL(l.location)).append('&');
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(l.location, 30));
|
||||
_postBodyBuffer.append(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(")</span></a> ");
|
||||
}
|
||||
_postBodyBuffer.append("<br />\n");
|
||||
|
@ -376,10 +376,10 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
|
||||
for (int i = 0; i < _entry.getAttachments().length; i++) {
|
||||
_postBodyBuffer.append("<option value=\"").append(i).append("\">");
|
||||
Attachment a = _entry.getAttachments()[i];
|
||||
_postBodyBuffer.append(sanitizeString(a.getName()));
|
||||
_postBodyBuffer.append(sanitizeString(a.getName(), 30));
|
||||
if ( (a.getDescription() != null) && (a.getDescription().trim().length() > 0) ) {
|
||||
_postBodyBuffer.append(": ");
|
||||
_postBodyBuffer.append(sanitizeString(a.getDescription()));
|
||||
_postBodyBuffer.append(sanitizeString(a.getDescription(), 30));
|
||||
}
|
||||
_postBodyBuffer.append(" (").append(a.getDataLength()/1024).append("KB");
|
||||
_postBodyBuffer.append(", type ").append(sanitizeString(a.getMimeType())).append(")</option>\n");
|
||||
@ -396,7 +396,7 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
|
||||
boolean expanded = (_user != null ? _user.getShowExpanded() : false);
|
||||
boolean images = (_user != null ? _user.getShowImages() : false);
|
||||
_postBodyBuffer.append(getPageURL(new Hash(Base64.decode(b.hash)), b.tag, b.entryId, -1, -1, expanded, images));
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(b.name)).append("</a> ");
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(b.name, 30)).append("</a> ");
|
||||
}
|
||||
_postBodyBuffer.append("<br />\n");
|
||||
}
|
||||
@ -412,7 +412,7 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
|
||||
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
|
||||
if (l.location != null)
|
||||
_postBodyBuffer.append("location=").append(sanitizeURL(l.location)).append('&');
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(l.location, 30));
|
||||
_postBodyBuffer.append(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(")</span></a> ");
|
||||
}
|
||||
_postBodyBuffer.append("<br />\n");
|
||||
@ -439,7 +439,7 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
|
||||
_postBodyBuffer.append(AddressesServlet.PARAM_NAME).append("=").append(sanitizeTagParam(a.name)).append('&');
|
||||
if (a.protocol != null)
|
||||
_postBodyBuffer.append(AddressesServlet.PARAM_PROTO).append("=").append(sanitizeTagParam(a.protocol)).append('&');
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(a.name)).append("</a>");
|
||||
_postBodyBuffer.append("\">").append(sanitizeString(a.name, 30)).append("</a>");
|
||||
}
|
||||
}
|
||||
_postBodyBuffer.append("<br />\n");
|
||||
|
@ -951,16 +951,20 @@ public abstract class BaseServlet extends HttpServlet {
|
||||
String tags, String author) {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append(uri);
|
||||
BlogURI expandTo = node.getEntry();
|
||||
if (node.getChildCount() > 0) {
|
||||
buf.append('?').append(ThreadedHTMLRenderer.PARAM_VISIBLE).append('=');
|
||||
ThreadNode child = node.getChild(0);
|
||||
buf.append(child.getEntry().getKeyHash().toBase64()).append('/');
|
||||
buf.append(child.getEntry().getEntryId()).append('&');
|
||||
} else {
|
||||
buf.append('?').append(ThreadedHTMLRenderer.PARAM_VISIBLE).append('=');
|
||||
buf.append(node.getEntry().getKeyHash().toBase64()).append('/');
|
||||
buf.append(node.getEntry().getEntryId()).append('&');
|
||||
}
|
||||
if (true) {
|
||||
// lets expand to the leaf
|
||||
expandTo = new BlogURI(node.getMostRecentPostAuthor(), node.getMostRecentPostDate());
|
||||
} else {
|
||||
// only expand one level
|
||||
expandTo = node.getChild(0).getEntry();
|
||||
}
|
||||
}
|
||||
buf.append('?').append(ThreadedHTMLRenderer.PARAM_VISIBLE).append('=');
|
||||
buf.append(expandTo.getKeyHash().toBase64()).append('/');
|
||||
buf.append(expandTo.getEntryId()).append('&');
|
||||
|
||||
buf.append(ThreadedHTMLRenderer.PARAM_VIEW_THREAD).append('=');
|
||||
buf.append(node.getEntry().getKeyHash().toBase64()).append('/');
|
||||
buf.append(node.getEntry().getEntryId()).append('&');
|
||||
|
@ -1,4 +1,8 @@
|
||||
$Id: history.txt,v 1.347 2005/12/04 15:12:19 jrandom Exp $
|
||||
$Id: history.txt,v 1.348 2005/12/05 01:14:16 jrandom Exp $
|
||||
|
||||
2005-12-07 jrandom
|
||||
* Expand the thread we're viewing to its leaf
|
||||
* Bugfix on intraday ordering (children are always newer than parents)
|
||||
|
||||
2005-12-05 jrandom
|
||||
* Added an RDF and XML thread export to Syndie, reachable at
|
||||
|
Reference in New Issue
Block a user