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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
erp5
Commits
ea8f4516
Commit
ea8f4516
authored
Sep 29, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: handle user's manually query and don't crash for unsupported query
parent
4a27ce80
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
28 deletions
+89
-28
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
+11
-9
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
...mplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
+9
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
...eItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
+14
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
...teItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
+55
-15
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filtereditor_js.xml
View file @
ea8f4516
...
...
@@ -529,6 +529,7 @@
})\n
.push(function
(result)
{\n
var
query_list,\n
query_item_list,\n
domain_tree_map =
result._embedded._view.listbox.domain_tree_map,\n
domain_tree_query_list;\n
gadget.props.column_list =
result._embedded._view.listbox.column_list;\n
...
...
@@ -542,16 +543,17 @@
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
}\n
if
(or.checked)
{\n
query_list =
query_list.query_list[0].query_list
||
[];\n
//OR
built
by
itself\n
if
(or.checked
&&
query_list.operator =
==
"NOT")
{\n
query_item_list =
query_list.query_list[0].query_list
||
[];\n
}
else
{\n
query_list =
query_list.query_list
||
[query_list];\n
query_
item_
list =
query_list.query_list
||
[query_list];\n
}\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
for
(
i =
0;
i
<
query_
item_
list.length;
i
+=
1)
{\n
if
(or.checked
&&
query_list.operator =
==
"NOT"
)
{\n
item =
createFilterItem(gadget,
query_
item_
list[i].query_list[0]);\n
}
else
{\n
item =
createFilterItem(gadget,
query_list[i]);\n
item =
createFilterItem(gadget,
query_
item_
list[i]);\n
}\n
container.insertBefore(item,
container.lastChild);\n
}\n
...
...
@@ -753,7 +755,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
946.4
083.26515.61815
</string>
</value>
<value>
<string>
946.4
378.65397.6826
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -771,7 +773,7 @@
</tuple>
<state>
<tuple>
<float>
14435
14871.92
</float>
<float>
14435
33150.45
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
ea8f4516
...
...
@@ -145,6 +145,7 @@
.declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("getFieldTypeGadgetUrl", "getFieldTypeGadgetUrl")\n
.declareAcquiredMethod("triggerSortEditor", "triggerSortEditor")\n
.declareAcquiredMethod("showQueryError", "showQueryError")\n
//////////////////////////////////////////////\n
// initialize the gadget content\n
//////////////////////////////////////////////\n
...
...
@@ -497,6 +498,12 @@
var temp = document.createElement("tfoot");\n
temp.innerHTML = my_translated_html;\n
table.appendChild(temp);\n
})\n
.fail(function (error) {\n
if (error.target.status === 500) {\n
return gadget.showQueryError(" Unsupportred Query");\n
}\n
throw error;\n
});\n
})\n
.declareService(function () {\n
...
...
@@ -782,7 +789,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
946.4
319.25695.31351
</string>
</value>
<value>
<string>
946.4
415.55526.9147
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -800,7 +807,7 @@
</tuple>
<state>
<tuple>
<float>
14435
29209.21
</float>
<float>
14435
35241.5
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
View file @
ea8f4516
...
...
@@ -152,6 +152,17 @@
return sortEditor.toggle();\n
});\n
})\n
.allowPublicAcquisition("showQueryError", function (param) {\n
var gadget = this;\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.getDeclaredGadget("erp5_searchfield");\n
})\n
.push(function (searchField) {\n
return searchField.showQueryError(param);\n
});\n
})\n
\n
\n
.declareMethod(\'render\', function (options) {\n
var gadget = this,\n
...
...
@@ -160,6 +171,7 @@
\n
form_options.erp5_document = options.erp5_document;\n
form_options.form_definition = options.form_definition;\n
search_options.jio_key = options.jio_key;\n
// XXX not generic, fix later\n
if (options.extended_search) {\n
form_options.form_definition.extended_search = options.extended_search;\n
...
...
@@ -385,7 +397,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
5.64053.62550.18722
</string>
</value>
<value>
<string>
94
6.4412.4475.4949
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -403,7 +415,7 @@
</tuple>
<state>
<tuple>
<float>
1443
185583.96
</float>
<float>
1443
534607.25
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
View file @
ea8f4516
...
...
@@ -99,7 +99,9 @@
</item>
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*global window, rJS, RSVP, loopEventListener, Handlebars */\n
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*global window, rJS, RSVP, loopEventListener, Handlebars */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, rJS, RSVP, loopEventListener, Handlebars) {\n
"use strict";\n
...
...
@@ -135,8 +137,7 @@
// acquired method\n
//////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("triggerFilterEditor", "triggerFilterEditor")\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
...
...
@@ -149,7 +150,7 @@
hide_value,\n
is_disabled = option_dict.disabled,\n
search_gadget = this;\n
\n
search_gadget.props.jio_key = option_dict.jio_key;
\n
if (is_disabled) {\n
append_class = " ui-disabled";\n
append_attribute = \' disabled="disabled\';\n
...
...
@@ -173,7 +174,10 @@
return search_gadget;\n
});\n
})\n
\n
.declareMethod("showQueryError", function (param) {\n
var input = this.props.element.querySelector(\'input[name="search"]\');\n
input.value += param;\n
})\n
.declareMethod(\'getContent\', function () {\n
var input = this.props.element.querySelector(\'input\'),\n
result = {};\n
...
...
@@ -183,7 +187,12 @@
})\n
\n
.declareService(function () {\n
var gadget = this;\n
var gadget = this,\n
i,\n
query_list,\n
tmp,\n
hide_query,\n
search_query;\n
\n
function filterSubmit(evt) {\n
return gadget.triggerFilterEditor();\n
...
...
@@ -195,12 +204,41 @@
return gadget.getContent();\n
})\n
.push(function (data) {\n
return gadget.pleasePublishMyState({\n
"extended_search": data.search\n
if (data.search) {\n
query_list = [];\n
search_query = QueryFactory.create(data.search);\n
if (search_query instanceof SimpleQuery) {\n
tmp = [search_query];\n
} else {\n
tmp = search_query.query_list;\n
}\n
for (i = 0; i < tmp.length; i += 1) {\n
if (tmp[i] instanceof SimpleQuery) {\n
if (tmp[i].key !== "catalog.uid") {\n
query_list.push(tmp[i]);\n
} else {\n
hide_query = new ComplexQuery({\n
operator: "AND",\n
query_list: [tmp[i]],\n
type: "complex"\n
});\n
})\n
.push(function (url) {\n
return gadget.pleaseRedirectMyHash(url);\n
}\n
} else {\n
//only have one complex query\n
hide_query = search_query.query_list[i];\n
}\n
}\n
\n
return gadget.redirect({jio_key: gadget.props.jio_key,\n
"extended_search": Query.objectToSearchText(new ComplexQuery({\n
operator: search_query.operator || "AND",\n
query_list: query_list,\n
type: "complex"\n
})),\n
"hide_item": hide_query ? Query.objectToSearchText(hide_query) : ""});\n
}\n
return gadget.redirect({jio_key: gadget.props.jio_key,\n
"extended_search": "", "hide_item": ""});\n
});\n
}\n
// Listen to form submit\n
...
...
@@ -218,7 +256,9 @@
);\n
});\n
\n
}(window, rJS, RSVP, loopEventListener, Handlebars));
</string>
</value>
}(window, rJS, RSVP, loopEventListener, Handlebars));
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
...
...
@@ -353,7 +393,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
5.64076.531.55330
</string>
</value>
<value>
<string>
94
6.4406.57134.42359
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -371,7 +411,7 @@
</tuple>
<state>
<tuple>
<float>
1443
183688.6
7
</float>
<float>
1443
534489.3
7
</float>
<string>
UTC
</string>
</tuple>
</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