Commit df54ab65 authored by amrani's avatar amrani

Added POPUP gadget

Added POPUP file to appchache
some Modification to support dropbox encryption and cryptostorage
added callback to mapping and date storage as well as all other JIO storage
parent f4e03e05
<!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>ERP5 OJS POPUP</title>
<!-- 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 id="popup_password" type="text/x-handlebars-template">
<div class="overlay">
<h3 class="header">{{message}}</h3>
<span class="ui-icon ui-icon-lock"></span>
<form>
<input placeholder="Password" autocomplete="off" class="ui-password-overlay" type="password" required>
<br>
<button type="submit" >Proceed</button>
</form>
</div>
</script>
<!-- custom script -->
<script src="gadget_erp5_popup.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
<?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>
</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>
</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_erp5_popup.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_popup_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </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>gadget popup</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</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>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</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>zope</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>1530875434.6</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>
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</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>969.12330.13902.31846</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>1532721257.96</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</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>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</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>1530819762.62</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, Handlebars, RSVP, TextEncoder */
(function (window, rJS, RSVP, Handlebars, TextEncoder) {
"use strict";
var gadget_klass = rJS(window),
popup = gadget_klass.__template_element
.getElementById("popup_password")
.innerHTML,
popup_template = Handlebars.compile(popup);
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
gadget_klass
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("redirect", "redirect")
//////////////////////////////////////////
// Converting from user key to Cryptokey
/////////////////////////////////////////
.declareMethod('convertKey', function (str) {
var buffer = new TextEncoder("utf-8").encode(str);
// We transform the string into an arraybuffer.
return new RSVP.Queue()
.push(function () {
return RSVP.all([window.crypto.subtle.digest("SHA-256", buffer),
window.crypto.subtle.importKey(
"raw",
buffer,
{name: "PBKDF2"
},
false,
["deriveKey"]
)
]);
})
.push(function (my_array) {
return {
CryptoKey: my_array[1],
Salt: my_array[0]
};
})
.push(undefined, function (error) {
throw error;
});
})
//////////////////////////////////////////
// Displaying POPUP function
/////////////////////////////////////////
.declareMethod('display_popup', function (options) {
var gadget = this;
if (options && options.message && options.addkey && options.error) {
return this.changeState({
visible: true,
message: options.message,
addkey: options.addkey,
error: options.error
})
.push(function () {
return gadget.notifySubmitted({message: gadget.state.error.error_message,
status: 'failure'});
});
}
})
.declareMethod('close', function () {
return this.changeState({
visible: false
});
})
.onStateChange(function (modification_dict) {
var gadget = this;
if (modification_dict.hasOwnProperty('visible')) {
if (gadget.state.visible) {
if (!gadget.element.classList.contains('visible')) {
gadget.element.classList.toggle('visible');
}
} else {
if (gadget.element.classList.contains('visible')) {
gadget.element.classList.remove('visible');
}
}
}
if (modification_dict.hasOwnProperty('message') && modification_dict.hasOwnProperty('addkey') &&
modification_dict.hasOwnProperty('error')) {
//window.top.document.body.addEventListener("click", function (evt) {
//evt.stopPropagation();
//evt.preventDefault();
//}, true);
gadget.element.innerHTML = popup_template({
message: gadget.state.message
});
}
})
//////////////////////////////////////////
// Evenet lisener on input
/////////////////////////////////////////
.declareMethod('add_lisener_input', function (input_pass) {
var gadget = this;
input_pass.addEventListener('input', function () {
gadget.notifySubmitted();
}, {once: true});
return;
})
//////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.onEvent('submit', function () {
var gadget = this,
input_pass_value,
input_pass = this.element.querySelector("input.ui-password-overlay");
if (input_pass.value !== undefined && input_pass.value !== null && input_pass.value !== "") {
input_pass_value = input_pass.value;
if (input_pass_value.match(/^(?=[\w\W]*\d)(?=[\w\W]*[a-z])(?=[\w\W]*[A-Z])[0-9a-zA-Z]{8,}$/)) {
return gadget.convertKey(input_pass_value)
.push(function (obj) {
return gadget.state.addkey(obj);
})
.push(function () {
return gadget.notifySubmitted();
})
.push(function () {
return gadget.close();
})
.push(function () {
return gadget.redirect({command: "display", options: {page: 'ojs_sync', auto_repair: 'true'}});
});
}
return gadget.add_lisener_input(input_pass)
.push(function () {
return gadget.notifySubmitted({message: 'Passwords must contain: \n' +
'a lower case letter [a-z] \n' +
'a upper case letter [A-Z] \n' +
'a numeric character [0-9] and \n ' +
'at least 8 characters in length', status: 'failure'});
});
}
return gadget.notifySubmitted({message: 'no field found', status: 'failure'});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
});
//.onEvent('click', function (evt) {
//if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
// (evt.target.tagName === 'BUTTON')) {
//return this.close();
//}
//}, false, false);
}(window, rJS, RSVP, Handlebars, TextEncoder));
\ 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>
</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>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_popup.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_popup_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>title</string> </key>
<value> <string>ERP5 POPUP</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>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</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>zope</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>1530875421.75</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>
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</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>969.12328.29106.49612</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>1532721180.95</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</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>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</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>1530819762.57</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -181,6 +181,8 @@ gadget_html5_element.html\n ...@@ -181,6 +181,8 @@ gadget_html5_element.html\n
gadget_html5_element.js\n gadget_html5_element.js\n
gadget_erp5_notification.html\n gadget_erp5_notification.html\n
gadget_erp5_notification.js\n gadget_erp5_notification.js\n
gadget_erp5_popup.html\n
gadget_erp5_popup.js\n
gadget_erp5_field_string.html\n gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n gadget_erp5_field_string.js\n
gadget_erp5_field_editor.html\n gadget_erp5_field_editor.html\n
...@@ -348,7 +350,7 @@ NETWORK:\n ...@@ -348,7 +350,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -362,7 +364,7 @@ NETWORK:\n ...@@ -362,7 +364,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.48513.5538.10342</string> </value> <value> <string>966.44456.34486.30566</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -380,7 +382,7 @@ NETWORK:\n ...@@ -380,7 +382,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516115771.45</float> <float>1532963989.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -185,6 +185,8 @@ gadget_html5_element.html\n ...@@ -185,6 +185,8 @@ gadget_html5_element.html\n
gadget_html5_element.js\n gadget_html5_element.js\n
gadget_erp5_notification.html\n gadget_erp5_notification.html\n
gadget_erp5_notification.js\n gadget_erp5_notification.js\n
gadget_erp5_popup.html\n
gadget_erp5_popup.js\n
gadget_erp5_field_string.html\n gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n gadget_erp5_field_string.js\n
gadget_erp5_field_editor.html\n gadget_erp5_field_editor.html\n
...@@ -352,7 +354,7 @@ NETWORK:\n ...@@ -352,7 +354,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -366,7 +368,7 @@ NETWORK:\n ...@@ -366,7 +368,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.45561.47559.9591</string> </value> <value> <string>966.44456.34486.30566</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -384,7 +386,7 @@ NETWORK:\n ...@@ -384,7 +386,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515771172.06</float> <float>1532963940.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -182,6 +182,8 @@ gadget_html5_element.html\n ...@@ -182,6 +182,8 @@ gadget_html5_element.html\n
gadget_html5_element.js\n gadget_html5_element.js\n
gadget_erp5_notification.html\n gadget_erp5_notification.html\n
gadget_erp5_notification.js\n gadget_erp5_notification.js\n
gadget_erp5_popup.html\n
gadget_erp5_popup.js\n
gadget_erp5_field_string.html\n gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n gadget_erp5_field_string.js\n
gadget_erp5_field_editor.html\n gadget_erp5_field_editor.html\n
...@@ -603,7 +605,7 @@ NETWORK:\n ...@@ -603,7 +605,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -617,7 +619,7 @@ NETWORK:\n ...@@ -617,7 +619,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.58581.32438.37376</string> </value> <value> <string>966.44456.34486.30566</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -635,7 +637,7 @@ NETWORK:\n ...@@ -635,7 +637,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1518539910.86</float> <float>1532963922.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, jIO, FormData, UriTemplate */
/*global window, rJS, jIO, FormData, UriTemplate */ /*global window, rJS, jIO, FormData, UriTemplate */
/*jslint indent: 2, maxerr: 3 */ /*jslint indent: 2, maxerr: 3 */
(function (window, rJS, jIO) { (function (window, rJS, jIO, RSVP) {
"use strict"; "use strict";
// jIO call wrapper for redirection to authentication page if needed // jIO call wrapper for redirection to authentication page if needed
...@@ -49,6 +51,11 @@ ...@@ -49,6 +51,11 @@
return gadget.redirect({ command: "row", url: site}); return gadget.redirect({ command: "row", url: site});
} }
} }
if (error.hasOwnProperty("status_code") && error.status_code === 801) {
if (gadget.state_parameter_dict.jio_storage_name === "DROPBOX") {
throw error.message;
}
}
throw error; throw error;
}); });
} }
...@@ -64,9 +71,21 @@ ...@@ -64,9 +71,21 @@
.declareAcquiredMethod("getSetting", "getSetting") .declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting") .declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod('getUrlFor', 'getUrlFor') .declareAcquiredMethod('getUrlFor', 'getUrlFor')
.declareAcquiredMethod('popupshow', 'popupshow')
.declareMethod('createJio', function (jio_options) { .declareMethod('createJio', function (jio_options) {
var gadget = this; var gadget = this,
utils = {"crypto_getCryptoKey": function (callback) {
return new RSVP.Queue()
.push(function () {
return gadget.popupshow({message: "Provide your password for dropbox encryption ",
addkey: callback.addkey_crypto,
error: callback.error_crypto });
})
.push(undefined, function (error) {
throw error;
});
}
};
if (jio_options === undefined) { if (jio_options === undefined) {
return; return;
} }
...@@ -76,7 +95,7 @@ ...@@ -76,7 +95,7 @@
property_list: ['modification_date'] property_list: ['modification_date']
}; };
try { try {
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options); this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options, utils);
} catch (error) { } catch (error) {
this.state_parameter_dict.jio_storage = undefined; this.state_parameter_dict.jio_storage = undefined;
} }
...@@ -116,4 +135,4 @@ ...@@ -116,4 +135,4 @@
return wrapJioCall(this, 'repair', arguments); return wrapJioCall(this, 'repair', arguments);
}); });
}(window, rJS, jIO)); }(window, rJS, jIO, RSVP));
\ No newline at end of file \ No newline at end of file
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.36985.29761.10359</string> </value> <value> <string>969.1654.46860.62464</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1507216488.77</float> <float>1532081552.21</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"use strict"; "use strict";
function setDropboxConfiguration(gadget, token) { function setDropboxConfiguration(gadget, token) {
var keyid = "key" + Math.floor(Math.random() * 7000).toString();
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
...@@ -34,8 +35,6 @@ ...@@ -34,8 +35,6 @@
check_remote_modification: true, check_remote_modification: true,
check_remote_creation: true, check_remote_creation: true,
check_remote_deletion: true, check_remote_deletion: true,
parallel_operation_attachment_amount: 50,
parallel_operation_amount: 50,
signature_sub_storage: { signature_sub_storage: {
type: "query", type: "query",
sub_storage: { sub_storage: {
...@@ -47,14 +46,6 @@ ...@@ -47,14 +46,6 @@
} }
}, },
local_sub_storage: { local_sub_storage: {
type: "mapping",
attachment: {
DOCUMENT_REGEXP : {
get: {uri_template: 'enclosure'},
put: {uri_template: 'enclosure'}
}
},
sub_storage: {
type: "query", type: "query",
sub_storage: { sub_storage: {
type: "uuid", type: "uuid",
...@@ -63,7 +54,6 @@ ...@@ -63,7 +54,6 @@
database: "officejs-dropbox" database: "officejs-dropbox"
} }
} }
}
}, },
remote_sub_storage: { remote_sub_storage: {
type: "mapping", type: "mapping",
...@@ -82,7 +72,7 @@ ...@@ -82,7 +72,7 @@
type: "drivetojiomapping", type: "drivetojiomapping",
sub_storage: { sub_storage: {
type: "crypt", type: "crypt",
key: 'amrani', keyid: keyid,
sub_storage: { sub_storage: {
type: "dropbox", type: "dropbox",
access_token: token, access_token: token,
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.9063.45697.9454</string> </value> <value> <string>968.63024.5682.53521</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1525334912.53</float> <float>1531832487.77</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -182,6 +182,8 @@ gadget_html5_element.html\n ...@@ -182,6 +182,8 @@ gadget_html5_element.html\n
gadget_html5_element.js\n gadget_html5_element.js\n
gadget_erp5_notification.html\n gadget_erp5_notification.html\n
gadget_erp5_notification.js\n gadget_erp5_notification.js\n
gadget_erp5_popup.html\n
gadget_erp5_popup.js\n
gadget_erp5_field_string.html\n gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n gadget_erp5_field_string.js\n
gadget_erp5_field_editor.html\n gadget_erp5_field_editor.html\n
...@@ -575,7 +577,7 @@ NETWORK:\n ...@@ -575,7 +577,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -589,7 +591,7 @@ NETWORK:\n ...@@ -589,7 +591,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.54546.48173.5239</string> </value> <value> <string>966.44456.34486.30566</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -607,7 +609,7 @@ NETWORK:\n ...@@ -607,7 +609,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516026588.79</float> <float>1532963871.52</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -159,8 +159,8 @@ gadget_erp5_page_ojs_dav_configurator.html\n ...@@ -159,8 +159,8 @@ gadget_erp5_page_ojs_dav_configurator.html\n
gadget_erp5_page_ojs_dav_configurator.js\n gadget_erp5_page_ojs_dav_configurator.js\n
gadget_erp5_page_ojs_erp5_configurator.html\n gadget_erp5_page_ojs_erp5_configurator.html\n
gadget_erp5_page_ojs_erp5_configurator.js\n gadget_erp5_page_ojs_erp5_configurator.js\n
gadget_erp5_page_ojs_dropbox_configurator.html\n gadget_erp5_popup.html\n
gadget_erp5_page_ojs_dropbox_configurator.js\n gadget_erp5_popup.js\n
gadget_erp5_page_ojs_sync.html\n gadget_erp5_page_ojs_sync.html\n
gadget_erp5_page_ojs_sync.js\n gadget_erp5_page_ojs_sync.js\n
gadget_erp5_page_ojs_document_list.html\n gadget_erp5_page_ojs_document_list.html\n
...@@ -685,7 +685,7 @@ NETWORK:\n ...@@ -685,7 +685,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -699,7 +699,7 @@ NETWORK:\n ...@@ -699,7 +699,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.48519.41997.58350</string> </value> <value> <string>967.34686.32911.56883</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -717,7 +717,7 @@ NETWORK:\n ...@@ -717,7 +717,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515675473.77</float> <float>1532944919.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -178,9 +178,10 @@ ...@@ -178,9 +178,10 @@
} }
} }
function MappingStorage(spec) { function MappingStorage(spec, utils) {
this.utils = utils;
this._mapping_dict = spec.property || {}; this._mapping_dict = spec.property || {};
this._sub_storage = jIO.createJIO(spec.sub_storage); this._sub_storage = jIO.createJIO(spec.sub_storage, utils);
this._map_all_property = spec.map_all_property !== undefined ? this._map_all_property = spec.map_all_property !== undefined ?
spec.map_all_property : true; spec.map_all_property : true;
this._no_sub_query_id = spec.no_sub_query_id; this._no_sub_query_id = spec.no_sub_query_id;
...@@ -648,8 +649,9 @@ ...@@ -648,8 +649,9 @@
return doc; return doc;
} }
function DateUpdaterStorage(spec) { function DateUpdaterStorage(spec, utils) {
this._sub_storage = jIO.createJIO(spec.sub_storage); this.utils = utils;
this._sub_storage = jIO.createJIO(spec.sub_storage, utils);
this._property_list = spec.property_list || []; this._property_list = spec.property_list || [];
} }
...@@ -726,8 +728,9 @@ ...@@ -726,8 +728,9 @@
*/ */
function SafeRepairStorage(spec) { function SafeRepairStorage(spec, utils) {
this._sub_storage = jIO.createJIO(spec.sub_storage); this.utils = utils;
this._sub_storage = jIO.createJIO(spec.sub_storage, utils);
this._id_dict = {}; this._id_dict = {};
} }
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.45923.44376.29252</string> </value> <value> <string>966.44456.34486.30566</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1507730215.96</float> <float>1530609994.82</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -175,6 +175,8 @@ gadget_html5_element.html\n ...@@ -175,6 +175,8 @@ gadget_html5_element.html\n
gadget_html5_element.js\n gadget_html5_element.js\n
gadget_erp5_notification.html\n gadget_erp5_notification.html\n
gadget_erp5_notification.js\n gadget_erp5_notification.js\n
gadget_erp5_popup.html\n
gadget_erp5_popup.js\n
gadget_erp5_field_string.html\n gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n gadget_erp5_field_string.js\n
gadget_erp5_field_editor.html\n gadget_erp5_field_editor.html\n
...@@ -326,7 +328,7 @@ NETWORK:\n ...@@ -326,7 +328,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -340,7 +342,7 @@ NETWORK:\n ...@@ -340,7 +342,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.45561.47559.9591</string> </value> <value> <string>966.44456.34486.30566</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -358,7 +360,7 @@ NETWORK:\n ...@@ -358,7 +360,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515773947.57</float> <float>1532963857.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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