Merge branch 'erase' into develop

This commit is contained in:
fred-fri 2012-08-02 12:06:01 +09:00
commit 966616f297
25 changed files with 153 additions and 742 deletions

@ -0,0 +1,2 @@
alter table `general_system_settings` drop column matchAlgorithmMatchesAreForceAccepted;
alter table `general_system_settings` drop column supervisorsCanAcceptDeclinePIs;

@ -51,9 +51,9 @@
</form> </form>
<div wicket:id="container"> <div wicket:id="container">
<form wicket:id="suggestMatchesForm"> <form wicket:id="suggestMatchesForm">
<div wicket:id="forceAcceptInfoContainer" class="info-box rounded-box append-bottom prepend-top"><b><p>Force accepting of matches is activated</p></b><p>Suggesting matches <!--<div wicket:id="forceAcceptInfoContainer" class="info-box rounded-box append-bottom prepend-top"><b><p>Force accepting of matches is activated</p></b><p>Suggesting matches-->
will automatically also force accept them without supervisors having the choice to decline to supervise <!--will automatically also force accept them without supervisors having the choice to decline to supervise-->
project ideas. You can change this option under Admin > System Settings</p></div> <!--project ideas. You can change this option under Admin > System Settings</p></div>-->
<button wicket:id="suggestMatches">Suggest these matches to supervisors</button> <button wicket:id="suggestMatches">Suggest these matches to supervisors</button>
<button wicket:id="suggestMatchesAtLeastOnePoints">Suggest matches with at least one points to <button wicket:id="suggestMatchesAtLeastOnePoints">Suggest matches with at least one points to
supervisors supervisors

@ -99,7 +99,7 @@ public class AutomaticMatchPanel extends Panel {
}); });
add(new WebMarkupContainer("forceAcceptInfoContainer").setVisible(generalSystemSettings.isMatchAlgorithmMatchesAreForceAccepted())); // add(new WebMarkupContainer("forceAcceptInfoContainer").setVisible(generalSystemSettings.isMatchAlgorithmMatchesAreForceAccepted()));
} }
}; };
suggestMatchesForm.setOutputMarkupId(true); suggestMatchesForm.setOutputMarkupId(true);
@ -141,16 +141,11 @@ public class AutomaticMatchPanel extends Panel {
for (Match match : result1.matches) { for (Match match : result1.matches) {
if(match.getPoints() >= points) { if(match.getPoints() >= points) {
match.setCreatedBy(SciProSession.get().getUser()); match.setCreatedBy(SciProSession.get().getUser());
if (generalSystemSettings.isMatchAlgorithmMatchesAreForceAccepted()){
match.setStatus(Match.Status.CONFIRMED); match.setStatus(Match.Status.CONFIRMED);
match = matchDao.save(match); match = matchDao.save(match);
// if (match.getSupervisor().getUnit()!=null){
// projectService.createAndExportProjectFromProjectIdea(match.getProjectIdea());
// }
} else {
match.setStatus(Match.Status.PUBLISHED);
match = matchDao.save(match);
}
} }
} }
info("Saved " + result1.matches.size() + " matches"); info("Saved " + result1.matches.size() + " matches");

@ -38,18 +38,18 @@
<!--<td><input name="7" type="checkbox" wicket:id="remoteExport" />--> <!--<td><input name="7" type="checkbox" wicket:id="remoteExport" />-->
<!--</td>--> <!--</td>-->
<!--</tr>--> <!--</tr>-->
<tr> <!--<tr>-->
<td><label for="7">Supervisors can accept and decline project ideas:</label> <!--<td><label for="7">Supervisors can accept and decline project ideas:</label>-->
</td> <!--</td>-->
<td><input name="7" type="checkbox" wicket:id="supervisorsCanAcceptDeclinePIs" /> <!--<td><input name="7" type="checkbox" wicket:id="supervisorsCanAcceptDeclinePIs" />-->
</td> <!--</td>-->
</tr> <!--</tr>-->
<tr> <!--<tr>-->
<td><label for="7">Matching algorithm matches are force accepted:</label> <!--<td><label for="7">Matching algorithm matches are force accepted:</label>-->
</td> <!--</td>-->
<td><input name="7" type="checkbox" wicket:id="matchAlgorithmMatchesAreForceAccepted" /> <!--<td><input name="7" type="checkbox" wicket:id="matchAlgorithmMatchesAreForceAccepted" />-->
</td> <!--</td>-->
</tr> <!--</tr>-->
</table> </table>

@ -38,16 +38,14 @@ public class AdminGeneralSettingsPage extends AbstractAdminSettingsPage {
TextField<String> smtpServer = new RequiredTextField<String>("smtpServer"); TextField<String> smtpServer = new RequiredTextField<String>("smtpServer");
CheckBox remoteExport = new CheckBox("remoteExport"); CheckBox remoteExport = new CheckBox("remoteExport");
CheckBox mailNotifications = new CheckBox("mailNotifications"); CheckBox mailNotifications = new CheckBox("mailNotifications");
CheckBox supervisorsCanAcceptDeclinePIs = new CheckBox("supervisorsCanAcceptDeclinePIs");
CheckBox matchAlgorithmMatchesAreForceAccepted = new CheckBox("matchAlgorithmMatchesAreForceAccepted");
add(mailFromName); add(mailFromName);
add(systemFromMail); add(systemFromMail);
add(smtpServer); add(smtpServer);
add(mailNotifications); add(mailNotifications);
add(remoteExport); // add(remoteExport);
add(supervisorsCanAcceptDeclinePIs);
add(matchAlgorithmMatchesAreForceAccepted);
} }
@Override @Override

@ -9,9 +9,7 @@
<div class="prepend-top">If you want to match (force accept) this <div class="prepend-top">If you want to match (force accept) this
idea to a supervisor manually, you can do so.</div> idea to a supervisor manually, you can do so.</div>
<div><span wicket:id="manualMatchPanel"></span></div> <div><span wicket:id="manualMatchPanel"></span></div>
<div class="prepend-top">If you want to suggest this
idea to a supervisor manually, you can do so.</div>
<div><span wicket:id="manualSuggestionPanel"></span></div>
<div class="prepend-top">If this project idea is poorly <div class="prepend-top">If this project idea is poorly
written, it should be refused, which means it will be sent back to the written, it should be refused, which means it will be sent back to the
authors for rewriting.</div> authors for rewriting.</div>

@ -36,7 +36,7 @@ public class ProjectIdeaActionPanel extends Panel {
Form<Match> form = new Form<Match>("form", matchModel); Form<Match> form = new Form<Match>("form", matchModel);
form.add(new ManualMatchPanel("manualMatchPanel", matchModel, Match.Status.CONFIRMED)); form.add(new ManualMatchPanel("manualMatchPanel", matchModel, Match.Status.CONFIRMED));
form.add(new ManualMatchPanel("manualSuggestionPanel", matchModel, Match.Status.PUBLISHED));
form.add(new ManualSetReviewerPanel("manualSetReviewerPanel", projectIdeaModel)); form.add(new ManualSetReviewerPanel("manualSetReviewerPanel", projectIdeaModel));
form.add(new ManualRefuseIdeaPanel("manualRefuseIdeaPanel", matchModel)); form.add(new ManualRefuseIdeaPanel("manualRefuseIdeaPanel", matchModel));
form.add(new AjaxSubmitLink("rematchButton") { form.add(new AjaxSubmitLink("rematchButton") {

@ -65,28 +65,6 @@ public class GeneralSystemSettings extends DomainObject{
@Basic(optional=true) @Basic(optional=true)
private int projectPartnerDaysToLive; private int projectPartnerDaysToLive;
@Basic(optional=false)
private boolean supervisorsCanAcceptDeclinePIs = true;
public boolean getSupervisorsCanAcceptDeclinePIs(){
return supervisorsCanAcceptDeclinePIs;
}
public void setSupervisorsCanAcceptDeclinePIs(boolean supervisorsCanAcceptDeclinePIs){
this.supervisorsCanAcceptDeclinePIs = supervisorsCanAcceptDeclinePIs;
}
@Basic(optional=false)
private boolean matchAlgorithmMatchesAreForceAccepted = true;
public boolean isMatchAlgorithmMatchesAreForceAccepted() {
return matchAlgorithmMatchesAreForceAccepted;
}
public void setMatchAlgorithmMatchesAreForceAccepted(boolean matchAlgorithmMatchesAreForceAccepted) {
this.matchAlgorithmMatchesAreForceAccepted = matchAlgorithmMatchesAreForceAccepted;
}
@Basic(optional=false) @Basic(optional=false)
private boolean finalSeminarThesisMustBeAPDF = false; private boolean finalSeminarThesisMustBeAPDF = false;

@ -42,7 +42,7 @@ public class ProjectIdea extends DomainObject {
) )
private Set<Employee> interestedSupervisors = new HashSet<Employee>(); private Set<Employee> interestedSupervisors = new HashSet<Employee>();
@ManyToMany @ManyToMany//(fetch = FetchType.EAGER)
private List<Student> authors = new ArrayList<Student>(); private List<Student> authors = new ArrayList<Student>();
@ManyToOne @ManyToOne

@ -81,7 +81,7 @@
</tfoot> </tfoot>
<tbody> <tbody>
<tr wicket:id="dataView"> <tr wicket:id="dataView">
<td><a href="#" wicket:id="detailsLink"><span wicket:id="supervisor"></span></a></td> <td><span wicket:id="supervisor"></span></td>
<td wicket:id="unit"></td> <td wicket:id="unit"></td>
<td><select wicket:id="targetBachelor"></select></td> <td><select wicket:id="targetBachelor"></select></td>
<td><select wicket:id="targetMaster"></select></td> <td><select wicket:id="targetMaster"></select></td>

@ -148,21 +148,9 @@ public class AdminManageSupervisorPanel extends Panel {
Availability bachelorAvalibality = supervisorDao.getAvailability(supervisor, projectClassDao.getProjectClass(ProjectClass.BACHELOR)); Availability bachelorAvalibality = supervisorDao.getAvailability(supervisor, projectClassDao.getProjectClass(ProjectClass.BACHELOR));
Availability masterAvalibality = supervisorDao.getAvailability(supervisor, projectClassDao.getProjectClass(ProjectClass.MASTER)); Availability masterAvalibality = supervisorDao.getAvailability(supervisor, projectClassDao.getProjectClass(ProjectClass.MASTER));
final AjaxLink<Void> detailsLink = new AjaxLink<Void>("detailsLink") {
private static final long serialVersionUID = 1340379052190115333L; item.add(new Label("supervisor", supervisor.getNameAsString()));
@Override
public void onClick(AjaxRequestTarget target) {
dialog.setTitle("Details for: " + supervisor.getNameAsString());
dialog.replace(new AdminSupervisorDetailsPanel("dialogContent", item.getModel(), feedbackPanel));
target.addComponent(dialog);
dialog.open(target);
}
};
detailsLink.add(new Label("supervisor", supervisor.getNameAsString()));
item.add(detailsLink);
item.add(new Label("unit", new PropertyModel<Employee>(supervisor, "unit.title"))); item.add(new Label("unit", new PropertyModel<Employee>(supervisor, "unit.title")));

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<div>
<a href="#" wicket:id="detailsLink">Project idea details</a>
|
<a href="#" wicket:id="profileLink">Profile</a>
<div wicket:id="mainPanel"></div>
</div>
</wicket:panel>
</body>
</html>

@ -1,101 +0,0 @@
package se.su.dsv.scipro.match.panel;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.match.dao.interfaces.SupervisorDao;
import se.su.dsv.scipro.user.panels.UserProfilePanelFactory;
public class AdminSupervisorDetailsPanel extends Panel {
private static final long serialVersionUID = 1L;
@SpringBean
private UserDao userDao;
@SpringBean
private SupervisorDao supervisorDao;
@SpringBean
private UserProfilePanelFactory factory;
private Panel detailsPanel;
private Panel profilePanel;
private Panel currentPanel;
private AjaxFallbackLink<Void> detailsLink;
private AjaxFallbackLink<Void> profileLink;
public AdminSupervisorDetailsPanel(String id, final IModel<Employee> model, final Component feedBackPanel) {
super(id, model);
final User supervisor = userDao.reLoad(model.getObject().getUser());
if (supervisor != null) {
detailsPanel = new SupervisedProjectsPanel("mainPanel", model, feedBackPanel);
profilePanel = factory.createUserProfilePanelForUser("mainPanel",model.getObject().getUser());
currentPanel = detailsPanel;
currentPanel.setOutputMarkupId(true);
detailsPanel.setOutputMarkupId(true);
profilePanel.setOutputMarkupId(true);
detailsLink = new AjaxFallbackLink<Void>("detailsLink") {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return currentPanel != detailsPanel;
}
@Override
public void onClick(AjaxRequestTarget target) {
currentPanel.replaceWith(detailsPanel);
currentPanel = detailsPanel;
if (target != null) {
target.addComponent(currentPanel);
target.addComponent(profileLink);
target.addComponent(this);
}
}
};
detailsLink.setOutputMarkupId(true);
add(detailsLink);
profileLink = new AjaxFallbackLink<Void>("profileLink") {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return currentPanel != profilePanel;
}
@Override
public void onClick(AjaxRequestTarget target) {
Employee tmp = supervisorDao.save(model.getObject());
profilePanel = factory.createUserProfilePanelForUser("mainPanel",tmp.getUser());
profilePanel.setOutputMarkupId(true);
currentPanel.replaceWith(profilePanel);
currentPanel = profilePanel;
if (target != null) {
target.addComponent(currentPanel);
target.addComponent(detailsLink);
target.addComponent(this);
}
}
};
profileLink.setOutputMarkupId(true);
add(profileLink);
add(currentPanel);
} else {
this.setVisible(false);
}
}
}

@ -1,9 +0,0 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<div wicket:id="matchedThesisPanel"></div>
<div wicket:id="projectsOverviewPanel"></div>
</wicket:panel>
</body>
</html>

@ -1,21 +0,0 @@
package se.su.dsv.scipro.match.panel;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.supervisor.panels.SupervisorMatchedThesisPanel;
import se.su.dsv.scipro.supervisor.panels.SupervisorProjectsOverviewPanel;
public class SupervisedProjectsPanel extends Panel {
private static final long serialVersionUID = 1L;
public SupervisedProjectsPanel(String id, IModel<Employee> model, final Component feedBackPanel) {
super(id, model);
add(new SupervisorMatchedThesisPanel("matchedThesisPanel", model.getObject().getUser(), "Admin", feedBackPanel));
add(new SupervisorProjectsOverviewPanel("projectsOverviewPanel", model.getObject().getUser()));
}
}

@ -8,6 +8,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.ProjectClass; import se.su.dsv.scipro.data.dataobjects.ProjectClass;
import se.su.dsv.scipro.match.dataobject.Match; import se.su.dsv.scipro.match.dataobject.Match;
import se.su.dsv.scipro.match.dataobject.ProjectIdea; import se.su.dsv.scipro.match.dataobject.ProjectIdea;
@ -55,6 +56,11 @@ public class ProjectIdeaServiceImpl extends AbstractQueryService<ProjectIdea, Lo
return projectIdeaRepo.findAll(isMatchStatus(status), pageable); return projectIdeaRepo.findAll(isMatchStatus(status), pageable);
} }
@Override
public Page<ProjectIdea> findByMatchedTo(Employee employee, Pageable pageable) {
return projectIdeaRepo.findAll(isMatchStatus(Match.Status.CONFIRMED).and(isMatchedTo(employee)), pageable);
}
@Override @Override
public Long countProjectIdeaByMatchStatus(Match.Status status) { public Long countProjectIdeaByMatchStatus(Match.Status status) {
return projectIdeaRepo.count(isMatchStatus(status)); return projectIdeaRepo.count(isMatchStatus(status));
@ -65,6 +71,11 @@ public class ProjectIdeaServiceImpl extends AbstractQueryService<ProjectIdea, Lo
return projectIdeaRepo.count(isMatchStatus(status).and(isProjectClass(projectClass))); return projectIdeaRepo.count(isMatchStatus(status).and(isProjectClass(projectClass)));
} }
@Override
public Long countByMatchedTo(Employee employee) {
return projectIdeaRepo.count(isMatchStatus(Match.Status.CONFIRMED).and(isMatchedTo(employee)));
}
private BooleanExpression isMatchStatus(Match.Status status){ private BooleanExpression isMatchStatus(Match.Status status){
return QProjectIdea.projectIdea.match.status.eq(status); return QProjectIdea.projectIdea.match.status.eq(status);
} }
@ -115,4 +126,8 @@ public class ProjectIdeaServiceImpl extends AbstractQueryService<ProjectIdea, Lo
} }
private BooleanExpression isMatchedTo(Employee employee){
return QProjectIdea.projectIdea.match.supervisor.eq(employee);
}
} }

@ -6,6 +6,7 @@ import java.util.Set;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.ProjectClass; import se.su.dsv.scipro.data.dataobjects.ProjectClass;
import se.su.dsv.scipro.match.dataobject.Match; import se.su.dsv.scipro.match.dataobject.Match;
import se.su.dsv.scipro.match.dataobject.ProjectIdea; import se.su.dsv.scipro.match.dataobject.ProjectIdea;
@ -17,10 +18,14 @@ import se.su.dsv.scipro.match.dataobject.ProjectIdea;
public interface ProjectIdeaService extends GenericService<ProjectIdea,Long>, QueryService<ProjectIdea, Long> { public interface ProjectIdeaService extends GenericService<ProjectIdea,Long>, QueryService<ProjectIdea, Long> {
public Page<ProjectIdea> find(Set<Match.Status> statusSet, String filterString, Date fromDate, Date toDate, Pageable pageable); public Page<ProjectIdea> find(Set<Match.Status> statusSet, String filterString, Date fromDate, Date toDate, Pageable pageable);
public Long count(Set<Match.Status> statusSet, String filterString, Date fromDate, Date toDate);
public Page<ProjectIdea> find(Match.Status status, Pageable pageable); public Page<ProjectIdea> find(Match.Status status, Pageable pageable);
public Long countProjectIdeaByMatchStatus(Match.Status status); public Page<ProjectIdea> findByMatchedTo(Employee employee, Pageable pageable);
public Long count(Set<Match.Status> statusSet, String filterString, Date fromDate, Date toDate);
public Long countProjectIdeaByMatchStatus(Match.Status status);
public Long countProjectIdeaByMatchStatusAndProjectClass(Match.Status status, ProjectClass projectClass); public Long countProjectIdeaByMatchStatusAndProjectClass(Match.Status status, ProjectClass projectClass);
public Long countByMatchedTo(Employee employee);
} }

@ -1,12 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html <html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body> <body>
<wicket:extend> <wicket:extend>
<div class="prepend-top span-24 last"> <!--<div class="prepend-top span-24 last">-->
<div wicket:id="feedBackPanel" /> <!--<div wicket:id="feedBackPanel" />-->
<div wicket:id="matchedThesisPanel"></div> <!--<div wicket:id="matchedThesisPanel"></div> -->
</div> <!--</div>-->
</wicket:extend> <div wicket:id="dialog">
<div wicket:id="dialogPanel"></div>
</div>
<div wicket:id="dp"></div>
</wicket:extend>
</body> </body>
</html> </html>

@ -1,22 +1,103 @@
package se.su.dsv.scipro.supervisor.pages; package se.su.dsv.scipro.supervisor.pages;
import org.apache.wicket.Component;
import org.apache.wicket.PageParameters; import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.odlabs.wiquery.ui.dialog.Dialog;
import org.springframework.data.domain.PageRequest;
import se.su.dsv.scipro.SciProSession; import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.supervisor.panels.SupervisorMatchedThesisPanel; import se.su.dsv.scipro.datatables.ClickableTitleColumn;
import se.su.dsv.scipro.datatables.DateColumn;
import se.su.dsv.scipro.datatables.GenericDataPanel;
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
import se.su.dsv.scipro.reusable.SafeLongToIntService;
import se.su.dsv.scipro.springdata.services.EmployeeService;
import se.su.dsv.scipro.springdata.services.GenericService;
import se.su.dsv.scipro.springdata.services.ProjectIdeaService;
import se.su.dsv.scipro.supervisor.panels.WatsonInfoPanel;
import java.util.Iterator;
public class SupervisorMyProjectIdeasPage extends AbstractSupervisorProjectIdeaPage { public class SupervisorMyProjectIdeasPage extends AbstractSupervisorProjectIdeaPage {
public static final String MAIN_MENU_LABEL = "Supervisor"; public static final String MAIN_MENU_LABEL = "Supervisor";
private static final long serialVersionUID = -6146389373527384427L; private static final long serialVersionUID = -6146389373527384427L;
@SpringBean
private ProjectIdeaService projectIdeaService;
@SpringBean
private SafeLongToIntService safeLongToIntService;
@SpringBean
private EmployeeService employeeService;
private Dialog dialog;
public SupervisorMyProjectIdeasPage(PageParameters pp) { public SupervisorMyProjectIdeasPage(PageParameters pp) {
super(pp); super(pp);
Component feedBackPanel = new FeedbackPanel("feedBackPanel"); // Component feedBackPanel = new FeedbackPanel("feedBackPanel");
feedBackPanel.setOutputMarkupId(true); // feedBackPanel.setOutputMarkupId(true);
add(feedBackPanel); // add(feedBackPanel);
add(new SupervisorMatchedThesisPanel("matchedThesisPanel", SciProSession.get().getUser(), "Supervisor", feedBackPanel)); // add(new SupervisorMatchedThesisPanel("matchedThesisPanel", SciProSession.get().getUser(), "Supervisor", feedBackPanel));
}
dialog = new Dialog("dialog");
dialog.setModal(true);
dialog.setAutoOpen(false);
dialog.setWidth(550);
dialog.setHeight(700);
dialog.add(new EmptyPanel("dialogPanel"));
add(dialog);
add(new GenericDataPanel<ProjectIdea>("dp") {
@Override
public GenericService getService() {
return projectIdeaService;
}
@Override
public String getSortString() {
return "dateCreated";
}
@Override
public IColumn[] getColumns() {
IColumn[] columns = new IColumn[3];
columns[0] = new PropertyColumn<ProjectIdea>(Model.of("Level"), "projectClass", "projectClass");
// columns[1] = new PropertyColumn<ProjectIdea>(Model.of("Title"), "title", "title");
columns[1] = new ClickableTitleColumn<ProjectIdea>(Model.of("Title"), "title", "title") {
@Override
protected void onClick(IModel<ProjectIdea> clicked, AjaxRequestTarget target) {
ProjectIdea pi = projectIdeaService.findOne(clicked.getObject().getId());
dialog.replace(new WatsonInfoPanel("dialogPanel", pi));
dialog.setTitle("Project idea: " + clicked.getObject().getTitle());
target.addComponent(dialog);
dialog.open(target);
}
};
columns[2] = new DateColumn<ProjectIdea>(Model.of("Received"), "match.dateCreated", "match.dateCreated");
return columns;
}
@Override
public Iterator<ProjectIdea> getIterator() {
return projectIdeaService.findByMatchedTo(employeeService.findByUser(SciProSession.get().getUser()), new PageRequest(getTable().getCurrentPage(), getTable().getRowsPerPage(), getSort())).iterator();
}
@Override
public int getSize() {
return safeLongToIntService.safeLongToInt(projectIdeaService.countByMatchedTo(employeeService.findByUser(SciProSession.get().getUser())));
}
});
}
} }

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
</head>
<body>
<wicket:panel>
<form wicket:id="form">
<div wicket:id="wmc1">
<div class="append-bottom"><button wicket:id="acceptButton">Accept to supervise</button></div>
<!-- <div class="append-bottom"><input type="button" value="Accept to supervise"></div> -->
<div class="append-top">Or enter a reason to decline: (at least
5 characters)</div>
<textarea wicket:id="reason" rows="5" style="width: 100%;"></textarea>
<button wicket:id="declineButton"
style="float: right; margin-top: 1em;">Decline</button>
</div>
<div wicket:id="wmc2"><div wicket:id="info"></div></div>
</form>
</wicket:panel>
</body>
</html>

@ -1,129 +0,0 @@
package se.su.dsv.scipro.supervisor.panels;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.validation.validator.StringValidator;
import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
import se.su.dsv.scipro.match.dataobject.Match;
import se.su.dsv.scipro.match.dataobject.Match.Status;
import se.su.dsv.scipro.match.facade.MatchFacade;
import se.su.dsv.scipro.springdata.services.ProjectService;
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
public abstract class SupervisorAcceptDeclinePanel2 extends Panel {
@SpringBean
private MatchDao matchDao;
@SpringBean
private MatchFacade matchFacade;
@SpringBean
private GeneralSystemSettingsDao gDao;
@SpringBean
private ProjectService projectService;
private static final long serialVersionUID = 1L;
private long matchId;
public abstract void onUpdate(AjaxRequestTarget target);
public SupervisorAcceptDeclinePanel2(String id, Match match) {
super(id);
matchId = match.getId();
final LoadableDetachableModel<Match> matchModel = new LoadableDetachableModel<Match>() {
private static final long serialVersionUID = 1L;
@Override
protected Match load() {
return matchDao.load(matchId);
}
};
add(new SupervisorAcceptDeclineForm("form", matchModel));
}
private class SupervisorAcceptDeclineForm extends Form<Void> {
private static final long serialVersionUID = 1L;
private TextArea<String> reason;
private String reasonString;
private LoadableDetachableModel<Match> matchModel;
public SupervisorAcceptDeclineForm(String id, final LoadableDetachableModel<Match> matchModel) {
super(id);
this.matchModel = matchModel;
WebMarkupContainer wmc1 = new WebMarkupContainer("wmc1");
add(wmc1);
AjaxLink<Void> acceptButton;
wmc1.add(acceptButton = new AjaxLink<Void>("acceptButton") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
matchDao.changeStatus(SciProSession.get().getUser(), matchModel.getObject(), Status.CONFIRMED);
matchModel.setObject(matchDao.reLoad(matchModel.getObject()));
// if (matchModel.getObject().getSupervisor().getUnit()!=null){
// projectService.createAndExportProjectFromProjectIdea(matchModel.getObject().getProjectIdea());
// }
onUpdate(target);
System.out.println("accept");
}
}).setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
if (matchModel.getObject().getSupervisor().getUnit()==null){
acceptButton.add(new JavascriptEventConfirmation("onclick", "You don't belong to an active unit in Daisy, so " +
"SciPro can not create a project and export it as a thesis course in Daisy for you. You will have to " +
"resolve this and then create a thesis course in Daisy manually. It will then take about 24 hours until " +
"that thesis course is imported into SciPro as a project."));
} else {
acceptButton.add(new JavascriptEventConfirmation("onclick", "SciPro will attempt to create a project and export " +
"it as a thesis course to Daisy for you. If everything goes well the project will show up in My projects right " +
"away. If something goes wrong, contact support."));
}
reason = new TextArea<String>("reason", new PropertyModel<String>(this, "reasonString"));
reason.setRequired(true);
reason.add(StringValidator.minimumLength(5));
reason.setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
wmc1.add(reason);
wmc1.add(new AjaxButton("declineButton") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
if (reason.getModelObject() != null && reason.getModelObject().length() > 4) {
matchFacade.reject(matchModel.getObject(), SciProSession.get().getUser(), reasonString);
onUpdate(target);
}
}
}).setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
WebMarkupContainer wmc2 = new WebMarkupContainer("wmc2");
wmc2.add(new Label("info", "Accepting and declining project ideas has been disabled. If you have any questions, "
+ "contact your GRUA or the administrator."));
add(wmc2);
wmc1.setVisible(gDao.getGeneralSystemSettingsInstance().getSupervisorsCanAcceptDeclinePIs());
wmc2.setVisible(!gDao.getGeneralSystemSettingsInstance().getSupervisorsCanAcceptDeclinePIs());
}
}
}

@ -1,57 +0,0 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
</head>
<body>
<wicket:panel>
<div wicket:id="dialog">
<div wicket:id="dialogcontents"></div>
</div>
<div class="span-24 last">
</div>
<div class="span-24 last" wicket:id="radioGroup">
<div><label for="statusListView">Show: </label><span wicket:id="statusListView"><input type="radio"
wicket:id="statusRadio"> </input> <span wicket:id="statusName"></span></span></div>
</div>
<div class="span-24 last" wicket:id="dataViewContainer">
<table class="rounded-corner">
<thead>
<tr>
<th class="rounded-left-top">Level</th>
<th>Title</th>
<th class="rounded-right-top">Author(s)</th>
<th class="rounded-right-top">Accepted date </th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4" class="rounded-foot">&nbsp;</td>
</tr>
</tfoot>
<tbody>
<tr wicket:id="projectIdeaDataView">
<td wicket:id="level"></td>
<td>
<a wicket:id="openLink"><span wicket:id="title"></span></a>
</td>
<td wicket:id="authors"></td>
<td wicket:id="acceptedDate"></td>
</tr>
</tbody>
<tbody>
<tr>
<td wicket:id="emptyLabel" colspan="4"></td>
</tr>
</tbody>
</table>
<div wicket:id="nav"></div>
</div>
</wicket:panel>
</body>
</html>

@ -1,220 +0,0 @@
package se.su.dsv.scipro.supervisor.panels;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
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.form.Radio;
import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.markup.html.panel.EmptyPanel;
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.model.CompoundPropertyModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.util.string.Strings;
import org.odlabs.wiquery.ui.dialog.Dialog;
import se.su.dsv.scipro.admin.panels.match.AdminEditProjectIdeaPanel;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.match.dao.interfaces.ProjectIdeaDao;
import se.su.dsv.scipro.match.dao.interfaces.SupervisorDao;
import se.su.dsv.scipro.match.dataobject.Match;
import se.su.dsv.scipro.match.dataobject.Match.Status;
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
import se.su.dsv.scipro.match.dataprovider.ProjectIdeaDataProvider;
import se.su.dsv.scipro.util.DateFormatter;
import se.su.dsv.scipro.util.StringUtil;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SupervisorMatchedThesisPanel extends Panel {
@SpringBean
private SupervisorDao supervisorDao;
private Match.Status selectedStatus;
private List<Match.Status> status;
private ProjectIdeaDao.Params params;
private WebMarkupContainer dataViewContainer;
private ProjectIdeaDataProvider provider;
private Label emptyLabel;
private DataView<ProjectIdea> dataView;
private List<Match.Status> statusList;
private static final long serialVersionUID = 1L;
private final String panelType;
private RadioGroup<Match.Status> radioGroup;
private User user;
private Dialog dialog;
private Component feedbackPanel;
public SupervisorMatchedThesisPanel(String id, User user, String panelType, final Component feedbackPanel__) {
super(id);
setOutputMarkupId(true);
this.user = user;
this.panelType = panelType;
feedbackPanel = feedbackPanel__;
dialog = new Dialog("dialog");
dialog.setModal(true);
dialog.setAutoOpen(false);
dialog.setWidth(800);
dialog.setHeight(800);
dialog.setOutputMarkupId(true);
add(dialog);
dialog.add(new EmptyPanel("dialogcontents"));
panelSettings();
dataViewSetup();
radioSetup();
addComponents();
}
private void panelSettings() {
dataViewContainer = new WebMarkupContainer("dataViewContainer");
provider = new ProjectIdeaDataProvider();
params = new ProjectIdeaDao.Params();
Employee supervisor = supervisorDao.getFrom(user);
//Supervisor is null when a sysadmin accesses the page and then we dont want to show any projectIdeas.
if (supervisor == null) {
Date d = new Date(1);
params.setSubmittedBefore(d);
}
ArrayList<Match.Status> startValue = new ArrayList<Match.Status>();
startValue.add(Match.Status.PUBLISHED);
params.setSupervisor(supervisor);
params.setStatuses(startValue);
provider.setParams(params);
emptyLabel = new Label("emptyLabel", "No project ideas.");
statusList = new ArrayList<Match.Status>();
statusList.add(Status.PUBLISHED);
statusList.add(Status.CONFIRMED);
}
private void dataViewSetup() {
dataView = new DataView<ProjectIdea>("projectIdeaDataView", provider) {
private static final long serialVersionUID = 2098366824640796530L;
@Override
protected void populateItem(final Item<ProjectIdea> item) {
final ProjectIdea projectIdea = item.getModelObject();
item.add(new Label("level", projectIdea.getProjectClass().getName()));
item.add(new AjaxLink<Void>("openLink") {
private static final long serialVersionUID = -6853137019834200749L;
@Override
public void onClick(AjaxRequestTarget target) {
if (panelType.equalsIgnoreCase("Admin")) {
dialog.replace(new AdminEditProjectIdeaPanel("dialogcontents", item.getModel(), feedbackPanel));
} else {
dialog.replace(new SupervisorProjectIdeaDialogPanel("dialogcontents", projectIdea.getMatch()) {
private static final long serialVersionUID = 5108807012237992330L;
@Override
public void onUpdateUpdate(AjaxRequestTarget target2) {
emptyLabel.setVisible(provider.size() == 0);
dialog.close(target2);
target2.addComponent(dataViewContainer);
target2.addComponent(emptyLabel);
}
});
}
dialog.setTitle(Strings.escapeMarkup(projectIdea.getTitle()).toString());
dialog.open(target);
target.addComponent(dialog);
}
}.add(new Label("title", projectIdea.getTitle())));
item.add(new Label("authors", StringUtil.getAuthorsFormated(projectIdea.getAuthors())));
if (projectIdea.getMatch().getStatus() == Status.CONFIRMED)
item.add(new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedDateLabel("acceptedDate" , projectIdea.getMatch().getDateCreated()));
else
item.add(new EmptyPanel("acceptedDate"));
}
};
}
private void radioSetup() {
CompoundPropertyModel<List<Match.Status>> statusModel = new CompoundPropertyModel<List<Match.Status>>(statusList);
radioGroup = new RadioGroup<Match.Status>("radioGroup", new Model<Match.Status>());
ListView<Match.Status> statusListView = new ListView<Match.Status>("statusListView", statusModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<Match.Status> item) {
Radio<Match.Status> radio = new Radio<Match.Status>("statusRadio", item.getModel());
item.add(radio);
if (item.getModelObject().equals(Match.Status.PUBLISHED)) {
item.add(new Label("statusName", "Suggested"));
} else {
item.add(new Label("statusName", "Accepted"));
}
}
};
radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
selectedStatus = radioGroup.getModelObject();
status = new ArrayList<Match.Status>();
status.add(selectedStatus);
params.setStatuses(status);
target.addComponent(dataViewContainer);
emptyLabel.setVisible(provider.size() == 0);
target.addComponent(emptyLabel);
}
});
radioGroup.add(statusListView);
radioGroup.setDefaultModelObject(Match.Status.PUBLISHED);
}
private void addComponents() {
emptyLabel.setOutputMarkupId(true);
emptyLabel.setVisible(provider.size() == 0);
dataViewContainer.add(dataView);
dataViewContainer.add(emptyLabel);
dataViewContainer.add(new PagingNavigator("nav", dataView));
dataViewContainer.setOutputMarkupId(true);
add(radioGroup);
add(dataViewContainer);
}
}

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<!--<a href="#" wicket:id="dialogLink">-->
<!--<span wicket:id="linkLabel"></span>-->
<!--</a>-->
<!---->
<!--<div wicket:id="dialog">-->
<div wicket:id="watsonPanel"></div>
<div wicket:id="acceptDeclinePanel"></div>
<!--</div>-->
</wicket:panel>
</body>
</html>

@ -1,62 +0,0 @@
package se.su.dsv.scipro.supervisor.panels;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
import se.su.dsv.scipro.match.dataobject.Match;
public abstract class SupervisorProjectIdeaDialogPanel extends Panel {
//matchDao
@SpringBean
MatchDao matchDao;
private static final long serialVersionUID = 1L;
private long matchId;
public abstract void onUpdateUpdate(AjaxRequestTarget target);
public SupervisorProjectIdeaDialogPanel(String id, Match match) {
super(id);
matchId = match.getId();
LoadableDetachableModel<Match> matchModel = new LoadableDetachableModel<Match>() {
private static final long serialVersionUID = 1L;
@Override
protected Match load() {
return matchDao.load(matchId);
}
};
add(new WatsonInfoPanel("watsonPanel", matchModel.getObject().getProjectIdea()));
SupervisorAcceptDeclinePanel2 acceptDeclinePanel;
boolean visible = matchModel.getObject().getStatus() != Match.Status.CONFIRMED;
add(acceptDeclinePanel = new SupervisorAcceptDeclinePanel2("acceptDeclinePanel", matchModel.getObject()){
private static final long serialVersionUID = 1L;
@Override
public void onUpdate(AjaxRequestTarget target) {
onUpdateUpdate(target);
}
});
acceptDeclinePanel.setVisible(visible);
}
}