Commit 5ba1efb6 authored by Boris Kocherov's avatar Boris Kocherov Committed by Vincent Bechu

erp5_officejs_ooffice: add ooffice_spreadsheet and gadget

parent 58dd0efe
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CKEditor Gadget</title>
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!--<script src="ckeditor/ckeditor.js"></script>-->
<script type="text/javascript" src="ooffice/vendor/underscore/underscore.js"></script>
<script type="text/javascript" src="ooffice/apps/api/documents/api.js"></script>
<script src="gadget_ooffice.js" type="text/javascript"></script>
</head>
<body style="margin: 0">
<div id="oospreadsheet_gadget" class="oospreadsheet_gadget"></div>
</body>
</html>
<?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_ooffice.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_ooffice_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>OOffice Gadget</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1448024007.19</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Jio Web Page View</title>
<link rel="stylesheet" href="gadget_erp5.css">
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script class="view-web-page-template" type="text/x-handlebars-template">
<form class="view-web-page-form">
<div class="center">
<div class="ui-field-contain">
<label data-i18n="Title:">Title:</label>
<input type="text" name="title" value="{{title}}">
</div>
<button type="submit" data-i18n="Save" style="display:none;">
Save
</button>
</div>
<div class="ui-field-contain">
    
<fieldset data-role="collapsible">
        
<legend>Extra Properties</legend>
<div class="ui-field-contain">
<label data-i18n="Reference:">Reference:</label>
<input type="text" name="reference"
value="{{reference}}">
</div>
<div class="ui-field-contain">
<label data-i18n="Version:">Version:</label>
<input type="text" name="version"
value="{{version}}"></label>
</div>
<div class="ui-field-contain">
<label data-i18n="Language:">Language:</label>
<input type="text" name="language" value="{{language}}">
</div>
<div class="ui-field-contain">
<label data-i18n="Description:">Description:</label>
<textarea name="description">{{description}}</textarea>
</div>
</fieldset>
</div>
<div class='document-content'></div>
</form>
</script>
<script src="gadget_officejs_jio_spreadsheet_view.js"></script>
</head>
<body>
</body>
</html>
/*globals window, rJS, Handlebars, RSVP, loopEventListener, console, document, jIO*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, document, RSVP, rJS, Handlebars, loopEventListener, jIO) {
"use strict";
function this_func_link(name) {
return function (opt) {
return this[name].apply(this, opt);
};
}
function renderOnlyOfficeGadget(gadget) {
var text_gadget;
return gadget.declareGadget(
"../../ooffice_spreadsheet_gadget/development/",
{
scope: "my_text_content",
sandbox: "iframe",
element: gadget.props.element.querySelector(".document-content")
}
)
.push(function (text_content_gadget) {
text_gadget = text_content_gadget;
gadget.setFillStyle();
// switchMaximizeMode(gadget);
return text_content_gadget;
})
.push(function (text_content_gadget) {
return text_content_gadget.render({
"key": 'text_content',
"value": gadget.options.data
});
})
.push(function () {
return text_gadget.getElement();
});
}
function saveContent(gadget, submit_event) {
var i,
doc = gadget.options.doc;
doc.modification_date = (new Date()).toISOString();
for (i = 0; i < submit_event.target.length; i += 1) {
// XXX Should check input type instead
if (submit_event.target[i].name) {
doc[submit_event.target[i].name] = submit_event.target[i].value;
}
}
return new RSVP.Queue()
.push(function () {
if (gadget.options.doc.content_type === undefined ||
gadget.options.doc.content_type.indexOf("application/x-asc") === 0
) {
gadget.options.doc.content_type = "application/x-asc-spreadsheet";
return gadget.getDeclaredGadget("my_text_content");
}
return undefined;
})
.push(function (text_content_gadget) {
if (text_content_gadget !== undefined) {
return text_content_gadget.getContent();
}
return undefined;
})
.push(function(datauri) {
if (datauri !== undefined) {
return gadget.jio_putAttachment(gadget.options.jio_key, 'data',
jIO.util.dataURItoBlob(datauri.text_content));
}
return;
})
.push(function () {
return gadget.jio_put(gadget.options.jio_key, doc);
});
}
function getMaxHeight(wrap_obj) {
var height;
if (wrap_obj) {
height = window.innerHeight - wrap_obj.offsetTop;
} else {
height = window.innerHeight;
}
if (height < 400) {
height = 400;
}
return height + "px";
}
function setFillStyle(gadget) {
var iframe = gadget.props.element.querySelector('iframe'),
height = getMaxHeight(iframe),
width = "100%";
iframe.setAttribute(
'style',
'width: ' + width + '; border: 0 none; height: ' + height
);
return {height: height, width: width};
}
function switchMaximizeMode(gadget) {
var iframe = gadget.props.element.querySelector('iframe'),
iframe_class_string = iframe.getAttribute('class') || "",
class_name = "ui-content-maximize",
class_index = iframe_class_string.indexOf(class_name);
if (class_index === -1) {
iframe_class_string += ' ' + class_name;
iframe.setAttribute('style', 'background: white;');
iframe.setAttribute('class', iframe_class_string);
return true;
}
iframe_class_string = iframe_class_string.substring(0, class_index)
+ iframe_class_string.substring(class_index + class_name.length);
iframe.setAttribute('style', 'width:100%; border: 0 none; height: 600px');
iframe.setAttribute('class', iframe_class_string);
return false;
}
var gadget_klass = rJS(window),
source = gadget_klass.__template_element
.querySelector(".view-web-page-template")
.innerHTML,
template = Handlebars.compile(source);
gadget_klass
.ready(function (g) {
g.props = {};
g.options = null;
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.deferred = RSVP.defer();
});
})
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod('getSetting', 'getSetting')
.allowPublicAcquisition("getSetting", this_func_link("getSetting"))
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.allowPublicAcquisition('setFillStyle', function () {
return setFillStyle(this);
})
.declareMethod('setFillStyle', function () {
return setFillStyle(this);
})
.allowPublicAcquisition('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return switchMaximizeMode(gadget);
});
}
return this.props.element.querySelector('button').click();
})
.declareMethod('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return switchMaximizeMode(gadget);
});
}
return this.props.element.querySelector('button').click();
})
.declareMethod("render", function (options) {
var gadget = this;
gadget.options = options;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.jio_get(options.jio_key),
gadget.jio_getAttachment(options.jio_key, "data")
.push(undefined, function (error) {
if (error.status_code === 404) {
return new Blob();
}
throw error;
})
]);
})
.push(function (result) {
return new RSVP.Queue()
.push(function () {
if (result[0].content_type === undefined ||
result[0].content_type.indexOf("application/x-asc") === 0) {
return jIO.util.readBlobAsDataURL(result[1]);
}
return jIO.util.readBlobAsText(result[1]);
})
.push(function (evt) {
result[1] = evt.target.result;
return result;
});
})
.push(function (list) {
var doc = list[0],
data = list[1];
gadget.options.doc = doc;
gadget.options.data = data;
gadget.options.doc.title = gadget.options.doc.title || "";
return new RSVP.Queue()
.push(function () {
return gadget.translateHtml(template(options.doc));
})
.push(function (html) {
gadget.props.element.innerHTML = html;
return gadget.updateHeader({
title: options.doc.title + " | " + options.doc.portal_type,
maximize_action: true,
maximized: (gadget.options.doc.title !== ""),
save_action: true
});
})
.push(function () {
return gadget.props.deferred.resolve();
});
});
})
/////////////////////////////////////////
// Render text content gadget
/////////////////////////////////////////
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.deferred.promise;
})
.push(function () {
var iframe;
if (gadget.options.doc.content_type === undefined
|| gadget.options.doc.content_type.indexOf("application/x-asc")
=== 0) {
return renderOnlyOfficeGadget(gadget);
}
iframe = document.createElement("iframe");
iframe.setAttribute(
"src",
"data:text/html," + gadget.options.data
);
gadget.props.element.querySelector(".document-content")
.appendChild(iframe);
return setFillStyle(gadget);
})
.push(function () {
if (gadget.options.doc.title !== "") {
return switchMaximizeMode(gadget);
}
return;
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.deferred.promise;
})
.push(function () {
return loopEventListener(
gadget.props.element.querySelector('form'),
'submit',
true,
function (event) {
return saveContent(gadget, event);
}
);
});
});
}(window, document, RSVP, rJS, Handlebars, loopEventListener, jIO));
\ No newline at end of file
/*global window, rJS, DocsAPI, _*/
/*jslint nomen: true, maxlen:80, indent:2*/
(function (rJS, DocsAPI, _) {
"use strict";
// Document Editor event handlers
//function onRequestHistory() {
// docEditor.refreshHistory({
// 'currentVersion': 3,
// 'history': [
// {
// 'user': {
// id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
// name: 'Татьяна Щербакова'
// },
// 'changes': null,
// 'created': '1/18/2015 6:38 PM',
// 'version': 1,
// 'version_group': 1,
// 'key': 'wyX9AwRq_677SWKjhfk='
// },
// {
// 'user': {
// id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
// name: 'Татьяна Щербакова'
// },
// 'changes': [
// {
// 'user': {
// id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
// name: 'Татьяна Щербакова'
// },
// 'created': '1/19/2015 6:30 PM'
// },
// {
// 'user': {
// 'userid': '8952d4ee-e8a5-42bf-11f0-6cd77801ec15',
// 'username': 'Александр Трофимов'
// },
// 'created': '1/19/2015 6:32 PM'
// },
// {
// 'user': {
// id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
// name: 'Татьяна Щербакова'
// },
// 'created': '1/19/2015 6:38 PM'
// }
// ],
// 'created': '2/19/2015 6:38 PM',
// 'version': 2,
// 'version_group': 1,
// 'key': 'wyX9AwRq_677SWKjhfk='
// },
// {
// 'user': {
// id: '895255ee-e8a5-42bf-86f0-6cd77801ec15',
// name: 'Me'
// },
// 'changes': null,
// 'created': '2/21/2015 6:38 PM',
// 'version': 3,
// 'version_group': 2,
// 'key': 'wyX9AwRq_677SWKjhfk='
// },
// {
// 'user': {
// id: '8952d4ee-e8a5-42bf-11f0-6cd77801ec15',
// name: 'Александр Трофимов'
// },
// 'changes': null,
// 'created': '2/22/2015 6:37 PM',
// 'version': 4,
// 'version_group': 3,
// 'key': 'wyX9AwRq_677SWKjhfk='
// },
// {
// 'user': {
// id: '8952d4ee-e8a5-42bf-11f0-6cd33801ec15',
// name: 'Леонид Орлов'
// },
// 'changes': null,
// 'created': '2/24/2015 6:29 PM',
// 'version': 5,
// 'version_group': 3,
// 'key': 'wyX9AwRq_677SWKjhfk='
// }]
// });
//}
//
//function onRequestHistoryData(revision) {
// docEditor.setHistoryData(
// {
// 'version': revision.data,
// 'url': 'http://isa2',
// 'urlDiff': 'http://isa2'
// }
// );
//}
//
//function onRequestHistoryClose() {
// // reload page
//}
//
function onDocEditorReady(event) {
if (event.target) {
console.log('Ready! Editor: ', event.target);
}
}
function onDocumentStateChange(event) {
var isModified = event.data;
console.log(isModified);
}
function onError(event) {
console.log(event.data);
// critical error happened
// examine event.data.errorCode and event.data.errorDescription for details
}
rJS(window)
.ready(function (g) {
g.props = {};
})
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.cfg = {
mode: 'edit',
lang: 'en',
canCoAuthoring: false,
canBackToFolder: true,
canCreateNew: true,
createUrl: 'http://www.example.com/create',
user: {
id: 'uid-901',
name: 'Hamish Mitchell'
},
recent: [
{
title: 'Memory.docx',
url: 'http://onlyoffice.com',
folder: 'Document Editor'
},
{
title: 'Description.doc',
url: 'http://onlyoffice.com',
folder: 'Document Editor'
},
{
title: 'DocEditor_right.xsl',
url: 'http://onlyoffice.com',
folder: 'Spreadsheet Editor'
},
{
title: 'api.rtf',
url: 'http://onlyoffice.com',
folder: 'Unnamed folder'
}
],
templates: [
{
name: 'Contracts',
icon: '../../api/documents/resources/templates/contracts.png'
},
{
name: 'Letter',
icon: '../../api/documents/resources/templates/letter.png'
},
{
name: 'List',
icon: '../../api/documents/resources/templates/list.png'
},
{
name: 'Plan',
icon: '../../api/documents/resources/templates/plan.png'
}
],
embedded: {
embedUrl: 'http://onlyoffice.com/embed',
fullscreenUrl: 'http://onlyoffice.com/fullscreen',
saveUrl: 'http://onlyoffice.com/download',
shareUrl: 'http://tl.com/72b4la97',
toolbarDocked: 'top'
},
customization: {
//logoUrl: 'header logo url', // default size 88 x 30
//logoUrlEmbedded: 'header logo url', // default size 88 x 30
//backgroundColor: '#ffffff',
//textColor: '#ff0000',
//customer: {
// name: 'SuperPuper',
// address: 'New-York, 125f-25',
// mail: 'support@gmail.com',
// www: 'www.superpuper.com',
// info: 'Some info',
// logo:'https://img.imgsmail.ru/r/default/portal/0.1.29/logo.png'
//},
//goback: {text: 'Go To London'}
about: true,
feedback: true
}
};
g.props.element = element;
});
})
.declareAcquiredMethod("submitContent", "triggerSubmit")
.declareAcquiredMethod("maximize", "triggerMaximize")
.declareMethod('render', function (options) {
console.log(options.value);
this.props.docEditor = new DocsAPI.DocEditor('oospreadsheet_gadget', {
//type: urlParams['type'],
width: '100%',
height: '100%',
//documentType: urlParams['doctype'],
document: {
//key: undefined,
//url: undefined,
title: options.title,
//fileType: undefined,
//vkey: undefined,
data: options.value || "",
permissions: {
edit: true,
download: true,
reader: true
}
},
editorConfig: this.props.cfg,
events: {
'onReady': onDocEditorReady,
'onBack': _.bind(function (event) {
this.maximize();
}, this),
'onDocumentStateChange': onDocumentStateChange,
'onRequestEditRights': _.bind(function (event) {
// occurs whenever the user tryes to enter edit mode
this.props.docEditor.applyEditRights(true,
"Someone is editing this document right now." +
" Please try again later.");
}, this),
//'onRequestHistory': onRequestHistory,
//'onRequestHistoryData': onRequestHistoryData,
//'onRequestHistoryClose': onRequestHistoryClose,
'onSave': _.bind(function (event) {
this.props.data = event.data;
this.submitContent();
return true;
// if you want to async save process return false
// and call api.processSaveResult when ready
}, this),
'onError': onError
}
});
this.props.key = options.key || "text_content";
return {};
})
.declareMethod('getContent', function () {
var result = {};
result[this.props.key] = this.props.data;
return result;
});
}(rJS, DocsAPI, _));
\ No newline at end of file
<?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_ooffice.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_ooffice_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>version</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1448024013.93</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
/*global window, rJS, jIO, URI, location, console, document, RSVP, loopEventListener, navigator, XMLHttpRequest, ProgressEvent*/
/*jslint nomen: true, indent: 2*/
(function (window, rJS, jIO) {
"use strict";
function this_func_link(name) {
return function (opt) {
return this[name].apply(this, opt);
};
}
var gadget_klass = rJS(window),
SCOPE = "main",
SETTING_STORAGE = jIO.createJIO({
type: "indexeddb",
database: "setting"
});
gadget_klass
.ready(function (gadget) {
gadget.props = {};
return gadget.getElement()
.push(function (element) {
var element_list =
element.querySelectorAll("[data-renderjs-configuration]"),
len = element_list.length,
key,
value,
i;
gadget.props.element = element;
gadget.props.configuration = {};
for (i = 0; i < len; i += 1) {
key = element_list[i].getAttribute('data-renderjs-configuration');
value = element_list[i].textContent;
gadget.props.configuration[key] = value;
}
})
.push(function () {
// Resources are now ready
// Modify base to provides same base as gadget
var base = document.createElement('base'),
child_gadget_url = gadget.props.configuration["child-gadget"];
base.href = new URI(child_gadget_url + '/../').normalize()
.toString();
document.head.appendChild(base);
return gadget.declareGadget(
child_gadget_url,
{
scope: SCOPE
}
);
})
.push(function (child_gadget) {
return child_gadget.getElement();
})
.push(function (child_element) {
gadget.props.element.appendChild(child_element);
});
})
.declareMethod('getSetting', function (key, default_value) {
var from_html = this.props.configuration[key];
if (from_html) {
return from_html;
}
return SETTING_STORAGE.get("setting")
.push(function (doc) {
return doc[key] || default_value;
}, function (error) {
if (error.status_code === 404) {
return default_value;
}
throw error;
});
})
.allowPublicAcquisition('getSetting', this_func_link('getSetting'))
.declareMethod('setSetting', function (key, value) {
return SETTING_STORAGE.get("setting")
.push(undefined, function (error) {
if (error.status_code === 404) {
return {};
}
throw error;
})
.push(function (doc) {
doc[key] = value;
return SETTING_STORAGE.put('setting', doc);
});
})
.allowPublicAcquisition('setSetting', this_func_link('setSetting'))
.declareAcquiredMethod("triggerSubmit", "triggerSubmit")
.allowPublicAcquisition('triggerSubmit', this_func_link('triggerMaximize'))
.declareAcquiredMethod("triggerMaximize", "triggerMaximize")
.allowPublicAcquisition('triggerMaximize', this_func_link('triggerMaximize'))
.declareAcquiredMethod("setFillStyle", "setFillStyle")
.allowPublicAcquisition('setFillStyle', this_func_link('setFillStyle'))
.declareMethod('render', function (options) {
var gadget = this;
return RSVP.Queue()
.push(function () {
return gadget.getDeclaredGadget(SCOPE);
})
.push(function (child_gadget) {
return child_gadget.render(options);
});
})
.declareMethod('getContent', function () {
var gadget = this;
return RSVP.Queue()
.push(function () {
return gadget.getDeclaredGadget(SCOPE);
})
.push(function (child_gadget) {
return child_gadget.getContent();
});
});
}(window, rJS, jIO));
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>OfficeJS Spreadsheet Loader Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_onlyoffice_landing.js" type="text/javascript"></script>
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Spreadsheet</script>
<script data-renderjs-configuration="child-gadget" type="text/x-renderjs-configuration">ooffice/gadget_ooffice.html</script>
</body>
</html>
<!DOCTYPE html>
<html manifest="disabled.appcache">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico">
<title>Spreedsheet Editor</title>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="jquerymobile.css">
<link rel="stylesheet" href="gadget_erp5.css">
<script data-renderjs-configuration="application_title" type="text/x-renderjs-configuration">Spreedsheet Editor</script>
<script data-renderjs-configuration="panel_gadget" type="text/x-renderjs-configuration">gadget_officejs_application_panel.html</script>
<script data-renderjs-configuration="action_view" type="text/x-renderjs-configuration">object_view</script>
<script data-renderjs-configuration="default_view_reference" type="text/x-renderjs-configuration">view</script>
<script data-renderjs-configuration="hateoas_url" type="text/x-renderjs-configuration">hateoas/</script>
<script data-renderjs-configuration="frontpage_gadget" type="text/x-renderjs-configuration">worklist</script>
<script src="jquery.js"></script>
<script src="jquerymobile.js"></script>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_global.js" ></script>
<script src="erp5_launcher.js"></script>
</head>
<body>
<div data-role="page">
<div data-gadget-url="gadget_jio.html"
data-gadget-scope="setting_gadget"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_officejs_spreadsheet_router.html"
data-gadget-scope="router"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_translation.html"
data-gadget-scope="translation_gadget"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_officejs_header.html"
data-gadget-scope="header"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_officejs_jio.html"
data-gadget-scope="jio_gadget"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_erp5_editor_panel.html"
data-gadget-scope="editor_panel"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_officejs_application_panel.html"
data-gadget-scope="panel"
data-gadget-sandbox="public"></div>
<div role="main" class="ui-content gadget-content"></div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>OfficeJS Spreadsheet Router Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_router.js" type="text/javascript"></script>
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Spreadsheet</script>
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">document_module</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Spreadsheet</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Spreadsheets</script>
<script data-renderjs-configuration="erp5_attachment_synchro" type="text/x-renderjs-configuration">/{+id}/Base_downloadWithCors</script>
<script data-renderjs-configuration="global_setting_gadget_url" type="text/x-renderjs-configuration">../officejs_setting_gadget/</script>
</body>
</html>
\ No newline at end of file
erp5_officejs
erp5_officejs_ooffice_fonts
\ No newline at end of file
web_page_module/ooffice_*
\ No newline at end of file
web_page_module/ooffice_*
web_page_module/gadget_ooffice_*
web_site_module/ooffice_spreadsheet
web_site_module/ooffice_spreadsheet/**
web_site_module/ooffice_spreadsheet_gadget
web_site_module/ooffice_spreadsheet_gadget/**
\ No newline at end of file
web_page_module/ooffice_*
\ No newline at end of file
web_page_module/ooffice_*
web_page_module/gadget_ooffice_*
web_site_module/ooffice_spreadsheet
web_site_module/ooffice_spreadsheet/**
web_site_module/ooffice_spreadsheet_gadget
web_site_module/ooffice_spreadsheet_gadget/**
\ No newline at end of file
web_page_module/ooffice_*
\ No newline at end of file
web_page_module/gadget_ooffice_*
web_page_module/ooffice_*
web_site_module/ooffice_spreadsheet
web_site_module/ooffice_spreadsheet/**
web_site_module/ooffice_spreadsheet_gadget
web_site_module/ooffice_spreadsheet_gadget/**
\ No newline at end of file
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