Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
e0a4a2c8
Commit
e0a4a2c8
authored
Aug 30, 2017
by
Piotr Gawron
Browse files
LoginDialog contains request an account link
parent
3b80906b
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
frontend-js/src/main/js/ConfigurationType.js
View file @
e0a4a2c8
"
use strict
"
;
var
ConfigurationType
=
{
DEFAULT_MAP
:
"
DEFAULT_MAP
"
,
GOOGLE_ANALYTICS_IDENTIFIER
:
"
GOOGLE_ANALYTICS_IDENTIFIER
"
,
LOGO_IMG
:
"
LOGO_IMG
"
,
LOGO_LINK
:
"
LOGO_LINK
"
,
LEGEND_FILES
:
"
LEGEND_FILES
"
,
MIN_COLOR_VAL
:
"
MIN_COLOR_VAL
"
,
MAX_COLOR_VAL
:
"
MAX_COLOR_VAL
"
,
SIMPLE_COLOR_VAL
:
"
SIMPLE_COLOR_VAL
"
,
SEARCH_DISTANCE
:
"
SEARCH_DISTANCE
"
,
USER_MANUAL_FILE
:
"
USER_MANUAL_FILE
"
,
DEFAULT_MAP
:
"
DEFAULT_MAP
"
,
GOOGLE_ANALYTICS_IDENTIFIER
:
"
GOOGLE_ANALYTICS_IDENTIFIER
"
,
LOGO_IMG
:
"
LOGO_IMG
"
,
LOGO_LINK
:
"
LOGO_LINK
"
,
LEGEND_FILES
:
"
LEGEND_FILES
"
,
MIN_COLOR_VAL
:
"
MIN_COLOR_VAL
"
,
MAX_COLOR_VAL
:
"
MAX_COLOR_VAL
"
,
REQUEST_ACCOUNT_EMAIL
:
"
REQUEST_ACCOUNT_EMAIL
"
,
SIMPLE_COLOR_VAL
:
"
SIMPLE_COLOR_VAL
"
,
SEARCH_DISTANCE
:
"
SEARCH_DISTANCE
"
,
USER_MANUAL_FILE
:
"
USER_MANUAL_FILE
"
,
};
module
.
exports
=
ConfigurationType
;
frontend-js/src/main/js/ServerConnector.js
View file @
e0a4a2c8
This diff is collapsed.
Click to expand it.
frontend-js/src/main/js/gui/LoginDialog.js
View file @
e0a4a2c8
...
...
@@ -6,6 +6,7 @@ var AbstractGuiElement = require('./AbstractGuiElement');
var
GuiConnector
=
require
(
'
../GuiConnector
'
);
var
InvalidCredentialsError
=
require
(
'
../InvalidCredentialsError
'
);
var
PanelControlElementType
=
require
(
'
./PanelControlElementType
'
);
var
ConfigurationType
=
require
(
"
../ConfigurationType
"
);
var
Functions
=
require
(
'
../Functions
'
);
var
logger
=
require
(
'
../logger
'
);
...
...
@@ -15,18 +16,18 @@ function LoginDialog(params) {
var
self
=
this
;
self
.
_createLoginTab
();
$
(
self
.
getElement
()).
dialog
({
autoOpen
:
false
,
resizable
:
false
,
autoOpen
:
false
,
resizable
:
false
,
});
var
loginButton
=
self
.
getControlElement
(
PanelControlElementType
.
USER_TAB_LOGIN_BUTTON
);
loginButton
.
onclick
=
function
()
{
loginButton
.
onclick
=
function
()
{
var
login
=
self
.
getControlElement
(
PanelControlElementType
.
USER_TAB_LOGIN_INPUT_TEXT
).
value
;
var
password
=
self
.
getControlElement
(
PanelControlElementType
.
USER_TAB_PASSOWRD_INPUT_TEXT
).
value
;
return
ServerConnector
.
login
(
login
,
password
).
then
(
function
()
{
return
ServerConnector
.
login
(
login
,
password
).
then
(
function
()
{
window
.
location
.
reload
(
false
);
}).
then
(
null
,
function
(
error
)
{
}).
then
(
null
,
function
(
error
)
{
if
(
error
instanceof
InvalidCredentialsError
)
{
GuiConnector
.
alert
(
"
invalid credentials
"
);
}
else
{
...
...
@@ -40,16 +41,16 @@ function LoginDialog(params) {
LoginDialog
.
prototype
=
Object
.
create
(
AbstractGuiElement
.
prototype
);
LoginDialog
.
prototype
.
constructor
=
LoginDialog
;
LoginDialog
.
prototype
.
createTableRow
=
function
(
elements
)
{
LoginDialog
.
prototype
.
createTableRow
=
function
(
elements
)
{
var
row
=
Functions
.
createElement
({
type
:
"
div
"
,
style
:
"
display: table-row;
"
type
:
"
div
"
,
style
:
"
display: table-row;
"
});
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
var
cell
=
Functions
.
createElement
({
type
:
"
div
"
,
style
:
"
display: table-cell;
"
type
:
"
div
"
,
style
:
"
display: table-cell;
"
});
cell
.
appendChild
(
elements
[
i
]);
row
.
appendChild
(
cell
);
...
...
@@ -57,65 +58,81 @@ LoginDialog.prototype.createTableRow = function(elements) {
return
row
;
};
LoginDialog
.
prototype
.
_createLoginTab
=
function
()
{
LoginDialog
.
prototype
.
_createLoginTab
=
function
()
{
var
self
=
this
;
var
authorizationFormTab
=
Functions
.
createElement
({
type
:
"
div
"
,
style
:
"
width:100%;display: table;border-spacing: 10px;
"
type
:
"
div
"
,
style
:
"
width:100%;display: table;border-spacing: 10px;
"
});
this
.
getElement
().
appendChild
(
authorizationFormTab
);
var
loginLabel
=
Functions
.
createElement
({
type
:
"
div
"
,
content
:
"
LOGIN:
"
type
:
"
div
"
,
content
:
"
LOGIN:
"
});
var
loginInput
=
Functions
.
createElement
({
type
:
"
input
"
,
inputType
:
"
text
"
,
style
:
"
width:100%
"
,
name
:
"
loginText
"
type
:
"
input
"
,
inputType
:
"
text
"
,
style
:
"
width:100%
"
,
name
:
"
loginText
"
});
this
.
setControlElement
(
PanelControlElementType
.
USER_TAB_LOGIN_INPUT_TEXT
,
loginInput
);
authorizationFormTab
.
appendChild
(
self
.
createTableRow
([
loginLabel
,
loginInput
]));
authorizationFormTab
.
appendChild
(
self
.
createTableRow
([
loginLabel
,
loginInput
]));
var
passwordLabel
=
Functions
.
createElement
({
type
:
"
div
"
,
content
:
"
PASSWORD:
"
type
:
"
div
"
,
content
:
"
PASSWORD:
"
});
var
passwordInput
=
Functions
.
createElement
({
type
:
"
input
"
,
inputType
:
"
password
"
,
style
:
"
width:100%
"
,
name
:
"
passwordText
"
type
:
"
input
"
,
inputType
:
"
password
"
,
style
:
"
width:100%
"
,
name
:
"
passwordText
"
});
this
.
setControlElement
(
PanelControlElementType
.
USER_TAB_PASSOWRD_INPUT_TEXT
,
passwordInput
);
authorizationFormTab
.
appendChild
(
self
.
createTableRow
([
passwordLabel
,
passwordInput
]));
authorizationFormTab
.
appendChild
(
self
.
createTableRow
([
passwordLabel
,
passwordInput
]));
var
centerTag
=
Functions
.
createElement
({
type
:
"
center
"
type
:
"
center
"
});
this
.
getElement
().
appendChild
(
centerTag
);
var
loginButton
=
Functions
.
createElement
({
type
:
"
button
"
,
name
:
"
loginButton
"
,
content
:
"
LOGIN
"
type
:
"
button
"
,
name
:
"
loginButton
"
,
content
:
"
LOGIN
"
});
centerTag
.
appendChild
(
loginButton
);
this
.
setControlElement
(
PanelControlElementType
.
USER_TAB_LOGIN_BUTTON
,
loginButton
);
this
.
getElement
().
appendChild
(
Functions
.
createElement
({
type
:
"
br
"
}));
this
.
getElement
().
appendChild
(
Functions
.
createElement
({
type
:
"
a
"
,
name
:
"
requestAccount
"
,
content
:
"
Request an account
"
,
href
:
"
#
"
,
}));
};
LoginDialog
.
prototype
.
init
=
function
()
{
var
self
=
this
;
return
ServerConnector
.
getConfigurationParam
(
ConfigurationType
.
REQUEST_ACCOUNT_EMAIL
).
then
(
function
(
value
)
{
var
link
=
$
(
"
[name=requestAccount]
"
,
self
.
getElement
());
link
.
attr
(
"
href
"
,
"
mailto:
"
+
value
+
"
?subject=MINERVA account request
"
);
});
};
LoginDialog
.
prototype
.
open
=
function
()
{
LoginDialog
.
prototype
.
open
=
function
()
{
var
self
=
this
;
$
(
self
.
getElement
()).
dialog
(
'
option
'
,
'
title
'
,
'
AUTHORIZATION FORM
'
);
$
(
self
.
getElement
()).
dialog
(
"
open
"
);
};
LoginDialog
.
prototype
.
destroy
=
function
()
{
LoginDialog
.
prototype
.
destroy
=
function
()
{
$
(
this
.
getElement
()).
dialog
(
"
destroy
"
);
};
...
...
frontend-js/src/main/js/gui/leftPanel/LeftPanel.js
View file @
e0a4a2c8
...
...
@@ -151,6 +151,7 @@ LeftPanel.prototype.init = function() {
resolve
();
});
promises
.
push
(
initEvents
);
promises
.
push
(
self
.
getLoginDialog
().
init
());
return
Promise
.
all
(
promises
);
};
...
...
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