Skip to content

Commit 19fc8e5

Browse files
committed
- Fix form validation, nav trails.
1 parent 3794b8b commit 19fc8e5

2 files changed

Lines changed: 78 additions & 40 deletions

File tree

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

Lines changed: 78 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ private ModelAndView getPrivateDataReminderSettingsLink()
389389
@Override
390390
public void addNavTrail(NavTree root)
391391
{
392-
PageFlowUtil.urlProvider(AdminUrls.class).addAdminNavTrail(root, "Panorama Public Admin Console", getClass(), getContainer());
392+
addPanoramaPublicAdminConsoleNav(root, getContainer());
393393
}
394394
}
395395

@@ -526,7 +526,7 @@ public void addNavTrail(NavTree root)
526526

527527
private static void addPanoramaPublicAdminConsoleNav(NavTree root, Container container)
528528
{
529-
root.addChild("Panorama Public Admin Console", new ActionURL(PanoramaPublicAdminViewAction.class, container));
529+
PageFlowUtil.urlProvider(AdminUrls.class).addAdminNavTrail(root, "Panorama Public Admin Console", PanoramaPublicAdminViewAction.class, container);
530530
}
531531

532532
public static class CreateJournalGroupForm
@@ -1574,6 +1574,7 @@ public ModelAndView getSuccessView(ManageCatalogEntryForm form)
15741574
@Override
15751575
public void addNavTrail(NavTree root)
15761576
{
1577+
addPanoramaPublicAdminConsoleNav(root, getContainer());
15771578
root.addChild("Panorama Public Catalog Settings");
15781579
}
15791580
}
@@ -10085,12 +10086,37 @@ public static ActionURL getViewExperimentModificationsURL(int experimentAnnotati
1008510086
return result;
1008610087
}
1008710088

10088-
@AdminConsoleAction
1008910089
@RequiresPermission(AdminOperationsPermission.class)
1009010090
public static class PrivateDataReminderSettingsAction extends FormViewAction<PrivateDataReminderSettingsForm>
1009110091
{
1009210092
@Override
10093-
public void validateCommand(PrivateDataReminderSettingsForm form, Errors errors) {}
10093+
public void validateCommand(PrivateDataReminderSettingsForm form, Errors errors)
10094+
{
10095+
if (form.getDelayUntilFirstReminder() == null)
10096+
{
10097+
errors.reject(ERROR_MSG, "Please enter a value for 'Delay until first reminder'.");
10098+
}
10099+
else if (form.getDelayUntilFirstReminder() < 0)
10100+
{
10101+
errors.reject(ERROR_MSG, "Value for 'Delay until first reminder' must be greater than 0.");
10102+
}
10103+
if (form.getReminderFrequency() == null)
10104+
{
10105+
errors.reject(ERROR_MSG, "Please enter a value for 'Reminder frequency'.");
10106+
}
10107+
else if (form.getReminderFrequency() < 0)
10108+
{
10109+
errors.reject(ERROR_MSG, "Value for 'Reminder frequency' must be greater than 0.");
10110+
}
10111+
if (form.getExtensionLength() == null)
10112+
{
10113+
errors.reject(ERROR_MSG, "Please enter a value for 'Extension duration'.");
10114+
}
10115+
else if (form.getExtensionLength() < 0)
10116+
{
10117+
errors.reject(ERROR_MSG, "Value for 'Extension duration' must be greater than 0.");
10118+
}
10119+
}
1009410120

1009510121
@Override
1009610122
public ModelAndView getView(PrivateDataReminderSettingsForm form, boolean reshow, BindException errors) throws Exception
@@ -10105,7 +10131,7 @@ public ModelAndView getView(PrivateDataReminderSettingsForm form, boolean reshow
1010510131
}
1010610132

1010710133
VBox view = new VBox();
10108-
view.addView(new JspView<>("/org/labkey/panoramapublic/view/privateDataRemindersSettingsForm.jsp", form));
10134+
view.addView(new JspView<>("/org/labkey/panoramapublic/view/privateDataRemindersSettingsForm.jsp", form, errors));
1010910135
view.setTitle("Private Data Reminder Settings");
1011010136
view.setFrame(WebPartView.FrameType.PORTAL);
1011110137
return view;
@@ -10144,17 +10170,17 @@ public ModelAndView getSuccessView(PrivateDataReminderSettingsForm form)
1014410170
@Override
1014510171
public void addNavTrail(NavTree root)
1014610172
{
10147-
PageFlowUtil.urlProvider(AdminUrls.class).addAdminNavTrail(root, "Panorama Public Admin Console", PanoramaPublicAdminViewAction.class, getContainer());
10173+
addPanoramaPublicAdminConsoleNav(root, getContainer());
1014810174
root.addChild("Private Data Reminder Settings");
1014910175
}
1015010176
}
1015110177

1015210178
public static class PrivateDataReminderSettingsForm
1015310179
{
1015410180
private boolean _enabled;
10155-
private int _extensionLength;
10156-
private int _reminderFrequency;
10157-
private int _delayUntilFirstReminder;
10181+
private Integer _extensionLength;
10182+
private Integer _reminderFrequency;
10183+
private Integer _delayUntilFirstReminder;
1015810184

1015910185
public boolean isEnabled()
1016010186
{
@@ -10166,32 +10192,32 @@ public void setEnabled(boolean enabled)
1016610192
_enabled = enabled;
1016710193
}
1016810194

10169-
public int getExtensionLength()
10195+
public Integer getExtensionLength()
1017010196
{
1017110197
return _extensionLength;
1017210198
}
1017310199

10174-
public void setExtensionLength(int extensionLength)
10200+
public void setExtensionLength(Integer extensionLength)
1017510201
{
1017610202
_extensionLength = extensionLength;
1017710203
}
1017810204

10179-
public int getReminderFrequency()
10205+
public Integer getReminderFrequency()
1018010206
{
1018110207
return _reminderFrequency;
1018210208
}
1018310209

10184-
public void setReminderFrequency(int reminderFrequency)
10210+
public void setReminderFrequency(Integer reminderFrequency)
1018510211
{
1018610212
_reminderFrequency = reminderFrequency;
1018710213
}
1018810214

10189-
public int getDelayUntilFirstReminder()
10215+
public Integer getDelayUntilFirstReminder()
1019010216
{
1019110217
return _delayUntilFirstReminder;
1019210218
}
1019310219

10194-
public void setDelayUntilFirstReminder(int delayUntilFirstReminder)
10220+
public void setDelayUntilFirstReminder(Integer delayUntilFirstReminder)
1019510221
{
1019610222
_delayUntilFirstReminder = delayUntilFirstReminder;
1019710223
}
@@ -10225,6 +10251,7 @@ public ModelAndView getView(PrivateDataSendReminderForm form, boolean reshow, Bi
1022510251

1022610252
JspView<PrivateDataSendReminderForm> jspView = new JspView<>("/org/labkey/panoramapublic/view/sendPrivateDataRemindersForm.jsp", form, errors);
1022710253
VBox view = new VBox(jspView, tableView);
10254+
view.setTitle("Send Reminders");
1022810255
view.setFrame(WebPartView.FrameType.PORTAL);
1022910256
return view;
1023010257
}
@@ -10257,8 +10284,8 @@ public URLHelper getSuccessURL(PrivateDataSendReminderForm form)
1025710284
@Override
1025810285
public void addNavTrail(NavTree root)
1025910286
{
10260-
PageFlowUtil.urlProvider(AdminUrls.class).addAdminNavTrail(root, "Private Data Reminder Settings", PrivateDataReminderSettingsAction.class, ContainerManager.getRoot());
10261-
root.addChild("Send Private Data Reminders");
10287+
root.addChild("Private Data Reminder Settings", new ActionURL(PrivateDataReminderSettingsAction.class, ContainerManager.getRoot()));
10288+
root.addChild("Send Reminders");
1026210289
}
1026310290
}
1026410291

@@ -10327,7 +10354,23 @@ public abstract class UpdateDatasetStatusAction extends ConfirmAction<ShortUrlFo
1032710354

1032810355
protected abstract void doValidationForAction(Errors errors);
1032910356
protected abstract void updateDatasetStatus(DatasetStatus datasetStatus);
10330-
protected abstract void postNotification() throws Exception;
10357+
protected abstract void postNotification();
10358+
10359+
protected abstract String getConfirmViewTitle();
10360+
protected abstract String getConfirmViewMessage();
10361+
10362+
public ModelAndView getConfirmView(ShortUrlForm shortUrlForm, BindException errors) throws Exception
10363+
{
10364+
setTitle(getConfirmViewTitle());
10365+
HtmlView view = new HtmlView(DIV(
10366+
DIV(getConfirmViewMessage()),
10367+
DIV("Title: " + _exptAnnotations.getTitle()),
10368+
DIV("Submitted on: " + DateUtil.formatDateTime(_exptAnnotations.getCreated(), "MMMM d, yyyy")),
10369+
DIV("Submitter: " + _exptAnnotations.getSubmitterName())
10370+
));
10371+
view.setTitle(getConfirmViewTitle());
10372+
return view;
10373+
}
1033110374

1033210375
@Override
1033310376
public void validateCommand(ShortUrlForm shortUrlForm, Errors errors)
@@ -10384,17 +10427,15 @@ public boolean handlePost(ShortUrlForm shortUrlForm, BindException errors) throw
1038410427
public class RequestExtensionAction extends UpdateDatasetStatusAction
1038510428
{
1038610429
@Override
10387-
public ModelAndView getConfirmView(ShortUrlForm shortUrlForm, BindException errors) throws Exception
10430+
protected String getConfirmViewTitle()
1038810431
{
10389-
setTitle("Request Extension");
10390-
HtmlView view = new HtmlView(DIV(
10391-
DIV("You are requesting an extension for the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL()),
10392-
DIV("Title: " + _exptAnnotations.getTitle()),
10393-
DIV("Submitted on: " + DateUtil.formatDateTime(_exptAnnotations.getCreated(), "MMMM d, yyyy")),
10394-
DIV("Submitter: " + _exptAnnotations.getSubmitterName())
10395-
));
10396-
view.setTitle("Request Extension For Panorama Public Data");
10397-
return view;
10432+
return "Request Extension For Panorama Public Data";
10433+
}
10434+
10435+
@Override
10436+
protected String getConfirmViewMessage()
10437+
{
10438+
return "You are requesting an extension for the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL();
1039810439
}
1039910440

1040010441
@Override
@@ -10450,17 +10491,15 @@ public ModelAndView getSuccessView(ShortUrlForm shortUrlForm)
1045010491
public class RequestDeletionAction extends UpdateDatasetStatusAction
1045110492
{
1045210493
@Override
10453-
public ModelAndView getConfirmView(ShortUrlForm shortUrlForm, BindException errors) throws Exception
10494+
protected String getConfirmViewTitle()
1045410495
{
10455-
setTitle("Request Deletion");
10456-
HtmlView view = new HtmlView(DIV(
10457-
DIV("You are requesting deletion of the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL()),
10458-
DIV("Title: " + _exptAnnotations.getTitle()),
10459-
DIV("Submitted on: " + DateUtil.formatDateTime(_exptAnnotations.getCreated(), "MMMM d, yyyy")),
10460-
DIV("Submitter: " + _exptAnnotations.getSubmitterName())
10461-
));
10462-
view.setTitle("Request Deletion For Panorama Public Data");
10463-
return view;
10496+
return "Request Deletion For Panorama Public Data";
10497+
}
10498+
10499+
@Override
10500+
protected String getConfirmViewMessage()
10501+
{
10502+
return "You are requesting deletion of the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL();
1046410503
}
1046510504

1046610505
@Override
@@ -10483,7 +10522,7 @@ protected void updateDatasetStatus(DatasetStatus datasetStatus)
1048310522
}
1048410523

1048510524
@Override
10486-
protected void postNotification() throws Exception
10525+
protected void postNotification()
1048710526
{
1048810527
// Post a message to the support thread.
1048910528
JournalSubmission submission = SubmissionManager.getSubmissionForExperiment(_exptAnnotations);

panoramapublic/src/org/labkey/panoramapublic/view/privateDataRemindersSettingsForm.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
alert("Please select a Panorama Public folder first.");
6363
return;
6464
}
65-
//console.log("Selected folder path: " + folderPath);
6665
window.location = LABKEY.ActionURL.buildURL("panoramapublic", "sendPrivateDataReminders.view", folderPath);
6766
}
6867
</script>

0 commit comments

Comments
 (0)