Commit 95a4bcac authored by Lu Xu's avatar Lu Xu 👀

erp5_officejs:implement Smart Assistant UI on officeJS

parent f07ebe82
......@@ -31,6 +31,17 @@
class='ui-flex-center'>
</div>
</form>
<form class="save_form ui-body-c" novalidate>
<div data-gadget-url="gadget_erp5_pt_form_list.html"
data-gadget-scope="form_list"
data-gadget-sandbox="public"
class='ui-flex-bottom'>
</div>
</form>
<div data-gadget-url="gadget_erp5_page_ojs_smart_assistant_worklist.html"
data-gadget-scope="worklist"
data-gadget-sandbox="public"
class='ui-flex-bottom'>
</div>
</body>
</html>
......@@ -62,7 +62,6 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string>
</tuple>
</value>
......@@ -279,7 +278,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.17859.46531.61866</string> </value>
<value> <string>979.64140.28065.34372</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -297,7 +296,7 @@
</tuple>
<state>
<tuple>
<float>1525278837.04</float>
<float>1574460415.05</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, jIO, Handlebars, RSVP, Blob*/
/*global window, rJS, jIO, Handlebars, RSVP, Blob, SimpleQuery, ComplexQuery, Query*/
/*jslint indent:2, maxlen: 80, nomen: true */
(function (window, rJS, jIO, RSVP) {
(function (window, rJS, jIO, RSVP, SimpleQuery, ComplexQuery, Query) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
......@@ -18,8 +17,44 @@
.declareAcquiredMethod("notifyChange", "notifyChange")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, date, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.hasOwnProperty("modification_date")) {
date = new Date(result.data.rows[i].value.modification_date);
result.data.rows[i].value.modification_date = {
field_gadget_param: {
allow_empty_time: 0,
ampm_time_style: 0,
css_class: "date_field",
date_only: 0,
description: "The Date",
editable: 0,
hidden: 0,
hidden_day_is_last_day: 0,
"default": date.toUTCString(),
key: "modification_date",
required: 0,
timezone_style: 0,
title: "Modification Date",
type: "DateTimeField"
}
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
}
}
return result;
});
})
.allowPublicAcquisition('updateHeader', function () {
return;
......@@ -57,7 +92,8 @@
return gadget.jio_post({
"title": name,
portal_type: portal_type,
parent_relative_url: parent_relative_url
parent_relative_url: parent_relative_url,
validation_state: 'draft'
});
})
.push(function (id) {
......@@ -68,6 +104,12 @@
"message": "Data created",
"status": "success"
});
})
.push(function () {
return gadget.redirect({
command: 'display',
options: {page: "ojs_smart_assistant_document_list"}
});
});
}
});
......@@ -98,8 +140,11 @@
};
});
})
.declareMethod("render", function () {
var gadget = this;
this.getDeclaredGadget('form_list');
return gadget.getSetting('jio_storage_name')
.push(function (result) {
if (!result) {
......@@ -110,11 +155,44 @@
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_view_upload_audio'),
gadget.getDeclaredGadget('form_view_image_text')
gadget.getDeclaredGadget('form_view_image_text'),
gadget.getDeclaredGadget('form_list'),
gadget.getDeclaredGadget('worklist'),
gadget.getSetting("portal_type")
]);
})
.push(function (result) {
var column_list = [
['agent_title', 'Title'],
['description', 'Reply'],
['modification_date', 'Modification Date'],
['validation_state', 'Validation State']
],
worklist_gadget = result[3],
portal_type = ["Query"],
query = "urn:jio:allDocs?query=",
i,
jio_query_list = [];
for (i = 0; i < portal_type.length; i += 1) {
jio_query_list.push(new SimpleQuery({
key: "portal_type",
operator: "",
type: "simple",
value: portal_type[i]
}));
}
query += Query.objectToSearchText(new ComplexQuery({
operator: "OR",
query_list: jio_query_list,
type: "complex"
}));
return RSVP.all([
worklist_gadget.render(),
result[0].render({
erp5_document: {"_embedded": {"_view": {
"upload": {
......@@ -194,6 +272,43 @@
[["text"]]
]]
}
}),
result[2].render({
erp5_document: {
"_embedded": {"_view": {
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 1,
"editable_column_list": [],
"key": "field_listbox",
"lines": 10,
"list_method": "portal_catalog",
"query": query,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['validation_state', 'descending'],
['modification_date', 'descending']],
"title": "Notification",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
]]
}
})
]);
})
......@@ -216,4 +331,4 @@
});
}(window, rJS, jIO, RSVP));
\ No newline at end of file
}(window, rJS, jIO, RSVP, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file
......@@ -58,29 +58,12 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_ojs_smart_assistant_home.js</string> </value>
......@@ -101,25 +84,6 @@
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284352.18</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
......@@ -134,12 +98,6 @@
<key> <string>title</string> </key>
<value> <string>Gadget Smart Assistant JS</string> </value>
</item>
<item>
<key> <string>url_string</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
......@@ -226,7 +184,7 @@
</tuple>
<state>
<tuple>
<float>1519634719.01</float>
<float>1562159205.06</float>
<string>UTC</string>
</tuple>
</state>
......@@ -275,7 +233,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.20676.40581.32768</string> </value>
<value> <string>980.55662.21812.7987</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -293,7 +251,7 @@
</tuple>
<state>
<tuple>
<float>1525444169.16</float>
<float>1577797510.26</float>
<string>UTC</string>
</tuple>
</state>
......@@ -354,7 +312,7 @@
</tuple>
<state>
<tuple>
<float>1519633924.76</float>
<float>1562158825.48</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<!--
data-i18n=Worklist
data-i18n=All work caught up!
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 Page Worklist</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_ojs_smart_assistant_worklist.js" type="text/javascript"></script>
<!-- XXX must set theme here! -->
<script id="table-template" type="text/x-handlebars-template">
{{#if document_list }}
<ul data-role="listview" data-theme="c" class="document-listview ui-listview-inset ui-corner-all">
{{#each document_list}}
<li class="ui-li-has-count" data-icon="false" ><a class="ui-body-inherit" href="{{link}}">{{title}} <span class="ui-li-count">{{count}}</span></a></li>
{{/each}}
</ul>
{{else}}
<p>All work caught up!</p>
{{/if}}
</script>
</head>
<body>
<h1 data-i18n="[value]Smart Assistant WorkLists" class="ui-title ui-override-theme worklist-title">Smart Assistant WorkLists</h1>
<section class="document_list"></section>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, Handlebars, URI */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars) {
"use strict";
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window),
source = gadget_klass.__template_element
.getElementById("table-template")
.innerHTML,
table_template = Handlebars.compile(source);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this;
new RSVP.Queue().push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'display', options: {page: "ojs_smart_assistant_document_list", extended_search: 'validation_state: "draft"'}}),
gadget.getUrlFor({command: 'display', options: {page: "ojs_smart_assistant_document_list", extended_search: 'validation_state: "processing"'}}),
gadget.jio_allDocs({"query": 'portal_type: ("Smart Assistant File" OR "Smart Assistant Image" OR "Smart Assistant Text" OR "Smart Assistant Sound") AND validation_state: "draft"'}),
gadget.jio_allDocs({"query": 'portal_type: ("Smart Assistant File" OR "Smart Assistant Image" OR "Smart Assistant Text" OR "Smart Assistant Sound") AND validation_state: "processing"'})
]);
})
.push(function (result) {
var line_list = [];
line_list.push({
link: result[0],
title: "Smart Assistant Records to Start Processing",
count: result[2].data.total_rows
});
line_list.push({
link: result[1],
title: "Smart Assistant Records to Finish Processing",
count: result[3].data.total_rows
});
gadget.element.querySelector('.document_list').innerHTML = table_template({
document_list: line_list
});
});
});
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
/*global window, rJS, RSVP, jIO, Blob*/
/*jslint indent:2, maxlen: 80, nomen: true */
(function (window, jIO, rJS, RSVP, URL) {
(function (window, jIO, rJS, RSVP, URL, SimpleQuery, ComplexQuery, Query) {
"use strict";
rJS(window)
......@@ -23,6 +23,7 @@
var gadget = this,
state = {
title: options.doc.title,
validation_state: options.doc.validation_state,
jio_key: options.jio_key
};
......@@ -96,6 +97,35 @@
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
var column_list = [
['agent_title', 'Title'],
['description', 'Reply'],
['modification_date', 'Modification Date'],
['validation_state', 'Validation State']
],
jio_key = gadget.state.jio_key,
portal_type = ["Query"],
agent_relative_url = jio_key,
query = "urn:jio:allDocs?query=",
jio_query_list = [];
jio_query_list.push(new SimpleQuery({
key: "portal_type",
operator: "",
type: "simple",
value: portal_type
}));
jio_query_list.push(new SimpleQuery({
key: "agent_relative_url",
operater: "",
type: "simple",
value: agent_relative_url
}));
query += Query.objectToSearchText(new ComplexQuery({
operator: "AND",
query_list: jio_query_list,
type: "complex"
}));
return form_gadget.render({
erp5_document: {
"_embedded": {
......@@ -115,7 +145,7 @@
"editable": 1,
"required": 1,
"key": "",
"title": "Download actual content",
"title": "Download",
"default": {"direct_url": gadget.state.upload,
"target_type": "download",
"textContent": gadget.state.title},
......@@ -124,7 +154,7 @@
},
"my_upload": {
"description": "",
"title": "Change it",
"title": "Re-upload",
"default": "",
"css_class": "",
"required": 1,
......@@ -132,6 +162,34 @@
"key": "upload_",
"hidden": 0,
"type": "FileField"
},
"my_validation_state": {
"description": "",
"title": "State",
"default": gadget.state.validation_state,
"css_class": "",
"required": 1,
"editable": 0,
"key": "validation_state",
"hidden": 0,
"type": "StringField"
},
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"editable_column_list": [],
"key": "field_listbox",
"lines": 5,
"list_method": "portal_catalog",
"query": query,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['modification_date', 'descending']],
"title": "Related Queries",
"type": "ListBox"
}
}
},
......@@ -144,10 +202,15 @@
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_actual_upload"], ["my_upload"]]
[["my_title"], ["my_actual_upload"],
["my_upload"], ["my_validation_state"]]
], [
"bottom",
[['listbox']]
]]
}
});
});
});
}(window, jIO, rJS, RSVP, URL));
\ No newline at end of file
}(window, jIO, rJS, RSVP, URL, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file
......@@ -245,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.18881.16014.512</string> </value>
<value> <string>980.55724.32706.34986</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -263,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1525355150.41</float>
<float>1577801225.85</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, jIO, URL, Blob, promiseEventListener, document*/
/*jslint indent:2, maxlen: 80, nomen: true */
(function (window, jIO, rJS, RSVP, URL) {
(function (window, jIO, rJS, RSVP, URL, SimpleQuery, ComplexQuery, Query) {
"use strict";
rJS(window)
......@@ -24,6 +24,7 @@
var gadget = this,
state = {
title: options.doc.title,
validation_state: options.doc.validation_state,
jio_key: options.jio_key
};
gadget.type = options.doc.type;
......@@ -94,7 +95,35 @@
})
.onStateChange(function () {
var gadget = this;
var gadget = this,
column_list = [
['agent_title', 'Title'],
['description', 'Reply'],
['modification_date', 'Modification Date'],
['validation_state', 'Validation State']
],
jio_key = gadget.state.jio_key,
portal_type = ["Query"],
agent_relative_url = jio_key,
query = "urn:jio:allDocs?query=",
jio_query_list = [];
jio_query_list.push(new SimpleQuery({
key: "portal_type",
operator: "",
type: "simple",
value: portal_type
}));
jio_query_list.push(new SimpleQuery({
key: "agent_relative_url",
operater: "",
type: "simple",
value: agent_relative_url
}));
query += Query.objectToSearchText(new ComplexQuery({
operator: "AND",
query_list: jio_query_list,
type: "complex"
}));
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
......@@ -115,7 +144,7 @@
},
"my_image": {
"description": "",
"title": "Change it",
"title": "Re-upload",
"default": "",
"css_class": "",
"required": 1,
......@@ -126,9 +155,20 @@
"capture": "camera",
"type": "FileField"
},
"my_validation_state": {
"description": "",
"title": "State",
"default": gadget.state.validation_state,
"css_class": "",
"required": 1,
"editable": 0,
"key": "validation_state",
"hidden": 0,
"type": "StringField"
},
"my_image_preview": {
"description": "",
"title": "Actually",
"title": "Preview",
"default": gadget.state.image,
"css_class": "",
"height" : "10",
......@@ -137,6 +177,23 @@
"key": "image_preview",
"hidden": 0,
"type": "ImageField"
},
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"editable_column_list": [],
"key": "field_listbox",
"lines": 5,
"list_method": "portal_catalog",
"query": query,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['modification_date', 'descending']],
"title": "Related Queries",
"type": "ListBox"
}
}
},
......@@ -150,10 +207,14 @@
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_image"], ["my_image_preview"]]
[["my_title"], ["my_image"],
["my_validation_state"], ["my_image_preview"]]
], [
"bottom",
[['listbox']]
]]
}
});
});
});
}(window, jIO, rJS, RSVP, URL));
\ No newline at end of file
}(window, jIO, rJS, RSVP, URL, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file
......@@ -245,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.18863.15987.54067</string> </value>
<value> <string>980.55724.18905.19933</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -263,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1525355118.62</float>
<float>1577801156.98</float>
<string>UTC</string>
</tuple>
</state>
......
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Jio Query View</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_officejs_jio_smart_assistant_query_view.js"></script>
</head>
<body>
<form class="save_form ui-body-c" novalidate>
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="form_view"
data-gadget-sandbox="public">
</div>
</form>
</body>
</html>
/*global window, rJS, RSVP, jIO, Blob*/
/*jslint indent:2, maxlen: 80, nomen: true */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateDocument", "updateDocument")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("jio_get", "jio_get")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this,
state = {
title: options.doc.title,
text_content: options.doc.text_content,
owner: options.doc.owner,
agent_title: options.doc.agent_title,
validation_state: options.doc.validation_state,
description: options.doc.description,
modification_date: options.doc.modification_date,
relative_url: options.doc.agent_relative_url,
link: options.doc.link,
jio_key: options.jio_key
};
gadget.type = options.doc.type;
return gadget.jio_get(options.jio_key)
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}),
gadget.changeState(state)
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: "Smart Assistant",
save_action: true,
selection_url: url_list[0],
previous_url: url_list[1],
next_url: url_list[2]
});
});
})
.onEvent('submit', function () {
var gadget = this;
return gadget.notifySubmitting()
.push(function () {
return gadget.getDeclaredGadget('form_view');
})
.push(function (form_gadget) {
return form_gadget.getContent();
})
.push(function (result) {
return gadget.updateDocument({text_content: result.text_content});
})
.push(function () {
return gadget.notifySubmitted({
"message": "Data updated",
"status": "success"
});
})
.push(function () {
return gadget.redirect({command: 'reload'});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.onStateChange(function () {
var gadget = this;
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
return form_gadget.render({
erp5_document: {
"_embedded": {
"_view": {
"my_title": {
"description": "",
"title": "Smart Asisstant Type",
"default": gadget.state.title,
"css_class": "",
"required": 1,
"editable": 0,
"key": "title",
"hidden": 0,
"type": "StringField"
},
"my_owner": {
"description": "",
"title": "From: ",
"default": gadget.state.owner,
"css_class": "",
"required": 1,
"editable": 0,
"key": "owner",
"hidden": 0,
"type": "StringField"
},
"my_agent_title": {
"relation_item_relative_url":
[gadget.state.relative_url],
"type": "RelationStringField",
"label": true,
"sort": [],
"relation_item_key":
"subfield_field_my_agent_title_item",
"description": "",
"catalog_index": "title",
"editable": 0,
"allow_creation": 0,
"allow_jump": 1,
"key": "agent_title",
"translated_portal_types": ["Category"],
"title": "Context",
"default": [gadget.state.agent_title],
"css_class": "",
"relation_field_id":
"subfield_field_my_agent_title_relation",
"required": 1,
"url": "agent_title",
"hidden": 0,
"portal_types": ["Category"],
"view": "view"
},
"your_modification_date": {
"description": "",
"title": "Modification Date",
"default": gadget.state.modification_date,
"css_class": "",
"required": 1,
"editable": 0,
"key": "modification_date",
"hidden": 0,
"timezone_style": 1,
"date_only": 0,
"type": "DateTimeField"
},
"your_validation_state": {
"description": "",
"title": "Validation State",
"default": gadget.state.validation_state,
"css_class": "",
"required": 1,
"editable": 0,
"key": "validation_state",
"hidden": 0,
"type": "StringField"
},
"my_description": {
"description": "",
"title": "Reply",
"default": gadget.state.description,
"css_class": "",
"required": 1,
"editable": 0,
"key": "description",
"hidden": 0,
"type": "TextAreaField"
},
"my_link": {
"editable": 1,
"required": 0,
"default": {"direct_url": gadget.state.link,
"target_type": "display",
"textContent": gadget.state.link},
"url": "gadget_erp5_page_ojs_link_field.html",
"type": "GadgetField",
"description": "",
"title": "Url",
"css_class": "",
"key": "link",
"hidden": 0,
"allow_jump": 1
},
"my_text_content": {
"description": "",
"title": "Answer",
"default": gadget.state.text_content,
"css_class": "",
"required": 1,
"editable": 1,
"key": "text_content",
"hidden": 0,
"type": "TextAreaField"
}
}
},
"_links": {
"type": {
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["my_agent_title"], ["my_title"]]
], [
"right",
[
["your_validation_state"],
["your_modification_date"],
["my_owner"]
]], [
"center",
[["my_description"], ["my_link"],
["my_text_content"]]
]]
}
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
/*global window, rJS, RSVP, jIO, URL, Blob*/
/*jslint indent:2, maxlen: 80, nomen: true */
(function (window, jIO, rJS, RSVP) {
(function (window, jIO, rJS, RSVP, SimpleQuery, ComplexQuery, Query) {
"use strict";
rJS(window)
......@@ -23,6 +23,7 @@
var gadget = this,
state = {
title: options.doc.title,
validation_state: options.doc.validation_state,
jio_key: options.jio_key
};
......@@ -92,7 +93,35 @@
})
.onStateChange(function () {
var gadget = this;
var gadget = this,
column_list = [
['agent_title', 'Title'],
['description', 'Reply'],
['modification_date', 'Modification Date'],
['validation_state', 'Validation State']
],
jio_key = gadget.state.jio_key,
portal_type = ["Query"],
agent_relative_url = jio_key,
query = "urn:jio:allDocs?query=",
jio_query_list = [];
jio_query_list.push(new SimpleQuery({
key: "portal_type",
operator: "",
type: "simple",
value: portal_type
}));
jio_query_list.push(new SimpleQuery({
key: "agent_relative_url",
operater: "",
type: "simple",
value: agent_relative_url
}));
query += Query.objectToSearchText(new ComplexQuery({
operator: "AND",
query_list: jio_query_list,
type: "complex"
}));
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
......@@ -118,7 +147,7 @@
"editable": 0,
"key": "player_content",
"hidden": 0,
"title": "Listen actual content",
"title": "Play",
"type": "GadgetField",
"renderjs_extra": '{"name": "data"}',
"url": "gadget_custom_player.html",
......@@ -136,6 +165,34 @@
"accept": "audio/*",
"capture": "microphone",
"type": "FileField"
},
"my_validation_state": {
"description": "",
"title": "State",
"default": gadget.state.validation_state,
"css_class": "",
"required": 1,
"editable": 0,
"key": "validation_state",
"hidden": 0,
"type": "StringField"
},
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"editable_column_list": [],
"key": "field_listbox",
"lines": 5,
"list_method": "portal_catalog",
"query": query,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['modification_date', 'descending']],
"title": "Related Queries",
"type": "ListBox"
}
}
},
......@@ -149,10 +206,14 @@
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_actual_audio"], ["my_audio"]]
[["my_title"], ["my_actual_audio"],
["my_audio"], ["my_validation_state"]]
], [
"bottom",
[['listbox']]
]]
}
});
});
});
}(window, jIO, rJS, RSVP));
\ No newline at end of file
}(window, jIO, rJS, RSVP, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file
......@@ -245,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.51362.22678.44731</string> </value>
<value> <string>980.54461.59381.50158</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -263,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1523439507.26</float>
<float>1577801044.1</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, URL,
promiseEventListener, document*/
/*jslint indent:2, maxlen: 80, nomen: true */
(function (window, rJS, RSVP) {
(function (window, rJS, RSVP, SimpleQuery, ComplexQuery, Query) {
"use strict";
rJS(window)
......@@ -23,6 +23,9 @@
var gadget = this,
state = {
title: options.doc.title,
agent_title: options.doc.agent_title,
description: options.doc.description,
validation_state: options.doc.validation_state,
jio_key: options.jio_key
};
......@@ -85,7 +88,35 @@
})
.onStateChange(function () {
var gadget = this;
var gadget = this,
column_list = [
['agent_title', 'Title'],
['description', 'Reply'],
['modification_date', 'Modification Date'],
['validation_state', 'Validation State']
],
jio_key = gadget.state.jio_key,
portal_type = ["Query"],
agent_relative_url = jio_key,
query = "urn:jio:allDocs?query=",
jio_query_list = [];
jio_query_list.push(new SimpleQuery({
key: "portal_type",
operator: "",
type: "simple",
value: portal_type
}));
jio_query_list.push(new SimpleQuery({
key: "agent_relative_url",
operater: "",
type: "simple",
value: agent_relative_url
}));
query += Query.objectToSearchText(new ComplexQuery({
operator: "AND",
query_list: jio_query_list,
type: "complex"
}));
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
......@@ -111,11 +142,38 @@
"editable": 1,
"key": "text_",
"hidden": 0,
"renderjs_extra": '{"editor": "fck_editor",' +
'"maximize": "auto"}',
"renderjs_extra": '{"editor": "fck_editor"}',
"type": "GadgetField",
"url": "gadget_editor.html",
"sandbox": "public"
},
"my_validation_state": {
"description": "",
"title": "State",
"default": gadget.state.validation_state,
"css_class": "",
"required": 1,
"editable": 0,
"key": "validation_state",
"hidden": 0,
"type": "StringField"
},
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"editable_column_list": [],
"key": "field_listbox",
"lines": 5,
"list_method": "portal_catalog",
"query": query,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['modification_date', 'descending']],
"title": "Related Queries",
"type": "ListBox"
}
}
},
......@@ -129,13 +187,14 @@
form_definition: {
group_list: [[
"left",
[["my_title"]]
[["my_title"],
["my_validation_state"]]
], [
"bottom",
[["my_text"]]
[["listbox"], ["my_text"]]
]]
}
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file
......@@ -245,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.50123.54319.23415</string> </value>
<value> <string>980.55722.32852.65126</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -263,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1523439452.07</float>
<float>1577801407.55</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -96,7 +96,8 @@
return gadget.jio_post({
"title": "record_" + title,
portal_type: portal_type,
parent_relative_url: parent_relative_url
parent_relative_url: parent_relative_url,
validation_state: 'draft'
});
}
})
......
......@@ -248,7 +248,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.53085.7592.1604</string> </value>
<value> <string>980.54461.59381.50158</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1523546633.96</float>
<float>1577787866.92</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -60,7 +60,8 @@
"title": title,
"text_content": content.text_content,
portal_type: portal_type,
parent_relative_url: parent_relative_url
parent_relative_url: parent_relative_url,
validation_state: 'draft'
})
.push(function () {
return gadget.notifySubmitted({"message": "Data created",
......@@ -85,7 +86,7 @@
return form_gadget.render({
erp5_document: {
"_embedded": {"_view": {
"my_content": {
"my_text_content": {
"default": "",
"css_class": "",
"required": 0,
......@@ -118,7 +119,7 @@
[["my_description"]]
], [
"bottom",
[["my_content"]]
[["my_text_content"]]
]]
}
});
......
......@@ -245,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.17930.59246.1075</string> </value>
<value> <string>980.54461.59381.50158</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -263,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1525279476.09</float>
<float>1577787578.24</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -78,10 +78,12 @@
.push(function (result) {
var column_list = [
['title', 'Title'],
['modification_date', 'Modification Date']
['modification_date', 'Modification Date'],
['validation_state', 'State'],
['portal_type', 'Smart Assistant Type']
],
portal_type = result[1].split(','),
portal_type = ["Smart Assistant Text", "Smart Assistant Sound", "Smart Assistant Image", "Smart Assistant File" ],
query = "urn:jio:allDocs?query=",
i,
jio_query_list = [];
......@@ -140,7 +142,9 @@
.push(function () {
return RSVP.all([
gadget.getSetting('document_title_plural'),
gadget.getUrlFor({command: "change", options: {"page": "ojs_smart_assistant_home"}})
gadget.getUrlFor({command: "change",
options: {"page": "ojs_smart_assistant_home",
"extended_search": undefined}})
]);
})
.push(function (result) {
......
......@@ -62,7 +62,6 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string>
</tuple>
</value>
......@@ -275,7 +274,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.17965.31026.10137</string> </value>
<value> <string>980.55539.61894.62822</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -293,7 +292,7 @@
</tuple>
<state>
<tuple>
<float>1525337356.71</float>
<float>1577790055.8</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -14,8 +14,8 @@
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Smart Assistant Text,Smart Assistant Image,Smart Assistant Sound,Smart Assistant File</script>
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">smart_assistant_text_module,smart_assistant_image_module,smart_assistant_sound_module,smart_assistant_file_module</script>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Smart Assistant Text,Smart Assistant Image,Smart Assistant Sound,Smart Assistant File,Query</script>
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">smart_assistant_text_module,smart_assistant_image_module,smart_assistant_sound_module,smart_assistant_file_module,query_module</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Smart Assistant</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Smart Assistant</script>
<script data-renderjs-configuration="erp5_attachment_synchro" type="text/x-renderjs-configuration">/{+id}/Base_downloadWithCors</script>
......
......@@ -223,62 +223,58 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<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>966.33997.15609.22101</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>1522420879.36</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
<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>977.57825.44431.51217</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>1566303568.38</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_exchange</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_exchange</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>download</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>20.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Download Original File</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Document_viewDownloadDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:object.hasFile()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -61,7 +61,9 @@
<item>
<key> <string>center</string> </key>
<value>
<list/>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
......
Smart Assistant File Module | view
Smart Assistant File | download
Smart Assistant File | jio_view
Smart Assistant File | view
Smart Assistant Image Module | view
......
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