#9 jsdoc comments for document list and related components

This commit is contained in:
Denys Vuika 2016-05-11 11:02:43 +01:00
parent 68abeb4b2b
commit 2f840c2ee3
18 changed files with 276 additions and 46 deletions

View File

@ -3,5 +3,9 @@ import { ContentActionModel } from './../models/content-action.model';
export declare class ContentActionList {
private documentList;
constructor(documentList: DocumentList);
/**
* Registers action handler within the parent document list component.
* @param action Action model to register.
*/
registerAction(action: ContentActionModel): void;
}

View File

@ -40,9 +40,11 @@ System.register(['angular2/core', './document-list'], function(exports_1, contex
ContentActionList = (function () {
function ContentActionList(documentList) {
this.documentList = documentList;
// saves reference to parent container
// so that content children can access it
}
/**
* Registers action handler within the parent document list component.
* @param action Action model to register.
*/
ContentActionList.prototype.registerAction = function (action) {
if (this.documentList && action) {
this.documentList.actions.push(action);

View File

@ -1 +1 @@
{"version":3,"file":"content-action-list.js","sourceRoot":"","sources":["content-action-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBACI,2BAAoB,YAA0B;oBAA1B,iBAAY,GAAZ,YAAY,CAAc;oBAC1C,sCAAsC;oBACtC,yCAAyC;gBAC7C,CAAC;gBAED,0CAAc,GAAd,UAAe,MAA0B;oBACrC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,CAAC,CAAC;wBAC9B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC3C,CAAC;gBACL,CAAC;gBAdL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,iBAAiB;wBAC3B,QAAQ,EAAE,EAAE;qBACf,CAAC;;qCAAA;gBAYF,wBAAC;YAAD,CAAC,AAXD,IAWC;YAXD,iDAWC,CAAA"}
{"version":3,"file":"content-action-list.js","sourceRoot":"","sources":["content-action-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBAEI,2BACY,YAA0B;oBAA1B,iBAAY,GAAZ,YAAY,CAAc;gBACtC,CAAC;gBAED;;;mBAGG;gBACH,0CAAc,GAAd,UAAe,MAA0B;oBACrC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,CAAC,CAAC;wBAC9B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC3C,CAAC;gBACL,CAAC;gBAlBL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,iBAAiB;wBAC3B,QAAQ,EAAE,EAAE;qBACf,CAAC;;qCAAA;gBAgBF,wBAAC;YAAD,CAAC,AAfD,IAeC;YAfD,iDAeC,CAAA"}

View File

@ -24,12 +24,16 @@ import {ContentActionModel} from './../models/content-action.model';
template: ''
})
export class ContentActionList {
constructor(private documentList: DocumentList) {
// saves reference to parent container
// so that content children can access it
constructor(
private documentList: DocumentList) {
}
registerAction(action: ContentActionModel) {
/**
* Registers action handler within the parent document list component.
* @param action Action model to register.
*/
registerAction(action: ContentActionModel): void {
if (this.documentList && action) {
this.documentList.actions.push(action);
}

View File

@ -1 +1 @@
{"version":3,"file":"content-action.js","sourceRoot":"","sources":["content-action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAYH;gBAoBI,uBACY,IAAuB,EACvB,eAAuC,EACvC,aAAmC;oBAFnC,SAAI,GAAJ,IAAI,CAAmB;oBACvB,oBAAe,GAAf,eAAe,CAAwB;oBACvC,kBAAa,GAAb,aAAa,CAAsB;oBApB/C,UAAK,GAAW,QAAQ,CAAC;oBAezB,YAAO,GAAG,IAAI,mBAAY,EAAE,CAAC;gBAM7B,CAAC;gBAED,gCAAQ,GAAR;oBAAA,iBAkBC;oBAjBG,IAAI,KAAK,GAAG,IAAI,yCAAkB,EAAE,CAAC;oBACrC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAA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AGR;oBAAC,YAAK,EAAE;;2DAAA;gBAGR;oBAAC,YAAK,EAAE;;8DAAA;gBAGR;oBAAC,YAAK,EAAE;;2DAAA;gBAGR;oBAAC,YAAK,EAAE;;6DAAA;gBAGR;oBAAC,aAAM,EAAE;;8DAAA;gBArBb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,gBAAgB;wBAC1B,QAAQ,EAAE,EAAE;qBACf,CAAC;;iCAAA;gBAmEF,oBAAC;YAAD,CAAC,AAlED,IAkEC;YAlED,yCAkEC,CAAA"}

View File

@ -20,6 +20,7 @@ import {ContentActionModel} from './../models/content-action.model';
import {ContentActionList} from './content-action-list';
import {DocumentActionsService} from '../services/document-actions.service';
import {FolderActionsService} from '../services/folder-actions.service';
import {ContentActionHandler} from '../models/content-action.model';
@Component({
selector: 'content-action',
@ -71,7 +72,7 @@ export class ContentAction implements OnInit {
this.list.registerAction(model);
}
private getSystemHandler(target: string, name: string) {
private getSystemHandler(target: string, name: string): ContentActionHandler {
if (target) {
let ltarget = target.toLowerCase();

View File

@ -3,5 +3,9 @@ import { ContentColumnModel } from './../models/content-column.model';
export declare class ContentColumnList {
private documentList;
constructor(documentList: DocumentList);
/**
* Registers column model within the parent document list component.
* @param column Column definition model to register.
*/
registerColumn(column: ContentColumnModel): void;
}

View File

@ -40,9 +40,11 @@ System.register(['angular2/core', './document-list'], function(exports_1, contex
ContentColumnList = (function () {
function ContentColumnList(documentList) {
this.documentList = documentList;
// saves reference to parent container
// so that content children can access it
}
/**
* Registers column model within the parent document list component.
* @param column Column definition model to register.
*/
ContentColumnList.prototype.registerColumn = function (column) {
if (this.documentList && column) {
this.documentList.columns.push(column);

View File

@ -1 +1 @@
{"version":3,"file":"content-column-list.js","sourceRoot":"","sources":["content-column-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBACI,2BAAoB,YAA0B;oBAA1B,iBAAY,GAAZ,YAAY,CAAc;oBAC1C,sCAAsC;oBACtC,yCAAyC;gBAC7C,CAAC;gBAED,0CAAc,GAAd,UAAe,MAA0B;oBACrC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,CAAC,CAAC;wBAC9B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC3C,CAAC;gBACL,CAAC;gBAdL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,iBAAiB;wBAC3B,QAAQ,EAAE,EAAE;qBACf,CAAC;;qCAAA;gBAYF,wBAAC;YAAD,CAAC,AAXD,IAWC;YAXD,iDAWC,CAAA"}
{"version":3,"file":"content-column-list.js","sourceRoot":"","sources":["content-column-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBAEI,2BACY,YAA0B;oBAA1B,iBAAY,GAAZ,YAAY,CAAc;gBACtC,CAAC;gBAED;;;mBAGG;gBACH,0CAAc,GAAd,UAAe,MAA0B;oBACrC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,CAAC,CAAC;wBAC9B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC3C,CAAC;gBACL,CAAC;gBAlBL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,iBAAiB;wBAC3B,QAAQ,EAAE,EAAE;qBACf,CAAC;;qCAAA;gBAgBF,wBAAC;YAAD,CAAC,AAfD,IAeC;YAfD,iDAeC,CAAA"}

View File

@ -24,12 +24,16 @@ import {ContentColumnModel} from './../models/content-column.model';
template: ''
})
export class ContentColumnList {
constructor(private documentList: DocumentList) {
// saves reference to parent container
// so that content children can access it
constructor(
private documentList: DocumentList) {
}
registerColumn(column: ContentColumnModel) {
/**
* Registers column model within the parent document list component.
* @param column Column definition model to register.
*/
registerColumn(column: ContentColumnModel): void {
if (this.documentList && column) {
this.documentList.columns.push(column);
}

View File

@ -35,19 +35,67 @@ export declare class DocumentList implements OnInit, AfterViewChecked, AfterCont
route: any[];
actions: ContentActionModel[];
columns: ContentColumnModel[];
/**
* Determines whether navigation to parent folder is available.
* @returns {boolean}
*/
canNavigateParent(): boolean;
constructor(_alfrescoService: AlfrescoService);
ngOnInit(): void;
ngAfterContentInit(): void;
ngAfterViewChecked(): void;
/**
* Get a list of content actions based on target and type.
* @param target Target to filter actions by.
* @param type Type to filter actions by.
* @returns {ContentActionModel[]} List of actions filtered by target and type.
*/
getContentActions(target: string, type: string): ContentActionModel[];
onNavigateParentClick($event: any): void;
onItemClick(item: DocumentEntity, $event?: any): void;
goToRoute(r: any, $event: any): void;
/**
* Invoked when 'parent folder' element is clicked.
* @param e DOM event
*/
onNavigateParentClick(e: any): void;
/**
* Invoked when list row is clicked.
* @param item Underlying node item
* @param e DOM event (optional)
*/
onItemClick(item: DocumentEntity, e?: any): void;
/**
* Invoked when a breadcrumb route is clicked.
* @param r Route to navigate to
* @param e DOM event
*/
goToRoute(r: any, e: any): void;
/**
* Gets content URL for the given node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
getContentUrl(node: DocumentEntity): string;
/**
* Gets thumbnail URL for the given document node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(node: DocumentEntity): string;
/**
* Invoked when executing content action for a document or folder.
* @param node Node to be the context of the execution.
* @param action Action to be executed against the context.
*/
executeContentAction(node: DocumentEntity, action: ContentActionModel): void;
/**
* Loads and displays folder content
* @param path Node path
*/
displayFolderContent(path: any): void;
/**
* Gets a path for a given node.
* @param node
* @returns {string}
*/
getNodePath(node: DocumentEntity): string;
/**
* Gets a value from an object by composed key
@ -57,5 +105,8 @@ export declare class DocumentList implements OnInit, AfterViewChecked, AfterCont
* @returns {string}
*/
getObjectValue(target: any, key: string): any;
/**
* Creates a set of predefined columns.
*/
setupDefaultColumns(): void;
}

View File

@ -55,6 +55,10 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
this.actions = [];
this.columns = [];
}
/**
* Determines whether navigation to parent folder is available.
* @returns {boolean}
*/
DocumentList.prototype.canNavigateParent = function () {
return this.navigate && !this.breadcrumb &&
this.currentFolderPath !== this.rootFolder.path;
@ -74,6 +78,12 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
componentHandler.upgradeAllRegistered();
}
};
/**
* Get a list of content actions based on target and type.
* @param target Target to filter actions by.
* @param type Type to filter actions by.
* @returns {ContentActionModel[]} List of actions filtered by target and type.
*/
DocumentList.prototype.getContentActions = function (target, type) {
if (target && type) {
var ltarget_1 = target.toLowerCase();
@ -85,9 +95,13 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
}
return [];
};
DocumentList.prototype.onNavigateParentClick = function ($event) {
if ($event) {
$event.preventDefault();
/**
* Invoked when 'parent folder' element is clicked.
* @param e DOM event
*/
DocumentList.prototype.onNavigateParentClick = function (e) {
if (e) {
e.preventDefault();
}
if (this.navigate) {
this.route.pop();
@ -97,10 +111,15 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
}
}
};
DocumentList.prototype.onItemClick = function (item, $event) {
if ($event === void 0) { $event = null; }
if ($event) {
$event.preventDefault();
/**
* Invoked when list row is clicked.
* @param item Underlying node item
* @param e DOM event (optional)
*/
DocumentList.prototype.onItemClick = function (item, e) {
if (e === void 0) { e = null; }
if (e) {
e.preventDefault();
}
this.itemClick.emit({
value: item
@ -116,9 +135,14 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
}
}
};
DocumentList.prototype.goToRoute = function (r, $event) {
if ($event) {
$event.preventDefault();
/**
* Invoked when a breadcrumb route is clicked.
* @param r Route to navigate to
* @param e DOM event
*/
DocumentList.prototype.goToRoute = function (r, e) {
if (e) {
e.preventDefault();
}
if (this.navigate) {
var idx = this.route.indexOf(r);
@ -128,23 +152,42 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
}
}
};
/**
* Gets content URL for the given node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
DocumentList.prototype.getContentUrl = function (node) {
if (this._alfrescoService) {
return this._alfrescoService.getContentUrl(node);
}
return null;
};
/**
* Gets thumbnail URL for the given document node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
DocumentList.prototype.getDocumentThumbnailUrl = function (node) {
if (this._alfrescoService) {
return this._alfrescoService.getDocumentThumbnailUrl(node);
}
return null;
};
/**
* Invoked when executing content action for a document or folder.
* @param node Node to be the context of the execution.
* @param action Action to be executed against the context.
*/
DocumentList.prototype.executeContentAction = function (node, action) {
if (action) {
action.handler(node);
}
};
/**
* Loads and displays folder content
* @param path Node path
*/
DocumentList.prototype.displayFolderContent = function (path) {
var _this = this;
if (path) {
@ -154,6 +197,11 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
.subscribe(function (folder) { return _this.folder = folder; }, function (error) { return _this.errorMessage = error; });
}
};
/**
* Gets a path for a given node.
* @param node
* @returns {string}
*/
DocumentList.prototype.getNodePath = function (node) {
if (node) {
var container = node.location.container;
@ -189,6 +237,9 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
} while (keys.length);
return target;
};
/**
* Creates a set of predefined columns.
*/
DocumentList.prototype.setupDefaultColumns = function () {
var thumbnailCol = new content_column_model_1.ContentColumnModel();
thumbnailCol.source = '$thumbnail';

File diff suppressed because one or more lines are too long

View File

@ -66,12 +66,17 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
actions: ContentActionModel[] = [];
columns: ContentColumnModel[] = [];
/**
* Determines whether navigation to parent folder is available.
* @returns {boolean}
*/
canNavigateParent(): boolean {
return this.navigate && !this.breadcrumb &&
this.currentFolderPath !== this.rootFolder.path;
}
constructor(private _alfrescoService: AlfrescoService) {
constructor(
private _alfrescoService: AlfrescoService) {
}
ngOnInit() {
@ -92,7 +97,13 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
}
}
getContentActions(target: string, type: string) {
/**
* Get a list of content actions based on target and type.
* @param target Target to filter actions by.
* @param type Type to filter actions by.
* @returns {ContentActionModel[]} List of actions filtered by target and type.
*/
getContentActions(target: string, type: string): ContentActionModel[] {
if (target && type) {
let ltarget = target.toLowerCase();
@ -106,9 +117,13 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
return [];
}
onNavigateParentClick($event) {
if ($event) {
$event.preventDefault();
/**
* Invoked when 'parent folder' element is clicked.
* @param e DOM event
*/
onNavigateParentClick(e) {
if (e) {
e.preventDefault();
}
if (this.navigate) {
@ -120,9 +135,14 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
}
}
onItemClick(item: DocumentEntity, $event = null) {
if ($event) {
$event.preventDefault();
/**
* Invoked when list row is clicked.
* @param item Underlying node item
* @param e DOM event (optional)
*/
onItemClick(item: DocumentEntity, e = null) {
if (e) {
e.preventDefault();
}
this.itemClick.emit({
@ -141,9 +161,14 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
}
}
goToRoute(r, $event) {
if ($event) {
$event.preventDefault();
/**
* Invoked when a breadcrumb route is clicked.
* @param r Route to navigate to
* @param e DOM event
*/
goToRoute(r, e) {
if (e) {
e.preventDefault();
}
if (this.navigate) {
@ -155,26 +180,45 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
}
}
getContentUrl(node: DocumentEntity) {
/**
* Gets content URL for the given node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
getContentUrl(node: DocumentEntity): string {
if (this._alfrescoService) {
return this._alfrescoService.getContentUrl(node);
}
return null;
}
getDocumentThumbnailUrl(node: DocumentEntity) {
/**
* Gets thumbnail URL for the given document node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(node: DocumentEntity): string {
if (this._alfrescoService) {
return this._alfrescoService.getDocumentThumbnailUrl(node);
}
return null;
}
/**
* Invoked when executing content action for a document or folder.
* @param node Node to be the context of the execution.
* @param action Action to be executed against the context.
*/
executeContentAction(node: DocumentEntity, action: ContentActionModel) {
if (action) {
action.handler(node);
}
}
/**
* Loads and displays folder content
* @param path Node path
*/
displayFolderContent(path) {
if (path) {
this.currentFolderPath = path;
@ -187,6 +231,11 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
}
}
/**
* Gets a path for a given node.
* @param node
* @returns {string}
*/
getNodePath(node: DocumentEntity): string {
if (node) {
let container = node.location.container;
@ -224,6 +273,9 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
return target;
}
/**
* Creates a set of predefined columns.
*/
setupDefaultColumns(): void {
let thumbnailCol = new ContentColumnModel();
thumbnailCol.source = '$thumbnail';

View File

@ -2,6 +2,9 @@ import { Http } from 'angular2/http';
import { Observable } from 'rxjs/Observable';
import { FolderEntity, DocumentEntity } from './../models/document-library.model';
import { AlfrescoSettingsService } from '../../../ng2-alfresco-core/services';
/**
* Internal service used by Document List component.
*/
export declare class AlfrescoService {
private http;
private settings;
@ -10,8 +13,23 @@ export declare class AlfrescoService {
private _baseUrlPath;
host: string;
private getBaseUrl();
/**
* Gets the folder node with the content.
* @param folder Path to folder.
* @returns {Observable<FolderEntity>} Folder entity.
*/
getFolder(folder: string): Observable<FolderEntity>;
/**
* Get thumbnail URL for the given document node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(document: DocumentEntity): string;
/**
* Get content URL for the given node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
getContentUrl(document: DocumentEntity): string;
private handleError(error);
}

View File

@ -43,6 +43,9 @@ System.register(['angular2/core', 'angular2/http', 'rxjs/Observable', '../../../
services_1 = services_1_1;
}],
execute: function() {
/**
* Internal service used by Document List component.
*/
AlfrescoService = (function () {
function AlfrescoService(http, settings) {
this.http = http;
@ -66,6 +69,11 @@ System.register(['angular2/core', 'angular2/http', 'rxjs/Observable', '../../../
AlfrescoService.prototype.getBaseUrl = function () {
return this.host + this._baseUrlPath;
};
/**
* Gets the folder node with the content.
* @param folder Path to folder.
* @returns {Observable<FolderEntity>} Folder entity.
*/
AlfrescoService.prototype.getFolder = function (folder) {
var headers = new http_1.Headers({
'Content-Type': 'application/json',
@ -78,11 +86,21 @@ System.register(['angular2/core', 'angular2/http', 'rxjs/Observable', '../../../
.do(function (data) { return console.log(data); }) // eyeball results in the console
.catch(this.handleError);
};
/**
* Get thumbnail URL for the given document node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
AlfrescoService.prototype.getDocumentThumbnailUrl = function (document) {
return this._host +
'/alfresco/service/api/node/' +
document.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&amp;ph=true&amp;lastModified=1';
};
/**
* Get content URL for the given node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
AlfrescoService.prototype.getContentUrl = function (document) {
return this._host + '/alfresco/service/' + document.contentUrl;
};

View File

@ -1 +1 @@
{"version":3,"file":"alfresco.service.js","sourceRoot":"","sources":["alfresco.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YASH;gBACI,yBACY,IAAU,EACV,QAAiC;oBADjC,SAAI,GAAJ,IAAI,CAAM;oBACV,aAAQ,GAAR,QAAQ,CAAyB;oBAOrC,UAAK,GAAW,uBAAuB,CAAC;oBACxC,iBAAY,GAAW,sDAAsD,CAAC;oBANlF,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;wBACX,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC;oBAC/B,CAAC;gBACL,CAAC;gBAKD,sBAAW,iCAAI;yBAAf;wBACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACtB,CAAC;yBAED,UAAgB,KAAY;wBACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACvB,CAAC;;;mBAJA;gBAMO,oCAAU,GAAlB;oBACI,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;gBACzC,CAAC;gBAED,mCAAS,GAAT,UAAU,MAAc;oBACpB,IAAI,OAAO,GAAG,IAAI,c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AI,OAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAjB,CAAiB,CAAC,CAAC,iCAAiC;yBAC/D,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACjC,CAAC;gBAED;;;;mBAIG;gBACH,iDAAuB,GAAvB,UAAwB,QAAwB;oBAC5C,MAAM,CAAC,IAAI,CAAC,KAAK;wBACb,6BAA6B;wBAC7B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,mEAAmE,CAAC;gBACnH,CAAC;gBAED;;;;mBAIG;gBACH,uCAAa,GAAb,UAAc,QAAwB;oBAClC,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAoB,GAAG,QAAQ,CAAC,UAAU,CAAC;gBACnE,CAAC;gBAEO,qCAAW,GAAnB,UAAqB,KAAe;oBAChC,mFAAmF;oBACnF,4CAA4C;oBAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACrB,MAAM,CAAC,uBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC;gBAClE,CAAC;gBAtEL;oBAAC,iBAAU,EAAE;;mCAAA;gBAuEb,sBAAC;YAAD,CAAC,AAtED,IAsEC;YAtED,6CAsEC,CAAA"}

View File

@ -21,8 +21,12 @@ import {Observable} from 'rxjs/Observable';
import {FolderEntity, DocumentEntity} from './../models/document-library.model';
import {AlfrescoSettingsService} from '../../../ng2-alfresco-core/services';
/**
* Internal service used by Document List component.
*/
@Injectable()
export class AlfrescoService {
constructor(
private http: Http,
private settings: AlfrescoSettingsService
@ -47,6 +51,11 @@ export class AlfrescoService {
return this.host + this._baseUrlPath;
}
/**
* Gets the folder node with the content.
* @param folder Path to folder.
* @returns {Observable<FolderEntity>} Folder entity.
*/
getFolder(folder: string) {
let headers = new Headers({
'Content-Type': 'application/json',
@ -60,13 +69,23 @@ export class AlfrescoService {
.catch(this.handleError);
}
getDocumentThumbnailUrl(document: DocumentEntity) {
/**
* Get thumbnail URL for the given document node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(document: DocumentEntity): string {
return this._host +
'/alfresco/service/api/node/' +
document.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&amp;ph=true&amp;lastModified=1';
}
getContentUrl(document: DocumentEntity) {
/**
* Get content URL for the given node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
getContentUrl(document: DocumentEntity): string {
return this._host + '/alfresco/service/' + document.contentUrl;
}