Added external categories icons management.

This commit is contained in:
Christian P. MOMON 2020-10-31 00:04:56 +01:00
parent 907fd57c5d
commit 62fa2b9399
9 changed files with 274 additions and 13 deletions

View file

@ -27,7 +27,7 @@ import fr.devinsy.strings.StringList;
*/ */
public class Category 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 name;
private String description; private String description;
@ -68,9 +68,26 @@ public class Category
return this.description; return this.description;
} }
/**
* Gets the logo path.
*
* @return the logo path
*/
public String getLogoPath() 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() public String getName()
@ -141,7 +158,7 @@ public class Category
} }
else else
{ {
this.logoPath = logoPath; this.logoPath = "categories/" + logoPath;
} }
} }

View file

@ -70,7 +70,7 @@ public class Factory
String name = properties.get(prefix + ".name"); String name = properties.get(prefix + ".name");
String description = properties.get(prefix + ".description"); String description = properties.get(prefix + ".description");
String softwares = properties.get(prefix + ".softwares"); String softwares = properties.get(prefix + ".softwares");
String logoPath = properties.get(prefix + ".logoPath"); String logoPath = properties.get(prefix + ".logo");
StringList softwareList = new StringList(); StringList softwareList = new StringList();
if (StringUtils.isNotBlank(softwares)) if (StringUtils.isNotBlank(softwares))

View file

@ -21,6 +21,7 @@ package fr.devinsy.statoolinfos.htmlize;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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. * Copy stuff.
* *
@ -189,7 +215,7 @@ public class Htmlizer
// //
File categories = new File(targetDirectory, "categories"); File categories = new File(targetDirectory, "categories");
categories.mkdirs(); 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(); File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
copyStuff(htmlizeDirectory); copyStuff(htmlizeDirectory);
copyCategoriesStuff(HtmlizerContext.instance().getConfiguration().get("conf.htmlize.categories.icons"), htmlizeDirectory);
AboutPage.build(); AboutPage.build();
FederationPage.build(); FederationPage.build();

View file

@ -31,7 +31,7 @@
<tr id="categoryListLine"> <tr id="categoryListLine">
<td id="categoryListLineName" style="padding-top: 0; padding-bottom: 0;"> <td id="categoryListLineName" style="padding-top: 0; padding-bottom: 0;">
<a href="#" id="categoryListLineNameLink"> <a href="#" id="categoryListLineNameLink">
<img id="categoryListLineNameLogo" src="categories/default.png" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/> <img id="categoryListLineNameLogo" src="categories/default.svg" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/>
<span id="categoryListLineNameValue">n/a</span> <span id="categoryListLineNameValue">n/a</span>
</a> </a>
</td> </td>

View file

@ -11,7 +11,7 @@
<body> <body>
<span id="category"> <span id="category">
<a id="categoryLink" href="#" title="Catégorie"> <a id="categoryLink" href="#" title="Catégorie">
<img id="categoryLogo" src="categories/default.png" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/> <img id="categoryLogo" src="categories/default.svg" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/>
<span id="categoryName">n/a</span> <span id="categoryName">n/a</span>
</a> </a>
</span> </span>

View file

@ -14,7 +14,7 @@
<div class="center" > <div class="center" >
<div class="row center"> <div class="row center">
<div class="column"> <div class="column">
<img id="categoryLogo" src="categories/default.png" style="width: 100px; height: 100px;"/> <img id="categoryLogo" src="categories/default.svg" style="width: 100px; height: 100px;"/>
</div> </div>
<div class="column" style="border: 0px solid red; max-width: 400px;"> <div class="column" style="border: 0px solid red; max-width: 400px;">
<div id="categoryName" class="content_title">n/a</div> <div id="categoryName" class="content_title">n/a</div>

View file

@ -68,12 +68,15 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$('#organizations').DataTable( $(document).ready( function ()
{ {
paging: false, $('#organizations').DataTable(
ordering: true, {
"order": [[ 0, "asc" ]], paging: false,
language: dataTableFrench ordering: true,
"order": [[ 0, "asc" ]],
language: dataTableFrench
});
}); });
</script> </script>
</body> </body>

View file

@ -0,0 +1,4 @@
Copyright : CC-BY-SA
Creator : GNOME project
Artist : GNOME project
Relation : https://commons.wikimedia.org/wiki/File:Gnome-folder-visiting.svg

View file

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:export-ydpi="90.000000"
inkscape:export-xdpi="90.000000"
inkscape:export-filename="/home/jimmac/Desktop/inkscape.png"
sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/status"
sodipodi:docname="folder-visiting.svg"
inkscape:version="0.45"
sodipodi:version="0.32"
id="svg1"
height="48.000000px"
width="48.000000px"
y="0.0000000"
x="0.0000000"
version="1.0"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<metadata
id="metadata162">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Folder Active</dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:creator>
<dc:date>2005-02-01</dc:date>
<cc:license
rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
<dc:identifier>http://jimmac.musichall.cz/</dc:identifier>
<dc:subject>
<rdf:Bag>
<rdf:li>folder</rdf:li>
<rdf:li>directory</rdf:li>
<rdf:li>storage</rdf:li>
</rdf:Bag>
</dc:subject>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
<cc:requires
rdf:resource="http://web.resource.org/cc/SourceCode" />
</cc:License>
</rdf:RDF>
</metadata>
<sodipodi:namedview
inkscape:current-layer="layer2"
inkscape:window-y="113"
inkscape:window-x="481"
showgrid="true"
inkscape:document-units="px"
inkscape:zoom="1"
inkscape:cx="78.671307"
inkscape:cy="-0.43917301"
inkscape:window-height="962"
inkscape:window-width="1097"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="0.25882353"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
inkscape:showpageshadow="false" />
<defs
id="defs3">
<linearGradient
id="linearGradient4734">
<stop
style="stop-color:#cccdbc;stop-opacity:1;"
offset="0"
id="stop4736" />
<stop
style="stop-color:#b9baa4;stop-opacity:1;"
offset="1"
id="stop4738" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4734"
id="linearGradient4740"
x1="24.588383"
y1="1.8991361"
x2="24.588383"
y2="40.858932"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3341">
<stop
id="stop3343"
offset="0.0000000"
style="stop-color:#ffffff;stop-opacity:0.36633664;" />
<stop
id="stop3345"
offset="1.0000000"
style="stop-color:#ffffff;stop-opacity:0.0000000;" />
</linearGradient>
<linearGradient
y2="25.197067"
x2="86.307266"
y1="60.062927"
x1="86.307266"
gradientTransform="scale(1.122625,0.89077)"
gradientUnits="userSpaceOnUse"
id="linearGradient3457"
xlink:href="#linearGradient3341"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3341"
id="linearGradient3793"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(1.122625,0.89077)"
x1="86.307266"
y1="60.062927"
x2="86.307266"
y2="25.197067" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3341"
id="linearGradient3795"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(1.122625,0.89077)"
x1="86.307266"
y1="60.062927"
x2="86.307266"
y2="25.197067" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3341"
id="linearGradient3797"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(1.122625,0.89077)"
x1="86.307266"
y1="60.062927"
x2="86.307266"
y2="25.197067" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3341"
id="linearGradient3799"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(1.122625,0.89077)"
x1="86.307266"
y1="60.062927"
x2="86.307266"
y2="25.197067" />
</defs>
<g
style="display:inline"
inkscape:label="pixmap"
id="layer1"
inkscape:groupmode="layer" />
<g
style="display:inline"
inkscape:label="vectors"
id="layer2"
inkscape:groupmode="layer">
<path
id="path895"
d="M 5.4062500,5.4687500 C 4.9412732,5.4687500 4.5937500,5.6960038 4.5937500,6.1875000 L 4.5937500,19.781250 C 3.1197790,19.875100 2.3750000,20.350995 2.3750000,22.125000 L 4.0000000,38.937500 C 4.0000000,39.737184 4.6378161,40.375000 5.4375000,40.375000 L 5.6562500,40.375000 C 5.6926022,40.378071 5.7124666,40.406250 5.7500000,40.406250 L 43.500000,40.406250 C 43.898877,40.406249 44.109770,40.235327 44.250000,39.968750 C 44.259540,39.959210 44.271980,39.947305 44.281250,39.937500 C 44.525496,39.679168 44.656250,39.322722 44.656250,38.937500 L 46.406250,17.218750 C 46.406250,16.419065 45.768435,15.781250 44.968750,15.781250 L 44.406250,15.781250 L 44.406250,10.437500 C 44.406250,9.8945350 44.030021,9.5937500 43.531250,9.5937500 L 24.406250,9.5937500 C 24.069238,9.5937504 23.729051,9.3978610 23.531250,9.1250000 L 20.906250,5.9062500 C 20.688385,5.6057111 20.277453,5.4687500 19.906250,5.4687500 L 5.4062500,5.4687500 z "
style="fill:url(#linearGradient4740);fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:0.99999988;stroke-miterlimit:4;stroke-opacity:1;opacity:1;color:#000000;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-dasharray:none;stroke-dashoffset:0;visibility:visible;display:inline;overflow:visible" />
<g
transform="matrix(0.186703,0.000000,0.000000,0.186703,-21.10730,57.62299)"
id="g891" />
<g
style="fill:url(#linearGradient3457);fill-opacity:1;display:inline"
transform="matrix(0.978667,0,0,0.978667,-70.33924,-23.05916)"
id="g3330">
<path
id="rect3294"
d="M 117.59375,57.53125 L 111.5625,63.5625 L 112.5,64.5 L 116,64.5 C 116.39888,64.499999 116.60977,64.329077 116.75,64.0625 C 116.75954,64.05296 116.77198,64.041055 116.78125,64.03125 C 117.0255,63.772918 117.15625,63.416472 117.15625,63.03125 L 117.59375,57.53125 z "
style="color:#000000;fill:url(#linearGradient3793);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
<path
id="rect3296"
d="M 85.53125,29.5625 L 77.09375,38 L 77.09375,43.875 C 75.619781,43.96885 74.875,44.444745 74.875,46.21875 L 75.3125,50.75 L 94.625,31.46875 L 93.40625,30 C 93.188382,29.699461 92.77745,29.5625 92.40625,29.5625 L 85.53125,29.5625 z "
style="color:#000000;fill:url(#linearGradient3795);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
<path
id="rect3298"
d="M 116.90625,38.1875 L 91.5625,63.5625 L 92.5,64.5 L 101.5625,64.5 L 118.40625,47.6875 L 118.90625,41.3125 C 118.90625,40.512815 118.26843,39.875 117.46875,39.875 L 116.90625,39.875 L 116.90625,38.1875 z "
style="color:#000000;fill:url(#linearGradient3797);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
<path
id="rect3300"
d="M 101.40625,33.6875 L 76.125,59 L 76.5,63.03125 C 76.500002,63.830934 77.137816,64.46875 77.9375,64.46875 L 78.15625,64.46875 C 78.192604,64.471821 78.212467,64.5 78.25,64.5 L 81.5625,64.5 L 112.40625,33.6875 L 101.40625,33.6875 z "
style="color:#000000;fill:url(#linearGradient3799);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.5 KiB