new file upload and folders
This commit is contained in:
parent
5cf80bb80b
commit
f26468d3dc
|
@ -207,6 +207,7 @@ app.controller('websiteCtrl', [
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
vm._uploadFile = function (pkg, opts) {
|
vm._uploadFile = function (pkg, opts) {
|
||||||
|
debugger;
|
||||||
vm.newFileUploaded = opts.newFile.name;
|
vm.newFileUploaded = opts.newFile.name;
|
||||||
opts.progress = opts.progress || opts;
|
opts.progress = opts.progress || opts;
|
||||||
return pkg.add({
|
return pkg.add({
|
||||||
|
@ -230,7 +231,6 @@ app.controller('websiteCtrl', [
|
||||||
var msg = vm.newFileUploaded + " has been uploaded"
|
var msg = vm.newFileUploaded + " has been uploaded"
|
||||||
opts.progress.uploadTotal = 0;
|
opts.progress.uploadTotal = 0;
|
||||||
vm.buildNotification(result, msg);
|
vm.buildNotification(result, msg);
|
||||||
vm.cleanPath();
|
|
||||||
// window.alert(JSON.stringify(result));
|
// window.alert(JSON.stringify(result));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -518,6 +518,29 @@ app.controller('websiteCtrl', [
|
||||||
vm.Shares.invite(r, opts);
|
vm.Shares.invite(r, opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vm.createNewFolder = function (r) {
|
||||||
|
if (vm.breadcrumbsPath.join('/') === '') {
|
||||||
|
r.folderName = '/' + vm.folderName + '/';
|
||||||
|
} else {
|
||||||
|
r.folderName = vm.breadcrumbsPath.join('/') + '/' + vm.folderName + '/';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.Sites.upload = function (r) {
|
||||||
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
|
//analyzeFile(r.newFile, r);
|
||||||
|
if (r.folderName !== '' && r.folderName !== undefined) {
|
||||||
|
r.uploadPath = r.folderName;
|
||||||
|
} else {
|
||||||
|
if (vm.breadcrumbsPath.join('/') === '') {
|
||||||
|
r.uploadPath = '/';
|
||||||
|
} else {
|
||||||
|
r.uploadPath = vm.breadcrumbsPath.join('/') + '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vm._uploadFile(pkg, r);
|
||||||
|
};
|
||||||
|
|
||||||
vm.Shares = {};
|
vm.Shares = {};
|
||||||
vm.Shares.invite = function (r, opts) {
|
vm.Shares.invite = function (r, opts) {
|
||||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<div class="folder-actions">
|
<div class="folder-actions">
|
||||||
<hr>
|
<hr>
|
||||||
<div class="">
|
<div class="">
|
||||||
<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 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">Upload files</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>
|
<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 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 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>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<div ng-if="vm.isZip" ><label>Unzip directory</label> <input type="text" ng-model="vm.unzipPath" /></div>
|
<div ng-if="vm.isZip" ><label>Unzip directory</label> <input type="text" ng-model="vm.unzipPath" /></div>
|
||||||
<div ng-if="r.uploadTotal"><span ng-bind="r.uploadPercent">99</span>% | <span ng-bind="r.uploadProgress">1</span> MiB / <span ng-bind="r.uploadTotal">100</span> MiB</div>
|
<div ng-if="r.uploadTotal"><span ng-bind="r.uploadPercent">99</span>% | <span ng-bind="r.uploadProgress">1</span> MiB / <span ng-bind="r.uploadTotal">100</span> MiB</div>
|
||||||
<input type="text" class="form-control hidden" ng-model="vm.autoPopulateWebPath" placeholder="/js/config/config.js" disabled/>
|
<input type="text" class="form-control hidden" ng-model="vm.autoPopulateWebPath" placeholder="/js/config/config.js" disabled/>
|
||||||
<button ng-click="vm.Sites.upload(r)" type="button" name="button" class="btn btn-success" ng-show="vm.showCompleteFileUploadBtn">Add File</button>
|
<button ng-click="vm.Sites.upload(r)" type="button" name="button" class="btn btn-success" >Add File</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<form class="form-inline" ng-show="vm.showUploadFolderContainer">
|
<form class="form-inline" ng-show="vm.showUploadFolderContainer">
|
||||||
|
@ -52,19 +52,19 @@
|
||||||
<ul class="ls-none">
|
<ul class="ls-none">
|
||||||
<li class="add-folder">
|
<li class="add-folder">
|
||||||
<span>
|
<span>
|
||||||
<i class="fa fa-folder"></i> <input type="text" class="form-control {{ vm.hideFolderInput }}" ng-model="vm.autoPopulateWebPath" ng-blur="vm.createNewFolder(r);" style="width: 85%;"/>
|
<i class="fa fa-folder"></i> <input type="text" class="form-control {{ vm.hideFolderInput }}" ng-model="vm.folderName" ng-blur="vm.createNewFolder(r);" style="width: 85%;"/>
|
||||||
<label ng-show="vm.showFileUploadBtn">{{ vm.autoPopulateWebPath }}</label>
|
<label>{{ vm.autoPopulateWebPath }}</label>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="text-center">
|
<li class="text-center">
|
||||||
<input type="file" ng-model="r.newFile" class="form-control" daplie-file-change="vm.Sites.setUpload(r)" ng-show="vm.showFileUploadBtn" />
|
<input type="file" ng-model="r.newFile" class="form-control" daplie-file-change="vm.Sites.setUpload(r)" />
|
||||||
<div ng-if="r.isZip"><label><input type="checkbox" ng-model="r.unzip" /> Unpack .zip</label></div>
|
<div ng-if="r.isZip"><label><input type="checkbox" ng-model="r.unzip" /> Unpack .zip</label></div>
|
||||||
<div ng-if="r.unzip"><label><input type="checkbox" ng-model="r.stripZip" /> Strip zip directory root</label></div>
|
<div ng-if="r.unzip"><label><input type="checkbox" ng-model="r.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 ng-if="vm.isZip" ><label>Unzip directory</label> <input type="text" ng-model="vm.unzipPath" /></div -->
|
||||||
<div ng-if="r.uploadTotal"><span ng-bind="r.uploadPercent">99</span>% | <span ng-bind="r.uploadProgress">1</span> MiB / <span ng-bind="r.uploadTotal">100</span> MiB</div>
|
<div ng-if="r.uploadTotal"><span ng-bind="r.uploadPercent">99</span>% | <span ng-bind="r.uploadProgress">1</span> MiB / <span ng-bind="r.uploadTotal">100</span> MiB</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button ng-click="vm.Sites.upload(r)" type="button" name="button" class="btn btn-success" ng-show="vm.showCompleteFileUploadBtn">Add File</button>
|
<button ng-click="vm.Sites.upload(r)" type="button" name="button" class="btn btn-success">Add File</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue