From 2fc109a683d2ab496e7fbd33e337821d16cb102c Mon Sep 17 00:00:00 2001 From: Jesus Maria Mendez Perez Date: Mon, 7 Oct 2024 12:38:01 +0200 Subject: [PATCH 1/2] SAK-49440 Modify the default behaviour of the 'mark as read' in the forums tool. --- .../service/ForumEntity.java | 6 +- .../messagecenter/bundle/Messages.properties | 12 +- .../bundle/Messages_es.properties | 10 +- .../api/app/messageforums/BulkPermission.java | 4 +- .../DefaultPermissionsManager.java | 4 +- .../MessageForumsMessageManager.java | 8 +- .../app/messageforums/MessagePermissions.java | 4 +- .../app/messageforums/PermissionLevel.java | 6 +- .../ui/DiscussionForumManager.java | 4 +- .../ui/PrivateMessageManager.java | 6 +- .../ui/UIPermissionsManager.java | 2 +- .../messageforums/DiscussionForumTool.java | 145 +++++++++++++----- .../MessageForumPublishToFaqBean.java | 4 +- .../messageforums/PrivateMessagesTool.java | 12 +- .../messageforums/jsf/AjaxPhaseListener.java | 8 +- .../messageforums/ui/DiscussionTopicBean.java | 18 +-- .../ui/MessageForumStatisticsBean.java | 4 +- .../ui/MessageForumSynopticBean.java | 6 +- .../tool/messageforums/ui/PermissionBean.java | 10 +- .../src/webapp/css/msgcntr.css | 8 +- .../messageforums-app/src/webapp/js/forum.js | 4 +- .../discussionForum/message/dfAllMessages.jsp | 14 +- .../discussionForum/message/dfFlatView.jsp | 4 +- .../message/dfViewSearchBar.jsp | 8 +- .../discussionForum/message/dfViewThread.jsp | 2 +- .../message/dfViewThreadBodyInclude.jsp | 8 +- .../permissions/permissions_include.jsp | 4 +- .../src/webapp/jsp/synoptic/synMain.jsp | 26 ++-- .../app/messageforums/AreaManagerImpl.java | 2 +- .../DefaultPermissionsManagerImpl.java | 8 +- .../MessageForumsMessageManagerImpl.java | 33 ++-- .../PermissionLevelManagerImpl.java | 18 +-- .../messageforums/PermissionManagerImpl.java | 36 ++--- .../ForumMessageEntityProviderImpl.java | 26 ++-- .../ui/DiscussionForumManagerImpl.java | 10 +- .../ui/PrivateMessageManagerImpl.java | 22 +-- .../ui/UIPermissionsManagerImpl.java | 8 +- .../dao/hibernate/MessagePermissionsImpl.java | 10 +- .../dao/hibernate/PermissionLevelImpl.hbm.xml | 2 +- .../dao/hibernate/PermissionLevelImpl.java | 20 +-- 40 files changed, 314 insertions(+), 232 deletions(-) diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java index 316b9d27d380..bfdb60624f2e 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/ForumEntity.java @@ -495,7 +495,7 @@ private void setMasks() { noneMask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(false)); noneMask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(false)); noneMask.put(PermissionLevel.READ, Boolean.valueOf(false)); - noneMask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(false)); + noneMask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(true)); noneMask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(false)); noneMask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); noneMask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); @@ -513,7 +513,7 @@ private void setMasks() { contributorMask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(false)); contributorMask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(false)); contributorMask.put(PermissionLevel.READ, Boolean.valueOf(true)); - contributorMask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(true)); + contributorMask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(false)); contributorMask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(false)); contributorMask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); contributorMask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); @@ -531,7 +531,7 @@ private void setMasks() { ownerMask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(true)); ownerMask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(true)); ownerMask.put(PermissionLevel.READ, Boolean.valueOf(true)); - ownerMask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(true)); + ownerMask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(false)); ownerMask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(true)); ownerMask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); ownerMask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); diff --git a/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages.properties b/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages.properties index b1540c0c1e7d..d0ec1338954b 100644 --- a/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages.properties +++ b/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages.properties @@ -56,7 +56,7 @@ cdfm_toolbar_separator = | cdfm_moderator_comment_text = Comment By cdfm_moderator_comment_text_anon = Comment By Moderator cdfm_moderate = Moderate -cdfm_mark_as_read=Mark as Read +cdfm_mark_as_not_read=Mark as Not Read cdfm_readby= - Read by: stat_list = Statistics & Grading stat_list_student = Statistics @@ -183,7 +183,7 @@ cdfm_mark_check_as_read=Mark Read cdfm_mark_check_as_unread=Mark Unread cdfm_mark_check_as_delete=Delete cdfm_mark_check_move_to_folder=Move -cdfm_mark_all_as_read=Mark All as Read +cdfm_mark_all_as_not_read=Mark All as Not Read cdfm_reply=Reply cdfm_print=Print cdfm_printer_friendly=Printer Friendly Format @@ -303,7 +303,7 @@ cdfm_failed_create_topic=Failed to create new topic cdfm_failed_rend_message=Failed Rending Messages cdfm_view_under_construct=This view is under contruction cdfm_lost_association=Lost association with current topic -cdfm_no_message_mark_read=No message selected to mark as read. Please select a message. +cdfm_no_message_mark_no_read=No message selected to mark as not read. Please select a message. cdfm_grade_successful=Grade submission successful. cdfm_grade_greater_than_zero=Please input a number greater than or equal to 0. cdfm_grade_decimal_warn=Please input number with 2 or fewer digits after decimal point. @@ -413,7 +413,7 @@ perm_revise_any=Edit Any perm_revise_own=Edit Own perm_delete_any=Delete Any perm_delete_own=Delete Own -perm_mark_as_read=Mark as Read +perm_mark_as_not_read=Mark as Not Read perm_choose_assignment_head=Grading perm_choose_assignment=Gradebook item: perm_choose_assignment_none_f=You can associate a grade from the Gradebook to this forum, but there are no existing Gradebook items. @@ -655,7 +655,7 @@ pvt_missing_body = You must write your message before you can send it. pvt_missing_body_draft =You must write your message before you can save it. pvt_confirm_msg_delete = Are you sure you want to delete this message? If yes, click Delete to delete the message. pvt_enter_search_text = Please enter text for search. -pvt_no_message_mark_read=No message selected to mark as read. Please select a message. +pvt_no_message_mark_no_read=No message selected to mark as not read. Please select a message. pvt_no_message_mark_delete=No message selected for deletion. Please select a message. pvt_no_message_mark_move=No message selected to move to another folder. Please select a message. pvt_deleted_success=The message(s) you selected have been successfully moved to the Deleted folder. @@ -698,7 +698,7 @@ pvt_scheduler_send= Schedule when this message will be sent pvt_scheduler_send_as_email= Schedule the message to be sent at the selected date and time pvt_scheduler_send_date= Date: syn_anon=No unread message counts as you aren't logged in. -syn_mark_as_read=Mark all as read +syn_mark_as_not_read=Mark all as not read syn_site_heading=Site syn_private_heading=New Messages syn_discussion_heading=New in Discussions diff --git a/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages_es.properties b/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages_es.properties index cff7d5c5da1a..ade5d6da3017 100644 --- a/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages_es.properties +++ b/msgcntr/messageforums-api/src/bundle/org/sakaiproject/api/app/messagecenter/bundle/Messages_es.properties @@ -56,7 +56,7 @@ cdfm_toolbar_separator=| cdfm_moderator_comment_text=Comentario de cdfm_moderator_comment_text_anon=Comentario del moderador cdfm_moderate=Moderar -cdfm_mark_as_read=Marcar como le\u00eddo +cdfm_mark_as_not_read=Marcar como no le\u00eddo cdfm_readby=- Le\u00eddo por\: stat_list=Estad\u00edsticas y calificaci\u00f3n stat_list_student=Estad\u00edsticas @@ -183,7 +183,7 @@ cdfm_mark_check_as_read=Marcar le\u00eddos cdfm_mark_check_as_unread=Marcar no le\u00eddos cdfm_mark_check_as_delete=Eliminar cdfm_mark_check_move_to_folder=Mover -cdfm_mark_all_as_read=Marcar todos como le\u00eddos +cdfm_mark_all_as_not_read=Marcar todos como no le\u00eddos cdfm_reply=Responder cdfm_print=Imprimir cdfm_printer_friendly=Versi\u00f3n imprimible @@ -409,7 +409,7 @@ perm_revise_any=Editar cualquiera perm_revise_own=Editar propios perm_delete_any=Eliminar cualquiera perm_delete_own=Eliminar propios -perm_mark_as_read=Marcar como le\u00eddo +perm_mark_as_read=Marcar como no le\u00eddo perm_choose_assignment_head=Calificaci\u00f3n perm_choose_assignment=\u00cdtem de calificaci\u00f3n\: perm_choose_assignment_none_f=Puede asociar un \u00edtem de Calificaciones con este foro, sin embargo, no hay todav\u00eda \u00edtems creados. @@ -651,7 +651,7 @@ pvt_missing_body=Debe escribir el mensaje antes de enviarlo. pvt_missing_body_draft=Debe escribir el mensaje antes de guardarlo. pvt_confirm_msg_delete=\u00bfEst\u00e1 seguro que desea eliminar este mensaje? En caso afirmativo, haga clic en Eliminar para eliminar el mensaje. pvt_enter_search_text=Introduzca el texto de b\u00fasqueda. -pvt_no_message_mark_read=No se ha seleccionado ning\u00fan mensaje para marcarlo como le\u00eddo. Seleccione un mensaje. +pvt_no_message_mark_no_read=No se ha seleccionado ning\u00fan mensaje para marcarlo como no le\u00eddo. Seleccione un mensaje. pvt_no_message_mark_delete=No hay mensajes seleccionados para eliminar. Seleccione un mensaje. pvt_no_message_mark_move=No hay mensajes seleccionados para mover a otra carpeta. Seleccione un mensaje. pvt_deleted_success=Los mensajes seleccionados se han movido correctamente a la carpeta de mensajes Eliminados. @@ -694,7 +694,7 @@ pvt_scheduler_send=Programar env\u00edo pvt_scheduler_send_as_email=Programar el env\u00edo del mensaje en la fecha y hora seleccionada pvt_scheduler_send_date=Fecha\: syn_anon=Si no hay mensajes sin leer, se considera que no est\u00e1 conectado. -syn_mark_as_read=Marcar todos como le\u00eddos +syn_mark_as_not_read=Marcar todos como no le\u00eddos syn_site_heading=Sitio syn_private_heading=Mensajes nuevos syn_discussion_heading=Nuevos mensajes en foros diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/BulkPermission.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/BulkPermission.java index 25dff7bb83f0..49f6755515fb 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/BulkPermission.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/BulkPermission.java @@ -23,7 +23,7 @@ public class BulkPermission { private boolean changeSettings; private boolean deleteAny; private boolean deleteOwn; - private boolean markAsRead; + private boolean markAsNotRead; private boolean moderatePostings; private boolean movePostings; private boolean newResponse; @@ -35,7 +35,7 @@ public class BulkPermission { private boolean reviseOwn; public void setAllPermissions(boolean toTrueOrFalse) { - changeSettings = deleteAny = deleteOwn = markAsRead = moderatePostings = movePostings = newTopic + changeSettings = deleteAny = deleteOwn = markAsNotRead = moderatePostings = movePostings = newTopic = newResponse = newResponseToResponse = postToGradebook = read = reviseAny = reviseOwn = toTrueOrFalse; } diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/DefaultPermissionsManager.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/DefaultPermissionsManager.java index 6e8b9184d995..6622101b8fe7 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/DefaultPermissionsManager.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/DefaultPermissionsManager.java @@ -39,7 +39,7 @@ public interface DefaultPermissionsManager public static final String FUNCTION_REVISE_OWN="messagecenter.reviseOwn"; public static final String FUNCTION_DELETE_ANY="messagecenter.deleteAny"; public static final String FUNCTION_DELETE_OWN="messagecenter.deleteOwn"; - public static final String FUNCTION_MARK_AS_READ="messagecenter.markAsRead"; + public static final String FUNCTION_MARK_AS_NOT_READ="messagecenter.markAsNotRead"; public static final String MESSAGE_FUNCTION_PREFIX="msg."; public static final String MESSAGE_FUNCTION_EMAIL= MESSAGE_FUNCTION_PREFIX +"emailout"; @@ -83,6 +83,6 @@ public interface DefaultPermissionsManager public boolean isDeleteOwn(String role); - public boolean isMarkAsRead(String role); + public boolean isMarkAsNotRead(String role); } diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessageForumsMessageManager.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessageForumsMessageManager.java index dcc52bf410b0..283c2c1b66b7 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessageForumsMessageManager.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessageForumsMessageManager.java @@ -98,13 +98,13 @@ String saveMessage(Message message, boolean logEvent, String toolId, String user public void markMessageApproval(Long messageId, boolean approved); - public void markMessageReadForUser(Long topicId, Long messageId, boolean read); + public void markMessageNotReadForUser(Long topicId, Long messageId, boolean read); - public void markMessageReadForUser(Long topicId, Long messageId, boolean read, String userId); + public void markMessageNotReadForUser(Long topicId, Long messageId, boolean read, String userId); - public void markMessageReadForUser(Long topicId, Long messageId, boolean read, String userId, String context, String toolId); + public void markMessageNotReadForUser(Long topicId, Long messageId, boolean read, String userId, String context, String toolId); - public boolean isMessageReadForUser(Long topicId, Long messageId); + public boolean isMessageNotReadForUser(Long topicId, Long messageId); public UnreadStatus findUnreadStatus(Long topicId, Long messageId); diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessagePermissions.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessagePermissions.java index dd33d5f1fe05..64c076909ebb 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessagePermissions.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/MessagePermissions.java @@ -52,9 +52,9 @@ public interface MessagePermissions { public Boolean getReviseOwn(); - public Boolean getMarkAsRead(); + public Boolean getMarkAsNotRead(); - public void setMarkAsRead(Boolean markAsRead); + public void setMarkAsNotRead(Boolean markAsNotRead); public void setReviseOwn(Boolean reviseOwn); diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionLevel.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionLevel.java index 1f8e9ae88fc8..954cc0b0bc59 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionLevel.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/PermissionLevel.java @@ -30,7 +30,7 @@ public interface PermissionLevel extends MutableEntity{ public static final String CHANGE_SETTINGS = "changeSettings"; public static final String POST_TO_GRADEBOOK = "postToGradebook"; public static final String READ = "read"; - public static final String MARK_AS_READ = "markAsRead"; + public static final String MARK_AS_NOT_READ = "markAsNotRead"; public static final String MODERATE_POSTINGS = "moderatePostings"; public static final String IDENTIFY_ANON_AUTHORS = "identifyAnonAuthors"; public static final String DELETE_OWN = "deleteOwn"; @@ -58,9 +58,9 @@ public interface PermissionLevel extends MutableEntity{ public void setDeleteOwn(Boolean deleteOwn); - public Boolean getMarkAsRead(); + public Boolean getMarkAsNotRead(); - public void setMarkAsRead(Boolean markAsRead); + public void setMarkAsNotRead(Boolean markAsNotRead); public Boolean getModeratePostings(); diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/DiscussionForumManager.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/DiscussionForumManager.java index 809fe3bada44..ee7e08f7a6d6 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/DiscussionForumManager.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/DiscussionForumManager.java @@ -439,12 +439,12 @@ public void saveTopicMessagePermissions(DiscussionTopic topic, public void markMessageAs(Message message, boolean readStatus); /** - * Mark the read status for a given message for a given user + * Mark the not read status for a given message for a given user * @param message * @param readStatus * @param userId */ - public void markMessageReadStatusForUser(Message message, boolean readStatus, String userId); + public void markMessageNotReadStatusForUser(Message message, boolean readStatus, String userId); /** diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/PrivateMessageManager.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/PrivateMessageManager.java index 16fb15bf8db2..97d384bcdcf4 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/PrivateMessageManager.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/PrivateMessageManager.java @@ -69,9 +69,9 @@ public interface PrivateMessageManager { public void saveForumSettings(PrivateForum forum); - public void markMessageAsReadForUser(final PrivateMessage message); - public void markMessageAsReadForUser(final PrivateMessage message, final String contextId); - public void markMessageAsReadForUser(final PrivateMessage message, final String contextId, final String userId, String toolId); + public void markMessageAsNotReadForUser(final PrivateMessage message); + public void markMessageAsNotReadForUser(final PrivateMessage message, final String contextId); + public void markMessageAsNotReadForUser(final PrivateMessage message, final String contextId, final String userId, String toolId); public void markMessageAsUnreadForUser(final PrivateMessage message); public void markMessageAsUnreadForUser(final PrivateMessage message, final String contextId); diff --git a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/UIPermissionsManager.java b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/UIPermissionsManager.java index 3a02300b5d9e..a882d5052d18 100644 --- a/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/UIPermissionsManager.java +++ b/msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/UIPermissionsManager.java @@ -190,7 +190,7 @@ public interface UIPermissionsManager * @param topic * @return */ - public boolean isMarkAsRead(DiscussionTopic topic, DiscussionForum forum); + public boolean isMarkAsNotRead(DiscussionTopic topic, DiscussionForum forum); /** * Returns whether current user has perm to moderate in this situation diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java index 959277825175..3d20669fd724 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java @@ -299,7 +299,7 @@ public class DiscussionForumTool { private static final String FAILED_REND_MESSAGE = "cdfm_failed_rend_message"; private static final String VIEW_UNDER_CONSTRUCT = "cdfm_view_under_construct"; private static final String LOST_ASSOCIATE = "cdfm_lost_association"; - private static final String NO_MARKED_READ_MESSAGE = "cdfm_no_message_mark_read"; + private static final String NO_MARKED_NO_READ_MESSAGE = "cdfm_no_message_mark_no_read"; private static final String GRADE_SUCCESSFUL = "cdfm_grade_successful"; private static final String GRADE_GREATER_ZERO = "cdfm_grade_greater_than_zero"; private static final String GRADE_DECIMAL_WARN = "cdfm_grade_decimal_warn"; @@ -2676,12 +2676,83 @@ else if (((DiscussionMessageBean)msgsList.get(i)).getMessage().getInReplyTo() == // now process the complete list of messages in the selected thread to possibly flag as read // if this topic is flagged to autoMarkThreadsRead, mark each message in the thread as read - if (selectedTopic.getTopic().getAutoMarkThreadsRead()) { - for (int i = 0; i < selectedThread.size(); i++) { - messageManager.markMessageReadForUser(selectedTopic.getTopic().getId(), ((DiscussionMessageBean)selectedThread.get(i)).getMessage().getId(), true); + // mark all as read + //if (selectedTopic.getTopic().getAutoMarkThreadsRead()) { + for (int i = 0; i < selectedThread.size(); i++) { + messageManager.markMessageNotReadForUser(selectedTopic.getTopic().getId(), ((DiscussionMessageBean)selectedThread.get(i)).getMessage().getId(), false); ((DiscussionMessageBean)selectedThread.get(i)).setRead(Boolean.TRUE); } + //} + + boolean postFirst = getNeedToPostFirst(); + if(postFirst){ + //user can't view this message until they have posted a message: + selectedMessage = null; } + + return THREAD_VIEW; + } + + public String processActionGetDisplayThread(boolean readStatus) + { + if(selectedTopic == null) + { + log.debug("no topic is selected in processActionGetDisplayThread."); + return gotoMain(); + } + selectedTopic = getDecoratedTopic(selectedTopic.getTopic()); + + setTopicBeanAssign(); + selectedTopic = getSelectedTopic(); + + List msgsList = selectedTopic.getMessages(); + + if (msgsList != null && !msgsList.isEmpty()) + msgsList = filterModeratedMessages(msgsList, selectedTopic.getTopic(), (DiscussionForum) selectedTopic.getTopic().getBaseForum()); + + List orderedList = new ArrayList(); + selectedThread = new ArrayList(); + + Boolean foundHead = false; + Boolean foundAfterHead = false; + threadMoved = didThreadMove(); + + //determine to make sure that selectedThreadHead does exist! + if(selectedThreadHead == null){ + return MAIN; + } + + for(int i=0; i - + --%> <%-- thread metadata (count) --%> @@ -398,11 +398,11 @@ <%-- author column --%> - - - + + - + diff --git a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfFlatView.jsp b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfFlatView.jsp index 3838647bc2b3..3568218e4563 100644 --- a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfFlatView.jsp +++ b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfFlatView.jsp @@ -106,8 +106,8 @@
- - + +
diff --git a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewSearchBar.jsp b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewSearchBar.jsp index efa087f13490..b1c573130b1f 100644 --- a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewSearchBar.jsp +++ b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewSearchBar.jsp @@ -68,16 +68,16 @@ <%-- - + --%> <%----%> <%-- - + diff --git a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThread.jsp b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThread.jsp index e682fe7dfaca..c1dc0497b2f7 100644 --- a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThread.jsp +++ b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThread.jsp @@ -122,7 +122,7 @@   -   +   diff --git a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp index d24bf603959d..19b8c7c50467 100644 --- a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp +++ b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp @@ -84,11 +84,11 @@ <%-- mark as read link --%> - + <%-- Reply link --%> diff --git a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/permissions/permissions_include.jsp b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/permissions/permissions_include.jsp index cb87db8a965e..77afa3473463 100644 --- a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/permissions/permissions_include.jsp +++ b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/permissions/permissions_include.jsp @@ -119,8 +119,8 @@ - - + + diff --git a/msgcntr/messageforums-app/src/webapp/jsp/synoptic/synMain.jsp b/msgcntr/messageforums-app/src/webapp/jsp/synoptic/synMain.jsp index c407a32c82ac..4389205a002c 100644 --- a/msgcntr/messageforums-app/src/webapp/jsp/synoptic/synMain.jsp +++ b/msgcntr/messageforums-app/src/webapp/jsp/synoptic/synMain.jsp @@ -70,16 +70,16 @@ --%> + title="#{msgs.syn_mark_as_not_read}"> - - + + <%-- - --%> @@ -141,16 +141,16 @@ - Read" escape="false" title="#{msgs.syn_goto_messages}" rendered="#{mfSynopticBean.siteInfo.unreadPrivateAmt > 0}" /> - - - + + + @@ -179,9 +179,9 @@ -
- +
diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java index eb94b72d7a47..7ec09ed590c5 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/AreaManagerImpl.java @@ -72,7 +72,7 @@ public class AreaManagerImpl extends HibernateDaoSupport implements AreaManager private MessageForumsTypeManager typeManager; private ServerConfigurationService serverConfigurationService; - private Boolean DEFAULT_AUTO_MARK_READ = false; + private Boolean DEFAULT_AUTO_MARK_READ = false; private SiteService siteService; private ToolManager toolManager; diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java index f0e82bb64772..34e0b3a3fd99 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DefaultPermissionsManagerImpl.java @@ -94,7 +94,7 @@ public void init() functionManager.registerFunction(DefaultPermissionsManager.FUNCTION_REVISE_OWN); functionManager.registerFunction(DefaultPermissionsManager.FUNCTION_DELETE_ANY); functionManager.registerFunction(DefaultPermissionsManager.FUNCTION_DELETE_OWN); - functionManager.registerFunction(DefaultPermissionsManager.FUNCTION_MARK_AS_READ);*/ + functionManager.registerFunction(DefaultPermissionsManager.FUNCTION_MARK_AS_NOT_READ);*/ } /** * @param functionManager The functionManager to set. @@ -217,11 +217,11 @@ public boolean isDeleteOwn(String role) } /* (non-Javadoc) - * @see org.sakaiproject.api.app.messageforums.DefaultPermissionsManager#isMarkAsRead(java.lang.String) + * @see org.sakaiproject.api.app.messageforums.DefaultPermissionsManager#isMarkAsNotRead(java.lang.String) */ - public boolean isMarkAsRead(String role) + public boolean isMarkAsNotRead(String role) { - return hasPermission(role, DefaultPermissionsManager.FUNCTION_MARK_AS_READ); + return hasPermission(role, DefaultPermissionsManager.FUNCTION_MARK_AS_NOT_READ); } private boolean hasPermission(String role, String permission) diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java index 85ec06bb3a3e..a0217ded1cef 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java @@ -1130,37 +1130,37 @@ private boolean isMessageFromForums(Message message) { return message.getTopic() != null; } - public void markMessageReadForUser(Long topicId, Long messageId, boolean read) { + public void markMessageNotReadForUser(Long topicId, Long messageId, boolean read) { if (messageId == null || topicId == null) { - log.error("markMessageReadForUser failed with topicId: " + topicId + ", messageId: " + messageId); + log.error("markMessageReadNotForUser failed with topicId: " + topicId + ", messageId: " + messageId); throw new IllegalArgumentException("Null Argument"); } - log.debug("markMessageReadForUser executing with topicId: " + topicId + ", messageId: " + messageId); + log.debug("markMessageNotReadForUser executing with topicId: " + topicId + ", messageId: " + messageId); if(getCurrentUser()!=null){ - markMessageReadForUser(topicId, messageId, read, getCurrentUser()); + markMessageNotReadForUser(topicId, messageId, read, getCurrentUser()); } else return; } - public void markMessageReadForUser(Long topicId, Long messageId, boolean read, String userId) + public void markMessageNotReadForUser(Long topicId, Long messageId, boolean read, String userId) { - markMessageReadForUser(topicId, messageId, read, userId, toolManager.getCurrentPlacement().getContext(), toolManager.getCurrentTool().getId()); + markMessageNotReadForUser(topicId, messageId, read, userId, toolManager.getCurrentPlacement().getContext(), toolManager.getCurrentTool().getId()); } - public void markMessageReadForUser(Long topicId, Long messageId, boolean read, String userId, String context, String toolId) + public void markMessageNotReadForUser(Long topicId, Long messageId, boolean read, String userId, String context, String toolId) { // to only add to event log if not read boolean trulyUnread; boolean originalReadStatus; if (messageId == null || topicId == null || userId == null) { - log.error("markMessageReadForUser failed with topicId: " + topicId + ", messageId: " + messageId + ", userId: " + userId); + log.error("markMessageNotReadForUser failed with topicId: " + topicId + ", messageId: " + messageId + ", userId: " + userId); throw new IllegalArgumentException("Null Argument"); } - log.debug("markMessageReadForUser executing with topicId: " + topicId + ", messageId: " + messageId); + log.debug("markMessageNotReadForUser executing with topicId: " + topicId + ", messageId: " + messageId); UnreadStatus status = findUnreadStatusByUserId(topicId, messageId, userId); if (status == null) { @@ -1177,7 +1177,7 @@ public void markMessageReadForUser(Long topicId, Long messageId, boolean read, S status.setTopicId(topicId); status.setMessageId(messageId); status.setUserId(userId); - status.setRead(Boolean.valueOf(read)); + status.setRead(!Boolean.valueOf(read)); Message message = (Message) getMessageById(messageId); boolean isMessageFromForums = isMessageFromForums(message); @@ -1199,6 +1199,17 @@ public void markMessageReadForUser(Long topicId, Long messageId, boolean read, S eventTrackingService.post(eventTrackingService.newEvent(DiscussionForumService.EVENT_FORUMS_READ, getEventMessage(message, toolId, userId, context), false)); else eventTrackingService.post(eventTrackingService.newEvent(DiscussionForumService.EVENT_MESSAGES_READ, getEventMessage(message, toolId, userId, context), false)); + } else if (!trulyUnread && read) { + //decrement the message count + Integer nr = message.getNumReaders(); + if (nr == null) + nr = Integer.valueOf(0); + if (nr > 0 ) { + nr = Integer.valueOf(nr.intValue() - 1); + } + message.setNumReaders(nr); + log.debug("set Message readers count to: " + nr); + message = this.saveOrUpdateMessage(message, false, toolId, userId, context, true); } getHibernateTemplate().saveOrUpdate(status); @@ -1330,7 +1341,7 @@ public void incrementMessagesSynopticToolInfo(String userId, String siteId, int } - public boolean isMessageReadForUser(final Long topicId, final Long messageId) { + public boolean isMessageNotReadForUser(final Long topicId, final Long messageId) { if (messageId == null || topicId == null) { log.error("getMessageById failed with topicId: " + topicId + ", messageId: " + messageId); throw new IllegalArgumentException("Null Argument"); diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java index ea984b469682..b95116c99cb1 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionLevelManagerImpl.java @@ -533,8 +533,8 @@ else if (customPermName.equals(PermissionLevel.DELETE_ANY)) return permissionLevel.getDeleteAny(); else if (customPermName.equals(PermissionLevel.DELETE_OWN)) return permissionLevel.getDeleteOwn(); - else if (customPermName.equals(PermissionLevel.MARK_AS_READ)) - return permissionLevel.getMarkAsRead(); + else if (customPermName.equals(PermissionLevel.MARK_AS_NOT_READ)) + return permissionLevel.getMarkAsNotRead(); else if (customPermName.equals(PermissionLevel.MODERATE_POSTINGS)) return permissionLevel.getModeratePostings(); else if (customPermName.equals(PermissionLevel.IDENTIFY_ANON_AUTHORS)) @@ -563,7 +563,7 @@ public List getCustomPermissions() { customPerms.add(PermissionLevel.NEW_TOPIC); customPerms.add(PermissionLevel.DELETE_ANY); customPerms.add(PermissionLevel.DELETE_OWN); - customPerms.add(PermissionLevel.MARK_AS_READ); + customPerms.add(PermissionLevel.MARK_AS_NOT_READ); customPerms.add(PermissionLevel.MODERATE_POSTINGS); customPerms.add(PermissionLevel.IDENTIFY_ANON_AUTHORS); customPerms.add(PermissionLevel.MOVE_POSTING); @@ -774,7 +774,7 @@ private PermissionsMask getDefaultOwnerPermissionsMask() { mask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(true)); mask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(true)); mask.put(PermissionLevel.READ, Boolean.valueOf(true)); - mask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(true)); + mask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(false)); mask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(true)); mask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(true)); mask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); @@ -795,7 +795,7 @@ private PermissionsMask getDefaultAuthorPermissionsMask() { mask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(true)); mask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(true)); mask.put(PermissionLevel.READ, Boolean.valueOf(true)); - mask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(true)); + mask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(false)); mask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(false)); mask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); mask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(true)); @@ -816,7 +816,7 @@ private PermissionsMask getDefaultContributorPermissionsMask() { mask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(false)); mask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(false)); mask.put(PermissionLevel.READ, Boolean.valueOf(true)); - mask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(true)); + mask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(false)); mask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(false)); mask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); mask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); @@ -837,7 +837,7 @@ private PermissionsMask getDefaultNoneditingAuthorPermissionsMask() { mask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(true)); mask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(true)); mask.put(PermissionLevel.READ, Boolean.valueOf(true)); - mask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(true)); + mask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(false)); mask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(false)); mask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); mask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); @@ -858,7 +858,7 @@ private PermissionsMask getDefaultNonePermissionsMask() { mask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(false)); mask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(false)); mask.put(PermissionLevel.READ, Boolean.valueOf(false)); - mask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(false)); + mask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(true)); mask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(false)); mask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); mask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); @@ -879,7 +879,7 @@ private PermissionsMask getDefaultReviewerPermissionsMask() { mask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(false)); mask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(false)); mask.put(PermissionLevel.READ, Boolean.valueOf(true)); - mask.put(PermissionLevel.MARK_AS_READ,Boolean.valueOf(true)); + mask.put(PermissionLevel.MARK_AS_NOT_READ,Boolean.valueOf(false)); mask.put(PermissionLevel.MODERATE_POSTINGS, Boolean.valueOf(false)); mask.put(PermissionLevel.IDENTIFY_ANON_AUTHORS, Boolean.valueOf(false)); mask.put(PermissionLevel.DELETE_OWN, Boolean.valueOf(false)); diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java index 5698f12ca0a4..1750678fa78d 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/PermissionManagerImpl.java @@ -524,7 +524,7 @@ public MessagePermissions getAreaMessagePermissionForRole(String role, String ty // mp.setReadDrafts(Boolean.FALSE); // mp.setReviseAny(Boolean.FALSE); // mp.setReviseOwn(Boolean.FALSE); -// mp.setMarkAsRead(Boolean.FALSE); +// mp.setMarkAsNotRead(Boolean.TRUE); return getDefaultAreaMessagePermissionForRole(role, typeId); } else { mp.setDeleteAny(permissions.getDeleteAny()); @@ -533,7 +533,7 @@ public MessagePermissions getAreaMessagePermissionForRole(String role, String ty mp.setReadDrafts(permissions.getReadDrafts()); mp.setReviseAny(permissions.getReviseAny()); mp.setReviseOwn(permissions.getReviseOwn()); - mp.setMarkAsRead(permissions.getMarkAsRead()); + mp.setMarkAsNotRead(permissions.getMarkAsNotRead()); } mp.setRole(role); @@ -555,7 +555,7 @@ public MessagePermissions getDefaultAreaMessagePermissionForRole(String role, St // mp.setReadDrafts(Boolean.FALSE); // mp.setReviseAny(Boolean.FALSE); // mp.setReviseOwn(Boolean.FALSE); -// mp.setMarkAsRead(Boolean.FALSE); +// mp.setMarkAsNotRead(Boolean.TRUE); // } else { // mp.setDeleteAny(permissions.getDeleteAny()); // mp.setDeleteOwn(permissions.getDeleteOwn()); @@ -563,7 +563,7 @@ public MessagePermissions getDefaultAreaMessagePermissionForRole(String role, St // mp.setReadDrafts(permissions.getReadDrafts()); // mp.setReviseAny(permissions.getReviseAny()); // mp.setReviseOwn(permissions.getReviseOwn()); -// mp.setMarkAsRead(permissions.getMarkAsRead()); +// mp.setMarkAsNotRead(permissions.getMarkAsNotRead()); // } mp.setRole(role); mp.setDeleteAny(Boolean.valueOf(defaultPermissionsManager.isDeleteAny(role))); @@ -572,7 +572,7 @@ public MessagePermissions getDefaultAreaMessagePermissionForRole(String role, St mp.setReadDrafts(Boolean.valueOf(false)); mp.setReviseAny(Boolean.valueOf(defaultPermissionsManager.isReviseAny(role))); mp.setReviseOwn(Boolean.valueOf(defaultPermissionsManager.isReviseOwn(role))); - mp.setMarkAsRead(Boolean.valueOf(defaultPermissionsManager.isMarkAsRead(role))); + mp.setMarkAsNotRead(Boolean.valueOf(defaultPermissionsManager.isMarkAsNotRead(role))); return mp; } @@ -591,7 +591,7 @@ public MessagePermissions createAreaMessagePermissionForRole(String role, String permissions.setReadDrafts(mp.getReadDrafts()); permissions.setReviseAny(mp.getReviseAny()); permissions.setReviseOwn(mp.getReviseOwn()); - permissions.setMarkAsRead(mp.getMarkAsRead()); + permissions.setMarkAsNotRead(mp.getMarkAsNotRead()); permissions.setRole(role); } return permissions; @@ -617,7 +617,7 @@ public void saveAreaMessagePermissionForRole(Area area, MessagePermissions permi permissions.setReviseAny(permission.getReviseAny()); permissions.setReviseOwn(permission.getReviseOwn()); permissions.setRole(permission.getRole()); - permissions.setMarkAsRead(permission.getMarkAsRead()); + permissions.setMarkAsNotRead(permission.getMarkAsNotRead()); getHibernateTemplate().saveOrUpdate(permissions); // Commented out when splitting events between Messages tool and Forums tool @@ -647,7 +647,7 @@ public void saveDefaultAreaMessagePermissionForRole(Area area, MessagePermission permissions.setReadDrafts(permission.getReadDrafts()); permissions.setReviseAny(permission.getReviseAny()); permissions.setReviseOwn(permission.getReviseOwn()); - permissions.setMarkAsRead(permission.getMarkAsRead()); + permissions.setMarkAsNotRead(permission.getMarkAsNotRead()); permissions.setRole(permission.getRole()); getHibernateTemplate().saveOrUpdate(permissions); @@ -676,7 +676,7 @@ public MessagePermissions getForumMessagePermissionForRole(BaseForum forum, Stri mp.setReadDrafts(permissions.getReadDrafts()); mp.setReviseAny(permissions.getReviseAny()); mp.setReviseOwn(permissions.getReviseOwn()); - mp.setMarkAsRead(permissions.getMarkAsRead()); + mp.setMarkAsNotRead(permissions.getMarkAsNotRead()); } mp.setRole(role); @@ -700,7 +700,7 @@ public MessagePermissions getDefaultForumMessagePermissionForRole(BaseForum foru mp.setReadDrafts(permissions.getReadDrafts()); mp.setReviseAny(permissions.getReviseAny()); mp.setReviseOwn(permissions.getReviseOwn()); - mp.setMarkAsRead(permissions.getMarkAsRead()); + mp.setMarkAsNotRead(permissions.getMarkAsNotRead()); } mp.setRole(role); @@ -722,7 +722,7 @@ public MessagePermissions createForumMessagePermissionForRole(String role, Strin permissions.setReadDrafts(mp.getReadDrafts()); permissions.setReviseAny(mp.getReviseAny()); permissions.setReviseOwn(mp.getReviseOwn()); - permissions.setMarkAsRead(mp.getMarkAsRead()); + permissions.setMarkAsNotRead(mp.getMarkAsNotRead()); permissions.setRole(role); } return permissions; @@ -747,7 +747,7 @@ public void saveForumMessagePermissionForRole(BaseForum forum, MessagePermission permissions.setReadDrafts(permission.getReadDrafts()); permissions.setReviseAny(permission.getReviseAny()); permissions.setReviseOwn(permission.getReviseOwn()); - permissions.setMarkAsRead(permission.getMarkAsRead()); + permissions.setMarkAsNotRead(permission.getMarkAsNotRead()); permissions.setRole(permission.getRole()); getHibernateTemplate().saveOrUpdate(permissions); @@ -779,7 +779,7 @@ public void saveDefaultForumMessagePermissionForRole(BaseForum forum, MessagePer permissions.setReadDrafts(permission.getReadDrafts()); permissions.setReviseAny(permission.getReviseAny()); permissions.setReviseOwn(permission.getReviseOwn()); - permissions.setMarkAsRead(permission.getMarkAsRead()); + permissions.setMarkAsNotRead(permission.getMarkAsNotRead()); permissions.setRole(permission.getRole()); getHibernateTemplate().saveOrUpdate(permissions); @@ -809,7 +809,7 @@ public MessagePermissions getTopicMessagePermissionForRole(Topic topic, String r mp.setReadDrafts(permissions.getReadDrafts()); mp.setReviseAny(permissions.getReviseAny()); mp.setReviseOwn(permissions.getReviseOwn()); - mp.setMarkAsRead(permissions.getMarkAsRead()); + mp.setMarkAsNotRead(permissions.getMarkAsNotRead()); } mp.setRole(role); @@ -833,7 +833,7 @@ public MessagePermissions getDefaultTopicMessagePermissionForRole(Topic topic, S mp.setReadDrafts(permissions.getReadDrafts()); mp.setReviseAny(permissions.getReviseAny()); mp.setReviseOwn(permissions.getReviseOwn()); - mp.setMarkAsRead(permissions.getMarkAsRead()); + mp.setMarkAsNotRead(permissions.getMarkAsNotRead()); } mp.setRole(role); @@ -855,7 +855,7 @@ public MessagePermissions createTopicMessagePermissionForRole(BaseForum forum, S permissions.setReadDrafts(mp.getReadDrafts()); permissions.setReviseAny(mp.getReviseAny()); permissions.setReviseOwn(mp.getReviseOwn()); - permissions.setMarkAsRead(mp.getMarkAsRead()); + permissions.setMarkAsNotRead(mp.getMarkAsNotRead()); permissions.setRole(role); } return permissions; @@ -880,7 +880,7 @@ public void saveTopicMessagePermissionForRole(Topic topic, MessagePermissions pe permissions.setReadDrafts(permission.getReadDrafts()); permissions.setReviseAny(permission.getReviseAny()); permissions.setReviseOwn(permission.getReviseOwn()); - permissions.setMarkAsRead(permission.getMarkAsRead()); + permissions.setMarkAsNotRead(permission.getMarkAsNotRead()); permissions.setRole(permission.getRole()); getHibernateTemplate().saveOrUpdate(permissions); @@ -912,7 +912,7 @@ public void saveDefaultTopicMessagePermissionForRole(Topic topic, MessagePermiss permissions.setReadDrafts(permission.getReadDrafts()); permissions.setReviseAny(permission.getReviseAny()); permissions.setReviseOwn(permission.getReviseOwn()); - permissions.setMarkAsRead(permission.getMarkAsRead()); + permissions.setMarkAsNotRead(permission.getMarkAsNotRead()); permissions.setRole(permission.getRole()); getHibernateTemplate().saveOrUpdate(permissions); diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java index cfb4283d8b07..f0b55d6d4163 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java @@ -426,16 +426,16 @@ public int compare(DecoratedMessage arg0, DecoratedMessage arg1) { } - public void markAsRead(String userId, String siteId, String readMessageId, int numOfAttempts) { + public void markAsNotRead(String userId, String siteId, String readMessageId, int numOfAttempts) { try { Message msg = getMessageManager().getMessageById(new Long(readMessageId)); if(msg instanceof PrivateMessage){ String toolId = DiscussionForumService.MESSAGES_TOOL_ID; - getPrivateMessageManager().markMessageAsReadForUser((PrivateMessage) msg, siteId, userId, toolId); + getPrivateMessageManager().markMessageAsNotReadForUser((PrivateMessage) msg, siteId, userId, toolId); }else{ String toolId = DiscussionForumService.FORUMS_TOOL_ID; String topicId = msg.getTopic().getId().toString(); - messageManager.markMessageReadForUser(new Long(topicId), new Long(readMessageId), true, userId, siteId, toolId); + messageManager.markMessageNotReadForUser(new Long(topicId), new Long(readMessageId), true, userId, siteId, toolId); } } catch (HibernateOptimisticLockingFailureException holfe) { @@ -449,12 +449,12 @@ public void markAsRead(String userId, String siteId, String readMessageId, int n numOfAttempts--; if (numOfAttempts <= 0) { - log.info("ForumMessageEntityProviderImpl: markAsRead: HibernateOptimisticLockingFailureException no more retries left"); + log.info("ForumMessageEntityProviderImpl: markAsNotRead: HibernateOptimisticLockingFailureException no more retries left"); log.error(holfe.getMessage(), holfe); } else { - log.info("ForumMessageEntityProviderImpl: markAsRead: HibernateOptimisticLockingFailureException: attempts left: " + log.info("ForumMessageEntityProviderImpl: markAsNotRead: HibernateOptimisticLockingFailureException: attempts left: " + numOfAttempts); - markAsRead(userId, siteId, readMessageId, numOfAttempts); + markAsNotRead(userId, siteId, readMessageId, numOfAttempts); } } catch (Exception e){ // failed, so wait and try again @@ -467,12 +467,12 @@ public void markAsRead(String userId, String siteId, String readMessageId, int n numOfAttempts--; if (numOfAttempts <= 0) { - log.info("ForumMessageEntityProviderImpl: markAsRead: no more retries left"); + log.info("ForumMessageEntityProviderImpl: markAsNotRead: no more retries left"); log.error(e.getMessage(), e); } else { - log.info("ForumMessageEntityProviderImpl: markAsRead: attempts left: " + log.info("ForumMessageEntityProviderImpl: markAsNotRead: attempts left: " + numOfAttempts); - markAsRead(userId, siteId, readMessageId, numOfAttempts); + markAsNotRead(userId, siteId, readMessageId, numOfAttempts); } } @@ -507,10 +507,10 @@ private List filterModeratedMessages(List messages, DiscussionTopic topic, Discu } /** - * markread/messageId/site/siteId - * markread/messageId/site/siteId + * marknotread/messageId/site/siteId + * marknotread/messageId/site/siteId */ - @EntityCustomAction(action="markread",viewKey=EntityView.VIEW_NEW) + @EntityCustomAction(action="marknotread",viewKey=EntityView.VIEW_NEW) public boolean getForum(EntityView view, Map params) { String messageId = view.getPathSegment(2); String siteId = ""; @@ -524,7 +524,7 @@ public boolean getForum(EntityView view, Map params) { return false; } - markAsRead(userId, siteId, messageId, SynopticMsgcntrManager.NUM_OF_ATTEMPTS); + markAsNotRead(userId, siteId, messageId, SynopticMsgcntrManager.NUM_OF_ATTEMPTS); return true; } diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java index c7c42c57a656..863af7f787a4 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/DiscussionForumManagerImpl.java @@ -1699,11 +1699,11 @@ public void markMessageAs(Message message, boolean readStatus) { if (log.isDebugEnabled()) { - log.debug("markMessageAsRead(Message" + message + ")"); + log.debug("markMessageAsNotRead(Message" + message + ")"); } try { - messageManager.markMessageReadForUser(message.getTopic().getId(), message + messageManager.markMessageNotReadForUser(message.getTopic().getId(), message .getId(), readStatus); } catch (Exception e) @@ -1713,15 +1713,15 @@ public void markMessageAs(Message message, boolean readStatus) } - public void markMessageReadStatusForUser(Message message, boolean readStatus, String userId) + public void markMessageNotReadStatusForUser(Message message, boolean readStatus, String userId) { if (log.isDebugEnabled()) { - log.debug("markMessageReadStatusForUser(Message" + message + " readStatus:" + readStatus + " userId: " + userId + ")"); + log.debug("markMessageNoReadStatusForUser(Message" + message + " readStatus:" + readStatus + " userId: " + userId + ")"); } try { - messageManager.markMessageReadForUser(message.getTopic().getId(), message + messageManager.markMessageNotReadForUser(message.getTopic().getId(), message .getId(), readStatus, userId); } catch (Exception e) diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java index 9ba5a63dd836..351c45dedb36 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/PrivateMessageManagerImpl.java @@ -1529,29 +1529,29 @@ private String buildMessageBody(PrivateMessage message) { /** - * @see org.sakaiproject.api.app.messageforums.ui.PrivateMessageManager#markMessageAsReadForUser(org.sakaiproject.api.app.messageforums.PrivateMessage) + * @see org.sakaiproject.api.app.messageforums.ui.PrivateMessageManager#markMessageAsNotReadForUser(org.sakaiproject.api.app.messageforums.PrivateMessage) */ - public void markMessageAsReadForUser(final PrivateMessage message) + public void markMessageAsNotReadForUser(final PrivateMessage message) { - markMessageAsReadForUser(message, getContextId()); + markMessageAsNotReadForUser(message, getContextId()); } /** * FOR SYNOPTIC TOOL: * Need to pass in contextId also */ - public void markMessageAsReadForUser(final PrivateMessage message, final String contextId) + public void markMessageAsNotReadForUser(final PrivateMessage message, final String contextId) { - markMessageAsReadForUser(message, contextId, getCurrentUser(), toolManager.getCurrentTool().getId()); + markMessageAsNotReadForUser(message, contextId, getCurrentUser(), toolManager.getCurrentTool().getId()); } - public void markMessageAsReadForUser(final PrivateMessage message, final String contextId, final String userId, String toolId) + public void markMessageAsNotReadForUser(final PrivateMessage message, final String contextId, final String userId, String toolId) { if (log.isDebugEnabled()) { - log.debug("markMessageAsReadForUser(message: " + message + ")"); + log.debug("markMessageAsNotReadForUser(message: " + message + ")"); } if (message == null) @@ -1572,9 +1572,9 @@ public void markMessageAsReadForUser(final PrivateMessage message, final String if (recipientList == null || recipientList.size() == 0) { - log.error("markMessageAsReadForUser(message: " + message + log.error("markMessageAsNotReadForUser(message: " + message + ") has empty recipient list"); - throw new RuntimeException("markMessageAsReadForUser(message: " + message + throw new RuntimeException("markMessageAsNotReadForUser(message: " + message + ") has empty recipient list"); } @@ -1642,7 +1642,7 @@ public void sendConfirmationEmail(PrivateMessage pvtMessage, PrivateMessageRecip } /** - * @see org.sakaiproject.api.app.messageforums.ui.PrivateMessageManager#markMessageAsReadForUser(org.sakaiproject.api.app.messageforums.PrivateMessage) + * @see org.sakaiproject.api.app.messageforums.ui.PrivateMessageManager#markMessageAsUnreadForUser(org.sakaiproject.api.app.messageforums.PrivateMessage) */ public void markMessageAsUnreadForUser(final PrivateMessage message) @@ -2411,7 +2411,7 @@ public void processPvtMsgReplySentAction(PrivateMessage currentMessage, PrivateM if (!rrepMsg.getDraft()) { markMessageAsRepliedForUser(currentMessage, rrepMsg.getAuthorId()); String contextId = ((PrivateMessageRecipientImpl)currentMessage.getRecipients().get(0)).getContextId(); - markMessageAsReadForUser(currentMessage, contextId, rrepMsg.getAuthorId(), DiscussionForumService.MESSAGES_TOOL_ID); + markMessageAsNotReadForUser(currentMessage, contextId, rrepMsg.getAuthorId(), DiscussionForumService.MESSAGES_TOOL_ID); LRS_Statement statement = null; try{ statement = getStatementForUserSentPvtMsg(currentMessage.getTitle(), SAKAI_VERB.responded, currentMessage); diff --git a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java index 9da00d92163b..8edad6926a53 100644 --- a/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java +++ b/msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java @@ -64,7 +64,7 @@ public class UIPermissionsManagerImpl implements UIPermissionsManager { private static final Predicate ifChangeSettings = item -> item.getPermissionLevel().getChangeSettings(); private static final Predicate ifDeleteAny = item -> item.getPermissionLevel().getDeleteAny(); private static final Predicate ifDeleteOwn = item -> item.getPermissionLevel().getDeleteOwn(); - private static final Predicate ifMarkAsRead = item -> item.getPermissionLevel().getMarkAsRead(); + private static final Predicate ifMarkAsNotRead = item -> item.getPermissionLevel().getMarkAsNotRead(); private static final Predicate ifModeratePostings = item -> item.getPermissionLevel().getModeratePostings(); private static final Predicate ifMovePosting = item -> item.getPermissionLevel().getMovePosting(); private static final Predicate ifNewResponse = item -> item.getPermissionLevel().getNewResponse(); @@ -359,7 +359,7 @@ public boolean isDeleteOwn(DiscussionTopic topic, DiscussionForum forum, String } @Override - public boolean isMarkAsRead(DiscussionTopic topic, DiscussionForum forum) { + public boolean isMarkAsNotRead(DiscussionTopic topic, DiscussionForum forum) { if (checkBaseConditions(topic, forum)) return true; if (topic.getLocked() == null || topic.getLocked().equals(Boolean.TRUE)) return false; @@ -368,7 +368,7 @@ public boolean isMarkAsRead(DiscussionTopic topic, DiscussionForum forum) { && !forum.getLocked() && !topic.getDraft() && !topic.getLocked()) { - return getTopicItemsByCurrentUser(topic).stream().anyMatch(ifMarkAsRead); + return getTopicItemsByCurrentUser(topic).stream().anyMatch(ifMarkAsNotRead); } return false; @@ -591,7 +591,7 @@ public BulkPermission getBulkPermissions(DiscussionTopic topic, DiscussionForum permission.setChangeSettings(ifTopicOwner || topicItemsByUser.stream().anyMatch(ifChangeSettings)); permission.setDeleteAny(!ifLockedTopic && !ifLockedForum && !ifDraftForum && !ifDraftTopic && topicItemsByUser.stream().anyMatch(ifDeleteAny)); permission.setDeleteOwn(!ifLockedTopic && !ifLockedForum && !ifDraftForum && !ifDraftTopic && topicItemsByUser.stream().anyMatch(ifDeleteOwn)); - permission.setMarkAsRead(!ifLockedTopic && !ifLockedForum && !ifDraftForum && !ifDraftTopic && topicItemsByUser.stream().anyMatch(ifMarkAsRead)); + permission.setMarkAsNotRead(!ifLockedTopic && !ifLockedForum && !ifDraftForum && !ifDraftTopic && topicItemsByUser.stream().anyMatch(ifMarkAsNotRead)); permission.setModeratePostings(!ifDraftForum && !ifDraftTopic && topicItemsByUser.stream().anyMatch(ifModeratePostings)); permission.setMovePostings(!ifLockedTopic && !ifLockedForum && !ifDraftForum && !ifDraftTopic && topicItemsByUser.stream().anyMatch(ifMovePosting)); permission.setNewResponse(!ifLockedTopic && !ifLockedForum && !ifDraftForum && !ifDraftTopic && topicItemsByUser.stream().anyMatch(ifNewResponse)); diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java index 285202a509d3..f426607264dd 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/MessagePermissionsImpl.java @@ -46,7 +46,7 @@ public class MessagePermissionsImpl implements MessagePermissions { private Boolean defaultValue; - private Boolean markAsRead; + private Boolean markAsNotRead; private Area area; @@ -209,12 +209,12 @@ public void setDefaultValue(Boolean defaultValue) { this.defaultValue = defaultValue; } - public Boolean getMarkAsRead() { - return this.markAsRead; + public Boolean getMarkAsNotRead() { + return this.markAsNotRead; } - public void setMarkAsRead(Boolean markAsRead) { - this.markAsRead = markAsRead; + public void setMarkAsNotRead(Boolean markAsNotRead) { + this.markAsNotRead = markAsNotRead; } } diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.hbm.xml b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.hbm.xml index 3485622f8f87..6ba468454d7b 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.hbm.xml +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.hbm.xml @@ -32,7 +32,7 @@ - + diff --git a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.java b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.java index 3046011d2b33..a9e1028fd2a5 100644 --- a/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.java +++ b/msgcntr/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/PermissionLevelImpl.java @@ -31,7 +31,7 @@ public class PermissionLevelImpl extends MutableEntityImpl private Boolean changeSettings; private Boolean deleteAny; private Boolean deleteOwn; - private Boolean markAsRead; + private Boolean markAsNotRead; private Boolean movePosting; private Boolean newForum; private Boolean newResponse; @@ -85,12 +85,12 @@ public void setDeleteOwn(Boolean deleteOwn) { this.deleteOwn = deleteOwn; } - public Boolean getMarkAsRead() { - return markAsRead; + public Boolean getMarkAsNotRead() { + return markAsNotRead; } - public void setMarkAsRead(Boolean markAsRead) { - this.markAsRead = markAsRead; + public void setMarkAsNotRead(Boolean markAsNotRead) { + this.markAsNotRead = markAsNotRead; } public Boolean getModeratePostings() { @@ -195,7 +195,7 @@ public int compareTo(Object obj) { public String toString() { StringBuilder buffer = new StringBuilder("["); buffer.append(changeSettings); - buffer.append(",").append(markAsRead); + buffer.append(",").append(markAsNotRead); //buffer.append(",").append(movePosting); buffer.append(",").append(newForum); buffer.append(",").append(newResponse); @@ -243,8 +243,8 @@ public boolean equals(Object o) returnValue = (bThis == null) ? obj.getDeleteOwn() == null : bThis.equals(obj.getDeleteOwn()); if(!returnValue) return returnValue; - bThis = this.getMarkAsRead(); - returnValue = (bThis == null) ? obj.getMarkAsRead() == null : bThis.equals(obj.getMarkAsRead()); + bThis = this.getMarkAsNotRead(); + returnValue = (bThis == null) ? obj.getMarkAsNotRead() == null : bThis.equals(obj.getMarkAsNotRead()); if(!returnValue) return returnValue; bThis = this.getMovePosting(); @@ -315,7 +315,7 @@ public int hashCode() bThis = this.getDeleteOwn(); temp = (bThis == null) ? 0 : bThis.hashCode(); result = result + temp; - bThis = this.getMarkAsRead(); + bThis = this.getMarkAsNotRead(); temp = (bThis == null) ? 0 : bThis.hashCode(); result = result + temp; bThis = this.getMovePosting(); @@ -368,7 +368,7 @@ public PermissionLevel clone() pli.setDeleteAny(this.getDeleteAny()); pli.setDeleteOwn(this.getDeleteOwn()); pli.setId(this.getId()); - pli.setMarkAsRead(this.getMarkAsRead()); + pli.setMarkAsNotRead(this.getMarkAsNotRead()); pli.setModeratePostings(this.getModeratePostings()); pli.setIdentifyAnonAuthors(this.getIdentifyAnonAuthors()); pli.setModified(this.getModified()); From fc10e71abebb902249fd20c18c129fce023ce575 Mon Sep 17 00:00:00 2001 From: Jesus Maria Mendez Perez Date: Fri, 18 Oct 2024 10:30:05 +0200 Subject: [PATCH 2/2] SAK-49440 Modify the default behaviour of the 'mark as read' in the forums tool. --- msgcntr/messageforums-app/src/webapp/js/forum.js | 14 +++++++++----- .../message/dfViewThreadBodyInclude.jsp | 12 ++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/msgcntr/messageforums-app/src/webapp/js/forum.js b/msgcntr/messageforums-app/src/webapp/js/forum.js index 5bb82b3621e8..56c98d98a2c5 100644 --- a/msgcntr/messageforums-app/src/webapp/js/forum.js +++ b/msgcntr/messageforums-app/src/webapp/js/forum.js @@ -375,15 +375,19 @@ function doAjax(messageId, topicId, self){ var thisThread = thisTheadClassArr[thisTheadClassArr.length - 1]; var unread = parseInt($('.hierItemBlock.' + thisThread + ' .childrenNewNumber').text(), 10); if (unread > 0) { - $('.hierItemBlock.' + thisThread + ' .childrenNewNumber').text(unread - 1); + $('.hierItemBlock.' + thisThread + ' .childrenNewNumber').text(unread + 1); + } else { + var unread = parseInt($('.hierItemBlock.' + thisThread + ' .childrenNewZero').text(), 10); + $('.hierItemBlock.' + thisThread + ' .childrenNewZero').text(unread + 1); } - $('.' + thisThread).find('em').text($('.' + thisThread).find('em').text() - 1); + $('.' + thisThread).find('em').text($('.' + thisThread).find('em').text() + 1); //hide "New Messages" in thread seed if all messages have been marked as "read" if ($('.' + thisThread).find('span.messageNew').size() === 1) { $('.' + thisThread).find('span.childrenNewThread').css('visibility', 'hidden'); } - // remove this "New" flag if this message has been marked as read - $(thisRow).children("td").children("span").children("span.messageNew").remove(); + // add this "New" flag if this message has been marked as not read + setupMessageNav('messageNew'); + //$(thisRow).children("td").children("span").children("span.messageNew").remove(); } else { //in dfFlatView - remove "New" flag, as well as link target for the thread navigator @@ -400,7 +404,7 @@ function doAjax(messageId, topicId, self){ //remove at end after references are not needed $(self).remove(); $("#" + messageId).parents("tr:first").children("td").each(function(){ - this.innerHTML = this.innerHTML.replace('bogus', /unreadMsg/g); + this.innerHTML = this.innerHTML.replace(/bogus/g, 'unreadMsg'); }); }, 500); } diff --git a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp index 19b8c7c50467..5d199c022903 100644 --- a/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp +++ b/msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp @@ -55,19 +55,19 @@ " escape="false" /> <%--author --%> - + - + - + <%--date --%> - + @@ -82,10 +82,10 @@
<%-- Grouping buttons --%> - <%-- mark as read link --%> + <%-- mark as not read link --%>