commit dda400791af082c710f02101c71ff89fb2a66de3
parent 66386a45fd0ec51628ef65e0e0061e937575867f
Author: Felicitus <felicitus@felicitus.org>
Date: Thu, 13 Jun 2013 15:40:46 +0200
Added very basic MOTD support
Diffstat:
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/config.php.template b/config.php.template
@@ -57,6 +57,11 @@ Configuration::setOption("partkeepr.database.mysql_socket", null);
Configuration::setOption("partkeepr.database.driver", "pdo_mysql");
+/**
+ * Specifies a message of the day (MOTD) to display on login. Simply replace false with any string.
+ */
+Configuration::setOption("partkeepr.frontend.motd", false);
+
/***********************************************************************************************************************
* CONFIGURATION SETTINGS FOR MIGRATING FROM PARTDB TO PARTKEEPR. LEAVE UNTOUCHED IF YOU DON'T HAVE PARTDB TO MIGRATE
**********************************************************************************************************************/
diff --git a/src/frontend/index.php b/src/frontend/index.php
@@ -83,6 +83,10 @@ if (Configuration::getOption("partkeepr.frontend.autologin.enabled", false) ===
$aParameters["autoLoginPassword"] = Configuration::getOption("partkeepr.frontend.autologin.password");
}
+if (Configuration::getOption("partkeepr.frontend.motd", false) !== false) {
+ $aParameters["motd"] = Configuration::getOption("partkeepr.frontend.motd");
+}
+
/* Load and render the template */
$template = $twig->loadTemplate("index.tpl");
diff --git a/src/frontend/js/PartKeepr.js b/src/frontend/js/PartKeepr.js
@@ -73,7 +73,11 @@ Ext.application({
/* @todo Load user preferences directly on login and not via delayed task */
this.displayTipWindowTask = new Ext.util.DelayedTask(this.displayTipOfTheDayWindow, this);
this.displayTipWindowTask.delay(100);
-
+
+ if (window.parameters.motd) {
+ this.displayMOTD();
+ }
+
this.setSession(this.getSessionManager().getSession());
this.getStatusbar().getConnectionButton().setConnected();
@@ -133,6 +137,12 @@ Ext.application({
}
},
/**
+ * Displays a message-of-the-day
+ */
+ displayMOTD: function () {
+ Ext.MessageBox.alert(i18n("Message of the day"), window.parameters.motd);
+ },
+ /**
* Does a schema status call against the PartKeepr installation, in order to verify if the schema is up-to-date.
*
* @param none