Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
b81c1cf2
Commit
b81c1cf2
authored
Feb 24, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added error messages for unlogged users
parent
5760f063
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
201 additions
and
145 deletions
+201
-145
js/erp5_loader.js
js/erp5_loader.js
+200
-144
lang/en-EN/dict.json
lang/en-EN/dict.json
+1
-1
No files found.
js/erp5_loader.js
View file @
b81c1cf2
...
...
@@ -733,37 +733,44 @@
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
var
parsed
=
util
.
parse
(
response
.
target
.
responseText
),
me
=
parsed
.
me
,
flux
=
flux
||
{};
if
(
!
me
)
{
return
{
"
pass
"
:
pass
};
}
else
{
return
jIO
.
util
.
ajax
({
"
url
"
:
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
}
}).
then
(
function
(
answer
)
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_ticket
"
)
{
query
=
reply
[
i
].
_query
;
if
(
answer
.
pass
)
{
flux
.
not_logged_in
=
true
;
return
{
"
pass
"
:
pass
};
}
else
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_ticket
"
)
{
query
=
reply
[
i
].
_query
;
}
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
skip_type
=
true
;
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
if
(
reply
.
response
)
{
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
skip_type
=
true
;
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
return
{
"
response
"
:
util
.
parse
(
reply
.
response
),
"
pass
"
:
pass
};
}
return
{
"
pass
"
:
pass
}
}).
fail
(
util
.
error
);
}
return
(
reply
);
...
...
@@ -830,36 +837,43 @@
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
var
parsed
=
util
.
parse
(
response
.
target
.
responseText
),
me
=
parsed
.
me
,
flux
=
flux
||
{};
if
(
!
me
)
{
return
{
"
pass
"
:
pass
};
}
else
{
return
jIO
.
util
.
ajax
({
"
url
"
:
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
}
}).
then
(
function
(
answer
)
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_computer
"
)
{
query
=
reply
[
i
].
_query
;
if
(
answer
.
pass
)
{
flux
.
not_logged_in
=
true
;
return
{
"
pass
"
:
pass
};
}
else
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_computer
"
)
{
query
=
reply
[
i
].
_query
;
}
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
if
(
reply
.
response
)
{
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
return
{
"
response
"
:
util
.
parse
(
reply
.
response
),
"
pass
"
:
pass
};
}
return
{
"
pass
"
:
pass
}
}).
fail
(
util
.
error
);
}
return
(
reply
);
...
...
@@ -885,36 +899,44 @@
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
var
parsed
=
util
.
parse
(
response
.
target
.
responseText
),
me
=
parsed
.
me
,
flux
=
flux
||
{};
if
(
!
me
)
{
flux
.
not_logged_in
=
true
;
return
{
"
pass
"
:
pass
};
}
else
{
return
jIO
.
util
.
ajax
({
"
url
"
:
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
}
}).
then
(
function
(
answer
)
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_invoice
"
)
{
query
=
reply
[
i
].
_query
;
if
(
answer
.
pass
)
{
flux
.
not_logged_in
=
true
;
return
{
"
pass
"
:
pass
};
}
else
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_invoice
"
)
{
query
=
reply
[
i
].
_query
;
}
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
if
(
reply
.
response
)
{
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
return
{
"
response
"
:
util
.
parse
(
reply
.
response
),
"
pass
"
:
pass
};
}
return
{
"
pass
"
:
pass
}
}).
fail
(
util
.
error
);
}
return
(
reply
);
...
...
@@ -940,36 +962,45 @@
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
var
parsed
=
util
.
parse
(
response
.
target
.
responseText
),
me
=
parsed
.
me
,
flux
=
flux
||
{};
if
(
!
me
)
{
return
{
"
pass
"
:
pass
}
}
else
{
return
jIO
.
util
.
ajax
({
"
url
"
:
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
}
}).
then
(
function
(
answer
)
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_network
"
)
{
query
=
reply
[
i
].
_query
;
if
(
answer
.
pass
)
{
flux
.
not_logged_in
=
true
;
return
{
"
pass
"
:
pass
};
}
else
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_network
"
)
{
query
=
reply
[
i
].
_query
;
}
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
if
(
reply
.
response
)
{
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
return
{
"
response
"
:
util
.
parse
(
reply
.
response
),
"
pass
"
:
pass
};
}
return
{
"
pass
"
:
pass
}
}).
fail
(
util
.
error
);
}
return
(
reply
);
...
...
@@ -996,36 +1027,43 @@
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
var
parsed
=
util
.
parse
(
response
.
target
.
responseText
),
me
=
parsed
.
me
,
flux
=
flux
||
{};
if
(
!
me
)
{
return
{
"
pass
"
:
pass
};
}
else
{
return
jIO
.
util
.
ajax
({
"
url
"
:
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
}
}).
then
(
function
(
answer
)
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_hosting_subscription
"
)
{
query
=
reply
[
i
].
_query
;
if
(
answer
.
pass
)
{
flux
.
not_logged_in
=
true
;
return
{
"
pass
"
:
pass
};
}
else
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_hosting_subscription
"
)
{
query
=
reply
[
i
].
_query
;
}
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
if
(
reply
.
response
)
{
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
return
{
"
response
"
:
util
.
parse
(
reply
.
response
),
"
pass
"
:
pass
};
}
return
{
"
pass
"
:
pass
}
}).
fail
(
util
.
error
);
}
return
(
reply
);
...
...
@@ -1179,7 +1217,6 @@
// store answer in flux
flux
=
flux
||
{};
flux
.
cert
=
util
.
parse
(
answer
.
target
.
responseText
);
console
.
log
(
"
SET
"
)
if
(
id
&&
obj
.
state
.
callback
)
{
$
.
mobile
.
changePage
(
obj
.
state
.
callback
.
replace
(
"
__id__
"
,
decode
?
id
:
window
.
encodeURIComponent
(
id
)));
}
...
...
@@ -6281,7 +6318,7 @@
// update info fields
// TODO: parentNode is not a proper selector, this should be done
// by s
tor
ing info fields associated with a gadget in state and
// by s
av
ing info fields associated with a gadget in state and
// updating from there!
app
.
setInfo
(
config
.
gadget
.
parentNode
,
...
...
@@ -7129,6 +7166,10 @@
return
util
.
error
(
"
makeContent: Missing constructor
"
);
}
// HACK ERP5
if
(
flux
.
not_logged_in
)
{
util
.
loader
(
""
,
"
status_dict.please_login
"
,
"
lock
"
);
}
// set data depending on auth
if
(
pass
.
no_auth
||
(
pass
.
auth
&&
pass
.
active_login
))
{
data
=
reply
.
response
?
util
.
parse
(
reply
.
response
)
:
null
;
...
...
@@ -7409,9 +7450,6 @@
if
(
store
&&
items
.
length
>
0
)
{
// show some status
util
.
loader
(
""
,
"
status_dict.storing
"
);
// as store will also be called directly and may require field
// definitions for validating what is being stored, we may fetch
// field definitions here again. When called in the setContent
...
...
@@ -7439,7 +7477,7 @@
delete
answer
.
pass
.
undo_skip
;
// if we have an answer = field definitions, the record fields
// must be validated before s
tor
ing, so we don't store a field
// must be validated before s
av
ing, so we don't store a field
// that does not exist
}
else
{
if
(
answer
.
response
)
{
...
...
@@ -7450,6 +7488,7 @@
}
// if we have form_data we continue
if
(
pass
.
form_data
===
undefined
)
{
util
.
loader
(
""
,
"
status_dict.saving
"
);
// loop over item and create a JIO record
for
(
i
=
0
;
i
<
pass
.
items
.
length
;
i
+=
1
)
{
...
...
@@ -7489,6 +7528,7 @@
}
}
else
{
// do it again, Sam...
util
.
loader
(
""
,
"
status_dict.saving
"
);
promises
[
0
]
=
jIO
.
util
.
ajax
({
"
url
"
:
storage
.
items
.
dict
.
url
,
"
type
"
:
"
GET
"
,
...
...
@@ -7497,40 +7537,56 @@
}
})
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
var
parsed
=
util
.
parse
(
response
.
target
.
responseText
),
me
=
parsed
.
me
,
flux
=
flux
||
{};
if
(
!
me
)
{
flux
.
not_logged_in
=
true
;
return
{
"
pass
"
:
pass
};
}
else
{
return
jIO
.
util
.
ajax
({
"
url
"
:
me
.
href
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
}
})
.
then
(
function
(
answer
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
answer
.
target
.
responseText
).
_actions
[
pass
.
fetch
].
href
,
"
type
"
:
"
POST
"
,
"
data
"
:
pass
.
form_data
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
if
(
answer
.
target
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
answer
.
target
.
responseText
).
_actions
[
pass
.
fetch
].
href
,
"
type
"
:
"
POST
"
,
"
data
"
:
pass
.
form_data
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
});
}
})
.
then
(
function
(
erp5_response
)
{
header
=
erp5_response
.
target
.
getResponseHeader
(
"
Location
"
);
return
RSVP
.
resolve
({
"
status
"
:
200
,
"
foo
"
:
"
bar
"
,
"
location
"
:
header
});
if
(
erp5_response
)
{
header
=
erp5_response
.
target
.
getResponseHeader
(
"
Location
"
);
return
RSVP
.
resolve
({
"
status
"
:
200
,
"
foo
"
:
"
bar
"
,
"
location
"
:
header
});
}
})
.
fail
(
util
.
error
);
}
return
RSVP
.
all
(
promises
)
.
then
(
function
(
response
)
{
util
.
loader
(
""
,
"
status_dict.success
"
,
"
check
"
);
// for single item actions, allow to return a status message
if
(
response
.
length
===
1
&&
reply
.
pass
.
reply
)
{
send_status
=
response
[
0
];
if
(
response
[
0
]
===
undefined
)
{
util
.
loader
(
""
,
"
status_dict.please_login
"
,
"
ban-circle
"
);
}
else
{
util
.
loader
(
""
,
"
status_dict.success
"
,
"
check
"
);
// for single item actions, allow to return a status message
if
(
response
.
length
===
1
&&
reply
.
pass
.
reply
)
{
send_status
=
response
[
0
];
}
}
return
{
"
response
"
:
send_status
,
...
...
lang/en-EN/dict.json
View file @
b81c1cf2
...
...
@@ -53,6 +53,7 @@
"find_out_more_details"
:
"For additional information, please refer to the following sections:"
},
"status_dict"
:
{
"please_login"
:
"Please log into SlapOS in another tab"
,
"loading_set"
:
"Loading Records"
,
"loading_fields"
:
"Loading Configuration"
,
"ssl_error"
:
"Please revoke existing certificate first"
,
...
...
@@ -61,7 +62,6 @@
"not_found"
:
"Page not found"
,
"uploading"
:
"Uploading"
,
"fetching"
:
"Fetching Data"
,
"storing"
:
"Storing Data"
,
"downloading"
:
"Downloading"
,
"rendering"
:
"Rendering"
,
"saving"
:
"Saving"
,
...
...
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