fixing shared folder/file upload

This commit is contained in:
Jon Lambson 2017-10-18 12:10:29 -06:00
parent 0b52305043
commit 3409ddccec
1 changed files with 31 additions and 6 deletions

View File

@ -352,7 +352,7 @@ app.controller('websiteCtrl', [
vm.siteFiles = [];
vm.Sites.allContents = function (r) {
vm.copyR = r;
vm.strictPath = r.shareAccess.path;
vm.strictPath = r.shareAccess.path.replace(/\//, '');
var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.contents({
hostname: r.domain
@ -384,6 +384,7 @@ app.controller('websiteCtrl', [
};
vm.Sites.contents = function (r, dir) {
console.log("SEARCHING DIRECTORY ->", dir);
vm.displaySpinner = '';
var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.contents({
@ -436,8 +437,13 @@ app.controller('websiteCtrl', [
vm.getDirectories = function (dir) {
if (vm.copyR.shareAccess.path !== '/') {
vm.breadcrumbs.push(dir);
vm.breadcrumbsPath = vm.copyR.shareAccess.path + dir + '/';
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath);
if (vm.breadcrumbsPath.length === 0) {
var breadcrumblies = vm.strictPath + dir;
vm.breadcrumbsPath = breadcrumblies.split('/');
} else {
vm.breadcrumbsPath.push(dir);
}
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
} else {
vm.breadcrumbs.push(dir);
vm.breadcrumbsPath.push(dir);
@ -523,8 +529,14 @@ app.controller('websiteCtrl', [
if (r.shareAccess.path !== '/') {
vm.breadcrumbsPath;
vm.breadcrumbs;
r.folderName = vm.breadcrumbsPath + vm.folderName;
debugger;
if (vm.breadcrumbsPath.length === 0) {
vm.breadcrumbsPath = vm.strictPath.split('/');
vm.breadcrumbsPath.pop();
vm.breadcrumbsPath.push(vm.folderName);
debugger;
} else {
r.folderName = vm.breadcrumbsPath + vm.folderName;
}
} else {
if (vm.breadcrumbsPath.join('/') === '') {
r.folderName = '/' + vm.folderName + '/';
@ -538,12 +550,25 @@ app.controller('websiteCtrl', [
var pkg = Auth.oauth3.pkg('www@daplie.com');
//analyzeFile(r.newFile, r);
if (r.folderName !== '' && r.folderName !== undefined) {
r.uploadPath = r.folderName;
r.uploadPath = r.folderName + '/';
debugger;
} else {
if (!Array.isArray(vm.breadcrumbsPath)) {
debugger;
vm.breadcrumbsPath = vm.breadcrumbsPath.split('/');
vm.breadcrumbsPath.pop();
} else {
if (vm.breadcrumbsPath[0] !== '') {
vm.breadcrumbsPath.unshift('');
}
debugger;
}
if (vm.breadcrumbsPath.join('/') === '') {
r.uploadPath = '/';
debugger;
} else {
r.uploadPath = vm.breadcrumbsPath.join('/') + '/';
debugger;
}
}
vm._uploadFile(pkg, r);