#60 Reproduce folders tree when a folder is uploaded

This commit is contained in:
mauriziovitale84
2016-05-19 10:59:31 +01:00
parent 2fa8283213
commit a9df957f2a
7 changed files with 298 additions and 103 deletions

View File

@@ -76,6 +76,9 @@ export class UploadButtonComponent {
@Input()
acceptedFilesType: string = '*';
@Input()
currentFolderPath: string = '/Sites/swsdp/documentLibrary';
@Input()
uploaddirectory: string = '';
@@ -92,15 +95,14 @@ export class UploadButtonComponent {
@Optional() translate: TranslateService) {
console.log('UploadComponent constructor', el);
let site = this.getSiteId();
let container = this.getContainerId();
this._uploaderService = new UploadService({
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
withCredentials: true,
authToken: btoa('admin:admin'),
authTokenPrefix: 'Basic',
fieldName: 'filedata',
formFields: {
siteid: 'swsdp',
containerid: 'documentLibrary'
siteid: site,
containerid: container
}
});
@@ -171,4 +173,20 @@ export class UploadButtonComponent {
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
/**
* Return the site from the path
* @returns {any}
*/
private getSiteId(): string {
return this.currentFolderPath.replace('/Sites/','').split('/')[0];
}
/**
* Return the container from the path
* @returns {any}
*/
private getContainerId(): string {
return this.currentFolderPath.replace('/Sites/','').split('/')[1];
}
}