diff options
author | Jonathan Bauer | 2019-01-31 16:22:50 +0100 |
---|---|---|
committer | Jonathan Bauer | 2019-01-31 16:22:50 +0100 |
commit | e025340c3e3056ca050b52ad05271a43846a2642 (patch) | |
tree | 733ca7ea725a84f5870827f7e89e3f9c08b59680 /dozentenmodul/src/main/java/org/openslx/dozmod/Config.java | |
parent | [*] Fix accidental use of Boolean.getBoolean. (-> .parseBoolean()) (diff) | |
download | tutor-module-e025340c3e3056ca050b52ad05271a43846a2642.tar.gz tutor-module-e025340c3e3056ca050b52ad05271a43846a2642.tar.xz tutor-module-e025340c3e3056ca050b52ad05271a43846a2642.zip |
[client] introduce branding, --dump and --pack
Application name, service name, master server endpoints, documentation
websites needed to be configurable to allow for an easy rebranding of
the suite.
Two new options allow this: use '--dump <folder>' to dump the jar's
configurable files into that folder. Aside from text templates in 'txt',
logos and icons in 'img', the 'branding.properties' file contains:
* masterserver.address : self-explanatory
* application.name : name to be shown on graphical elements like the
main window
* service.name : name to be used as a prefix for formulation like
'bwLehrpool-Team' or 'bwLehrpool-System' etc
* service.faq.website : link to FAQ website
* service.email : support contact address
Once edited, the whole folder can be integrated into the Suite with
'--pack <folder> <new_jar>'. The path to the new jar is then the
rebranded version of the suite.
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/Config.java')
-rwxr-xr-x | dozentenmodul/src/main/java/org/openslx/dozmod/Config.java | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java index b1e771b4..9c8b0b9e 100755 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java @@ -9,8 +9,6 @@ import java.io.InputStream; import java.util.Properties; import org.apache.log4j.Logger; -import org.openslx.dozmod.gui.window.DisclaimerWindow; -import org.openslx.dozmod.gui.window.PrivacyNoticeWindow; import org.openslx.dozmod.util.OsHelper; import org.openslx.util.QuickTimer; import org.openslx.util.QuickTimer.Task; @@ -93,7 +91,7 @@ public class Config { } // Check if we got a path - configFile = new File(configPath + File.separatorChar + "bwSuite" + File.separatorChar + configFile = new File(configPath + File.separatorChar + Branding.getServiceName() + File.separatorChar + "config.properties").getAbsoluteFile(); // Check if the directory exists. @@ -128,7 +126,8 @@ public class Config { private static void forceSaveInternal() throws FileNotFoundException, IOException { synchronized (prop) { - prop.store(new FileOutputStream(configFile), "bwLehrpool Dozentenmodul Client Config"); + prop.store(new FileOutputStream(configFile), + Branding.getServiceName() + " Dozentenmodul Client Config"); } } @@ -192,15 +191,8 @@ public class Config { * * @return version of the disclaimer the user accepted, 0 otherwise. */ - public static int getDisclaimerAgreement() { - int savedVersion = getInteger("disclaimer.accepted_version", 0); - // check if we have a saved version and if it is larger than - // the current version. If it is, reset it to 0. - if (savedVersion != 0 && Math.abs(savedVersion - DisclaimerWindow.DISCLAIMER_VERSION) != 0) { - setDisclaimerAgreement(0); - return 0; - } - return savedVersion; + public static String getDisclaimerAgreement() { + return getString("disclaimer.accepted_version", ""); } /** @@ -208,8 +200,8 @@ public class Config { * * @return true if it succeeded, false otherwise */ - public static void setDisclaimerAgreement(int value) { - setInteger("disclaimer.accepted_version", value); + public static void setDisclaimerAgreement(String value) { + setString("disclaimer.accepted_version", value); } /** @@ -217,15 +209,8 @@ public class Config { * * @return version of the privacy notice the user accepted, 0 otherwise. */ - public static int getPrivacyAgreement() { - int savedVersion = getInteger("privacy.accepted_version", 0); - // check if we have a saved version and if it is larger than - // the current version. If it is, reset it to 0. - if (savedVersion != 0 && Math.abs(savedVersion - PrivacyNoticeWindow.PRIVACY_VERSION) != 0) { - setPrivacyAgreement(0); - return 0; - } - return savedVersion; + public static String getPrivacyAgreement() { + return getString("privacy.accepted_version", ""); } /** @@ -233,8 +218,8 @@ public class Config { * * @return true if it succeeded, false otherwise */ - public static void setPrivacyAgreement(int value) { - setInteger("privacy.accepted_version", value); + public static void setPrivacyAgreement(String value) { + setString("privacy.accepted_version", value); } /** @@ -367,8 +352,8 @@ public class Config { * @return Saved session, or <code>null</code> if no session was saved */ public static SavedSession getSavedSession() { - SavedSession session = new SavedSession(getString("session.address", ""), getString("session.token", - ""), getString("session.mastertoken", "")); + SavedSession session = new SavedSession(getString("session.address", ""), + getString("session.token", ""), getString("session.mastertoken", "")); if (session.token.isEmpty() || session.address.isEmpty() || session.masterToken.isEmpty()) return null; return session; |