Merge branch 'checklists' into develop
* checklists: added ListCheckListTemplatePanel added listCheckListPanel Implemented creation of checklist templates checklist foundation added adminchecklistpage
This commit is contained in:
commit
2198cefdec
.gitignore
src/main
java/se/su/dsv/scipro
admin
checklists/panels
CreateCheckListTemplatePanel.htmlCreateCheckListTemplatePanel.javaListCheckListPanel.javaListCheckListTemplatePanel.htmlListCheckListTemplatePanel.javaTrafficLightPanel.htmlTrafficLightPanel.javaViewCheckListPanel.java
data
dao
dataobjects
enums
project/pages
resources
target/work/WicketMockServlet-filestore
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,3 +3,6 @@
|
||||
\.classpath
|
||||
\target/**/*
|
||||
\target/*
|
||||
/.settings
|
||||
/.classpath
|
||||
/target
|
||||
|
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>CheckLists</title>
|
||||
</head>
|
||||
<body>
|
||||
<wicket:extend>
|
||||
|
||||
<div class="span-22 last">
|
||||
<!-- Left column -->
|
||||
<div class="span-10 colborder">
|
||||
<div class="span-10 last">
|
||||
<div wicket:id="cCLPanel"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Right column -->
|
||||
<div class="span-10 last">
|
||||
<div class="span-10 last">
|
||||
<div wicket:id="listCLPanel"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:extend>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,36 @@
|
||||
package se.su.dsv.scipro.admin.pages;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.SubmitLink;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.checklists.panels.CreateCheckListTemplatePanel;
|
||||
import se.su.dsv.scipro.checklists.panels.ListCheckListTemplatePanel;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||
import se.su.dsv.scipro.project.panels.ProjectPartnerPanel;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN, Roles.ADMIN})
|
||||
public class AdminCheckListPage extends AbstractAdminPage {
|
||||
|
||||
|
||||
public static final String MAIN_MENU_LABEL = "CheckLists";
|
||||
|
||||
public AdminCheckListPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new CreateCheckListTemplatePanel("cCLPanel"));
|
||||
add(new ListCheckListTemplatePanel("listCLPanel"));
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import org.apache.wicket.Page;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminCheckListPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminFinalSeminarPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminProjectPartnerPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminRolePage;
|
||||
@ -39,6 +40,7 @@ public class AdminTabMenuPanel extends AbstractMenuPanel {
|
||||
items.add(new MenuItem("Settings", AdminGeneralSettingsPage.class, ImageIcon.ICON_SETTINGS));
|
||||
items.add(new MenuItem("Role management", AdminRolePage.class));
|
||||
items.add(new MenuItem("Project partner", AdminProjectPartnerPage.class));
|
||||
items.add(new MenuItem("CheckList", AdminCheckListPage.class));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
@ -5,21 +5,36 @@
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<wicket:panel>
|
||||
<div wicket:id="feedbackPanel"></div>
|
||||
<form wicket:id="form">
|
||||
<div>
|
||||
<input wicket:id="questions" type="text" />
|
||||
|
||||
Template name: <input wicket:id="title" type="text" />
|
||||
</div>
|
||||
<input wicket:id="button" type="submit"/>
|
||||
<p></p>
|
||||
<div wicket:id="radioChoice">
|
||||
<input type="radio" />
|
||||
</div>
|
||||
<div>
|
||||
<form wicket:id="addQuestionForm">
|
||||
<div wicket:id="container">
|
||||
<div>Questions</div>
|
||||
<div wicket:id="questions">
|
||||
<span wicket:id=questionLabel></span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<input wicket:id="question" type="text" />
|
||||
</div>
|
||||
<input wicket:id="addQuestionButton" type="submit" />
|
||||
</form>
|
||||
<div>
|
||||
<a href="#" wicket:id="link">Print</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="#" wicket:id="newLink">New Link</a>
|
||||
</div>
|
||||
<p></p>
|
||||
<input wicket:id="save" type="submit" />
|
||||
</form>
|
||||
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -1,27 +1,19 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
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.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.basic.MultiLineLabel;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.Radio;
|
||||
import org.apache.wicket.markup.html.form.RadioChoice;
|
||||
import org.apache.wicket.markup.html.form.RadioGroup;
|
||||
import org.apache.wicket.markup.html.form.RequiredTextField;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
@ -29,21 +21,10 @@ import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.data.enums.StateOfMind;
|
||||
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author fnorbe@dsv.su.se
|
||||
@ -53,15 +34,6 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 8862892008428526067L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checkListTemplateDao;
|
||||
|
||||
@ -71,6 +43,8 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
private String question = "";
|
||||
private String title = "";
|
||||
|
||||
private final FeedbackPanel feedbackPanel;
|
||||
|
||||
private ProjectClass projectClass;
|
||||
|
||||
private CheckListTemplate checkListTemplate = new CheckListTemplate();
|
||||
@ -78,41 +52,48 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
public CreateCheckListTemplatePanel(String id) {
|
||||
super(id);
|
||||
projectClass = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
|
||||
final FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackPanel");
|
||||
feedbackPanel = new FeedbackPanel("feedbackPanel");
|
||||
feedbackPanel.setOutputMarkupId(true);
|
||||
add(feedbackPanel);
|
||||
Form<CheckListTemplate> form = new Form<CheckListTemplate>("form");
|
||||
final Form<CheckListTemplate> addQuestionForm = new Form<CheckListTemplate>("addQuestionForm");
|
||||
final TextField<String> titleField = new RequiredTextField<String>("title",
|
||||
new PropertyModel<String>(this, "title"));
|
||||
final TextField<String> questionField = new RequiredTextField<String>("questions",
|
||||
titleField.setOutputMarkupId(true);
|
||||
final TextField<String> questionField = new RequiredTextField<String>("question",
|
||||
new PropertyModel<String>(this, "question"));
|
||||
questionField.setOutputMarkupId(true);
|
||||
RadioChoice<ProjectClass> radioChoice = new RadioChoice<ProjectClass>("view",
|
||||
questionField.setRequired(false);
|
||||
RadioChoice<ProjectClass> radioChoice = new RadioChoice<ProjectClass>("radioChoice",
|
||||
new PropertyModel<ProjectClass>(this, "projectClass"), projectClassDao.findAll());
|
||||
|
||||
IModel<List<String>> questionModel = new LoadableDetachableModel<List<String>>() {
|
||||
final IModel<List<String>> questionModel = new LoadableDetachableModel<List<String>>(){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<String> load() {
|
||||
// TODO Auto-generated method stub
|
||||
protected List<String> load() {
|
||||
return checkListTemplate.getQuestions();
|
||||
}
|
||||
};
|
||||
|
||||
AjaxLink<Void> printLink = new AjaxLink<Void>("addQuestionLink") {
|
||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
ListView<String> listView = new ListView<String>("questions", questionModel) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
checkListTemplate.getQuestions().add(question);
|
||||
question = "";
|
||||
target.addComponent(questionField);
|
||||
protected void populateItem(ListItem<String> item) {
|
||||
Label question = new Label("questionLabel", item.getModel().getObject());
|
||||
item.add(question);
|
||||
|
||||
}
|
||||
};
|
||||
AjaxButton button = new AjaxButton("button", new Model<String>("Save")) {
|
||||
|
||||
container.add(listView);
|
||||
//add(new FeedbackPanel("feedbackPanel"));
|
||||
|
||||
AjaxButton save = new AjaxButton("save", new Model<String>("Save template")) {
|
||||
|
||||
/**
|
||||
*
|
||||
@ -125,20 +106,17 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
checkListTemplate.setLevel(projectClass);
|
||||
checkListTemplate.setCreator(SciProSession.get().getUser());
|
||||
checkListTemplate.setName(title);
|
||||
|
||||
target.addComponent(feedbackPanel);
|
||||
checkListTemplateDao.save(checkListTemplate);
|
||||
checkListTemplate = new CheckListTemplate();
|
||||
title ="";
|
||||
question="";
|
||||
target.addComponent(container);
|
||||
target.addComponent(titleField);
|
||||
|
||||
}
|
||||
};
|
||||
form.add(titleField);
|
||||
form.add(radioChoice);
|
||||
form.add(button);
|
||||
form.add(questionField);
|
||||
add(form);
|
||||
|
||||
|
||||
|
||||
AjaxLink<Void> newLink = new AjaxLink<Void>("newLink") {
|
||||
|
||||
AjaxButton addQuestionButton = new AjaxButton("addQuestionButton", new Model<String>("Add question")) {
|
||||
|
||||
/**
|
||||
*
|
||||
@ -146,13 +124,26 @@ public class CreateCheckListTemplatePanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
checkListTemplate = new CheckListTemplate();
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
|
||||
if(question != null || question != ""){
|
||||
checkListTemplate.getQuestions().add(new String(question));
|
||||
}
|
||||
questionModel.detach();
|
||||
question = "";
|
||||
target.addComponent(questionField);
|
||||
target.addComponent(container);
|
||||
|
||||
}
|
||||
};
|
||||
add(printLink);
|
||||
add(newLink);
|
||||
addQuestionForm.add(questionField);
|
||||
addQuestionForm.add(container);
|
||||
addQuestionForm.add(addQuestionButton);
|
||||
form.add(titleField);
|
||||
form.add(radioChoice);
|
||||
form.add(addQuestionForm);
|
||||
form.add(save);
|
||||
add(form);
|
||||
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
public class ListCheckListPanel extends Panel {
|
||||
|
||||
private List<CheckList> checkLists;
|
||||
private CheckListRole role;
|
||||
private CheckListDao checkListDao;
|
||||
private Project project;
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ListCheckListPanel(String id, CheckListRole role, final Project project) {
|
||||
super(id);
|
||||
this.role = role;
|
||||
checkLists = checkListDao.findCheckLists(project, role);
|
||||
|
||||
IModel<List<CheckList>> checkListModel = new LoadableDetachableModel<List<CheckList>>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<CheckList> load() {
|
||||
return project.getCheckLists();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
ListView<CheckList> checkLists = new ListView<CheckList>("checkLists", checkListModel) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckList> item) {
|
||||
Label listName = new Label("listName", item.getModel().getObject().getName());
|
||||
item.add(listName);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
container.add(checkLists);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<!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="container">
|
||||
<div wicket:id="checkListTemplates">
|
||||
<div wicket:id="templateName"></div>
|
||||
<div wicket:id="templateOwner"></div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,68 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
public class ListCheckListTemplatePanel extends Panel{
|
||||
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checkListTemplateDao;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ListCheckListTemplatePanel(String id) {
|
||||
super(id);
|
||||
|
||||
IModel<List<CheckListTemplate>> checkListTemplateModel = new LoadableDetachableModel<List<CheckListTemplate>>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<CheckListTemplate> load() {
|
||||
return checkListTemplateDao.findAll();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
ListView<CheckListTemplate> checkListTemplates = new ListView<CheckListTemplate>("checkListTemplates", checkListTemplateModel) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckListTemplate> item) {
|
||||
Label templateName = new Label("templateName", new PropertyModel<String>(item.getModel(),"name"));
|
||||
Label templateOwner = new Label("templateOwner", new PropertyModel<String>(item.getModel(), "creator"));
|
||||
item.add(templateName);
|
||||
item.add(templateOwner);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
container.add(checkListTemplates);
|
||||
add(container);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,21 +12,6 @@
|
||||
<table >
|
||||
<tr >
|
||||
<td><input type="radio" wicket:id="radio" /></td>
|
||||
<!--
|
||||
<td><img wicket:id="image" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div wicket:id="checkLists">
|
||||
<div wicket:id="listView">
|
||||
<span wicket:id="question"></span>
|
||||
<div wicket:id="listViewAnswer">
|
||||
<span wicket:id="answer"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<td><img wicket:id="image"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -39,24 +24,3 @@
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
||||
<!--
|
||||
<!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="trafficLightContainer">
|
||||
<table wicket:id="group">
|
||||
<tr wicket:id="lights">
|
||||
<td><input type="radio" wicket:id="radio" /></td>
|
||||
<td> <img wicket:id="image"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
>>>>>>> checklists
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html> -->
|
@ -38,18 +38,6 @@ public class TrafficLightPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 8862892008428526067L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checkListTemplateDao;
|
||||
|
||||
public TrafficLightPanel(String id) {
|
||||
super(id);
|
||||
|
||||
@ -94,71 +82,4 @@ public class TrafficLightPanel extends Panel {
|
||||
group.add(lightList);
|
||||
}
|
||||
|
||||
|
||||
List<CheckList> checkLists = checkListDao.findCheckLists(SciProSession.get()
|
||||
.getActiveProject());{
|
||||
if (checkLists.size() < 1) {
|
||||
CheckList checkList = new CheckList("Test", SciProSession.get().getActiveProject());
|
||||
CheckListQuestion checkListQuestion = new CheckListQuestion("Testquestion?");
|
||||
checkListQuestion = checkListQuestionDao.save(checkListQuestion);
|
||||
checkList.getQuestions().add(checkListQuestion);
|
||||
checkList = checkListDao.save(checkList);
|
||||
}
|
||||
|
||||
ListView<CheckList> checkListsListView = new ListView<CheckList>("checkLists", checkLists) {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckList> item) {
|
||||
|
||||
ListView<CheckListQuestion> listView = new ListView<CheckListQuestion>(
|
||||
"listView",
|
||||
new ArrayList<CheckListQuestion>(item.getModel().getObject().getQuestions())) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckListQuestion> item) {
|
||||
CheckListQuestion checkListQuestion = item.getModel().getObject();
|
||||
if(checkListQuestion.getAnswers().size() == 0){
|
||||
CheckListAnswer checkListAnswer = new CheckListAnswer(SciProSession.get().getUser(), CheckListQuestionAnswer.GREEN);
|
||||
checkListAnswer = checkListAnswerDao.save(checkListAnswer);
|
||||
checkListQuestion.getAnswers().add(checkListAnswer);
|
||||
checkListQuestionDao.save(checkListQuestion);
|
||||
|
||||
}
|
||||
item.add(new Label("question", item.getModel().getObject().getQuestion()));
|
||||
|
||||
ListView<CheckListAnswer> listView = new ListView<CheckListAnswer>(
|
||||
"listViewAnswer",
|
||||
new ArrayList<CheckListAnswer>(item.getModel().getObject().getAnswers())) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckListAnswer> item) {
|
||||
item.add(new Label("answer", item.getModel().getObject().getAnswer().toString()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
item.add(listView);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
item.add(listView);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
add(checkListsListView);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,109 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
|
||||
public class ViewCheckListPanel extends Panel {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checkListTemplateDao;
|
||||
|
||||
|
||||
public ViewCheckListPanel(String id){
|
||||
super(id);
|
||||
|
||||
/* List<CheckList> checkLists = checkListDao.findCheckLists(SciProSession.get()
|
||||
.getActiveProject());{
|
||||
if (checkLists.size() < 1) {
|
||||
CheckList checkList = new CheckList("Test", SciProSession.get().getActiveProject());
|
||||
CheckListQuestion checkListQuestion = new CheckListQuestion("Testquestion?");
|
||||
checkListQuestion = checkListQuestionDao.save(checkListQuestion);
|
||||
checkList.getQuestions().add(checkListQuestion);
|
||||
checkList = checkListDao.save(checkList);
|
||||
|
||||
}
|
||||
|
||||
ListView<CheckList> checkListsListView = new ListView<CheckList>("checkLists", checkLists) {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckList> item) {
|
||||
|
||||
ListView<CheckListQuestion> listView = new ListView<CheckListQuestion>(
|
||||
"listView",
|
||||
new ArrayList<CheckListQuestion>(item.getModel().getObject().getQuestions())) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckListQuestion> item) {
|
||||
CheckListQuestion checkListQuestion = item.getModel().getObject();
|
||||
if(checkListQuestion.getAnswers().size() == 0){
|
||||
CheckListAnswer checkListAnswer = new CheckListAnswer(SciProSession.get().getUser(), CheckListQuestionAnswer.GREEN);
|
||||
checkListAnswer = checkListAnswerDao.save(checkListAnswer);
|
||||
checkListQuestion.getAnswers().add(checkListAnswer);
|
||||
checkListQuestionDao.save(checkListQuestion);
|
||||
|
||||
}
|
||||
item.add(new Label("question", item.getModel().getObject().getQuestion()));
|
||||
|
||||
ListView<CheckListAnswer> listView = new ListView<CheckListAnswer>(
|
||||
"listViewAnswer",
|
||||
new ArrayList<CheckListAnswer>(item.getModel().getObject().getAnswers())) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckListAnswer> item) {
|
||||
item.add(new Label("answer", item.getModel().getObject().getAnswer().toString()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
item.add(listView);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
item.add(listView);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
add(checkListsListView);
|
||||
};*/
|
||||
|
||||
}
|
||||
}
|
@ -4,8 +4,11 @@ import java.util.List;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
|
||||
public interface CheckListDao extends Dao<CheckList> {
|
||||
|
||||
public List<CheckList> findCheckLists(final Project project);
|
||||
public List<CheckList> findCheckLists(final Project project, CheckListRole role);
|
||||
//use this if a dataview is necesary
|
||||
//public int countCheckLists (final CheckList cl, Project project);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package se.su.dsv.scipro.data.dao.jpa;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
@ -9,12 +10,16 @@ import javax.persistence.PersistenceException;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import org.hibernate.ejb.QueryHints;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.orm.jpa.JpaCallback;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -29,7 +34,7 @@ public class CheckListDaoJPAImp extends AbstractDaoJPAImp<CheckList> implements
|
||||
super(CheckList.class);
|
||||
}
|
||||
|
||||
public List<CheckList> findCheckLists(final Project project) {
|
||||
public List<CheckList> findCheckLists(final Project project, CheckListRole role) {
|
||||
return getJpaTemplate().execute(new JpaCallback<List<CheckList>>() {
|
||||
public List<CheckList> doInJpa(EntityManager em) throws PersistenceException {
|
||||
String q = "select s " + "from CheckList s " + "where s.project = :project";
|
||||
@ -47,4 +52,23 @@ public class CheckListDaoJPAImp extends AbstractDaoJPAImp<CheckList> implements
|
||||
|
||||
});
|
||||
}
|
||||
//use this if a dataview is necesary
|
||||
/*@Override
|
||||
@Transactional(readOnly = true)
|
||||
public int countCheckLists(final CheckList cl,final Project project) {
|
||||
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
||||
|
||||
@Override
|
||||
public Integer doInJpa(EntityManager em)
|
||||
throws PersistenceException {
|
||||
String q = "SELECT COUNT(cl) from CheckList cl WHERE cl.project = :p" ;
|
||||
TypedQuery<Long> query = em.createQuery(q,
|
||||
Long.class);
|
||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||
query.setParameter("p", project);
|
||||
|
||||
return (query.getSingleResult()).intValue();
|
||||
}
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@ -41,6 +43,7 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
||||
private static final long serialVersionUID = 9071570648984376188L;
|
||||
|
||||
public static final String PP_PROJECT_ID = "pid";
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@ -82,6 +85,10 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
||||
private String statusMessage = "";
|
||||
|
||||
private Date daisyStartDate;
|
||||
|
||||
@OneToMany(targetEntity=CheckList.class, cascade=CascadeType.ALL, orphanRemoval=true)
|
||||
@Sort(type=SortType.NATURAL) //Required by hibernate
|
||||
private List<CheckList> checkLists = new ArrayList<CheckList>();
|
||||
|
||||
public Project() {}
|
||||
|
||||
@ -208,6 +215,18 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
||||
public void setStatusMessage(String statusMessage) {
|
||||
this.statusMessage = statusMessage;
|
||||
}
|
||||
|
||||
public List<CheckList> getCheckLists() {
|
||||
return checkLists;
|
||||
}
|
||||
|
||||
public void setCheckLists(List<CheckList> checkLists) {
|
||||
this.checkLists = checkLists;
|
||||
}
|
||||
|
||||
public void addCheckList(CheckList cl){
|
||||
checkLists.add(cl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
@ -268,6 +287,5 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
||||
final public String getCommentKey() {
|
||||
return Project.class.getCanonicalName().toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package se.su.dsv.scipro.data.enums;
|
||||
|
||||
public enum CheckListRole {
|
||||
AUTHOR,
|
||||
SUPERVISOR,
|
||||
ADMIN
|
||||
}
|
@ -2,6 +2,9 @@ package se.su.dsv.scipro.project.pages;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.checklists.panels.ListCheckListPanel;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
@ -10,11 +13,13 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
*
|
||||
*/
|
||||
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN}) //TODO Hidden for initial deployment
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN})
|
||||
public class ProjectChecklistPage extends ProjectPage {
|
||||
|
||||
public ProjectChecklistPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new ListCheckListPanel("listCheckListPanel", CheckListRole.AUTHOR,
|
||||
SciProSession.get().getActiveProject()));
|
||||
//add(new TrafficLightPanel("trafficLightPanel"));
|
||||
//add(new CreateCheckListTemplatePanel("createCheckList"));
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
<div class="span-22 last">
|
||||
<div wicket:id=feedback></div>
|
||||
<!-- Left column -->
|
||||
|
||||
<div class="span-10 colborder">
|
||||
<div class="span-10 last">
|
||||
<h5 class="peer-title">Look for project partner</h5>
|
||||
|
@ -59,7 +59,6 @@ public class ProjectPartnerPage extends ProjectPage {
|
||||
|
||||
private DataView<ProjectPartner> dataView;
|
||||
private WebMarkupContainer wmc;
|
||||
private IModel<List<ProjectPartner>> listModel;
|
||||
|
||||
private RadioChoice<ProjectClass> degreeChoice;
|
||||
private RadioChoice<ProjectClass> showChoice;
|
||||
@ -76,7 +75,7 @@ public class ProjectPartnerPage extends ProjectPage {
|
||||
|
||||
settings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
|
||||
choices = new ArrayList<ProjectClass>();
|
||||
days = settings.getProjectPartnerDaysToLive();
|
||||
setDays(settings.getProjectPartnerDaysToLive());
|
||||
ProjectClass bachelor = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
|
||||
choices.add(bachelor);
|
||||
choices.add(projectClassDao.getProjectClass(ProjectClass.MASTER));
|
||||
@ -142,7 +141,6 @@ public class ProjectPartnerPage extends ProjectPage {
|
||||
|
||||
private void loadListView(ProjectPartnerDataProvider projectPartnerDataProvider){
|
||||
dataView = new DataView<ProjectPartner>("list", projectPartnerDataProvider, 5 ){
|
||||
//wmc.add(new ListView<ProjectPartner>("list", new PropertyModel<List<ProjectPartner>>(this, "ProjectPartnerDao.getProjectPartner")){
|
||||
|
||||
|
||||
|
||||
@ -160,5 +158,13 @@ public class ProjectPartnerPage extends ProjectPage {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public int getDays() {
|
||||
return days;
|
||||
}
|
||||
|
||||
public void setDays(int days) {
|
||||
this.days = days;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
<!DOCTYPE Repository
|
||||
PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN"
|
||||
"http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
|
||||
<Repository>
|
||||
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
|
||||
<param name="path" value="/jackrabbit" />
|
||||
</FileSystem>
|
||||
<Security appName="Jackrabbit">
|
||||
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager" />
|
||||
<LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
|
||||
<param name="anonymousId" value="anonymous" />
|
||||
</LoginModule>
|
||||
</Security>
|
||||
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
|
||||
|
||||
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore">
|
||||
<param name="path" value="${rep.home}/repository/datastore"/>
|
||||
<param name="minRecordLength" value="100"/>
|
||||
</DataStore>
|
||||
|
||||
<Workspace name="${wsp.name}">
|
||||
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
|
||||
<param name="path" value="${wsp.home}" />
|
||||
</FileSystem>
|
||||
|
||||
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager">
|
||||
<param name="blobFSBlockSize" value="0"/>
|
||||
<param name="minBlobSize" value="4096"/>
|
||||
<param name="errorHandling" value=""/>
|
||||
</PersistenceManager>
|
||||
|
||||
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
|
||||
<param name="path" value="${wsp.home}/index" />
|
||||
<param name="indexingConfiguration" value="${wsp.home}/index-config.xml"/>
|
||||
<param name="textFilterClasses" value="
|
||||
org.apache.jackrabbit.extractor.MsWordTextExtractor,
|
||||
org.apache.jackrabbit.extractor.MsExcelTextExtractor,
|
||||
org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,
|
||||
org.apache.jackrabbit.extractor.PdfTextExtractor,
|
||||
org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,
|
||||
org.apache.jackrabbit.extractor.RTFTextExtractor,
|
||||
org.apache.jackrabbit.extractor.XMLTextExtractor,
|
||||
org.apache.jackrabbit.extractor.PngTextExtractor,
|
||||
org.apache.jackrabbit.extractor.HTMLTextExtractor"/>
|
||||
<param name="extractorPoolSize " value="2"/>
|
||||
<param name="supportHighlighting" value="true"/>
|
||||
</SearchIndex>
|
||||
</Workspace>
|
||||
<Versioning rootPath="${rep.home}/versions">
|
||||
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
|
||||
<param name="path" value="${rep.home}/versions" />
|
||||
</FileSystem>
|
||||
<!-- <PersistenceManager class="org.apache.jackrabbit.core.persistence.xml.XMLPersistenceManager" />-->
|
||||
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager">
|
||||
<param name="blobFSBlockSize" value="0"/>
|
||||
<param name="minBlobSize" value="4096"/>
|
||||
<param name="errorHandling" value=""/>
|
||||
</PersistenceManager>
|
||||
</Versioning>
|
||||
</Repository>
|
@ -38,6 +38,10 @@
|
||||
"projectClassDao"
|
||||
"projectScheduleDao"
|
||||
"projectFollowerDao"
|
||||
"checkListDao"
|
||||
"checkListQuestion"
|
||||
"checkListTemplate"
|
||||
"checkListAnswer"
|
||||
"stringResourceDao"
|
||||
"fileDescriptionDao"
|
||||
"projectEventTemplateDao"
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user