diff --git a/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.html b/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.html index 6e7cf9f8ee..2ddee71e15 100644 --- a/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.html +++ b/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.html @@ -4,15 +4,27 @@ + + + + + +
+ + Name + Modified by + + Modified at +
{{result.entry.name}}{{result.entry.modifiedByUser.displayName}}{{result.entry.modifiedAt}}
diff --git a/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.ts b/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.ts index 34a2831402..b0b70f6b34 100644 --- a/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.ts +++ b/ng2-components/ng2-alfresco-search/src/components/alfresco-search.component.ts @@ -55,6 +55,30 @@ export class AlfrescoSearchComponent { this.displaySearchResults(this.currentSearchTerm); } + /** + * Gets content URL for the given node. + * @param node Node to get URL for. + * @returns {string} URL address. + */ + getContentUrl(node: any): string { + 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. + */ + getDocumentThumbnailUrl(node: any): string { + if (this._alfrescoService) { + return this._alfrescoService.getDocumentThumbnailUrl(node); + } + return null; + } + /** * Loads and displays folder content * @param searchTerm Search query entered by user diff --git a/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts b/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts index 4b2c13b1c3..fbcab05111 100644 --- a/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts +++ b/ng2-components/ng2-alfresco-search/src/services/alfresco.service.ts @@ -91,6 +91,26 @@ export class AlfrescoService { .catch(this.handleError); } + /** + * Get thumbnail URL for the given document node. + * @param document Node to get URL for. + * @returns {string} URL address. + */ + getDocumentThumbnailUrl(document: any) { + return this.getContentUrl(document) + '/thumbnails/doclib?c=queue&ph=true&lastModified=1&alf_ticket=' + this.getAlfrescoTicket(); + } + + /** + * Get content URL for the given node. + * @param document Node to get URL for. + * @returns {string} URL address. + */ + getContentUrl(document: any) { + return this._host + + '/alfresco/service/api/node/workspace/SpacesStore/' + + document.entry.id + '/content'; + } + private handleError(error: Response) { // in a real world app, we may send the error to some remote logging infrastructure // instead of just logging it to the console