some validations
This commit is contained in:
parent
2c696b642b
commit
107b6549c9
|
@ -348,9 +348,9 @@ app.controller('websiteCtrl', [
|
||||||
};
|
};
|
||||||
vm.Sites.upload = function (r) {
|
vm.Sites.upload = function (r) {
|
||||||
if (r.uploadPath === undefined) {
|
if (r.uploadPath === undefined) {
|
||||||
r.uploadPath = vm.breadcrumbsPath.join('');
|
r.uploadPath = vm.breadcrumbsPath.join('/');
|
||||||
} else {
|
} else {
|
||||||
r.uploadPath = vm.breadcrumbsPath.join('') + vm.autoPopulateWebPath;
|
r.uploadPath = vm.breadcrumbsPath.join('/') + vm.autoPopulateWebPath;
|
||||||
}
|
}
|
||||||
vm.copyr = r;
|
vm.copyr = r;
|
||||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
|
@ -376,14 +376,14 @@ app.controller('websiteCtrl', [
|
||||||
|
|
||||||
vm.Sites.remove = function (r, opts) {
|
vm.Sites.remove = function (r, opts) {
|
||||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
vm.pathRemoved = r.path || opts.path;
|
vm.pathRemoved = opts.path;
|
||||||
return pkg.remove({
|
return pkg.remove({
|
||||||
hostname: r.domain
|
hostname: r.domain
|
||||||
, domain: r.domain
|
, domain: r.domain
|
||||||
, tld: r.tld
|
, tld: r.tld
|
||||||
, sld: r.sld
|
, sld: r.sld
|
||||||
//, sub: vm.record.sub
|
//, sub: vm.record.sub
|
||||||
, path: opts.path || r.path
|
, path: opts.path
|
||||||
, confirm: opts.confirm || r.confirm
|
, confirm: opts.confirm || r.confirm
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
var msg = "'"+ vm.pathRemoved + "'" + ' has been removed';
|
var msg = "'"+ vm.pathRemoved + "'" + ' has been removed';
|
||||||
|
@ -403,7 +403,7 @@ app.controller('websiteCtrl', [
|
||||||
} else if (path.includes(".")) {
|
} else if (path.includes(".")) {
|
||||||
confirmMessage = "Delete this file?";
|
confirmMessage = "Delete this file?";
|
||||||
if (vm.autoPopulateWebPath === undefined) {
|
if (vm.autoPopulateWebPath === undefined) {
|
||||||
opts.path = path;
|
opts.path = r.shareAccess.path + path;
|
||||||
} else {
|
} else {
|
||||||
opts.path = vm.autoPopulateWebPath + path;
|
opts.path = vm.autoPopulateWebPath + path;
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,15 @@ app.controller('websiteCtrl', [
|
||||||
vm.breadcrumbs = breadcrumbs.splice(0,removeFromBreadcrumbs);
|
vm.breadcrumbs = breadcrumbs.splice(0,removeFromBreadcrumbs);
|
||||||
var updatebreadcrumbsPath = vm.breadcrumbsPath;
|
var updatebreadcrumbsPath = vm.breadcrumbsPath;
|
||||||
vm.autoPopulateWebPath = updatebreadcrumbsPath.join('');
|
vm.autoPopulateWebPath = updatebreadcrumbsPath.join('');
|
||||||
vm.autoPopulateWebPath = vm.autoPopulateWebPath+"/";
|
vm.autoPopulateWebPath = vm.autoPopulateWebPath + '/';
|
||||||
|
vm.breadcrumbsPath.push('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (site.shareAccess !== undefined) {
|
||||||
|
if (site.shareAccess.path !== '/') {
|
||||||
|
vm.breadcrumbsPath = site.shareAccess.path.split('/');
|
||||||
|
vm.breadcrumbs = site.shareAccess.path.split('/');
|
||||||
|
vm.breadcrumbs.splice(0,1,'root');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,6 +527,7 @@ app.controller('websiteCtrl', [
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.getDirectories = function (path) {
|
vm.getDirectories = function (path) {
|
||||||
|
debugger;
|
||||||
vm.displaySpinner = '';
|
vm.displaySpinner = '';
|
||||||
vm.siteDirectories = [];
|
vm.siteDirectories = [];
|
||||||
vm.siteFiles = [];
|
vm.siteFiles = [];
|
||||||
|
@ -530,6 +539,7 @@ app.controller('websiteCtrl', [
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.getDirectoriesFromBreadcrumbs = function (dir) {
|
vm.getDirectoriesFromBreadcrumbs = function (dir) {
|
||||||
|
debugger;
|
||||||
if (dir === 'root') {
|
if (dir === 'root') {
|
||||||
vm.showFolderAction = true;
|
vm.showFolderAction = true;
|
||||||
vm.showUploadButton = true;
|
vm.showUploadButton = true;
|
||||||
|
@ -702,6 +712,27 @@ app.controller('websiteCtrl', [
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
vm.checkShareRights = function (r) {
|
||||||
|
if (r.invitedBy) {
|
||||||
|
r.shareAccess = { write: false, read: false, invite: false };
|
||||||
|
if (r.mode.includes('w')) {
|
||||||
|
r.shareAccess.write = true;
|
||||||
|
}
|
||||||
|
if (r.mode.includes('r')) {
|
||||||
|
r.shareAccess.read = true;
|
||||||
|
}
|
||||||
|
if (r.mode.includes('x')) {
|
||||||
|
r.shareAccess.invite = true;
|
||||||
|
}
|
||||||
|
r.shareAccess.path = r.path;
|
||||||
|
console.log(r.shareAccess);
|
||||||
|
} else {
|
||||||
|
r.shareAccess = { write: true, read: true, invite: true, path: '/' };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.$watch('vm.selectedDomain', function (domainSelected) {
|
$scope.$watch('vm.selectedDomain', function (domainSelected) {
|
||||||
if (domainSelected !== undefined) {
|
if (domainSelected !== undefined) {
|
||||||
vm.dom = domainSelected.description;
|
vm.dom = domainSelected.description;
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
<div class="card__content">
|
<div class="card__content">
|
||||||
<div class="card__title text-center"><a ng-href="https://{{ r.domain }}" target="_blank" ng-bind="r.domain">example.com</a></div>
|
<div class="card__title text-center"><a ng-href="https://{{ r.domain }}" target="_blank" ng-bind="r.domain">example.com</a></div>
|
||||||
<div class="cards__title text-center"><span ng-if="r.pending" class="text-muted">(pending)</span></div>
|
<div class="cards__title text-center"><span ng-if="r.pending" class="text-muted">(pending)</span></div>
|
||||||
<button class="btn btn--block card__btn" data-toggle="modal" data-target=".{{ r.challenge }}" ng-click="vm.closeAllOpenActions()">Edit</button>
|
<button class="btn btn--block card__btn" data-toggle="modal" data-target=".{{ r.challenge }}" ng-click="vm.closeAllOpenActions(); vm.checkShareRights(r);">Edit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -157,7 +157,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="square-service-block">
|
<div class="square-service-block">
|
||||||
<a ng-click="vm.showAction('files'); vm.Sites.contents(r)" class="cp trigger-files-list-refresh">
|
<a ng-click="vm.showAction('files'); vm.Sites.contents(r);" class="cp trigger-files-list-refresh">
|
||||||
<div class="ssb-icon"><i class="fa fa-sitemap" aria-hidden="true"></i></div>
|
<div class="ssb-icon"><i class="fa fa-sitemap" aria-hidden="true"></i></div>
|
||||||
<h2 class="ssb-title">Files</h2>
|
<h2 class="ssb-title">Files</h2>
|
||||||
</a>
|
</a>
|
||||||
|
@ -192,6 +192,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="vm.showInviteContainer">
|
<div ng-show="vm.showInviteContainer">
|
||||||
|
<div ng-if="r.shareAccess.invite">
|
||||||
<h1><i class="fa fa-folder"></i> {{ vm.currentFolder | capitalize }}</h1>
|
<h1><i class="fa fa-folder"></i> {{ vm.currentFolder | capitalize }}</h1>
|
||||||
<form class="form-horizontal">
|
<form class="form-horizontal">
|
||||||
|
|
||||||
|
@ -215,6 +216,10 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-if="!r.shareAccess.invite">
|
||||||
|
<h3 class="text-muted">You do not have the correct permissions to invite or share files...</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div ng-show="vm.showSharesContainer">
|
<div ng-show="vm.showSharesContainer">
|
||||||
<div class="text-center {{ vm.displaySpinner }}">
|
<div class="text-center {{ vm.displaySpinner }}">
|
||||||
<i class="fa fa-spinner fa-spin fa-5x"></i>
|
<i class="fa fa-spinner fa-spin fa-5x"></i>
|
||||||
|
|
|
@ -14,23 +14,23 @@
|
||||||
<ul class="tree ls-none">
|
<ul class="tree ls-none">
|
||||||
<li class="directories-go-here" ng-repeat="directory in vm.siteDirectories track by $index">
|
<li class="directories-go-here" ng-repeat="directory in vm.siteDirectories track by $index">
|
||||||
<input type="checkbox" id="{{ r.challenge }}{{ $index }}" />
|
<input type="checkbox" id="{{ r.challenge }}{{ $index }}" />
|
||||||
<label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory); vm.cleanPath();" data="{{ directory }}">{{ directory }}</label><span class="pull-right"><button type="button" class="btn btn-danger btn-xs" ng-click="vm.deleteFilesFrom(r, directory)" data="{{ directory }}" ><i class="fa fa-trash"></i></button></span>
|
<label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory); vm.cleanPath();" data="{{ directory }}">{{ directory }}</label><span class="pull-right"><button ng-if="r.shareAccess.write" type="button" class="btn btn-danger btn-xs" ng-click="vm.deleteFilesFrom(r, directory)" data="{{ directory }}" ><i class="fa fa-trash"></i></button></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="tree files-only ls-none">
|
<ul class="tree files-only ls-none">
|
||||||
<li ng-repeat="file in vm.siteFiles track by $index">
|
<li ng-repeat="file in vm.siteFiles track by $index">
|
||||||
<span class="tree_label filez">{{ file }}</span><span class="pull-right"><button type="button" class="btn btn-danger btn-xs" ng-click="vm.deleteFilesFrom(r, file)" data="{{ file }}" ><i class="fa fa-trash"></i></button></span><br>
|
<span class="tree_label filez">{{ file }}</span><span class="pull-right"><button ng-if="r.shareAccess.write" type="button" class="btn btn-danger btn-xs" ng-click="vm.deleteFilesFrom(r, file)" data="{{ file }}" ><i class="fa fa-trash"></i></button></span><br>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="folder-actions">
|
<div class="folder-actions">
|
||||||
<hr>
|
<hr>
|
||||||
<div class="">
|
<div class="">
|
||||||
<button type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false" ng-show="vm.showUploadButton">Upload files</button>
|
<button ng-if="r.shareAccess.write" type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false" ng-show="vm.showUploadButton">Upload files</button>
|
||||||
<button type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showAction('invite');">Share folder</button>
|
<button ng-if="r.shareAccess.invite" type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showAction('invite');">Share folder</button>
|
||||||
<ul class="ls-none folder-actions-list">
|
<ul class="ls-none folder-actions-list">
|
||||||
<li class="" ng-hide="vm.showFolderAction"><span><i class="fa fa-upload cp"></i> <a ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false;" class="cp">Upload files</a></span></li>
|
<li ng-if="r.shareAccess.write" ng-hide="vm.showFolderAction"><span><i class="fa fa-upload cp"></i> <a ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false;" class="cp">Upload files</a></span></li>
|
||||||
<li class=""><span><i class="fa fa-folder cp"></i> <a ng-click="vm.cleanPath(); vm.showUploadFolderContainer = true; vm.showFileUploadBtn = false;" class="cp">New folder</a></span></li>
|
<li ng-if="r.shareAccess.write"><span><i class="fa fa-folder cp"></i> <a ng-click="vm.cleanPath(); vm.showUploadFolderContainer = true; vm.showFileUploadBtn = false;" class="cp">New folder</a></span></li>
|
||||||
<li ng-hide="vm.showUploadButton"><span><i class="fa fa-trash cp"></i> <a ng-click="vm.triggerDeleteFolder(vm.currentFolder, r)" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li>
|
<li ng-hide="vm.showUploadButton" ng-if="r.shareAccess.write"><span><i class="fa fa-trash cp"></i> <a ng-click="vm.triggerDeleteFolder(vm.currentFolder, r)" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="padding-side-15">
|
<div class="padding-side-15">
|
||||||
<button type="button" class="btn btn-danger pull-right" ng-click="vm.deleteFilesFrom(r, path)"><i class="fa fa-trash"></i> Remove all Files</button>
|
<button ng-if="r.shareAccess.write" type="button" class="btn btn-danger pull-right" ng-click="vm.deleteFilesFrom(r, path)"><i class="fa fa-trash"></i> Remove all Files</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue