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