better restrecited searches

This commit is contained in:
Jon Lambson 2017-10-27 17:11:28 -06:00
parent cd578bd85f
commit 369cca98b5
1 changed files with 39 additions and 6 deletions

View File

@ -360,6 +360,7 @@ app.controller('websiteCtrl', [
vm.Sites.allContents = function (r) { vm.Sites.allContents = function (r) {
vm.copyR = r; vm.copyR = r;
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
debugger;
return pkg.contents({ return pkg.contents({
hostname: r.domain hostname: r.domain
, domain: r.domain , domain: r.domain
@ -368,6 +369,8 @@ app.controller('websiteCtrl', [
//, sub: r.sub //, sub: r.sub
, path: r.shareAccess.path , path: r.shareAccess.path
}).then(function (result) { }).then(function (result) {
vm.cleanArrays();
debugger;
vm.folderStructure = result; vm.folderStructure = result;
result.data.forEach(function(data){ result.data.forEach(function(data){
if (data.file) { if (data.file) {
@ -395,11 +398,13 @@ app.controller('websiteCtrl', [
vm.Sites.contents = function (r, dir) { vm.Sites.contents = function (r, dir) {
vm.siteFiles = []; vm.siteFiles = [];
vm.siteDirectories = []; vm.siteDirectories = [];
dir = dir + '/';
cleanPathQuery(dir); cleanPathQuery(dir);
dir = vm.cleanedPath; dir = vm.cleanedPath;
vm.previousSearchQuery = dir; vm.previousSearchQuery = dir;
vm.displaySpinner = ''; vm.displaySpinner = '';
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
debugger;
return pkg.contents({ return pkg.contents({
hostname: r.domain, hostname: r.domain,
domain: r.domain, domain: r.domain,
@ -419,6 +424,7 @@ app.controller('websiteCtrl', [
vm.siteDirectories.push(data.name); vm.siteDirectories.push(data.name);
} }
}); });
vm.currentFolder = vm.breadcrumbs[vm.breadcrumbs.length - 1];
}); });
}; };
@ -426,10 +432,27 @@ app.controller('websiteCtrl', [
var str2arryQuery = cleanPathQuery(vm.breadcrumbsPath.join('/')); var str2arryQuery = cleanPathQuery(vm.breadcrumbsPath.join('/'));
var str2arry = vm.breadcrumbs; var str2arry = vm.breadcrumbs;
str2arryQuery = str2arryQuery.split('/'); str2arryQuery = str2arryQuery.split('/');
if (vm.copyR.shareAccess.path !== '/') {
var removeFromBreadcrumbsQuery = str2arryQuery.indexOf(crumb) + 1; var removeFromBreadcrumbsQuery = str2arryQuery.indexOf(crumb) + 1;
var removeFromBreadcrumbs = str2arry.indexOf(crumb) + 1; var removeFromBreadcrumbs = str2arry.indexOf(crumb) + 1;
vm.breadcrumbsPath = str2arryQuery.splice(0,removeFromBreadcrumbsQuery); vm.breadcrumbsPath = str2arryQuery.splice(0,removeFromBreadcrumbsQuery);
vm.breadcrumbs = str2arry.splice(0,removeFromBreadcrumbs); vm.breadcrumbs = str2arry.splice(0,removeFromBreadcrumbs);
var strictPath = vm.strictPath.slice(0, -1);
if (vm.breadcrumbsPath.join('/').indexOf(strictPath) !== 0) {
vm.breadcrumbsPath = strictPath.split('/');
vm.breadcrumbs = strictPath.split('/');
vm.breadcrumbs.shift();
var result = { data: { warning: true } };
vm.currentFolder = vm.breadcrumbs[vm.breadcrumbs.length - 2];
var msg = "You can only view " + "'" + vm.currentFolder + "'";
vm.buildNotification(result, msg);
}
} else {
var removeFromBreadcrumbsQuery = str2arryQuery.indexOf(crumb) + 1;
var removeFromBreadcrumbs = str2arry.indexOf(crumb) + 1;
vm.breadcrumbsPath = str2arryQuery.splice(0,removeFromBreadcrumbsQuery);
vm.breadcrumbs = str2arry.splice(0,removeFromBreadcrumbs);
}
}; };
var removeFolderCrumbsCleanUp = function (crumb) { var removeFolderCrumbsCleanUp = function (crumb) {
@ -441,6 +464,7 @@ app.controller('websiteCtrl', [
vm.breadcrumbsPath = str2arryQuery.splice(0,removeFromBreadcrumbsQuery); vm.breadcrumbsPath = str2arryQuery.splice(0,removeFromBreadcrumbsQuery);
vm.breadcrumbs = str2arry.splice(0,removeFromBreadcrumbs); vm.breadcrumbs = str2arry.splice(0,removeFromBreadcrumbs);
vm.copyR.fromFolder = vm.breadcrumbsPath.join('/'); vm.copyR.fromFolder = vm.breadcrumbsPath.join('/');
vm.currentFolder = vm.breadcrumbs[vm.breadcrumbs.length - 1];
}; };
vm.getDirectoriesFromBreadcrumbs = function (dir) { vm.getDirectoriesFromBreadcrumbs = function (dir) {
@ -539,8 +563,9 @@ app.controller('websiteCtrl', [
sharePath = cleanPathQuery(vm.breadcrumbsPath.join('/')); sharePath = cleanPathQuery(vm.breadcrumbsPath.join('/'));
sharePath = sharePath + '/'; sharePath = sharePath + '/';
} }
cleanPathQuery(sharePath);
opts = { opts = {
sharePath: sharePath, sharePath: vm.cleanedPath,
shareMode: vm.copiedShareMode shareMode: vm.copiedShareMode
}; };
vm.Shares.invite(r, opts); vm.Shares.invite(r, opts);
@ -799,7 +824,15 @@ app.controller('websiteCtrl', [
hidden: '', hidden: '',
message: msg message: msg
}; };
} else { } else if (result.data.warning) {
vm.alertNotification = {
className: 'warning',
title: 'Warning',
hidden: '',
message: msg
};
}
else {
vm.alertNotification = { vm.alertNotification = {
className: 'success', className: 'success',
title: 'Success', title: 'Success',