Navbar is now customizeable via docs/toolbar.html. There is a default should that file not be there. And... wtf, didn't my syndie thumbnail patch take? Well, no conflicts reported so, here it goes again.

This commit is contained in:
polecat
2005-12-13 08:18:59 +00:00
committed by zzz
parent ab4f3008cb
commit e5fa7e0ae4
11 changed files with 54 additions and 16 deletions

View File

@@ -183,7 +183,7 @@ class ArchiveIndexer {
public void receiveAddress(String name, String schema, String protocol, String location, String anchorText) {}
public void receiveArchive(String name, String description, String locationSchema, String location, String postingKey, String anchorText) {}
public void receiveAttachment(int id, String anchorText) {}
public void receiveAttachment(int id, int thumbnail, String anchorText) {}
public void receiveBegin() {}
public void receiveBlog(String name, String blogKeyHash, String blogPath, long blogEntryId, List blogArchiveLocations, String anchorText) {}
public void receiveBold(String text) {}

View File

@@ -14,7 +14,7 @@ public class HeaderReceiver implements SMLParser.EventReceiver {
public void receiveAddress(String name, String schema, String protocol, String location, String anchorText) {}
public void receiveArchive(String name, String description, String locationSchema, String location, String postingKey, String anchorText) {}
public void receiveAttachment(int id, String anchorText) {}
public void receiveAttachment(int id, int thumbnail, String anchorText) {}
public void receiveBegin() {}
public void receiveBlog(String name, String blogKeyHash, String blogPath, long blogEntryId, List blogArchiveLocations, String anchorText) {}
public void receiveBold(String text) {}

View File

@@ -111,5 +111,5 @@ public class EventReceiverImpl implements SMLParser.EventReceiver {
public void receiveH5(String text) {}
public void receivePre(String text) {}
public void receiveHR() {}
public void receiveAttachment(int id, String anchorText) {}
public void receiveAttachment(int id, int thumbnail, String anchorText) {}
}

View File

@@ -31,16 +31,27 @@ public class HTMLPreviewRenderer extends HTMLRenderer {
ArchiveViewerBean.PARAM_ATTACHMENT + "=" + id;
}
public void receiveAttachment(int id, String anchorText) {
public void receiveAttachment(int id, int thumb, String anchorText) {
anchorText = sanitizeString(anchorText);
if (!continueBody()) { return; }
if ( (id < 0) || (_files == null) || (id >= _files.size()) ) {
_bodyBuffer.append(sanitizeString(anchorText));
_bodyBuffer.append(anchorText);
} else {
File f = (File)_files.get(id);
String name = (String)_filenames.get(id);
String type = (String)_fileTypes.get(id);
_bodyBuffer.append("<a ").append(getClass("attachmentView")).append(" href=\"").append(getAttachmentURL(id)).append("\">");
_bodyBuffer.append(sanitizeString(anchorText)).append("</a>");
if(thumb >= 0) {
_bodyBuffer.append("<img src=\"").
append(getAttachmentURL(thumb)).
append("\" alt=\"").append(anchorText).
append("\" title=\"").append(anchorText).
append("\" />");
} else {
_bodyBuffer.append(anchorText);
}
_bodyBuffer.append("</a>");
_bodyBuffer.append(getSpan("attachmentSummary")).append(" (");
_bodyBuffer.append(getSpan("attachmentSummarySize")).append(f.length()/1024).append("KB</span>, ");
_bodyBuffer.append(getSpan("attachmentSummaryName")).append(" \"").append(sanitizeString(name)).append("\"</span>, ");

View File

@@ -513,14 +513,23 @@ public class HTMLRenderer extends EventReceiverImpl {
}
}
public void receiveAttachment(int id, String anchorText) {
public void receiveAttachment(int id, int thumb, String anchorText) {
if (!continueBody()) { return; }
Attachment attachments[] = _entry.getAttachments();
if ( (id < 0) || (id >= attachments.length)) {
_bodyBuffer.append(getSpan("attachmentUnknown")).append(sanitizeString(anchorText)).append("</span>");
} else {
_bodyBuffer.append("<a ").append(getClass("attachmentView")).append(" href=\"").append(getAttachmentURL(id)).append("\">");
_bodyBuffer.append(sanitizeString(anchorText)).append("</a>");
_bodyBuffer.append("<a ").append(getClass("attachmentView")).append(" href=\"").append(getAttachmentURL(id)).append("\">");
if(thumb >= 0) {
_bodyBuffer.append("<img src=\"").
append(getAttachmentURL(thumb)).
append("\" alt=\"").append(anchorText).
append("\" title=\"").append(anchorText).
append("\" />");
} else {
_bodyBuffer.append(anchorText);
}
_bodyBuffer.append("</a>");
_bodyBuffer.append(getSpan("attachmentSummary")).append(" (");
_bodyBuffer.append(getSpan("attachmentSummarySize")).append(attachments[id].getDataLength()/1024).append("KB</span>, ");
_bodyBuffer.append(getSpan("attachmentSummaryName")).append(" \"").append(sanitizeString(attachments[id].getName())).append("\"</span>, ");

View File

@@ -208,7 +208,7 @@ public class RSSRenderer extends HTMLRenderer {
_bodyBuffer.append(sanitizeString(anchorText));
}
}
public void receiveAttachment(int id, String anchorText) {
public void receiveAttachment(int id, int thumb, String anchorText) {
if (!continueBody()) { return; }
_bodyBuffer.append(sanitizeString(anchorText));
}

View File

@@ -211,6 +211,7 @@ public class SMLParser {
private static final String T_ATTACHMENT = "attachment";
private static final String T_ARCHIVE = "archive";
private static final String P_THUMBNAIL = "thumbnail";
private static final String P_ATTACHMENT = "attachment";
private static final String P_WHO_QUOTED = "author";
private static final String P_QUOTE_LOCATION = "location";
@@ -284,7 +285,10 @@ public class SMLParser {
} else if (T_PRE.equals(tagName)) {
receiver.receivePre(body);
} else if (T_ATTACHMENT.equals(tagName)) {
receiver.receiveAttachment((int)getLong(P_ATTACHMENT_ID, attr), body);
receiver.receiveAttachment(
(int)getLong(P_ATTACHMENT_ID, attr),
(int)getLong(P_THUMBNAIL, attr),
body);
} else {
if (_log.shouldLog(Log.WARN))
_log.warn("need to learn how to parse the tag [" + tagName + "]");
@@ -402,7 +406,7 @@ public class SMLParser {
String postingKey, String anchorText);
public void receiveImage(String alternateText, int attachmentId);
public void receiveAddress(String name, String schema, String protocol, String location, String anchorText);
public void receiveAttachment(int id, String anchorText);
public void receiveAttachment(int id, int thumb, String anchorText);
public void receiveBold(String text);
public void receiveItalic(String text);
public void receiveUnderline(String text);