Commit 525c2cc1 authored by Sven Franck's avatar Sven Franck

app: add checkbox-based jio query including OR/AND handling

parent a681a879
......@@ -2984,8 +2984,33 @@
// content.set..., no need for dynamic content and pointer
map.actions = {
"custom_checkbox_search": function (obj) {
var form_check_list, i, check_len, check, value_str;
// TODO: it should be possible to inherit results so a dynamic listview
// could be child of a form, which is not dynamic!
form_check_list = obj.element.parentNode.parentNode.nextSibling.getElementsByTagName("input");
value_str = "";
for (i = 0, check_len = form_check_list.length; i < check_len; i += 1) {
check = form_check_list[i];
if (check.type = "checkbox" && check.checked) {
value_str += "group=" + check.id.split("select_")[1] + "|";
}
}
$.mobile.changePage(
"#" + window.encodeURIComponent(
"product_module&query:" + value_str.slice(0,-1)
)
);
},
"custom_search": function (obj) {
$.mobile.changePage("#" + window.encodeURIComponent("product_module&value:" + obj.element.value));
$.mobile.changePage(
"#" + window.encodeURIComponent(
"product_module&value:" + obj.element.value
)
);
},
"set_search": function (obj) {
......@@ -4447,7 +4472,7 @@
// "foo" = "bar"
if (is_value && key) {
obj.query += ' AND (' + key + ': "' + value + '")';
obj.query += ' AND (' + key + ':= "' + value + '")';
obj.start = 0;
obj.items = 1;
obj.restore = [key, value];
......@@ -4465,7 +4490,7 @@
"key",
field_list[i]
)) {
wrap += field_list[i] + ': "' +
wrap += field_list[i] + ':= "' +
obj.wildcard_character +
value +
obj.wildcard_character + '" OR ';
......@@ -4510,6 +4535,7 @@
obj.limit = [];
}
}
return obj;
};
......@@ -7044,6 +7070,7 @@
* limit:start=0+items=5&
* sort:id=ascending+foo=descending&
* select:id+foo+baz+cous
* value:foo+bar+baz
*
* @method parseQueryParameter
* @param {string} str String to parse
......@@ -7064,7 +7091,8 @@
switch (indicator) {
case "query":
initial_query.query = param[1].replace("=", ":=", "g")
.replace("+", " AND ", "g");
.replace("+", " AND ", "g")
.replace("|", " OR ", "g");
break;
case "limit":
// NOTE: Thanks Tristan!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment