From 02a5630f623397602b11d1cdc595fa9309254c58 Mon Sep 17 00:00:00 2001 From: vdumas Date: Thu, 6 Jun 2024 17:40:59 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07565=20-=20Polishing=20Newsroom=20-=20Ad?= =?UTF-8?q?d=20subtitle=20and=20user=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../newsroom/en.dictionary.itop.newsroom.php | 37 ++++++++++--------- .../newsroom/fr.dictionary.itop.newsroom.php | 37 ++++++++++--------- .../Newsroom/iTopNewsroomController.php | 8 ++++ .../NotificationsCenterController.php | 11 +++++- 4 files changed, 56 insertions(+), 37 deletions(-) diff --git a/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php index 8b14f146e..4a263f24f 100644 --- a/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php @@ -19,44 +19,45 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Newsroom:iTopNotification:Label' => ITOP_APPLICATION_SHORT, - 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your ' . ITOP_APPLICATION_SHORT.' notifications', + 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your ' . ITOP_APPLICATION_SHORT.' news', + 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.', 'UI:Newsroom:iTopNotification:ViewAllPage:Read:Label' => 'Read', 'UI:Newsroom:iTopNotification:ViewAllPage:Unread:Label' => 'Unread', 'UI:Newsroom:iTopNotification:SelectMode:Label' => 'Select mode', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAllAsRead:Label' => 'Mark all as read', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAllAsUnread:Label' => 'Mark all as unread', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Label' => 'Delete all', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Success:Message' => 'All %1$s notifications have been deleted', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Title' => 'Delete all notifications', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Message' => 'Are you sure you want to delete all notifications?', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Success:Message' => 'All %1$s news have been deleted', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Title' => 'Delete all news', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Message' => 'Are you sure you want to delete all news?', - 'UI:Newsroom:iTopNotification:ViewAllPage:Empty:Title' => 'No notification, you are up to date!', + 'UI:Newsroom:iTopNotification:ViewAllPage:Empty:Title' => 'No news, you are up to date!', // Actions // - Unitary buttons - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Label' => 'Delete this notification', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:ViewObject:Label' => 'Go to the notification url', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Label' => 'Delete this news', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:ViewObject:Label' => 'Go to the news url', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:Label' => 'Mark as read', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:Label' => 'Mark as unread', // - Bulk buttons 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkSelectedAsRead:Label' => 'Mark selected as read', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkSelectedAsUnread:Label' => 'Mark selected as unread', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Label' => 'Delete selected', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Title' => 'Delete selected notifications', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Message' => 'Are you sure you want to delete selected notifications?', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Title' => 'Delete selected news', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Message' => 'Are you sure you want to delete selected news?', // Feedback messages 'UI:Newsroom:iTopNotification:ViewAllPage:Action:InvalidAction:Message' => 'Invalid action: "%1$s"', // - Mark as read - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:NoEvent:Message' => 'No notification to mark as read', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:Success:Message' => 'The notification has been marked as read', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsReadMultiple:Success:Message' => '%1$s notifications have been marked as read', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:NoEvent:Message' => 'No news to mark as read', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:Success:Message' => 'The news has been marked as read', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsReadMultiple:Success:Message' => '%1$s news have been marked as read', // - Mark as unread - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:NoEvent:Message' => 'No notification to mark as read', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:Success:Message' => 'The notification has been marked as unread', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnreadMultiple:Success:Message' => '%1$s notifications have been marked as unread', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:NoEvent:Message' => 'No news to mark as read', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:Success:Message' => 'The news has been marked as unread', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnreadMultiple:Success:Message' => '%1$s news have been marked as unread', // Delete - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No notification to delete', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The notification has been deleted', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s notifications have been deleted', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted', )); \ No newline at end of file diff --git a/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php index 11c624acc..e38017b6d 100644 --- a/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php @@ -19,44 +19,45 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Newsroom:iTopNotification:Label' => ITOP_APPLICATION_SHORT, - 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Vos notifications ' . ITOP_APPLICATION_SHORT, + 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Vos news ' . ITOP_APPLICATION_SHORT, + 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Gérer vos news, les marquer comme lues ou non lues, les supprimer, etc.', 'UI:Newsroom:iTopNotification:ViewAllPage:Read:Label' => 'Lue', 'UI:Newsroom:iTopNotification:ViewAllPage:Unread:Label' => 'Non lue', 'UI:Newsroom:iTopNotification:SelectMode:Label' => 'Sélection multiple', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAllAsRead:Label' => 'Marquer tout comme lu', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAllAsUnread:Label' => 'Marquer tout comme non lu', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Label' => 'Supprimer tout', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Success:Message' => '%1$s notifications ont été supprimées', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Title' => 'Supprimer toutes les notifications', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Message' => 'Êtes-vous sûr de vouloir supprimer toutes les notifications ?', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Success:Message' => '%1$s news ont été supprimées', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Title' => 'Supprimer toutes les news', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Message' => 'Êtes-vous sûr de vouloir supprimer toutes les news ?', - 'UI:Newsroom:iTopNotification:ViewAllPage:Empty:Title' => 'Aucune notification, vous êtes à jour !', + 'UI:Newsroom:iTopNotification:ViewAllPage:Empty:Title' => 'Aucune news, vous êtes à jour !', // Actions // - Unitary buttons - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Label' => 'Supprimer cette notification', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:ViewObject:Label' => 'Aller à l\'url de la notification', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Label' => 'Supprimer cette news', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:ViewObject:Label' => 'Aller à l\'url de la news', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:Label' => 'Marquer comme lu', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:Label' => 'Marquer comme non lu', // - Bulk buttons 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkSelectedAsRead:Label' => 'Marquer sélectionnée(s) comme lu', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkSelectedAsUnread:Label' => 'Marquer sélectionnée(s) comme non lu', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Label' => 'Supprimer sélectionnée(s)', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Title' => 'Supprimer les notifications sélectionnées', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Message' => 'Êtes-vous sûr de vouloir supprimer les notifications sélectionnées ?', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Title' => 'Supprimer les news sélectionnées', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteSelected:Confirmation:Message' => 'Êtes-vous sûr de vouloir supprimer les news sélectionnées ?', // Feedback messages 'UI:Newsroom:iTopNotification:ViewAllPage:Action:InvalidAction:Message' => 'Action invalide : "%1$s"', // - Mark as read - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:NoEvent:Message' => 'Aucune notification à marquer comme lue', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:Success:Message' => 'La notification a été marquée comme lue', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsReadMultiple:Success:Message' => '%1$s notifications ont été marquées comme lues', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:NoEvent:Message' => 'Aucune news à marquer comme lue', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsRead:Success:Message' => 'La news a été marquée comme lue', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsReadMultiple:Success:Message' => '%1$s news ont été marquées comme lues', // - Mark as unread - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:NoEvent:Message' => 'Aucune notification à marquer comme non lue', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:Success:Message' => 'La notification a été marquée comme non lue', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnreadMultiple:Success:Message' => '%1$s notifications ont été marquées comme non lues', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:NoEvent:Message' => 'Aucune news à marquer comme non lue', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:Success:Message' => 'La news a été marquée comme non lue', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnreadMultiple:Success:Message' => '%1$s news ont été marquées comme non lues', // Delete - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'Aucune notification à supprimer', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'La notification a été supprimée', - 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s notifications ont été supprimées', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'Aucune news à supprimer', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'La news a été supprimée', + 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news ont été supprimées', )); \ No newline at end of file diff --git a/sources/Controller/Newsroom/iTopNewsroomController.php b/sources/Controller/Newsroom/iTopNewsroomController.php index b2eee5a2a..592e7c182 100644 --- a/sources/Controller/Newsroom/iTopNewsroomController.php +++ b/sources/Controller/Newsroom/iTopNewsroomController.php @@ -35,6 +35,7 @@ use SecurityException; use URLPopupMenuItem; use UserRights; use utils; +use appUserPreferences; /** @@ -61,6 +62,13 @@ class iTopNewsroomController extends Controller // Add title block // Make bulk actions block $oBulkActionsBlock = PanelUIBlockFactory::MakeForInformation(Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:Title')); + $oBulkActionsBlock->AddSubTitleBlock(new Html(Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:SubTitle'))); + $sPictureUrl = UserRights::GetUserPictureAbsUrl(); + if (empty($sPictureUrl)) { + $sPictureUrl = utils::GetAbsoluteUrlAppRoot().'images/user-pictures/'.appUserPreferences::GetPref('user_picture_placeholder', 'user-profile-default-256px.png'); + } + $oBulkActionsBlock->SetIcon($sPictureUrl,Panel::ENUM_ICON_COVER_METHOD_CONTAIN, true); + $oNotificationsCenterButton = ButtonUIBlockFactory::MakeIconLink( 'fas fa-cogs', Dict::S('UI:NotificationsCenter:Panel:Title'), diff --git a/sources/Controller/Notifications/NotificationsCenterController.php b/sources/Controller/Notifications/NotificationsCenterController.php index 4636bad32..82dab6e97 100644 --- a/sources/Controller/Notifications/NotificationsCenterController.php +++ b/sources/Controller/Notifications/NotificationsCenterController.php @@ -19,6 +19,8 @@ use Dict; use Exception; use MetaModel; use utils; +use UserRights; +use appUserPreferences; /** @@ -58,7 +60,14 @@ class NotificationsCenterController extends Controller // Create a panel that will contain the table $oNotificationsPanel = new Panel(Dict::S('UI:NotificationsCenter:Panel:Title'), array(), 'grey', 'ibo-notifications-center'); $oNotificationsPanel->AddCSSClass('ibo-datatable-panel'); - $oSubtitleBlock = new UIContentBlock(null, ['ibo-notifications-center--sub-title']); + + $oNotificationsPanel->AddSubTitleBlock(new Html(Dict::S('UI:NotificationsCenter:Panel:SubTitle'))); + $sPictureUrl = UserRights::GetUserPictureAbsUrl(); + if (empty($sPictureUrl)) { + $sPictureUrl = utils::GetAbsoluteUrlAppRoot().'images/user-pictures/'.appUserPreferences::GetPref('user_picture_placeholder', 'user-profile-default-256px.png'); + } + $oNotificationsPanel->SetIcon($sPictureUrl,Panel::ENUM_ICON_COVER_METHOD_CONTAIN, true); + $oNotificationsCenterTableColumns = [ 'trigger' => array('label' => MetaModel::GetName('Trigger')), 'trigger_class' => array('label' => MetaModel::GetAttributeDef('Trigger', 'finalclass')->GetLabel()),