From c64e790ab9788c87ac0982e702c7cae55ac16931 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Wed, 8 Jan 2020 10:15:15 +0100 Subject: [PATCH] FEAT #12091 TIME 0:20 added view document icon in folder and followed lists --- src/app/folder/controllers/FolderController.php | 3 ++- .../UserFollowedResourceController.php | 3 ++- .../folder-document-list.component.html | 16 ++++++++++------ .../folder-document-list.component.ts | 14 ++++++++++---- .../followed-document-list.component.html | 8 ++++++-- .../followed-document-list.component.ts | 14 ++++++++++---- src/frontend/app/list/basket-list.component.ts | 8 +++++--- 7 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/app/folder/controllers/FolderController.php b/src/app/folder/controllers/FolderController.php index 4acc518cd91..446b93c42bd 100755 --- a/src/app/folder/controllers/FolderController.php +++ b/src/app/folder/controllers/FolderController.php @@ -545,7 +545,8 @@ class FolderController $select = [ 'res_letterbox.res_id', 'res_letterbox.subject', 'res_letterbox.barcode', 'res_letterbox.alt_identifier', - 'status.label_status AS "status.label_status"', 'status.img_filename AS "status.img_filename"', 'priorities.color AS "priorities.color"' + 'status.label_status AS "status.label_status"', 'status.img_filename AS "status.img_filename"', 'priorities.color AS "priorities.color"', + 'res_letterbox.filename as res_filename' ]; $tableFunction = ['status', 'priorities']; $leftJoinFunction = ['res_letterbox.status = status.id', 'res_letterbox.priority = priorities.id']; diff --git a/src/app/resource/controllers/UserFollowedResourceController.php b/src/app/resource/controllers/UserFollowedResourceController.php index 0b0c805964e..92bfbda7a13 100644 --- a/src/app/resource/controllers/UserFollowedResourceController.php +++ b/src/app/resource/controllers/UserFollowedResourceController.php @@ -129,7 +129,8 @@ class UserFollowedResourceController $select = [ 'res_letterbox.res_id', 'res_letterbox.subject', 'res_letterbox.barcode', 'res_letterbox.alt_identifier', - 'status.label_status AS "status.label_status"', 'status.img_filename AS "status.img_filename"', 'priorities.color AS "priorities.color"' + 'status.label_status AS "status.label_status"', 'status.img_filename AS "status.img_filename"', 'priorities.color AS "priorities.color"', + 'res_letterbox.filename as res_filename' ]; $tableFunction = ['status', 'priorities']; $leftJoinFunction = ['res_letterbox.status = status.id', 'res_letterbox.priority = priorities.id']; diff --git a/src/frontend/app/folder/document-list/folder-document-list.component.html b/src/frontend/app/folder/document-list/folder-document-list.component.html index 5e36f7cefe4..2c4f8f38f57 100644 --- a/src/frontend/app/folder/document-list/folder-document-list.component.html +++ b/src/frontend/app/folder/document-list/folder-document-list.component.html @@ -156,11 +156,15 @@ [color]="snav2.opened && row.checked && currentMode == 'diffusion' ? 'primary' : ''"> </mat-icon> </button> - <button mat-icon-button title="{{lang.linkDetails}}" - (click)="$event.stopPropagation();goToDetail(row);" - (mouseenter)="viewThumbnail(row);" (mouseleave)="closeThumbnail();"> - <mat-icon fontSet="fas" fontIcon="fa-info-circle fa-2x"></mat-icon> - </button> + <button mat-icon-button title="{{lang.viewResource}}" (click)="$event.stopPropagation();viewDocument(row)" + (mouseenter)="viewThumbnail(row);" (mouseleave)="closeThumbnail();" + [disabled]="!row.hasDocument"> + <mat-icon fontSet="fas" fontIcon="fa-eye fa-2x"></mat-icon> + </button> + <button mat-icon-button title="{{lang.linkDetails}}" + (click)="$event.stopPropagation();goToDetail(row);"> + <mat-icon fontSet="fas" fontIcon="fa-info-circle fa-2x"></mat-icon> + </button> </span> </div> </td> @@ -202,4 +206,4 @@ <app-folder-action-list #actionsListContext [contextMode]="true" [currentFolderInfo]="folderInfo" [totalRes]="allResInBasket.length" [selectedRes]="selectedRes" (refreshEvent)="refreshDaoAfterAction()" (refreshPanelFolders)="panelFolder.refreshFoldersTree()"> -</app-folder-action-list> \ No newline at end of file +</app-folder-action-list> diff --git a/src/frontend/app/folder/document-list/folder-document-list.component.ts b/src/frontend/app/folder/document-list/folder-document-list.component.ts index 6e9dcfa7f43..12a1582a266 100644 --- a/src/frontend/app/folder/document-list/folder-document-list.component.ts +++ b/src/frontend/app/folder/document-list/folder-document-list.component.ts @@ -292,9 +292,11 @@ export class FolderDocumentListComponent implements OnInit { } viewThumbnail(row: any) { - this.thumbnailUrl = '../../rest/resources/' + row.resId + '/thumbnail'; - $j('#viewThumbnail').show(); - $j('#listContent').css({ "overflow": "hidden" }); + if (row.hasDocument) { + this.thumbnailUrl = '../../rest/resources/' + row.resId + '/thumbnail'; + $j('#viewThumbnail').show(); + $j('#listContent').css({"overflow": "hidden"}); + } } closeThumbnail() { @@ -308,7 +310,7 @@ export class FolderDocumentListComponent implements OnInit { Object.keys(element).forEach((key) => { if (key == 'statusImage' && element[key] == null) { element[key] = 'fa-question undefined'; - } else if ((element[key] == null || element[key] == '') && ['closingDate', 'countAttachments', 'countNotes', 'display', 'mailTracking'].indexOf(key) === -1) { + } else if ((element[key] == null || element[key] == '') && ['closingDate', 'countAttachments', 'countNotes', 'display', 'mailTracking', 'hasDocument'].indexOf(key) === -1) { element[key] = this.lang.undefined; } }); @@ -393,6 +395,10 @@ export class FolderDocumentListComponent implements OnInit { } row.mailTracking = !row.mailTracking; } + + viewDocument(row: any) { + window.open("../../rest/resources/" + row.resId + "/content?mode=view", "_blank"); + } } export interface BasketList { folder: any; diff --git a/src/frontend/app/home/followed-list/followed-document-list.component.html b/src/frontend/app/home/followed-list/followed-document-list.component.html index 93a507ece25..41e5dafd9ae 100644 --- a/src/frontend/app/home/followed-list/followed-document-list.component.html +++ b/src/frontend/app/home/followed-list/followed-document-list.component.html @@ -131,9 +131,13 @@ [color]="snav2.opened && row.checked && currentMode == 'diffusion' ? 'primary' : ''"> </mat-icon> </button> + <button mat-icon-button title="{{lang.viewResource}}" (click)="$event.stopPropagation();viewDocument(row)" + (mouseenter)="viewThumbnail(row);" (mouseleave)="closeThumbnail();" + [disabled]="!row.hasDocument"> + <mat-icon fontSet="fas" fontIcon="fa-eye fa-2x"></mat-icon> + </button> <button mat-icon-button title="{{lang.linkDetails}}" - (click)="$event.stopPropagation();goToDetail(row);" - (mouseenter)="viewThumbnail(row);" (mouseleave)="closeThumbnail();"> + (click)="$event.stopPropagation();goToDetail(row);"> <mat-icon fontSet="fas" fontIcon="fa-info-circle fa-2x"></mat-icon> </button> </span> diff --git a/src/frontend/app/home/followed-list/followed-document-list.component.ts b/src/frontend/app/home/followed-list/followed-document-list.component.ts index d854f6e8a18..22e65265ed4 100644 --- a/src/frontend/app/home/followed-list/followed-document-list.component.ts +++ b/src/frontend/app/home/followed-list/followed-document-list.component.ts @@ -251,9 +251,11 @@ export class FollowedDocumentListComponent implements OnInit { } viewThumbnail(row: any) { - this.thumbnailUrl = '../../rest/resources/' + row.resId + '/thumbnail'; - $j('#viewThumbnail').show(); - $j('#listContent').css({ "overflow": "hidden" }); + if (row.hasDocument) { + this.thumbnailUrl = '../../rest/resources/' + row.resId + '/thumbnail'; + $j('#viewThumbnail').show(); + $j('#listContent').css({"overflow": "hidden"}); + } } closeThumbnail() { @@ -267,7 +269,7 @@ export class FollowedDocumentListComponent implements OnInit { Object.keys(element).forEach((key) => { if (key == 'statusImage' && element[key] == null) { element[key] = 'fa-question undefined'; - } else if ((element[key] == null || element[key] == '') && ['closingDate', 'countAttachments', 'countNotes', 'display', 'mailTracking'].indexOf(key) === -1) { + } else if ((element[key] == null || element[key] == '') && ['closingDate', 'countAttachments', 'countNotes', 'display', 'mailTracking', 'hasDocument'].indexOf(key) === -1) { element[key] = this.lang.undefined; } }); @@ -346,6 +348,10 @@ export class FollowedDocumentListComponent implements OnInit { row.mailTracking = !row.mailTracking; } + + viewDocument(row: any) { + window.open("../../rest/resources/" + row.resId + "/content?mode=view", "_blank"); + } } export interface BasketList { folder: any; diff --git a/src/frontend/app/list/basket-list.component.ts b/src/frontend/app/list/basket-list.component.ts index d9dfbb3ef30..caa17b0d671 100755 --- a/src/frontend/app/list/basket-list.component.ts +++ b/src/frontend/app/list/basket-list.component.ts @@ -285,9 +285,11 @@ export class BasketListComponent implements OnInit { } viewThumbnail(row: any) { - this.thumbnailUrl = '../../rest/resources/' + row.resId + '/thumbnail'; - $j('#viewThumbnail').show(); - $j('#listContent').css({ "overflow": "hidden" }); + if (row.hasDocument) { + this.thumbnailUrl = '../../rest/resources/' + row.resId + '/thumbnail'; + $j('#viewThumbnail').show(); + $j('#listContent').css({"overflow": "hidden"}); + } } closeThumbnail() { -- GitLab