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
Vivek
erp5
Commits
d0907084
Commit
d0907084
authored
Sep 28, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: add support for OR operation
parent
9e56822f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
23 deletions
+58
-23
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filtereditor_js.xml
...eItem/web_page_module/rjs_gadget_erp5_filtereditor_js.xml
+58
-23
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filtereditor_js.xml
View file @
d0907084
...
@@ -130,7 +130,6 @@
...
@@ -130,7 +130,6 @@
\n
\n
function submitFilterQuery(gadget) {\n
function submitFilterQuery(gadget) {\n
var i,\n
var i,\n
operator,\n
query = "",\n
query = "",\n
value,\n
value,\n
key,\n
key,\n
...
@@ -142,7 +141,10 @@
...
@@ -142,7 +141,10 @@
options = gadget.props.options,\n
options = gadget.props.options,\n
filterforms = gadget.props.element.querySelectorAll(".filterForm"),\n
filterforms = gadget.props.element.querySelectorAll(".filterForm"),\n
and = gadget.props.element.querySelector(".and");\n
and = gadget.props.element.querySelector(".and");\n
operator = and.checked ? "AND" : "OR";\n
//when OR is selected, since OR with Related Query is not supported,\n
// see https://git.erp5.org/gitweb/erp5.git/blob/HEAD:/product/ZSQLCatalog/Query/ComplexQuery.py?js=1#l113\n
//convert OR to NOT with AND\n
//a + b = NOT ( NOT (a) AND NOT (b)) \n
//build simple&complex query\n
//build simple&complex query\n
for (i = 0; i < filterforms.length; i += 1) {\n
for (i = 0; i < filterforms.length; i += 1) {\n
value = filterforms[i][2].value;\n
value = filterforms[i][2].value;\n
...
@@ -156,6 +158,7 @@
...
@@ -156,6 +158,7 @@
} else {\n
} else {\n
key = filterforms[i][0][filterforms[i][0].selectedIndex].value;\n
key = filterforms[i][0][filterforms[i][0].selectedIndex].value;\n
}\n
}\n
if (and.checked || filterforms.length === 1) {\n
simple_query_list.push(new SimpleQuery(\n
simple_query_list.push(new SimpleQuery(\n
{\n
{\n
key: key,\n
key: key,\n
...
@@ -163,8 +166,26 @@
...
@@ -163,8 +166,26 @@
value: value\n
value: value\n
}\n
}\n
));\n
));\n
} else {\n
simple_query_list.push(new ComplexQuery(\n
{\n
operator: "NOT",\n
query_list: [new SimpleQuery(\n
{\n
key: key,\n
type: "simple",\n
value: value\n
}\n
}\n
)],\n
type: "complex"\n
}\n
));\n
}\n
}\n
}\n
}\n
\n
\n
\n
\n
\n
if (gadget.props.tree_path[0] !== "--") {\n
if (gadget.props.tree_path[0] !== "--") {\n
for (i = 0; i < gadget.props.tree_path.length; i += 1) {\n
for (i = 0; i < gadget.props.tree_path.length; i += 1) {\n
...
@@ -192,11 +213,18 @@
...
@@ -192,11 +213,18 @@
\n
\n
if (simple_query_list.length >
0) {\n
if (simple_query_list.length >
0) {\n
complex_query = new ComplexQuery({\n
complex_query = new ComplexQuery({\n
operator:
operator
,\n
operator:
"AND"
,\n
query_list: simple_query_list,\n
query_list: simple_query_list,\n
type: "complex"\n
type: "complex"\n
});\n
});\n
query = Query.objectToSearchText(complex_query);\n
if (!and.checked
&&
filterforms.length > 1) {\n
complex_query = new ComplexQuery({\n
operator: "NOT",\n
query_list: [complex_query],\n
type: "complex"\n
});\n
}\n
query = complex_query.toString();\n
}\n
}\n
\n
\n
if (domain_tree_query_list.length > 0) {\n
if (domain_tree_query_list.length > 0) {\n
...
@@ -474,7 +502,6 @@
...
@@ -474,7 +502,6 @@
\n
\n
.declareMethod(\'render\',
function
(options)
{\n
.declareMethod(\'render\',
function
(options)
{\n
var
container =
this.props.element.querySelector(".filter_item_container"),\n
var
container =
this.props.element.querySelector(".filter_item_container"),\n
domain_tree_container =
this.props.element.querySelector(".domain_tree_container"),\n
i,\n
i,\n
gadget =
this,\n
gadget =
this,\n
domain_tree,\n
domain_tree,\n
...
@@ -500,16 +527,24 @@
...
@@ -500,16 +527,24 @@
gadget.props.domain_tree_map =
result._embedded._view.listbox.domain_tree_map;\n
gadget.props.domain_tree_map =
result._embedded._view.listbox.domain_tree_map;\n
if
(query
!==
"")
{\n
if
(query
!==
"")
{\n
query_list =
QueryFactory.create(query);\n
query_list =
QueryFactory.create(query);\n
if
(
query_list.operator =
==
"OR")
{\n
if
(
query_list.operator =
==
"OR"
||
query_list.operator =
==
"NOT"
)
{\n
or.checked =
true;\n
or.checked =
true;\n
or.parentElement.children[0].setAttribute("class",
"ui-btn
ui-corner-all
ui-btn-inherit
ui-btn-icon-left
ui-radio-on");\n
or.parentElement.children[0].setAttribute("class",
"ui-btn
ui-corner-all
ui-btn-inherit
ui-btn-icon-left
ui-radio-on");\n
}
else
{\n
}
else
{\n
and.checked =
true;\n
and.checked =
true;\n
and.parentElement.children[0].setAttribute("class",
"ui-btn
ui-corner-all
ui-btn-inherit
ui-btn-icon-left
ui-radio-on");\n
and.parentElement.children[0].setAttribute("class",
"ui-btn
ui-corner-all
ui-btn-inherit
ui-btn-icon-left
ui-radio-on");\n
}\n
}\n
if
(or.checked)
{\n
query_list =
query_list.query_list[0].query_list;\n
}
else
{\n
query_list =
query_list.query_list
||
[query_list];\n
query_list =
query_list.query_list
||
[query_list];\n
}\n
for
(
i =
0;
i
<
query_list.length;
i
+=
1)
{\n
for
(
i =
0;
i
<
query_list.length;
i
+=
1)
{\n
if
(or.checked)
{\n
item =
createFilterItem(gadget,
query_list[i].query_list[0]);\n
}
else
{\n
item =
createFilterItem(gadget,
query_list[i]);\n
item =
createFilterItem(gadget,
query_list[i]);\n
}\n
container.insertBefore(item,
container.lastChild);\n
container.insertBefore(item,
container.lastChild);\n
}\n
}\n
}
else
{\n
}
else
{\n
...
@@ -710,7 +745,7 @@
...
@@ -710,7 +745,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
5.62461.33513.45533
</string>
</value>
<value>
<string>
94
6.3040.41776.59886
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -728,7 +763,7 @@
...
@@ -728,7 +763,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14434
26358.29
</float>
<float>
14434
52242.14
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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