Commit 5cae8912 authored by Vincent Bechu's avatar Vincent Bechu Committed by Eteri

erp5_officejs: add whiteboard app

parent b3115189
......@@ -107,6 +107,13 @@ var global = self, window = self;
return self.setting_storage.get(self.registration.scope)
.push(function (doc) {
relative_url = doc.landing_page || "/";
})
.push(undefined, function (error) {
if (error.status_code === 404) {
relative_url = "/";
return;
}
throw error;
});
}
})
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>957.13322.19650.55534</string> </value>
<value> <string>957.19142.34610.35908</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1486631658.62</float>
<float>1486980979.01</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<body>
</body>
<script>
var center = document.createElement("center");
var link = document.createElement("a");
link.innerHTML = "Edit";
link.setAttribute("target", "_blank");
link.setAttribute("href", window.location.origin + '/erp5/web_site_module/officejs_cribjs/#page=jio_crib_configurator&communication_gadget=' + window.location.origin + window.location.pathname + "gadget_officejs_whiteboard_liberator.html&application_name=Whiteboard");
center.appendChild(link);
document.querySelector("body").appendChild(center);
</script>
</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>Jio Gadget</title>
<base href = "/erp5/web_site_module/officejs_whiteboard/>">
<!-- 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_mappingstorage.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_whiteboard_liberator.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*global window, rJS, jIO, FormData, RSVP, MessageChannel */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS, jIO, MessageChannel, RSVP) {
"use strict";
var cached_url = [
"renderjs.js",
"rsvp.js",
"jiodev.js",
"jio_mappingstorage.js",
"gadget_officejs_whiteboard_liberator.js",
"gadget_officejs_whiteboard_liberator.html"
];
function postMessage(gadget, message) {
return new RSVP.Promise(function (resolve, reject) {
var messageChannel = new MessageChannel();
messageChannel.port1.onmessage = function (event) {
if (event.data.error) {
reject(event.data.error);
} else {
return resolve(event.data);
}
};
gadget.props.serviceWorker.postMessage(
JSON.stringify(message),
[messageChannel.port2]
);
});
}
rJS(window)
.ready(function (gadget) {
gadget.state_parameter_dict = {};
gadget.props = {};
return new RSVP.Queue()
.push(function () {
return window.navigator.serviceWorker.register(
"gadget_officejs_bootloader_serviceworker.js"
);
})
.push(function (registration) {
if (registration.installing) {
gadget.props.serviceWorker = registration.installing;
} else if (registration.waiting) {
gadget.props.serviceWorker = registration.waiting;
} else if (registration.active) {
gadget.props.serviceWorker = registration.active;
}
})
.push(function () {
return postMessage(
gadget,
{
"action": "install",
"url_list": cached_url,
"version": "001"
}
);
});
})
.declareMethod('createStorage', function (erp5_url) {
var gadget = this;
gadget.state_parameter_dict.jio_storage = jIO.createJIO({
use_remote_post: false,
conflict_handling: 1,
check_local_modification: true,
check_local_creation: true,
check_local_deletion: false,
check_remote_modification: false,
check_remote_creation: false,
check_remote_deletion: false,
type: "replicate",
query: {query: 'content_type: "text%"'},
signature_storage: {
type: "indexeddb",
database: "sync_hash"
},
local_sub_storage: {
type: "uuid",
sub_storage: {
type: "query",
sub_storage: {
type: "indexeddb",
database: (window.location.origin + window.location.pathname)
.replace("gadget_officejs_whiteboard_liberator.html", "")
}
}
},
remote_sub_storage: {
type: "mapping",
id: ["equalSubProperty", "reference"],
property: {
"relative_url": ["ignore"],
"version": ["ignore"]
},
sub_storage: {
type: "erp5",
url: erp5_url + "/hateoas",
default_view_reference: "jio_view"
}
}
});
return gadget.state_parameter_dict.jio_storage.get("/")
.push(undefined, function (error) {
if (error.status_code === 404) {
return gadget.state_parameter_dict.jio_storage.put("/", {
"reference": "/",
"title": "Root Page",
"portal_type": "Web Page",
"parent_relative_url": "web_page_module",
"content_type": "text/html",
"text_content": "<html>Root of your Free Web Site</html>",
"modification_date": (new Date()).toISOString()
});
}
throw error;
});
})
.declareMethod('allDocs', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.allDocs.apply(storage, arguments);
})
.declareMethod('allAttachments', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.allAttachments.apply(storage, arguments);
})
.declareMethod('get', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.get.apply(storage, arguments);
})
.declareMethod('put', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.put.apply(storage, arguments);
})
.declareMethod('post', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.post.apply(storage, arguments);
})
.declareMethod('remove', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.remove.apply(storage, arguments);
})
.declareMethod('getAttachment', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.getAttachment.apply(storage, arguments);
})
.declareMethod('putAttachment', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.putAttachment.apply(storage, arguments);
})
.declareMethod('removeAttachment', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.removeAttachment.apply(storage, arguments);
})
.declareMethod('repair', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.repair.apply(storage, arguments);
});
}(window, rJS, jIO, MessageChannel, RSVP));
\ No newline at end of file
......@@ -21,4 +21,5 @@ web_site_module/officejs_pdf_viewer_gadget/**
web_site_module/officejs_codemirror
web_site_module/officejs_codemirror/**
web_site_module/officejs_cribjs
web_site_module/officejs_cribjs/**
\ No newline at end of file
web_site_module/officejs_cribjs/**
web_site_module/officejs_whiteboard
\ No newline at end of file
......@@ -21,4 +21,5 @@ web_site_module/officejs_pdf_viewer_gadget/**
web_site_module/officejs_codemirror
web_site_module/officejs_codemirror/**
web_site_module/officejs_cribjs
web_site_module/officejs_cribjs/**
\ No newline at end of file
web_site_module/officejs_cribjs/**
web_site_module/officejs_whiteboard
\ No newline at end of file
......@@ -23,4 +23,5 @@ web_site_module/officejs_svg_editor/**
web_site_module/officejs_svg_editor_gadget
web_site_module/officejs_svg_editor_gadget/**
web_site_module/officejs_text_editor
web_site_module/officejs_text_editor/**
\ No newline at end of file
web_site_module/officejs_text_editor/**
web_site_module/officejs_whiteboard
\ 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