Load shared folder and register change events in teams
This commit is contained in:
@@ -30,7 +30,9 @@ define([
|
||||
Messages)
|
||||
{
|
||||
var APP = {};
|
||||
var driveAPP = {};
|
||||
var driveAPP = {
|
||||
isTeam: true
|
||||
};
|
||||
//var SHARED_FOLDER_NAME = Messages.fm_sharedFolderName;
|
||||
|
||||
var copyObjectValue = function (objRef, objToCopy) {
|
||||
@@ -86,9 +88,11 @@ define([
|
||||
'back': {
|
||||
onClick: function (common) {
|
||||
var sframeChan = common.getSframeChannel();
|
||||
sframeChan.query('Q_SET_TEAM', null, function (err) {
|
||||
if (err) { return void console.error(err); }
|
||||
APP.buildUI(common);
|
||||
APP.module.execCommand('SUBSCRIBE', null, function () {
|
||||
sframeChan.query('Q_SET_TEAM', null, function (err) {
|
||||
if (err) { return void console.error(err); }
|
||||
APP.buildUI(common);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -248,9 +252,11 @@ define([
|
||||
h('li', a) // XXX
|
||||
])));
|
||||
$(a).click(function () {
|
||||
sframeChan.query('Q_SET_TEAM', id, function (err) {
|
||||
if (err) { return void console.error(err); }
|
||||
buildUI(common, true);
|
||||
APP.module.execCommand('SUBSCRIBE', id, function () {
|
||||
sframeChan.query('Q_SET_TEAM', id, function (err) {
|
||||
if (err) { return void console.error(err); }
|
||||
buildUI(common, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -304,7 +310,7 @@ define([
|
||||
});
|
||||
|
||||
makeBlock('drive', function (common, cb) {
|
||||
var $div = $('div.cp-team-drive').empty();
|
||||
$('div.cp-team-drive').empty();
|
||||
var content = [
|
||||
h('div.cp-app-drive-container', {tabindex:0}, [
|
||||
h('div#cp-app-drive-tree'),
|
||||
|
||||
@@ -38,6 +38,8 @@ define([
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
var teamId; // XXX
|
||||
var afterSecrets = function (Cryptpad, Utils, secret, cb) {
|
||||
return void cb();
|
||||
/*
|
||||
var hash = window.location.hash.slice(1);
|
||||
if (hash && Utils.LocalStore.isLoggedIn()) {
|
||||
return; // XXX How to add a shared folder?
|
||||
@@ -57,8 +59,9 @@ define([
|
||||
return void Cryptpad.loadSharedFolder(id, data, cb);
|
||||
}
|
||||
cb();
|
||||
*/
|
||||
};
|
||||
var addRpc = function (sframeChan, Cryptpad, Utils) {
|
||||
var addRpc = function (sframeChan, Cryptpad) {
|
||||
sframeChan.on('Q_SET_TEAM', function (data, cb) {
|
||||
teamId = data;
|
||||
cb();
|
||||
@@ -89,14 +92,8 @@ define([
|
||||
cb(obj);
|
||||
});
|
||||
});
|
||||
sframeChan.on('EV_DRIVE_SET_HASH', function (hash) {
|
||||
// Update the hash in the address bar
|
||||
if (!Utils.LocalStore.isLoggedIn()) { return; }
|
||||
var ohc = window.onhashchange;
|
||||
window.onhashchange = function () {};
|
||||
window.location.hash = hash || '';
|
||||
window.onhashchange = ohc;
|
||||
ohc({reset:true});
|
||||
sframeChan.on('EV_DRIVE_SET_HASH', function () {
|
||||
return;
|
||||
});
|
||||
Cryptpad.onNetworkDisconnect.reg(function () {
|
||||
sframeChan.event('EV_NETWORK_DISCONNECT');
|
||||
@@ -108,7 +105,7 @@ define([
|
||||
// Intercept events for the team drive and send them the required way
|
||||
if (obj.type !== 'team' ||
|
||||
['DRIVE_CHANGE', 'DRIVE_LOG', 'DRIVE_REMOVE'].indexOf(obj.data.ev) === -1) { return; }
|
||||
sframeChan.event(obj.data.ev, obj.data.data);
|
||||
sframeChan.event('EV_'+obj.data.ev, obj.data.data);
|
||||
});
|
||||
};
|
||||
SFCommonO.start({
|
||||
|
||||
Reference in New Issue
Block a user