Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vincent Bechu
erp5
Commits
63e2db68
Commit
63e2db68
authored
Oct 20, 2016
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_office_js: add first version of contributor.
parent
50304da3
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1088 additions
and
0 deletions
+1088
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.html.html
...em/web_page_module/gadget_erp5_page_contributor.html.html
+23
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.html.xml
...tem/web_page_module/gadget_erp5_page_contributor.html.xml
+127
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.js.html
...Item/web_page_module/gadget_erp5_page_contributor.js.html
+286
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.js.xml
...eItem/web_page_module/gadget_erp5_page_contributor.js.xml
+127
-0
bt5/erp5_officejs/PathTemplateItem/web_site_module/renderjs_contributor.xml
...PathTemplateItem/web_site_module/renderjs_contributor.xml
+525
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.html.html
0 → 100644
View file @
63e2db68
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
OfficeJS Contributor
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_erp5_page_contributor.js"
></script>
</head>
<body>
<form>
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"form"
data-gadget-sandbox=
"public"
></div>
<button
type=
"submit"
data-i18n=
"Save"
style=
"display:none;"
>
Proceed
</button>
</form>
<div
class=
"result"
></div>
</body>
</html>
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.html.xml
0 → 100644
View file @
63e2db68
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Page"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
contributor/person_module/1
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_erp5_page_contributor.html
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
gadget_erp5_page_contributor.html
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Page
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
OfficeJS Contributor
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.js.html
0 → 100644
View file @
63e2db68
/*globals window, RSVP, rJS, RSVP, loopEventListener*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, RSVP, loopEventListener, jIO) {
"use strict";
function synchronisationErp5(gadget, submit_event) {
var query = "", url_list, i, param = {};
for (i = 0; i
<
submit
_event
.
target
.
length
;
i
+=
1
)
{
if
(
submit_event
.
target
[
i
].
name
)
{
param[submit_event.target[i].name] =
submit_event.target[i].value;
}
}
url_list =
param.url_list.split('\n');
for
(i =
0;
i
<
url_list
.
length
;
i
+=
1
)
{
if
(
i
>
0) {
query += " AND ";
}
query += 'id: "' + url_list[i] + '"';
}
return new RSVP.Queue()
.push(function () {
return gadget.notifySubmitting();
})
.push(function () {
return gadget.props.storage.createJio({
type: "replicate",
remote_sub_storage: {
type: "mapping",
mapping_dict: {
"id": {"equal": "reference"},
"text_content": {"equal": "text_content"},
"parent_relative_url": {"equal": "parent_relative_url"},
"portal_type": {"equal": "portal_type"},
"title": {"equal": "title"},
"description": {"equal": "description"}
},
sub_storage: {
type: "erp5",
url: param.url_a + "/erp5/web_site_module/hateoas",
default_view_reference: "jio_view"
}
},
local_sub_storage: {
type: "mapping",
query: {
"query": 'validation_state: "Draft" AND version:"'
+ param.version_b + '"'
},
mapping_dict: {
"id": {"equal": "reference"},
"parent_relative_url": {"equal": "parent_relative_url"},
"portal_type": {"equal": "portal_type"},
"text_content": {"equal": "text_content"},
"title": {"equal": "title"},
"description": {"equal": "description"},
"version": {"default_value": param.version_b}
},
sub_storage: {
type: "erp5",
url: param.url_b + "/erp5/web_site_module/hateoas",
default_view_reference: "jio_view"
}
},
conflict_handling: param.reverse ? 1 : 2,
query: {query: query},
signature_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "contributor-hash"
}
}
});
})
.push(function () {
return RSVP.all([
gadget.props.storage.repair(),
gadget.props.storage.allDocs()
]);
})
.push(function (result) {
gadget.props.element.querySelector(".result").innerHTML =
result[1].data.total_rows + " documents loaded";
return gadget.notifySubmitted();
});
}
function actualiseParam(gadget, event) {
var suffixe = "#/?page=contributor", key;
gadget.props.param[event.target.name] = event.target.value;
for (key in gadget.props.param) {
if (gadget.props.param.hasOwnProperty(key)) {
if (gadget.props.param[key] !== "") {
suffixe += "
&
" + key + "="
+ gadget.props.param[key];
}
}
}
window.history.replaceState(
window.history.state,
"parameters changement",
encodeURI(suffixe)
);
}
rJS(window)
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.param = {};
});
})
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("jio_repair", "jio_repair")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareMethod("triggerSubmit", function () {
this.props.element.querySelector("button").click();
})
.declareMethod("render", function (option) {
var g = this;
g.props.param.url_list = option.url_list || "";
g.props.param.url_a = option.url_a || "";
g.props.param.url_b = option.url_b || "";
g.props.param.version_b = option.version_b || "";
return g.declareGadget("gadget_jio.html", {scope: "storage_local"})
.push(function (storage_gadget) {
g.props.storage = storage_gadget;
})
.push(function () {
return g.updateHeader({
submit_action: true,
panel_action: false,
page_title: "Contributor"
});
})
.push(function () {
return g.getDeclaredGadget("form");
})
.push(function (form_gadget) {
g.props.form_gadget = form_gadget;
return form_gadget.render({
"erp5_document": {"_embedded": {"_view": {
"erp_a": {
"description": "",
"title": "",
"default": "Erp5 Source",
"css_class": "",
"required": 1,
"editable": 0,
"key": "erp_a",
"hidden": 0,
"type": "ReadOnlyField"
},
"url_a": {
"description": "",
"title": "Url source",
"default": g.props.param.url_a,
"css_class": "",
"required": 1,
"editable": 1,
"key": "url_a",
"hidden": 0,
"type": "StringField"
},
"url_list": {
"description": "",
"title": "References",
"default": g.props.param.url_list,
"css_class": "",
"required": 1,
"editable": 1,
"key": "url_list",
"hidden": 0,
"type": "TextAreaField"
},
"erp_b": {
"description": "",
"title": "",
"default": "Erp5 destination",
"css_class": "",
"required": 1,
"editable": 0,
"key": "erp_b",
"hidden": 0,
"type": "ReadOnlyField"
},
"url_b": {
"description": "",
"title": "Url destination",
"default": g.props.param.url_b,
"css_class": "",
"required": 1,
"editable": 1,
"key": "url_b",
"hidden": 0,
"type": "StringField"
},
"version_b": {
"description": "",
"title": "Version",
"default": g.props.param.version_b,
"css_class": "",
"required": 1,
"editable": 1,
"key": "version_b",
"hidden": 0,
"type": "StringField"
},
"reverse": {
"description": "",
"title": "Reverse",
"editable": 1,
"required": 1,
"key": "reverse",
"type": "CheckBoxField"
}
}}},
"form_definition": {
"group_list": [
[
"left",
[["erp_a"], ["url_a"]]
],
[
"right",
[["erp_b"], ["url_b"], ["version_b"]]
],
[
"center",
[["reverse"], ["url_list"]]
]
]
}
});
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.declareService(function () {
var gadget = this, key, promise_list = [];
promise_list.push(loopEventListener(
gadget.props.element.querySelector('form'),
'submit',
true,
function (event) {
return synchronisationErp5(gadget, event);
}
));
function linkActualiseParam(event) {
return actualiseParam(gadget, event);
}
function saveParameter(event) {
return gadget.setSetting("contributor_parameter", gadget.param);
}
for (key in gadget.props.param) {
if (gadget.props.param.hasOwnProperty(key)) {
promise_list.push(loopEventListener(
gadget.props.element.querySelector('form [name=' + key + ']'),
"keyup",
true,
linkActualiseParam
));
}
}
return RSVP.all(promise_list);
});
}(window, rJS, RSVP, loopEventListener, jIO));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_page_contributor.js.xml
0 → 100644
View file @
63e2db68
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Script"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
contributor/person_module/1
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_erp5_page_contributor.js
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
gadget_erp5_page_contributor.js
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Script
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
OfficeJS Contributor JS
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs/PathTemplateItem/web_site_module/renderjs_contributor.xml
0 → 100644
View file @
63e2db68
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment