diff --git a/src/fr/devinsy/statoolinfos/core/Category.java b/src/fr/devinsy/statoolinfos/core/Category.java index 3f5e09b..7791d97 100644 --- a/src/fr/devinsy/statoolinfos/core/Category.java +++ b/src/fr/devinsy/statoolinfos/core/Category.java @@ -27,7 +27,7 @@ import fr.devinsy.strings.StringList; */ public class Category { - public static final String DEFAULT_LOGO_PATH = "categories/default.png"; + public static final String DEFAULT_LOGO_PATH = "categories/default.svg"; private String name; private String description; @@ -68,9 +68,26 @@ public class Category return this.description; } + /** + * Gets the logo path. + * + * @return the logo path + */ public String getLogoPath() { - return this.logoPath; + String result; + + if (StringUtils.isBlank(this.logoPath)) + { + result = DEFAULT_LOGO_PATH; + } + else + { + result = this.logoPath; + } + + // + return result; } public String getName() @@ -141,7 +158,7 @@ public class Category } else { - this.logoPath = logoPath; + this.logoPath = "categories/" + logoPath; } } diff --git a/src/fr/devinsy/statoolinfos/core/Factory.java b/src/fr/devinsy/statoolinfos/core/Factory.java index 2797d98..e8e149f 100644 --- a/src/fr/devinsy/statoolinfos/core/Factory.java +++ b/src/fr/devinsy/statoolinfos/core/Factory.java @@ -70,7 +70,7 @@ public class Factory String name = properties.get(prefix + ".name"); String description = properties.get(prefix + ".description"); String softwares = properties.get(prefix + ".softwares"); - String logoPath = properties.get(prefix + ".logoPath"); + String logoPath = properties.get(prefix + ".logo"); StringList softwareList = new StringList(); if (StringUtils.isNotBlank(softwares)) diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index 15cb6de..7e59a5d 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -21,6 +21,7 @@ package fr.devinsy.statoolinfos.htmlize; import java.io.File; import java.io.IOException; +import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,6 +79,31 @@ public class Htmlizer } } + /** + * Copy categories stuff. + * + * @param path + * the path + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private static void copyCategoriesStuff(final String path, final File targetDirectory) throws IOException + { + if (StringUtils.isNotBlank(path)) + { + File source = new File(path); + File target = new File(targetDirectory, "categories"); + + for (File file : source.listFiles()) + { + if (file.isFile()) + { + FileUtils.copyFileToDirectory(file, target); + } + } + } + } + /** * Copy stuff. * @@ -189,7 +215,7 @@ public class Htmlizer // File categories = new File(targetDirectory, "categories"); categories.mkdirs(); - StatoolInfosUtils.copyRessource(source + "categories/default.png", categories); + StatoolInfosUtils.copyRessource(source + "categories/default.svg", categories); } } @@ -212,6 +238,7 @@ public class Htmlizer File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory(); copyStuff(htmlizeDirectory); + copyCategoriesStuff(HtmlizerContext.instance().getConfiguration().get("conf.htmlize.categories.icons"), htmlizeDirectory); AboutPage.build(); FederationPage.build(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/categories.xhtml b/src/fr/devinsy/statoolinfos/htmlize/categories.xhtml index f6e2a24..3f6ac17 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/categories.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/categories.xhtml @@ -31,7 +31,7 @@