X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=library%2Fweb%2Ftemplates%2FWebLibraryServerTemplates.java;h=25644446db3bdc5ada11122d07e3295bd3efc663;hb=379a497e6fd2b959c57b2ff4023413e2daf36232;hp=482a1b826e12514a0714cf5cd3256531851d4166;hpb=e992c260c059c53c4aabc980db85efd58f190205;p=fanfix.git diff --git a/library/web/templates/WebLibraryServerTemplates.java b/library/web/templates/WebLibraryServerTemplates.java index 482a1b8..2564444 100644 --- a/library/web/templates/WebLibraryServerTemplates.java +++ b/library/web/templates/WebLibraryServerTemplates.java @@ -1,4 +1,205 @@ package be.nikiroo.fanfix.library.web.templates; +import java.util.List; + +import be.nikiroo.fanfix.Instance; +import be.nikiroo.fanfix.bundles.UiConfig; +import be.nikiroo.fanfix.library.Template; +import be.nikiroo.utils.Version; + +/** + * Utility class to retrieve and fill HTML templates for Fanfix web server. + * + * @author niki + */ public class WebLibraryServerTemplates { + static private WebLibraryServerTemplates instance = new WebLibraryServerTemplates(); + + /** + * Get the (unique) instance of this {@link WebLibraryServerTemplates}. + * + * @return the (unique) instance + */ + static public WebLibraryServerTemplates getInstance() { + return instance; + } + + public Template bookline(String luid, String href, String title, + String author, boolean cached) { + + String cachedClass = "cached"; + String cachedValue = "◉"; + if (!cached) { + cachedClass = "uncached"; + cachedValue = "○"; + } + + return new Template(getClass(), "bookline.html") // + .set("href", href) // + .set("cachedClass", cachedClass) // + .set("cached", cachedValue) // + .set("luid", luid) // + .set("title", title) // + .set("author", author) // + ; + } + + public Template index(boolean banner, boolean fullscreen, + List