Open the access modal in the secure iframe

pull/1/head
yflory 5 years ago
parent 19a0dafbe1
commit 2aec7c2569

@ -196,6 +196,7 @@ define([
]); ]);
var $frame = $(frame); var $frame = $(frame);
frame.closeModal = function (cb) { frame.closeModal = function (cb) {
frame.closeModal = function () {}; // Prevent further calls
$frame.fadeOut(150, function () { $frame.fadeOut(150, function () {
$frame.detach(); $frame.detach();
if (typeof(cb) === "function") { cb(); } if (typeof(cb) === "function") { cb(); }

@ -1592,11 +1592,7 @@ define([
.text(Messages.accessButton)) .text(Messages.accessButton))
.click(common.prepareFeedback(type)) .click(common.prepareFeedback(type))
.click(function () { .click(function () {
require(['/common/inner/access.js'], function (Access) { sframeChan.event('EV_ACCESS_OPEN');
Access.getAccessModal(common, {}, function (e) {
if (e) { console.error(e); }
});
});
}); });
break; break;
case 'properties': case 'properties':

@ -129,7 +129,10 @@ define([
tabs[i] = { tabs[i] = {
content: c && UI.dialog.customModal(node, { content: c && UI.dialog.customModal(node, {
buttons: obj.buttons || button, buttons: obj.buttons || button,
onClose: function () { blocked = false; } onClose: function () {
blocked = false;
if (typeof(opts.onClose) === "function") { opts.onClose(); }
}
}), }),
disabled: !c, disabled: !c,
title: obj.title, title: obj.title,

@ -1020,6 +1020,10 @@ define([
initSecureModal('filepicker', data || {}, cb); initSecureModal('filepicker', data || {}, cb);
}); });
sframeChan.on('EV_ACCESS_OPEN', function (data) {
initSecureModal('access', data || {}, null);
});
sframeChan.on('EV_SHARE_OPEN', function (data) { sframeChan.on('EV_SHARE_OPEN', function (data) {
initSecureModal('share', data || {}, null); initSecureModal('share', data || {}, null);
}); });

@ -40,6 +40,8 @@ define([
var displayed; var displayed;
var create = {}; var create = {};
// Share modal
create['share'] = function (data) { create['share'] = function (data) {
var priv = metadataMgr.getPrivateData(); var priv = metadataMgr.getPrivateData();
var f = (data && data.file) ? UIElements.createFileShareModal var f = (data && data.file) ? UIElements.createFileShareModal
@ -71,6 +73,20 @@ define([
displayed = modal; displayed = modal;
}; };
// Access modal
create['access'] = function (data) {
require(['/common/inner/access.js'], function (Access) {
Access.getAccessModal(common, {
onClose: function () {
hideIframe();
}
}, function (e, modal) {
if (e) { console.error(e); }
displayed = modal;
});
});
};
// File uploader // File uploader
var onFilePicked = function (data) { var onFilePicked = function (data) {
var privateData = metadataMgr.getPrivateData(); var privateData = metadataMgr.getPrivateData();

@ -108,6 +108,10 @@ define([
config.addCommonRpc(sframeChan); config.addCommonRpc(sframeChan);
Cryptpad.padRpc.onMetadataEvent.reg(function (data) {
sframeChan.event('EV_RT_METADATA', data);
});
sframeChan.on('EV_CACHE_PUT', function (x) { sframeChan.on('EV_CACHE_PUT', function (x) {
Object.keys(x).forEach(function (k) { Object.keys(x).forEach(function (k) {
localStorage['CRYPTPAD_CACHE|' + k] = x[k]; localStorage['CRYPTPAD_CACHE|' + k] = x[k];

Loading…
Cancel
Save