|
|
@ -35,7 +35,6 @@ define([
|
|
|
|
var divMid = h('div.cp-share-column-mid', addBtn);
|
|
|
|
var divMid = h('div.cp-share-column-mid', addBtn);
|
|
|
|
var div2 = h('div.cp-share-column.cp-ownership');
|
|
|
|
var div2 = h('div.cp-share-column.cp-ownership');
|
|
|
|
var $div1 = $(div1);
|
|
|
|
var $div1 = $(div1);
|
|
|
|
$divMid = $(divMid);
|
|
|
|
|
|
|
|
var $div2 = $(div2);
|
|
|
|
var $div2 = $(div2);
|
|
|
|
|
|
|
|
|
|
|
|
// Remove owner column
|
|
|
|
// Remove owner column
|
|
|
@ -65,35 +64,17 @@ define([
|
|
|
|
edPublic: ed,
|
|
|
|
edPublic: ed,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var msg = pending ? Messages.owner_removePendingText
|
|
|
|
|
|
|
|
: Messages.owner_removeText;
|
|
|
|
var remove = function (el) {
|
|
|
|
var removeCol = UIElements.getUserGrid(msg, {
|
|
|
|
|
|
|
|
common: common,
|
|
|
|
|
|
|
|
large: true,
|
|
|
|
|
|
|
|
data: _owners,
|
|
|
|
|
|
|
|
noFilter: true
|
|
|
|
|
|
|
|
}, function () {
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var $div = $(removeCol.div);
|
|
|
|
|
|
|
|
// When clicking on the remove button, we check the selected users.
|
|
|
|
|
|
|
|
// If you try to remove yourself, we'll display an additional warning message
|
|
|
|
|
|
|
|
var btnMsg = pending ? Messages.owner_removePendingButton : Messages.owner_removeButton;
|
|
|
|
|
|
|
|
var removeButton = h('button.no-margin', btnMsg);
|
|
|
|
|
|
|
|
$(removeButton).click(function () {
|
|
|
|
|
|
|
|
// Check selection
|
|
|
|
// Check selection
|
|
|
|
var $sel = $div.find('.cp-usergrid-user.cp-selected');
|
|
|
|
|
|
|
|
var sel = $sel.toArray();
|
|
|
|
|
|
|
|
if (!sel.length) { return; }
|
|
|
|
|
|
|
|
var me = false;
|
|
|
|
var me = false;
|
|
|
|
var toRemove = sel.map(function (el) {
|
|
|
|
var $el = $(el);
|
|
|
|
var ed = $(el).attr('data-ed');
|
|
|
|
var ed = $el.attr('data-ed');
|
|
|
|
if (!ed) { return; }
|
|
|
|
if (!ed) { return; }
|
|
|
|
if (teamOwner && teams[teamOwner] && teams[teamOwner].edPublic === ed) { me = true; }
|
|
|
|
if (teamOwner && teams[teamOwner] && teams[teamOwner].edPublic === ed) { me = true; }
|
|
|
|
if (ed === edPublic && !teamOwner) { me = true; }
|
|
|
|
if (ed === edPublic && !teamOwner) { me = true; }
|
|
|
|
return ed;
|
|
|
|
|
|
|
|
}).filter(function (x) { return x; });
|
|
|
|
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
var msg = me ? Messages.owner_removeMeConfirm : Messages.owner_removeConfirm;
|
|
|
|
var msg = me ? Messages.owner_removeMeConfirm : Messages.owner_removeConfirm; // XXX check existing keys
|
|
|
|
UI.confirm(msg, waitFor(function (yes) {
|
|
|
|
UI.confirm(msg, waitFor(function (yes) {
|
|
|
|
if (!yes) {
|
|
|
|
if (!yes) {
|
|
|
|
waitFor.abort();
|
|
|
|
waitFor.abort();
|
|
|
@ -105,7 +86,7 @@ define([
|
|
|
|
sframeChan.query('Q_SET_PAD_METADATA', {
|
|
|
|
sframeChan.query('Q_SET_PAD_METADATA', {
|
|
|
|
channel: channel,
|
|
|
|
channel: channel,
|
|
|
|
command: pending ? 'RM_PENDING_OWNERS' : 'RM_OWNERS',
|
|
|
|
command: pending ? 'RM_PENDING_OWNERS' : 'RM_OWNERS',
|
|
|
|
value: toRemove,
|
|
|
|
value: [ed],
|
|
|
|
teamId: teamOwner
|
|
|
|
teamId: teamOwner
|
|
|
|
}, waitFor(function (err, res) {
|
|
|
|
}, waitFor(function (err, res) {
|
|
|
|
err = err || (res && res.error);
|
|
|
|
err = err || (res && res.error);
|
|
|
@ -119,24 +100,34 @@ define([
|
|
|
|
UI.log(Messages.saved);
|
|
|
|
UI.log(Messages.saved);
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
sel.forEach(function (el) {
|
|
|
|
var curve = $el.attr('data-curve');
|
|
|
|
var curve = $(el).attr('data-curve');
|
|
|
|
var friend = curve === user.curvePublic ? user : friends[curve];
|
|
|
|
var friend = curve === user.curvePublic ? user : friends[curve];
|
|
|
|
if (!friend) { return; }
|
|
|
|
if (!friend) { return; }
|
|
|
|
common.mailbox.sendTo("RM_OWNER", {
|
|
|
|
common.mailbox.sendTo("RM_OWNER", {
|
|
|
|
channel: channel,
|
|
|
|
channel: channel,
|
|
|
|
title: data.title,
|
|
|
|
title: data.title,
|
|
|
|
pending: pending
|
|
|
|
pending: pending
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
channel: friend.notifications,
|
|
|
|
channel: friend.notifications,
|
|
|
|
curvePublic: friend.curvePublic
|
|
|
|
curvePublic: friend.curvePublic
|
|
|
|
}, waitFor());
|
|
|
|
}, waitFor());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
redrawAll(true);
|
|
|
|
redrawAll(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var msg = pending ? Messages.owner_removePendingText
|
|
|
|
|
|
|
|
: Messages.owner_removeText;
|
|
|
|
|
|
|
|
var removeCol = UIElements.getUserGrid(msg, {
|
|
|
|
|
|
|
|
common: common,
|
|
|
|
|
|
|
|
large: true,
|
|
|
|
|
|
|
|
data: _owners,
|
|
|
|
|
|
|
|
noSelect: true,
|
|
|
|
|
|
|
|
list: true,
|
|
|
|
|
|
|
|
remove: remove
|
|
|
|
|
|
|
|
}, function () {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$div.append(h('p', removeButton));
|
|
|
|
var $div = $(removeCol.div);
|
|
|
|
return $div;
|
|
|
|
return $div;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -415,7 +406,6 @@ define([
|
|
|
|
opts = opts || {};
|
|
|
|
opts = opts || {};
|
|
|
|
|
|
|
|
|
|
|
|
var priv = common.getMetadataMgr().getPrivateData();
|
|
|
|
var priv = common.getMetadataMgr().getPrivateData();
|
|
|
|
var edPublic = priv.edPublic;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $div = $(h('div.cp-share-columns'));
|
|
|
|
var $div = $(h('div.cp-share-columns'));
|
|
|
|
if (!data) { return void cb(void 0, $div); }
|
|
|
|
if (!data) { return void cb(void 0, $div); }
|
|
|
@ -445,8 +435,7 @@ define([
|
|
|
|
]));
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var $pwLabel = $('<label>', {'for': 'cp-app-prop-password'})
|
|
|
|
$('<label>', {'for': 'cp-app-prop-password'}).text(Messages.creation_passwordValue).appendTo($d);
|
|
|
|
.text(Messages.creation_passwordValue).appendTo($d);
|
|
|
|
|
|
|
|
var password = UI.passwordInput({
|
|
|
|
var password = UI.passwordInput({
|
|
|
|
id: 'cp-app-prop-password',
|
|
|
|
id: 'cp-app-prop-password',
|
|
|
|
readonly: 'readonly'
|
|
|
|
readonly: 'readonly'
|
|
|
|