diff --git a/core/src/main/java/se/su/dsv/scipro/system/ProjectTypeSettings.java b/core/src/main/java/se/su/dsv/scipro/system/ProjectTypeSettings.java index 8b59f9c202..f83d626f1b 100755 --- a/core/src/main/java/se/su/dsv/scipro/system/ProjectTypeSettings.java +++ b/core/src/main/java/se/su/dsv/scipro/system/ProjectTypeSettings.java @@ -59,6 +59,10 @@ public class ProjectTypeSettings extends DomainObject { @Basic(optional = false) private int numDaysBeforePeerGetsCancelled = DEFAULT_NUM_DAYS_BEFORE_CANCELLED_PEERS; + @Basic + @Column(name = "review_process_information_url_for_supervisor") + private String reviewProcessInformationUrl; + @Override public Long getId() { return this.id; @@ -164,6 +168,14 @@ public class ProjectTypeSettings extends DomainObject { this.minimumActiveParticipationsToBeGraded = minimumActiveParticipationsToBeGraded; } + public String getReviewProcessInformationUrl() { + return reviewProcessInformationUrl; + } + + public void setReviewProcessInformationUrl(String reviewProcessInformationUrl) { + this.reviewProcessInformationUrl = reviewProcessInformationUrl; + } + @Override public String toString() { return "ProjectTypeSettings(id=" + this.getId() + ", projectType=" + this.getProjectType() + ", minAuthors=" + this.getMinAuthors() + ", maxAuthors=" + this.getMaxAuthors() + ", maxFinalSeminarActiveParticipation=" + this.getMaxFinalSeminarActiveParticipation() + ", maxOpponentsOnFinalSeminar=" + this.getMaxOpponentsOnFinalSeminar() + ", minFinalSeminarActiveParticipation=" + this.getMinFinalSeminarActiveParticipation() + ", minOpponentsOnFinalSeminar=" + this.getMinOpponentsOnFinalSeminar() + ", numDaysBetweenPeerReviewsOnSameProject=" + this.getNumDaysBetweenPeerReviewsOnSameProject() + ", numDaysToSubmitPeerReview=" + this.getNumDaysToSubmitPeerReview() + ", numDaysBeforePeerGetsCancelled=" + this.getNumDaysBeforePeerGetsCancelled() + ")"; diff --git a/core/src/main/resources/db/migration/V387__support_for_information_url_about_review_process.sql b/core/src/main/resources/db/migration/V387__support_for_information_url_about_review_process.sql new file mode 100644 index 0000000000..f40cd40bb9 --- /dev/null +++ b/core/src/main/resources/db/migration/V387__support_for_information_url_about_review_process.sql @@ -0,0 +1,2 @@ +ALTER TABLE `project_type_settings` + ADD COLUMN `review_process_information_url_for_supervisor` VARCHAR(255) NULL; diff --git a/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.html b/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.html index 9b4aa476dc..bb599f038e 100755 --- a/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.html +++ b/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.html @@ -46,6 +46,15 @@ </label> <input class="form-control" type="number" wicket:id="minimum_active_participations_to_be_graded"> </div> + <div class="mb-3"> + <label wicket:for="review_process_information_url"> + URL with information about the review process + </label> + <input class="form-control" type="url" wicket:id="review_process_information_url"> + <small class="text-muted"> + This link is display for supervisors when they are in the review process. + </small> + </div> <input class="btn btn-sm btn-success" wicket:id="createButton" type="submit" value="Save" /> <input class="btn btn-sm btn-danger" wicket:id="deleteButton" type="submit" value="Inactivate" /> </form> diff --git a/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.java b/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.java index a3b855e306..ad084a3436 100755 --- a/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.java +++ b/view/src/main/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanel.java @@ -84,6 +84,14 @@ public class AdminProjectTypePanel extends Panel { maximumAuthors.setRequired(true); add(maximumAuthors); + TextField<String> reviewProcessInformationUrl = new UrlTextField( + "review_process_information_url", + LambdaModel.of( + settings, + ProjectTypeSettings::getReviewProcessInformationUrl, + ProjectTypeSettings::setReviewProcessInformationUrl)); + add(reviewProcessInformationUrl); + Button createButton = new Button("createButton") { @Override public void onSubmit() { diff --git a/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.html b/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.html index 08fc6dc846..0ffe04c429 100644 --- a/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.html +++ b/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.html @@ -10,7 +10,16 @@ <div class="col-12 col-xl-3 col-lg-6"> <div class="card bg-light"> <h4 class="card-header">Rough draft approval</h4> - <div class="card-body" wicket:id="roughDraftApproval"></div> + <div class="card-body"> + <wicket:enclosure> + <p> + <a href="https://example.com" wicket:id="review_process_information"> + See more information about the review process and any important dates. + </a> + </p> + </wicket:enclosure> + <div wicket:id="roughDraftApproval"></div> + </div> </div> </div> <div class="col-12 col-xl-6 col-lg-6"> diff --git a/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.java b/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.java index a20488c956..17110c6047 100644 --- a/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.java +++ b/view/src/main/java/se/su/dsv/scipro/supervisor/pages/SupervisorInteractWithReviewerPage.java @@ -3,6 +3,8 @@ package se.su.dsv.scipro.supervisor.pages; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.OnEventHeaderItem; import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.link.ExternalLink; +import org.apache.wicket.model.IModel; import org.apache.wicket.request.mapper.parameter.PageParameters; import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorMyProjects; import se.su.dsv.scipro.file.FileService; @@ -18,6 +20,8 @@ import se.su.dsv.scipro.security.auth.roles.Roles; import se.su.dsv.scipro.supervisor.panels.RoughDraftApprovalPanel; import jakarta.inject.Inject; +import se.su.dsv.scipro.system.ProjectType; +import se.su.dsv.scipro.system.ProjectTypeSettings; @Authorization(authorizedRoles = Roles.SUPERVISOR) public class SupervisorInteractWithReviewerPage extends AbstractSupervisorProjectDetailsPage implements MenuHighlightSupervisorMyProjects { @@ -41,6 +45,17 @@ public class SupervisorInteractWithReviewerPage extends AbstractSupervisorProjec } }); + IModel<String> moreInformationUrl = projectModel + .map(Project::getProjectType) + .map(ProjectType::getProjectTypeSettings) + .map(ProjectTypeSettings::getReviewProcessInformationUrl); + add(new ExternalLink("review_process_information", moreInformationUrl) { + @Override + protected void onConfigure() { + super.onConfigure(); + setVisible(moreInformationUrl.getObject() != null); + } + }); ForumThread<Project> reviewerThread = new ReviewerInteractionForumThread(reviewerInteractionService); add(new RoughDraftApprovalPanel("roughDraftApproval", projectModel)); add(new SubmitForumReplyPanel<>("communication", projectModel, reviewerThread)); diff --git a/view/src/test/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanelTest.java b/view/src/test/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanelTest.java index d9259509f9..c7eb32c9e9 100644 --- a/view/src/test/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanelTest.java +++ b/view/src/test/java/se/su/dsv/scipro/admin/panels/AdminProjectTypePanelTest.java @@ -55,4 +55,17 @@ public class AdminProjectTypePanelTest extends SciProTest { assertEquals(17, captor.getValue().getProjectTypeSettings().getMinAuthors()); assertEquals(29, captor.getValue().getProjectTypeSettings().getMaxAuthors()); } + + @Test + public void set_review_process_information_url() { + FormTester formTester = tester.newFormTester(path(panel, "projectTypeForm")); + formTester.setValue("name", "bachelor"); + formTester.setValue("review_process_information_url", "https://example.com"); + formTester.submit("createButton"); + + ArgumentCaptor<ProjectType> captor = ArgumentCaptor.forClass(ProjectType.class); + verify(projectTypeService).save(captor.capture()); + + assertEquals("https://example.com", captor.getValue().getProjectTypeSettings().getReviewProcessInformationUrl()); + } }