Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Boris Kocherov
erp5
Commits
c9f2cb68
Commit
c9f2cb68
authored
Nov 16, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_form: update from...
erp5_json_form: update from
bk/rjs_json_form@e9d56210
parent
ef48eaf6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
28 deletions
+47
-28
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
...ateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
+0
-23
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.js.js
...json_form/jsonform/gadget_json_generated_form_child.js.js
+47
-5
No files found.
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
View file @
c9f2cb68
...
...
@@ -901,29 +901,6 @@
.
allowPublicAcquisition
(
"
expandSchema
"
,
function
(
arr
)
{
return
expandSchemaForField
(
this
,
arr
[
0
],
arr
[
1
],
arr
[
2
]);
})
.
onEvent
(
'
click
'
,
function
(
evt
)
{
if
(
evt
.
target
===
this
.
props
.
delete_button
)
{
return
this
.
selfRemove
(
evt
);
}
var
link
=
evt
.
target
.
getAttribute
(
"
data-error-link
"
),
button_list
=
this
.
props
.
add_buttons
,
i
;
if
(
link
)
{
location
.
href
=
link
;
return
;
}
for
(
i
=
0
;
i
<
button_list
.
length
;
i
=
i
+
1
)
{
if
(
evt
.
target
===
button_list
[
i
].
element
)
{
return
button_list
[
i
].
event
(
evt
);
}
}
})
.
declareJob
(
'
listenEvents
'
,
function
()
{
// XXX Disable
return
;
})
.
onLoop
(
function
()
{
var
gadget
=
this
;
if
(
this
.
props
.
changed
)
{
...
...
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.js.js
View file @
c9f2cb68
...
...
@@ -441,18 +441,22 @@
}
function
schemaArrFilteredByDocument
(
schema_arr
,
json_document
)
{
var
i
,
var
x
,
i
,
errors
,
error
,
flag
,
circular
=
schema_arr
[
0
].
circular
,
ret_arr
=
[],
validation
,
schema
;
if
(
schema_arr
.
length
===
1
||
schema_arr
[
0
].
is_arr_of_const
)
{
return
schema_arr
;
}
if
(
json_document
!==
undefined
)
{
for
(
i
=
0
;
i
<
schema_arr
.
length
;
i
+=
1
)
{
schema
=
schema_arr
[
i
].
schema
;
for
(
x
=
0
;
x
<
schema_arr
.
length
;
x
+=
1
)
{
schema
=
schema_arr
[
x
].
schema
;
if
(
schema
===
true
)
{
flag
=
true
;
}
else
if
(
schema
===
false
)
{
...
...
@@ -461,11 +465,49 @@
flag
=
tv4
.
validate
(
json_document
,
schema
);
}
if
(
flag
)
{
ret_arr
.
push
(
schema_arr
[
i
]);
ret_arr
.
push
(
schema_arr
[
x
]);
}
}
if
(
ret_arr
.
length
===
0
)
{
// currently try to find
// more compatible schema for current document
// XXX it may be need be more smart in future
// (every error has weigh, weigh depend from level...),
// may be not.
for
(
x
=
0
;
x
<
schema_arr
.
length
;
x
+=
1
)
{
schema
=
schema_arr
[
x
].
schema
;
if
(
schema
!==
false
)
{
validation
=
tv4
.
validateMultiple
(
json_document
,
schema
);
errors
=
validation
.
errors
;
flag
=
true
;
for
(
i
=
0
;
i
<
errors
.
length
;
i
+=
1
)
{
error
=
errors
[
i
];
if
(
error
.
code
===
0
||
// INVALID_TYPE
error
.
code
===
13
||
// NOT_PASSED
error
.
code
===
14
// BOOLEAN_SCHEMA_FALSE
)
{
if
(
error
.
dataPath
.
split
(
'
/
'
).
length
===
1
)
{
flag
=
false
;
break
;
}
}
if
(
error
.
code
===
15
// CONST_NOT_EQUAL
)
{
// take in account errors only on fist level
if
(
error
.
dataPath
.
split
(
'
/
'
).
length
<=
2
)
{
flag
=
false
;
break
;
}
}
}
if
(
flag
)
{
ret_arr
=
[
schema_arr
[
x
]];
break
;
}
}
}
}
if
(
ret_arr
.
length
===
0
)
{
// XXX find schema more compatible with document
return
schema_arr
;
}
ret_arr
[
0
].
circular
=
circular
;
...
...
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