+ *
+ * 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 .
+ */
+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;
+ }
+}
diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java
index f458dfc..cbe0cf6 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java
@@ -18,17 +18,12 @@
*/
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.LoggerFactory;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.Organization;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
-import fr.devinsy.statoolinfos.util.BuildInformation;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
@@ -59,9 +54,7 @@ public class FederationPage
TagDataManager data = new TagDataManager();
- data.setContent("versionsup", BuildInformation.instance().version());
- data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE)));
-
+ data.setAttribute("federationRawButton", "href", federation.getTechnicalName() + ".properties");
data.setAttribute("federationLogo", "src", federation.getTechnicalName() + "-logo.png");
data.setEscapedContent("federationName", federation.getName());
data.setEscapedContent("federationDescription", federation.getDescription());
@@ -81,7 +74,9 @@ public class FederationPage
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)
{
diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java
index ed6b3aa..cce30eb 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java
@@ -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.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/about.xhtml", targetDirectory);
}
}
@@ -216,9 +215,14 @@ public class Htmlizer
logger.info("Htmlize federation properties file.");
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());
- String page = FederationPage.build(federation);
+ page = FederationPage.build(federation);
FileUtils.write(new File(htmlizeDirectory, "index.xhtml"), page, StandardCharsets.UTF_8);
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());
//
- 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);
for (Service service : organization.getServices())
diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java
index cf3dba6..50225a5 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java
@@ -83,7 +83,9 @@ public class OrganizationPage
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)
{
diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java
index d2e6490..3751ed5 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java
@@ -88,7 +88,9 @@ public class PropertiesFilesPage
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)
{
diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java
index 52d38fe..b0a0738 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java
@@ -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)
{
diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java
index 052837c..49b2680 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java
@@ -68,25 +68,9 @@ public class ServicePage
data.setEscapedContent("serviceName", service.getName());
data.setEscapedContent("serviceDescription", service.getDescription());
- // int index = 0;
- // 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;
- // }
+ String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
- result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
+ result = WebCharterView.build(content);
}
catch (XidynException exception)
{
diff --git a/src/fr/devinsy/statoolinfos/htmlize/MainMenuView.java b/src/fr/devinsy/statoolinfos/htmlize/WebCharterView.java
similarity index 75%
rename from src/fr/devinsy/statoolinfos/htmlize/MainMenuView.java
rename to src/fr/devinsy/statoolinfos/htmlize/WebCharterView.java
index e22b278..ba91af8 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/MainMenuView.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/WebCharterView.java
@@ -30,39 +30,43 @@ import fr.devinsy.statoolinfos.util.BuildInformation;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
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.
*
- * @param federation
- * the organization
+ * @param content
+ * the content
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
- public static String build(final String... paths) throws StatoolInfosException
+ public static String build(final String content) throws StatoolInfosException
{
String result;
try
{
+ logger.debug("Building WebCharterView.");
+
TagDataManager data = new TagDataManager();
data.setContent("versionsup", BuildInformation.instance().version());
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)
{
- throw new StatoolInfosException("Error building mainMenu view: " + exception.getMessage(), exception);
+ throw new StatoolInfosException("Error building webCharter view: " + exception.getMessage(), exception);
}
//
diff --git a/src/fr/devinsy/statoolinfos/htmlize/about.xhtml b/src/fr/devinsy/statoolinfos/htmlize/about.xhtml
new file mode 100644
index 0000000..c4c9c1f
--- /dev/null
+++ b/src/fr/devinsy/statoolinfos/htmlize/about.xhtml
@@ -0,0 +1,25 @@
+
+
+
+
+ StatoolInfos
+
+
+
+
+
+
+
+
+ Introduction
+ StatoolInfos is a simple tool of statistics about federation, organizations and services.
+
+ License and source repository
+ The original author of StatoolInfos is Christian P. MOMON.
+ StatoolInfo is a free software released under the GNU AGPL license.
+ The official source repository is:
+
+
+
diff --git a/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml
index a4fc20c..447cdf8 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml
+++ b/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml
@@ -11,46 +11,37 @@
-
-
StatoolInfosv0.0.14 – AboutPage updated on
xx/xx/xxxx xx:xx
-
+
+
Federation name
-
-
-
Federation name
-
-
Bla bla description
-
Nombre de membres : n/a
-
Nombre de services : n/a
-
-
-
-
- Nom du membre |
- URL |
- Services |
-
-
-
-
-
-
-
- n/a
-
- |
- n/a |
- n/a |
-
-
-
-
+
Bla bla description
+
Nombre de membres : n/a
+
Nombre de services : n/a
+
+
+
+
+ Nom du membre |
+ URL |
+ Services |
+
+
+
+
+
+
+
+ n/a
+
+ |
+ n/a |
+ n/a |
+
+
+
-
+