|
|
@ -1936,6 +1936,44 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var getIcon = UI.getIcon;
|
|
|
|
var getIcon = UI.getIcon;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var createShareButton = function (id, $container) {
|
|
|
|
|
|
|
|
var $shareBlock = $('<button>', {
|
|
|
|
|
|
|
|
'class': 'cp-toolbar-share-button',
|
|
|
|
|
|
|
|
title: Messages.shareButton
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$sharedIcon.clone().appendTo($shareBlock);
|
|
|
|
|
|
|
|
$('<span>').text(Messages.shareButton).appendTo($shareBlock);
|
|
|
|
|
|
|
|
var data = manager.getSharedFolderData(id);
|
|
|
|
|
|
|
|
var parsed = (data.href && data.href.indexOf('#') !== -1) ? Hash.parsePadUrl(data.href) : {};
|
|
|
|
|
|
|
|
var roParsed = Hash.parsePadUrl(data.roHref) || {};
|
|
|
|
|
|
|
|
if (!parsed.hash && !roParsed.hash) { return void console.error("Invalid href: "+(data.href || data.roHref)); }
|
|
|
|
|
|
|
|
var friends = common.getFriends();
|
|
|
|
|
|
|
|
var ro = folders[id] && folders[id].version >= 2;
|
|
|
|
|
|
|
|
var modal = UIElements.createShareModal({
|
|
|
|
|
|
|
|
teamId: APP.team,
|
|
|
|
|
|
|
|
origin: APP.origin,
|
|
|
|
|
|
|
|
pathname: "/drive/",
|
|
|
|
|
|
|
|
friends: friends,
|
|
|
|
|
|
|
|
title: data.title,
|
|
|
|
|
|
|
|
password: data.password,
|
|
|
|
|
|
|
|
sharedFolder: true,
|
|
|
|
|
|
|
|
common: common,
|
|
|
|
|
|
|
|
hashes: {
|
|
|
|
|
|
|
|
editHash: parsed.hash,
|
|
|
|
|
|
|
|
viewHash: ro && roParsed.hash,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// If we're a viewer and this is an old shared folder (no read-only mode), we
|
|
|
|
|
|
|
|
// can't share the read-only URL and we don't have access to the edit one.
|
|
|
|
|
|
|
|
// We should hide the share button.
|
|
|
|
|
|
|
|
if (!modal) { return; }
|
|
|
|
|
|
|
|
$shareBlock.click(function () {
|
|
|
|
|
|
|
|
UI.openCustomModal(modal);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$container.append($shareBlock);
|
|
|
|
|
|
|
|
return $shareBlock;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Create the "li" element corresponding to the file/folder located in "path"
|
|
|
|
// Create the "li" element corresponding to the file/folder located in "path"
|
|
|
|
var createElement = function (path, elPath, root, isFolder) {
|
|
|
|
var createElement = function (path, elPath, root, isFolder) {
|
|
|
|
// Forbid drag&drop inside the trash
|
|
|
|
// Forbid drag&drop inside the trash
|
|
|
@ -2016,6 +2054,15 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
delete APP.newFolder;
|
|
|
|
delete APP.newFolder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isSharedFolder && APP.convertedFolder === element) {
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
|
|
var $fakeButton = createShareButton(element, $('<div>'));
|
|
|
|
|
|
|
|
if (!$fakeButton) { return; }
|
|
|
|
|
|
|
|
$fakeButton.click();
|
|
|
|
|
|
|
|
}, 100);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $element;
|
|
|
|
return $element;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -2553,43 +2600,6 @@ define([
|
|
|
|
$container.append($block);
|
|
|
|
$container.append($block);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createShareButton = function (id, $container) {
|
|
|
|
|
|
|
|
var $shareBlock = $('<button>', {
|
|
|
|
|
|
|
|
'class': 'cp-toolbar-share-button',
|
|
|
|
|
|
|
|
title: Messages.shareButton
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$sharedIcon.clone().appendTo($shareBlock);
|
|
|
|
|
|
|
|
$('<span>').text(Messages.shareButton).appendTo($shareBlock);
|
|
|
|
|
|
|
|
var data = manager.getSharedFolderData(id);
|
|
|
|
|
|
|
|
var parsed = (data.href && data.href.indexOf('#') !== -1) ? Hash.parsePadUrl(data.href) : {};
|
|
|
|
|
|
|
|
var roParsed = Hash.parsePadUrl(data.roHref) || {};
|
|
|
|
|
|
|
|
if (!parsed.hash && !roParsed.hash) { return void console.error("Invalid href: "+(data.href || data.roHref)); }
|
|
|
|
|
|
|
|
var friends = common.getFriends();
|
|
|
|
|
|
|
|
var ro = folders[id] && folders[id].version >= 2;
|
|
|
|
|
|
|
|
var modal = UIElements.createShareModal({
|
|
|
|
|
|
|
|
teamId: APP.team,
|
|
|
|
|
|
|
|
origin: APP.origin,
|
|
|
|
|
|
|
|
pathname: "/drive/",
|
|
|
|
|
|
|
|
friends: friends,
|
|
|
|
|
|
|
|
title: data.title,
|
|
|
|
|
|
|
|
password: data.password,
|
|
|
|
|
|
|
|
sharedFolder: true,
|
|
|
|
|
|
|
|
common: common,
|
|
|
|
|
|
|
|
hashes: {
|
|
|
|
|
|
|
|
editHash: parsed.hash,
|
|
|
|
|
|
|
|
viewHash: ro && roParsed.hash,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// If we're a viewer and this is an old shared folder (no read-only mode), we
|
|
|
|
|
|
|
|
// can't share the read-only URL and we don't have access to the edit one.
|
|
|
|
|
|
|
|
// We should hide the share button.
|
|
|
|
|
|
|
|
if (!modal) { return; }
|
|
|
|
|
|
|
|
$shareBlock.click(function () {
|
|
|
|
|
|
|
|
UI.openCustomModal(modal);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$container.append($shareBlock);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SORT_FOLDER_DESC = 'sortFoldersDesc';
|
|
|
|
var SORT_FOLDER_DESC = 'sortFoldersDesc';
|
|
|
|
var SORT_FILE_BY = 'sortFilesBy';
|
|
|
|
var SORT_FILE_BY = 'sortFilesBy';
|
|
|
|
var SORT_FILE_DESC = 'sortFilesDesc';
|
|
|
|
var SORT_FILE_DESC = 'sortFilesDesc';
|
|
|
@ -3485,6 +3495,9 @@ define([
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$content.scrollTop(s);
|
|
|
|
$content.scrollTop(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete APP.convertedFolder;
|
|
|
|
|
|
|
|
|
|
|
|
appStatus.ready(true);
|
|
|
|
appStatus.ready(true);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var displayDirectory = APP.displayDirectory = function (path, force) {
|
|
|
|
var displayDirectory = APP.displayDirectory = function (path, force) {
|
|
|
@ -4087,10 +4100,14 @@ define([
|
|
|
|
if (!res) { return; }
|
|
|
|
if (!res) { return; }
|
|
|
|
var password = $(convertContent).find('#cp-upload-password').val() || undefined;
|
|
|
|
var password = $(convertContent).find('#cp-upload-password').val() || undefined;
|
|
|
|
var owned = Util.isChecked($(convertContent).find('#cp-upload-owned'));
|
|
|
|
var owned = Util.isChecked($(convertContent).find('#cp-upload-owned'));
|
|
|
|
manager.convertFolderToSharedFolder(paths[0].path, owned, password, refresh);
|
|
|
|
manager.convertFolderToSharedFolder(paths[0].path, owned, password, function (err, obj) {
|
|
|
|
|
|
|
|
if (err || obj && obj.error) { return void console.error(err || obj.error); }
|
|
|
|
|
|
|
|
if (obj && obj.fId) { APP.convertedFolder = obj.fId; }
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else { // File
|
|
|
|
} else { // File or shared folder
|
|
|
|
var sf = manager.isSharedFolder(el);
|
|
|
|
var sf = manager.isSharedFolder(el);
|
|
|
|
data = sf ? manager.getSharedFolderData(el) : manager.getFileData(el);
|
|
|
|
data = sf ? manager.getSharedFolderData(el) : manager.getFileData(el);
|
|
|
|
parsed = (data.href && data.href.indexOf('#') !== -1) ? Hash.parsePadUrl(data.href) : {};
|
|
|
|
parsed = (data.href && data.href.indexOf('#') !== -1) ? Hash.parsePadUrl(data.href) : {};
|
|
|
|