Commit b362f232 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Remember the list of last accessed documents

This list can be viewed in the panel History link
parent 18f1b521
......@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Mon, 03 Nov 2015 11:50:00 +0000\n
# generated on Mon, 10 Nov 2015 14:20:00 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -165,6 +165,8 @@ gadget_erp5_page_form.html\n
gadget_erp5_page_form.js\n
gadget_erp5_page_front.html\n
gadget_erp5_page_front.js\n
gadget_erp5_page_history.html\n
gadget_erp5_page_history.js\n
gadget_erp5_page_login.html\n
gadget_erp5_page_login.js\n
gadget_erp5_page_logout.html\n
......@@ -332,7 +334,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.55008.187.42410</string> </value>
<value> <string>946.56378.7589.51541</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -350,7 +352,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1446547833.72</float>
<float>1447161601.46</float>
<string>UTC</string>
</tuple>
</state>
......
<?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_page_history.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_page_history_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 http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>ERP5 Page History</title>\n
\n
<!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
<script src="handlebars.js" type="text/javascript"></script>\n
\n
\n
<!-- custom script -->\n
<script src="gadget_global.js" type="text/javascript"></script>\n
<script src="gadget_erp5_page_history.js" type="text/javascript"></script>\n
\n
<!-- XXX must set theme here! -->\n
<script id="table-template" type="text/x-handlebars-template">\n
<ul data-role="listview" data-theme="c" class="document-listview ui-listview-inset ui-corner-all">\n
{{#each documentlist}}\n
<li><a class="ui-body-inherit" href="{{link}}">{{title}}</a></li>\n
{{/each}}\n
</ul>\n
</script>\n
\n
</head>\n
<body>\n
<section class="document_list"></section>\n
</body>\n
</html>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget ERP5 History</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>1446803548.65</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>946.65003.35174.34013</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>1447083698.91</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> <string>detect_converted_file</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>external_processing_state</string> </key>
<value> <string>converted</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>1446803341.66</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_page_history.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_page_history_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[
/*global window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery, objectToSearchText */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery, objectToSearchText) {\n
"use strict";\n
\n
/////////////////////////////////////////////////////////////////\n
// Handlebars\n
/////////////////////////////////////////////////////////////////\n
// Precompile the templates while loading the first gadget instance\n
var gadget_klass = rJS(window),\n
source = gadget_klass.__template_element\n
.getElementById("table-template")\n
.innerHTML,\n
table_template = Handlebars.compile(source);\n
\n
gadget_klass\n
/////////////////////////////////////////////////////////////////\n
// ready\n
/////////////////////////////////////////////////////////////////\n
// Init local properties\n
.ready(function (g) {\n
g.props = {};\n
})\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
});\n
})\n
\n
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
.declareMethod("render", function (options) {\n
var gadget = this,\n
id_list = options.id_list || [];\n
\n
return gadget.updateHeader({\n
page_title: \'History\'\n
})\n
.push(function () {\n
var i,\n
query_list = [];\n
for (i = 0; i < id_list.length; i += 1) {\n
query_list.push(new SimpleQuery({key: \'relative_url\', value: id_list[i]}));\n
}\n
return gadget.jio_allDocs({\n
query: objectToSearchText(new ComplexQuery({operator: \'OR\', query_list: query_list})),\n
select_list: ["title", "portal_type"],\n
limit: id_list.length\n
});\n
})\n
.push(function (result) {\n
var result_list = [],\n
i;\n
for (i = 0; i < result.data.rows.length; i += 1) {\n
result_list.push(RSVP.all([\n
gadget.getUrlFor({command: \'display\', options: {jio_key: result.data.rows[i].id}}),\n
result.data.rows[i].value,\n
result.data.rows[i].id\n
]));\n
}\n
return RSVP.all(result_list);\n
})\n
.push(function (result_list) {\n
var i,\n
document_list = [],\n
document_dict = {},\n
result_html;\n
\n
for (i = 0; i < result_list.length; i += 1) {\n
document_dict[result_list[i][2]] = {\n
link: result_list[i][0],\n
title: (result_list[i][1].title || result_list[i][2]) + " (" + result_list[i][1].portal_type + ")"\n
};\n
}\n
// Sort by access time\n
for (i = 0; i < id_list.length; i += 1) {\n
if (document_dict.hasOwnProperty(id_list[i])) {\n
document_list.push(document_dict[id_list[i]]);\n
}\n
}\n
\n
result_html = table_template({\n
documentlist: document_list\n
});\n
\n
return gadget.translateHtml(result_html);\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.querySelector(\'.document_list\').innerHTML =\n
my_translated_html;\n
});\n
});\n
}(window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery, objectToSearchText));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget ERP5 History 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>1446803538.61</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>947.772.27087.52821</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>1447161932.1</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> <string>detect_converted_file</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>external_processing_state</string> </key>
<value> <string>converted</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>1446803341.63</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -129,6 +129,7 @@
</head>\n
<body>\n
<div data-gadget-url="gadget_jio.html" data-gadget-scope="jio_selection"></div>\n
<div data-gadget-url="gadget_jio.html" data-gadget-scope="jio_navigation_history"></div>\n
</body>\n
</html>\n
......@@ -254,7 +255,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -268,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.59812.18070.18176</string> </value>
<value> <string>946.44927.40202.16725</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -286,8 +287,8 @@
</tuple>
<state>
<tuple>
<float>1442926344.74</float>
<string>GMT</string>
<float>1446821965.62</float>
<string>UTC</string>
</tuple>
</state>
</object>
......
......@@ -248,18 +248,56 @@
}\n
return result;\n
}\n
\n
//////////////////////////////////////////////////////////////////\n
// navigation history functions\n
//////////////////////////////////////////////////////////////////\n
function addNavigationHistoryAndDisplay(gadget, jio_key, options) {\n
var hash = getDisplayUrlFor(jio_key, options),\n
queue;\n
/*jslint regexp: true*/\n
if (jio_key && /^[^\\/]+_module\\/[^\\/]+$/.test(jio_key)) {\n
/*jslint regexp: false*/\n
// This only work for remote access to ERP5...\n
queue = gadget.props.jio_navigation_gadget.put(jio_key, {\n
access_time: (new Date().getTime()),\n
hash: hash\n
})\n
.push(function () {\n
return gadget.props.jio_navigation_gadget.allDocs({\n
sort_on: [[\'access_time\', \'descending\']],\n
// Max number of history entry\n
limit: [30, 9999]\n
});\n
})\n
.push(function (result_list) {\n
// Remove old accessed documents\n
var i,\n
promise_list = [];\n
for (i = 0; i < result_list.data.rows.length; i += 1) {\n
promise_list.push(\n
gadget.props.jio_navigation_gadget.remove(result_list.data.rows[i].id)\n
);\n
}\n
return RSVP.all(promise_list);\n
});\n
} else {\n
queue = new RSVP.Queue();\n
}\n
return queue\n
.push(function () {\n
return synchronousChangeState(hash);\n
});\n
}\n
\n
//////////////////////////////////////////////////////////////////\n
// exec command functions\n
//////////////////////////////////////////////////////////////////\n
function execDisplayCommand(next_options) {\n
function execDisplayCommand(gadget, next_options) {\n
// console.warn(command_options);\n
var jio_key = next_options.jio_key;\n
delete next_options.jio_key;\n
// XXX Implement history management\n
return synchronousChangeState(\n
getDisplayUrlFor(jio_key, next_options)\n
);\n
return addNavigationHistoryAndDisplay(gadget, jio_key, next_options);\n
}\n
\n
function execChangeCommand(previous_options, next_options) {\n
......@@ -302,9 +340,7 @@
})\n
.push(function (id) {\n
next_options.history = id;\n
return synchronousChangeState(\n
getDisplayUrlFor(jio_key, next_options)\n
);\n
return addNavigationHistoryAndDisplay(gadget, jio_key, next_options);\n
});\n
}\n
\n
......@@ -317,9 +353,7 @@
return addHistory(gadget, previous_options)\n
.push(function (id) {\n
next_options.history = id;\n
return synchronousChangeState(\n
getDisplayUrlFor(jio_key, next_options)\n
);\n
return addNavigationHistoryAndDisplay(gadget, jio_key, next_options);\n
});\n
}\n
\n
......@@ -345,12 +379,14 @@
getCommandUrlFor(gadget, COMMAND_HISTORY_PREVIOUS, previous_options)\n
);\n
}\n
return synchronousChangeState(\n
getDisplayUrlFor(result.data.rows[0].id, {\n
return addNavigationHistoryAndDisplay(\n
gadget,\n
result.data.rows[0].id,\n
{\n
selection: previous_options.selection,\n
selection_index: parseInt(previous_options.selection_index, 10) + 1,\n
history: previous_options.history\n
})\n
}\n
);\n
});\n
}, function (error) {\n
......@@ -391,12 +427,14 @@
getCommandUrlFor(gadget, COMMAND_HISTORY_PREVIOUS, previous_options)\n
);\n
}\n
return synchronousChangeState(\n
getDisplayUrlFor(result.data.rows[0].id, {\n
return addNavigationHistoryAndDisplay(\n
gadget,\n
result.data.rows[0].id,\n
{\n
selection: previous_options.selection,\n
selection_index: parseInt(previous_options.selection_index, 10) - 1,\n
history: previous_options.history\n
})\n
}\n
);\n
});\n
}, function (error) {\n
......@@ -417,9 +455,8 @@
uri;\n
if (parent_link !== undefined) {\n
uri = new URI(parent_link.href);\n
return synchronousChangeState(\n
getDisplayUrlFor(uri.segment(2), {})\n
);\n
\n
return addNavigationHistoryAndDisplay(gadget, uri.segment(2), {});\n
}\n
});\n
}\n
......@@ -454,9 +491,7 @@
var options = result_list[0].data,\n
next_jio_key = options.jio_key;\n
delete options.jio_key;\n
return synchronousChangeState(\n
getDisplayUrlFor(next_jio_key, options)\n
);\n
return addNavigationHistoryAndDisplay(gadget, next_jio_key, options);\n
});\n
}\n
\n
......@@ -484,6 +519,28 @@
})\n
);\n
}\n
} else if (command_options.args.page === \'history\') {\n
// This is an adhoc route to handle local navigation history\n
return gadget.props.jio_navigation_gadget.allDocs({\n
sort_on: [[\'access_time\', \'descending\']]\n
})\n
.push(function (result) {\n
var result_list = result.data.rows,\n
id_list = [],\n
i;\n
for (i = 0; i < result_list.length; i += 1) {\n
id_list.push(result_list[i].id);\n
}\n
\n
return {\n
url: "gadget_erp5_page_" + command_options.args.page + ".html",\n
// XXX Drop this options thing.\n
// Implement a "getSelection" method\n
options: {\n
id_list: id_list\n
}\n
};\n
});\n
}\n
\n
if (command_options.args.page === undefined) {\n
......@@ -539,7 +596,7 @@
}\n
\n
if (command_options.path === COMMAND_DISPLAY_STATE) {\n
return execDisplayCommand(next_options);\n
return execDisplayCommand(gadget, next_options);\n
}\n
if (command_options.path === COMMAND_INDEX_STATE) {\n
return execIndexCommand(gadget, previous_options, next_options);\n
......@@ -632,6 +689,20 @@
});\n
});\n
})\n
\n
.ready(function (gadget) {\n
return gadget.getDeclaredGadget("jio_navigation_history")\n
.push(function (jio_gadget) {\n
gadget.props.jio_navigation_gadget = jio_gadget;\n
return jio_gadget.createJio({\n
type: "query",\n
sub_storage: {\n
type: "indexeddb",\n
database: "navigation_history"\n
}\n
});\n
});\n
})\n
\n
.declareMethod(\'getCommandUrlFor\', function (options) {\n
var command = options.command,\n
......@@ -842,7 +913,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.59190.22172.6929</string> </value>
<value> <string>947.784.43671.16128</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -860,7 +931,7 @@
</tuple>
<state>
<tuple>
<float>1446737639.1</float>
<float>1447162652.41</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test Page History Only Shows Module Sub Documents</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test Page Front</td></tr>\n
</thead><tbody>\n
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />\n
\n
<!-- Access module, create a document, then create a sub document -->\n
<tr>\n
<td>open</td>\n
<td>${base_url}/web_site_module/renderjs_runner/#</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//h3[@data-i18n=\'Other\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//h3[@data-i18n=\'Other\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//a[@data-i18n=\'Foos\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>link=Foos</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>link=Add</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>link=Add</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//select[@name=\'field_your_portal_type\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>select</td>\n
<td>//select[@name=\'field_your_portal_type\']</td>\n
<td>label=Foo</td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>Save</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>link=Add</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//select[@name=\'field_your_portal_type\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>select</td>\n
<td>//select[@name=\'field_your_portal_type\']</td>\n
<td>label=Foo Line</td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>Save</td>\n
<td></td>\n
</tr>\n
\n
<!-- History only show 1 of the 3 documents accessed -->\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//a[text()=\'1\' and contains(@href, \'#!change\') and contains(@href, \'n.page=breadcrumb\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_breadcrumb.html\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'ERP5\' and @href=\'#\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'panel\']//div[contains(@class, \'ui-panel-open\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'panel\']//a[text()=\'History\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_history.html\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Generate links to module -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'2 (Foo)\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module%2F2\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextNotPresent</td>\n
<td>Foo Module</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextNotPresent</td>\n
<td>Foo Line</td>\n
<td></td>\n
</tr>\n
\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPageHistoryDocumentListOnlyShowModuleSubDocuments</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test Page History Only Shows Module Sub Documents</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test Page Front</td></tr>\n
</thead><tbody>\n
\n
<!-- reuse listbox suite reset to clear modules. -->\n
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/ListBoxZuite_reset</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Reset Successfully.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<!-- create a Foo -->\n
<td>${base_url}/foo_module/Foo_createObjects?start:int=1&amp;num:int=2</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Created Successfully.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/Zuite_waitForActivities</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Done.</td>\n
<td></td>\n
</tr>\n
\n
<!-- Access both documents -->\n
<tr>\n
<td>open</td>\n
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>Title 1</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'field_listbox\']//a[text()=\'Title 1\' and contains(@href, \'#!index\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'header\']//a[text()=\'Back\' and contains(@href, \'#!history_previous\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//a[text()=\'Back\' and contains(@href, \'#!history_previous\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>Title 2</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'field_listbox\']//a[text()=\'Title 2\' and contains(@href, \'#!index\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'header\']//a[text()=\'Back\' and contains(@href, \'#!history_previous\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//a[text()=\'Back\' and contains(@href, \'#!history_previous\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Go to the history tab -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'panel\']//div[contains(@class, \'ui-panel-open\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'panel\']//a[text()=\'History\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_history.html\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Generate links to module -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//li[@class=\'ui-first-child\']//a[text()=\'Title 2 (Foo)\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module%2F2\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Title 1 (Foo)\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module%2F1\')]</td>\n
<td></td>\n
</tr>\n
\n
<!-- Click on second one to change the order -->\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Title 1 (Foo)\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module%2F1\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'header\']//a[text()=\'Back\' and contains(@href, \'#!history_previous\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//a[text()=\'Back\' and contains(@href, \'#!history_previous\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Go to the history tab -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'panel\']//div[contains(@class, \'ui-panel-open\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'panel\']//a[text()=\'History\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_history.html\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Generate links to module -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//li[@class=\'ui-first-child\']//a[text()=\'Title 1 (Foo)\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module%2F1\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Title 2 (Foo)\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module%2F2\')]</td>\n
<td></td>\n
</tr>\n
\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPageHistoryDocumentListOrderedByAccessTime</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test History Page Menu Action</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>\n
</thead><tbody>\n
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />\n
\n
<tr>\n
<td>open</td>\n
<td>${base_url}/web_site_module/renderjs_runner/#/?page=history</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_history.html\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>Menu</td>\n
<td></td>\n
</tr>\n
\n
<!-- Header has a menu button -->\n
<tr>\n
<td>assertElementPresent</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertElementPresent</td>\n
<td>//div[@data-gadget-scope=\'panel\']//div[contains(@class, \'ui-panel-closed\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'panel\']//div[contains(@class, \'ui-panel-open\')]</td>\n
<td></td>\n
</tr>\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPageHistoryMenuAction</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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