Skip to content

Commit 67067f9

Browse files
authored
Add admin action to post to multiple Panorama Public submission request message threads (#430)
- Added an admin console action that will allow site admins to post to multiple Panorama Public submission request message threads. Show link to post messages on the admin page only if a "Panorama Public" journal project exists on the server. - Added a form where site admins can enter a title and message (in Markdown syntax), and filter and select from the list of datasets on Panorama Public where the message should be posted. -- Display an example message on the confirmation page. -- Added placeholder texts for links in message - Added a pipeline job to post the message to the selected experiments' message threads. -- Add submitter and lab head to the notify list if they were not on the original message thread posted before we switched to secure messages for Panorama Public. - "Support Message" column was added to the ExperimentAnnotationsTableInfo so that site admins can easily navigate to the message thread for a dataset - Removed old, unused admin action AssignSubmitterPermissionAction and related pipeline job.. - Added experiment title and permanent link on the form to make data public.
1 parent e7315eb commit 67067f9

10 files changed

Lines changed: 745 additions & 212 deletions

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicController.java

Lines changed: 256 additions & 60 deletions
Large diffs are not rendered by default.

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicModule.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import org.labkey.panoramapublic.catalog.CatalogImageAttachmentType;
4646
import org.labkey.panoramapublic.model.Journal;
4747
import org.labkey.panoramapublic.model.speclib.SpecLibKey;
48-
import org.labkey.panoramapublic.pipeline.CopyExperimentFinalTask;
4948
import org.labkey.panoramapublic.pipeline.CopyExperimentPipelineProvider;
5049
import org.labkey.panoramapublic.pipeline.PxValidationPipelineProvider;
5150
import org.labkey.panoramapublic.proteomexchange.ExperimentModificationGetter;

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicNotification.java

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

panoramapublic/src/org/labkey/panoramapublic/pipeline/AssignSubmitterPermissionJob.java

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)