Commit b849729e authored by Roque's avatar Roque

erp5_officejs: common clone action gadget (text editor updated)

parent b2181b84
...@@ -51,6 +51,10 @@ url_list = [ ...@@ -51,6 +51,10 @@ url_list = [
"officejs_logo.png", "officejs_logo.png",
"jio_appcachestorage.js", "jio_appcachestorage.js",
"jio_configuration_storage.js", "jio_configuration_storage.js",
#app actions
"action_clone.html",
"action_clone.js"
] ]
base64_url_list = context.WebSection_getBase64ConfigurationUrlList(batch_mode=1) base64_url_list = context.WebSection_getBase64ConfigurationUrlList(batch_mode=1)
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<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">
<title>OfficeJS Texteditor Clone Action</title> <title>OfficeJS Clone Action</title>
<script src="rsvp.js"></script> <script src="rsvp.js"></script>
<script src="renderjs.js"></script> <script src="renderjs.js"></script>
<script src="action_texteditor_clone.js"></script> <script src="action_clone.js"></script>
</head> </head>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
<value> <string>action_texteditor_clone.html</string> </value> <value> <string>action_clone.html</string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
......
/*global window, rJS, RSVP */ /*global window, rJS, RSVP, jIO */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) { (function (window, rJS, RSVP, jIO) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get") .declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_post", "jio_post") .declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("jio_allAttachments", "jio_allAttachments")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
...@@ -38,16 +41,36 @@ ...@@ -38,16 +41,36 @@
} }
}, gadget = this, }, gadget = this,
document = parent_options.doc, document = parent_options.doc,
property; all_attachments,
delete content_dict.dialog_method; promise_list = [],
for (property in content_dict) { parent_jio_key = parent_options.action_options.jio_key,
if (content_dict.hasOwnProperty(property)) { jio_key;
document[property] = content_dict[property]; return gadget.jio_allAttachments(parent_jio_key)
} .push(function (result) {
} var property;
return gadget.jio_post(document) all_attachments = result;
.push(function (jio_key) { return gadget.jio_post(document);
return_submit_dict.notify.message = "Data Updated"; })
.push(function (result_jio_key) {
var attachment_id;
jio_key = result_jio_key;
for (attachment_id in all_attachments) {
if (all_attachments.hasOwnProperty(attachment_id)) {
promise_list.push(gadget.jio_getAttachment(parent_jio_key, attachment_id));
}
}
return RSVP.all(promise_list);
})
.push(function (result_list) {
var i;
promise_list = [];
for (i = 0; i < result_list.length; i += 1) {
promise_list.push(gadget.jio_putAttachment(jio_key, Object.keys(all_attachments)[i], result_list[i]));
}
return RSVP.all(promise_list);
})
.push(function () {
return_submit_dict.notify.message = "Clone Document Created";
return_submit_dict.notify.status = "success"; return_submit_dict.notify.status = "success";
return_submit_dict.redirect.options = { return_submit_dict.redirect.options = {
jio_key: jio_key, jio_key: jio_key,
...@@ -64,4 +87,4 @@ ...@@ -64,4 +87,4 @@
}); });
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP, jIO));
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
<value> <string>action_texteditor_clone.js</string> </value> <value> <string>action_clone.js</string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
......
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
</item> </item>
<item> <item>
<key> <string>gadget_url</string> </key> <key> <string>gadget_url</string> </key>
<value> <string>action_texteditor_clone.html</string> </value> <value> <string>action_clone.html</string> </value>
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
......
...@@ -4,10 +4,6 @@ url_list = [ ...@@ -4,10 +4,6 @@ url_list = [
"gadget_officejs_text_editor.json", "gadget_officejs_text_editor.json",
"officejs_logo_text_editor.png", "officejs_logo_text_editor.png",
"gadget_officejs_text_editor_router.html", "gadget_officejs_text_editor_router.html",
#app custom actions
"action_texteditor_clone.html",
"action_texteditor_clone.js"
] ]
return url_list return url_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testOfficeJSTextEditorClone</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment