Call Us : +91 9925144200       Email us : hello@contcentric.com

Blog

Jan 23

Running Alfresco AngularJS Application (0.5.1) without Activiti Explorer

This BLOG is explaining what all changes you need to make to start Alfresco AngularJS client without Activiti explorer.

Make sure that you are using latest version of alfresco-community(5.2.a).
If you are using older version, you need to enable CORS manually for alfresco AngularJS application to connect to your alfresco repository.

 
This BLOG assumes that you have already generated AngularJS application by referring below links:
https://github.com/Alfresco/alfresco-ng2-components/blob/master/PREREQUISITES.md (for prerequisites) and
https://github.com/Alfresco/generator-ng2-alfresco-app (for alfresco AngularJS application generation).

You only want to use it as an ECM without installing Activiti. In order to achieve this follow the below steps:
1.  Find a file files.component.ts on a path ./app/components/files.
2.  Edit that file and replace the code of that file with the code given below :

import { Component, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { 
 DocumentActionsService,
 DocumentList 
} from 'ng2-alfresco-documentlist';
 import { FormService } from 'ng2-activiti-form';
 
 declare let __moduleName: string;
 
 @Component({ 
 moduleId: __moduleName,
 selector: 'files-component',
 templateUrl: './files.component.html',
 styleUrls: ['./files.component.css'] 
})
 export class FilesComponent {
 currentPath: string = '/Sites/swsdp/documentLibrary';
 
 fileNodeId: any; 
 fileShowed: boolean = false;
 multipleFileUpload: boolean = false;
 folderUpload: boolean = false;
 acceptedFilesTypeShow: boolean = false;
 versioning: boolean = false;
 
 acceptedFilesType: string = '.jpg,.pdf,.js';
 @ViewChild(DocumentList) 
 documentList: DocumentList;
 
 constructor(private documentActions: DocumentActionsService,
 private formService: FormService,
 private router: Router) { 
 documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
 } 
 
 myDocumentActionHandler(obj: any) { 
 window.alert('my custom action handler');
 } 
 
 myCustomAction1(event) { 
 alert('Custom document action for ' + event.value.entry.name);
 } 
 
 myFolderAction1(event) { 
 alert('Custom folder action for ' + event.value.entry.name);
 } 
 
 showFile(event) { 
 if (event.value.entry.isFile) { 
 this.fileNodeId = event.value.entry.id;
 this.fileShowed = true; } 
 else { 
 this.fileShowed = false;
 } 
 } 
 
 onFolderChanged(event?: any) { 
 if (event) { 
 this.currentPath = event.path;
 } 
 } 
 
 toggleMultipleFileUpload() { 
 this.multipleFileUpload = !this.multipleFileUpload;
 return this.multipleFileUpload;
 } 
 
 toggleFolder() { 
 this.multipleFileUpload = false;
 this.folderUpload = !this.folderUpload; return this.folderUpload;
 } 
 
 toggleAcceptedFilesType() {
 this.acceptedFilesTypeShow = !this.acceptedFilesTypeShow;
 return this.acceptedFilesTypeShow;
 } 
 
 toggleVersioning() { 
 this.versioning = !this.versioning; return this.versioning;
 } 
 
 viewActivitiForm(event?: any) { 
 this.router.navigate(['/activiti/tasksnode', event.value.entry.id]);
 } 
}

3.  Rebuild the project using command “npm run build” from command prompt.
4.  And start the app using “npm start command”.

In login page, do not forget to disable the BPM toggle button.
Open url.
Give appropriate credentials.

In case you are facing issue, please feel free to comment on this BLOG and we will reply you at the earliest moment. Good luck!

Shubham

About The Author

Shubham is an Alfresco developer at ContCentric with Alfresco Certified Engineer (ACE501) certification under his belt. His interest lies in exploring Alfresco add-on features and integrating in the application, besides the involvement in Alfresco Share and Activiti project development.

Leave a reply

Your email address will not be published. Required fields are marked *