added dialog with refuse comment for authors to read under my project ideas page

This commit is contained in:
Emil Siverhall 2012-03-27 12:27:45 +02:00
parent 2ad03a4761
commit 7d93f1b2f8
2 changed files with 64 additions and 12 deletions
src/main/java/se/su/dsv/scipro/project/panels

@ -2,6 +2,13 @@
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<div wicket:id="dialog">
<div class="info-box rounded-box last span-10">The submitted
project idea has been refused with the comment below. You may submit
the idea again after it has been rewritten.</div>
<div class="prepend-top append-bottom" wicket:id="refuseComment"></div>
<button class="right" wicket:id="closeButton">Close</button>
</div>
<div class="span-22 last" wicket:id="container">
<div class="span-14" wicket:id="periodPanel"></div>
@ -28,7 +35,7 @@
<td wicket:id="level"></td>
<td><a href="#" wicket:id="ideaLink"><span wicket:id="title"></span></a></td>
<td wicket:id="authors"></td>
<td wicket:id="supervisor"></td>
<td><a href="#" wicket:id="infoLink"><span wicket:id="supervisor"></span></a></td>
</tr>
</tbody>

@ -3,6 +3,8 @@ package se.su.dsv.scipro.project.panels;
import java.util.List;
import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
@ -11,6 +13,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.odlabs.wiquery.ui.dialog.Dialog;
import se.su.dsv.scipro.data.dataobjects.Student;
import se.su.dsv.scipro.data.dataobjects.User;
@ -33,15 +36,39 @@ public class MyProjectIdeasPanel extends Panel {
private DataView<ProjectIdea> dataView;
private WebMarkupContainer container;
private Label emptyLabel;
private Dialog dialog;
public MyProjectIdeasPanel(String id, User user) {
super(id);
container = new WebMarkupContainer("container");
container.add(new ProjectIdeaPeriodPanel("periodPanel"));
setUpDialog();
setUpDataView(user);
add(container);
}
container.add(new ProjectIdeaPeriodPanel("periodPanel"));
private void setUpDialog() {
dialog = new Dialog("dialog");
dialog.setModal(true);
dialog.setAutoOpen(false);
dialog.setWidth(475);
dialog.add(new Label("refuseComment", ""));
dialog.add(new AjaxLink<Void>("closeButton"){
private static final long serialVersionUID = 3070470744295433839L;
@Override
public void onClick(AjaxRequestTarget target) {
dialog.close(target);
}
});
dialog.setOutputMarkupId(true);
add(dialog);
}
private void setUpDataView(User user) {
emptyLabel = new Label("emptyLabel", "No project ideas available.");
container.add(emptyLabel);
emptyLabel.setOutputMarkupId(true);
@ -81,15 +108,32 @@ public class MyProjectIdeasPanel extends Panel {
item.add(new Label("level", idea.getProjectClass().getName()));
item.add(new Label("authors", authorString));
AjaxLink<Void> infoLink = new AjaxLink<Void>("infoLink") {
private static final long serialVersionUID = 3252482686426707024L;
@Override
public void onClick(AjaxRequestTarget target) {
dialog.setTitle("Refused idea details");
String refuseComment = idea.getMatch().getCommentForStudent()!=null?idea.getMatch().getCommentForStudent():"No comment added";
dialog.replace(new Label("refuseComment",refuseComment));
target.addComponent(dialog);
dialog.open(target);
}
};
infoLink.setEnabled(idea.getMatch().getStatus().equals(Match.Status.REFUSED));
String supervisor = "";
if(idea.getMatch().getSupervisor()!=null&&idea.getMatch().getStatus().equals(Match.Status.CONFIRMED))
if(idea.getMatch().getSupervisor()!=null&&idea.getMatch().getStatus().equals(Match.Status.CONFIRMED)) {
supervisor = idea.getMatch().getSupervisor().getNameAsString()+" ("+idea.getMatch().getSupervisor().getEmailAsString()+")";
else if(idea.getMatch().getStatus().equals(Match.Status.REFUSED))
supervisor = "Project idea refused, needs to be rewritten";
else
}
else if(idea.getMatch().getStatus().equals(Match.Status.REFUSED)){
supervisor = "Project idea refused, click for details";
}
else {
supervisor = "Supervisor allocation in progress";
item.add(new Label("supervisor", supervisor));
}
infoLink.add(new Label("supervisor", supervisor));
item.add(infoLink);
}
@ -97,8 +141,9 @@ public class MyProjectIdeasPanel extends Panel {
dataView.setItemsPerPage(10);
container.setOutputMarkupId(true);
container.add(dataView);
container.add(new PagingNavigator("nav", dataView));
add(container);
container.add(new PagingNavigator("nav", dataView));
}
}