}
public String getHtml(String requestPath) throws MalformedURLException,
- IOException, ClassNotFoundException {
+ IOException, ClassNotFoundException {
if (requestPath == null)
requestPath = "";
requestPath);
layout.init("Photos", context.getLocalPathComponents(), this, context);
- final DirectoryMetadata metadata = getMetadataForPath(requestPath);
+ final DirectoryMetadata directory = getMetadataForPath(requestPath);
- compileHtml(layout, metadata);
+ compileHtml(layout, directory);
- return layout.getHtml(false, false);
+ return layout.getHtml(false, false, directory);
}
public DirectoryMetadata getMetadataForPath(final String requestPath)
// file path
if (picture.getDimensions().equals(desiredDimension))
return context.getGlobalUrl() + context.getLocalUrl() + "/"
- + picture.fileName;
+ + picture.fileName;
final String thumbnailFileName = picture
.getRelativeThumbnailFileName(desiredDimension);
return context.getGlobalUrl() + context.getLocalUrl() + "/"
- + Constants.THUMBNAILS_DIRECTORY_NAME + "/"
- + UrlParamEncoder.encode(thumbnailFileName);
+ + Constants.THUMBNAILS_DIRECTORY_NAME + "/"
+ + UrlParamEncoder.encode(thumbnailFileName);
}
}
package eu.svjatoslav.meviz.htmlindexer.layouts;
+import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
"Error generating thumbnails for image file: "
+ e.toString()
+ ", thumbnail generation skipped, enlisting as ordinary file instead.",
- e);
+ e);
enlistFile(picture, parentDirectoryMetadata);
}
}
@Override
public void enlistOgv(final AbstractFile abstractFile,
final DirectoryMetadata parentDirectoryMetadata)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
final GeneralFile file = (GeneralFile) abstractFile;
// watchable video
filesHtml
- .append("<video preload=\"metadata\" controls=\"controls\" tabindex=\"0\">\n");
+ .append("<video preload=\"metadata\" controls=\"controls\" tabindex=\"0\">\n");
filesHtml
- .append("<source type=\"video/ogg\" codecs=\"theora, vorbis\" src=\""
- + indexingContext.getGlobalUrl()
- + UrlParamEncoder.encode(indexingContext.getLocalUrl()
- + "/" + file.fileName) + "\">\n");
+ .append("<source type=\"video/ogg\" codecs=\"theora, vorbis\" src=\""
+ + indexingContext.getGlobalUrl()
+ + UrlParamEncoder.encode(indexingContext.getLocalUrl()
+ + "/" + file.fileName) + "\">\n");
filesHtml.append("</source>\n");
filesHtml.append("</video>\n");
filesHtml.append("<br/>\n");
// video title
filesHtml
- .append("Video: <b>"
- + FilePathParser
- .getFileNameWithoutExtension(file.fileName)
- + "<b/> ");
+ .append("Video: <b>"
+ + FilePathParser
+ .getFileNameWithoutExtension(file.fileName)
+ + "<b/> ");
// video download link
filesHtml.append("<a href=\""
return "";
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ *
+ * @throws IOException
+ */
@Override
public String getHtml(final boolean showTitle,
- final boolean doHtmlHeaderAndFooter) {
+ final boolean doHtmlHeaderAndFooter,
+ final DirectoryMetadata directory) {
// assemble final page HTML
- final StringBuffer finalHtml = new StringBuffer();
+ final StringBuffer html = new StringBuffer();
if (doHtmlHeaderAndFooter) {
// page header
- finalHtml.append("<HTML>\n");
- finalHtml.append("<HEAD>\n");
- finalHtml
- .append(" <meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\"/>\n");
- finalHtml.append("</HEAD>\n");
- finalHtml
- .append("<BODY bgcolor=\"#000000\" alink=\"#50ffff\" link=\"#50ffff\" vlink=\"#ff50ff\" text=\"#ffffff\">\n");
- finalHtml.append("<!-- " + Constants.HTML_MAGIC_STRING + " -->\n");
- finalHtml.append("<!-- " + Constants.HTML_MEMO + " -->\n");
- finalHtml.append("<font color=\"#ffffff\">\n");
+ html.append("<HTML>\n");
+ html.append("<HEAD>\n");
+ html.append(" <meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\"/>\n");
+ html.append("</HEAD>\n");
+ html.append("<BODY bgcolor=\"#000000\" alink=\"#50ffff\" link=\"#50ffff\" vlink=\"#ff50ff\" text=\"#ffffff\">\n");
+ html.append("<!-- " + Constants.HTML_MAGIC_STRING + " -->\n");
+ html.append("<!-- " + Constants.HTML_MEMO + " -->\n");
+ html.append("<font color=\"#ffffff\">\n");
}
if (showTitle)
- finalHtml
- .append("<CENTER><H1>" + galleryTitle + "</H1></CENTER>\n");
-
- showCurrentPath(finalHtml);
+ html.append("<CENTER><H1>" + galleryTitle + "</H1></CENTER>\n");
- listDirectories(finalHtml);
-
- finalHtml.append(filesHtml.toString());
+ html.append(showCurrentPath());
+ html.append(listDirectories());
+ html.append(directory.getHeaderMevizMetadataHtml());
+ html.append(filesHtml.toString());
if (doHtmlHeaderAndFooter)
- finalHtml.append("</font></BODY></HTML>\n");
+ html.append("</font></BODY></HTML>\n");
- return finalHtml.toString();
+ return html.toString();
}
private String getImageThumbnailUrl(final Picture picture) {
filesHtml = new StringBuffer();
}
- private void listDirectories(final StringBuffer finalHtml) {
- finalHtml.append("<TABLE>\n");
+ private String listDirectories() {
+ final StringBuilder html = new StringBuilder();
+ html.append("<TABLE>\n");
if (path.size() > 0) {
- finalHtml.append("<TR>");
- finalHtml.append("<TD><b><a href=\""
+ html.append("<TR>");
+ html.append("<TD><b><a href=\""
+ indexer.getParentDirectoryUrl(indexingContext)
+ "\"><h2> <== parent directory</h2></a></b></TD>");
- finalHtml.append("</TR>\n");
+ html.append("</TR>\n");
}
- finalHtml.append(dirHtml.toString());
- finalHtml.append("\n<TR><TD><br></TD></TR>\n");
- finalHtml.append("</TABLE>\n");
+ html.append(dirHtml.toString());
+ html.append("\n<TR><TD><br></TD></TR>\n");
+ html.append("</TABLE>\n");
+
+ return html.toString();
}
- private void showCurrentPath(final StringBuffer finalHtml) {
- finalHtml.append("<CENTER><H2>");
+ private String showCurrentPath() {
+ final StringBuilder html = new StringBuilder();
+ html.append("<CENTER><H2>");
for (final String p : path)
- finalHtml.append(" / " + p);
- finalHtml.append("</H2></CENTER>\n");
+ html.append(" / " + p);
+ html.append("</H2></CENTER>\n");
+
+ return html.toString();
}
}