Introduced WebCharterView.

This commit is contained in:
Christian P. MOMON 2020-09-21 03:41:46 +02:00
parent 4604ab1e7b
commit 348abcb993
16 changed files with 361 additions and 332 deletions

View file

@ -0,0 +1,65 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* StatoolInfos is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class AboutPage.
*/
public class AboutPage
{
private static Logger logger = LoggerFactory.getLogger(AboutPage.class);
/**
* Builds the.
*
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String build() throws StatoolInfosException
{
String result;
try
{
logger.debug("Building about page {}.");
TagDataManager data = new TagDataManager();
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/about.xhtml", data).toString();
result = WebCharterView.build(content);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building about page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -18,17 +18,12 @@
*/ */
package fr.devinsy.statoolinfos.htmlize; package fr.devinsy.statoolinfos.htmlize;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Federation; import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.Organization; import fr.devinsy.statoolinfos.core.Organization;
import fr.devinsy.statoolinfos.core.StatoolInfosException; import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.util.BuildInformation;
import fr.devinsy.xidyn.XidynException; import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils; import fr.devinsy.xidyn.presenters.PresenterUtils;
@ -59,9 +54,7 @@ public class FederationPage
TagDataManager data = new TagDataManager(); TagDataManager data = new TagDataManager();
data.setContent("versionsup", BuildInformation.instance().version()); data.setAttribute("federationRawButton", "href", federation.getTechnicalName() + ".properties");
data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE)));
data.setAttribute("federationLogo", "src", federation.getTechnicalName() + "-logo.png"); data.setAttribute("federationLogo", "src", federation.getTechnicalName() + "-logo.png");
data.setEscapedContent("federationName", federation.getName()); data.setEscapedContent("federationName", federation.getName());
data.setEscapedContent("federationDescription", federation.getDescription()); data.setEscapedContent("federationDescription", federation.getDescription());
@ -81,7 +74,9 @@ public class FederationPage
index += 1; index += 1;
} }
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federation.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federation.xhtml", data).toString();
result = WebCharterView.build(content);
} }
catch (XidynException exception) catch (XidynException exception)
{ {

View file

@ -108,7 +108,6 @@ public class Htmlizer
StatoolInfosUtils.copyRessource("/fr/devinsy/statoolinfos/htmlize/stuff/statoolinfos-logo-name.jpg", targetDirectory); StatoolInfosUtils.copyRessource("/fr/devinsy/statoolinfos/htmlize/stuff/statoolinfos-logo-name.jpg", targetDirectory);
StatoolInfosUtils.copyRessource("/fr/devinsy/statoolinfos/htmlize/stuff/statoolinfos-logo.jpg", new File(targetDirectory, "logo.jpg")); StatoolInfosUtils.copyRessource("/fr/devinsy/statoolinfos/htmlize/stuff/statoolinfos-logo.jpg", new File(targetDirectory, "logo.jpg"));
StatoolInfosUtils.copyRessource("/fr/devinsy/statoolinfos/htmlize/stuff/statoolinfos-logo.ico", new File(targetDirectory, "favicon.ico")); StatoolInfosUtils.copyRessource("/fr/devinsy/statoolinfos/htmlize/stuff/statoolinfos-logo.ico", new File(targetDirectory, "favicon.ico"));
StatoolInfosUtils.copyRessource("/fr/devinsy/statoolinfos/htmlize/stuff/about.xhtml", targetDirectory);
} }
} }
@ -216,9 +215,14 @@ public class Htmlizer
logger.info("Htmlize federation properties file."); logger.info("Htmlize federation properties file.");
FileUtils.copyFile(federation.getLocalFile(), new File(htmlizeDirectory, federation.getTechnicalName() + ".properties")); FileUtils.copyFile(federation.getLocalFile(), new File(htmlizeDirectory, federation.getTechnicalName() + ".properties"));
//
logger.info("Htmlize about page.");
String page = AboutPage.build();
FileUtils.write(new File(htmlizeDirectory, "about.xhtml"), page, StandardCharsets.UTF_8);
// //
logger.info("Htmlize federation page: {}.", federation.getName()); logger.info("Htmlize federation page: {}.", federation.getName());
String page = FederationPage.build(federation); page = FederationPage.build(federation);
FileUtils.write(new File(htmlizeDirectory, "index.xhtml"), page, StandardCharsets.UTF_8); FileUtils.write(new File(htmlizeDirectory, "index.xhtml"), page, StandardCharsets.UTF_8);
for (Organization organization : federation.getOrganizations()) for (Organization organization : federation.getOrganizations())
@ -290,7 +294,12 @@ public class Htmlizer
cache.restoreLogoTo(organization.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-logo.jpg"), organization.getTechnicalName()); cache.restoreLogoTo(organization.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-logo.jpg"), organization.getTechnicalName());
// //
String page = OrganizationPage.build(organization); logger.info("Htmlize about page.");
String page = AboutPage.build();
FileUtils.write(new File(htmlizeDirectory, "about.xhtml"), page, StandardCharsets.UTF_8);
//
page = OrganizationPage.build(organization);
FileUtils.write(new File(htmlizeDirectory, "index.xhtml"), page, StandardCharsets.UTF_8); FileUtils.write(new File(htmlizeDirectory, "index.xhtml"), page, StandardCharsets.UTF_8);
for (Service service : organization.getServices()) for (Service service : organization.getServices())

View file

@ -83,7 +83,9 @@ public class OrganizationPage
index += 1; index += 1;
} }
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organization.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organization.xhtml", data).toString();
result = WebCharterView.build(content);
} }
catch (XidynException exception) catch (XidynException exception)
{ {

View file

@ -88,7 +88,9 @@ public class PropertiesFilesPage
index += 1; index += 1;
} }
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml", data).toString();
result = WebCharterView.build(content);
} }
catch (XidynException exception) catch (XidynException exception)
{ {

View file

@ -132,7 +132,9 @@ public class PropertyStatsPage2
} }
// //
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml", data).toString();
result = WebCharterView.build(content);
} }
catch (XidynException exception) catch (XidynException exception)
{ {

View file

@ -68,25 +68,9 @@ public class ServicePage
data.setEscapedContent("serviceName", service.getName()); data.setEscapedContent("serviceName", service.getName());
data.setEscapedContent("serviceDescription", service.getDescription()); data.setEscapedContent("serviceDescription", service.getDescription());
// int index = 0; String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
// for (Service service : service.getServices())
// {
// data.setEscapedContent("serviceListLine", index,
// "serviceListLineNameLink", service.getName());
// data.setAttribute("serviceListLine", index,
// "serviceListLineNameLink", "href", service.getTechnicalName() +
// ".xhtml");
// data.setEscapedContent("serviceListLine", index,
// "serviceListLineUrlLink", service.getURL());
// data.setAttribute("serviceListLine", index,
// "serviceListLineUrlLink", "href", service.getURL());
// data.setEscapedContent("serviceListLine", index,
// "serviceListLineSoftware", service.getSoftware());
//
// index += 1;
// }
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString(); result = WebCharterView.build(content);
} }
catch (XidynException exception) catch (XidynException exception)
{ {

View file

@ -30,39 +30,43 @@ import fr.devinsy.statoolinfos.util.BuildInformation;
import fr.devinsy.xidyn.XidynException; import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils; import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.utils.XidynUtils;
/** /**
* The Class MainMenuView. * The Class WebCharterView.
*/ */
public class MainMenuView public class WebCharterView
{ {
private static Logger logger = LoggerFactory.getLogger(MainMenuView.class); private static Logger logger = LoggerFactory.getLogger(WebCharterView.class);
/** /**
* Builds the. * Builds the.
* *
* @param federation * @param content
* the organization * the content
* @return the string * @return the string
* @throws StatoolInfosException * @throws StatoolInfosException
* the statool infos exception * the statool infos exception
*/ */
public static String build(final String... paths) throws StatoolInfosException public static String build(final String content) throws StatoolInfosException
{ {
String result; String result;
try try
{ {
logger.debug("Building WebCharterView.");
TagDataManager data = new TagDataManager(); TagDataManager data = new TagDataManager();
data.setContent("versionsup", BuildInformation.instance().version()); data.setContent("versionsup", BuildInformation.instance().version());
data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE))); data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE)));
data.setContent("webCharterContent", XidynUtils.extractBodyContent(content));
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/mainMenu.xhtml", data).toString(); result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/webCharterView.xhtml", data).toString();
} }
catch (XidynException exception) catch (XidynException exception)
{ {
throw new StatoolInfosException("Error building mainMenu view: " + exception.getMessage(), exception); throw new StatoolInfosException("Error building webCharter view: " + exception.getMessage(), exception);
} }
// //

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js" />
<script src="Chart.bundle.min.js"></script>
</head>
<body>
<h2>Introduction</h2>
<p>StatoolInfos is a simple tool of statistics about federation, organizations and services.</p>
<h2>License and source repository</h2>
<p>The original author of StatoolInfos is Christian P. MOMON.</p>
<p>StatoolInfo is a free software released under the GNU AGPL license.</p>
<p>The official source repository is:</p>
<ul>
<li><a href="https://forge.devinsy.fr/devinsy/statoolinfos">https://forge.devinsy.fr/devinsy/statoolinfos</a></li>
</ul>
</body>
</html>

View file

@ -11,14 +11,6 @@
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
</head> </head>
<body> <body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">About</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<div style="margin: 5px;">
<a id="propertiesRawButton" href="propertiesFiles.xhtml" class="button">Properties</a>
<a id="propertiesRawButton" href="propertyStats.xhtml" class="button">Property Stats</a>
</div>
<div class="center"> <div class="center">
<h2><img id="federationLogo" src="#" style="width: 100px; heigth: 100px; vertical-align: middle;"/> <span id="federationName">Federation name</span></h2> <h2><img id="federationLogo" src="#" style="width: 100px; heigth: 100px; vertical-align: middle;"/> <span id="federationName">Federation name</span></h2>
<div style="margin: 5px;"> <div style="margin: 5px;">
@ -51,6 +43,5 @@
</table> </table>
</div> </div>
</div> </div>
</div>
</body> </body>
</html> </html>

View file

@ -11,9 +11,6 @@
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
</head> </head>
<body> <body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">About</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<h2><img id="organizationLogo" src="#" style="width: 100px; heigth: 100px;"/> <span id="organizationName">Organization name</span></h2> <h2><img id="organizationLogo" src="#" style="width: 100px; heigth: 100px;"/> <span id="organizationName">Organization name</span></h2>
<div style="margin: 5px;"> <div style="margin: 5px;">
@ -45,7 +42,5 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
</body> </body>
</html> </html>

View file

@ -11,13 +11,6 @@
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
</head> </head>
<body> <body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">About</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<div style="margin: 5px;">
<a id="propertiesRawButton" href="#" class="button">Properties</a>
</div>
<div class="center"> <div class="center">
<h2>Fichiers properties</h2> <h2>Fichiers properties</h2>
<div>Nombre de fichiers : <span id="fileCount">n/a</span></div> <div>Nombre de fichiers : <span id="fileCount">n/a</span></div>
@ -46,6 +39,5 @@
</table> </table>
</div> </div>
</div> </div>
</div>
</body> </body>
</html> </html>

View file

@ -11,13 +11,6 @@
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
</head> </head>
<body> <body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">À propos</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<div style="margin: 5px;">
<a id="propertiesRawButton" href="#" class="button">Property Stats</a>
</div>
<div class="row center_table" style="width: 1100px;"> <div class="row center_table" style="width: 1100px;">
<div class="column center"> <div class="column center">
<h2 id="statsTitleO">Statistics des property</h2> <h2 id="statsTitleO">Statistics des property</h2>
@ -137,7 +130,5 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</body> </body>
</html> </html>

View file

@ -11,9 +11,6 @@
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
</head> </head>
<body> <body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">About</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<h2><img id="serviceLogo" src="#" style="width: 100px; heigth: 100px;"/> <span id="serviceName">Service name</span></h2> <h2><img id="serviceLogo" src="#" style="width: 100px; heigth: 100px;"/> <span id="serviceName">Service name</span></h2>
<div style="margin: 5px;"> <div style="margin: 5px;">
<a id="serviceRawButton" href="#" class="button">Raw</a> <a id="serviceRawButton" href="#" class="button">Raw</a>
@ -35,7 +32,5 @@
</tr> </tr>
</table> </table>
</div> </div>
</div>
</body> </body>
</html> </html>

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js" />
<script src="Chart.bundle.min.js"></script>
</head>
<body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a> <a href="about.xhtml">About</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<h2>Introduction</h2>
<p>StatoolInfos is a simple tool of statistics about federation, organizations and services.</p>
<h2>License and source repository</h2>
<p>The original author of StatoolInfos is Christian P. MOMON.</p>
<p>StatoolInfo is a free software released under the GNU AGPL license.</p>
<p>The official source repository is:</p>
<ul>
<li><a href="https://forge.devinsy.fr/devinsy/statoolinfos">https://forge.devinsy.fr/devinsy/statoolinfos</a></li>
</ul>
</div>
</body>
</html>

View file

@ -12,15 +12,21 @@
</head> </head>
<body> <body>
<div style="margin: 5px 10px 10px 10px;"> <div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">À propos</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1> <h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">About</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<div style="margin: 5px;"> <div style="margin: 5px;">
<a id="propertiesRawButton" href="propertiesFiles.xhtml" class="button">Properties</a> <a id="propertiesRawButton" href="propertiesFiles.xhtml" class="button">Fichiers properties</a>
<a id="propertiesRawButton" href="propertyStats.xhtml" class="button">Property Stats</a> <a id="propertiesRawButton" href="propertyStats.xhtml" class="button">Toutes les property</a>
<a id="" href="#" class="button">Tous les services</a>
<a id="" href="#" class="button">Tous les logiciels</a>
</div> </div>
<div> <div>
<a href="index.xhtml">Accueil</a> <span id="menuPath"> <span id="menuPathItem"></span></span> <a href="index.xhtml">Fédération</a> <span id="menuPath"> > …<span id="menuPathItem"></span></span>
</div> </div>
<div id="webCharterContent" />
</div> </div>
</body> </body>
</html> </html>