Merge branch 'studentpremandatory' into develop
This commit is contained in:
commit
e8238a2779
src/main/java/se/su/dsv/scipro
match/panel
project/panels
springdata
@ -11,7 +11,7 @@
|
||||
<div wicket:id="checkGroup">
|
||||
<div wicket:id="view">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" wicket:id="checkBox"></input>
|
||||
<input type="checkbox" wicket:id="checkBox"/>
|
||||
<span wicket:id="name"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -28,7 +28,13 @@
|
||||
<span class="span8">Don't have a partner? <a href="#" wicket:id="partnerLink">Find one!</a></span>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" wicket:id="contract"/>
|
||||
<span> I fulfill the prerequisites for this idea at the start of the thesis course</span>
|
||||
</label>
|
||||
|
||||
<div class="row-fluid">
|
||||
<button wicket:id="selectLink">Select idea</button>
|
||||
</div>
|
||||
|
@ -2,14 +2,17 @@ package se.su.dsv.scipro.project.panels;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
|
||||
import org.apache.wicket.markup.html.basic.EnclosureContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.link.Link;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
import org.apache.wicket.markup.html.form.CheckBox;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
@ -55,6 +58,7 @@ public class NewAcceptIdeaDialogPanel extends Panel {
|
||||
private static final long serialVersionUID = -6831228457816635170L;
|
||||
|
||||
private NewPartnerAdditionPanel coAuthorPanel;
|
||||
private AjaxCheckBox contract;
|
||||
|
||||
public AcceptIdeaForm(String id, final IModel<NewIdea> model, final User loggedInUser, FeedbackPanel feedback, final boolean unconfirmed) {
|
||||
super(id, model);
|
||||
@ -63,6 +67,7 @@ public class NewAcceptIdeaDialogPanel extends Panel {
|
||||
addPartnerSelection(model, unconfirmed);
|
||||
addSelectButton(model, loggedInUser, feedback, unconfirmed);
|
||||
addUnconfirmedContainer(model, loggedInUser, unconfirmed); //Info box with accept/decline buttons
|
||||
addContract();
|
||||
}
|
||||
|
||||
private void addUnconfirmedContainer(final IModel<NewIdea> model, final User loggedInUser, final boolean unconfirmed) {
|
||||
@ -145,7 +150,8 @@ public class NewAcceptIdeaDialogPanel extends Panel {
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
Pair<Boolean, String> acceptance = ideaService.validateStudentAcceptance(model.getObject(), loggedInUser, coAuthorPanel.getCoAuthor(), applicationPeriod);
|
||||
System.out.println(contract.getModelObject());
|
||||
Pair<Boolean, String> acceptance = ideaService.validateStudentAcceptance(model.getObject(), loggedInUser, coAuthorPanel.getCoAuthor(), applicationPeriod, contract.getModelObject());
|
||||
if(acceptance.head){
|
||||
NotificationSource source = NotificationUtils.sourceFor(SupervisorNewIdeaStartPage.class, ProjectNewIdeaStartPage.class);
|
||||
ideaService.acceptIdea(model.getObject(), loggedInUser, coAuthorPanel.getCoAuthor(), source, applicationPeriod);
|
||||
@ -163,6 +169,14 @@ public class NewAcceptIdeaDialogPanel extends Panel {
|
||||
selectLink.setVisible(!unconfirmed);
|
||||
add(selectLink);
|
||||
}
|
||||
|
||||
private void addContract(){
|
||||
add(contract = new AjaxCheckBox("contract", new Model<Boolean>(false)){
|
||||
@Override
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -208,8 +208,13 @@ public class NewIdeaServiceImpl extends AbstractQueryService<NewIdea, Long> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Boolean, String> validateStudentAcceptance(NewIdea idea, User creator, Student coAuthor, final ApplicationPeriod ap) {
|
||||
public Pair<Boolean, String> validateStudentAcceptance(NewIdea idea, User creator, Student coAuthor, final ApplicationPeriod ap, boolean contract) {
|
||||
idea = findOne(idea.getId());
|
||||
if (!contract)
|
||||
return new Pair<Boolean, String>(false, "You must fulfill the prerequisites in order to select the idea");
|
||||
if(!idea.getMatch().getStatus().equals(Status.UNMATCHED)) //Someone changed idea status while students try to accept. Not available for selection.
|
||||
return new Pair<Boolean, String>(false, "Idea is no longer available");
|
||||
|
||||
if(!idea.getMatch().getStatus().equals(Status.UNMATCHED)) //Someone changed idea status while students try to accept. Not available for selection.
|
||||
return new Pair<Boolean, String>(false, "Idea is no longer available");
|
||||
|
||||
|
@ -42,7 +42,7 @@ public interface NewIdeaService extends GenericService<NewIdea, Long>, QueryServ
|
||||
Pair<Boolean, String> validateSupervisorIdeaSubmission(NewIdea idea, List<Keyword> keywords);
|
||||
|
||||
Pair<Boolean, String> validateSupervisorAcceptance(NewIdea idea, Employee supervisor, ProjectClass pc);
|
||||
Pair<Boolean, String> validateStudentAcceptance(NewIdea idea, User creator, Student coAuthor, final ApplicationPeriod applicationPeriod);
|
||||
Pair<Boolean, String> validateStudentAcceptance(NewIdea idea, User creator, Student coAuthor, final ApplicationPeriod applicationPeriod, boolean contract);
|
||||
Pair<Boolean, String> validateAdminAddAuthors(NewIdea idea, SortedSet<Student> authors);
|
||||
NewIdea createProject(NewIdea idea, User creator) throws ExternalExportException;
|
||||
NewIdea saveSupervisorIdea(NewIdea idea, Employee supervisor, List<Keyword> keywords, boolean isNewIdea);
|
||||
|
Loading…
x
Reference in New Issue
Block a user