Commit 04df0c44 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: add draft support for filter editor which is used to make query

parent 7950d24e
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_filter_editor.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_filtereditor_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta charset="utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>ERP5 Filter Editor</title>\n
\n
<!-- renderjs -->\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="handlebars.js"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_erp5_filter_editor.js"></script>\n
\n
<script id="option-template" type="text/x-handlebars-template">\n
<option value="{{value}}" data-i18n="{{text}}">{{text}}</option>\n
</script>\n
\n
<script id="selected-option-template" type="text/x-handlebars-template">\n
<option selected="selected" data-i18n="{{text}}" value="{{value}}">{{text}}</option>\n
</script>\n
\n
\n
<script id="option-template" type="text/x-handlebars-template">\n
<option value="{{value}}" data-i18n="{{text}}">{{text}}</option>\n
</script>\n
\n
<script id="selected-option-template" type="text/x-handlebars-template">\n
<option selected="selected" data-i18n="{{text}}" value="{{value}}">{{text}}</option>\n
</script>\n
\n
<script id="filter-template" type="text/x-handlebars-template">\n
<div class="header">\n
<form class="delete">\n
<button type="submit" class="close ui-btn-c ui-override-theme ui-btn ui-icon-delete ui-btn-icon-notext"></button>\n
</form>\n
<h1 data-i18n="Filter Editor">Filter Editor</h1>\n
\n
<form class="submit">\n
<button type="submit" class="submit ui-btn-c ui-override-theme ui-btn ui-icon-reorder ui-btn-icon-notext"></button>\n
</form>\n
</div>\n
\n
<div class="container">\n
<h1 data-i18n="Custom Filter">Custom Filter</h1>\n
\n
<fieldset data-role="ui_controlgroup">\n
<label for="radio-a">All criterions(AND)</label>\n
<input type="radio" name="radio_filter" id="radio_a" class="and" checked></input>\n
<label for="radio-b">At least one(OR)</label>\n
<input type="radio" name="radio_filter" id="radio_b" class="or"></input>\n
</fieldset>\n
<div class="filter_item_container">\n
<form class="plus">\n
<button type="submit" class="plus ui-btn-c ui-override-theme ui-btn ui-icon-plus ui-btn-icon-notext"></button>\n
</div>\n
</form>\n
</div>\n
\n
<div class="predefined_filter">\n
<h1 data-i18n="Predefined Filter">Predefined Filter</h1>\n
</div>\n
\n
</script>\n
\n
</head>\n
<body>\n
<div class="jqm-navmenu-panel"></div>\n
</body>\n
</html>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Erp5 Filter Editor</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1439819451.71</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.13851.42970.21913</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1440425765.38</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>empty</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1439819302.25</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_filter_editor.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_filtereditor_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
/*global window, rJS, Handlebars, jQuery, RSVP, loopEventListener, document */\n
(function (window, rJS, Handlebars, $, RSVP, loopEventListener) {\n
"use strict";\n
\n
/////////////////////////////////////////////////////////////////\n
// templates\n
/////////////////////////////////////////////////////////////////\n
// Precompile templates while loading the first gadget instance\n
var gadget_klass = rJS(window),\n
option_source = gadget_klass.__template_element\n
.getElementById("option-template")\n
.innerHTML,\n
option_template = Handlebars.compile(option_source),\n
\n
selected_option_source = gadget_klass.__template_element\n
.getElementById("selected-option-template")\n
.innerHTML,\n
selected_option_template = Handlebars.compile(selected_option_source),\n
\n
filter_source = gadget_klass.__template_element\n
.getElementById("filter-template")\n
.innerHTML,\n
filter_template = Handlebars.compile(filter_source);\n
\n
\n
\n
function submitFilterQuery(gadget) {\n
var i,\n
operator,\n
query = "",\n
value,\n
select,\n
filterforms = gadget.props.element.querySelectorAll(".filterForm"),\n
and = gadget.props.element.querySelector(".and");\n
operator = and.checked ? " AND " : " OR ";\n
for (i = 0; i < filterforms.length; i += 1) {\n
if (filterforms[i][3].value !== "") {\n
if (i !== 0) {\n
query += operator;\n
}\n
value = filterforms[i][3].value;\n
select = filterforms[i][2][filterforms[i][2].selectedIndex].value;\n
if (select === "keyword" && filterforms[i][1][filterforms[i][1].selectedIndex].value !== "Searchable Text") {\n
value = "%" + value + "%";\n
} else {\n
value = select + value;\n
}\n
if (filterforms[i][1][filterforms[i][1].selectedIndex].value === "Searchable Text") {\n
query += value;\n
} else {\n
query += filterforms[i][1][filterforms[i][1].selectedIndex].value + ":" + value;\n
}\n
}\n
}\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.pleasePublishMyState({\n
"extended_search": query\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
function createFilterItem(gadget, select, input_value) {\n
var container = document.createElement("form"),\n
minus_button = document.createElement("input"),\n
select_reference = document.createElement("select"),\n
i,\n
tmp = "",\n
default_select = "Searchable Text",\n
select_options,\n
select_options_value,\n
options_map = {\n
"date_float": ["Equals To", "Greater Than", "Less Than", "Not Greater Than", "Not Less Than"],\n
"date_float_value": ["", ">", "<", "<=", ">="],\n
"searchable_text": ["Contain"],\n
"searchable_text_value": [""],\n
"other": ["Exact Match", "keyword"],\n
"other_value": ["", "keyword"]\n
},\n
\n
text = document.createElement("input"),\n
select_operator = document.createElement("select");\n
\n
container.appendChild(minus_button);\n
container.appendChild(select_reference);\n
container.appendChild(select_operator);\n
text.setAttribute("type", "text");\n
text.setAttribute("value", input_value || "");\n
minus_button.setAttribute("class", "minus_button");\n
minus_button.setAttribute("type", "button");\n
container.appendChild(text);\n
container.setAttribute("class", "filterForm");\n
\n
\n
\n
\n
function createSelectOperator(event) {\n
var html = "",\n
j;\n
if (event.target.value.indexOf(\'date\') !== -1 ||\n
event.target.value.indexOf(\'quantity\') !== -1 ||\n
event.target.value.indexOf(\'price\') !== -1) {\n
select_options = options_map.date_float;\n
select_options_value = options_map.date_float_value;\n
} else if (event.target.value === "Searchable Text") {\n
select_options = options_map.searchable_text;\n
select_options_value = options_map.searchable_text_value;\n
} else {\n
select_options = options_map.other;\n
select_options_value = options_map.other_value;\n
}\n
\n
for (j = 0; j < select_options.length; j += 1) {\n
html += option_template({\n
value: select_options_value[j],\n
text: select_options[j]\n
});\n
}\n
select_operator.innerHTML = html;\n
}\n
\n
\n
tmp = "";\n
tmp += option_template({\n
value: "Searchable Text",\n
text: "Searchable Text"\n
});\n
for (i = 0; i < gadget.props.options.length; i += 1) {\n
if (select === gadget.props.options[i][0]) {\n
default_select = gadget.props.options[i][1];\n
tmp += selected_option_template({\n
value: gadget.props.options[i][0],\n
text: gadget.props.options[i][1]\n
});\n
} else {\n
tmp += option_template({\n
value: gadget.props.options[i][0],\n
text: gadget.props.options[i][1]\n
});\n
}\n
}\n
\n
select_reference.innerHTML = tmp;\n
\n
createSelectOperator({"target": {"value": default_select}});\n
loopEventListener(\n
minus_button,\n
"click",\n
false,\n
function () {\n
container.parentElement.removeChild(container);\n
}\n
);\n
loopEventListener(\n
select_reference,\n
"change",\n
false,\n
createSelectOperator\n
);\n
loopEventListener(\n
container,\n
"submit",\n
false,\n
function () {\n
return submitFilterQuery(gadget);\n
}\n
);\n
return container;\n
}\n
\n
\n
gadget_klass\n
/////////////////////////////////////////////////////////////////\n
// ready\n
/////////////////////////////////////////////////////////////////\n
// Init local properties\n
.ready(function (g) {\n
g.props = {};\n
})\n
\n
//////////////////////////////////////////////\n
// acquired method\n
//////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisFrontPage", "whoWantToDisplayThisFrontPage")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
\n
// Assign the element to a variable\n
.ready(function (g) {\n
return g.getElement()\n
.push(function (element) {\n
g.props.element = element;\n
g.props.jelement = $(element.querySelector("div"));\n
});\n
})\n
\n
.ready(function (g) {\n
g.props.jelement.panel({\n
display: "overlay",\n
position: "right",\n
theme: "c"\n
});\n
})\n
\n
.ready(function (g) {\n
return new RSVP.Queue()\n
.push(function () {\n
var tmp = filter_template();\n
return g.translateHtml(tmp);\n
})\n
.push(function (translated_html) {\n
g.props.jelement.html(translated_html);\n
g.props.jelement.trigger("create");\n
});\n
})\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareMethod(\'toggle\', function () {\n
var gadget = this,\n
options = gadget.props.options;\n
gadget.props.jelement.panel("toggle");\n
if (gadget.props.element.querySelector(".filterForm") === null || gadget.props.change) {\n
gadget.props.change = false;\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view});\n
})\n
.push(function (result) {\n
gadget.props.options = result.data._embedded._view.listbox.column_list;\n
return createFilterItem(gadget);\n
})\n
.push(function (item) {\n
var container = gadget.props.element.querySelector(".filter_item_container");\n
container.insertBefore(item, container.lastChild);\n
});\n
}\n
})\n
\n
.declareMethod(\'render\', function (options) {\n
var container = this.props.element.querySelector(".filter_item_container"),\n
i,\n
gadget = this,\n
item,\n
select_list,\n
query;\n
while (container.firstChild !== container.lastChild) {\n
container.removeChild(container.firstChild);\n
}\n
this.props.options = options;\n
if (options.filterEditor !== undefined || options.pg !== undefined) {\n
\n
query = options.filterEditor ? options.filterEditor.extended_search : options.pg.fg.erp5_searchfield.extended_search;\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view});\n
})\n
.push(function (result) {\n
gadget.props.options = result.data._embedded._view.listbox.column_list;\n
var query_list = query.split(" AND ");\n
\n
for (i = 0; i < query_list.length; i += 1) {\n
select_list = query_list[i].split(":");\n
if (select_list.length === 1) {\n
item = createFilterItem(gadget, "Searchable Text", query_list[i]);\n
} else {\n
item = createFilterItem(gadget, select_list[0], select_list[1]);\n
}\n
container.insertBefore(item, container.lastChild);\n
}\n
});\n
}\n
\n
})\n
\n
/////////////////////////////////////////////////////////////////\n
// declared services\n
/////////////////////////////////////////////////////////////////\n
.declareService(function () {\n
var gadget = this;\n
function closeFilterEditor() {\n
gadget.props.jelement.panel("toggle");\n
}\n
function plusItem() {\n
return new RSVP.Queue()\n
.push(function () {\n
return createFilterItem(gadget);\n
})\n
.push(function (item) {\n
var container = gadget.props.element.querySelector(".filter_item_container");\n
container.insertBefore(item, container.lastChild);\n
});\n
}\n
\n
loopEventListener(\n
gadget.props.element.querySelector(".plus"),\n
"submit",\n
false,\n
plusItem\n
);\n
loopEventListener(\n
gadget.props.element.querySelector(".delete"),\n
"submit",\n
false,\n
closeFilterEditor\n
);\n
loopEventListener(\n
gadget.props.element.querySelector(".submit"),\n
"submit",\n
false,\n
function () {\n
return submitFilterQuery(gadget);\n
}\n
);\n
});\n
\n
}(window, rJS, Handlebars, jQuery, RSVP, loopEventListener));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Erp5 Filter Editor JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1439819594.24</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.18296.32311.54766</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1440435953.88</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>empty</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1439819567.59</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -158,6 +158,13 @@ ...@@ -158,6 +158,13 @@
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
data-gadget-scope="filterEditor"\n
data-gadget-sandbox="public"></div>\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
...@@ -303,7 +310,7 @@ ...@@ -303,7 +310,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.54056.18010.56797</string> </value> <value> <string>945.18332.59164.9181</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -321,8 +328,8 @@ ...@@ -321,8 +328,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442581000.11</float> <float>1440437597.42</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -495,6 +495,9 @@ ...@@ -495,6 +495,9 @@
.allowPublicAcquisition(\'triggerPanel\', function () {\n .allowPublicAcquisition(\'triggerPanel\', function () {\n
return route(this, "panel", "toggle");\n return route(this, "panel", "toggle");\n
})\n })\n
.allowPublicAcquisition(\'triggerFilterEditor\', function () {\n
return route(this, "filterEditor", "toggle");\n
})\n
\n \n
.allowPublicAcquisition("jio_allDocs", function (param_list) {\n .allowPublicAcquisition("jio_allDocs", function (param_list) {\n
return callJioGadget(this, "allDocs", param_list);\n return callJioGadget(this, "allDocs", param_list);\n
...@@ -775,7 +778,7 @@ ...@@ -775,7 +778,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>
......
...@@ -214,7 +214,11 @@ ...@@ -214,7 +214,11 @@
\n \n
if (url_query) {\n if (url_query) {\n
//query_string = field_json.column_list.reduce(buildQueryString, \' AND (\').replace(new RegExp("OR " + \'$\'), \')\');\n //query_string = field_json.column_list.reduce(buildQueryString, \' AND (\').replace(new RegExp("OR " + \'$\'), \')\');\n
if (field_json.list_method_template === undefined) {\n
query_string = \' AND \' + url_query;\n query_string = \' AND \' + url_query;\n
} else {\n
query_string = url_query;\n
}\n
}\n }\n
\n \n
for (i = 0; i < field_json.column_list.length; i += 1) {\n for (i = 0; i < field_json.column_list.length; i += 1) {\n
...@@ -604,7 +608,7 @@ ...@@ -604,7 +608,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.44927.40202.16725</string> </value> <value> <string>945.18094.21629.29286</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -622,7 +626,7 @@ ...@@ -622,7 +626,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445939419.71</float> <float>1440435604.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -171,7 +171,13 @@ ...@@ -171,7 +171,13 @@
});\n });\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var sub_options = options.fg || {};\n var sub_options = options.fg;\n
if (sub_options === undefined) {\n
sub_options = {};\n
if(options.filterEditor) {\n
sub_options.erp5_searchfield = options.filterEditor;\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
...@@ -317,7 +323,7 @@ ...@@ -317,7 +323,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>
...@@ -331,7 +337,7 @@ ...@@ -331,7 +337,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.30055.63361.39150</string> </value> <value> <string>945.12418.34036.47547</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -349,8 +355,8 @@ ...@@ -349,8 +355,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445267203.04</float> <float>1440083034.81</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -120,24 +120,38 @@ ...@@ -120,24 +120,38 @@
<!-- custom script -->\n <!-- custom script -->\n
<script src="gadget_erp5_searchfield.js"></script>\n <script src="gadget_erp5_searchfield.js"></script>\n
\n \n
<!-- XXX widget-status is bad! -->\n
<script id="panel-template" type="text/x-handlebars-template">\n <script id="panel-template" type="text/x-handlebars-template">\n
<div class="center">\n <div class="field_container">\n
<div class="ui-field-contain">\n <div class="ui-field-contain">\n
<div class="ui-input-text ui-body-{{widget_theme}} ui-corner-all ui-shadow-inset ui-input-has-clear {{widget_status_class}}">\n <div class="css-compatability-helper">\n
<div class="ui-input-text ui-body-{{theme}} ui-input-has-icon ui-corner-all ui-shadow-inset ui-input-has-clear {{status_class}} {{css_class}}">\n
<form class="save_form document_form">\n
<input type="text" data-enhanced="true" value="{{widget_value}}" name="search" {{widget_status_attribute}} />\n <input type="text" data-enhanced="true" value="{{widget_value}}" name="search" {{widget_status_attribute}} />\n
<div class="ui-btn ui-input-clear ui-input-btn ui-corner-all ui-icon-search ui-btn-icon-notext" data-i18n="[node]header-submit">\n <div class="ui-btn ui-input-clear ui-input-btn ui-corner-all ui-icon-search ui-btn-icon-notext" data-i18n="[node]{{search_i18n}}">\n
Submit<input data-enhanced="true" type="submit" data-i18n="[value]header-submit" value="Submit" {{widget_status_attribute}} />\n {{search_i18n}}<input tabindex="-1" data-role="button" data-enhanced="true" type="submit" data-i18n="[value]{{search_i18n}}" value=" "/>\n
</div>\n
</form>\n
</div>\n
<div class="ui-shadow-inset ui-btn ui-btn-inline ui-corner-all ui-btn-{{theme}} ui-btn-icon-notext ui-icon-filter ui-override-theme " >\n
<form class="filter_form">\n
<div class="ui-input-btn">\n
<input data-role="button" data-enhanced="true" type="submit" data-i18n="[value]" value=" ">\n
</div>\n
\n
</form>\n
</div>\n </div>\n
</div>\n </div>\n
<a href="#" data-i18n="filter" class="ui-btn ui-btn-{{widget_theme}} ui-btn-icon-notext ui-icon-filter ui-override-theme ui-disabled">Filters</a>\n
</div>\n </div>\n
</div>\n </div>\n
</script>\n </script>\n
\n
\n
\n
\n
\n \n
</head>\n </head>\n
<body>\n <body>\n
<div class="save_form document_form"></div>\n <div class="container"></div>\n
</body>\n </body>\n
</html> </html>
...@@ -262,7 +276,7 @@ ...@@ -262,7 +276,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>
...@@ -276,7 +290,7 @@ ...@@ -276,7 +290,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.50880.23560.7150</string> </value> <value> <string>945.13789.16491.47428</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -294,8 +308,8 @@ ...@@ -294,8 +308,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442998364.27</float> <float>1440168925.51</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -135,7 +135,9 @@ ...@@ -135,7 +135,9 @@
// acquired method\n // acquired method\n
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
\n .declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("triggerFilterEditor", "triggerFilterEditor")\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -161,7 +163,7 @@ ...@@ -161,7 +163,7 @@
}));\n }));\n
})\n })\n
.push(function (my_translated_html) {\n .push(function (my_translated_html) {\n
search_gadget.props.element.querySelector("div").innerHTML =\n search_gadget.props.element.querySelector(".container").innerHTML =\n
my_translated_html;\n my_translated_html;\n
return search_gadget;\n return search_gadget;\n
});\n });\n
...@@ -173,6 +175,42 @@ ...@@ -173,6 +175,42 @@
\n \n
result[input.getAttribute(\'name\')] = input.value;\n result[input.getAttribute(\'name\')] = input.value;\n
return result;\n return result;\n
})\n
\n
.declareService(function () {\n
var gadget = this;\n
\n
function filterSubmit(evt) {\n
return gadget.triggerFilterEditor();\n
}\n
\n
function formSubmit(evt) {\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.getContent();\n
})\n
.push(function (data) {\n
return gadget.pleasePublishMyState({\n
"extended_search": data.search\n
});\n
})\n
.push(function (url) {\n
return gadget.pleaseRedirectMyHash(url);\n
});\n
}\n
// Listen to form submit\n
loopEventListener(\n
gadget.props.element.querySelector(\'.save_form\'),\n
\'submit\',\n
false,\n
formSubmit\n
);\n
loopEventListener(\n
gadget.props.element.querySelector(\'.filter_form\'),\n
\'submit\',\n
false,\n
filterSubmit\n
);\n
});\n });\n
\n \n
}(window, rJS, RSVP, loopEventListener, Handlebars));</string> </value> }(window, rJS, RSVP, loopEventListener, Handlebars));</string> </value>
...@@ -310,7 +348,7 @@ ...@@ -310,7 +348,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.61050.10650.48093</string> </value> <value> <string>945.13775.30295.64870</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -328,8 +366,8 @@ ...@@ -328,8 +366,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445265843.55</float> <float>1440164409.77</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
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