Skip to content

Commit

Permalink
Merge pull request #2157 from SCADA-LTS/fix/#1927_Hardcoded_Scada_ver…
Browse files Browse the repository at this point in the history
…sion

#1927 Hardcoded Scada version - correct save desc instance in old ui …
  • Loading branch information
Limraj authored Apr 1, 2022
2 parents 9469652 + 94f9501 commit 1f9b447
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion WebContent/WEB-INF/jsp/emport.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
<tr>
<td><label for="projectName"><fmt:message
key="emport.projectName" />
</label> <input type="text" id="projectName" value="${instanceDescription}" /><br />
</label> <input type="text" id="projectName" value="${instanceDescriptionHeader}" /><br />
</td>

</tr>
Expand Down
2 changes: 1 addition & 1 deletion WebContent/WEB-INF/jsp/pointHierarchySLTS.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ thead th {
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="footer" align="center">&copy;2012-2021 Scada-LTS All rights reserved. <fmt:message
<td colspan="2" class="footer" align="center">&copy;2012-${toYear} Scada-LTS All rights reserved. <fmt:message
key="footer.rightsReserved" /></td>
</tr>
</table>
Expand Down
10 changes: 5 additions & 5 deletions WebContent/WEB-INF/jsp/systemSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</c:forEach>
$set(sel, settings.<c:out value="<%= SystemSettingsDAO.LANGUAGE %>"/>);
});
/*
SystemSettingsDwr.checkTypeDB(function(msg){
if (msg == "derby") {
Expand All @@ -108,7 +108,7 @@
if (msg == "mysql") {
document.getElementById('radioMysql').checked = true;
}
});
});*/
}
Expand Down Expand Up @@ -732,8 +732,8 @@
</tr>
</table>
</div>
<div class="borderDiv marB marR" style="float:left">

<!--div class="borderDiv marB marR" style="float:left">
<table align="center" "100%">
<tr>
<td>
Expand Down Expand Up @@ -792,7 +792,7 @@
</td>
</tr>
</table>
</div>
</div-->

<div class="borderDiv marB marR" style="float:left">
<div id="sms-domain"></div>
Expand Down
10 changes: 5 additions & 5 deletions WebContent/WEB-INF/tags/page.tag
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
<html>
<head>
<title><c:choose>
<c:when test="${!empty instanceDescription}">${instanceDescription}</c:when>
<c:when test="${!empty instanceDescriptionHeader}">${instanceDescriptionHeader}</c:when>
<c:otherwise><fmt:message key="header.title"/></c:otherwise>
</c:choose></title>

<!-- Meta -->
<meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="Copyright" content="ScadaLTS &copy;2020"/>
<meta name="Copyright" content="ScadaLTS &copy;${toYear}"/>
<meta name="DESCRIPTION" content="ScadaLTS Software"/>
<meta name="KEYWORDS" content="ScadaLTS Software"/>

Expand Down Expand Up @@ -151,8 +151,8 @@
</div>

<div>
<c:if test="${!empty instanceDescription}">
<span id="instanceDescription" align="right" valign="bottom" class="projectTitle">${instanceDescription}</span>
<c:if test="${!empty instanceDescriptionHeader}">
<span id="instanceDescriptionHeader" align="right" valign="bottom" class="projectTitle"><a href="system_settings.shtm" style="text-decoration: none;color:grey">${instanceDescriptionHeader}</a></span>
</c:if>
</div>
</div>
Expand Down Expand Up @@ -278,7 +278,7 @@
<jsp:doBody/>
</div>
<div id="sltsFooter" class="footer">
<span>&copy;2012-2021 Scada-LTS <fmt:message key="footer.rightsReserved"/><span>
<span>&copy;2012-${toYear} Scada-LTS <fmt:message key="footer.rightsReserved"/><span>
</div>
<c:if test="${!empty onload}">
<script type="text/javascript">dojo.addOnLoad(${onload});</script>
Expand Down
2 changes: 1 addition & 1 deletion scadalts-ui/build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const json = require(pkgJsonPath);

// ----- PACKAGE.JSON VARIABLES ----- //
var tag = '0.3.0';
var milestone = '2.6.0';
var milestone = 'Unknown';
var build = '0';
var branch = 'local';
var commit = 'N/A';
Expand Down
8 changes: 4 additions & 4 deletions scadalts-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "scadalts-ui",
"version": "0.3.0",
"tag": "2.6.1",
"milestone": "2.6.1",
"tag": "Unknown",
"milestone": "Unknown",
"build": "1",
"branch": "local",
"commit": "5576832f3e61b3fb31fa3b914260d1ef3f33b546",
"commit": "Unknown",
"pullRequestNumber": "1",
"pullRequestBranch": "prerelease/2.5.0",
"pullRequestBranch": "local",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --port 3000",
Expand Down
3 changes: 2 additions & 1 deletion src/com/serotonin/mango/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

import com.serotonin.ShouldNeverHappenException;
import com.serotonin.db.KeyValuePair;
import org.scada_lts.config.ScadaVersion;
import org.scada_lts.dao.SystemSettingsDAO;
import com.serotonin.mango.util.BackgroundContext;
import com.serotonin.mango.util.CommPortConfigException;
Expand Down Expand Up @@ -93,7 +94,7 @@ public class Common {
* the correct version.
*/
public static final String getVersion() {
return "2.6.10";
return ScadaVersion.getInstance().getVersionNumber();
}

public static final Long getStartupTime() {
Expand Down
6 changes: 3 additions & 3 deletions src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,11 @@ public DwrResponseI18n saveColourSettings(String chartBackgroundColour,
public void saveInfoSettings(String newVersionNotificationLevel,
String instanceDescription) {
Permissions.ensureAdmin();
SystemSettingsDAO SystemSettingsDAO = new SystemSettingsDAO();
SystemSettingsDAO.setValue(
SystemSettingsDAO systemSettingsDAO = new SystemSettingsDAO();
systemSettingsDAO.setValue(
SystemSettingsDAO.NEW_VERSION_NOTIFICATION_LEVEL,
newVersionNotificationLevel);
SystemSettingsDAO.setValue(SystemSettingsDAO.INSTANCE_DESCRIPTION,
systemSettingsDAO.setValue(SystemSettingsDAO.INSTANCE_DESCRIPTION,
instanceDescription);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.joda.time.DateTime;
import org.scada_lts.config.ScadaVersion;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
Expand All @@ -37,9 +38,10 @@ public class CommonDataInterceptor implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
request.setAttribute("availableLanguages", Common.getLanguages());
request.setAttribute("lang", ControllerUtils.getLocale(request).getLanguage());
request.setAttribute("instanceDescription", SystemSettingsDAO.getValue(SystemSettingsDAO.INSTANCE_DESCRIPTION));
request.setAttribute("instanceDescriptionHeader", SystemSettingsDAO.getValue(SystemSettingsDAO.INSTANCE_DESCRIPTION));
request.setAttribute("NEW_ID", Common.NEW_ID);
request.setAttribute("scadaVersion", ScadaVersion.getInstance());
request.setAttribute("toYear", DateTime.now().getYear());
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/org/scada_lts/config/ScadaVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private ScadaVersion() {
private static void setUpScadaVersionProperties() {
if (configuration != null) {
showVersionInfo = Boolean.parseBoolean(configuration.getProperty("slts.version.show", "false"));
versionNumber = configuration.getProperty("slts.version.number", Common.getVersion());
versionNumber = configuration.getProperty("slts.version.number", "Unknown");
buildNumber = Integer.parseInt(configuration.getProperty("slts.version.build", "0"));
commitNumber = configuration.getProperty("slts.version.commit", "");
runningOs = configuration.getProperty("slts.version.os", System.getProperty("os.name") + System.getProperty("os.version"));
Expand Down
6 changes: 3 additions & 3 deletions src/org/scada_lts/dao/SystemSettingsDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class SystemSettingsDAO {
+ DATABASE_STATEMENT + ";";

private static final String SELECT_LATEST_SCHEMA_VERSION = ""
+ "SELECT version FROM schema_version ORDER BY version DESC LIMIT 1";
+ "SELECT version FROM schema_version ORDER BY installed_rank DESC LIMIT 1";
// @formatter:on

private static final Log LOG = LogFactory.getLog(SystemSettingsDAO.class);
Expand Down Expand Up @@ -328,7 +328,7 @@ public String getDatabaseSchemaVersion(String key, String defaultValue) {
public static final Map<String, Object> DEFAULT_VALUES = new HashMap<String, Object>();

static {
DEFAULT_VALUES.put(DATABASE_SCHEMA_VERSION, "0.7.0");
DEFAULT_VALUES.put(DATABASE_SCHEMA_VERSION, "Unknown");

DEFAULT_VALUES.put(HTTP_CLIENT_PROXY_SERVER, "");
DEFAULT_VALUES.put(HTTP_CLIENT_PROXY_PORT, -1);
Expand Down Expand Up @@ -361,7 +361,7 @@ public String getDatabaseSchemaVersion(String key, String defaultValue) {
DEFAULT_VALUES.put(FUTURE_DATE_LIMIT_PERIODS, 24);
DEFAULT_VALUES.put(FUTURE_DATE_LIMIT_PERIOD_TYPE,
Common.TimePeriods.HOURS);
DEFAULT_VALUES.put(INSTANCE_DESCRIPTION, "Scada-LTS - 2.5");
DEFAULT_VALUES.put(INSTANCE_DESCRIPTION, "Click and set instance description");

DEFAULT_VALUES.put(CHART_BACKGROUND_COLOUR, "white");
DEFAULT_VALUES.put(PLOT_BACKGROUND_COLOUR, "white");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import org.scada_lts.cache.PointHierarchyCache;
import org.scada_lts.dao.model.pointhierarchy.PointHierarchyNode;
import org.scada_lts.service.pointhierarchy.PointHierarchyService;
Expand Down Expand Up @@ -76,6 +77,7 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer

model.put("appName", request.getContextPath());
model.put("appPort", request.getLocalPort());
model.put("toYear", DateTime.now().getYear());
return new ModelAndView("pointHierarchySLTS", model);
}
}
Expand Down
2 changes: 1 addition & 1 deletion webapp-resources/version.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scada-LTS version info.
slts.version.show=true
slts.version.number=v2.7.1
slts.version.number=Unknown
slts.version.build=0
slts.version.commit=(N/A)
slts.version.branch=local
Expand Down

0 comments on commit 1f9b447

Please sign in to comment.