Commit 941c60ec authored by Vincent Bechu's avatar Vincent Bechu Committed by Vincent Bechu

erp5_officejs_application: PDF Viewer Gadget

parent b041ab7f
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Software Product" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</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>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>follow_up/web_site_module/osp-22</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>OSP-22</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>osp-22</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Software Product</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>PDFJS Gadget</string> </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>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>956.7274.47583.13414</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</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>1482747452.42</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</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>1482336643.51</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
/*jslint indent: 2, nomen: true */
/*global window, rJS, RSVP, PDFJS, webViewerLoad, Uint8Array,
ArrayBuffer, PDFViewerApplication, FileReader */
(function (window, rJS, RSVP, PDFJS, webViewerLoad) {
"use strict";
rJS(window)
.ready(function (gadget) {
gadget.props = {};
return gadget.getElement()
.push(function (element) {
gadget.props.element = element;
});
})
.declareMethod("render", function (options) {
[].forEach.call(window.document.head.querySelectorAll("base"), function (el) {
// XXX GadgetField adds <base> tag to fit to the parent page location, it's BAD to remove them.
// In the case of pdf.js, all component are loaded dynamicaly through ajax requests in
// pdf-js "folder". By setting a <base> tag, we change the url resolution behavior, and
// we break all dynamic links. So, deleting <base> is required.
window.document.head.removeChild(el);
});
this.props.key = options.key;
var raw = window.atob(options.value);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for (var i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
}
webViewerLoad(array);
// hide few buttons for now
this.props.element.querySelector('#viewBookmark').hidden = true;
this.props.element.querySelector('#documentProperties').hidden = true;
this.props.element.querySelector('#documentProperties').hidden = true;
return;
})
.declareMethod("getContent", function () {
var form_data = {};
var self = this;
return new RSVP.Queue()
.push(function () {
if (PDFViewerApplication.pdfDocument) {
return PDFViewerApplication.pdfDocument.getData();
} else {
return '';
}
})
.push(function (data) {
var blob = PDFJS.createBlob(data, "application/pdf");
var filereader = new FileReader();
return new RSVP.Promise(function (resolve, reject, notify) {
filereader.addEventListener("load", resolve);
filereader.addEventListener("error", reject);
filereader.addEventListener("progress", notify);
filereader.readAsDataURL(blob);
}, function () {
filereader.abort();
});
})
.push(function (evt) {
form_data[self.props.key] = evt.target.result;
return form_data;
});
});
}(window, rJS, RSVP, PDFJS, webViewerLoad, PDFViewerApplication));
This diff is collapsed.
web_page_module/osp-22-gadget_pdf_viewer_js
web_page_module/osp-22-gadget_pdf_viewer_appcache
web_page_module/osp-22-gadget_pdf_viewer_html
web_page_module/osp-22-renderjs_js
web_page_module/osp-22-rsvp_js
web_page_module/osp-22-jiodev_js
software_product_module/osp-22
web_site_module/osp-22
web_site_module/osp-22/development
web_site_module/osp-22/development/**
\ No newline at end of file
software_product_module/osp-22
web_page_module/osp-22-gadget_pdf_viewer_appcache
web_page_module/osp-22-gadget_pdf_viewer_html
web_page_module/osp-22-gadget_pdf_viewer_js
web_page_module/osp-22-jiodev_js
web_page_module/osp-22-renderjs_js
web_page_module/osp-22-rsvp_js
web_site_module/osp-22
web_site_module/osp-22/development
web_site_module/osp-22/development/**
\ No newline at end of file
PDF Viewer Gadget
\ No newline at end of file
2016-12-21T15:38:39Z
\ 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