Commit 131f2cc3 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: Don't use deprecateds methods

parent 50504c85
...@@ -133,6 +133,7 @@ ...@@ -133,6 +133,7 @@
query = "",\n query = "",\n
value,\n value,\n
select,\n select,\n
options = gadget.props.render_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 operator = and.checked ? " AND " : " OR ";\n
...@@ -176,6 +177,9 @@ ...@@ -176,6 +177,9 @@
}\n }\n
}\n }\n
}\n }\n
gadget.props.jelement.panel("toggle");\n
return gadget.redirect({jio_key: options.jio_key, view: options.view, "extended_search": query});\n
/*\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
return gadget.pleasePublishMyState({\n return gadget.pleasePublishMyState({\n
...@@ -185,7 +189,7 @@ ...@@ -185,7 +189,7 @@
.push(function (url) {\n .push(function (url) {\n
gadget.props.jelement.panel("toggle");\n gadget.props.jelement.panel("toggle");\n
return gadget.pleaseRedirectMyHash(url);\n return gadget.pleaseRedirectMyHash(url);\n
});\n });*/\n
}\n }\n
\n \n
\n \n
...@@ -400,10 +404,8 @@ ...@@ -400,10 +404,8 @@
// acquired method\n // acquired method\n
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisFrontPage", "whoWantToDisplayThisFrontPage")\n .declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
\n
// Assign the element to a variable\n // Assign the element to a variable\n
.ready(function (g) {\n .ready(function (g) {\n
return g.getElement()\n return g.getElement()\n
...@@ -436,7 +438,6 @@ ...@@ -436,7 +438,6 @@
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareMethod(\'toggle\', function () {\n .declareMethod(\'toggle\', function () {\n
var gadget = this,\n var gadget = this,\n
options = gadget.props.options;\n options = gadget.props.options;\n
...@@ -446,12 +447,12 @@ ...@@ -446,12 +447,12 @@
gadget.props.change = false;\n gadget.props.change = false;\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view});\n return gadget.jio_getAttachment(options.jio_key, options.view);\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var container = gadget.props.element.querySelector(".filter_item_container");\n var container = gadget.props.element.querySelector(".filter_item_container");\n
gadget.props.options = result.data._embedded._view.listbox.column_list;\n gadget.props.options = result._embedded._view.listbox.column_list;\n
gadget.props.domain_tree_map = result.data._embedded._view.listbox.domain_tree_map;\n gadget.props.domain_tree_map = result._embedded._view.listbox.domain_tree_map;\n
container.insertBefore(createFilterItem(gadget), container.lastChild);\n container.insertBefore(createFilterItem(gadget), container.lastChild);\n
createDomainTree(gadget);\n createDomainTree(gadget);\n
});\n });\n
...@@ -473,32 +474,27 @@ ...@@ -473,32 +474,27 @@
while (domain_tree_container.firstChild) {\n while (domain_tree_container.firstChild) {\n
domain_tree_container.removeChild(domain_tree_container.firstChild);\n domain_tree_container.removeChild(domain_tree_container.firstChild);\n
}\n }\n
\n options.view = options.view || \'view\';\n
this.props.render_options = options;\n
this.props.options = options;\n this.props.options = options;\n
if (options.filterEditor !== undefined || options.pg !== undefined || options.sortEditor) {\n if (options.extended_search || options.sortEditor) {\n
gadget.props.tree_path = [];\n gadget.props.tree_path = [];\n
if (options.filterEditor) {\n query = options.extended_search;\n
query = options.filterEditor.extended_search;\n
} else if (options.sortEditor) {\n
query = options.sortEditor.extended_search;\n
} else if (options.pg.fg.erp5_searchfield) {\n
query = options.pg.fg.erp5_searchfield.extended_search;\n
}\n
if (query === undefined) {\n if (query === undefined) {\n
query = "";\n query = "";\n
}\n }\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view});\n return gadget.jio_getAttachment(options.jio_key, options.view);\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var query_list = QueryFactory.create(query),\n var query_list = QueryFactory.create(query),\n
j = 0,\n j = 0,\n
key,\n key,\n
domain_tree_map = result.data._embedded._view.listbox.domain_tree_map,\n domain_tree_map = result._embedded._view.listbox.domain_tree_map,\n
domain_tree_list;\n domain_tree_list;\n
gadget.props.options = result.data._embedded._view.listbox.column_list;\n gadget.props.options = result._embedded._view.listbox.column_list;\n
gadget.props.domain_tree_map = result.data._embedded._view.listbox.domain_tree_map;\n gadget.props.domain_tree_map = result._embedded._view.listbox.domain_tree_map;\n
if (query_list.operator === "OR") {\n if (query_list.operator === "OR") {\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
...@@ -754,7 +750,7 @@ ...@@ -754,7 +750,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.49499.52520.15308</string> </value> <value> <string>945.58516.23819.36949</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -772,7 +768,7 @@ ...@@ -772,7 +768,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442307606.31</float> <float>1442848653.18</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -221,8 +221,8 @@ ...@@ -221,8 +221,8 @@
if (form_definition.extended_search) {\n if (form_definition.extended_search) {\n
suboption_dict.extended_search = form_definition.extended_search;\n suboption_dict.extended_search = form_definition.extended_search;\n
}\n }\n
if (form_definition.extended_sort_list) {\n if (form_definition.sort_list) {\n
suboption_dict.extended_sort_list = form_definition.extended_sort_list;\n suboption_dict.sort_list = form_definition.sort_list;\n
}\n }\n
\n \n
form_gadget.props.gadget_list = [];\n form_gadget.props.gadget_list = [];\n
...@@ -517,7 +517,7 @@ ...@@ -517,7 +517,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.49324.9572.9676</string> </value> <value> <string>945.58401.24333.56064</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -535,7 +535,7 @@ ...@@ -535,7 +535,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442309628.83</float> <float>1442850517.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -158,8 +158,6 @@ ...@@ -158,8 +158,6 @@
data-gadget-scope="panel"\n data-gadget-scope="panel"\n
data-gadget-sandbox="public"></div>\n data-gadget-sandbox="public"></div>\n
\n \n
<div data-gadget-url="gadget_erp5_filter_editor.html"\n <div data-gadget-url="gadget_erp5_filter_editor.html"\n
data-gadget-scope="filterEditor"\n data-gadget-scope="filterEditor"\n
data-gadget-sandbox="public"></div>\n data-gadget-sandbox="public"></div>\n
...@@ -168,7 +166,6 @@ ...@@ -168,7 +166,6 @@
data-gadget-scope="sortEditor"\n data-gadget-scope="sortEditor"\n
data-gadget-sandbox="public"></div>\n data-gadget-sandbox="public"></div>\n
\n \n
<div role="main" class="ui-content gadget-content"></div>\n <div role="main" class="ui-content gadget-content"></div>\n
</div>\n </div>\n
\n \n
...@@ -300,7 +297,7 @@ ...@@ -300,7 +297,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -314,7 +311,7 @@ ...@@ -314,7 +311,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.49198.46948.13260</string> </value> <value> <string>945.58401.24333.56064</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -332,7 +329,7 @@ ...@@ -332,7 +329,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442309444.67</float> <float>1442842868.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -159,8 +159,8 @@ ...@@ -159,8 +159,8 @@
\n \n
gadget.props.field_json = field_json;\n gadget.props.field_json = field_json;\n
gadget.props.extended_search = options.extended_search;\n gadget.props.extended_search = options.extended_search;\n
if (options.extended_sort_list) {\n if (options.sort_list) {\n
gadget.props.extended_sort_list = Object.keys(options.extended_sort_list).map(function (key) {return options.extended_sort_list[key]; });\n gadget.props.sort_list = Object.keys(options.sort_list).map(function (key) {return options.sort_list[key]; });\n
}\n }\n
if (field_json.show_anchor) {\n if (field_json.show_anchor) {\n
th = document.createElement("th");\n th = document.createElement("th");\n
...@@ -485,7 +485,7 @@ ...@@ -485,7 +485,7 @@
})\n })\n
.declareService(function () {\n .declareService(function () {\n
var gadget = this;\n var gadget = this;\n
return gadget.createListboxItem({"sort_list": gadget.props.extended_sort_list});\n return gadget.createListboxItem({"sort_list": gadget.props.sort_list});\n
})\n })\n
.declareService(function () {\n .declareService(function () {\n
var gadget = this,\n var gadget = this,\n
...@@ -713,7 +713,7 @@ ...@@ -713,7 +713,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.49507.40992.33228</string> </value> <value> <string>945.58413.7711.46148</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -731,7 +731,7 @@ ...@@ -731,7 +731,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442308372.06</float> <float>1442850295.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -140,10 +140,12 @@ ...@@ -140,10 +140,12 @@
form_options.erp5_document = options.erp5_document;\n form_options.erp5_document = options.erp5_document;\n
form_options.form_definition = options.form_definition;\n form_options.form_definition = options.form_definition;\n
// XXX not generic, fix later\n // XXX not generic, fix later\n
if (options.erp5_searchfield) {\n if (options.extended_search) {\n
form_options.form_definition.extended_search = options.erp5_searchfield.extended_search;\n form_options.form_definition.extended_search = options.extended_search;\n
form_options.form_definition.extended_sort_list = options.erp5_searchfield.sort_list;\n search_options.extended_search = options.extended_search;\n
search_options.extended_search = options.erp5_searchfield.extended_search;\n }\n
if (options.sort_list) {\n
form_options.form_definition.sort_list = options.sort_list;\n
}\n }\n
form_options.view = options.view;\n form_options.view = options.view;\n
\n \n
...@@ -348,7 +350,7 @@ ...@@ -348,7 +350,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.49301.25010.20189</string> </value> <value> <string>945.58541.12756.33723</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -366,7 +368,7 @@ ...@@ -366,7 +368,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442309537.27</float> <float>1442850245.08</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -171,17 +171,9 @@ ...@@ -171,17 +171,9 @@
});\n });\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var sub_options = options.fg;\n var sub_options = {};\n
if (sub_options === undefined) {\n sub_options.extended_search = options.extended_search;\n
sub_options = {};\n sub_options.sort_list = options.sort_list;\n
if (options.filterEditor) {\n
sub_options.erp5_searchfield = options.filterEditor;\n
} else {\n
if (options.sortEditor) {\n
sub_options.erp5_searchfield = options.sortEditor;\n
}\n
}\n
}\n
sub_options.erp5_document = erp5_document;\n sub_options.erp5_document = erp5_document;\n
sub_options.form_definition = erp5_form;\n sub_options.form_definition = erp5_form;\n
sub_options.view = options.view;\n sub_options.view = options.view;\n
...@@ -341,7 +333,7 @@ ...@@ -341,7 +333,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.49277.33497.32034</string> </value> <value> <string>945.58508.55936.1041</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -359,7 +351,7 @@ ...@@ -359,7 +351,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442308423.62</float> <float>1442850001.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -235,8 +235,7 @@ ...@@ -235,8 +235,7 @@
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n .declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareMethod(\'toggle\', function () {\n .declareMethod(\'toggle\', function () {\n
var gadget = this,\n var gadget = this,\n
options = gadget.props.options;\n options = gadget.props.options;\n
...@@ -244,10 +243,10 @@ ...@@ -244,10 +243,10 @@
if (gadget.props.column_list === "") {\n if (gadget.props.column_list === "") {\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view});\n return gadget.jio_getAttachment(options.jio_key, options.view);\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
gadget.props.column_list = result.data._embedded._view.listbox.column_list;\n gadget.props.column_list = result._embedded._view.listbox.column_list;\n
});\n });\n
}\n }\n
})\n })\n
...@@ -263,20 +262,22 @@ ...@@ -263,20 +262,22 @@
for (i = 0; i < sort_form_list.length; i += 1) {\n for (i = 0; i < sort_form_list.length; i += 1) {\n
sort_form_list[i].parentElement.removeChild(sort_form_list[i]);\n sort_form_list[i].parentElement.removeChild(sort_form_list[i]);\n
}\n }\n
options.view = options.view || "view";\n
gadget.props.options = options;\n gadget.props.options = options;\n
\n
gadget.props.column_list = "";\n gadget.props.column_list = "";\n
if (options.sortEditor) {\n if (options.sort_list) {\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view});\n return gadget.jio_getAttachment(options.jio_key, options.view);\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var key;\n var key;\n
gadget.props.column_list = result.data._embedded._view.listbox.column_list;\n gadget.props.column_list = result._embedded._view.listbox.column_list;\n
for (key in options.sortEditor.sort_list) {\n for (key in options.sort_list) {\n
if (options.sortEditor.sort_list.hasOwnProperty(key)) {\n if (options.sort_list.hasOwnProperty(key)) {\n
if (options.sortEditor.sort_list[key] !== "") {\n if (options.sort_list[key] !== "") {\n
container.insertBefore(createSortItem(gadget, options.sortEditor.sort_list[key]), container.lastChild);\n container.insertBefore(createSortItem(gadget, options.sort_list[key]), container.lastChild);\n
}\n }\n
}\n }\n
}\n }\n
...@@ -324,28 +325,15 @@ ...@@ -324,28 +325,15 @@
sort_query.push("");\n sort_query.push("");\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
if (gadget.props.options.filterEditor) {\n gadget.props.jelement.panel("toggle");\n
return gadget.pleasePublishMyState({\n if (gadget.props.options.extended_search) {\n
"extended_search": gadget.props.options.filterEditor.extended_search || "",\n return gadget.redirect({jio_key: gadget.props.options.jio_key, view: gadget.props.options.view,\n
"sort_list": sort_query\n "extended_search": gadget.props.options.extended_search,\n
});\n "sort_list": sort_query});\n
}\n
if (gadget.props.options.sortEditor) {\n
return gadget.pleasePublishMyState({\n
"extended_search": gadget.props.options.sortEditor.extended_search || "",\n
"sort_list": sort_query\n
});\n
}\n }\n
return gadget.pleasePublishMyState({\n return gadget.redirect({jio_key: options.jio_key, view: options.view, "sort_list": sort_query});\n
"sort_list": sort_query\n
});\n });\n
})\n
.push(function (url) {\n
gadget.props.jelement.panel("toggle");\n
return gadget.pleaseRedirectMyHash(url);\n
});\n });\n
}\n
);\n
});\n });\n
\n \n
}(window, document, rJS, RSVP)); }(window, document, rJS, RSVP));
...@@ -485,7 +473,7 @@ ...@@ -485,7 +473,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.49555.29942.44322</string> </value> <value> <string>945.58533.55345.57856</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -503,7 +491,7 @@ ...@@ -503,7 +491,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442311229.21</float> <float>1442850207.57</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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