Skip to content

Commit

Permalink
#1580 Improvement describe information about scada on top
Browse files Browse the repository at this point in the history
Added:
- Custom text on top inside mainHeader, next to app logo
- input area for text to be displayed in main header next to logo
- input area for css style of that aforementioned custom text
  • Loading branch information
Patrykb0802 committed Aug 7, 2024
1 parent 43ac248 commit 22cbea5
Show file tree
Hide file tree
Showing 18 changed files with 91 additions and 1 deletion.
19 changes: 19 additions & 0 deletions WebContent/WEB-INF/jsp/systemSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
$set("<c:out value="<%= SystemSettingsDAO.WEB_RESOURCE_GRAPHICS_PATH %>"/>", settings.<c:out value="<%= SystemSettingsDAO.WEB_RESOURCE_GRAPHICS_PATH %>"/>);
$set("<c:out value="<%= SystemSettingsDAO.WEB_RESOURCE_UPLOADS_PATH %>"/>", settings.<c:out value="<%= SystemSettingsDAO.WEB_RESOURCE_UPLOADS_PATH %>"/>);
$set("<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION %>"/>", settings.<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION %>"/>);
$set("<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET %>"/>", settings.<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET %>"/>);
setDisabled($("<c:out value="<%= SystemSettingsDAO.WORK_ITEMS_REPORTING_ITEMS_PER_SECOND_ENABLED %>"/>"), !settings.<c:out value="<%= SystemSettingsDAO.WORK_ITEMS_REPORTING_ENABLED %>"/>);
setDisabled($("<c:out value="<%= SystemSettingsDAO.WORK_ITEMS_REPORTING_ITEMS_PER_SECOND_LIMIT %>"/>"), !settings.<c:out value="<%= SystemSettingsDAO.WORK_ITEMS_REPORTING_ENABLED %>"/> || !settings.<c:out value="<%= SystemSettingsDAO.WORK_ITEMS_REPORTING_ITEMS_PER_SECOND_ENABLED %>"/>);
Expand Down Expand Up @@ -310,13 +312,16 @@
$get("<c:out value="<%= SystemSettingsDAO.WEB_RESOURCE_GRAPHICS_PATH %>"/>"),
$get("<c:out value="<%= SystemSettingsDAO.WEB_RESOURCE_UPLOADS_PATH %>"/>"),
$get("<c:out value="<%= SystemSettingsDAO.EVENT_ASSIGN_ENABLED %>"/>"),
$get("<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION %>"/>"),
$get("<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET %>"/>"),
function(response) {
stopImageFader("saveMiscSettingsImg");
if (response.hasMessages)
setUserMessage("miscMessage", response.messages[0].contextualMessage);
else {
setUserMessage("miscMessage", "<fmt:message key="systemSettings.miscSaved"/>");
}
location.reload();
});
setUserMessage("miscMessage");
startImageFader("saveMiscSettingsImg");
Expand Down Expand Up @@ -963,6 +968,20 @@
</td>
<td colspan="2" id="graphicsPathMessage" class="formError"></td>
</tr>
<tr>
<td class="formLabelRequired"><fmt:message key="systemsettings.custom.information"/></td>
<td class="formField">
<input id="<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION %>"/>" type="text" class="formShort" style="width: 300px;"/>
</td>
</tr>
<tr>
<td class="formLabelRequired"><fmt:message key="systemsettings.custom.information.stylesheet"/></td>
<td class="formField">
<div>#custom-information {</div>
<input id="<c:out value="<%= SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET %>"/>" type="text" class="formShort" style="width: 300px; height: 50px;"/>
<div>}</div>
</td>
</tr>
<tr>
<td class="formLabelRequired"><fmt:message key="event.assign.enabled"/></td>
<td class="formField">
Expand Down
6 changes: 6 additions & 0 deletions WebContent/WEB-INF/tags/logo.tag
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<%@include file="/WEB-INF/tags/decl.tagf" %>

<div class="logo-section">
<style>
#custom-information {
${scadaVersion.getCustomStyles()}
}
</style>
<div class="logo-section--title">
<img id="logo" src="assets/logo.png" alt="Logo">
<span id="custom-information">${scadaVersion.getCustomInformation()}</span>
<c:if test="${(!empty scadaVersion) && scadaVersion.isShowVersionInfo()}">
<c:if test="${!empty scadaVersion.getCompanyName()}">
<div id="company-container">
Expand Down
8 changes: 7 additions & 1 deletion src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ public Map<String, Object> getSettings() {
systemSettingsService.getMiscSettings().getWebResourceUploadsPath());
settings.put(SystemSettingsDAO.EVENT_ASSIGN_ENABLED,
systemSettingsService.getMiscSettings().isEventAssignEnabled());
settings.put(SystemSettingsDAO.CUSTOM_INFORMATION,
systemSettingsService.getMiscSettings().getCustomInformation());
settings.put(SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET,
systemSettingsService.getMiscSettings().getCustomInformationStylesheet());
return settings;
}

Expand Down Expand Up @@ -332,7 +336,7 @@ public DwrResponseI18n saveMiscSettings(int uiPerformance, String dataPointRtVal
boolean workItemsReportingEnabled, boolean workItemsReportingItemsPerSecondEnabled,
int workItemsReportingItemsPerSecondLimit, int threadsNameAdditionalLength,
String webResourceGraphicsPath, String webResourceUploadsPath,
boolean eventAssignEnabled) {
boolean eventAssignEnabled, String customInformation, String customInformationStylesheet) {
Permissions.ensureAdmin();
SystemSettingsDAO systemSettingsDAO = new SystemSettingsDAO();
DwrResponseI18n response = new DwrResponseI18n();
Expand Down Expand Up @@ -392,6 +396,8 @@ public DwrResponseI18n saveMiscSettings(int uiPerformance, String dataPointRtVal
}
SystemSettingsService systemSettingsService = new SystemSettingsService();
systemSettingsService.saveEventAssignEnabled(eventAssignEnabled);
systemSettingsDAO.setValue(SystemSettingsDAO.CUSTOM_INFORMATION, customInformation);
systemSettingsDAO.setValue(SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET, customInformationStylesheet);
return response;
}

Expand Down
10 changes: 10 additions & 0 deletions src/org/scada_lts/config/ScadaVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import com.serotonin.mango.Common;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.scada_lts.dao.SystemSettingsDAO;


import java.io.FileInputStream;
import java.util.Properties;

import static org.scada_lts.dao.SystemSettingsDAO.CUSTOM_INFORMATION;
import static org.scada_lts.dao.SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET;

/**
* Scada Version class
*
Expand Down Expand Up @@ -134,4 +138,10 @@ public String getCompanyName() {
public String getPoweredBy() {
return poweredBy;
}
public String getCustomInformation() {
return SystemSettingsDAO.getValue(CUSTOM_INFORMATION);
}
public String getCustomStyles(){
return SystemSettingsDAO.getValue(CUSTOM_INFORMATION_STYLESHEET);
}
}
4 changes: 4 additions & 0 deletions src/org/scada_lts/dao/SystemSettingsDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ public class SystemSettingsDAO {
public static final String WEB_RESOURCE_GRAPHICS_PATH = "webResourceGraphicsPath";
public static final String WEB_RESOURCE_UPLOADS_PATH = "webResourceUploadsPath";
public static final String EVENT_ASSIGN_ENABLED = "eventAssignEnabled";
public static final String CUSTOM_INFORMATION = "customInformation";
public static final String CUSTOM_INFORMATION_STYLESHEET = "customInformationStylesheet";

// @formatter:off
private static final String SELECT_SETTING_VALUE_WHERE = ""
Expand Down Expand Up @@ -414,6 +416,8 @@ public String getDatabaseSchemaVersion(String key, String defaultValue) {
DEFAULT_VALUES.put(WEB_RESOURCE_GRAPHICS_PATH, SystemSettingsUtils.getWebResourceGraphicsPath());
DEFAULT_VALUES.put(WEB_RESOURCE_UPLOADS_PATH, SystemSettingsUtils.getWebResourceUploadsPath());
DEFAULT_VALUES.put(EVENT_ASSIGN_ENABLED, SystemSettingsUtils.isEventAssignEnabled());
DEFAULT_VALUES.put(CUSTOM_INFORMATION, "&nbsp;");
DEFAULT_VALUES.put(CUSTOM_INFORMATION_STYLESHEET, "color: green; font-size: 2em;");
}

@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, rollbackFor = SQLException.class)
Expand Down
5 changes: 5 additions & 0 deletions src/org/scada_lts/mango/service/SystemSettingsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public JsonSettingsMisc getMiscSettings() {
json.setWebResourceGraphicsPath(SystemSettingsDAO.getValue(SystemSettingsDAO.WEB_RESOURCE_GRAPHICS_PATH));
json.setWebResourceUploadsPath(SystemSettingsDAO.getValue(SystemSettingsDAO.WEB_RESOURCE_UPLOADS_PATH));
json.setEventAssignEnabled(SystemSettingsDAO.getBooleanValue(SystemSettingsDAO.EVENT_ASSIGN_ENABLED));
json.setCustomInformation(SystemSettingsDAO.getValue(SystemSettingsDAO.CUSTOM_INFORMATION));
json.setCustomInformationStylesheet(SystemSettingsDAO.getValue(SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET));
return json;
}

Expand All @@ -162,6 +164,9 @@ public void saveMiscSettings(JsonSettingsMisc json) {
systemSettingsDAO.setValue(SystemSettingsDAO.WEB_RESOURCE_GRAPHICS_PATH, json.getWebResourceGraphicsPath());
systemSettingsDAO.setValue(SystemSettingsDAO.WEB_RESOURCE_UPLOADS_PATH, json.getWebResourceUploadsPath());
saveEventAssignEnabled(json.isEventAssignEnabled());
systemSettingsDAO.setValue(SystemSettingsDAO.CUSTOM_INFORMATION, json.getCustomInformation());
systemSettingsDAO.setValue(SystemSettingsDAO.CUSTOM_INFORMATION_STYLESHEET, json.getCustomInformationStylesheet());

}

public SettingsDataRetention getDataRetentionSettings() {
Expand Down
18 changes: 18 additions & 0 deletions src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class JsonSettingsMisc implements Serializable {
public String webResourceGraphicsPath;
public String webResourceUploadsPath;
public boolean eventAssignEnabled;
public String customInformation;
public String customInformationStylesheet;

public JsonSettingsMisc() {}

Expand Down Expand Up @@ -123,4 +125,20 @@ public boolean isEventAssignEnabled() {
public void setEventAssignEnabled(boolean eventAssignEnabled) {
this.eventAssignEnabled = eventAssignEnabled;
}

public String getCustomInformation(){
return customInformation;
}

public void setCustomInformation(String customInformation){
this.customInformation = customInformation;
}

public String getCustomInformationStylesheet(){
return customInformationStylesheet;
}

public void setCustomInformationStylesheet(String customInformationStylesheet){
this.customInformationStylesheet = customInformationStylesheet;
}
}
2 changes: 2 additions & 0 deletions webapp-resources/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3346,6 +3346,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3349,6 +3349,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information = Custom information to display
systemsettings.custom.information.stylesheet = Custom information stylesheet
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3389,6 +3389,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_fi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3474,6 +3474,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3343,6 +3343,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_lu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3362,6 +3362,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3464,6 +3464,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_pl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3486,6 +3486,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_pt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3501,6 +3501,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3497,6 +3497,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down
2 changes: 2 additions & 0 deletions webapp-resources/messages_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3449,6 +3449,8 @@ event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
systemsettings.custom.information.stylesheet = Custom information stylesheet
systemsettings.custom.information = Custom information to display
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
Expand Down

0 comments on commit 22cbea5

Please sign in to comment.