From 5d7b54cdd4b782e00d9b9ff24f95e9a56242eb6e Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sun, 20 Aug 2017 17:34:54 +0200 Subject: [PATCH] Change analysis.html to server.html Remove the percentage signs at addValue --- .../java/com/djrapitops/plan/api/API.java | 6 ++--- .../djrapitops/plan/data/AnalysisData.java | 2 +- .../plan/data/additional/HookHandler.java | 4 ++-- .../plan/data/analysis/ActivityPart.java | 22 +++++++++---------- .../plan/data/analysis/GamemodePart.java | 12 +++++----- .../plan/data/analysis/RawData.java | 2 +- .../plan/ui/html/DataRequestHandler.java | 9 ++++---- .../response/AnalysisPageResponse.java | 2 +- .../utilities/analysis/ExportUtility.java | 2 +- Plan/test/test/java/utils/TestInit.java | 2 +- 10 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/api/API.java b/Plan/src/main/java/com/djrapitops/plan/api/API.java index 47a97c84f..cda2f300f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/api/API.java +++ b/Plan/src/main/java/com/djrapitops/plan/api/API.java @@ -211,15 +211,15 @@ public class API { *

* Check if the data is cached to AnalysisCache before calling this. * - * @return analysis.html with all placeholders replaced. + * @return server.html with all placeholders replaced. */ public String getAnalysisHtmlAsString() { WebServer server = plugin.getUiServer(); if (Verify.notNull(server)) { - return server.getDataReqHandler().getAnalysisHtml(); + return server.getDataReqHandler().getServerHtml(); } DataRequestHandler reqH = new DataRequestHandler(plugin); - return reqH.getAnalysisHtml(); + return reqH.getServerHtml(); } /** diff --git a/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java b/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java index c7c9227c0..6c992cacf 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java @@ -21,7 +21,7 @@ import java.util.Map; * analysed using the analysis method. *

* After being analysed the ReplaceMap can be retrieved for replacing - * placeholders on the analysis.html file. + * placeholders on the server.html file. * * @author Rsl1122 * @since 3.5.2 diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java index 6522987ef..eabc8274f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java @@ -73,7 +73,7 @@ public class HookHandler { /** * Used to get the Layout with PluginData placeholders to replace %plugins% - * placeholder on analysis.html. + * placeholder on server.html. * * @return html, getPluginsTabLayout-method * @see HtmlUtils @@ -85,7 +85,7 @@ public class HookHandler { } /** - * Used to get the Layout with PluginData placeholders to replace %plugins% + * Used to get the Layout with PluginData placeholders to replace ${plugins} * placeholder on player.html. * * @return html, getPluginsTabLayout-method diff --git a/Plan/src/main/java/com/djrapitops/plan/data/analysis/ActivityPart.java b/Plan/src/main/java/com/djrapitops/plan/data/analysis/ActivityPart.java index f102c7b58..159378f36 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/analysis/ActivityPart.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/analysis/ActivityPart.java @@ -83,7 +83,7 @@ public class ActivityPart extends RawData { private void playerActivityGraphs() { List tpsData = tpsPart.getTpsData(); addValue("playersonlineseries", PlayerActivityGraphCreator.buildSeriesDataString(tpsData)); - addValue("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL.toString()); + addValue("playersgraphcolor", Settings.HCOLOR_ACT_ONL.toString()); } private void activityPiechart() { @@ -93,24 +93,24 @@ public class ActivityPart extends RawData { final String colJoi = Settings.HCOLOR_ACTP_JON.toString(); final String colBan = Settings.HCOLOR_ACTP_BAN.toString(); - addValue("%activecol%", colAct); - addValue("%inactivecol%", colIna); - addValue("%joinleavecol%", colJoi); - addValue("%bancol%", colBan); + addValue("activecol", colAct); + addValue("inactivecol", colIna); + addValue("joinleavecol", colJoi); + addValue("bancol", colBan); String activityColors = HtmlUtils.separateWithQuotes( "#" + colAct, "#" + colIna, "#" + colJoi, "#" + colBan ); - addValue("%activitycolors%", activityColors); + addValue("activitycolors", activityColors); String activityLabels = "[" + HtmlUtils.separateWithQuotes( "Active", "Inactive", "Unknown", "Banned") + "]"; - addValue("%labelsactivity%", activityLabels); + addValue("labelsactivity", activityLabels); addValue("activitydata", Arrays.toString(counts)); - addValue("%active%", counts[0]); - addValue("%inactive%", counts[1]); - addValue("%joinleaver%", counts[2]); - addValue("%banned%", counts[3]); + addValue("active", counts[0]); + addValue("inactive", counts[1]); + addValue("joinleaver", counts[2]); + addValue("banned", counts[3]); } public void addBan(UUID uuid) { diff --git a/Plan/src/main/java/com/djrapitops/plan/data/analysis/GamemodePart.java b/Plan/src/main/java/com/djrapitops/plan/data/analysis/GamemodePart.java index c01e20951..f7ddd3004 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/analysis/GamemodePart.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/analysis/GamemodePart.java @@ -58,17 +58,17 @@ public class GamemodePart extends RawData { String col2 = Settings.HCOLOR_GMP_2.toString(); String col3 = Settings.HCOLOR_GMP_3.toString(); - addValue("%gm0col%", col0); - addValue("%gm1col%", col1); - addValue("%gm2col%", col2); - addValue("%gm3col%", col3); + addValue("gm0col", col0); + addValue("gm1col", col1); + addValue("gm2col", col2); + addValue("gm3col", col3); String gmColors = HtmlUtils.separateWithQuotes( "#" + col0, "#" + col1, "#" + col2, "#" + col3 ); String gmLabels = "[" + HtmlUtils.separateWithQuotes( "Survival", "Creative", "Adventure", "Spectator") + "]"; - addValue("%gmcolors%", gmColors); - addValue("%gmlabels%", gmLabels); + addValue("gmcolors", gmColors); + addValue("gmlabel", gmLabels); // Adds Percentage indicators for (int i = 0; i < percentages.length; i++) { diff --git a/Plan/src/main/java/com/djrapitops/plan/data/analysis/RawData.java b/Plan/src/main/java/com/djrapitops/plan/data/analysis/RawData.java index 71aebb51c..c96cfbe31 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/analysis/RawData.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/analysis/RawData.java @@ -68,7 +68,7 @@ public abstract class RawData { /** * Adds a placeholder to the replaceMap. * - * @param placeholder placeholder, with or without % signs. + * @param placeholder placeholder, without prefix and suffix * @param value Any value the placeholder should be replaced with. */ public void addValue(String placeholder, Serializable value) { diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/html/DataRequestHandler.java b/Plan/src/main/java/com/djrapitops/plan/ui/html/DataRequestHandler.java index f60a9bbdb..89a538d9f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/html/DataRequestHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/html/DataRequestHandler.java @@ -63,21 +63,20 @@ public class DataRequestHandler { } /** - * Returns the analysis.html as string with replaced placeholders. + * Returns the server.html as string with replaced placeholders. * * @return the html */ - @Deprecated //analysis.html has been removed //TODO server.html - public String getAnalysisHtml() { + public String getServerHtml() { try { if (!analysisCache.isCached()) { return "

404 Data was not found in cache

"; } return HtmlUtils.replacePlaceholders( - HtmlUtils.getStringFromResource("analysis.html"), + HtmlUtils.getStringFromResource("server.html"), PlaceholderUtils.getAnalysisReplaceRules(analysisCache.getData())); } catch (FileNotFoundException ex) { - return "

404 analysis.html was not found

"; + return "

404 server.html was not found

"; } } diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/AnalysisPageResponse.java b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/AnalysisPageResponse.java index 54dd1e146..5fbe12f2a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/AnalysisPageResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/AnalysisPageResponse.java @@ -10,6 +10,6 @@ public class AnalysisPageResponse extends Response { public AnalysisPageResponse(DataRequestHandler h) { super.setHeader("HTTP/1.1 200 OK"); - super.setContent(h.getAnalysisHtml()); + super.setContent(h.getServerHtml()); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java index b859d34e9..0881f798c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java @@ -141,7 +141,7 @@ public class ExportUtility { return; } serverFolder.mkdirs(); - String analysisHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getStringFromResource("analysis.html"), //TODO server.html + String analysisHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getStringFromResource("server.html"), PlaceholderUtils.getAnalysisReplaceRules(analysisData)) .replace(HtmlUtils.getInspectUrl(""), "../player/"); File analysisHtmlFile = new File(serverFolder, "index.html"); diff --git a/Plan/test/test/java/utils/TestInit.java b/Plan/test/test/java/utils/TestInit.java index 6b555a71c..dd23df24e 100644 --- a/Plan/test/test/java/utils/TestInit.java +++ b/Plan/test/test/java/utils/TestInit.java @@ -89,7 +89,7 @@ public class TestInit { // Html Files File analysis = new File(getClass().getResource("/server.html").getPath()); - when(planMock.getResource("analysis.html")).thenReturn(new FileInputStream(analysis)); + when(planMock.getResource("server.html")).thenReturn(new FileInputStream(analysis)); File player = new File(getClass().getResource("/player.html").getPath()); when(planMock.getResource("player.html")).thenReturn(new FileInputStream(player));