Commit 3144672a authored by Roque's avatar Roque

erp5_officejs: new approach for officejs apps - text editor forms and views

parent 3b9c3789
<?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_list</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_list</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>language</string> </key>
<value>
<none/>
</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>40.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>portal_skins/erp5_web_officejs_ui/WebPageModule_viewWebPageListAsJio</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>text_editor_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>35.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>portal_skins/erp5_web_officejs_ui/WebPage_viewAsTextDocument</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Common Utils</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_officejs_common_utils.js"></script>
</head>
<body>
</body>
</html>
/*global document, window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (document, window, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("isDesktopMedia", "isDesktopMedia")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod('getUrlParameter', 'getUrlParameter')
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this,
default_view,
app_view,
form_definition,
gadget_utils,
jio_document,
portal_type,
front_page;
return RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.declareGadget("gadget_officejs_common_utils.html"),
gadget.getSetting('app_view_reference'),
gadget.getSetting('default_view_reference')
]);
})
.push(function (result_list) {
gadget_utils = result_list[0];
app_view = options.action || result_list[1];
default_view = result_list[2];
return gadget.jio_get(options.jio_key);
})
.push(function (result) {
jio_document = result;
if (jio_document.portal_type === undefined) {
throw new Error('Can not display document: ' + options.jio_key);
}
}, function () {})
.push(function () {
return gadget.getSetting('parent_portal_type');
})
.push(function (parent_portal_type) {
if (jio_document) {
portal_type = jio_document.portal_type;
} else if (options.portal_type) {
portal_type = options.portal_type;
} else {
portal_type = parent_portal_type;
}
front_page = portal_type === parent_portal_type;
return gadget_utils.getFormDefinition(portal_type, app_view);
})
.push(function (result) {
return result;
}, function () {
return gadget_utils.getFormDefinition(portal_type, default_view);
})
.push(function (result) {
form_definition = result;
return gadget_utils.getFormInfo(form_definition);
})
.push(function (form_info) {
var form_type = form_info[0],
child_gadget_url = form_info[1];
return gadget.changeState({
jio_key: options.jio_key,
doc: jio_document,
portal_type: portal_type,
child_gadget_url: child_gadget_url,
form_definition: form_definition,
form_type: form_type,
editable: options.editable,
view: options.view || default_view,
front_page: front_page
});
});
})
.onStateChange(function () {
var fragment = document.createElement('div'),
gadget = this;
while (this.element.firstChild) {
this.element.removeChild(this.element.firstChild);
}
this.element.appendChild(fragment);
return gadget.declareGadget("gadget_officejs_form_view.html", {element: fragment,
scope: 'form_view'})
.push(function (form_view_gadget) {
return form_view_gadget.render(gadget.state);
});
})
.allowPublicAcquisition('notifySubmit', function () {
return this.triggerSubmit();
})
.allowPublicAcquisition('submitContent', function (param_list) {
var gadget = this,
//target_url = options[1],
content_dict = param_list[2];
return gadget.jio_get(gadget.state.jio_key)
.push(function (doc) {
var property;
for (property in content_dict) {
if (content_dict.hasOwnProperty(property)) {
doc[property] = content_dict[property];
}
}
return gadget.jio_put(gadget.state.jio_key, doc);
})
.push(function () {
return gadget.notifySubmitting();
})
.push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
});
})
.declareMethod("triggerSubmit", function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_view')
.push(function (view_gadget) {
return view_gadget.triggerSubmit(argument_list);
});
});
}(document, window, rJS, RSVP));
\ No newline at end of file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Form View</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_officejs_form_view.js"></script>
</head>
<body>
</body>
</html>
......@@ -87,13 +87,14 @@
};
AppCacheStorage.prototype.repair = function () {
var storage = this;
var storage = this, url = "";
return new RSVP.Queue()
.push(function () {
url = new URL(storage._manifest, new URL(storage._version,
storage._origin_url));
return jIO.util.ajax({
type: "GET",
url: new URL(storage._manifest, new URL(storage._version,
storage._origin_url))
url: url
});
})
.push(function (response) {
......@@ -123,7 +124,7 @@
})
.push(undefined, function (error) {
if (!error.message) {
error.message = "Can't get manifest";
error.message = "Can't get manifest. URL: " + url;
}
throw error;
});
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Local Jio Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="jio_ojs_storage.js" type="text/javascript"></script>
<script src="jio_appcachestorage.js"></script>
<!-- custom script -->
<script src="gadget_ojs_local_jio.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=Workflows
data-i18n=Actions
data-i18n=Clone
data-i18n=Delete
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Officejs Page Action</title>
<link rel="http://www.renderjs.org/rel/interface" href="interface_page.html">
<!-- 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_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_action_officejs.js" type="text/javascript"></script>
<script id="table-template" type="text/x-handlebars-template">
<section class="ui-content-header-plain">
<h3 data-i18n="[last]{{definition_i18n}}">
<span class="ui-icon ui-icon-{{definition_icon}}">&nbsp;</span>
{{definition_title}}
</h3>
</section>
<ul class="document-listview">
{{#each document_list}}
<li><a data-i18n="{{title}}" href="{{link}}">{{title}}</a></li>
{{/each}}
</ul>
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=Workflows
data-i18n=Actions
data-i18n=Clone
data-i18n=Delete
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Officejs Page Action</title>
<link rel="http://www.renderjs.org/rel/interface" href="interface_page.html">
<!-- 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_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_create_document.js" type="text/javascript"></script>
<script id="table-template" type="text/x-handlebars-template">
<section class="ui-content-header-plain">
<h3 data-i18n="[last]{{definition_i18n}}">
<span class="ui-icon ui-icon-{{definition_icon}}">&nbsp;</span>
{{definition_title}}
</h3>
</section>
<ul class="document-listview">
{{#each document_list}}
<li><a data-i18n="{{title}}" href="{{link}}">{{title}}</a></li>
{{/each}}
</ul>
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Handle Action</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_handle_action.js"></script>
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 Local Controller</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jio_appcachestorage.js"></script>
<!-- custom script -->
<script src="gadget_erp5_page_ojs_local_controller.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
......@@ -4,7 +4,7 @@
"description": "Simple Text Web Editor",
"icons": [{
"src": "officejs_logo_text_editor.png",
"sizes": "any",
"sizes": "128x128",
"type": "image/png"
}],
"start_url": "../../",
......
......@@ -17,6 +17,7 @@
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Web Page</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Text Document</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Text Documents</script>
<script data-renderjs-configuration="parent_portal_type" type="text/x-renderjs-configuration">Web Page Module</script>
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">web_page_module</script>
<script data-renderjs-configuration="erp5_attachment_synchro" type="text/x-renderjs-configuration"></script>
<script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">n692ixxhyg9zhqs</script>
......
......@@ -413,7 +413,7 @@
</item>
<item>
<key> <string>configuration_cache_file</string> </key>
<value> <string>gadget_officejs_text_editor.appcache</string> </value>
<value> <string>gadget_officejs_discussion_tool.appcache</string> </value>
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
......@@ -732,7 +732,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>973.35104.39622.59955</string> </value>
<value> <string>975.50798.33418.15411</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -750,7 +750,7 @@
</tuple>
<state>
<tuple>
<float>1549643621.84</float>
<float>1558530049.62</float>
<string>UTC</string>
</tuple>
</state>
......
Web Page Module | jio_view
Web Page | text_editor_view
\ No newline at end of file
......@@ -36,6 +36,8 @@ web_site_module/officejs_svg_editor
web_site_module/officejs_svg_editor/**
web_site_module/officejs_text_editor
web_site_module/officejs_text_editor/**
web_site_module/officejs_discussion_tool
web_site_module/officejs_discussion_tool/**
web_site_module/officejs_todomvc
web_site_module/officejs_wallsearch
web_site_module/officejs_wallsearch/**
......
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