|
|
@ -1032,21 +1032,18 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; }
|
|
|
|
if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
var createAccessRights = function (group_name) {
|
|
|
|
var rights = h('div', [
|
|
|
|
var rights = [
|
|
|
|
h('label', Messages.share_linkAccess),
|
|
|
|
h('label', Messages.share_linkAccess),
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
UI.createRadio('accessRights', 'cp-share-editable-false',
|
|
|
|
UI.createRadio(group_name, 'cp-share-editable-false',
|
|
|
|
Messages.share_linkView, true, { mark: {tabindex:1} }),
|
|
|
|
Messages.share_linkView, true, { mark: {tabindex:1} }),
|
|
|
|
UI.createRadio('accessRights', 'cp-share-present',
|
|
|
|
UI.createRadio(group_name, 'cp-share-present',
|
|
|
|
Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad
|
|
|
|
Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad
|
|
|
|
UI.createRadio('accessRights', 'cp-share-editable-true',
|
|
|
|
UI.createRadio(group_name, 'cp-share-editable-true',
|
|
|
|
Messages.share_linkEdit, false, { mark: {tabindex:1} }),
|
|
|
|
Messages.share_linkEdit, false, { mark: {tabindex:1} }),
|
|
|
|
|
|
|
|
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
]);
|
|
|
|
];
|
|
|
|
|
|
|
|
return rights;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Share link tab
|
|
|
|
// Share link tab
|
|
|
|
var content = [];
|
|
|
|
var content = [];
|
|
|
@ -1054,13 +1051,13 @@ define([
|
|
|
|
h('label', Messages.sharedFolders_share),
|
|
|
|
h('label', Messages.sharedFolders_share),
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
var linkAccessRights = createAccessRights('link-rights');
|
|
|
|
|
|
|
|
var padContent = [
|
|
|
|
var padContent = [
|
|
|
|
UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }),
|
|
|
|
UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }),
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); }
|
|
|
|
if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); }
|
|
|
|
Array.prototype.push.apply(content, linkAccessRights);
|
|
|
|
Array.prototype.push.apply(content);
|
|
|
|
if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); }
|
|
|
|
if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); }
|
|
|
|
content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 }));
|
|
|
|
content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 }));
|
|
|
|
|
|
|
|
|
|
|
@ -1069,9 +1066,9 @@ define([
|
|
|
|
var link = h('div.cp-share-modal', content);
|
|
|
|
var link = h('div.cp-share-modal', content);
|
|
|
|
|
|
|
|
|
|
|
|
var saveValue = function () {
|
|
|
|
var saveValue = function () {
|
|
|
|
var edit = Util.isChecked($(link).find('#cp-share-editable-true'));
|
|
|
|
var edit = Util.isChecked($(rights).find('#cp-share-editable-true'));
|
|
|
|
var embed = Util.isChecked($(link).find('#cp-share-embed'));
|
|
|
|
var embed = Util.isChecked($(link).find('#cp-share-embed'));
|
|
|
|
var present = Util.isChecked($(link).find('#cp-share-present'));
|
|
|
|
var present = Util.isChecked($(rights).find('#cp-share-present'));
|
|
|
|
common.setAttribute(['general', 'share'], {
|
|
|
|
common.setAttribute(['general', 'share'], {
|
|
|
|
edit: edit,
|
|
|
|
edit: edit,
|
|
|
|
embed: embed,
|
|
|
|
embed: embed,
|
|
|
@ -1081,10 +1078,9 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var getLinkValue = function (initValue) {
|
|
|
|
var getLinkValue = function (initValue) {
|
|
|
|
var val = initValue || {};
|
|
|
|
var val = initValue || {};
|
|
|
|
var edit = val.edit !== undefined ? val.edit : Util.isChecked($(link).find('#cp-share-editable-true'));
|
|
|
|
var edit = val.edit !== undefined ? val.edit : Util.isChecked($(rights).find('#cp-share-editable-true'));
|
|
|
|
var embed = val.embed !== undefined ? val.embed : Util.isChecked($(link).find('#cp-share-embed'));
|
|
|
|
var embed = val.embed !== undefined ? val.embed : Util.isChecked($(link).find('#cp-share-embed'));
|
|
|
|
var present = val.present !== undefined ? val.present : Util.isChecked($(link).find('#cp-share-present'));
|
|
|
|
var present = val.present !== undefined ? val.present : Util.isChecked($(rights).find('#cp-share-present'));
|
|
|
|
|
|
|
|
|
|
|
|
var hash = (!hashes.viewHash || (edit && hashes.editHash)) ? hashes.editHash : hashes.viewHash;
|
|
|
|
var hash = (!hashes.viewHash || (edit && hashes.editHash)) ? hashes.editHash : hashes.viewHash;
|
|
|
|
var href = origin + pathname + '#' + hash;
|
|
|
|
var href = origin + pathname + '#' + hash;
|
|
|
|
var parsed = Hash.parsePadUrl(href);
|
|
|
|
var parsed = Hash.parsePadUrl(href);
|
|
|
@ -1098,41 +1094,40 @@ define([
|
|
|
|
keys: [27]};
|
|
|
|
keys: [27]};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var linkButtons = [makeCancelButton()];
|
|
|
|
var linkButtons = [
|
|
|
|
|
|
|
|
makeCancelButton(),
|
|
|
|
if (!config.sharedFolder) {
|
|
|
|
!config.sharedFolder && {
|
|
|
|
linkButtons.push({
|
|
|
|
className: 'secondary', // XXX style this diferently than cancel
|
|
|
|
className: 'secondary', // XXX style this diferently than cancel
|
|
|
|
name: Messages.share_linkOpen,
|
|
|
|
name: Messages.share_linkOpen,
|
|
|
|
onClick: function () {
|
|
|
|
onClick: function () {
|
|
|
|
saveValue();
|
|
|
|
saveValue();
|
|
|
|
var v = getLinkValue();
|
|
|
|
var v = getLinkValue();
|
|
|
|
window.open(v);
|
|
|
|
window.open(v);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
keys: [[13, 'ctrl']]
|
|
|
|
keys: [[13, 'ctrl']]
|
|
|
|
},
|
|
|
|
});
|
|
|
|
{
|
|
|
|
};
|
|
|
|
className: 'primary',
|
|
|
|
|
|
|
|
name: Messages.share_linkCopy,
|
|
|
|
|
|
|
|
onClick: function () {
|
|
|
|
|
|
|
|
saveValue();
|
|
|
|
|
|
|
|
var v = getLinkValue();
|
|
|
|
|
|
|
|
var success = Clipboard.copy(v);
|
|
|
|
|
|
|
|
if (success) { UI.log(Messages.shareSuccess); }
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
keys: [13]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
linkButtons.push({
|
|
|
|
|
|
|
|
className: 'primary',
|
|
|
|
|
|
|
|
name: Messages.share_linkCopy,
|
|
|
|
|
|
|
|
onClick: function () {
|
|
|
|
|
|
|
|
saveValue();
|
|
|
|
|
|
|
|
var v = getLinkValue();
|
|
|
|
|
|
|
|
var success = Clipboard.copy(v);
|
|
|
|
|
|
|
|
if (success) { UI.log(Messages.shareSuccess); }
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
keys: [13]}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $link = $(link);
|
|
|
|
// disable edit share options if you don't have edit rights
|
|
|
|
|
|
|
|
|
|
|
|
if (!hashes.editHash) {
|
|
|
|
if (!hashes.editHash) {
|
|
|
|
$(link).find('#cp-share-editable-false').attr('checked', true);
|
|
|
|
$(rights).find('#cp-share-editable-false').attr('checked', true);
|
|
|
|
$(link).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true);
|
|
|
|
$(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true);
|
|
|
|
} else if (!hashes.viewHash) {
|
|
|
|
} else if (!hashes.viewHash) {
|
|
|
|
$(link).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true);
|
|
|
|
$(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true);
|
|
|
|
$(link).find('#cp-share-editable-true').attr('checked', true);
|
|
|
|
$(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true);
|
|
|
|
|
|
|
|
$(rights).find('#cp-share-editable-true').attr('checked', true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$(link).find('#cp-share-link-preview').val(getLinkValue());
|
|
|
|
$(link).find('#cp-share-link-preview').val(getLinkValue());
|
|
|
@ -1156,8 +1151,9 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
onFriendShare.reg(saveValue);
|
|
|
|
onFriendShare.reg(saveValue);
|
|
|
|
|
|
|
|
|
|
|
|
var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : '';
|
|
|
|
// XXX Don't display access rights if no contacts
|
|
|
|
var contacts = h('.cp-share-modal', contactsAccessRights);
|
|
|
|
/// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : '';
|
|
|
|
|
|
|
|
var contacts = h('div.cp-share-modal');
|
|
|
|
var $contacts = $(contacts);
|
|
|
|
var $contacts = $(contacts);
|
|
|
|
|
|
|
|
|
|
|
|
$(friendsList).appendTo($contacts);
|
|
|
|
$(friendsList).appendTo($contacts);
|
|
|
@ -1187,7 +1183,9 @@ define([
|
|
|
|
className: 'primary',
|
|
|
|
className: 'primary',
|
|
|
|
name: Messages.share_linkCopy,
|
|
|
|
name: Messages.share_linkCopy,
|
|
|
|
onClick: function () {
|
|
|
|
onClick: function () {
|
|
|
|
var v = getEmbedValue();
|
|
|
|
var v = getLinkValue({
|
|
|
|
|
|
|
|
embed: true
|
|
|
|
|
|
|
|
});
|
|
|
|
var success = Clipboard.copy(v);
|
|
|
|
var success = Clipboard.copy(v);
|
|
|
|
if (success) { UI.log(Messages.shareSuccess); }
|
|
|
|
if (success) { UI.log(Messages.shareSuccess); }
|
|
|
|
},
|
|
|
|
},
|
|
|
|