Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
rjs_json_form
Commits
61e2a609
Commit
61e2a609
authored
Feb 25, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove multiple base_url computation
parent
5f555486
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
19 deletions
+14
-19
gadget_erp5_page_slap_load_schema.js
gadget_erp5_page_slap_load_schema.js
+14
-19
No files found.
gadget_erp5_page_slap_load_schema.js
View file @
61e2a609
...
@@ -12,6 +12,16 @@
...
@@ -12,6 +12,16 @@
}
}
}
}
function
getBaseUrl
(
schema_url
)
{
var
base_url
,
url_uri
=
URI
(
schema_url
);
base_url
=
url_uri
.
path
().
split
(
"
/
"
);
base_url
.
pop
();
base_url
=
schema_url
.
split
(
url_uri
.
path
())[
0
]
+
base_url
.
join
(
"
/
"
);
return
base_url
;
}
function
getJSON
(
url
)
{
function
getJSON
(
url
)
{
var
protocol
=
URI
(
url
).
protocol
();
var
protocol
=
URI
(
url
).
protocol
();
if
(
protocol
===
"
http
"
||
protocol
===
"
https
"
)
{
if
(
protocol
===
"
http
"
||
protocol
===
"
https
"
)
{
...
@@ -203,13 +213,7 @@
...
@@ -203,13 +213,7 @@
.
declareMethod
(
"
loadJSONSchema
"
,
function
(
url
)
{
.
declareMethod
(
"
loadJSONSchema
"
,
function
(
url
)
{
return
getJSON
(
url
)
return
getJSON
(
url
)
.
push
(
function
(
json
)
{
.
push
(
function
(
json
)
{
var
base_url
,
url_uri
;
var
base_url
=
getBaseUrl
(
url
);
url_uri
=
URI
(
url
);
base_url
=
url_uri
.
path
().
split
(
"
/
"
);
base_url
.
pop
();
base_url
=
url
.
split
(
url_uri
.
path
())[
0
]
+
base_url
.
join
(
"
/
"
);
return
validateJSONSchema
(
json
,
base_url
);
return
validateJSONSchema
(
json
,
base_url
);
});
});
})
})
...
@@ -223,8 +227,7 @@
...
@@ -223,8 +227,7 @@
.
push
(
function
(
json_object
)
{
.
push
(
function
(
json_object
)
{
var
parameter_schema_url
,
var
parameter_schema_url
,
st
,
st
,
base_url
,
base_url
;
url_uri
=
URI
(
schema_url
);
for
(
st
in
json_object
[
"
software-type
"
])
{
for
(
st
in
json_object
[
"
software-type
"
])
{
if
(
json_object
[
"
software-type
"
].
hasOwnProperty
(
st
))
{
if
(
json_object
[
"
software-type
"
].
hasOwnProperty
(
st
))
{
...
@@ -235,9 +238,7 @@
...
@@ -235,9 +238,7 @@
}
}
if
(
URI
(
parameter_schema_url
).
protocol
()
===
""
)
{
if
(
URI
(
parameter_schema_url
).
protocol
()
===
""
)
{
base_url
=
url_uri
.
path
().
split
(
"
/
"
);
base_url
=
getBaseUrl
(
schema_url
);
base_url
.
pop
();
base_url
=
schema_url
.
split
(
url_uri
.
path
())[
0
]
+
base_url
.
join
(
"
/
"
);
if
(
base_url
!==
undefined
)
{
if
(
base_url
!==
undefined
)
{
parameter_schema_url
=
base_url
+
"
/
"
+
parameter_schema_url
;
parameter_schema_url
=
base_url
+
"
/
"
+
parameter_schema_url
;
}
}
...
@@ -256,13 +257,7 @@
...
@@ -256,13 +257,7 @@
.
declareMethod
(
"
validateJSON
"
,
function
(
schema_url
,
generated_json
)
{
.
declareMethod
(
"
validateJSON
"
,
function
(
schema_url
,
generated_json
)
{
return
getJSON
(
schema_url
)
return
getJSON
(
schema_url
)
.
push
(
function
(
schema
)
{
.
push
(
function
(
schema
)
{
var
base_url
,
var
base_url
=
getBaseUrl
(
schema_url
);
url_uri
=
URI
(
schema_url
);
base_url
=
url_uri
.
path
().
split
(
"
/
"
);
base_url
.
pop
();
base_url
=
schema_url
.
split
(
url_uri
.
path
())[
0
]
+
base_url
.
join
(
"
/
"
);
return
expandSchema
(
schema
,
schema
,
base_url
)
return
expandSchema
(
schema
,
schema
,
base_url
)
.
push
(
function
(
loaded_schema
)
{
.
push
(
function
(
loaded_schema
)
{
return
tv4
.
validateMultiple
(
generated_json
,
loaded_schema
);
return
tv4
.
validateMultiple
(
generated_json
,
loaded_schema
);
...
...
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