|
|
@ -42,6 +42,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var APP = window.APP = {
|
|
|
|
var APP = window.APP = {
|
|
|
|
editable: false,
|
|
|
|
editable: false,
|
|
|
|
|
|
|
|
online: true,
|
|
|
|
mobile: function () {
|
|
|
|
mobile: function () {
|
|
|
|
if (window.matchMedia) { return !window.matchMedia('(any-pointer:fine)').matches; }
|
|
|
|
if (window.matchMedia) { return !window.matchMedia('(any-pointer:fine)').matches; }
|
|
|
|
else { return $('body').width() <= 600; }
|
|
|
|
else { return $('body').width() <= 600; }
|
|
|
@ -267,13 +268,25 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Handle disconnect/reconnect
|
|
|
|
// Handle disconnect/reconnect
|
|
|
|
var setEditable = function (state, isHistory) {
|
|
|
|
// If isHistory and isSf are both false, update the "APP.online" flag
|
|
|
|
|
|
|
|
// If isHistory is true, update the "APP.history" flag
|
|
|
|
|
|
|
|
// isSf is used to detect offline shared folders: setEditable is called on displayDirectory
|
|
|
|
|
|
|
|
var setEditable = function (state, isHistory, isSf) {
|
|
|
|
if (APP.closed || !APP.$content || !$.contains(document.documentElement, APP.$content[0])) { return; }
|
|
|
|
if (APP.closed || !APP.$content || !$.contains(document.documentElement, APP.$content[0])) { return; }
|
|
|
|
|
|
|
|
if (isHistory) {
|
|
|
|
|
|
|
|
APP.history = !state;
|
|
|
|
|
|
|
|
} else if (!isSf) {
|
|
|
|
|
|
|
|
APP.online = state;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
state = APP.online && !APP.history && state;
|
|
|
|
APP.editable = !APP.readOnly && state;
|
|
|
|
APP.editable = !APP.readOnly && state;
|
|
|
|
|
|
|
|
|
|
|
|
if (!state) {
|
|
|
|
if (!state) {
|
|
|
|
APP.$content.addClass('cp-app-drive-readonly');
|
|
|
|
APP.$content.addClass('cp-app-drive-readonly');
|
|
|
|
if (!isHistory) {
|
|
|
|
if (!APP.history || !APP.online) {
|
|
|
|
$('#cp-app-drive-connection-state').show();
|
|
|
|
$('#cp-app-drive-connection-state').show();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$('#cp-app-drive-connection-state').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$('[draggable="true"]').attr('draggable', false);
|
|
|
|
$('[draggable="true"]').attr('draggable', false);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3670,6 +3683,15 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var readOnlyFolder = false;
|
|
|
|
var readOnlyFolder = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If the shared folder is offline, add the "DISCONNECTED" banner, otherwise
|
|
|
|
|
|
|
|
// use the normal "editable" behavior (based on drive offline or history mode)
|
|
|
|
|
|
|
|
if (sfId && manager.folders[sfId].offline) {
|
|
|
|
|
|
|
|
setEditable(false, false, true);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
setEditable(true, false, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (APP.readOnly) {
|
|
|
|
if (APP.readOnly) {
|
|
|
|
// Read-only drive (team?)
|
|
|
|
// Read-only drive (team?)
|
|
|
|
$content.prepend($readOnly.clone());
|
|
|
|
$content.prepend($readOnly.clone());
|
|
|
|