// set options
String optionName = params.get("optionName");
if (optionName != null && !optionName.isEmpty()) {
+ String optionNo = params.get("optionNo");
String optionValue = params.get("optionValue");
- if (optionValue == null || optionValue.isEmpty()) {
+ if (optionNo != null || optionValue == null
+ || optionValue.isEmpty()) {
session.getCookies().delete(optionName);
cookies.remove(optionName);
} else {
appendPreHtml(builder, true);
+ Map<String, String> params = session.getParms();
+
String filter = cookies.get("filter");
+ if (params.get("optionNo") != null)
+ filter = null;
if (filter == null) {
filter = "";
}
- Map<String, String> params = session.getParms();
String browser = params.get("browser") == null ? ""
: params.get("browser");
String browser2 = params.get("browser2") == null ? ""
// TODO: javascript in realtime, using visible=false + hide [submit]
builder.append("<div class='filter'>\n");
- builder.append("\tFilter: \n");
+ builder.append("\t<span class='label'>Filter: </span>\n");
builder.append(
"\t<input name='optionName' type='hidden' value='filter' />\n");
builder.append("\t<input name='optionValue' type='text' value='"
+ filter + "' place-holder='...' />\n");
+ builder.append("\t<input name='optionNo' type='submit' value='x' />");
builder.append(
"\t<input name='submit' type='submit' value='Filter' />\n");
builder.append("</div>\n");
StringBuilder builder = new StringBuilder();
appendPreHtml(builder, false);
- // TODO: no desc page for images?
+ // For images documents, always go to the images if not chap 0 desc
if (story.getMeta().isImageDocument()) {
- if (chapter <= 0)
- chapter = 1;
- if (paragraph <= 0)
+ if (chapter > 0 && paragraph <= 0)
paragraph = 1;
}
String disabledZoomHeight = "";
if (paragraph <= 0) {
- first = getViewUrl(luid, 1, null);
- previous = getViewUrl(luid, (Math.max(chapter - 1, 1)), null);
+ first = getViewUrl(luid, 0, null);
+ previous = getViewUrl(luid, (Math.max(chapter - 1, 0)), null);
next = getViewUrl(luid,
(Math.min(chapter + 1, story.getChapters().size())),
null);
last = getViewUrl(luid, story.getChapters().size(), null);
- // TODO
StringBuilder desc = new StringBuilder();
if (chapter <= 0) {
desc.append("\t<div class='cover'>\n");
desc.append("\t\t<img src='/story/" + luid + "/cover'/>\n");
desc.append("\t</div>\n");
- desc.append("\t<table>\n");
- desc.append(
- "\t\t<tr><th>HEAD 1</th><th>HEAD 2</th></tr>\n");
- desc.append("\t\t<tr><td>KEY 1</td><td>VAL 1</td></tr>\n");
- desc.append("\t\t<tr><td>KEY 2</td><td>VAL 2</td></tr>\n");
+ desc.append("\t<table class='details'>\n");
+ Map<String, String> details = BasicLibrary
+ .getMetaDesc(story.getMeta());
+ for (String key : details.keySet()) {
+ appendTableRow(desc, 2, key, details.get(key));
+ }
desc.append("\t</table>\n");
desc.append("</div>\n");
desc.append("<h1 class='title'>Description</h1>\n");
content.append("<div class='viewer text'>\n");
content.append(desc);
+ String description = new TextOutput(false).convert(chap,
+ chapter > 0);
content.append(
- new TextOutput(false).convert(chap, chapter > 0));
+ description.isEmpty() ? "No description provided."
+ : description);
content.append("</div>\n");
- if (chapter <= 1)
+ if (chapter <= 0)
disabledLeft = " disabled='disbaled'";
if (chapter >= story.getChapters().size())
disabledRight = " disabled='disbaled'";
if (paragraph >= chap.getParagraphs().size())
disabledRight = " disabled='disbaled'";
+ // First -> previous *chapter*
+ if (chapter > 0)
+ disabledLeft = "";
+ first = getViewUrl(luid, (Math.max(chapter - 1, 0)), null);
+ if (paragraph <= 1) {
+ previous = first;
+ }
+
Paragraph para = null;
try {
para = chap.getParagraphs().get(paragraph - 1);
zoomStyle, //
getStoryUrl(luid, chapter, paragraph)));
} else {
- content.append(para.getContent());
+ content.append(String.format("" //
+ + "<div class='viewer text'>%s</div>", //
+ para.getContent()));
}
}
builder.append(">").append(name).append("</option>\n");
}
+ private void appendTableRow(StringBuilder builder, int depth,
+ String... tds) {
+ for (int i = 0; i < depth; i++) {
+ builder.append("\t");
+ }
+
+ int col = 1;
+ builder.append("<tr>");
+ for (String td : tds) {
+ builder.append("<td class='col");
+ builder.append(col++);
+ builder.append("'>");
+ builder.append(td);
+ builder.append("</td>");
+ }
+ builder.append("</tr>\n");
+ }
+
public static void main(String[] args) throws IOException {
Instance.init();
WebLibraryServer web = new WebLibraryServer(false);