Commit 285b780d authored by Christoffer Ackelman's avatar Christoffer Ackelman

JS: Autoformat files

parent 220549a4
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -98,36 +98,11 @@ var Pwr = {
mAccess_RtEventsAck: 1 << 18,
mAccess_RtPlc: 1 << 19,
mAccess_RtNavigator: 1 << 20,
mAccess_AllRt: 1 << 2 |
1 << 3 |
1 << 4 |
1 << 5 |
1 << 0 |
1 << 1 |
1 << 25 |
1 << 18 |
1 << 19 |
1 << 20 |
1 << 6 |
1 << 7 |
1 << 8 |
1 << 9 |
1 << 10 |
1 << 11 |
1 << 12 |
1 << 13 |
1 << 14 |
1 << 15,
mAccess_AllOperators: 1 << 6 |
1 << 7 |
1 << 8 |
1 << 9 |
1 << 10 |
1 << 11 |
1 << 12 |
1 << 13 |
1 << 14 |
1 << 15,
mAccess_AllRt: 1 << 2 | 1 << 3 | 1 << 4 | 1 << 5 | 1 << 0 | 1 << 1 | 1 << 25 |
1 << 18 | 1 << 19 | 1 << 20 | 1 << 6 | 1 << 7 | 1 << 8 | 1 << 9 | 1 << 10 |
1 << 11 | 1 << 12 | 1 << 13 | 1 << 14 | 1 << 15,
mAccess_AllOperators: 1 << 6 | 1 << 7 | 1 << 8 | 1 << 9 | 1 << 10 | 1 << 11 |
1 << 12 | 1 << 13 | 1 << 14 | 1 << 15,
mAccess_AllPwr: ~0,
mAdef_pointer: 1,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
"use strict";
/** Start OpWind **/
function OpWindMenu() {
this.gdh = 0;
this.buttons = null;
......@@ -14,8 +12,9 @@ function OpWindMenu() {
this.init = function () {
this.host = window.location.hostname;
if (this.host == "")
if (this.host == "") {
this.host = "localhost";
}
this.gdh = new Gdh();
this.gdh.open_cb = this.gdh_init_cb;
......@@ -48,7 +47,8 @@ function OpWindMenu() {
button.type = "button";
button.className = "leftmenu-button";
button.value = text;
button.addEventListener('click', new Function("menu.button_cb(\"" + button.value + "\")"));
button.addEventListener('click',
new Function("menu.button_cb(\"" + button.value + "\")"));
context.appendChild(button);
context.appendChild(document.createElement("br"));
return button;
......@@ -67,24 +67,27 @@ function OpWindMenu() {
context.appendChild(self.user_text);
context.appendChild(document.createElement("hr"));
document.getElementById("login_button").addEventListener("click", function (event) {
if (document.getElementById("login_frame").style.visibility == 'hidden') {
document.getElementById("login_button")
.addEventListener("click", function (event) {
if (document.getElementById("login_frame").style.visibility ==
'hidden') {
document.getElementById("login_user").value = "";
document.getElementById("login_passw").value = "";
document.getElementById("login_frame").style.visibility = 'visible';
document.getElementById("login_frame").style.height = '120px';
document.getElementById("login_user").focus();
}
else {
} else {
document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px';
}
});
document.getElementById("apply_button").addEventListener("click", function (event) {
document.getElementById("apply_button")
.addEventListener("click", function (event) {
var user = document.getElementById("login_user").value;
var passwd = document.getElementById("login_passw").value;
if (user.trim() == "")
if (user.trim() == "") {
return;
}
document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px';
var c = new JopCrypt();
......@@ -93,11 +96,13 @@ function OpWindMenu() {
self.user = user;
self.gdh.login(user, passwd, self.login_cb, self);
});
document.getElementById("cancel_button").addEventListener("click", function (event) {
document.getElementById("cancel_button")
.addEventListener("click", function (event) {
document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px';
});
document.getElementById("logout_button").addEventListener("click", function (event) {
document.getElementById("logout_button")
.addEventListener("click", function (event) {
document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px';
self.priv = 0;
......@@ -110,25 +115,29 @@ function OpWindMenu() {
//document.getElementById("login_frame").setAttribute("style", "visibility:hidden;height:10px";
document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px';
}
else {
} else {
document.getElementById("login_button").remove();
document.getElementById("login_frame").remove();
}
if (result.enable_language)
if (result.enable_language) {
self.add_menu_button(context, "Language");
}
if (result.enable_alarmlist) {
self.add_menu_button(context, "AlarmList");
self.add_menu_button(context, "EventList");
}
if (result.enable_eventlog)
if (result.enable_eventlog) {
self.add_menu_button(context, "EventLog");
if (result.enable_navigator)
}
if (result.enable_navigator) {
self.add_menu_button(context, "Navigator");
if (!result.disable_help)
}
if (!result.disable_help) {
self.add_menu_button(context, "Help");
if (!result.disable_proview)
}
if (!result.disable_proview) {
self.add_menu_button(context, "ProviewR");
}
context.appendChild(document.createElement("hr"));
......@@ -143,69 +152,66 @@ function OpWindMenu() {
if (self.info.enable_language && text == "Language") {
console.log("Language activated");
}
else if (self.info.enable_alarmlist && text == "AlarmList") {
} else if (self.info.enable_alarmlist && text == "AlarmList") {
console.log("AlarmList activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators |
Pwr.mAccess_System | Pwr.mAccess_Maintenance |
Pwr.mAccess_Process | Pwr.mAccess_Instrument)))
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
else
} else {
window.open("ev.html?list=alarm", "_blank");
}
else if (self.info.enable_alarmlist && text == "EventList") {
} else if (self.info.enable_alarmlist && text == "EventList") {
console.log("EventList activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators |
Pwr.mAccess_System | Pwr.mAccess_Maintenance |
Pwr.mAccess_Process | Pwr.mAccess_Instrument)))
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
else
} else {
window.open("ev.html?list=event", "_blank");
}
else if (self.info.enable_eventlog && text == "EventLog") {
} else if (self.info.enable_eventlog && text == "EventLog") {
console.log("EventLog activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators |
Pwr.mAccess_System | Pwr.mAccess_Maintenance |
Pwr.mAccess_Process | Pwr.mAccess_Instrument)))
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
else
} else {
window.alert("Not yet implemented");
}
else if (self.info.enable_navigator && text == "Navigator") {
} else if (self.info.enable_navigator && text == "Navigator") {
console.log("Navigator activated");
if (!(self.is_authorized(Pwr.mAccess_RtNavigator |
Pwr.mAccess_System | Pwr.mAccess_Maintenance |
Pwr.mAccess_Process | Pwr.mAccess_Instrument)))
if (!(self.is_authorized(Pwr.mAccess_RtNavigator | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
else
} else {
window.open("xtt.html", "_blank");
}
else if (!self.info.disable_help && text == "Help") {
} else if (!self.info.disable_help && text == "Help") {
console.log("Help activated");
window.open("xtt_help_index.html", "_blank");
}
else if (!self.info.disable_proview && text == "ProviewR") {
} else if (!self.info.disable_proview && text == "ProviewR") {
console.log("ProviewR activated");
window.open("http://www.proview.se", "_blank");
}
else {
} else {
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators |
Pwr.mAccess_System | Pwr.mAccess_Maintenance |
Pwr.mAccess_Process | Pwr.mAccess_Instrument)))
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
else {
} else {
for (var i = 0; i < self.info.buttons.length; i++) {
if (self.info.buttons[i].text == text) {
console.log("Found", self.info.buttons[i].text);
var name = self.info.buttons[i].name;
var n = name.indexOf(".pwg");
if (n != -1)
if (n != -1) {
name = name.substring(0, n);
}
var url = "ge.html?graph=" + name;
console.log("url", url);
window.open(url, "_blank");
......@@ -221,25 +227,22 @@ function OpWindMenu() {
if (sts & 1) {
self.priv = result;
sessionStorage.setItem("pwr_privilege", self.priv);
if (self.user_text != null)
if (self.user_text != null) {
self.user_text.textContent = self.user + " on " + self.host;
}
console.log("Login", self.user, "Priv", self.priv);
}
else {
} else {
self.priv = 0;
self.user = "none";
sessionStorage.setItem("pwr_privilege", self.priv);
if (self.user_text != null)
if (self.user_text != null) {
self.user_text.textContent = "None on " + self.host;
}
console.log("Login failure", "Priv", self.priv);
}
};
}
var menu = new OpWindMenu();
menu.init();
/** End OpWind **/
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment