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
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
amrani
erp5
Commits
fcecd285
Commit
fcecd285
authored
Oct 11, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui][erp5_core] Release Jio 3.25.0
parent
69d79d7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
196 additions
and
92 deletions
+196
-92
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
...enderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
+97
-45
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
...nderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
+2
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/jio.js.js
...p5_core/SkinTemplateItem/portal_skins/erp5_core/jio.js.js
+97
-45
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
View file @
fcecd285
...
...
@@ -6312,8 +6312,8 @@ return new Parser;
* @param {String} [way="ascending"] 'ascending' or 'descending'
* @return {Function} The sort function
*/
function
sortFunction
(
key
,
way
)
{
var
result
;
function
sortFunction
(
key
,
way
,
key_schema
)
{
var
result
,
cast_to
;
if
(
way
===
'
descending
'
)
{
result
=
1
;
}
else
if
(
way
===
'
ascending
'
)
{
...
...
@@ -6322,6 +6322,29 @@ return new Parser;
throw
new
TypeError
(
"
Query.sortFunction():
"
+
"
Argument 2 must be 'ascending' or 'descending'
"
);
}
if
(
key_schema
!==
undefined
&&
key_schema
.
key_set
!==
undefined
&&
key_schema
.
key_set
[
key
]
!==
undefined
&&
key_schema
.
key_set
[
key
].
cast_to
!==
undefined
)
{
if
(
typeof
key_schema
.
key_set
[
key
].
cast_to
===
"
string
"
)
{
cast_to
=
key_schema
.
cast_lookup
[
key_schema
.
key_set
[
key
].
cast_to
];
}
else
{
cast_to
=
key_schema
.
key_set
[
key
].
cast_to
;
}
return
function
(
a
,
b
)
{
var
f_a
=
cast_to
(
a
[
key
]),
f_b
=
cast_to
(
b
[
key
]);
if
(
typeof
f_b
.
cmp
===
'
function
'
)
{
return
result
*
f_b
.
cmp
(
f_a
);
}
if
(
f_a
>
f_b
)
{
return
-
result
;
}
if
(
f_a
<
f_b
)
{
return
result
;
}
return
0
;
};
}
return
function
(
a
,
b
)
{
// this comparison is 5 times faster than json comparison
var
i
,
l
;
...
...
@@ -6346,6 +6369,7 @@ return new Parser;
};
}
/**
* Sort a list of items, according to keys and directions.
*
...
...
@@ -6353,7 +6377,7 @@ return new Parser;
* @param {Array} list The item list to sort
* @return {Array} The filtered list
*/
function
sortOn
(
sort_on_option
,
list
)
{
function
sortOn
(
sort_on_option
,
list
,
key_schema
)
{
var
sort_index
;
if
(
!
Array
.
isArray
(
sort_on_option
))
{
throw
new
TypeError
(
"
jioquery.sortOn():
"
+
...
...
@@ -6363,7 +6387,8 @@ return new Parser;
sort_index
-=
1
)
{
list
.
sort
(
sortFunction
(
sort_on_option
[
sort_index
][
0
],
sort_on_option
[
sort_index
][
1
]
sort_on_option
[
sort_index
][
1
],
key_schema
));
}
return
list
;
...
...
@@ -6426,6 +6451,35 @@ return new Parser;
return
list
;
}
function
checkKeySchema
(
key_schema
)
{
var
prop
;
if
(
key_schema
!==
undefined
)
{
if
(
typeof
key_schema
!==
'
object
'
)
{
throw
new
TypeError
(
"
Query().create():
"
+
"
key_schema is not of type 'object'
"
);
}
// key_set is mandatory
if
(
key_schema
.
key_set
===
undefined
)
{
throw
new
TypeError
(
"
Query().create():
"
+
"
key_schema has no 'key_set' property
"
);
}
for
(
prop
in
key_schema
)
{
if
(
key_schema
.
hasOwnProperty
(
prop
))
{
switch
(
prop
)
{
case
'
key_set
'
:
case
'
cast_lookup
'
:
case
'
match_lookup
'
:
break
;
default
:
throw
new
TypeError
(
"
Query().create():
"
+
"
key_schema has unknown property '
"
+
prop
+
"
'
"
);
}
}
}
}
}
/**
* The query to use to filter a list of objects.
* This is an abstract class.
...
...
@@ -6433,7 +6487,10 @@ return new Parser;
* @class Query
* @constructor
*/
function
Query
()
{
function
Query
(
key_schema
)
{
checkKeySchema
(
key_schema
);
this
.
_key_schema
=
key_schema
||
{};
/**
* Called before parsing the query. Must be overridden!
...
...
@@ -6506,7 +6563,7 @@ return new Parser;
}
if
(
option
.
sort_on
)
{
sortOn
(
option
.
sort_on
,
item_list
);
sortOn
(
option
.
sort_on
,
item_list
,
this
.
_key_schema
);
}
if
(
option
.
limit
)
{
...
...
@@ -6845,7 +6902,7 @@ return new Parser;
*/
QueryFactory
.
create
=
function
(
object
,
key_schema
)
{
if
(
object
===
""
)
{
return
new
Query
();
return
new
Query
(
key_schema
);
}
if
(
typeof
object
===
"
string
"
)
{
object
=
parseStringToObject
(
object
);
...
...
@@ -6877,35 +6934,6 @@ return new Parser;
throw
new
TypeError
(
"
This object is not a query
"
);
}
function
checkKeySchema
(
key_schema
)
{
var
prop
;
if
(
key_schema
!==
undefined
)
{
if
(
typeof
key_schema
!==
'
object
'
)
{
throw
new
TypeError
(
"
SimpleQuery().create():
"
+
"
key_schema is not of type 'object'
"
);
}
// key_set is mandatory
if
(
key_schema
.
key_set
===
undefined
)
{
throw
new
TypeError
(
"
SimpleQuery().create():
"
+
"
key_schema has no 'key_set' property
"
);
}
for
(
prop
in
key_schema
)
{
if
(
key_schema
.
hasOwnProperty
(
prop
))
{
switch
(
prop
)
{
case
'
key_set
'
:
case
'
cast_lookup
'
:
case
'
match_lookup
'
:
break
;
default
:
throw
new
TypeError
(
"
SimpleQuery().create():
"
+
"
key_schema has unknown property '
"
+
prop
+
"
'
"
);
}
}
}
}
}
/**
* The SimpleQuery inherits from Query, and compares one metadata value
*
...
...
@@ -6917,11 +6945,7 @@ return new Parser;
* @param {String} spec.value The value of the metadata to compare
*/
function
SimpleQuery
(
spec
,
key_schema
)
{
Query
.
call
(
this
);
checkKeySchema
(
key_schema
);
this
.
_key_schema
=
key_schema
||
{};
Query
.
call
(
this
,
key_schema
);
/**
* Operator to use to compare object values
...
...
@@ -11956,10 +11980,37 @@ return new Parser;
}(
jIO
,
UriTemplate
,
FormData
,
RSVP
,
URI
,
Blob
,
SimpleQuery
,
ComplexQuery
));
;
/*jslint nomen: true*/
/*global RSVP*/
(
function
(
jIO
,
RSVP
)
{
/*global RSVP
, jiodate
*/
(
function
(
jIO
,
RSVP
,
jiodate
)
{
"
use strict
"
;
function
dateType
(
str
)
{
return
jiodate
.
JIODate
(
new
Date
(
str
).
toISOString
());
}
function
initKeySchema
(
storage
,
spec
)
{
var
property
;
for
(
property
in
spec
.
schema
)
{
if
(
spec
.
schema
.
hasOwnProperty
(
property
))
{
if
(
spec
.
schema
[
property
].
type
===
"
string
"
&&
spec
.
schema
[
property
].
format
===
"
date-time
"
)
{
storage
.
_key_schema
.
key_set
[
property
]
=
{
read_from
:
property
,
cast_to
:
"
dateType
"
};
if
(
storage
.
_key_schema
.
cast_lookup
.
dateType
===
undefined
)
{
storage
.
_key_schema
.
cast_lookup
.
dateType
=
dateType
;
}
}
else
{
throw
new
jIO
.
util
.
jIOError
(
"
Wrong schema for property:
"
+
property
,
400
);
}
}
}
}
/**
* The jIO QueryStorage extension
*
...
...
@@ -11968,7 +12019,8 @@ return new Parser;
*/
function
QueryStorage
(
spec
)
{
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
this
.
_key_schema
=
spec
.
key_schema
;
this
.
_key_schema
=
{
key_set
:
{},
cast_lookup
:
{}};
initKeySchema
(
this
,
spec
);
}
QueryStorage
.
prototype
.
get
=
function
()
{
...
...
@@ -12168,7 +12220,7 @@ return new Parser;
jIO
.
addStorage
(
'
query
'
,
QueryStorage
);
}(
jIO
,
RSVP
));
}(
jIO
,
RSVP
,
jiodate
));
;
/*jslint nomen: true*/
/*global RSVP, Blob*/
(
function
(
jIO
,
RSVP
,
Blob
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
View file @
fcecd285
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
962.
34068.22248.54801
</string>
</value>
<value>
<string>
962.
45920.57433.52548
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
1507
020010.09
</float>
<float>
1507
734563.15
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/jio.js.js
View file @
fcecd285
...
...
@@ -6312,8 +6312,8 @@ return new Parser;
* @param {String} [way="ascending"] 'ascending' or 'descending'
* @return {Function} The sort function
*/
function
sortFunction
(
key
,
way
)
{
var
result
;
function
sortFunction
(
key
,
way
,
key_schema
)
{
var
result
,
cast_to
;
if
(
way
===
'
descending
'
)
{
result
=
1
;
}
else
if
(
way
===
'
ascending
'
)
{
...
...
@@ -6322,6 +6322,29 @@ return new Parser;
throw
new
TypeError
(
"
Query.sortFunction():
"
+
"
Argument 2 must be 'ascending' or 'descending'
"
);
}
if
(
key_schema
!==
undefined
&&
key_schema
.
key_set
!==
undefined
&&
key_schema
.
key_set
[
key
]
!==
undefined
&&
key_schema
.
key_set
[
key
].
cast_to
!==
undefined
)
{
if
(
typeof
key_schema
.
key_set
[
key
].
cast_to
===
"
string
"
)
{
cast_to
=
key_schema
.
cast_lookup
[
key_schema
.
key_set
[
key
].
cast_to
];
}
else
{
cast_to
=
key_schema
.
key_set
[
key
].
cast_to
;
}
return
function
(
a
,
b
)
{
var
f_a
=
cast_to
(
a
[
key
]),
f_b
=
cast_to
(
b
[
key
]);
if
(
typeof
f_b
.
cmp
===
'
function
'
)
{
return
result
*
f_b
.
cmp
(
f_a
);
}
if
(
f_a
>
f_b
)
{
return
-
result
;
}
if
(
f_a
<
f_b
)
{
return
result
;
}
return
0
;
};
}
return
function
(
a
,
b
)
{
// this comparison is 5 times faster than json comparison
var
i
,
l
;
...
...
@@ -6346,6 +6369,7 @@ return new Parser;
};
}
/**
* Sort a list of items, according to keys and directions.
*
...
...
@@ -6353,7 +6377,7 @@ return new Parser;
* @param {Array} list The item list to sort
* @return {Array} The filtered list
*/
function
sortOn
(
sort_on_option
,
list
)
{
function
sortOn
(
sort_on_option
,
list
,
key_schema
)
{
var
sort_index
;
if
(
!
Array
.
isArray
(
sort_on_option
))
{
throw
new
TypeError
(
"
jioquery.sortOn():
"
+
...
...
@@ -6363,7 +6387,8 @@ return new Parser;
sort_index
-=
1
)
{
list
.
sort
(
sortFunction
(
sort_on_option
[
sort_index
][
0
],
sort_on_option
[
sort_index
][
1
]
sort_on_option
[
sort_index
][
1
],
key_schema
));
}
return
list
;
...
...
@@ -6426,6 +6451,35 @@ return new Parser;
return
list
;
}
function
checkKeySchema
(
key_schema
)
{
var
prop
;
if
(
key_schema
!==
undefined
)
{
if
(
typeof
key_schema
!==
'
object
'
)
{
throw
new
TypeError
(
"
Query().create():
"
+
"
key_schema is not of type 'object'
"
);
}
// key_set is mandatory
if
(
key_schema
.
key_set
===
undefined
)
{
throw
new
TypeError
(
"
Query().create():
"
+
"
key_schema has no 'key_set' property
"
);
}
for
(
prop
in
key_schema
)
{
if
(
key_schema
.
hasOwnProperty
(
prop
))
{
switch
(
prop
)
{
case
'
key_set
'
:
case
'
cast_lookup
'
:
case
'
match_lookup
'
:
break
;
default
:
throw
new
TypeError
(
"
Query().create():
"
+
"
key_schema has unknown property '
"
+
prop
+
"
'
"
);
}
}
}
}
}
/**
* The query to use to filter a list of objects.
* This is an abstract class.
...
...
@@ -6433,7 +6487,10 @@ return new Parser;
* @class Query
* @constructor
*/
function
Query
()
{
function
Query
(
key_schema
)
{
checkKeySchema
(
key_schema
);
this
.
_key_schema
=
key_schema
||
{};
/**
* Called before parsing the query. Must be overridden!
...
...
@@ -6506,7 +6563,7 @@ return new Parser;
}
if
(
option
.
sort_on
)
{
sortOn
(
option
.
sort_on
,
item_list
);
sortOn
(
option
.
sort_on
,
item_list
,
this
.
_key_schema
);
}
if
(
option
.
limit
)
{
...
...
@@ -6845,7 +6902,7 @@ return new Parser;
*/
QueryFactory
.
create
=
function
(
object
,
key_schema
)
{
if
(
object
===
""
)
{
return
new
Query
();
return
new
Query
(
key_schema
);
}
if
(
typeof
object
===
"
string
"
)
{
object
=
parseStringToObject
(
object
);
...
...
@@ -6877,35 +6934,6 @@ return new Parser;
throw
new
TypeError
(
"
This object is not a query
"
);
}
function
checkKeySchema
(
key_schema
)
{
var
prop
;
if
(
key_schema
!==
undefined
)
{
if
(
typeof
key_schema
!==
'
object
'
)
{
throw
new
TypeError
(
"
SimpleQuery().create():
"
+
"
key_schema is not of type 'object'
"
);
}
// key_set is mandatory
if
(
key_schema
.
key_set
===
undefined
)
{
throw
new
TypeError
(
"
SimpleQuery().create():
"
+
"
key_schema has no 'key_set' property
"
);
}
for
(
prop
in
key_schema
)
{
if
(
key_schema
.
hasOwnProperty
(
prop
))
{
switch
(
prop
)
{
case
'
key_set
'
:
case
'
cast_lookup
'
:
case
'
match_lookup
'
:
break
;
default
:
throw
new
TypeError
(
"
SimpleQuery().create():
"
+
"
key_schema has unknown property '
"
+
prop
+
"
'
"
);
}
}
}
}
}
/**
* The SimpleQuery inherits from Query, and compares one metadata value
*
...
...
@@ -6917,11 +6945,7 @@ return new Parser;
* @param {String} spec.value The value of the metadata to compare
*/
function
SimpleQuery
(
spec
,
key_schema
)
{
Query
.
call
(
this
);
checkKeySchema
(
key_schema
);
this
.
_key_schema
=
key_schema
||
{};
Query
.
call
(
this
,
key_schema
);
/**
* Operator to use to compare object values
...
...
@@ -11956,10 +11980,37 @@ return new Parser;
}(
jIO
,
UriTemplate
,
FormData
,
RSVP
,
URI
,
Blob
,
SimpleQuery
,
ComplexQuery
));
;
/*jslint nomen: true*/
/*global RSVP*/
(
function
(
jIO
,
RSVP
)
{
/*global RSVP
, jiodate
*/
(
function
(
jIO
,
RSVP
,
jiodate
)
{
"
use strict
"
;
function
dateType
(
str
)
{
return
jiodate
.
JIODate
(
new
Date
(
str
).
toISOString
());
}
function
initKeySchema
(
storage
,
spec
)
{
var
property
;
for
(
property
in
spec
.
schema
)
{
if
(
spec
.
schema
.
hasOwnProperty
(
property
))
{
if
(
spec
.
schema
[
property
].
type
===
"
string
"
&&
spec
.
schema
[
property
].
format
===
"
date-time
"
)
{
storage
.
_key_schema
.
key_set
[
property
]
=
{
read_from
:
property
,
cast_to
:
"
dateType
"
};
if
(
storage
.
_key_schema
.
cast_lookup
.
dateType
===
undefined
)
{
storage
.
_key_schema
.
cast_lookup
.
dateType
=
dateType
;
}
}
else
{
throw
new
jIO
.
util
.
jIOError
(
"
Wrong schema for property:
"
+
property
,
400
);
}
}
}
}
/**
* The jIO QueryStorage extension
*
...
...
@@ -11968,7 +12019,8 @@ return new Parser;
*/
function
QueryStorage
(
spec
)
{
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
this
.
_key_schema
=
spec
.
key_schema
;
this
.
_key_schema
=
{
key_set
:
{},
cast_lookup
:
{}};
initKeySchema
(
this
,
spec
);
}
QueryStorage
.
prototype
.
get
=
function
()
{
...
...
@@ -12168,7 +12220,7 @@ return new Parser;
jIO
.
addStorage
(
'
query
'
,
QueryStorage
);
}(
jIO
,
RSVP
));
}(
jIO
,
RSVP
,
jiodate
));
;
/*jslint nomen: true*/
/*global RSVP, Blob*/
(
function
(
jIO
,
RSVP
,
Blob
)
{
...
...
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