Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
b7f980d6
Commit
b7f980d6
authored
Oct 23, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
js operator window login
parent
2b3d801a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
34 deletions
+89
-34
java/jsw/opwind/src/opwind.js
java/jsw/opwind/src/opwind.js
+59
-31
java/jsw/opwind/src/opwind_menu.html
java/jsw/opwind/src/opwind_menu.html
+18
-2
java/jsw/xtt/src/toolbar.css
java/jsw/xtt/src/toolbar.css
+12
-1
No files found.
java/jsw/opwind/src/opwind.js
View file @
b7f980d6
...
...
@@ -1975,23 +1975,64 @@ function OpWindMenu() {
console
.
log
(
"
Menu received
"
,
sts
,
data
,
result
.
buttons
.
length
);
var
context
=
document
.
getElementById
(
"
opwindmenu
"
);
var
header
=
document
.
createElement
(
"
H1
"
);
var
title
=
document
.
createTextNode
(
result
.
title
);
header
.
appendChild
(
title
);
context
.
appendChild
(
header
);
var
text
=
document
.
createTextNode
(
result
.
text
);
context
.
appendChild
(
text
);
context
.
appendChild
(
document
.
createElement
(
"
hr
"
));
self
.
user_text
=
document
.
createTextNode
(
self
.
user
+
"
on
"
+
self
.
host
);
context
.
appendChild
(
self
.
user_text
);
context
.
appendChild
(
document
.
createElement
(
"
hr
"
));
document
.
getElementById
(
"
opwind_title
"
).
innerHTML
=
result
.
title
;
document
.
getElementById
(
"
opwind_text
"
).
innerHTML
=
result
.
text
;
if
(
result
.
enable_login
)
{
self
.
user_text
=
document
.
createTextNode
(
self
.
user
+
"
on
"
+
self
.
host
);
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_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
{
document
.
getElementById
(
"
login_frame
"
).
style
.
visibility
=
'
hidden
'
;
document
.
getElementById
(
"
login_frame
"
).
style
.
height
=
'
0px
'
;
}
});
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
()
==
""
)
return
;
document
.
getElementById
(
"
login_frame
"
).
style
.
visibility
=
'
hidden
'
;
document
.
getElementById
(
"
login_frame
"
).
style
.
height
=
'
0px
'
;
var
c
=
new
JopCrypt
();
passwd
=
c
.
crypt
(
"
aa
"
,
passwd
);
self
.
user
=
user
;
self
.
gdh
.
login
(
user
,
passwd
,
self
.
login_cb
,
self
);
});
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
(
"
login_frame
"
).
style
.
visibility
=
'
hidden
'
;
document
.
getElementById
(
"
login_frame
"
).
style
.
height
=
'
0px
'
;
self
.
priv
=
0
;
self
.
user
=
"
Default
"
;
self
.
gdh
.
login
(
""
,
""
,
self
.
login_cb
,
self
);
});
document
.
getElementById
(
"
login_user
"
).
value
=
""
;
document
.
getElementById
(
"
login_passw
"
).
value
=
""
;
//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
{
document
.
getElementById
(
"
login_button
"
).
remove
();
document
.
getElementById
(
"
login_frame
"
).
remove
();
}
if
(
result
.
enable_language
)
self
.
add_menu_button
(
context
,
"
Language
"
);
if
(
result
.
enable_login
)
self
.
add_menu_button
(
context
,
"
Login
"
);
if
(
result
.
enable_alarmlist
)
self
.
add_menu_button
(
context
,
"
AlarmList
"
);
if
(
result
.
enable_eventlog
)
...
...
@@ -2008,8 +2049,6 @@ function OpWindMenu() {
var
button
;
for
(
var
i
=
0
;
i
<
result
.
buttons
.
length
;
i
++
)
{
console
.
log
(
"
Child
"
,
result
.
buttons
[
i
].
name
);
self
.
add_menu_button
(
context
,
result
.
buttons
[
i
].
text
);
}
};
...
...
@@ -2019,18 +2058,6 @@ function OpWindMenu() {
if
(
self
.
info
.
enable_language
&&
text
==
"
Language
"
)
{
console
.
log
(
"
Language activated
"
);
}
else
if
(
self
.
info
.
enable_login
&&
text
==
"
Login
"
)
{
console
.
log
(
"
Login activated
"
);
var
user
=
prompt
(
"
Username
"
);
var
passwd
=
prompt
(
"
Password
"
);
var
c
=
new
JopCrypt
();
passwd
=
c
.
crypt
(
"
aa
"
,
passwd
);
console
.
log
(
"
Login
"
,
user
,
passwd
);
self
.
user
=
user
;
self
.
gdh
.
login
(
user
,
passwd
,
self
.
login_cb
,
self
);
}
else
if
(
self
.
info
.
enable_alarmlist
&&
text
==
"
AlarmList
"
)
{
console
.
log
(
"
AlarmList activated
"
);
if
(
!
(
self
.
is_authorized
(
Pwr
.
mAccess_RtRead
|
Pwr
.
mAccess_RtWrite
|
...
...
@@ -2101,14 +2128,15 @@ function OpWindMenu() {
if
(
self
.
user_text
!=
null
)
self
.
user_text
.
textContent
=
self
.
user
+
"
on
"
+
self
.
host
;
console
.
log
(
"
sessionStorage set
"
);
console
.
log
(
"
Login
"
,
self
.
user
,
"
Priv
"
,
self
.
priv
);
}
else
{
self
.
priv
=
0
;
self
.
user
=
"
none
"
;
console
.
log
(
"
user_text
"
,
self
.
user_text
);
sessionStorage
.
setItem
(
"
pwr_privilege
"
,
self
.
priv
);
if
(
self
.
user_text
!=
null
)
self
.
user_text
.
textContent
=
"
None on
"
+
self
.
host
;
console
.
log
(
"
Login failure
"
,
"
Priv
"
,
self
.
priv
);
}
};
}
...
...
java/jsw/opwind/src/opwind_menu.html
View file @
b7f980d6
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
Xtt
</title>
<title>
Operator Menu
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"toolbar.css"
>
</head>
<body>
<div
id=
"opwindmenu"
width=
"120"
height=
"800"
></div>
<div
id=
"opwindmenu"
width=
"120"
height=
"800"
>
<h1
id=
"opwind_title"
></h1>
<p
id=
"opwind_text"
></p>
<hr>
<button
id=
"login_button"
type=
"button"
class=
"leftmenu-button"
>
Login
</button>
<div
id=
"login_frame"
class=
"login-frame"
>
Username
<br>
<input
id=
"login_user"
name=
"username"
class=
"login-field"
/><br>
Password
<br>
<input
id=
"login_passw"
name=
"password"
type=
"password"
class=
"login-field"
/><br>
<button
id=
"apply_button"
type=
"button"
style=
"flex-grow:1"
>
Apply
</button>
<button
id=
"cancel_button"
type=
"button"
style=
"float:right"
>
Cancel
</button><br>
<button
id=
"logout_button"
type=
"button"
class=
"leftmenu-button"
>
Logout
</button>
</div>
</div>
<script
src=
opwind.js
></script>
<hr>
<address><a
href=
"mailto:claes@debian86.ssab.com"
></a></address>
...
...
java/jsw/xtt/src/toolbar.css
View file @
b7f980d6
...
...
@@ -51,4 +51,15 @@
.leftmenu-button
{
width
:
100%
;
}
\ No newline at end of file
}
.login-frame
{
background-color
:
#ddeeff
;
padding
:
10px
;
display
:
block
;
overflow
:
hidden
;
}
.login-field
{
width
:
100%
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment