|
|
|
@ -271,14 +271,12 @@ define([
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
|
console.log('koko');
|
|
|
|
|
// Send the command
|
|
|
|
|
sframeChan.query('Q_SET_PAD_METADATA', {
|
|
|
|
|
channel: channel,
|
|
|
|
|
command: 'ADD_PENDING_OWNERS',
|
|
|
|
|
value: toAdd
|
|
|
|
|
}, waitFor(function (err, res) {
|
|
|
|
|
console.error(arguments);
|
|
|
|
|
err = err || (res && res.error);
|
|
|
|
|
if (err) {
|
|
|
|
|
waitFor.abort();
|
|
|
|
@ -286,8 +284,6 @@ define([
|
|
|
|
|
} // XXX
|
|
|
|
|
}));
|
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
|
console.log('okok');
|
|
|
|
|
// TODO send notifications
|
|
|
|
|
sel.forEach(function (el) {
|
|
|
|
|
var friend = friends[$(el).attr('data-curve')];
|
|
|
|
|
if (!friend) { return; }
|
|
|
|
@ -318,13 +314,17 @@ define([
|
|
|
|
|
return $div2;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var pending = false;
|
|
|
|
|
redrawAll = function () {
|
|
|
|
|
$div1.empty();
|
|
|
|
|
$div2.empty();
|
|
|
|
|
if (pending) { return; }
|
|
|
|
|
pending = true;
|
|
|
|
|
common.getPadMetadata(null, function (obj) {
|
|
|
|
|
pending = false;
|
|
|
|
|
if (obj && obj.error) { return; }
|
|
|
|
|
owners = obj.owners;
|
|
|
|
|
pending_owners = obj.pending_owners;
|
|
|
|
|
$div1.empty();
|
|
|
|
|
$div2.empty();
|
|
|
|
|
$div1.append(drawRemove(false)).append(drawRemove(true));
|
|
|
|
|
$div2.append(drawAdd());
|
|
|
|
|
});
|
|
|
|
@ -333,6 +333,15 @@ define([
|
|
|
|
|
$div1.append(drawRemove(false)).append(drawRemove(true));
|
|
|
|
|
$div2.append(drawAdd());
|
|
|
|
|
|
|
|
|
|
var handler = sframeChan.on('EV_RT_METADATA', function (md) {
|
|
|
|
|
if (!$div1.length) {
|
|
|
|
|
return void handler.stop();
|
|
|
|
|
}
|
|
|
|
|
owners = md.owners;
|
|
|
|
|
pending_owners = md.pending_owners;
|
|
|
|
|
redrawAll();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Create modal
|
|
|
|
|
var link = h('div.cp-share-columns', [
|
|
|
|
|
div1,
|
|
|
|
@ -349,9 +358,11 @@ define([
|
|
|
|
|
return UI.dialog.customModal(link, {buttons: linkButtons});
|
|
|
|
|
};
|
|
|
|
|
var getRightsProperties = function (common, data, cb) {
|
|
|
|
|
var $d = $('<div>');
|
|
|
|
|
if (!data) { return void cb(void 0, $d); }
|
|
|
|
|
var $div = $('<div>');
|
|
|
|
|
if (!data) { return void cb(void 0, $div); }
|
|
|
|
|
|
|
|
|
|
var draw = function () {
|
|
|
|
|
var $d = $('<div>');
|
|
|
|
|
$('<label>', {'for': 'cp-app-prop-owners'}).text(Messages.creation_owners)
|
|
|
|
|
.appendTo($d);
|
|
|
|
|
var owners = Messages.creation_noOwner;
|
|
|
|
@ -480,8 +491,25 @@ define([
|
|
|
|
|
$d.append(changePass);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $d;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
cb(void 0, $d);
|
|
|
|
|
var sframeChan = common.getSframeChannel();
|
|
|
|
|
var handler = sframeChan.on('EV_RT_METADATA', function (md) {
|
|
|
|
|
if (!$div.length) {
|
|
|
|
|
handler.stop();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
md = JSON.parse(JSON.stringify(md));
|
|
|
|
|
data.owners = md.owners;
|
|
|
|
|
data.expire = md.expire;
|
|
|
|
|
data.pending_owners = md.pending_owners;
|
|
|
|
|
$div.empty();
|
|
|
|
|
$div.append(draw());
|
|
|
|
|
});
|
|
|
|
|
$div.append(draw());
|
|
|
|
|
|
|
|
|
|
cb(void 0, $div);
|
|
|
|
|
};
|
|
|
|
|
var getPadProperties = function (common, data, cb) {
|
|
|
|
|
var $d = $('<div>');
|
|
|
|
@ -568,6 +596,8 @@ define([
|
|
|
|
|
} else {
|
|
|
|
|
cb(void 0, $d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
UIElements.getProperties = function (common, data, cb) {
|
|
|
|
|
var c1;
|
|
|
|
|