Commit b2181b84 authored by Xiaowu Zhang's avatar Xiaowu Zhang

Improve Smart Assistant

See merge request nexedi/erp5!1262
parents f07ebe82 be47defa
Pipeline #11702 failed with stage
in 0 seconds
/*jslint indent: 2*/ /*jslint indent: 2*/
/*global self, fetch, Request, Response */ /*global self, fetch, Request, Response, URL, Blob */
var global = self, window = self; var global = self, window = self;
(function (self, fetch, Request, Response) { (function (self, fetch, Response, Blob) {
"use strict"; "use strict";
self.DOMParser = {}; self.DOMParser = {};
...@@ -52,7 +52,8 @@ var global = self, window = self; ...@@ -52,7 +52,8 @@ var global = self, window = self;
self.addEventListener("fetch", function (event) { self.addEventListener("fetch", function (event) {
var relative_url = './' + event.request.url.split("#")[0] var relative_url = './' + event.request.url.split("#")[0]
.replace(self.registration.scope, "") .replace(self.registration.scope, "")
.replace(self.version_url, ""); .replace(self.version_url, ""),
tmp;
if (relative_url === './no-cache') { if (relative_url === './no-cache') {
event.respondWith(new Response(self.cache_list)); event.respondWith(new Response(self.cache_list));
return; return;
...@@ -80,6 +81,42 @@ var global = self, window = self; ...@@ -80,6 +81,42 @@ var global = self, window = self;
return new Response(error, {"statusText": error.message, "status": 500}); return new Response(error, {"statusText": error.message, "status": 500});
}) })
); );
} else if (
// postData from manifest.json
event.request.method === 'POST' &&
relative_url.split('?')[0].endsWith('postData')
) {
self.request = event.request;
event.respondWith(Response.redirect('.'));
} else if (
// Determine if it hasSharedData
event.request.url.endsWith('hasSharedData')
) {
event.respondWith(new Response(self.request ? "true" : "false"));
} else if (
// getSharedData from upload_shared_file page
// upload_shared_file page processes the data
event.request.url.endsWith('getSharedData') &&
event.request.method === 'GET'
) {
if (!self.request) {
event.respondWith(new Response(''));
} else {
tmp = self.request;
delete self.request;
event.respondWith(
new self.RSVP.Queue()
.push(function () {
return tmp.formData();
})
.push(function (data) {
return data.get('file');
})
.push(function (file) {
return new Response(new Blob([file], {type: file.type}));
})
);
}
} else { } else {
event.respondWith( event.respondWith(
new self.RSVP.Queue() new self.RSVP.Queue()
...@@ -101,4 +138,4 @@ var global = self, window = self; ...@@ -101,4 +138,4 @@ var global = self, window = self;
} }
}); });
}(self, fetch, Request, Response)); }(self, fetch, Response, Blob));
\ No newline at end of file \ No newline at end of file
...@@ -223,7 +223,7 @@ ...@@ -223,7 +223,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>P0</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>969.27647.29835.22169</string> </value> <value> <string>986.49641.0.58982</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1533640296.2</float> <float>1600683471.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="gadget_officejs_smart_assistant.css"> <link rel="stylesheet" type="text/css" href="gadget_officejs_smart_assistant.css">
<link rel="manifest" href="gadget_officejs_json_manifest_smart_assistant.json">
<title>OfficeJS Smart Assistant Home</title> <title>OfficeJS Smart Assistant Home</title>
...@@ -31,6 +32,17 @@ ...@@ -31,6 +32,17 @@
class='ui-flex-center'> class='ui-flex-center'>
</div> </div>
</form> </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> </body>
</html> </html>
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string> <string>classification/collaborative/team</string>
</tuple> </tuple>
</value> </value>
...@@ -279,7 +278,7 @@ ...@@ -279,7 +278,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.17859.46531.61866</string> </value> <value> <string>981.3464.44902.45755</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -297,7 +296,7 @@ ...@@ -297,7 +296,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1525278837.04</float> <float>1578607727.59</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, jIO, Handlebars, RSVP, Blob*/ /*global window, rJS, jIO, navigator, Handlebars, RSVP, Blob, SimpleQuery, ComplexQuery, Query*/
/*jslint indent:2, maxlen: 80, nomen: true */ /*jslint indent:2, maxlen: 80, nomen: true */
(function (window, rJS, jIO, RSVP) { (function (window, rJS, jIO, navigator,
RSVP, SimpleQuery, ComplexQuery, Query) {
"use strict"; "use strict";
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -18,8 +18,40 @@ ...@@ -18,8 +18,40 @@
.declareAcquiredMethod("notifyChange", "notifyChange") .declareAcquiredMethod("notifyChange", "notifyChange")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted") .declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .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"
}
};
}
}
return result;
});
})
.allowPublicAcquisition('updateHeader', function () { .allowPublicAcquisition('updateHeader', function () {
return; return;
...@@ -32,7 +64,7 @@ ...@@ -32,7 +64,7 @@
portal_type = gadget.props.portal_type, portal_type = gadget.props.portal_type,
parent_relative_url = gadget.props.parent_relative_url; parent_relative_url = gadget.props.parent_relative_url;
return RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.getDeclaredGadget(scope); return gadget.getDeclaredGadget(scope);
}) })
...@@ -57,7 +89,8 @@ ...@@ -57,7 +89,8 @@
return gadget.jio_post({ return gadget.jio_post({
"title": name, "title": name,
portal_type: portal_type, portal_type: portal_type,
parent_relative_url: parent_relative_url parent_relative_url: parent_relative_url,
validation_state: 'draft'
}); });
}) })
.push(function (id) { .push(function (id) {
...@@ -68,6 +101,12 @@ ...@@ -68,6 +101,12 @@
"message": "Data created", "message": "Data created",
"status": "success" "status": "success"
}); });
})
.push(function () {
return gadget.redirect({
command: 'display',
options: {page: "ojs_smart_assistant_document_list"}
});
}); });
} }
}); });
...@@ -84,7 +123,7 @@ ...@@ -84,7 +123,7 @@
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.ready(function (g) { .ready(function (g) {
return RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
g.getSetting('portal_type'), g.getSetting('portal_type'),
...@@ -100,21 +139,69 @@ ...@@ -100,21 +139,69 @@
}) })
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this; var gadget = this;
return gadget.getSetting('jio_storage_name') return gadget.getSetting('jio_storage_name')
.push(function (result) { .push(function (result) {
if (!result) { if (!result) {
return gadget.redirect({command: 'display', return gadget.redirect({command: 'display',
options: {page: 'ojs_configurator'}}); options: {page: 'ojs_configurator'}});
} }
if ('serviceWorker' in navigator) {
if (navigator.serviceWorker.controller) {
return jIO.util.ajax({
url: 'hasSharedData'
});
}
}
}) })
.push(function () { .push(function (result) {
if (result) {
if (result.target.response === 'true') {
return gadget.redirect({command: 'display', options: {
page: 'ojs_smart_assistant_upload_shared_file'
}});
}
}
return RSVP.all([ return RSVP.all([
gadget.getDeclaredGadget('form_view_upload_audio'), 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) { .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([ return RSVP.all([
worklist_gadget.render(),
result[0].render({ result[0].render({
erp5_document: {"_embedded": {"_view": { erp5_document: {"_embedded": {"_view": {
"upload": { "upload": {
...@@ -194,6 +281,43 @@ ...@@ -194,6 +281,43 @@
[["text"]] [["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"]]
]]
}
}) })
]); ]);
}) })
...@@ -213,7 +337,6 @@ ...@@ -213,7 +337,6 @@
page_icon: "exchange" page_icon: "exchange"
}); });
}); });
}); });
}(window, rJS, jIO, RSVP)); }(window, rJS, jIO, navigator, RSVP, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file \ No newline at end of file
...@@ -58,29 +58,12 @@ ...@@ -58,29 +58,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_ojs_smart_assistant_home.js</string> </value> <value> <string>gadget_erp5_page_ojs_smart_assistant_home.js</string> </value>
...@@ -101,25 +84,6 @@ ...@@ -101,25 +84,6 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Web Script</string> </value>
...@@ -134,12 +98,6 @@ ...@@ -134,12 +98,6 @@
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Gadget Smart Assistant JS</string> </value> <value> <string>Gadget Smart Assistant JS</string> </value>
</item> </item>
<item>
<key> <string>url_string</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>001</string> </value> <value> <string>001</string> </value>
...@@ -226,7 +184,7 @@ ...@@ -226,7 +184,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519634719.01</float> <float>1597277315.11</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -275,7 +233,7 @@ ...@@ -275,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.20676.40581.32768</string> </value> <value> <string>986.52650.40049.32887</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -293,7 +251,7 @@ ...@@ -293,7 +251,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1525444169.16</float> <float>1600864455.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -354,7 +312,7 @@ ...@@ -354,7 +312,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519633924.76</float> <float>1562158825.48</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="gadget_officejs_smart_assistant.css">
<link rel="manifest" href="gadget_officejs_json_manifest_smart_assistant.json">
<title>OfficeJS Smart Assistant Upload Shared File</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jiodev.js"></script>
<script src="gadget_erp5_page_ojs_smart_assistant_upload_shared_file.js"></script>
</head>
<body>
<h1>Your file is uploading to Smart Assistant...</h1>
</body>
</html>
/*global window, rJS, jIO, Handlebars, RSVP, Blob*/
/*jslint indent:2, maxlen: 80, nomen: true */
(function (window, rJS, jIO, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareService(function handleWebShareFile() {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: 'GET',
url: 'getSharedData',
dataType: "blob"
});
})
.push(function (resx) {
// Condition: when there's uploaded data
if (resx.target.response.size) {
return gadget.notifySubmitting()
.push(function () {
return gadget.jio_post({
"title": Date(), //get date as title
portal_type: "Smart Assistant File",
parent_relative_url: "smart_assistant_file_module",
validation_state: 'draft'
});
})
.push(function (id) {
return gadget.jio_putAttachment(
id,
'data',
resx.target.response
);
})
.push(function () {
return gadget.notifySubmitted({
"message": "Data created",
"status": "success"
});
})
.push(function () {
return gadget.redirect({
command: 'display',
options: {page: "ojs_smart_assistant_document_list"}
});
});
}
// Condition: if there's no data
return gadget.notifySubmitted({
"message": "No data found",
"status": "failed"
})
.push(function () {
return gadget.redirect({
command: 'display',
options: {page: "ojs_smart_assistant_home"}
});
});
});
});
}(window, rJS, jIO, RSVP));
\ No newline at end of file
<!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*/ /*global window, rJS, RSVP, jIO, Blob*/
/*jslint indent:2, maxlen: 80, nomen: true */ /*jslint indent:2, maxlen: 80, nomen: true */
(function (window, jIO, rJS, RSVP, URL) { (function (window, jIO, rJS, RSVP, URL, SimpleQuery, ComplexQuery, Query) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
var gadget = this, var gadget = this,
state = { state = {
title: options.doc.title, title: options.doc.title,
validation_state: options.doc.validation_state,
jio_key: options.jio_key jio_key: options.jio_key
}; };
...@@ -96,6 +97,35 @@ ...@@ -96,6 +97,35 @@
return gadget.getDeclaredGadget('form_view') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .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({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": { "_embedded": {
...@@ -115,7 +145,7 @@ ...@@ -115,7 +145,7 @@
"editable": 1, "editable": 1,
"required": 1, "required": 1,
"key": "", "key": "",
"title": "Download actual content", "title": "Download",
"default": {"direct_url": gadget.state.upload, "default": {"direct_url": gadget.state.upload,
"target_type": "download", "target_type": "download",
"textContent": gadget.state.title}, "textContent": gadget.state.title},
...@@ -124,7 +154,7 @@ ...@@ -124,7 +154,7 @@
}, },
"my_upload": { "my_upload": {
"description": "", "description": "",
"title": "Change it", "title": "Re-upload",
"default": "", "default": "",
"css_class": "", "css_class": "",
"required": 1, "required": 1,
...@@ -132,6 +162,34 @@ ...@@ -132,6 +162,34 @@
"key": "upload_", "key": "upload_",
"hidden": 0, "hidden": 0,
"type": "FileField" "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 @@ ...@@ -144,10 +202,15 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "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 @@ ...@@ -245,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.18881.16014.512</string> </value> <value> <string>980.55724.32706.34986</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1525355150.41</float> <float>1577801225.85</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, jIO, URL, Blob, promiseEventListener, document*/ /*global window, rJS, RSVP, jIO, URL, Blob, promiseEventListener, document*/
/*jslint indent:2, maxlen: 80, nomen: true */ /*jslint indent:2, maxlen: 80, nomen: true */
(function (window, jIO, rJS, RSVP, URL) { (function (window, jIO, rJS, RSVP, URL, SimpleQuery, ComplexQuery, Query) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
var gadget = this, var gadget = this,
state = { state = {
title: options.doc.title, title: options.doc.title,
validation_state: options.doc.validation_state,
jio_key: options.jio_key jio_key: options.jio_key
}; };
gadget.type = options.doc.type; gadget.type = options.doc.type;
...@@ -94,7 +95,35 @@ ...@@ -94,7 +95,35 @@
}) })
.onStateChange(function () { .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') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .push(function (form_gadget) {
...@@ -115,7 +144,7 @@ ...@@ -115,7 +144,7 @@
}, },
"my_image": { "my_image": {
"description": "", "description": "",
"title": "Change it", "title": "Re-upload",
"default": "", "default": "",
"css_class": "", "css_class": "",
"required": 1, "required": 1,
...@@ -126,9 +155,20 @@ ...@@ -126,9 +155,20 @@
"capture": "camera", "capture": "camera",
"type": "FileField" "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": { "my_image_preview": {
"description": "", "description": "",
"title": "Actually", "title": "Preview",
"default": gadget.state.image, "default": gadget.state.image,
"css_class": "", "css_class": "",
"height" : "10", "height" : "10",
...@@ -137,6 +177,23 @@ ...@@ -137,6 +177,23 @@
"key": "image_preview", "key": "image_preview",
"hidden": 0, "hidden": 0,
"type": "ImageField" "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 @@ ...@@ -150,10 +207,14 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "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)); }(window, jIO, rJS, RSVP, URL, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file \ No newline at end of file
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.18863.15987.54067</string> </value> <value> <string>980.55724.18905.19933</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1525355118.62</float> <float>1577801156.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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*/ /*global window, rJS, RSVP, jIO, URL, Blob*/
/*jslint indent:2, maxlen: 80, nomen: true */ /*jslint indent:2, maxlen: 80, nomen: true */
(function (window, jIO, rJS, RSVP) { (function (window, jIO, rJS, RSVP, SimpleQuery, ComplexQuery, Query) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
var gadget = this, var gadget = this,
state = { state = {
title: options.doc.title, title: options.doc.title,
validation_state: options.doc.validation_state,
jio_key: options.jio_key jio_key: options.jio_key
}; };
...@@ -92,7 +93,35 @@ ...@@ -92,7 +93,35 @@
}) })
.onStateChange(function () { .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') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .push(function (form_gadget) {
...@@ -118,7 +147,7 @@ ...@@ -118,7 +147,7 @@
"editable": 0, "editable": 0,
"key": "player_content", "key": "player_content",
"hidden": 0, "hidden": 0,
"title": "Listen actual content", "title": "Play",
"type": "GadgetField", "type": "GadgetField",
"renderjs_extra": '{"name": "data"}', "renderjs_extra": '{"name": "data"}',
"url": "gadget_custom_player.html", "url": "gadget_custom_player.html",
...@@ -136,6 +165,34 @@ ...@@ -136,6 +165,34 @@
"accept": "audio/*", "accept": "audio/*",
"capture": "microphone", "capture": "microphone",
"type": "FileField" "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 @@ ...@@ -149,10 +206,14 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_actual_audio"], ["my_audio"]] [["my_title"], ["my_actual_audio"],
["my_audio"], ["my_validation_state"]]
], [
"bottom",
[['listbox']]
]] ]]
} }
}); });
}); });
}); });
}(window, jIO, rJS, RSVP)); }(window, jIO, rJS, RSVP, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file \ No newline at end of file
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.51362.22678.44731</string> </value> <value> <string>980.54461.59381.50158</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523439507.26</float> <float>1577801044.1</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, URL, /*global window, rJS, RSVP, URL,
promiseEventListener, document*/ promiseEventListener, document*/
/*jslint indent:2, maxlen: 80, nomen: true */ /*jslint indent:2, maxlen: 80, nomen: true */
(function (window, rJS, RSVP) { (function (window, rJS, RSVP, SimpleQuery, ComplexQuery, Query) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
var gadget = this, var gadget = this,
state = { state = {
title: options.doc.title, 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 jio_key: options.jio_key
}; };
...@@ -85,7 +88,35 @@ ...@@ -85,7 +88,35 @@
}) })
.onStateChange(function () { .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') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .push(function (form_gadget) {
...@@ -111,11 +142,38 @@ ...@@ -111,11 +142,38 @@
"editable": 1, "editable": 1,
"key": "text_", "key": "text_",
"hidden": 0, "hidden": 0,
"renderjs_extra": '{"editor": "fck_editor",' + "renderjs_extra": '{"editor": "fck_editor"}',
'"maximize": "auto"}',
"type": "GadgetField", "type": "GadgetField",
"url": "gadget_editor.html", "url": "gadget_editor.html",
"sandbox": "public" "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 @@ ...@@ -129,13 +187,14 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"]] [["my_title"],
["my_validation_state"]]
], [ ], [
"bottom", "bottom",
[["my_text"]] [["listbox"], ["my_text"]]
]] ]]
} }
}); });
}); });
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file \ No newline at end of file
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.50123.54319.23415</string> </value> <value> <string>980.55722.32852.65126</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523439452.07</float> <float>1577801407.55</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
// Update web app manifest so that it can be installable
{ {
"short_name": "Smart Assistant", "short_name": "Smart Assistant",
"name": "OfficeJS Smart Assistant", "name": "OfficeJS Smart Assistant",
"description": "Assist you with using an ERP", "description": "Assist you with using an ERP",
"icons": [{ "icons": [{
"src": "officejs_smart_assistant_icon.png", "src": "officejs_smart_assistant_icon.png",
"sizes": "any", "sizes": "any",
"type": "image/png" "type": "image/png"
}], }],
"start_url": "../../", "start_url": "../",
"display": "standalone" "theme_color": "#333",
"background_color": "#333",
"display": "standalone",
"scope": "../",
// web share target API
"share_target": {
"action": "./postData",
"method": "POST",
"enctype": "multipart/form-data",
"params": {
"files": [{
"name": "file",
"accept": ["*/*"]
}]
}
}
} }
\ No newline at end of file
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>970.32880.35131.14592</string> </value> <value> <string>986.3906.17858.11212</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1537948707.94</float> <float>1598012587.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -96,7 +96,8 @@ ...@@ -96,7 +96,8 @@
return gadget.jio_post({ return gadget.jio_post({
"title": "record_" + title, "title": "record_" + title,
portal_type: portal_type, portal_type: portal_type,
parent_relative_url: parent_relative_url parent_relative_url: parent_relative_url,
validation_state: 'draft'
}); });
} }
}) })
......
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.53085.7592.1604</string> </value> <value> <string>980.54461.59381.50158</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523546633.96</float> <float>1577787866.92</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -60,7 +60,8 @@ ...@@ -60,7 +60,8 @@
"title": title, "title": title,
"text_content": content.text_content, "text_content": content.text_content,
portal_type: portal_type, portal_type: portal_type,
parent_relative_url: parent_relative_url parent_relative_url: parent_relative_url,
validation_state: 'draft'
}) })
.push(function () { .push(function () {
return gadget.notifySubmitted({"message": "Data created", return gadget.notifySubmitted({"message": "Data created",
...@@ -85,7 +86,7 @@ ...@@ -85,7 +86,7 @@
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
"my_content": { "my_text_content": {
"default": "", "default": "",
"css_class": "", "css_class": "",
"required": 0, "required": 0,
...@@ -118,7 +119,7 @@ ...@@ -118,7 +119,7 @@
[["my_description"]] [["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_text_content"]]
]] ]]
} }
}); });
......
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.17930.59246.1075</string> </value> <value> <string>980.54461.59381.50158</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1525279476.09</float> <float>1577787578.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -78,10 +78,12 @@ ...@@ -78,10 +78,12 @@
.push(function (result) { .push(function (result) {
var column_list = [ var column_list = [
['title', 'Title'], ['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=", query = "urn:jio:allDocs?query=",
i, i,
jio_query_list = []; jio_query_list = [];
...@@ -140,7 +142,9 @@ ...@@ -140,7 +142,9 @@
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getSetting('document_title_plural'), 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) { .push(function (result) {
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string> <string>classification/collaborative/team</string>
</tuple> </tuple>
</value> </value>
...@@ -275,7 +274,7 @@ ...@@ -275,7 +274,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.17965.31026.10137</string> </value> <value> <string>980.55539.61894.62822</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -293,7 +292,7 @@ ...@@ -293,7 +292,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1525337356.71</float> <float>1577790055.8</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
</head> </head>
<body> <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="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</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" 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="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> <script data-renderjs-configuration="erp5_attachment_synchro" type="text/x-renderjs-configuration">/{+id}/Base_downloadWithCors</script>
......
...@@ -223,62 +223,58 @@ ...@@ -223,62 +223,58 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <tuple>
<item> <none/>
<key> <string>_log</string> </key> <list>
<value> <dictionary>
<list> <item>
<dictionary> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>action</string> </key> </item>
<value> <string>edit</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>comment</string> </key>
<item> <value>
<key> <string>comment</string> </key> <none/>
<value> </value>
<none/> </item>
</value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>977.57825.44431.51217</string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>966.33997.15609.22101</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>time</string> </key>
<item> <value>
<key> <string>time</string> </key> <object>
<value> <klass>
<object> <global name="DateTime" module="DateTime.DateTime"/>
<klass> </klass>
<global name="DateTime" module="DateTime.DateTime"/> <tuple>
</klass> <none/>
<tuple> </tuple>
<none/> <state>
</tuple> <tuple>
<state> <float>1566303568.38</float>
<tuple> <string>UTC</string>
<float>1522420879.36</float> </tuple>
<string>UTC</string> </state>
</tuple> </object>
</state> </value>
</object> </item>
</value> </dictionary>
</item> </list>
</dictionary> </tuple>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
......
...@@ -128,7 +128,13 @@ url_list = [ ...@@ -128,7 +128,13 @@ url_list = [
"gadget_officejs_jio_smart_assistant_text_view.js", "gadget_officejs_jio_smart_assistant_text_view.js",
"gadget_officejs_jio_smart_assistant_text_view.html", "gadget_officejs_jio_smart_assistant_text_view.html",
"gadget_erp5_page_ojs_smart_assistant_home.html", "gadget_erp5_page_ojs_smart_assistant_home.html",
"gadget_erp5_page_ojs_smart_assistant_home.js" "gadget_erp5_page_ojs_smart_assistant_home.js",
"gadget_erp5_page_ojs_smart_assistant_upload_shared_file.html",
"gadget_erp5_page_ojs_smart_assistant_upload_shared_file.js",
"gadget_erp5_page_ojs_smart_assistant_worklist.html",
"gadget_erp5_page_ojs_smart_assistant_worklist.js",
"gadget_officejs_jio_query_view.html",
"gadget_officejs_jio_smart_assistant_query_view.js"
] ]
return url_list return url_list
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>1.0</float> </value> <value> <float>30.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/File_viewAsJIO</string> </value> <value> <string>string:${object_url}/Query_viewAsJIO</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>1.0</float> </value> <value> <float>2.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/File_viewAsJIO</string> </value> <value> <string>string:${object_url}/SmartAssistant_viewAsJIO</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>1.0</float> </value> <value> <float>2.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/File_viewAsJIO</string> </value> <value> <string>string:${object_url}/SmartAssistant_viewAsJIO</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>1.0</float> </value> <value> <float>30.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/SmartAssistantText_viewAsJIO</string> </value> <value> <string>string:${object_url}/SmartAssistant_viewAsJIO</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </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>jio_view</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>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</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}/SmartAssistant_viewAsJIO</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>my_description</string>
<string>my_text_content</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>your_modification_date</string>
<string>your_validation_state</string>
<string>my_title</string>
<string>my_agent_title</string>
<string>my_agent_relative_url</string>
<string>my_link</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>my_owner</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Query_viewAsJIO</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Query</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,4 +2,5 @@ erp5_hal_json_style ...@@ -2,4 +2,5 @@ erp5_hal_json_style
erp5_web_renderjs_ui erp5_web_renderjs_ui
erp5_notebook erp5_notebook
erp5_multimedia erp5_multimedia
erp5_run_my_doc erp5_run_my_doc
\ No newline at end of file erp5_smart_assistant
\ No newline at end of file
...@@ -6,6 +6,11 @@ PDF | jio_view ...@@ -6,6 +6,11 @@ PDF | jio_view
Presentation | jio_data Presentation | jio_data
Presentation | jio_view Presentation | jio_view
Presentation | jio_view_attachment Presentation | jio_view_attachment
Query | jio_view
Smart Assistant File | jio_view
Smart Assistant Image | jio_view
Smart Assistant Sound | jio_view
Smart Assistant Text | jio_view
Sound | jio_view Sound | jio_view
Spreadsheet | jio_data Spreadsheet | jio_data
Spreadsheet | jio_view Spreadsheet | jio_view
......
web_page_module/gadget_officejs_erp5_page_smart_assistant_test_upload_shared_file*
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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