options for path, unzip, and strip-root-path

This commit is contained in:
aj 2017-08-23 20:36:19 +00:00
parent 37734638b8
commit 3ba63bc818
3 changed files with 21 additions and 3 deletions

View File

@ -11,10 +11,15 @@ function handleFiles(ev) {
return; return;
} }
$scope = angular.element(ev.target).scope(); $scope = angular.element(ev.target).scope();
// 'vm' is the Controller As name. // 'vm' is the Controller As name.
vm = $scope.vm; vm = $scope.vm;
vm.currentFiles = ev.target.files; vm.currentFiles = ev.target.files;
var file = vm.currentFiles[0];
vm.isZip = /\.zip$/.test(file.name);
vm.unzip = vm.isZip;
vm.stripZip = vm.isZip;
$scope.$digest();
console.log('vm.currentFiles', vm.currentFiles); console.log('vm.currentFiles', vm.currentFiles);
} }
window.document.body.addEventListener('change', handleFiles); window.document.body.addEventListener('change', handleFiles);
@ -25,6 +30,8 @@ app.controller('websiteCtrl', [
var vm = this; var vm = this;
vm.domains = []; vm.domains = [];
//vm.unzipPath = '/';
vm.webPath = '/';
Auth.api = function (apiname, opts) { Auth.api = function (apiname, opts) {
var els = []; var els = [];
@ -117,6 +124,9 @@ app.controller('websiteCtrl', [
, sld: vm.domain.sld , sld: vm.domain.sld
//, sub: vm.record.sub //, sub: vm.record.sub
, multipart: { site: vm.currentFiles[0] } , multipart: { site: vm.currentFiles[0] }
, unzip: vm.unzip
, strip: vm.stripZip
, path: vm.webPath
}).then(function (result) { }).then(function (result) {
window.alert(JSON.stringify(result)); window.alert(JSON.stringify(result));
}); });

View File

@ -12,7 +12,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
method: 'POST' method: 'POST'
, url: OAUTH3.url.normalize(providerUri) , url: OAUTH3.url.normalize(providerUri)
+ '/api/www@daplie.com/acl/add/' + opts.hostname + '/api/www@daplie.com/acl/add/' + opts.hostname
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/ }) + '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, unzip: opts.unzip, strip: opts.strip, path: opts.path })
, session: session , session: session
, multipart: opts.multipart // special property to be figured out by browser request code , multipart: opts.multipart // special property to be figured out by browser request code
}).then(function (result) { }).then(function (result) {

View File

@ -44,7 +44,15 @@
<br> <br>
--> -->
<div class="input-group"> <div class="input-group">
<label>Select .zip upload</label> <input type="file" class="js-file-upload this-has-a-special-non-angular-event-handler" /> <div><label>Select .zip upload</label> <input type="file" class="js-file-upload this-has-a-special-non-angular-event-handler" /></div>
<div ng-if="vm.isZip" ><label><input type="checkbox" ng-model="vm.unzip" /> Unpack .zip</label></div>
<div ng-if="vm.unzip" ><label><input type="checkbox" ng-model="vm.stripZip" /> Strip zip directory root</label></div>
<!-- div ng-if="vm.isZip" ><label>Unzip directory</label> <input type="text" ng-model="vm.unzipPath" /></div -->
<div><label>Web path</label> <input type="text" ng-model="vm.webPath" /></div>
</div> </div>
</div> </div>
</div> </div>