@@ -227,12 +227,11 @@ private static void postNotification(ExperimentAnnotations experimentAnnotations
227227 postNotification (journal , je , messageBody .toString (), journalAdmin , messageTitlePrefix , status , getNotifyList (experimentAnnotations , user ));
228228 }
229229
230- private static void postNotification (Journal journal , JournalExperiment je , String messageBody , User messagePoster ,
231- @ NotNull String messageTitlePrefix , @ NotNull StatusOption status , @ Nullable List <User > notifyUsers )
230+ private static void postNotificationFullTitle (Journal journal , JournalExperiment je , String messageBody , User messagePoster ,
231+ @ NotNull String messageTitle , @ NotNull StatusOption status , @ Nullable List <User > notifyUsers )
232232 {
233233 AnnouncementService svc = AnnouncementService .get ();
234234 Container supportContainer = journal .getSupportContainer ();
235- String messageTitle = messageTitlePrefix +" - " + je .getShortAccessUrl ().renderShortURL ();
236235
237236 Set <User > combinedNotifyUserIds = new HashSet <>();
238237 if (notifyUsers != null )
@@ -264,6 +263,83 @@ private static void postNotification(Journal journal, JournalExperiment je, Stri
264263 SubmissionManager .updateJournalExperiment (je , messagePoster );
265264 }
266265 }
266+ private static void postNotification (Journal journal , JournalExperiment je , String messageBody , User messagePoster ,
267+ @ NotNull String messageTitlePrefix , @ NotNull StatusOption status , @ Nullable List <User > notifyUsers )
268+ {
269+ String messageTitle = messageTitlePrefix +" - " + je .getShortAccessUrl ().renderShortURL ();
270+ postNotificationFullTitle (journal , je , messageBody , messagePoster , messageTitle , status , notifyUsers );
271+ }
272+
273+ public static void postNotification (Journal journal , JournalExperiment je , String text , User messageTo , User messagePoster ,
274+ @ NotNull String messageTitle , @ NotNull StatusOption status , @ Nullable List <User > notifyUsers )
275+ {
276+ StringBuilder messageBody = getFullMessageBody (text , messageTo , messagePoster );
277+ postNotificationFullTitle (journal , je , messageBody .toString (), messagePoster , messageTitle , status , notifyUsers );
278+ }
279+
280+ @ NotNull
281+ public static StringBuilder getFullMessageBody (String text , User messageTo , User messagePoster )
282+ {
283+ StringBuilder messageBody = new StringBuilder ();
284+ messageBody .append ("Dear " ).append (getUserName (messageTo )).append ("," ).append (NL2 );
285+ messageBody .append (text );
286+ messageBody .append (NL2 ).append ("Best regards," );
287+ messageBody .append (NL ).append (getUserName (messagePoster ));
288+ return messageBody ;
289+ }
290+
291+ // The following link placeholders can be used in messages posted through the Panorama Public admin console (PostPanoramaPublicMessageAction).
292+ // An example message (Markdown format):
293+ /*
294+ We have updated the password policy on PanoramaWeb. If you have not yet updated the password for the reviewer account assigned to
295+ this data (available at __PH__DATA__SHORT__URL__), we ask that you do so as soon as possible.
296+
297+ **How to Change the Password**: Log in with the reviewer account's email and current password, and follow the prompt to set a new password.
298+ For details on the reviewer account associated with your data, please refer to the message that was sent when this data was copied to
299+ Panorama Public or view the full message thread at this link: [Message Thread](__PH__MESSAGE__THREAD__URL__)
300+
301+ **For Published Data**:
302+ If your data is already published and you no longer need the reviewer account, we encourage you to make the data public. This can be
303+ easily done by clicking the "Make Public" button in your data folder or by clicking this link: [Make Data Public](__PH__MAKE__DATA__PUBLIC__URL__)
304+
305+ We apologize for any inconvenience this update may cause. We are here to assist you if you have any questions or need help updating your password.
306+ Please respond to this message by [**clicking here**](__PH__RESPOND__TO__MESSAGE__URL__) for further clarification or support.
307+ */
308+ public static String PLACEHOLDER = "__PH__" ;
309+ public static String PLACEHOLDER_MESSAGE_THREAD_URL = PLACEHOLDER + "MESSAGE__THREAD__URL__" ;
310+ public static String PLACEHOLDER_RESPOND_TO_MESSAGE_URL = PLACEHOLDER + "RESPOND__TO__MESSAGE__URL__" ;
311+ public static String PLACEHOLDER_MAKE_DATA_PUBLIC_URL = PLACEHOLDER + "MAKE__DATA__PUBLIC__URL__" ;
312+ public static String PLACEHOLDER_SHORT_URL = PLACEHOLDER + "DATA__SHORT__URL__" ;
313+ public static String replaceLinkPlaceholders (@ NotNull String text , @ NotNull ExperimentAnnotations expAnnotations ,
314+ @ NotNull Announcement announcement , @ NotNull Container announcementContainer )
315+ {
316+ String toReturn = text ;
317+ if (toReturn .contains (PLACEHOLDER_SHORT_URL ))
318+ {
319+ toReturn = toReturn .replaceAll (PLACEHOLDER_SHORT_URL , expAnnotations .getShortUrl ().renderShortURL ());
320+ }
321+ if (toReturn .contains (PLACEHOLDER_MESSAGE_THREAD_URL ))
322+ {
323+ ActionURL viewMessageUrl = new ActionURL ("announcements" , "thread" , announcementContainer )
324+ .addParameter ("rowId" , announcement .getRowId ());
325+ toReturn = toReturn .replaceAll (PLACEHOLDER_MESSAGE_THREAD_URL , viewMessageUrl .getLocalURIString ());
326+ }
327+ if (toReturn .contains (PLACEHOLDER_RESPOND_TO_MESSAGE_URL ))
328+ {
329+ ActionURL viewMessageUrl = new ActionURL ("announcements" , "thread" , announcementContainer )
330+ .addParameter ("rowId" , announcement .getRowId ());
331+ ActionURL respondToMessageUrl = new ActionURL ("announcements" , "respond" , announcementContainer )
332+ .addParameter ("parentId" , announcement .getEntityId ())
333+ .addReturnURL (viewMessageUrl );
334+ toReturn = toReturn .replaceAll (PLACEHOLDER_RESPOND_TO_MESSAGE_URL , respondToMessageUrl .getLocalURIString ());
335+ }
336+ if (toReturn .contains (PLACEHOLDER_MAKE_DATA_PUBLIC_URL ))
337+ {
338+ ActionURL makePublicUrl = PanoramaPublicController .getMakePublicUrl (expAnnotations .getId (), expAnnotations .getContainer ());
339+ toReturn = toReturn .replaceAll (PLACEHOLDER_MAKE_DATA_PUBLIC_URL , makePublicUrl .getLocalURIString ());
340+ }
341+ return toReturn ;
342+ }
267343
268344 private static void appendSubmissionDetails (ExperimentAnnotations expAnnotations , Journal journal , JournalExperiment je , Submission submission ,
269345 @ Nullable ExperimentAnnotations currentJournalExpt , StringBuilder text )
0 commit comments