Commit f31f08bd authored by Lu Xu's avatar Lu Xu 👀

erp5_officejs:implement App on officeJS

parent cfb9d0cc
......@@ -31,6 +31,12 @@
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>
</body>
</html>
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.17859.46531.61866</string> </value>
<value> <string>976.22725.48476.52138</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1525278837.04</float>
<float>1560351706.09</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 +18,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;
......@@ -98,8 +134,11 @@
};
});
})
.declareMethod("render", function () {
var gadget = this;
this.getDeclaredGadget('form_list');
return gadget.getSetting('jio_storage_name')
.push(function (result) {
if (!result) {
......@@ -110,10 +149,38 @@
.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'),//added
gadget.getSetting("portal_type")
]);
})
.push(function (result) {
var column_list = [
['title', 'Title'],
['modification_date', 'Modification Date'],
['validation_state', 'Validation State']
],
portal_type = result[3].split(','),
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([
result[0].render({
erp5_document: {"_embedded": {"_view": {
......@@ -194,6 +261,42 @@
[["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": 30,
"list_method": "portal_catalog",
"query": query,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['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 +319,4 @@
});
}(window, rJS, jIO, RSVP));
\ No newline at end of file
}(window, rJS, jIO, RSVP, SimpleQuery, ComplexQuery, Query));
......@@ -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>
......@@ -224,7 +182,7 @@
</tuple>
<state>
<tuple>
<float>1519634719.01</float>
<float>1562159205.06</float>
<string>UTC</string>
</tuple>
</state>
......@@ -269,7 +227,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.20676.40581.32768</string> </value>
<value> <string>976.54308.37653.52753</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +245,7 @@
</tuple>
<state>
<tuple>
<float>1525444169.16</float>
<float>1562162159.44</float>
<string>UTC</string>
</tuple>
</state>
......@@ -344,7 +302,7 @@
</tuple>
<state>
<tuple>
<float>1519633924.76</float>
<float>1562158825.48</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -12,7 +12,8 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateDocument", "updateDocument")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_get", "jio_get")
......@@ -52,8 +53,7 @@
})
.onEvent('submit', function () {
var gadget = this,
title;
var gadget = this;
return gadget.notifySubmitting()
.push(function () {
......@@ -63,14 +63,9 @@
return form_gadget.getContent();
})
.push(function (result) {
title = result.title;
if (result.text_ === "") {
result.text_ = " ";
}
var reply = result.reply;
return gadget.updateDocument({
'text_content': result.text_,
title: title
'text_content': gadget.state.content.text_content + "\n" + reply
});
})
.push(function () {
......@@ -78,6 +73,9 @@
"message": "Data Updated",
"status": "success"
});
})
.push(function () {
return gadget.redirect({command: 'reload'});
});
})
.declareMethod("triggerSubmit", function () {
......@@ -104,15 +102,25 @@
"hidden": 0,
"type": "StringField"
},
"my_text": {
"default": gadget.state.text,
"my_text_content": {
"default": gadget.state.content.text_content,
"css_class": "",
"required": 0,
"editable": 0,
"key": "text_content",
"hidden": 0,
"title": 'History',
"type": "TextAreaField"
},
"my_reply": {
"default": "",
"title": "Reply",
"css_class": "",
"required": 0,
"editable": 1,
"key": "text_",
"key": "reply",
"hidden": 0,
"renderjs_extra": '{"editor": "fck_editor",' +
'"maximize": "auto"}',
"renderjs_extra": '{"editor": "fck_editor"}',
"type": "GadgetField",
"url": "gadget_editor.html",
"sandbox": "public"
......@@ -130,9 +138,12 @@
group_list: [[
"left",
[["my_title"]]
], [
"center",
[["my_text_content"]]
], [
"bottom",
[["my_text"]]
[["my_reply"]]
]]
}
});
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.50123.54319.23415</string> </value>
<value> <string>976.31373.10382.14609</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1523439452.07</float>
<float>1560873588.93</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -85,7 +85,7 @@
return form_gadget.render({
erp5_document: {
"_embedded": {"_view": {
"my_content": {
"my_text_content": {
"default": "",
"css_class": "",
"required": 0,
......@@ -118,7 +118,7 @@
[["my_description"]]
], [
"bottom",
[["my_content"]]
[["my_text_content"]]
]]
}
});
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.17930.59246.1075</string> </value>
<value> <string>976.14145.4153.46813</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1525279476.09</float>
<float>1559836938.79</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -58,20 +58,16 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>classification/collaborative/team</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_ojs_panel_smart_assistant.js</string> </value>
......@@ -88,7 +84,9 @@
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -188,7 +186,7 @@
</tuple>
<state>
<tuple>
<float>1520002302.38</float>
<float>1562163551.28</float>
<string>UTC</string>
</tuple>
</state>
......@@ -233,7 +231,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.14275.9143.23296</string> </value>
<value> <string>976.54306.32835.10854</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -251,7 +249,7 @@
</tuple>
<state>
<tuple>
<float>1522761698.8</float>
<float>1562160158.27</float>
<string>UTC</string>
</tuple>
</state>
......@@ -274,7 +272,9 @@
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actor</string> </key>
......@@ -290,7 +290,7 @@
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
<value> <string>empty</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
......@@ -308,7 +308,7 @@
</tuple>
<state>
<tuple>
<float>1520001217.02</float>
<float>1562159899.76</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment