students can now see when current application period ends
This commit is contained in:
parent
c1e7a2725c
commit
38a163be16
src/main/java/se/su/dsv/scipro/project/panels
@ -4,6 +4,7 @@
|
||||
<wicket:panel>
|
||||
<div class="span-22 last" wicket:id="container">
|
||||
<div class="span-14" wicket:id="periodPanel"></div>
|
||||
|
||||
<table class="rounded-corner" >
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -1,26 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="span-14 last">
|
||||
<div class="span-14 rounded-box append-bottom" wicket:id="periodContainer">
|
||||
<wicket:enclosure child="availableClassLabel">
|
||||
<span><b>Project idea submission is now open for the following project levels: </b></span><br />
|
||||
<span wicket:id="availableClassLabel"></span>
|
||||
<br /><br />
|
||||
<span class="prepend-top"><a href="#" wicket:id="newIdeaLink"><img wicket:id="add" /> Submit new project idea</a></span>
|
||||
<span class="prepend-top" wicket:id="alreadySubmittedLabel"></span>
|
||||
</wicket:enclosure>
|
||||
<wicket:enclosure child="noPeriodLabel">
|
||||
<b><span wicket:id="noPeriodLabel"></span></b>
|
||||
</wicket:enclosure>
|
||||
<br /><br />
|
||||
<div wicket:id="nextPeriodView">
|
||||
<span wicket:id="nextPeriodLabel"></span>
|
||||
</div>
|
||||
|
||||
<wicket:panel>
|
||||
<div class="span-14 last">
|
||||
<div class="span-14 rounded-box append-bottom"
|
||||
wicket:id="periodContainer">
|
||||
|
||||
|
||||
|
||||
<wicket:enclosure child="availableClassLabel">
|
||||
<span><b>Project idea submission is now open for the
|
||||
following project levels: </b></span>
|
||||
<br />
|
||||
<br>
|
||||
<div wicket:id="nowlist">
|
||||
<div>
|
||||
<span wicket:id="name"></span> <span wicket:id="dates"></span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!-- <span wicket:id="availableClassLabel"></span> -->
|
||||
<span class="prepend-top"><a href="#"
|
||||
wicket:id="newIdeaLink"><img wicket:id="add" /> Submit new
|
||||
project idea</a></span>
|
||||
<span class="prepend-top" wicket:id="alreadySubmittedLabel"></span>
|
||||
</wicket:enclosure>
|
||||
<wicket:enclosure child="noPeriodLabel">
|
||||
<b><span wicket:id="noPeriodLabel"></span></b>
|
||||
</wicket:enclosure>
|
||||
<br />
|
||||
<br />
|
||||
<div wicket:id="nextPeriodView">
|
||||
<span wicket:id="nextPeriodLabel"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -27,22 +27,39 @@ import se.su.dsv.scipro.util.DateFormatter;
|
||||
public class ProjectIdeaPeriodPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@SpringBean
|
||||
private ApplicationPeriodDao applicationPeriodDao;
|
||||
@SpringBean
|
||||
private ProjectClassDao projectClassDao;
|
||||
@SpringBean
|
||||
private ProjectIdeaFacade projectIdeaFacade;
|
||||
|
||||
|
||||
private WebMarkupContainer periodContainer;
|
||||
|
||||
public ProjectIdeaPeriodPanel(String id) {
|
||||
super(id);
|
||||
final List<ApplicationPeriod> currentPeriods = applicationPeriodDao.getCurrentPeriods(new Date());
|
||||
|
||||
|
||||
periodContainer = new WebMarkupContainer("periodContainer");
|
||||
|
||||
ListView<ApplicationPeriod> nowlist = new ListView<ApplicationPeriod>("nowlist", applicationPeriodDao.getCurrentPeriods(new Date())){
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected void populateItem(ListItem<ApplicationPeriod> item){
|
||||
ApplicationPeriod ap = (ApplicationPeriod)item.getModelObject();
|
||||
String levelString = "";
|
||||
for (ProjectClass pc : ap.getProjectClass()){
|
||||
levelString += pc.getName() + " ";
|
||||
}
|
||||
item.add(new Label("name", levelString));
|
||||
item.add(new Label("dates", " period is open between: " +
|
||||
new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedString(ap.getStartDate()) + " and " +
|
||||
new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedString(ap.getEndDate()) + "."));
|
||||
}
|
||||
};
|
||||
|
||||
periodContainer.add(nowlist);
|
||||
|
||||
final List<ApplicationPeriod> currentPeriods = applicationPeriodDao.getCurrentPeriods(new Date());
|
||||
|
||||
Set<ProjectClass> availableClasses = new HashSet<ProjectClass>();
|
||||
String availableClassString = "";
|
||||
@ -51,31 +68,31 @@ public class ProjectIdeaPeriodPanel extends Panel {
|
||||
|
||||
for (ProjectClass pc : availableClasses)
|
||||
availableClassString += pc.getName() + " ";
|
||||
|
||||
|
||||
|
||||
|
||||
Label availableClassLabel = new Label("availableClassLabel", availableClassString) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return currentPeriods.size() > 0;
|
||||
}
|
||||
public boolean isVisible() {
|
||||
return currentPeriods.size() > 0;
|
||||
}
|
||||
};
|
||||
periodContainer.add(availableClassLabel);
|
||||
|
||||
|
||||
List<ProjectClass> projectClasses = projectClassDao.findAll();
|
||||
List<String> nextPeriodList = new ArrayList<String>();
|
||||
|
||||
|
||||
for (ProjectClass p : projectClasses) {
|
||||
ApplicationPeriod a = applicationPeriodDao.getNextPeriodByClass(p, new Date());
|
||||
if (a != null)
|
||||
nextPeriodList.add("Next upcoming " + p.getName() + " period is open between: " +
|
||||
new DateFormatter(DateFormatter.FORMAT.DEFAULT).createFormattedString(a.getStartDate()) + " and " +
|
||||
new DateFormatter(DateFormatter.FORMAT.DEFAULT).createFormattedString(a.getEndDate()));
|
||||
new DateFormatter(DateFormatter.FORMAT.DEFAULT).createFormattedString(a.getStartDate()) + " and " +
|
||||
new DateFormatter(DateFormatter.FORMAT.DEFAULT).createFormattedString(a.getEndDate()));
|
||||
else
|
||||
nextPeriodList.add("Next upcoming " + p.getName() + " period opens: N/A");
|
||||
}
|
||||
|
||||
|
||||
ListView<String> nextPeriodView = new ListView<String>("nextPeriodView", nextPeriodList) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -83,11 +100,11 @@ public class ProjectIdeaPeriodPanel extends Panel {
|
||||
protected void populateItem(ListItem<String> item) {
|
||||
item.add(new Label("nextPeriodLabel", item.getModelObject()));
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
periodContainer.add(nextPeriodView);
|
||||
|
||||
|
||||
Label noActivePeriodLabel = new Label("noPeriodLabel", "There are no active periods for project idea submission available right now") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -99,19 +116,19 @@ public class ProjectIdeaPeriodPanel extends Panel {
|
||||
periodContainer.add(noActivePeriodLabel);
|
||||
BookmarkablePageLink<Void> newIdeaLink = new BookmarkablePageLink<Void>("newIdeaLink", ProjectIdeaSubmissionPage.class);
|
||||
newIdeaLink.add(new ImageObject("add", ImageObject.SIXTEEN + ImageObject.ADD));
|
||||
// System.out.println("Calling method");
|
||||
|
||||
// System.out.println("Calling method");
|
||||
|
||||
Label alreadySubmittedLabel = new Label("alreadySubmittedLabel", "You have already submitted or are already included in a project idea collected in current project idea collection period(s)");
|
||||
alreadySubmittedLabel.setVisible(false);
|
||||
periodContainer.add(alreadySubmittedLabel);
|
||||
|
||||
|
||||
if (projectIdeaFacade.projectIdeaAlreadySubmittedThisPeriod(SciProSession.get().getUser(), currentPeriods)){
|
||||
newIdeaLink.setVisible(false);
|
||||
alreadySubmittedLabel.setVisible(true);
|
||||
}
|
||||
|
||||
// newIdeaLink.setVisible(!projectIdeaFacade.projectIdeaAlreadySubmittedThisPeriod(SciProSession.get().getUser(), currentPeriods));
|
||||
|
||||
|
||||
// newIdeaLink.setVisible(!projectIdeaFacade.projectIdeaAlreadySubmittedThisPeriod(SciProSession.get().getUser(), currentPeriods));
|
||||
|
||||
periodContainer.add(newIdeaLink);
|
||||
add(periodContainer);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user