Merge branch 'develop' of git.dsv.su.se:/git/scipro/scipro into develop
This commit is contained in:
commit
d6fd04ecd8
src
main/java/se/su/dsv/scipro
SciProApplication.java
admin
basepages
basepanels
checklists/panels
AnswerDialogPanel.javaCreateChecklistTemplatePanel.htmlCreateChecklistTemplatePanel.javaFunctionalEditChecklistTemplatePanel.javaListCheckListPanel.javaListCheckListTemplatePanel.java
conference/panels
data
json/pages
knol/resource
model
page
BookmarkableCategoryResourcePage.htmlBookmarkableCategoryResourcePage.javaBookmarkableResourcePage.htmlBookmarkableResourcePage.javaBookmarkableTagResourcePage.htmlBookmarkableTagResourcePage.javaHtmlWebMarkupContainer.javaResourcePage.htmlResourcePage.javaStaticImage.java
panels
FileResourcePanel.htmlFileResourcePanel.javaResourceBookmarkableCategoryPanel.htmlResourceBookmarkableCategoryPanel.javaResourceBookmarkablePanel.htmlResourceBookmarkablePanel.javaResourceBookmarkableTagPanel.htmlResourceBookmarkableTagPanel.javaResourceListPanel.htmlResourceListPanel.javaResourceListPanel.propertiesResourcesPanel.htmlResourcesPanel.javaResourcesPanel.properties
log
facade
pages
panels
match
message/panels
opponent/panels
peer
data/dao/controllers
panels
workerthreads
project
pages
panels
supervisor
user/facade
workerthreads
test/java/se/su/dsv/scipro/match
@ -42,7 +42,6 @@ import se.su.dsv.scipro.admin.pages.settings.AdminGeneralSettingsPage;
|
|||||||
import se.su.dsv.scipro.admin.pages.settings.AdminPeerSettingsPage;
|
import se.su.dsv.scipro.admin.pages.settings.AdminPeerSettingsPage;
|
||||||
import se.su.dsv.scipro.admin.pages.settings.AdminServerEnvironmentSettingsPage;
|
import se.su.dsv.scipro.admin.pages.settings.AdminServerEnvironmentSettingsPage;
|
||||||
import se.su.dsv.scipro.basepages.DemoPage;
|
import se.su.dsv.scipro.basepages.DemoPage;
|
||||||
import se.su.dsv.scipro.basepages.Inte;
|
|
||||||
import se.su.dsv.scipro.basepages.errorpages.AccessDeniedPage;
|
import se.su.dsv.scipro.basepages.errorpages.AccessDeniedPage;
|
||||||
import se.su.dsv.scipro.basepages.errorpages.CustomErrorPageFactory;
|
import se.su.dsv.scipro.basepages.errorpages.CustomErrorPageFactory;
|
||||||
import se.su.dsv.scipro.basepages.errorpages.InternalErrorPage;
|
import se.su.dsv.scipro.basepages.errorpages.InternalErrorPage;
|
||||||
@ -62,12 +61,6 @@ import se.su.dsv.scipro.json.pages.JsonSentMessagePage;
|
|||||||
import se.su.dsv.scipro.json.pages.JsonSetReadPage;
|
import se.su.dsv.scipro.json.pages.JsonSetReadPage;
|
||||||
import se.su.dsv.scipro.json.pages.JsonSetStatusPage;
|
import se.su.dsv.scipro.json.pages.JsonSetStatusPage;
|
||||||
import se.su.dsv.scipro.json.pages.JsonStatusPage;
|
import se.su.dsv.scipro.json.pages.JsonStatusPage;
|
||||||
import se.su.dsv.scipro.knol.resource.page.BookmarkableCategoryResourcePage;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.BookmarkableResourcePage;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.BookmarkableTagResourcePage;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|
||||||
import se.su.dsv.scipro.log.pages.ProjectLogPage;
|
|
||||||
import se.su.dsv.scipro.log.pages.SupervisorLogPage;
|
|
||||||
import se.su.dsv.scipro.loginlogout.pages.LoginPage;
|
import se.su.dsv.scipro.loginlogout.pages.LoginPage;
|
||||||
import se.su.dsv.scipro.loginlogout.pages.LogoutPage;
|
import se.su.dsv.scipro.loginlogout.pages.LogoutPage;
|
||||||
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||||
@ -172,7 +165,6 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
mountBookmarkablePage("login", LoginPage.class);
|
mountBookmarkablePage("login", LoginPage.class);
|
||||||
mountBookmarkablePage("logout", LogoutPage.class);
|
mountBookmarkablePage("logout", LogoutPage.class);
|
||||||
mountBookmarkablePage("demo", DemoPage.class);
|
mountBookmarkablePage("demo", DemoPage.class);
|
||||||
mountBookmarkablePage("inte", Inte.class);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pop-up pages
|
* Pop-up pages
|
||||||
@ -194,14 +186,6 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
mountBookmarkablePage("json/status", JsonStatusPage.class);
|
mountBookmarkablePage("json/status", JsonStatusPage.class);
|
||||||
mountBookmarkablePage("json/setstatus", JsonSetStatusPage.class);
|
mountBookmarkablePage("json/setstatus", JsonSetStatusPage.class);
|
||||||
|
|
||||||
/*
|
|
||||||
* Resource pages
|
|
||||||
*/
|
|
||||||
mountBookmarkablePage("resource", ResourcePage.class);
|
|
||||||
mountBookmarkablePage("resource/category", BookmarkableCategoryResourcePage.class);
|
|
||||||
mountBookmarkablePage("resource/resource", BookmarkableResourcePage.class);
|
|
||||||
mountBookmarkablePage("resource/tag", BookmarkableTagResourcePage.class);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Admin pages
|
* Admin pages
|
||||||
*/
|
*/
|
||||||
@ -235,7 +219,6 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
mountBookmarkablePage("noproject", NoActiveProjectPage.class);
|
mountBookmarkablePage("noproject", NoActiveProjectPage.class);
|
||||||
mountBookmarkablePage("project/checklist", ProjectChecklistPage.class);
|
mountBookmarkablePage("project/checklist", ProjectChecklistPage.class);
|
||||||
mountBookmarkablePage("project/checklist/viewchecklist", ProjectViewCheckListPage.class);
|
mountBookmarkablePage("project/checklist/viewchecklist", ProjectViewCheckListPage.class);
|
||||||
mountBookmarkablePage("project/notes", ProjectLogPage.class);
|
|
||||||
mountBookmarkablePage("projectideas", ProjectIdeaPage.class);
|
mountBookmarkablePage("projectideas", ProjectIdeaPage.class);
|
||||||
mountBookmarkablePage("projectideas/submit", ProjectIdeaSubmissionPage.class);
|
mountBookmarkablePage("projectideas/submit", ProjectIdeaSubmissionPage.class);
|
||||||
/*
|
/*
|
||||||
@ -247,7 +230,6 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
mountBookmarkablePage("supervisor/templates/editor", SupervisorScheduleTemplatesEditorPage.class);
|
mountBookmarkablePage("supervisor/templates/editor", SupervisorScheduleTemplatesEditorPage.class);
|
||||||
mountBookmarkablePage("supervisor/templates", SupervisorScheduleTemplatesPage.class);
|
mountBookmarkablePage("supervisor/templates", SupervisorScheduleTemplatesPage.class);
|
||||||
mountBookmarkablePage("supervisor/project/details", SupervisorProjectDetailsPage.class);
|
mountBookmarkablePage("supervisor/project/details", SupervisorProjectDetailsPage.class);
|
||||||
mountBookmarkablePage("supervisor/project/details/notes", SupervisorLogPage.class);
|
|
||||||
mountBookmarkablePage("supervisor/project/details/checklist", SupervisorChecklistPage.class);
|
mountBookmarkablePage("supervisor/project/details/checklist", SupervisorChecklistPage.class);
|
||||||
mountBookmarkablePage("supervisor/project/details/addchecklist", SupervisorAddCheckListToProjectPage.class);
|
mountBookmarkablePage("supervisor/project/details/addchecklist", SupervisorAddCheckListToProjectPage.class);
|
||||||
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
||||||
|
@ -3,8 +3,6 @@ package se.su.dsv.scipro.admin.pages;
|
|||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
|
|
||||||
import se.su.dsv.scipro.admin.panels.AdminListCheckListTemplatePanel;
|
import se.su.dsv.scipro.admin.panels.AdminListCheckListTemplatePanel;
|
||||||
import se.su.dsv.scipro.checklists.panels.CreateChecklistTemplatePanel;
|
|
||||||
import se.su.dsv.scipro.checklists.panels.FunctionalListCheckListTemplatePanel;
|
|
||||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
import se.su.dsv.scipro.security.auth.Authorization;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
@ -46,7 +46,7 @@ public class AdminProjectPartnerPage extends AbstractAdminPage {
|
|||||||
@Override
|
@Override
|
||||||
public void onSubmit() {
|
public void onSubmit() {
|
||||||
settings.setProjectPartnerDaysToLive(amountOfDays);
|
settings.setProjectPartnerDaysToLive(amountOfDays);
|
||||||
generalSystemSettingsDao.save(settings);
|
settings = generalSystemSettingsDao.save(settings);
|
||||||
info("OK");
|
info("OK");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -68,7 +68,7 @@ public class AdminExemptionCreatePanel extends Panel {
|
|||||||
exemption.setGrantedBy(SciProSession.get().getUser());
|
exemption.setGrantedBy(SciProSession.get().getUser());
|
||||||
exemption.setAuthor(authorDao.getOrCreate(studentSelector.getModelObject().getUser()));
|
exemption.setAuthor(authorDao.getOrCreate(studentSelector.getModelObject().getUser()));
|
||||||
try {
|
try {
|
||||||
exemptionDao.save(exemption);
|
exemption = exemptionDao.save(exemption);
|
||||||
info("Exemption created.");
|
info("Exemption created.");
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
error("Only one exemption per author and project class allowed.");
|
error("Only one exemption per author and project class allowed.");
|
||||||
|
@ -63,7 +63,7 @@ public class AutomaticMatchPanel extends Panel {
|
|||||||
for (Match match : result.matches) {
|
for (Match match : result.matches) {
|
||||||
match.setCreatedBy(SciProSession.get().getUser());
|
match.setCreatedBy(SciProSession.get().getUser());
|
||||||
match.setStatus(Match.Status.PUBLISHED);
|
match.setStatus(Match.Status.PUBLISHED);
|
||||||
matchDao.save(match);
|
match = matchDao.save(match);
|
||||||
}
|
}
|
||||||
info("Saved " + result.matches.size() + " matches");
|
info("Saved " + result.matches.size() + " matches");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -129,7 +129,7 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
|||||||
tmp.setCategories(categoryPanel.getSelectedCategories());
|
tmp.setCategories(categoryPanel.getSelectedCategories());
|
||||||
List<CheckListTemplate> templates = checkListTemplateDao.findTemplates();
|
List<CheckListTemplate> templates = checkListTemplateDao.findTemplates();
|
||||||
tmp.setTemplateNumber(templates.size()-1);
|
tmp.setTemplateNumber(templates.size()-1);
|
||||||
checkListTemplateDao.save(tmp);
|
tmp = checkListTemplateDao.save(tmp);
|
||||||
target.addComponent(container);
|
target.addComponent(container);
|
||||||
dialog.close(target);
|
dialog.close(target);
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
|||||||
tmp.setName(nameField.getModelObject());
|
tmp.setName(nameField.getModelObject());
|
||||||
|
|
||||||
tmp.setCategories(categoryPanel.getSelectedCategories());
|
tmp.setCategories(categoryPanel.getSelectedCategories());
|
||||||
checkListTemplateDao.save(tmp);
|
tmp = checkListTemplateDao.save(tmp);
|
||||||
target.addComponent(container);
|
target.addComponent(container);
|
||||||
dialog.close(target);
|
dialog.close(target);
|
||||||
}
|
}
|
||||||
|
@ -41,13 +41,15 @@ public class ManualMatchPanel extends Panel {
|
|||||||
private Form<Employee> matchForm;
|
private Form<Employee> matchForm;
|
||||||
private AutocompleteComponent<Employee> autocompleteSupervisorField;
|
private AutocompleteComponent<Employee> autocompleteSupervisorField;
|
||||||
private Long supervisorId;
|
private Long supervisorId;
|
||||||
public ManualMatchPanel(String id, IModel<Match> matchModel) {
|
private boolean confirmed;
|
||||||
|
public ManualMatchPanel(String id, IModel<Match> matchModel, final boolean confirmed__) {
|
||||||
super(id);
|
super(id);
|
||||||
supervisorId = matchModel.getObject().getSupervisor() != null ? matchModel.getObject().getSupervisor().getId() : 0L;
|
supervisorId = matchModel.getObject().getSupervisor() != null ? matchModel.getObject().getSupervisor().getId() : 0L;
|
||||||
setOutputMarkupPlaceholderTag(true);
|
setOutputMarkupPlaceholderTag(true);
|
||||||
currentFragment = createButtonFragment();
|
currentFragment = createButtonFragment();
|
||||||
alternateFragment = createMatchFragment(matchModel);
|
alternateFragment = createMatchFragment(matchModel);
|
||||||
add(currentFragment);
|
add(currentFragment);
|
||||||
|
confirmed = confirmed__;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Fragment createButtonFragment() {
|
private Fragment createButtonFragment() {
|
||||||
@ -95,7 +97,11 @@ public class ManualMatchPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public void onSubmit() {
|
public void onSubmit() {
|
||||||
matchModel.getObject().setSupervisor(autocompleteSupervisorField.getModelObject());
|
matchModel.getObject().setSupervisor(autocompleteSupervisorField.getModelObject());
|
||||||
matchModel.getObject().setStatus(Status.CONFIRMED);
|
if(confirmed) {
|
||||||
|
matchModel.getObject().setStatus(Status.CONFIRMED);
|
||||||
|
} else {
|
||||||
|
matchModel.getObject().setStatus(Status.PUBLISHED);
|
||||||
|
}
|
||||||
matchDao.changeStatus(SciProSession.get().getUser(), matchModel.getObject(), null);
|
matchDao.changeStatus(SciProSession.get().getUser(), matchModel.getObject(), null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<wicket:panel>
|
<wicket:panel>
|
||||||
<wicket:enclosure child="manual">
|
<wicket:enclosure child="manual">
|
||||||
<div wicket:id="manual" class="append-bottom"></div>
|
<!--<div wicket:id="manual" class="append-bottom"></div>-->
|
||||||
<div wicket:id="watson"></div>
|
<div wicket:id="watson"></div>
|
||||||
</wicket:enclosure>
|
</wicket:enclosure>
|
||||||
</wicket:panel>
|
</wicket:panel>
|
||||||
|
@ -16,7 +16,7 @@ public class ManualWatsonPanel extends Panel {
|
|||||||
public ManualWatsonPanel(String id, IModel<ProjectIdea> model) {
|
public ManualWatsonPanel(String id, IModel<ProjectIdea> model) {
|
||||||
super(id);
|
super(id);
|
||||||
if (model.getObject()!=null){
|
if (model.getObject()!=null){
|
||||||
add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match")));
|
add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match"), true));
|
||||||
add(new WatsonInfoPanel("watson", model.getObject().getMatch().getProjectIdea()));
|
add(new WatsonInfoPanel("watson", model.getObject().getMatch().getProjectIdea()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,14 @@
|
|||||||
<div wicket:id="removeAuthorPanel"></div>
|
<div wicket:id="removeAuthorPanel"></div>
|
||||||
<form wicket:id="form">
|
<form wicket:id="form">
|
||||||
|
|
||||||
<div class="prepend-top">If you want to match and suggest this
|
<div class="prepend-top">If you want to match (CONFIRM) this
|
||||||
idea to a supervisor or reviewer manually, you can do so.</div>
|
idea to a supervisor or reviewer manually, you can do so.</div>
|
||||||
<div wicket:id="manualMatchPanel"></div>
|
<div wicket:id="manualMatchPanel"></div>
|
||||||
|
<div class="prepend-top">If you want to suggest (PUBLISH) this
|
||||||
|
idea to a supervisor or reviewer manually, you can do so.</div>
|
||||||
|
<div wicket:id="manualSuggPanel"></div>
|
||||||
<div class="prepend-top">If this project idea is poorly
|
<div class="prepend-top">If this project idea is poorly
|
||||||
written, it should 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>
|
||||||
<button wicket:id="sendBackButton">Refuse project idea</button>
|
<button wicket:id="sendBackButton">Refuse project idea</button>
|
||||||
<div class="prepend-top">If this project idea has been
|
<div class="prepend-top">If this project idea has been
|
||||||
|
@ -19,14 +19,14 @@ public class ProjectIdeaActionPanel extends Panel {
|
|||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private MatchDao matchDao;
|
private MatchDao matchDao;
|
||||||
private ManualMatchPanel manualMatchPanel;
|
|
||||||
|
|
||||||
|
|
||||||
public ProjectIdeaActionPanel(String id, final IModel<Match> matchModel) {
|
public ProjectIdeaActionPanel(String id, final IModel<Match> matchModel) {
|
||||||
super(id);
|
super(id);
|
||||||
add(new ProjectIdeaRemoveAuthorPanel("removeAuthorPanel", new Model(matchModel.getObject().getProjectIdea())).setVisible(matchModel.getObject().getProjectIdea().getAuthors().size()>1));
|
add(new ProjectIdeaRemoveAuthorPanel("removeAuthorPanel", new Model(matchModel.getObject().getProjectIdea())).setVisible(matchModel.getObject().getProjectIdea().getAuthors().size()>1));
|
||||||
Form<Match> form = new Form<Match>("form", matchModel);
|
Form<Match> form = new Form<Match>("form", matchModel);
|
||||||
form.add(manualMatchPanel = new ManualMatchPanel("manualMatchPanel", matchModel));
|
|
||||||
|
form.add(new ManualMatchPanel("manualMatchPanel", matchModel, true));
|
||||||
|
form.add(new ManualMatchPanel("manualSuggPanel", matchModel, false));
|
||||||
|
|
||||||
form.add(new Button("sendBackButton") {
|
form.add(new Button("sendBackButton") {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
package se.su.dsv.scipro.basepages;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.model.Model;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
|
||||||
|
|
||||||
public class Inte extends PublicPage {
|
|
||||||
|
|
||||||
private StaticImage firstImage, secondImage;
|
|
||||||
|
|
||||||
|
|
||||||
public Inte(final PageParameters pp){
|
|
||||||
super(pp);
|
|
||||||
|
|
||||||
firstImage = new StaticImage("firstImage", new Model<String>(
|
|
||||||
"images/icons/bullet_ball_glass_green.png"));
|
|
||||||
secondImage = new StaticImage("secondImage", new Model<String>(
|
|
||||||
"images/icons/bullet_ball_glass_yellow.png"));
|
|
||||||
|
|
||||||
|
|
||||||
add(firstImage);
|
|
||||||
add(secondImage);
|
|
||||||
|
|
||||||
secondImage.setVisible(false);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -127,7 +127,7 @@ public class UserSettingsPanel extends Panel {
|
|||||||
public void onSubmit(){
|
public void onSubmit(){
|
||||||
// UserSettings userSettings = userSettingsDao.reLoad(getModelObject());
|
// UserSettings userSettings = userSettingsDao.reLoad(getModelObject());
|
||||||
SciProSession.get().setActiveProject(userSettings.getActiveProject());
|
SciProSession.get().setActiveProject(userSettings.getActiveProject());
|
||||||
userSettingsDao.save(userSettings);
|
userSettings = userSettingsDao.save(userSettings);
|
||||||
setResponsePage(this.getPage().getClass(),this.getPage().getPageParameters());
|
setResponsePage(this.getPage().getClass(),this.getPage().getPageParameters());
|
||||||
}
|
}
|
||||||
}//UserSettingsForm
|
}//UserSettingsForm
|
||||||
|
@ -95,7 +95,7 @@ public class AnswerDialogPanel extends Panel {
|
|||||||
clAnswer.setComment(comment);
|
clAnswer.setComment(comment);
|
||||||
clq = checkListQuestionDao.reLoad(clq);
|
clq = checkListQuestionDao.reLoad(clq);
|
||||||
clq.addAnswer(checkListAnswerDao.save(clAnswer));
|
clq.addAnswer(checkListAnswerDao.save(clAnswer));
|
||||||
checkListQuestionDao.save(clq);
|
clq = checkListQuestionDao.save(clq);
|
||||||
setResponsePage(getPage());
|
setResponsePage(getPage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 class="span-10 last">
|
|
||||||
<form wicket:id="form">
|
|
||||||
<div wicket:id="feedbackPanel"></div>
|
|
||||||
<div>
|
|
||||||
<div>Template name</div>
|
|
||||||
<input wicket:id="templateName" type="text" />
|
|
||||||
</div>
|
|
||||||
<p></p>
|
|
||||||
<div wicket:id="categoryPanel"></div>
|
|
||||||
<p></p>
|
|
||||||
<div>Question</div>
|
|
||||||
<div>
|
|
||||||
<form wicket:id="addQuestionForm">
|
|
||||||
<div>
|
|
||||||
<input wicket:id="question" type="text" />
|
|
||||||
</div>
|
|
||||||
<input wicket:id="addQuestionButton" type="submit" />
|
|
||||||
<p></p>
|
|
||||||
<div wicket:id="container">
|
|
||||||
<table class="rounded-corner">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="rounded-left-top rounded-left-right">Questions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="1" class="rounded-foot"> </td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
<tr wicket:id="questions">
|
|
||||||
<td wicket:id="questionLabel"></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<p></p>
|
|
||||||
<input wicket:id="save" type="submit" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</wicket:panel>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,159 +0,0 @@
|
|||||||
package se.su.dsv.scipro.checklists.panels;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
|
||||||
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.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.IModel;
|
|
||||||
import org.apache.wicket.model.LoadableDetachableModel;
|
|
||||||
import org.apache.wicket.model.Model;
|
|
||||||
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.admin.pages.AdminCheckListPage;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author fnorbe@dsv.su.se
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class CreateChecklistTemplatePanel extends Panel {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 8862892008428526067L;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private CheckListTemplateDao checkListTemplateDao;
|
|
||||||
|
|
||||||
private String question = "";
|
|
||||||
private String title = "";
|
|
||||||
|
|
||||||
private CheckListTemplate checkListTemplate = new CheckListTemplate();
|
|
||||||
|
|
||||||
|
|
||||||
public CreateChecklistTemplatePanel(String id) {
|
|
||||||
super(id);
|
|
||||||
|
|
||||||
question = "";
|
|
||||||
title = "";
|
|
||||||
|
|
||||||
final FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackPanel");
|
|
||||||
feedbackPanel.setOutputMarkupId(true);
|
|
||||||
|
|
||||||
final ChecklistCategoryPanel categoryPanel = new ChecklistCategoryPanel("categoryPanel", new ArrayList<ChecklistCategory>());
|
|
||||||
|
|
||||||
Form<CheckListTemplate> form = new Form<CheckListTemplate>("form");
|
|
||||||
final Form<CheckListTemplate> addQuestionForm = new Form<CheckListTemplate>("addQuestionForm");
|
|
||||||
final TextField<String> titleField = new RequiredTextField<String>("templateName",
|
|
||||||
new PropertyModel<String>(this, "title"));
|
|
||||||
titleField.setOutputMarkupId(true);
|
|
||||||
final TextField<String> questionField = new TextField<String>("question",
|
|
||||||
new PropertyModel<String>(this, "question"));
|
|
||||||
questionField.setOutputMarkupId(true);
|
|
||||||
questionField.setRequired(false);
|
|
||||||
|
|
||||||
final IModel<List<String>> questionModel = new LoadableDetachableModel<List<String>>(){
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<String> load() {
|
|
||||||
return checkListTemplate.getQuestions();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
|
||||||
container.setOutputMarkupId(true);
|
|
||||||
ListView<String> listView = new ListView<String>("questions", questionModel) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateItem(ListItem<String> item) {
|
|
||||||
Label question = new Label("questionLabel", item.getModel().getObject());
|
|
||||||
item.add(question);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
container.add(listView);
|
|
||||||
|
|
||||||
AjaxButton save = new AjaxButton("save", new Model<String>("Save template")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
|
|
||||||
if(checkListTemplate.getQuestions() == null){
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
checkListTemplate.setCreator(SciProSession.get().getUser());
|
|
||||||
checkListTemplate.setName(title);
|
|
||||||
checkListTemplate.setCategories(categoryPanel.getSelectedCategories());
|
|
||||||
checkListTemplateDao.save(checkListTemplate);
|
|
||||||
checkListTemplate = new CheckListTemplate();
|
|
||||||
title ="";
|
|
||||||
question="";
|
|
||||||
target.addComponent(container);
|
|
||||||
target.addComponent(titleField);
|
|
||||||
setResponsePage(new AdminCheckListPage(new PageParameters()));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError (final AjaxRequestTarget target, final Form<?> form) {
|
|
||||||
target.addComponent(feedbackPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AjaxButton addQuestionButton = new AjaxButton("addQuestionButton", new Model<String>("Add question")) { static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
|
|
||||||
try{
|
|
||||||
checkListTemplate.addQuestion(new String(question));
|
|
||||||
questionModel.detach();
|
|
||||||
question = "";
|
|
||||||
target.addComponent(questionField);
|
|
||||||
target.addComponent(container);
|
|
||||||
}catch(NullPointerException npe){
|
|
||||||
feedbackPanel.error("Question cant be empty");
|
|
||||||
target.addComponent(feedbackPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
addQuestionForm.add(questionField);
|
|
||||||
addQuestionForm.add(container);
|
|
||||||
addQuestionForm.add(addQuestionButton);
|
|
||||||
form.add(feedbackPanel);
|
|
||||||
form.add(titleField);
|
|
||||||
form.add(categoryPanel);
|
|
||||||
form.add(addQuestionForm);
|
|
||||||
form.add(save);
|
|
||||||
|
|
||||||
add(form);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -5,16 +5,14 @@ import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
|||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
import org.apache.wicket.markup.html.form.TextField;
|
import org.apache.wicket.markup.html.form.TextField;
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
import org.apache.wicket.markup.html.panel.Panel;
|
||||||
|
import org.apache.wicket.model.Model;
|
||||||
import org.apache.wicket.model.PropertyModel;
|
import org.apache.wicket.model.PropertyModel;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.admin.pages.AdminCheckListPage;
|
|
||||||
import se.su.dsv.scipro.admin.panels.AdminViewCheckListTemplatePanel;
|
import se.su.dsv.scipro.admin.panels.AdminViewCheckListTemplatePanel;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectScheduleEvent;
|
|
||||||
|
|
||||||
public abstract class FunctionalEditChecklistTemplatePanel extends Panel{
|
public abstract class FunctionalEditChecklistTemplatePanel extends Panel{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -32,7 +30,7 @@ public abstract class FunctionalEditChecklistTemplatePanel extends Panel{
|
|||||||
if (clt.getId()!=null)
|
if (clt.getId()!=null)
|
||||||
clt = checklistTemplateDao.reLoad(clt);
|
clt = checklistTemplateDao.reLoad(clt);
|
||||||
|
|
||||||
form = new ChecklistTemplateForm("checklistTemplateForm", clt);
|
form = new ChecklistTemplateForm("checklistTemplateForm", new Model<CheckListTemplate>(clt));
|
||||||
add(form);
|
add(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,24 +43,18 @@ public abstract class FunctionalEditChecklistTemplatePanel extends Panel{
|
|||||||
public class ChecklistTemplateForm extends Form{
|
public class ChecklistTemplateForm extends Form{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private transient String name; //no need to serialize this
|
public ChecklistTemplateForm(String id, final Model<CheckListTemplate> cltModel) {
|
||||||
private CheckListTemplate clt;
|
|
||||||
|
|
||||||
public ChecklistTemplateForm(String id, final CheckListTemplate clt) {
|
|
||||||
super(id);
|
super(id);
|
||||||
|
|
||||||
this.clt = clt;
|
add(new TextField<String>("nameTextField", new PropertyModel<String>(cltModel.getObject(), "name")));
|
||||||
name = clt.getName();
|
add(new ChecklistCategoryPanel("categoryPanel", cltModel.getObject().getCategories()));
|
||||||
add(new TextField<String>("nameTextField", new PropertyModel<String>(this, "name")));
|
add(new AdminViewCheckListTemplatePanel("avcltp", cltModel.getObject()));
|
||||||
add(new ChecklistCategoryPanel("categoryPanel", clt.getCategories()));
|
|
||||||
add(new AdminViewCheckListTemplatePanel("avcltp", clt));
|
|
||||||
|
|
||||||
add(new AjaxButton("saveButton") {
|
add(new AjaxButton("saveButton") {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
clt.setName(name);
|
cltModel.setObject(checklistTemplateDao.save(cltModel.getObject()));
|
||||||
checklistTemplateDao.save(clt);
|
|
||||||
onUpdate(target);
|
onUpdate(target);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -14,6 +14,7 @@ import org.apache.wicket.markup.html.panel.EmptyPanel;
|
|||||||
import org.apache.wicket.markup.html.panel.Panel;
|
import org.apache.wicket.markup.html.panel.Panel;
|
||||||
import org.apache.wicket.model.IModel;
|
import org.apache.wicket.model.IModel;
|
||||||
import org.apache.wicket.model.LoadableDetachableModel;
|
import org.apache.wicket.model.LoadableDetachableModel;
|
||||||
|
import org.apache.wicket.model.Model;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
import se.su.dsv.scipro.SciProSession;
|
||||||
@ -56,19 +57,19 @@ public class ListCheckListPanel extends Panel {
|
|||||||
@SpringBean
|
@SpringBean
|
||||||
CheckListController checkListController;
|
CheckListController checkListController;
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private Project project;
|
private Model<Project> projectModel;
|
||||||
private final ListView<CheckList> checkLists;
|
private final ListView<CheckList> checkLists;
|
||||||
private Label emptyLabel;
|
private Label emptyLabel;
|
||||||
|
|
||||||
public ListCheckListPanel(String id, final CheckListRole role, final Project project) {
|
public ListCheckListPanel(String id, final CheckListRole role, final Model<Project> projectModel) {
|
||||||
super(id);
|
super(id);
|
||||||
assert(project != null);
|
assert(projectModel.getObject() != null);
|
||||||
this.project = project;
|
this.projectModel = projectModel;
|
||||||
final IModel<List<CheckList>> checkListModel = new LoadableDetachableModel<List<CheckList>>() {
|
final IModel<List<CheckList>> checkListModel = new LoadableDetachableModel<List<CheckList>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@Override
|
@Override
|
||||||
protected List<CheckList> load() {
|
protected List<CheckList> load() {
|
||||||
return project.getCheckLists();
|
return projectModel.getObject().getCheckLists();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||||
@ -76,7 +77,7 @@ public class ListCheckListPanel extends Panel {
|
|||||||
|
|
||||||
emptyLabel = new Label("emptyLabel", "No checklists has been added to this project yet.");
|
emptyLabel = new Label("emptyLabel", "No checklists has been added to this project yet.");
|
||||||
emptyLabel.setOutputMarkupId(true);
|
emptyLabel.setOutputMarkupId(true);
|
||||||
emptyLabel.setVisible(project.getCheckLists().isEmpty());
|
emptyLabel.setVisible(projectModel.getObject().getCheckLists().isEmpty());
|
||||||
container.add(emptyLabel);
|
container.add(emptyLabel);
|
||||||
|
|
||||||
container.add(new WebMarkupContainer("removeHeader"){
|
container.add(new WebMarkupContainer("removeHeader"){
|
||||||
@ -94,7 +95,7 @@ public class ListCheckListPanel extends Panel {
|
|||||||
final CheckList cl = item.getModelObject();
|
final CheckList cl = item.getModelObject();
|
||||||
final PageParameters pp = new PageParameters();
|
final PageParameters pp = new PageParameters();
|
||||||
pp.put("checklist", cl.getId());
|
pp.put("checklist", cl.getId());
|
||||||
pp.put(Project.PP_PROJECT_ID, project.getId());
|
pp.put(Project.PP_PROJECT_ID, projectModel.getObject().getId());
|
||||||
//Check for answered questions on this checklist
|
//Check for answered questions on this checklist
|
||||||
boolean isAnswered=false;
|
boolean isAnswered=false;
|
||||||
for(CheckListQuestion question :cl.getQuestions()){
|
for(CheckListQuestion question :cl.getQuestions()){
|
||||||
@ -105,8 +106,8 @@ public class ListCheckListPanel extends Panel {
|
|||||||
}
|
}
|
||||||
//Check for links from project schedule events
|
//Check for links from project schedule events
|
||||||
boolean isLinked=false;
|
boolean isLinked=false;
|
||||||
if(project != null && project.getProjectSchedule() != null){
|
if(projectModel.getObject() != null && projectModel.getObject().getProjectSchedule() != null){
|
||||||
for(final ProjectScheduleEvent event : project.getProjectSchedule().getEvents()){
|
for(final ProjectScheduleEvent event : projectModel.getObject().getProjectSchedule().getEvents()){
|
||||||
if(event.getCheckList() != null && event.getCheckList().equals(cl)){
|
if(event.getCheckList() != null && event.getCheckList().equals(cl)){
|
||||||
isLinked = true;
|
isLinked = true;
|
||||||
break;
|
break;
|
||||||
@ -123,7 +124,7 @@ public class ListCheckListPanel extends Panel {
|
|||||||
assert(canDeleteChecklist(role));
|
assert(canDeleteChecklist(role));
|
||||||
// if(checklistCanBeRemoved){
|
// if(checklistCanBeRemoved){
|
||||||
|
|
||||||
for (ProjectScheduleEvent pse : project.getProjectSchedule().getEvents()){
|
for (ProjectScheduleEvent pse : projectModel.getObject().getProjectSchedule().getEvents()){
|
||||||
if (pse.getCheckList()!=null && pse.getCheckList().equals(item.getModelObject())){
|
if (pse.getCheckList()!=null && pse.getCheckList().equals(item.getModelObject())){
|
||||||
pse.setCheckList(null);
|
pse.setCheckList(null);
|
||||||
pseDao.save(pse);
|
pseDao.save(pse);
|
||||||
@ -131,8 +132,11 @@ public class ListCheckListPanel extends Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkListDao.reLoad(item.getModel().getObject());
|
checkListDao.reLoad(item.getModel().getObject());
|
||||||
project.removeCheckList(item.getModelObject());
|
projectModel.getObject().removeCheckList(item.getModelObject());
|
||||||
projectDao.save(project);
|
|
||||||
|
|
||||||
|
|
||||||
|
projectModel.setObject(projectDao.save(projectModel.getObject()));
|
||||||
setResponsePage(SupervisorChecklistPage.class, pp);
|
setResponsePage(SupervisorChecklistPage.class, pp);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public class ListCheckListTemplatePanel extends Panel{
|
|||||||
|
|
||||||
if (!alreadyAdded){
|
if (!alreadyAdded){
|
||||||
project.addCheckList(checkListDao.save(cl));
|
project.addCheckList(checkListDao.save(cl));
|
||||||
projectDao.save(project);
|
project = projectDao.save(project);
|
||||||
dialog.close(target);
|
dialog.close(target);
|
||||||
setResponsePage(SupervisorChecklistPage.class, pp);
|
setResponsePage(SupervisorChecklistPage.class, pp);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ public class ConferencePanel extends Panel {
|
|||||||
|
|
||||||
MessageBoard mb = messageBoardModel.getObject();
|
MessageBoard mb = messageBoardModel.getObject();
|
||||||
mb.removeFromBoardMessages(boardMessageDao.reLoad(bm));
|
mb.removeFromBoardMessages(boardMessageDao.reLoad(bm));
|
||||||
messageBoardDao.save(mb);
|
mb = messageBoardDao.save(mb);
|
||||||
boardMessageDao.delete(boardMessageDao.reLoad(bm));
|
boardMessageDao.delete(boardMessageDao.reLoad(bm));
|
||||||
webMarkupContainer.removeAll();
|
webMarkupContainer.removeAll();
|
||||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||||
@ -319,7 +319,7 @@ public class ConferencePanel extends Panel {
|
|||||||
|
|
||||||
MessageBoard mb = messageBoardModel.getObject();
|
MessageBoard mb = messageBoardModel.getObject();
|
||||||
mb.addToBoardMessages(bm);
|
mb.addToBoardMessages(bm);
|
||||||
messageBoardDao.save(mb);
|
mb = messageBoardDao.save(mb);
|
||||||
|
|
||||||
for (SubscriberModel subscriberModel : subscriberModels) {
|
for (SubscriberModel subscriberModel : subscriberModels) {
|
||||||
notificationController.notifyConferencePost(subscriberModel.getUser(),
|
notificationController.notifyConferencePost(subscriberModel.getUser(),
|
||||||
|
@ -90,7 +90,7 @@ public class CheckListControllerImpl implements CheckListController, IClusterabl
|
|||||||
clUpload.setFileName(upload.getClientFileName());
|
clUpload.setFileName(upload.getClientFileName());
|
||||||
clUpload = checkListUploadDao.save(clUpload);
|
clUpload = checkListUploadDao.save(clUpload);
|
||||||
checkList.setCheckListUpload(clUpload);
|
checkList.setCheckListUpload(clUpload);
|
||||||
checkListDao.save(checkList);
|
checkList = checkListDao.save(checkList);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//Something went wrong...
|
//Something went wrong...
|
||||||
@ -119,7 +119,7 @@ public class CheckListControllerImpl implements CheckListController, IClusterabl
|
|||||||
CheckList tmp = checkListUpload.getCheckList();
|
CheckList tmp = checkListUpload.getCheckList();
|
||||||
tmp.setCheckListUpload(null);
|
tmp.setCheckListUpload(null);
|
||||||
checkListUploadDao.delete(checkListUpload);
|
checkListUploadDao.delete(checkListUpload);
|
||||||
checkListDao.save(tmp);
|
tmp = checkListDao.save(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
notification.setUser(usertoNotify);
|
notification.setUser(usertoNotify);
|
||||||
notification.setInfoText(notificationMessage.getWebNotificationMessage());
|
notification.setInfoText(notificationMessage.getWebNotificationMessage());
|
||||||
notification.setUrl(absoluteUrl);
|
notification.setUrl(absoluteUrl);
|
||||||
notificationDao.save(notification);
|
notification = notificationDao.save(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Date;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -11,32 +12,37 @@ 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.CheckListQuestionDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.enums.ProjectStatus;
|
import se.su.dsv.scipro.data.enums.ProjectStatus;
|
||||||
import se.su.dsv.scipro.data.enums.StateOfMind;
|
import se.su.dsv.scipro.data.enums.StateOfMind;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ProjectFacade {
|
public class ProjectFacade {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CheckListTemplateDao checkListTemplateDao;
|
private CheckListTemplateDao checkListTemplateDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CheckListDao checkListDao;
|
private CheckListDao checkListDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CheckListQuestionDao checkListQuestionDao;
|
private CheckListQuestionDao checkListQuestionDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSettingsDao userSettingsDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectDao projectDao;
|
private ProjectDao projectDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CheckListTemplateDao checklistTemplateDao;
|
private CheckListTemplateDao checklistTemplateDao;
|
||||||
|
|
||||||
public void completedProjectStatus(Project project){
|
public void completedProjectStatus(Project project){
|
||||||
if (project!=null){
|
if (project!=null){
|
||||||
project = projectDao.reLoad(project);
|
project = projectDao.reLoad(project);
|
||||||
@ -47,38 +53,49 @@ public class ProjectFacade {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteProject(Project project){
|
||||||
|
project = projectDao.reLoad(project);
|
||||||
|
for (Student s : project.getProjectParticipants()){
|
||||||
|
if (userSettingsDao.getUserSettings(s.getUser()).getActiveProject()!=null && userSettingsDao.getUserSettings(s.getUser()).getActiveProject().equals(project)){
|
||||||
|
userSettingsDao.getUserSettings(s.getUser()).setActiveProject(null);
|
||||||
|
userSettingsDao.save(userSettingsDao.getUserSettings(s.getUser()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
projectDao.delete(project);
|
||||||
|
}
|
||||||
|
|
||||||
public void generateChecklists(Project project){
|
public void generateChecklists(Project project){
|
||||||
List<CheckListTemplate> templates;
|
List<CheckListTemplate> templates;
|
||||||
project = projectDao.reLoad(project);
|
project = projectDao.reLoad(project);
|
||||||
|
|
||||||
if(project.getProjectClass().getCode().equals(ProjectClass.BACHELOR)){
|
if(project.getProjectClass().getCode().equals(ProjectClass.BACHELOR)){
|
||||||
templates = checkListTemplateDao.findTemplatesByCategory("Bachelor");
|
templates = checkListTemplateDao.findTemplatesByCategory("Bachelor");
|
||||||
}else{
|
}else{
|
||||||
templates = checkListTemplateDao.findTemplatesByCategory("Master");
|
templates = checkListTemplateDao.findTemplatesByCategory("Master");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(CheckListTemplate template : templates){
|
for(CheckListTemplate template : templates){
|
||||||
|
|
||||||
List<CheckList> addedCheckLists = project.getCheckLists(); //list with all the checklist already added to the project
|
List<CheckList> addedCheckLists = project.getCheckLists(); //list with all the checklist already added to the project
|
||||||
|
|
||||||
boolean alreadyAdded = false;
|
boolean alreadyAdded = false;
|
||||||
|
|
||||||
for (CheckList check : addedCheckLists){ //loop through the list
|
for (CheckList check : addedCheckLists){ //loop through the list
|
||||||
if (check.getName().equals(template.getName())){ //if the name of the template we want to add already exists as a checklist
|
if (check.getName().equals(template.getName())){ //if the name of the template we want to add already exists as a checklist
|
||||||
alreadyAdded = true; //set the boolean to true
|
alreadyAdded = true; //set the boolean to true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alreadyAdded){ //if its NOT already added, then add a new checklist based on the template
|
if (!alreadyAdded){ //if its NOT already added, then add a new checklist based on the template
|
||||||
|
|
||||||
CheckListTemplate clt2 = checklistTemplateDao.reLoad(template);
|
CheckListTemplate clt2 = checklistTemplateDao.reLoad(template);
|
||||||
List<ChecklistCategory> categoryList = new ArrayList<ChecklistCategory>();
|
List<ChecklistCategory> categoryList = new ArrayList<ChecklistCategory>();
|
||||||
for(ChecklistCategory cc : clt2.getCategories()){
|
for(ChecklistCategory cc : clt2.getCategories()){
|
||||||
categoryList.add(cc);
|
categoryList.add(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckList cl = new CheckList(template.getName(), project, categoryList);
|
CheckList cl = new CheckList(template.getName(), project, categoryList);
|
||||||
for(String question : template.getQuestions()){
|
for(String question : template.getQuestions()){
|
||||||
CheckListQuestion clQuestion = new CheckListQuestion(question, cl.getNumberOfQuestions());
|
CheckListQuestion clQuestion = new CheckListQuestion(question, cl.getNumberOfQuestions());
|
||||||
@ -87,11 +104,11 @@ public class ProjectFacade {
|
|||||||
}
|
}
|
||||||
cl.setCategories(template.getCategories());
|
cl.setCategories(template.getCategories());
|
||||||
project.addCheckList(checkListDao.save(cl));
|
project.addCheckList(checkListDao.save(cl));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
projectDao.save(project);
|
project = projectDao.save(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class JsonDeletePrivateMessagePage extends WebPage {
|
|||||||
if (userSettings.getApiKey() != null && userSettings.getApiKey().equals(apikey)) {
|
if (userSettings.getApiKey() != null && userSettings.getApiKey().equals(apikey)) {
|
||||||
PrivateMessage privateMessage = privateMessageDao.load(jsonDeletePrivateMessage.id);
|
PrivateMessage privateMessage = privateMessageDao.load(jsonDeletePrivateMessage.id);
|
||||||
privateMessage.setDeleted(true);
|
privateMessage.setDeleted(true);
|
||||||
privateMessageDao.save(privateMessage);
|
privateMessage = privateMessageDao.save(privateMessage);
|
||||||
jsonOutput.addProperty("apikey", "success");
|
jsonOutput.addProperty("apikey", "success");
|
||||||
} else {
|
} else {
|
||||||
jsonOutput.addProperty("apikey", "fail");
|
jsonOutput.addProperty("apikey", "fail");
|
||||||
|
@ -60,7 +60,7 @@ public class JsonDeleteRecipientPage extends WebPage {
|
|||||||
if (userSettings.getApiKey() != null && userSettings.getApiKey().equals(apikey)) {
|
if (userSettings.getApiKey() != null && userSettings.getApiKey().equals(apikey)) {
|
||||||
Recipient recipient = recipientDao.load(jsonRecipient.id);
|
Recipient recipient = recipientDao.load(jsonRecipient.id);
|
||||||
recipient.setDeleted(true);
|
recipient.setDeleted(true);
|
||||||
recipientDao.save(recipient);
|
recipient = recipientDao.save(recipient);
|
||||||
jsonOutput.addProperty("apikey", "success");
|
jsonOutput.addProperty("apikey", "success");
|
||||||
} else {
|
} else {
|
||||||
jsonOutput.addProperty("apikey", "fail");
|
jsonOutput.addProperty("apikey", "fail");
|
||||||
|
@ -61,7 +61,7 @@ public class JsonSetReadPage extends WebPage {
|
|||||||
if (userSettings.getApiKey() != null && userSettings.getApiKey().equals(apikey)) {
|
if (userSettings.getApiKey() != null && userSettings.getApiKey().equals(apikey)) {
|
||||||
Recipient recipient = recipientDao.load(jsonRecipient.id);
|
Recipient recipient = recipientDao.load(jsonRecipient.id);
|
||||||
recipient.setDateRead(new Date());
|
recipient.setDateRead(new Date());
|
||||||
recipientDao.save(recipient);
|
recipient = recipientDao.save(recipient);
|
||||||
jsonOutput.addProperty("apikey", "success");
|
jsonOutput.addProperty("apikey", "success");
|
||||||
} else {
|
} else {
|
||||||
jsonOutput.addProperty("apikey", "fail");
|
jsonOutput.addProperty("apikey", "fail");
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.model;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.apache.wicket.IClusterable;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Category;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CategoryModel implements IClusterable {
|
|
||||||
|
|
||||||
private String categoryName;
|
|
||||||
private Category selectedCategory;
|
|
||||||
|
|
||||||
public String getCategoryName() {
|
|
||||||
return categoryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCategoryName(String categoryName) {
|
|
||||||
this.categoryName = categoryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Category getCategory() {
|
|
||||||
return selectedCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCategory(Category category) {
|
|
||||||
this.selectedCategory = category;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.model;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.IClusterable;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Category;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Tag;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ResourceModel implements IClusterable {
|
|
||||||
|
|
||||||
private String info;
|
|
||||||
private String link;
|
|
||||||
private String linkName;
|
|
||||||
private String embedCode;
|
|
||||||
private String tags;
|
|
||||||
private Collection<Category> selectedCategoryCollection;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getEmbedCode() {
|
|
||||||
return embedCode;
|
|
||||||
}
|
|
||||||
public void setEmbedCode(String embedCode) {
|
|
||||||
this.embedCode = embedCode;
|
|
||||||
}
|
|
||||||
public String getInfo() {
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
public String getLink() {
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
public String getLinkName() {
|
|
||||||
return linkName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getTags() {
|
|
||||||
return tags;
|
|
||||||
}
|
|
||||||
public void setTags(String tags) {
|
|
||||||
this.tags = tags;
|
|
||||||
}
|
|
||||||
public void setInfo(String info) {
|
|
||||||
this.info = info;
|
|
||||||
}
|
|
||||||
public void setLink(String link) {
|
|
||||||
this.link = link;
|
|
||||||
}
|
|
||||||
public void setLinkName(String linkName) {
|
|
||||||
this.linkName = linkName;
|
|
||||||
}
|
|
||||||
public Collection<Category> getSelectedCategoryCollection() {
|
|
||||||
return selectedCategoryCollection;
|
|
||||||
}
|
|
||||||
public void setSelectedCategoryCollection(
|
|
||||||
Collection<Category> selectedCategoryCollection) {
|
|
||||||
this.selectedCategoryCollection = selectedCategoryCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
|
|
||||||
|
|
||||||
<div wicket:id="bookMarkTagPanel"></div>
|
|
||||||
|
|
||||||
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,46 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.page;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.basepages.MenuPage;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Category;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Tag;
|
|
||||||
import se.su.dsv.scipro.knol.resource.panels.ResourceBookmarkableCategoryPanel;
|
|
||||||
import se.su.dsv.scipro.knol.resource.panels.ResourceBookmarkableTagPanel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class BookmarkableCategoryResourcePage extends MenuPage {
|
|
||||||
|
|
||||||
public BookmarkableCategoryResourcePage(PageParameters pp) {
|
|
||||||
super(pp);
|
|
||||||
add(new ResourceBookmarkableCategoryPanel("bookMarkTagPanel", pp));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BookmarkablePageLink<Void> getBookmarkablePageLink(String id,
|
|
||||||
List<Category> categoryList) {
|
|
||||||
String category = "";
|
|
||||||
boolean first = true;
|
|
||||||
for (Category t : categoryList) {
|
|
||||||
if (first) {
|
|
||||||
category += t.getId();
|
|
||||||
first = false;
|
|
||||||
} else{
|
|
||||||
category += "+" + t.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PageParameters pp = new PageParameters();
|
|
||||||
pp.add("c", category);
|
|
||||||
return new BookmarkablePageLink<Void>(id,
|
|
||||||
BookmarkableCategoryResourcePage.class, pp);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
|
|
||||||
|
|
||||||
<div wicket:id="bookMarkPanel"></div>
|
|
||||||
|
|
||||||
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.page;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.basepages.MenuPage;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
|
||||||
import se.su.dsv.scipro.knol.resource.panels.ResourceBookmarkablePanel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class BookmarkableResourcePage extends MenuPage{
|
|
||||||
|
|
||||||
public BookmarkableResourcePage(PageParameters pp) {
|
|
||||||
super(pp);
|
|
||||||
add(new ResourceBookmarkablePanel("bookMarkPanel", pp));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BookmarkablePageLink<Void> getBookmarkablePageLink(String id, Resource resource){
|
|
||||||
PageParameters pp = new PageParameters();
|
|
||||||
pp.put("r", resource.getId());
|
|
||||||
return new BookmarkablePageLink<Void>(id, BookmarkableResourcePage.class, pp);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
|
|
||||||
|
|
||||||
<div wicket:id="bookMarkTagPanel"></div>
|
|
||||||
|
|
||||||
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,43 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.page;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.basepages.MenuPage;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Tag;
|
|
||||||
import se.su.dsv.scipro.knol.resource.panels.ResourceBookmarkableTagPanel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class BookmarkableTagResourcePage extends MenuPage {
|
|
||||||
|
|
||||||
public BookmarkableTagResourcePage(PageParameters pp) {
|
|
||||||
super(pp);
|
|
||||||
add(new ResourceBookmarkableTagPanel("bookMarkTagPanel", pp));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BookmarkablePageLink<Void> getBookmarkablePageLink(String id,
|
|
||||||
List<Tag> tagList) {
|
|
||||||
String tag = "";
|
|
||||||
boolean first = true;
|
|
||||||
for (Tag t : tagList) {
|
|
||||||
if (first) {
|
|
||||||
tag += t.getId();
|
|
||||||
first = false;
|
|
||||||
} else{
|
|
||||||
tag += "+" + t.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PageParameters pp = new PageParameters();
|
|
||||||
pp.add("t", tag);
|
|
||||||
return new BookmarkablePageLink<Void>(id,
|
|
||||||
BookmarkableTagResourcePage.class, pp);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.page;
|
|
||||||
|
|
||||||
import org.apache.wicket.markup.ComponentTag;
|
|
||||||
import org.apache.wicket.markup.MarkupStream;
|
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class HtmlWebMarkupContainer extends WebMarkupContainer {
|
|
||||||
|
|
||||||
private String html;
|
|
||||||
|
|
||||||
public HtmlWebMarkupContainer(String id, String html) {
|
|
||||||
super(id);
|
|
||||||
this.html = html;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getHtml() {
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setHtml(String html) {
|
|
||||||
this.html = html;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onComponentTagBody(MarkupStream markupStream,
|
|
||||||
ComponentTag openTag) {
|
|
||||||
replaceComponentTagBody(markupStream, openTag, html);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
<div wicket:id="resourcesPanel"></div>
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.page;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.basepages.MenuPage;
|
|
||||||
import se.su.dsv.scipro.knol.resource.panels.ResourcesPanel;
|
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Authorization(authorizedRoles={Roles.SYSADMIN}) //TODO Hidden for initial deployment
|
|
||||||
public class ResourcePage extends MenuPage {
|
|
||||||
|
|
||||||
public static final String MAIN_MENU_LABEL = "Resources";
|
|
||||||
|
|
||||||
public ResourcePage(PageParameters pp) {
|
|
||||||
super(pp);
|
|
||||||
add(new ResourcesPanel("resourcesPanel"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.page;
|
|
||||||
|
|
||||||
import org.apache.wicket.markup.ComponentTag;
|
|
||||||
import org.apache.wicket.markup.html.WebComponent;
|
|
||||||
import org.apache.wicket.model.IModel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class StaticImage extends WebComponent {
|
|
||||||
|
|
||||||
public StaticImage(String id, IModel model) {
|
|
||||||
super(id, model);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onComponentTag(ComponentTag tag) {
|
|
||||||
super.onComponentTag(tag);
|
|
||||||
checkComponentTag(tag, "img");
|
|
||||||
tag.put("src", getDefaultModelObjectAsString());
|
|
||||||
// since Wicket 1.4 you need to use getDefaultModelObjectAsString() instead of getModelObjectAsString()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
|
|
||||||
<div><span wicket:id="feedbackPanel">[Feedback goes here]</span></div>
|
|
||||||
<form wicket:id="uploadForm">
|
|
||||||
<div><input wicket:id="fileInput" id="fileInput" type="file" /></div>
|
|
||||||
<div><input type="submit" value="Upload!" name="upload" /></div>
|
|
||||||
<span wicket:id="progress">[[ajax upload progressbar]]</span>
|
|
||||||
</form>
|
|
||||||
<table wicket:id="listFiles">
|
|
||||||
<tr wicket:id="content">
|
|
||||||
<!-- <td><a href="delete" wicket:id="delete"><span-->
|
|
||||||
<!-- wicket:id="deleteIcon" /></a></td>-->
|
|
||||||
<td><span wicket:id="name">name</span></td>
|
|
||||||
<td><a href="#" wicket:id="open">Open</a></td>
|
|
||||||
|
|
||||||
<td><a href="#" wicket:id="download">Download</a></td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</wicket:panel>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,124 +0,0 @@
|
|||||||
package se.su.dsv.scipro.knol.resource.panels;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar;
|
|
||||||
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.upload.FileUpload;
|
|
||||||
import org.apache.wicket.markup.html.form.upload.FileUploadField;
|
|
||||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.markup.repeater.RepeatingView;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
import org.apache.wicket.util.lang.Bytes;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
|
||||||
import se.su.dsv.scipro.repository.FileRepository;
|
|
||||||
import se.su.dsv.scipro.repository.SortOrder;
|
|
||||||
import se.su.dsv.scipro.repository.components.FileDownloadLink;
|
|
||||||
import se.su.dsv.scipro.repository.components.FileOpenLink;
|
|
||||||
|
|
||||||
public class FileResourcePanel extends Panel{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 5500371345065598841L;
|
|
||||||
|
|
||||||
protected Bytes maxFileSize = Bytes.megabytes(100);
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
protected FileRepository fileRepository;
|
|
||||||
@SpringBean
|
|
||||||
protected UserDao userDao;
|
|
||||||
|
|
||||||
protected FileUploadForm fuf;
|
|
||||||
|
|
||||||
protected Resource resource;
|
|
||||||
|
|
||||||
protected WebMarkupContainer listFiles;
|
|
||||||
protected WebMarkupContainer tableHead;
|
|
||||||
|
|
||||||
public FileResourcePanel(String id, Resource resource) {
|
|
||||||
super(id);
|
|
||||||
add(new FeedbackPanel("feedbackPanel"));
|
|
||||||
this.resource = resource;
|
|
||||||
|
|
||||||
listFiles = new WebMarkupContainer("listFiles");
|
|
||||||
add(listFiles);
|
|
||||||
reloadFiles();
|
|
||||||
|
|
||||||
fuf = new FileUploadForm("uploadForm");
|
|
||||||
add(fuf);
|
|
||||||
fuf.add(new UploadProgressBar("progress", fuf)); //TODO seems to be broken in some browsers like Chrome
|
|
||||||
if(resource == null || resource.getId() == null)
|
|
||||||
fuf.setVisible(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void reloadFiles() {
|
|
||||||
listFiles.removeAll();
|
|
||||||
List<FileDescription> items = fileRepository.searchFiles(fileRepository.getResourcePath(resource.getId()),false);
|
|
||||||
|
|
||||||
if(items.isEmpty())
|
|
||||||
listFiles.setVisible(false);
|
|
||||||
else
|
|
||||||
listFiles.setVisible(true);
|
|
||||||
|
|
||||||
fileRepository.sortFileDescriptions(items, SortOrder.Name);
|
|
||||||
|
|
||||||
RepeatingView contents = new RepeatingView("content");
|
|
||||||
listFiles.add(contents);
|
|
||||||
for (final FileDescription desc : items) {
|
|
||||||
WebMarkupContainer inner = new WebMarkupContainer(contents.newChildId());
|
|
||||||
|
|
||||||
inner.add(new Label("name", desc.getName()));
|
|
||||||
|
|
||||||
inner.add(new FileDownloadLink("download", desc ));
|
|
||||||
inner.add(new FileOpenLink("open", desc));
|
|
||||||
|
|
||||||
contents.add(inner);
|
|
||||||
}//for
|
|
||||||
}//reloadFiles
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class FileUploadForm extends Form<Void> {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private FileUploadField fileUploadField;
|
|
||||||
|
|
||||||
public FileUploadForm(String id) {
|
|
||||||
super(id);
|
|
||||||
setMultiPart(true);
|
|
||||||
|
|
||||||
// Add one file input field
|
|
||||||
add(fileUploadField = new FileUploadField("fileInput"));
|
|
||||||
|
|
||||||
setMaxSize(maxFileSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit() {
|
|
||||||
final FileUpload upload = fileUploadField.getFileUpload();
|
|
||||||
if(resource == null){
|
|
||||||
error("File resource was null, this was not meant to happen!");
|
|
||||||
} else {
|
|
||||||
if(resource.getId() == null){
|
|
||||||
error("File resource id was null, this was not meant to happen!");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
String absolutePath = fileRepository.getResourcePath(resource.getId());
|
|
||||||
fileRepository.storeFile(upload, absolutePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setRedirect(true);
|
|
||||||
|
|
||||||
reloadFiles();
|
|
||||||
|
|
||||||
//This might have to be changed into something better using page parameters etc.
|
|
||||||
setResponsePage(getPage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
|
|
||||||
<h2>Resources</h2>
|
|
||||||
<div wicket:id="tagHeader" class="larger"></div>
|
|
||||||
<a href="#" wicket:id="showAll">Show All</a>
|
|
||||||
<div wicket:id="resourceListPanel"></div>
|
|
||||||
</wicket:panel>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,101 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.panels;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.RestartResponseException;
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
|
||||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProApplication;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CategoryDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ResourceDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.TagDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Category;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Tag;
|
|
||||||
import se.su.dsv.scipro.data.enums.ResourceType;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ResourceBookmarkableCategoryPanel extends Panel {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ResourceDao resourceDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private CategoryDao categoryDao;
|
|
||||||
|
|
||||||
|
|
||||||
public ResourceBookmarkableCategoryPanel(String id, PageParameters pp) {
|
|
||||||
super(id);
|
|
||||||
add(new AjaxLink<Tag>("showAll") {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
|
|
||||||
setResponsePage(ResourcePage.class);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
List<Category> categoryList = new ArrayList<Category>();
|
|
||||||
String categories = pp.getString("c");
|
|
||||||
String tagHeader = "Filtered by categories: ";
|
|
||||||
boolean first = true;
|
|
||||||
if (categories == null) {
|
|
||||||
failAndRedirect();
|
|
||||||
} else {
|
|
||||||
StringTokenizer stringTokenizer = new StringTokenizer(categories,
|
|
||||||
"+");
|
|
||||||
|
|
||||||
while (stringTokenizer.hasMoreTokens()) {
|
|
||||||
String tagString = stringTokenizer.nextToken().trim();
|
|
||||||
Category category = categoryDao.load(Long.valueOf(tagString));
|
|
||||||
if (category != null) {
|
|
||||||
if (!categoryList.contains(category)) {
|
|
||||||
categoryList.add(category);
|
|
||||||
if (first) {
|
|
||||||
tagHeader += category.getCategoryName();
|
|
||||||
first = false;
|
|
||||||
} else
|
|
||||||
tagHeader += ", " + category.getCategoryName();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
failAndRedirect();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
add(new Label("tagHeader", tagHeader));
|
|
||||||
Set<Resource> resourceList = new HashSet<Resource>();
|
|
||||||
for (Category category : categoryList) {
|
|
||||||
resourceList.addAll(resourceDao.findResourcesByCategory(category));
|
|
||||||
}
|
|
||||||
add(new ResourceListPanel("resourceListPanel", new ArrayList<Resource>(
|
|
||||||
resourceList), ResourceType.TAGVIEW));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void failAndRedirect() {
|
|
||||||
throw new RestartResponseException(SciProApplication.get()
|
|
||||||
.getApplicationSettings().getAccessDeniedPage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
|
|
||||||
<h2>Resource</h2>
|
|
||||||
<div wicket:id="resourceListPanel"></div>
|
|
||||||
</wicket:panel>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.panels;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.RestartResponseException;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProApplication;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ResourceDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
|
||||||
import se.su.dsv.scipro.data.enums.ResourceType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ResourceBookmarkablePanel extends Panel {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ResourceDao resourceDao;
|
|
||||||
|
|
||||||
|
|
||||||
private Resource resource;
|
|
||||||
|
|
||||||
|
|
||||||
public ResourceBookmarkablePanel(String id, PageParameters pp) {
|
|
||||||
super(id);
|
|
||||||
Long resId = pp.getAsLong("r");
|
|
||||||
|
|
||||||
if (resId == null) {
|
|
||||||
failAndRedirect();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
resource = resourceDao.load(resId);
|
|
||||||
if (resource == null)
|
|
||||||
failAndRedirect();
|
|
||||||
}
|
|
||||||
List<Resource> resourceList = new ArrayList<Resource>();
|
|
||||||
resourceList.add(resource);
|
|
||||||
add(new ResourceListPanel("resourceListPanel", resourceList, ResourceType.PERMALINK));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void failAndRedirect() {
|
|
||||||
throw new RestartResponseException(SciProApplication.get()
|
|
||||||
.getApplicationSettings().getAccessDeniedPage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
|
|
||||||
<h2>Resources</h2>
|
|
||||||
<div wicket:id="tagHeader" class="larger"></div>
|
|
||||||
<a href="#" wicket:id="showAll">Show All</a>
|
|
||||||
<div wicket:id="resourceListPanel"></div>
|
|
||||||
</wicket:panel>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,97 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.panels;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.RestartResponseException;
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
|
||||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProApplication;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ResourceDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.TagDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Tag;
|
|
||||||
import se.su.dsv.scipro.data.enums.ResourceType;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ResourceBookmarkableTagPanel extends Panel {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ResourceDao resourceDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private TagDao tagDao;
|
|
||||||
|
|
||||||
|
|
||||||
public ResourceBookmarkableTagPanel(String id, PageParameters pp) {
|
|
||||||
super(id);
|
|
||||||
add(new AjaxLink<Tag>("showAll") {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
|
|
||||||
setResponsePage(ResourcePage.class);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
List<Tag> tagList = new ArrayList<Tag>();
|
|
||||||
String tags = pp.getString("t");
|
|
||||||
String tagHeader = "Filtered by tags: ";
|
|
||||||
boolean first = true;
|
|
||||||
if (tags == null) {
|
|
||||||
failAndRedirect();
|
|
||||||
} else {
|
|
||||||
StringTokenizer stringTokenizer = new StringTokenizer(tags, "+");
|
|
||||||
|
|
||||||
while (stringTokenizer.hasMoreTokens()) {
|
|
||||||
String tagString = stringTokenizer.nextToken().trim();
|
|
||||||
Tag tag = tagDao.load(Long.valueOf(tagString));
|
|
||||||
if (null != tag) {
|
|
||||||
if (!tagList.contains(tag)) {
|
|
||||||
tagList.add(tag);
|
|
||||||
if (first) {
|
|
||||||
tagHeader += tag.getTag();
|
|
||||||
first = false;
|
|
||||||
} else
|
|
||||||
tagHeader += ", " + tag.getTag();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
failAndRedirect();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
add(new Label("tagHeader", tagHeader));
|
|
||||||
Set<Resource> resourceList = new HashSet<Resource>();
|
|
||||||
for (Tag tag : tagList) {
|
|
||||||
resourceList.addAll(resourceDao.findResourcesByTag(tag));
|
|
||||||
}
|
|
||||||
add(new ResourceListPanel("resourceListPanel", new ArrayList<Resource>(resourceList), ResourceType.TAGVIEW));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void failAndRedirect() {
|
|
||||||
throw new RestartResponseException(SciProApplication.get()
|
|
||||||
.getApplicationSettings().getAccessDeniedPage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,177 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
|
|
||||||
<div wicket:id="listContainer">
|
|
||||||
<table wicket:id = "link-item" class = "link-resource-border">
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="rating-cell">
|
|
||||||
<div class = "centered" ><a href="#" wicket:id="upLink"><img wicket:id="upLinkIcon"/></a></div>
|
|
||||||
<div class = "centered larger-rate-number" wicket:id="rate"></div>
|
|
||||||
<div class = "centered" ><a href="#" wicket:id="downLink"><img wicket:id="downLinkIcon" /></a></div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<a href="#" target="new" wicket:id="link" class="larger"></a>
|
|
||||||
<span wicket:id="heading" class="larger"></span>
|
|
||||||
<div class = "right-corner-resource">
|
|
||||||
<div class = "resource-icon">
|
|
||||||
<a href="#" wicket:id="editResource"><img src="images/icons/edit_16x16.png" " alt="Edit" title="Edit"/></a>
|
|
||||||
<a href="#" wicket:id="deleteResource"><img src="images/icons/delete_16x16.png" alt="Delete" title="Delete"/></a>
|
|
||||||
</div>
|
|
||||||
<div class = "smaller">
|
|
||||||
<strong>Created: </strong> <span wicket:id="date"></span>
|
|
||||||
<br/>
|
|
||||||
<strong>Created by: </strong> <span wicket:id="user"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div><a href="#" target="new" wicket:id="linkAddress"></a></div>
|
|
||||||
<div wicket:id="embedCode"></div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div wicket:id="info" class = "info-resource"></div>
|
|
||||||
<div><strong>Categories: </strong> <span wicket:id="category-item"><a href="#" wicket:id="tag"><span wicket:id="tagName"></span></a> </span></div>
|
|
||||||
<strong>Tags: </strong> <span wicket:id="tag-item"><a href="#" wicket:id="tag"><span wicket:id="tagName"></span></a> </span>
|
|
||||||
<div ><a href="#" wicket:id="bookmark">Permalink</a></div>
|
|
||||||
|
|
||||||
|
|
||||||
<div><a href="#" wicket:id="showComments"><span wicket:id="commentNumber"></span></a></div>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="rating-cell"></td>
|
|
||||||
<td colspan ="2"><div wicket:id="container"><div wicket:id="commentThread"></div></div></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div wicket:id ="navigator"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div wicket:id="editLinkDialog">
|
|
||||||
<div wicket:id="editLinkDialogContainer">
|
|
||||||
<form wicket:id="editLinkResourceForm">
|
|
||||||
<div wicket:id="feedbackContainer" class ="span-8 last">
|
|
||||||
<div wicket:id="feedbackPanel">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Link Name:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="linkName" class ="span-6"/>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Link Address:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="link" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Info:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<textarea wicket:id="info" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Categories:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<select wicket:id="selectedCategoryCollection" class ="span-8 last"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Tags:</strong>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class ="span-6 last">
|
|
||||||
Separate by comma.
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="tags" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Delete tags:</strong>
|
|
||||||
</div>
|
|
||||||
<div wicket:id="tagListContainer" class ="span-6 last">
|
|
||||||
<span wicket:id="tag-item">
|
|
||||||
<span wicket:id="tagContainer">
|
|
||||||
<span wicket:id="tag"></span>
|
|
||||||
<a href="#" wicket:id="deleteTag"><img src="images/icons/delete_16x16.png" alt="Delete" title="Delete"/></a>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last edit-button"><input type="submit" wicket:id="submitButton" /> </div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div wicket:id="editEmbedDialog">
|
|
||||||
<div wicket:id="editEmbedDialogContainer">
|
|
||||||
<form wicket:id="editEmbedResourceForm">
|
|
||||||
<div wicket:id="feedbackContainer" class ="span-8 last">
|
|
||||||
<div wicket:id="feedbackPanel">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Heading:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="linkName" class ="span-6"/>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Embed Code:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
Disclaimer: no security checks at the moment.
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<textarea wicket:id="embedCode" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Info:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<textarea wicket:id="info" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Categories:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<select wicket:id="selectedCategoryCollection" class ="span-8 last"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Add tags:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
Separate by comma.
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="tags" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Delete tags:</strong>
|
|
||||||
</div>
|
|
||||||
<div wicket:id="tagListContainerEmbed" class ="span-8 last">
|
|
||||||
<span wicket:id="tag-embed-item">
|
|
||||||
<span wicket:id="tagEmbedContainer">
|
|
||||||
<span wicket:id="tagEmbed"></span>
|
|
||||||
<a href="#" wicket:id="deleteTagEmbed"><img src="images/icons/delete_16x16.png" alt="Delete" title="Delete"/></a>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last edit-button"><input type="submit" wicket:id="submitButton" /> </div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</wicket:panel>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
|||||||
editLinkDialog.editLinkDialogContainer.editLinkResourceForm.link=Link Address
|
|
||||||
editLinkDialog.editLinkDialogContainer.editLinkResourceForm.linkName=Link Name
|
|
||||||
editLinkDialog.editLinkDialogContainer.editLinkResourceForm.info=Info
|
|
||||||
editLinkDialog.editLinkDialogContainer.editLinkResourceForm.tags=Tags
|
|
||||||
editLinkDialog.editLinkDialogContainer.editLinkResourceForm.selectedCategoryCollection=Categories
|
|
||||||
editEmbedDialog.editEmbedDialogContainer.editEmbedResourceForm.linkName=Heading
|
|
||||||
editEmbedDialog.editEmbedDialogContainer.editEmbedResourceForm.embedCode=Embed Code
|
|
||||||
editEmbedDialog.editEmbedDialogContainer.editEmbedResourceForm.info=Info
|
|
||||||
editEmbedDialog.editEmbedDialogContainer.editEmbedResourceForm.tags=Tags
|
|
||||||
editEmbedDialog.editEmbedDialogContainer.editEmbedResourceForm.selectedCategoryCollection=Categories
|
|
||||||
Required='${label}' is required
|
|
@ -1,170 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Resources</h2>
|
|
||||||
<div><a href="#" wicket:id="addLinkResource">Add Link Resource</a></div>
|
|
||||||
<div><a href="#" wicket:id="addEmbedResource">Add Embed Resource</a></div>
|
|
||||||
<div><a href="#" wicket:id="addCategories">Add Categories</a></div>
|
|
||||||
<div><a href="#" wicket:id="adminCategories">Edit Categories</a></div>
|
|
||||||
|
|
||||||
<div wicket:id="container">
|
|
||||||
<div wicket:id="resourceListPanel"></div>
|
|
||||||
</div>
|
|
||||||
<div wicket:id="dialog">
|
|
||||||
<div wicket:id="dialogContainer">
|
|
||||||
<form wicket:id="resourceForm">
|
|
||||||
<div wicket:id="feedbackContainer" class ="span-8 last">
|
|
||||||
<div wicket:id="feedbackPanel">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Link Name:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="linkName" class ="span-6"/>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Link Address:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="link" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Info:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<textarea wicket:id="info" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Categories:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<select wicket:id="selectedCategoryCollection" class ="span-8 last"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Tags:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
Separate by comma.
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="tags" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last"><input type="submit" wicket:id="submitButton" /> </div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div wicket:id="embedDialog">
|
|
||||||
<div wicket:id="embedDialogContainer">
|
|
||||||
<form wicket:id="embedResourceForm">
|
|
||||||
<div wicket:id="feedbackContainer" class ="span-8 last">
|
|
||||||
<div wicket:id="feedbackPanel"></div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Heading:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="linkName" class ="span-6"/>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Embed Code:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
Disclaimer: no security checks at the moment.
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<textarea wicket:id="embedCode" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Info:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<textarea wicket:id="info" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Categories:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<select wicket:id="selectedCategoryCollection" class ="span-8 last"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Tags:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
Separate by comma.
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="tags" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last"><input type="submit" wicket:id="submitButton" /> </div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div wicket:id="adminCategoriesDialog">
|
|
||||||
<div wicket:id="adminCategoriesContainer">
|
|
||||||
<form wicket:id="adminCategoriesForm">
|
|
||||||
<div wicket:id="feedbackContainer" class ="span-8 last">
|
|
||||||
<div wicket:id="feedbackPanel"></div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Categories:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
<select wicket:id="selectedCategory" class ="span-8 last"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Category Name:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="categoryName" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="submit" wicket:id="editButton" />
|
|
||||||
<input type="submit" wicket:id="deleteCategory" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="submit" wicket:id="closeButton" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div wicket:id="addCategoriesDialog">
|
|
||||||
<div wicket:id="addCategoriesContainer">
|
|
||||||
<form wicket:id="addCategoriesForm">
|
|
||||||
<div wicket:id="feedbackContainer" class ="span-8 last">
|
|
||||||
<div wicket:id="feedbackPanel"></div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Categories:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
<select wicket:id="selectedCategory" class ="span-8 last"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Category Name:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" wicket:id="categoryName" class ="span-6" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class ="span-6 last"><input type="submit" wicket:id="addButton" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="submit" wicket:id="closeButton" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</wicket:panel>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,749 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.knol.resource.panels;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
|
||||||
import org.apache.wicket.ajax.IAjaxCallDecorator;
|
|
||||||
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
|
|
||||||
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
|
|
||||||
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.form.Form;
|
|
||||||
import org.apache.wicket.markup.html.form.IChoiceRenderer;
|
|
||||||
import org.apache.wicket.markup.html.form.ListChoice;
|
|
||||||
import org.apache.wicket.markup.html.form.ListMultipleChoice;
|
|
||||||
import org.apache.wicket.markup.html.form.TextArea;
|
|
||||||
import org.apache.wicket.markup.html.form.TextField;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.model.CompoundPropertyModel;
|
|
||||||
import org.apache.wicket.model.Model;
|
|
||||||
import org.apache.wicket.model.util.ListModel;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
import org.apache.wicket.validation.validator.UrlValidator;
|
|
||||||
import org.odlabs.wiquery.core.javascript.JsScopeContext;
|
|
||||||
import org.odlabs.wiquery.ui.core.JsScopeUiEvent;
|
|
||||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
|
||||||
import se.su.dsv.scipro.components.FormFeedbackPanel;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CategoryDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ResourceDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.TagDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Category;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Tag;
|
|
||||||
import se.su.dsv.scipro.data.enums.ResourceType;
|
|
||||||
import se.su.dsv.scipro.knol.resource.model.CategoryModel;
|
|
||||||
import se.su.dsv.scipro.knol.resource.model.ResourceModel;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|
||||||
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ResourcesPanel extends Panel {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private TagDao tagDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ResourceDao resourceDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private CategoryDao categoryDao;
|
|
||||||
|
|
||||||
private WebMarkupContainer linkDialogContainer, embedDialogContainer,
|
|
||||||
editCategoriesContainer, container, addCategoriesContainer;
|
|
||||||
private Dialog linkDialog, embedDialog, editCategoriesDialog,
|
|
||||||
addCategoriesDialog;
|
|
||||||
|
|
||||||
private TextField<String> linkNameEmbed;
|
|
||||||
private ResourceListPanel resourceListPanel;
|
|
||||||
|
|
||||||
public ResourcesPanel(String id) {
|
|
||||||
super(id);
|
|
||||||
container = new WebMarkupContainer("container");
|
|
||||||
container.setOutputMarkupId(true);
|
|
||||||
container
|
|
||||||
.add(resourceListPanel = new ResourceListPanel(
|
|
||||||
"resourceListPanel", resourceDao.findAll(),
|
|
||||||
ResourceType.NORMAL));
|
|
||||||
add(container);
|
|
||||||
resourceListPanel.setOutputMarkupId(true);
|
|
||||||
linkDialogContainer = new WebMarkupContainer("dialogContainer");
|
|
||||||
linkDialog = new Dialog("dialog");
|
|
||||||
linkDialog.setModal(true);
|
|
||||||
linkDialog.setAutoOpen(false);
|
|
||||||
linkDialog.setWidth(470);
|
|
||||||
linkDialog.add(linkDialogContainer);
|
|
||||||
add(linkDialog);
|
|
||||||
linkDialogContainer.setOutputMarkupId(true);
|
|
||||||
linkDialogContainer.add(new AddLinkResourceForm("resourceForm"));
|
|
||||||
|
|
||||||
embedDialogContainer = new WebMarkupContainer("embedDialogContainer");
|
|
||||||
embedDialog = new Dialog("embedDialog");
|
|
||||||
embedDialog.setModal(true);
|
|
||||||
embedDialog.setAutoOpen(false);
|
|
||||||
embedDialog.setWidth(470);
|
|
||||||
embedDialog.add(embedDialogContainer);
|
|
||||||
add(embedDialog);
|
|
||||||
embedDialogContainer.setOutputMarkupId(true);
|
|
||||||
embedDialogContainer.add(new AddEmbedResourceForm("embedResourceForm"));
|
|
||||||
|
|
||||||
editCategoriesContainer = new WebMarkupContainer(
|
|
||||||
"adminCategoriesContainer");
|
|
||||||
editCategoriesDialog = new Dialog("adminCategoriesDialog");
|
|
||||||
editCategoriesDialog.setModal(true);
|
|
||||||
editCategoriesDialog.setAutoOpen(false);
|
|
||||||
editCategoriesDialog.setWidth(470);
|
|
||||||
// editCategoriesDialog.setHeight(340);
|
|
||||||
editCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void execute(JsScopeContext scopeContext) {
|
|
||||||
scopeContext.append("window.location.reload()");
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
editCategoriesDialog.add(editCategoriesContainer);
|
|
||||||
add(editCategoriesDialog);
|
|
||||||
editCategoriesContainer.setOutputMarkupId(true);
|
|
||||||
editCategoriesContainer.add(new EditCategoriesForm(
|
|
||||||
"adminCategoriesForm"));
|
|
||||||
|
|
||||||
addCategoriesContainer = new WebMarkupContainer(
|
|
||||||
"addCategoriesContainer");
|
|
||||||
addCategoriesDialog = new Dialog("addCategoriesDialog");
|
|
||||||
addCategoriesDialog.setModal(true);
|
|
||||||
addCategoriesDialog.setAutoOpen(false);
|
|
||||||
addCategoriesDialog.setWidth(470);
|
|
||||||
// addCategoriesDialog.setHeight(340);
|
|
||||||
addCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void execute(JsScopeContext scopeContext) {
|
|
||||||
scopeContext.append("window.location.reload()");
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
addCategoriesDialog.add(addCategoriesContainer);
|
|
||||||
add(addCategoriesDialog);
|
|
||||||
addCategoriesContainer.setOutputMarkupId(true);
|
|
||||||
addCategoriesContainer.add(new AddCategoriesForm("addCategoriesForm"));
|
|
||||||
|
|
||||||
add(new AjaxLink<String>("addLinkResource", new Model<String>(
|
|
||||||
"Add Link Resource")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
target.addComponent(linkDialog);
|
|
||||||
linkDialog.open(target);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
add(new AjaxLink<String>("addEmbedResource", new Model<String>(
|
|
||||||
"Add Link Resource")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
target.addComponent(embedDialog);
|
|
||||||
embedDialog.open(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVisible(){
|
|
||||||
return false; //TODO Made invisible for initial deployment because it allows dangerous code to be pasted
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AjaxLink<String> editCategories, addCategories;
|
|
||||||
add(editCategories = new AjaxLink<String>("adminCategories") {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
target.addComponent(editCategoriesDialog);
|
|
||||||
editCategoriesDialog.open(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
add(addCategories = new AjaxLink<String>("addCategories") {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
target.addComponent(addCategoriesDialog);
|
|
||||||
addCategoriesDialog.open(target);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
MetaDataActionStrategy.authorize(editCategories, Roles.ADMIN, true);
|
|
||||||
MetaDataActionStrategy.authorize(addCategories, Roles.ADMIN, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AddLinkResourceForm extends Form<ResourceModel> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AddLinkResourceForm(String name) {
|
|
||||||
super(name, new CompoundPropertyModel<ResourceModel>(
|
|
||||||
new ResourceModel()));
|
|
||||||
final WebMarkupContainer feedbackContainer = new WebMarkupContainer(
|
|
||||||
"feedbackContainer");
|
|
||||||
feedbackContainer.setOutputMarkupId(true);
|
|
||||||
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<ResourceModel>(
|
|
||||||
"feedbackPanel", this);
|
|
||||||
feedbackContainer.add(feedbackPanel);
|
|
||||||
add(feedbackContainer);
|
|
||||||
linkDialog.setTitle("Add Link Resource");
|
|
||||||
|
|
||||||
final TextArea<String> info;
|
|
||||||
final TextField<String> linkName;
|
|
||||||
UrlValidator urlValidator = new UrlValidator();
|
|
||||||
final TextField<String> linkAddress = new TextField<String>("link");
|
|
||||||
linkAddress.add(urlValidator);
|
|
||||||
final TextField<String> tags = new TextField<String>("tags");
|
|
||||||
tags.setRequired(true);
|
|
||||||
linkAddress.setRequired(true);
|
|
||||||
|
|
||||||
add(linkName = new TextField<String>("linkName"));
|
|
||||||
add(linkAddress);
|
|
||||||
add(info = new TextArea<String>("info"));
|
|
||||||
info.setRequired(true);
|
|
||||||
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
// Implement dispay here
|
|
||||||
public Object getDisplayValue(Category category) {
|
|
||||||
return category.getCategoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdValue(Category category, int arg1) {
|
|
||||||
return category.getId().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
final ListMultipleChoice<Category> categorySelectList = new ListMultipleChoice<Category>(
|
|
||||||
"selectedCategoryCollection", new ListModel<Category>(
|
|
||||||
categoryDao.findAll()), choiceRenderer) {
|
|
||||||
private static final long serialVersionUID = -7117603450416845711L;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
categorySelectList.setRequired(true);
|
|
||||||
categorySelectList.setOutputMarkupId(true);
|
|
||||||
add(categorySelectList);
|
|
||||||
|
|
||||||
add(tags);
|
|
||||||
|
|
||||||
linkName.setRequired(true);
|
|
||||||
add(new AjaxButton("submitButton", new Model<String>(
|
|
||||||
"Save Resource")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
Resource link = new Resource();
|
|
||||||
ResourceModel resourceModel = ((ResourceModel) form
|
|
||||||
.getModelObject());
|
|
||||||
|
|
||||||
String tags = resourceModel.getTags();
|
|
||||||
|
|
||||||
List<Tag> tagList = new ArrayList<Tag>();
|
|
||||||
if (tags != null) {
|
|
||||||
StringTokenizer stringTokenizer = new StringTokenizer(
|
|
||||||
tags, ",");
|
|
||||||
|
|
||||||
while (stringTokenizer.hasMoreTokens()) {
|
|
||||||
String tagString = stringTokenizer.nextToken()
|
|
||||||
.trim();
|
|
||||||
if (null != tagDao.findExactTagQuery(tagString)) {
|
|
||||||
tagList.add(tagDao.findExactTagQuery(tagString));
|
|
||||||
} else if (!tagString.equals("")) {
|
|
||||||
Tag tag = new Tag();
|
|
||||||
tagString = tagString.toLowerCase();
|
|
||||||
tag.setTag(tagString);
|
|
||||||
|
|
||||||
tag = tagDao.save(tag);
|
|
||||||
tagList.add(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
link.setCategoryList(new ArrayList<Category>(resourceModel
|
|
||||||
.getSelectedCategoryCollection()));
|
|
||||||
link.setInfo(resourceModel.getInfo());
|
|
||||||
link.setLink(resourceModel.getLink());
|
|
||||||
link.setCreator(SciProSession.get().getUser());
|
|
||||||
link.setTagList(tagList);
|
|
||||||
if (resourceModel.getLinkName() != null) {
|
|
||||||
link.setHeading(resourceModel.getLinkName());
|
|
||||||
}
|
|
||||||
resourceDao.save(link);
|
|
||||||
resourceModel.setLink("");
|
|
||||||
resourceModel.setLinkName("");
|
|
||||||
resourceModel.setTags("");
|
|
||||||
resourceModel.setInfo("");
|
|
||||||
linkDialog.close(target);
|
|
||||||
setResponsePage(ResourcePage.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target,
|
|
||||||
final Form<?> form) {
|
|
||||||
target.addComponent(feedbackContainer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AddEmbedResourceForm extends Form<ResourceModel> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AddEmbedResourceForm(String name) {
|
|
||||||
super(name, new CompoundPropertyModel<ResourceModel>(
|
|
||||||
new ResourceModel()));
|
|
||||||
final WebMarkupContainer feedbackContainer = new WebMarkupContainer(
|
|
||||||
"feedbackContainer");
|
|
||||||
feedbackContainer.setOutputMarkupId(true);
|
|
||||||
|
|
||||||
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<ResourceModel>(
|
|
||||||
"feedbackPanel", this);
|
|
||||||
feedbackContainer.add(feedbackPanel);
|
|
||||||
add(feedbackContainer);
|
|
||||||
|
|
||||||
embedDialog.setTitle("Add Embed Resource");
|
|
||||||
add(linkNameEmbed = new TextField<String>("linkName"));
|
|
||||||
linkNameEmbed.setRequired(true);
|
|
||||||
final TextArea<String> embedTextArea;
|
|
||||||
add(embedTextArea = new TextArea<String>("embedCode"));
|
|
||||||
embedTextArea.setRequired(true);
|
|
||||||
final TextArea<String> info;
|
|
||||||
add(info = new TextArea<String>("info"));
|
|
||||||
info.setRequired(true);
|
|
||||||
final TextField<String> tags = new TextField<String>("tags");
|
|
||||||
tags.setRequired(true);
|
|
||||||
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
// Implement dispay here
|
|
||||||
public Object getDisplayValue(Category category) {
|
|
||||||
return category.getCategoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdValue(Category category, int arg1) {
|
|
||||||
return category.getId().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
final ListMultipleChoice<Category> categorySelectList = new ListMultipleChoice<Category>(
|
|
||||||
"selectedCategoryCollection", new ListModel<Category>(
|
|
||||||
categoryDao.findAll()), choiceRenderer) {
|
|
||||||
private static final long serialVersionUID = -7117603450416845711L;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
categorySelectList.setRequired(true);
|
|
||||||
categorySelectList.setOutputMarkupId(true);
|
|
||||||
add(categorySelectList);
|
|
||||||
add(tags);
|
|
||||||
|
|
||||||
add(new AjaxButton("submitButton", new Model<String>(
|
|
||||||
"Save Resource")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
Resource link;
|
|
||||||
|
|
||||||
link = new Resource();
|
|
||||||
|
|
||||||
ResourceModel resourceModel = ((ResourceModel) form
|
|
||||||
.getModelObject());
|
|
||||||
|
|
||||||
String tags = resourceModel.getTags();
|
|
||||||
|
|
||||||
List<Tag> tagList = new ArrayList<Tag>();
|
|
||||||
if (tags != null) {
|
|
||||||
StringTokenizer stringTokenizer = new StringTokenizer(
|
|
||||||
tags, ",");
|
|
||||||
|
|
||||||
while (stringTokenizer.hasMoreTokens()) {
|
|
||||||
String tagString = stringTokenizer.nextToken()
|
|
||||||
.trim();
|
|
||||||
if (null != tagDao.findExactTagQuery(tagString)) {
|
|
||||||
tagList.add(tagDao.findExactTagQuery(tagString));
|
|
||||||
} else if (!tagString.equals("")) {
|
|
||||||
Tag tag = new Tag();
|
|
||||||
tagString = tagString.toLowerCase();
|
|
||||||
tag.setTag(tagString);
|
|
||||||
|
|
||||||
tag = tagDao.save(tag);
|
|
||||||
tagList.add(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
link.setHeading(resourceModel.getLinkName());
|
|
||||||
link.setEmbedCode(resourceModel.getEmbedCode());
|
|
||||||
link.setInfo(resourceModel.getInfo());
|
|
||||||
link.setCategoryList(new ArrayList<Category>(resourceModel
|
|
||||||
.getSelectedCategoryCollection()));
|
|
||||||
link.setCreator(SciProSession.get().getUser());
|
|
||||||
link.setTagList(tagList);
|
|
||||||
if (resourceModel.getLinkName() != null) {
|
|
||||||
link.setHeading(resourceModel.getLinkName());
|
|
||||||
}
|
|
||||||
resourceDao.save(link);
|
|
||||||
|
|
||||||
resourceModel.setLink("");
|
|
||||||
resourceModel.setLinkName("");
|
|
||||||
resourceModel.setTags("");
|
|
||||||
resourceModel.setInfo("");
|
|
||||||
embedDialog.close(target);
|
|
||||||
setResponsePage(ResourcePage.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target,
|
|
||||||
final Form<?> form) {
|
|
||||||
target.addComponent(feedbackContainer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class EditCategoriesForm extends Form<CategoryModel> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private Category category;
|
|
||||||
|
|
||||||
public EditCategoriesForm(String name) {
|
|
||||||
super(name, new CompoundPropertyModel<CategoryModel>(
|
|
||||||
new CategoryModel()));
|
|
||||||
final WebMarkupContainer feedbackContainer = new WebMarkupContainer(
|
|
||||||
"feedbackContainer");
|
|
||||||
feedbackContainer.setOutputMarkupId(true);
|
|
||||||
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<CategoryModel>(
|
|
||||||
"feedbackPanel", this);
|
|
||||||
feedbackContainer.add(feedbackPanel);
|
|
||||||
add(feedbackContainer);
|
|
||||||
|
|
||||||
editCategoriesDialog.setTitle("Edit Categories");
|
|
||||||
final TextField<String> categoryName = new TextField<String>(
|
|
||||||
"categoryName");
|
|
||||||
add(categoryName);
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
// Implement dispay here
|
|
||||||
public Object getDisplayValue(Category category) {
|
|
||||||
return category.getCategoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdValue(Category category, int arg1) {
|
|
||||||
return category.getId().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
|
|
||||||
"selectedCategory", new ListModel<Category>(
|
|
||||||
categoryDao.findAll()), choiceRenderer) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected CharSequence getDefaultChoice(Object selected) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
categorySelectList.setOutputMarkupId(true);
|
|
||||||
|
|
||||||
OnChangeAjaxBehavior userSelectBehaviour = new OnChangeAjaxBehavior() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 3412906970812300312L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onUpdate(AjaxRequestTarget target) {
|
|
||||||
category = categoryDao.reLoad(getModelObject()
|
|
||||||
.getCategory());
|
|
||||||
if (category != null) {
|
|
||||||
getModelObject().setCategoryName(
|
|
||||||
category.getCategoryName());
|
|
||||||
target.addComponent(editCategoriesContainer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
add(new AjaxButton("deleteCategory", new Model<String>(
|
|
||||||
"Delete Category")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
if (category != null) {
|
|
||||||
category = categoryDao.reLoad(category);
|
|
||||||
for (Resource resource : resourceDao
|
|
||||||
.findResourcesByCategory(category)) {
|
|
||||||
|
|
||||||
List<Category> categoryList = resource
|
|
||||||
.getCategoryList();
|
|
||||||
categoryList.remove(category);
|
|
||||||
resource.setCategoryList(categoryList);
|
|
||||||
resourceDao.save(resource);
|
|
||||||
}
|
|
||||||
categoryDao.delete(category);
|
|
||||||
|
|
||||||
categorySelectList.setChoices(categoryDao.findAll());
|
|
||||||
EditCategoriesForm.this.getModelObject()
|
|
||||||
.setCategoryName("");
|
|
||||||
target.addComponent(editCategoriesContainer);
|
|
||||||
info("Category deleted");
|
|
||||||
} else {
|
|
||||||
error("No category selected");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected IAjaxCallDecorator getAjaxCallDecorator() {
|
|
||||||
return new AjaxCallDecorator() {
|
|
||||||
private static final long serialVersionUID = 8989126586010432130L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.apache.wicket.ajax.calldecorator.AjaxCallDecorator
|
|
||||||
* #decorateScript(java.lang.CharSequence)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CharSequence decorateScript(CharSequence script) {
|
|
||||||
String ret = "if(!confirm('Do you really want to delete?')) return false; "
|
|
||||||
+ script;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target,
|
|
||||||
final Form<?> form) {
|
|
||||||
target.addComponent(feedbackContainer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
categorySelectList.add(userSelectBehaviour);
|
|
||||||
add(categorySelectList);
|
|
||||||
|
|
||||||
add(new AjaxButton("editButton", new Model<String>("Save Edit")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
if (category == null) {
|
|
||||||
error("No category selected");
|
|
||||||
} else if (EditCategoriesForm.this.getModelObject()
|
|
||||||
.getCategoryName() == null) {
|
|
||||||
error("Category must have a name");
|
|
||||||
} else if (categoryDao
|
|
||||||
.reLoad(category)
|
|
||||||
.getCategoryName()
|
|
||||||
.equals(EditCategoriesForm.this.getModelObject()
|
|
||||||
.getCategoryName())) {
|
|
||||||
error("No change");
|
|
||||||
} else {
|
|
||||||
category = categoryDao.reLoad(category);
|
|
||||||
category.setCategoryName(EditCategoriesForm.this
|
|
||||||
.getModelObject().getCategoryName());
|
|
||||||
categoryDao.save(category);
|
|
||||||
info("Category changed");
|
|
||||||
categorySelectList.setChoices(categoryDao.findAll());
|
|
||||||
target.addComponent(editCategoriesContainer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target,
|
|
||||||
final Form<?> form) {
|
|
||||||
target.addComponent(feedbackContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
add(new AjaxButton("closeButton", new Model<String>("Close")) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
editCategoriesDialog.close(target);
|
|
||||||
setResponsePage(ResourcePage.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target,
|
|
||||||
final Form<?> form) {
|
|
||||||
target.addComponent(feedbackContainer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AddCategoriesForm extends Form<CategoryModel> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AddCategoriesForm(String name) {
|
|
||||||
super(name, new CompoundPropertyModel<CategoryModel>(
|
|
||||||
new CategoryModel()));
|
|
||||||
final WebMarkupContainer feedbackContainer = new WebMarkupContainer(
|
|
||||||
"feedbackContainer");
|
|
||||||
feedbackContainer.setOutputMarkupId(true);
|
|
||||||
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<CategoryModel>(
|
|
||||||
"feedbackPanel", this);
|
|
||||||
feedbackContainer.add(feedbackPanel);
|
|
||||||
add(feedbackContainer);
|
|
||||||
|
|
||||||
addCategoriesDialog.setTitle("Add Categories");
|
|
||||||
final TextField<String> categoryName = new TextField<String>(
|
|
||||||
"categoryName");
|
|
||||||
add(categoryName);
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
// Implement dispay here
|
|
||||||
public Object getDisplayValue(Category category) {
|
|
||||||
return category.getCategoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdValue(Category category, int arg1) {
|
|
||||||
return category.getId().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
|
|
||||||
"selectedCategory", new ListModel<Category>(
|
|
||||||
categoryDao.findAll()), choiceRenderer) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected CharSequence getDefaultChoice(Object selected) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
categorySelectList.setOutputMarkupId(true);
|
|
||||||
|
|
||||||
add(categorySelectList);
|
|
||||||
|
|
||||||
add(new AjaxButton("addButton", new Model<String>("Add Category")) {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
CategoryModel categoryModel = (CategoryModel) form
|
|
||||||
.getModelObject();
|
|
||||||
|
|
||||||
if (categoryModel.getCategoryName() == null) {
|
|
||||||
error("Category must have a name");
|
|
||||||
} else {
|
|
||||||
Category category = categoryDao
|
|
||||||
.findExactCategoryQuery(categoryModel
|
|
||||||
.getCategoryName());
|
|
||||||
if (category == null) {
|
|
||||||
Category cat = new Category();
|
|
||||||
cat.setCategoryName(categoryModel.getCategoryName());
|
|
||||||
categoryDao.save(cat);
|
|
||||||
categorySelectList
|
|
||||||
.setChoices(categoryDao.findAll());
|
|
||||||
AddCategoriesForm.this.getModelObject()
|
|
||||||
.setCategoryName("");
|
|
||||||
target.addComponent(addCategoriesContainer);
|
|
||||||
info("Category added");
|
|
||||||
} else {
|
|
||||||
error("Category already exists");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target,
|
|
||||||
final Form<?> form) {
|
|
||||||
target.addComponent(feedbackContainer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
add(new AjaxButton("closeButton", new Model<String>("Close")) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
addCategoriesDialog.close(target);
|
|
||||||
setResponsePage(ResourcePage.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target,
|
|
||||||
final Form<?> form) {
|
|
||||||
target.addComponent(feedbackContainer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
dialog.dialogContainer.resourceForm.link=Link Address
|
|
||||||
dialog.dialogContainer.resourceForm.linkName=Link Name
|
|
||||||
dialog.dialogContainer.resourceForm.info=Info
|
|
||||||
dialog.dialogContainer.resourceForm.tags=Tags
|
|
||||||
dialog.dialogContainer.resourceForm.selectedCategoryCollection = Categories
|
|
||||||
embedDialog.embedDialogContainer.embedResourceForm.linkName=Heading
|
|
||||||
embedDialog.embedDialogContainer.embedResourceForm.embedCode=Embed Code
|
|
||||||
embedDialog.embedDialogContainer.embedResourceForm.info=Info
|
|
||||||
embedDialog.embedDialogContainer.embedResourceForm.tags=Tags
|
|
||||||
embedDialog.embedDialogContainer.embedResourceForm.selectedCategoryCollection=Categories
|
|
||||||
Required='${label}' is required
|
|
@ -1,86 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.facade;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.LogDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.LogEntryDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Log;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Service facade for logs and their log entries.
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class LogFacade {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LogDao logDao;
|
|
||||||
@Autowired
|
|
||||||
private LogEntryDao logEntryDao;
|
|
||||||
private final Logger logger = Logger.getLogger(LogFacade.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a log for the given project, if none exists it will be silently created and returned.
|
|
||||||
* If the project parameter is null, a wrapped UnsupportedOperationException is thrown.
|
|
||||||
* @param p
|
|
||||||
* @return The log.
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public Log retrieveLog(final Project p){
|
|
||||||
if(p == null)
|
|
||||||
throw new RenderingSafeException(new UnsupportedOperationException("Sorry, can't retrieve a log without a valid project"));
|
|
||||||
Log log = p.getLog();
|
|
||||||
if(log == null){
|
|
||||||
logger.debug("No existing log for project "+p+", creating a new one");
|
|
||||||
log = new Log(p);
|
|
||||||
log.updateTimeStamps();
|
|
||||||
log = logDao.save(log);
|
|
||||||
p.setLog(log);
|
|
||||||
}
|
|
||||||
return log;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new log entry and makes the needed object-state linking.
|
|
||||||
* If either parameter is null, a wrapped UnsupportedOperationException is thrown.
|
|
||||||
* @param log
|
|
||||||
* @param creator
|
|
||||||
* @param contents
|
|
||||||
* @return The newly created log entry.
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public LogEntry createNewLogEntry(final Log log, final User creator, String contents){
|
|
||||||
if (log == null || creator == null)
|
|
||||||
throw new RenderingSafeException(new UnsupportedOperationException("Sorry, can't create log entries without a valid log and creator"));
|
|
||||||
LogEntry le = new LogEntry(creator, contents, log);
|
|
||||||
// le.updateTimeStamps();
|
|
||||||
return( logEntryDao.save(le));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void deleteLogEntry(LogEntry logEntry){
|
|
||||||
logEntry = logEntryDao.reLoad(logEntry);
|
|
||||||
logEntry.setDeleted(true);
|
|
||||||
logEntryDao.save(logEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Queries for all the log entries in a log
|
|
||||||
* @param log
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
public List<LogEntry> retrieveLogEntries(final Log log){
|
|
||||||
// return log.getLogEntryList();
|
|
||||||
return logEntryDao.findAllNonDeletedByLog(log);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html
|
|
||||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<wicket:remove>
|
|
||||||
<link rel="stylesheet" type="text/css" href="../../../../../../webapp/css/scipro.css"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="../../../../../../webapp/css/blueprint/screen.css"/>
|
|
||||||
</wicket:remove>
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
<div wicket:id="logPanel"></div>
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,52 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.pages;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
|
||||||
import se.su.dsv.scipro.log.panels.LogPanel;
|
|
||||||
import se.su.dsv.scipro.project.pages.ProjectPage;
|
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
@Authorization(authorizedRoles={Roles.STUDENT})
|
|
||||||
public class ProjectLogPage extends ProjectPage{
|
|
||||||
|
|
||||||
// @SpringBean
|
|
||||||
// private LogDao logDao;
|
|
||||||
// @SpringBean
|
|
||||||
// private LogEntryDao logEntryDao;
|
|
||||||
|
|
||||||
public ProjectLogPage(PageParameters pp) {
|
|
||||||
|
|
||||||
super(pp);
|
|
||||||
if(getActiveProject() == null || getUser() == null)
|
|
||||||
throw new RenderingSafeException(new IllegalStateException("No valid project or user"));
|
|
||||||
add(new LogPanel("logPanel",getActiveProject(),getUser()));
|
|
||||||
|
|
||||||
// /*
|
|
||||||
// * Ladda log och logEntries
|
|
||||||
// */
|
|
||||||
// super(pp);
|
|
||||||
//
|
|
||||||
// Project project = SciProSession.get().getActiveProject();
|
|
||||||
//
|
|
||||||
// Log log = null;
|
|
||||||
// if (project.getLog()==null){
|
|
||||||
// //Om projektet ännu inte har en logg måste en skapas och sparas.
|
|
||||||
// log = new Log(project);
|
|
||||||
// log = logDao.save(log);
|
|
||||||
// }else{
|
|
||||||
// log = project.getLog();
|
|
||||||
// }//annars tar vi projektets redan existerande logg
|
|
||||||
//
|
|
||||||
// List<LogEntry> logEntryList = logEntryDao.findAllNonDeletedByLog(log); //denna metod hämtar denna logs ickedeletade inlägg
|
|
||||||
//
|
|
||||||
// WriteLogEntryPanel wlep = new WriteLogEntryPanel("wlep", logEntryList);
|
|
||||||
// add(wlep);
|
|
||||||
// LogEntriesPanel lep = new LogEntriesPanel("lep", logEntryList, true);
|
|
||||||
// add(lep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html
|
|
||||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<wicket:remove>
|
|
||||||
<link rel="stylesheet" type="text/css"
|
|
||||||
href="../../../../../../webapp/css/scipro.css" />
|
|
||||||
<link rel="stylesheet" type="text/css"
|
|
||||||
href="../../../../../../webapp/css/blueprint/screen.css" />
|
|
||||||
</wicket:remove>
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
<div wicket:id="logPanel"></div>
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,60 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.pages;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
|
||||||
import se.su.dsv.scipro.activityplan.panels.SupervisorActivityPlanPanel;
|
|
||||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorMyProjects;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.LogEntryDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
|
||||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
|
||||||
import se.su.dsv.scipro.log.panels.LogPanel;
|
|
||||||
import se.su.dsv.scipro.log.panels.SupervisorLogPanel;
|
|
||||||
import se.su.dsv.scipro.project.panels.LogEntriesPanel;
|
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorProjectDetailsPage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author fred-fri@dsv.su.se
|
|
||||||
*
|
|
||||||
* Displays log entries to the supervisor.
|
|
||||||
*/
|
|
||||||
@Authorization(authorizedRoles={Roles.EMPLOYEE})
|
|
||||||
public class SupervisorLogPage extends AbstractSupervisorProjectDetailsPage implements MenuHighlightSupervisorMyProjects {
|
|
||||||
|
|
||||||
// @SpringBean
|
|
||||||
// private LogEntryDao logEntryDao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. If the project or log is null
|
|
||||||
* the constructor handles it and displays the
|
|
||||||
* appropriate error message to the user.
|
|
||||||
* @param pp
|
|
||||||
*/
|
|
||||||
public SupervisorLogPage(PageParameters pp) {
|
|
||||||
super(pp);
|
|
||||||
|
|
||||||
if(projectModel.getObject() == null)
|
|
||||||
throw new RenderingSafeException(new IllegalStateException("No valid project or user"));
|
|
||||||
// add(new LogPanel("logPanel", projectModel.getObject(),SciProSession.get().getUser()));
|
|
||||||
add(new SupervisorLogPanel("logPanel", projectModel.getObject(),SciProSession.get().getUser()));
|
|
||||||
|
|
||||||
// final Label noLogLabel = new Label("lep", "No log entries yet.");
|
|
||||||
// final Label noProjectLabel = new Label("lep", "No project selected.");
|
|
||||||
// final List<LogEntry> logEntryList = logEntryDao.findAllNonDeletedByLog(projectModel.getObject().getLog());
|
|
||||||
// final LogEntriesPanel lep = new LogEntriesPanel("lep", logEntryList, false);
|
|
||||||
// if (projectModel.getObject()==null){
|
|
||||||
// add(noProjectLabel);
|
|
||||||
// } else if (projectModel.getObject().getLog()==null || logEntryList.size() == 0){
|
|
||||||
// add(noLogLabel);
|
|
||||||
// } else {
|
|
||||||
// add(lep);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html
|
|
||||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
<div class="span-22" wicket:id="formContainer">
|
|
||||||
<div class="span-10">
|
|
||||||
<form wicket:id="logEntryForm">
|
|
||||||
<div>
|
|
||||||
<textarea wicket:id="contents">This is a comment</textarea>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<!-- <input type="submit" value="Submit" id="formsubmit" /> -->
|
|
||||||
<input wicket:id="saveButton" type="submit" value="Post note" class="append-bottom"/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="span-10 last">
|
|
||||||
<div class="append-bottom"></div>
|
|
||||||
<div class="info-box rounded-box last">
|
|
||||||
<p>What is this?</p>
|
|
||||||
<div>
|
|
||||||
Use notes to jot down stuff related to the project, or anything really. <b>Remember!</b> The notes are <b>NOT</b> private! Admins and all the people included in the project, such as other students, supervisors, reviewers etc can read them too.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div wicket:id="logEntryListContainer" class="span-22">
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr wicket:id="logEntryDataView">
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<div class="rounded-box">
|
|
||||||
<div class="box-title rounded">
|
|
||||||
<span wicket:id="creator">1/1/2004</span> <span> on </span> <span
|
|
||||||
wicket:id="dateCreated">1/1/2004</span>
|
|
||||||
<!-- <span><img wicket:id="deleteIcon" class="right-corner-resource" /> </span> -->
|
|
||||||
<span><a href="#" class="right-corner-resource"
|
|
||||||
wicket:id="deleteLink"> <img class="round-box-icon"
|
|
||||||
wicket:id="deleteIcon" alt="Delete" title="Delete" />
|
|
||||||
</a></span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span wicket:id="contents">Comment text goes here.</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div wicket:id="emptyLabel"></div>
|
|
||||||
<div wicket:id="navigator"></div>
|
|
||||||
</div>
|
|
||||||
<wicket:child />
|
|
||||||
</wicket:panel>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,172 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.panels;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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.navigation.paging.PagingNavigator;
|
|
||||||
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.markup.repeater.data.ListDataProvider;
|
|
||||||
import org.apache.wicket.model.PropertyModel;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.DomainObject;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
import se.su.dsv.scipro.icons.ImageObject;
|
|
||||||
import se.su.dsv.scipro.log.facade.LogFacade;
|
|
||||||
import se.su.dsv.scipro.util.DateFormatter;
|
|
||||||
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generic panel with artifacts for entering and viewing log entries. Uses facade helper.
|
|
||||||
* Has a boolean method (isAuthor) that controls whether entering new entries is allowed
|
|
||||||
* (or rather, whether the artifacts for making new entries are visible). In this class
|
|
||||||
* it is set to true. For supervisors, use the extended version of this class in which
|
|
||||||
* that boolean method is overridden and set to false.
|
|
||||||
*
|
|
||||||
* @author fred
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LogPanel extends Panel{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private LogFacade logFacade; //facade class takes care of persistence etc
|
|
||||||
|
|
||||||
private Project project;
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
private List<LogEntry> logEntryList; //list with the logs log entries
|
|
||||||
private WebMarkupContainer logEntryListContainer; //container for the entries
|
|
||||||
|
|
||||||
private Label emptyLabel;
|
|
||||||
private PagingNavigator pagingNavigator;
|
|
||||||
|
|
||||||
//here comes the methods to be overriden by subclasses
|
|
||||||
protected boolean isAuthor() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LogPanel(final String id, final Project project, final User user) {
|
|
||||||
super(id);
|
|
||||||
this.project = project;
|
|
||||||
this.user = user;
|
|
||||||
|
|
||||||
dataViewInit();
|
|
||||||
formInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void formInit(){
|
|
||||||
WebMarkupContainer formContainer = new WebMarkupContainer("formContainer"); //container for the form
|
|
||||||
add(formContainer);
|
|
||||||
// formContainer.add(new LogEntryForm("logEntryForm"));
|
|
||||||
formContainer.add(new CommentForm("logEntryForm"));
|
|
||||||
formContainer.setVisible(isAuthor()); //only visible to authors
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dataViewInit(){
|
|
||||||
logEntryList = logFacade.retrieveLogEntries(logFacade.retrieveLog(project));//set the list to... the list!
|
|
||||||
Collections.sort(logEntryList); //sort the list
|
|
||||||
|
|
||||||
logEntryListContainer = new WebMarkupContainer("logEntryListContainer"); //instantiate the container
|
|
||||||
logEntryListContainer.setOutputMarkupId(true); //make it ajax targetable
|
|
||||||
|
|
||||||
DataView<LogEntry> dataView = new DataView<LogEntry>("logEntryDataView", new ListDataProvider<LogEntry>(logEntryList)) { //dataview using the list
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateItem(final Item<LogEntry> item) {
|
|
||||||
final LogEntry logEntry = item.getModelObject();
|
|
||||||
|
|
||||||
item.add(new Label("contents", logEntry.getContents())); //show contents
|
|
||||||
item.add(new Label("creator", logEntry.getCreator().toString()));//show creator/author
|
|
||||||
item.add(new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedDateLabel("dateCreated",((DomainObject) item.getModelObject()).getDateCreated()));//and date created
|
|
||||||
|
|
||||||
AjaxLink<Void> deleteLink = new AjaxLink<Void>("deleteLink"){ //deletelink
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
logFacade.deleteLogEntry(logEntry); //set lazy deleted
|
|
||||||
logEntryList.remove(logEntry); //remove it from the list that the dataview uses
|
|
||||||
target.addComponent(logEntryListContainer); //target the container containing the dataview
|
|
||||||
|
|
||||||
emptyLabel.setVisible(logEntryList.isEmpty());
|
|
||||||
target.addComponent(emptyLabel);
|
|
||||||
pagingNavigator.setVisible(!logEntryList.isEmpty());
|
|
||||||
target.addComponent(pagingNavigator);
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean isVisible(){
|
|
||||||
return (user.equals(logEntry.getCreator()));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
deleteLink.add(new JavascriptEventConfirmation("onclick", "Are you sure you want to delete this note?"));
|
|
||||||
deleteLink.add(new ImageObject("deleteIcon", ImageObject.TWENTYFOUR + ImageObject.DELETE));
|
|
||||||
item.add(deleteLink);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
dataView.setItemsPerPage(10);
|
|
||||||
logEntryListContainer.add(dataView);
|
|
||||||
pagingNavigator = new PagingNavigator("navigator", dataView);
|
|
||||||
pagingNavigator.setVisible(!logEntryList.isEmpty());
|
|
||||||
pagingNavigator.setOutputMarkupId(true);
|
|
||||||
logEntryListContainer.add(pagingNavigator);
|
|
||||||
|
|
||||||
add(logEntryListContainer);
|
|
||||||
|
|
||||||
emptyLabel = new Label("emptyLabel", "No notes to show.");
|
|
||||||
emptyLabel.setVisible(logEntryList.isEmpty());
|
|
||||||
emptyLabel.setOutputMarkupId(true);
|
|
||||||
logEntryListContainer.add(emptyLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CommentForm extends Form{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private transient String text; //no need to serialize this
|
|
||||||
|
|
||||||
public CommentForm(String id) {
|
|
||||||
super(id);
|
|
||||||
|
|
||||||
final TextArea<String> contents = new TextArea<String>("contents", new PropertyModel<String>(CommentForm.this, "text")); //textArea for user to enter the log entry
|
|
||||||
// contents.setType(String.class); this is the default
|
|
||||||
contents.setOutputMarkupId(true);
|
|
||||||
add(contents);
|
|
||||||
|
|
||||||
add(new AjaxButton("saveButton") {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
LogEntry le = logFacade.createNewLogEntry(logFacade.retrieveLog(project), user, text); //create the entry
|
|
||||||
logEntryList.add(le); //add the new entry to the local list that the dataview uses
|
|
||||||
Collections.sort(logEntryList); //sort the list
|
|
||||||
|
|
||||||
contents.clearInput(); //clear the text area
|
|
||||||
contents.setModelObject(null); //make sure it "knows" the model has been changed
|
|
||||||
|
|
||||||
//ajax stuff
|
|
||||||
target.addComponent(logEntryListContainer);
|
|
||||||
target.addComponent(contents);
|
|
||||||
|
|
||||||
emptyLabel.setVisible(logEntryList.isEmpty());
|
|
||||||
target.addComponent(emptyLabel);
|
|
||||||
pagingNavigator.setVisible(!logEntryList.isEmpty());
|
|
||||||
target.addComponent(pagingNavigator);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
<wicket:extend>
|
|
||||||
</wicket:extend>
|
|
||||||
</wicket:panel>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.panels;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
|
|
||||||
public class SupervisorLogPanel extends LogPanel{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public SupervisorLogPanel(String id, Project project, User user) {
|
|
||||||
super(id, project, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isAuthor() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -39,8 +39,8 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
|
|||||||
matchProjectIdeas(unmatchedProjectIdeas, supervisorAvailability, pairList);
|
matchProjectIdeas(unmatchedProjectIdeas, supervisorAvailability, pairList);
|
||||||
|
|
||||||
if(!pairList.isEmpty()) {
|
if(!pairList.isEmpty()) {
|
||||||
Collections.sort(pairList);
|
|
||||||
calculateTotalAvailability(pairList);
|
calculateTotalAvailability(pairList);
|
||||||
|
Collections.sort(pairList);
|
||||||
Pair foundPair = pairList.get(0);
|
Pair foundPair = pairList.get(0);
|
||||||
for(Availability availability : supervisorAvailability) {
|
for(Availability availability : supervisorAvailability) {
|
||||||
if(availability.getSupervisor().equals(foundPair.getMatch().getSupervisor()) &&
|
if(availability.getSupervisor().equals(foundPair.getMatch().getSupervisor()) &&
|
||||||
@ -98,7 +98,7 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the best match, the old one or the new one with supervisor
|
* Return a new Pair with a calculated score
|
||||||
* @param projectIdea projectIdea
|
* @param projectIdea projectIdea
|
||||||
* @param availability the availability
|
* @param availability the availability
|
||||||
* @return Pair
|
* @return Pair
|
||||||
@ -207,7 +207,6 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
|
|||||||
* is added to Availability#getAvailability (int) for bachelor for each supervisor, this total availability is considered when
|
* is added to Availability#getAvailability (int) for bachelor for each supervisor, this total availability is considered when
|
||||||
* matching project ideas to supervisors
|
* matching project ideas to supervisors
|
||||||
* @param pairList all the matches that is produced, represented as instances of the class Pair
|
* @param pairList all the matches that is produced, represented as instances of the class Pair
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private void calculateTotalAvailability(List<Pair> pairList) {
|
private void calculateTotalAvailability(List<Pair> pairList) {
|
||||||
for(Pair ourMatch : pairList) {
|
for(Pair ourMatch : pairList) {
|
||||||
|
@ -94,9 +94,9 @@ public class KeywordDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Keyword> imple
|
|||||||
public List<Keyword> doInJpa(EntityManager em) throws PersistenceException {
|
public List<Keyword> doInJpa(EntityManager em) throws PersistenceException {
|
||||||
TypedQuery<Keyword> query;
|
TypedQuery<Keyword> query;
|
||||||
if(includeLazyDeleted)
|
if(includeLazyDeleted)
|
||||||
query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type", domainClass);
|
query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type ORDER BY keyword", domainClass);
|
||||||
else
|
else
|
||||||
query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type AND x.deleted = false", domainClass);
|
query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type AND x.deleted = false ORDER BY keyword", domainClass);
|
||||||
query.setParameter("type", keywordType);
|
query.setParameter("type", keywordType);
|
||||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
|
@ -79,7 +79,7 @@ public class MatchDaoJPAImp extends AbstractDaoJPAImp<Match> implements
|
|||||||
match = super.save(match);
|
match = super.save(match);
|
||||||
ProjectIdea projectIdea = match.getProjectIdea();
|
ProjectIdea projectIdea = match.getProjectIdea();
|
||||||
projectIdea.addMatch(match);
|
projectIdea.addMatch(match);
|
||||||
projectIdeaDao.save(projectIdea);
|
projectIdea = projectIdeaDao.save(projectIdea);
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ public class PrivateMessagesPanel extends Panel {
|
|||||||
Recipient rec2 = recipientDao.reLoad(item.getModelObject());
|
Recipient rec2 = recipientDao.reLoad(item.getModelObject());
|
||||||
if (rec2.getDateRead() == null) {
|
if (rec2.getDateRead() == null) {
|
||||||
rec2.setDateRead(GregorianCalendar.getInstance().getTime());
|
rec2.setDateRead(GregorianCalendar.getInstance().getTime());
|
||||||
recipientDao.save(rec2);
|
rec2 = recipientDao.save(rec2);
|
||||||
}
|
}
|
||||||
|
|
||||||
messageContainer = new WebMarkupContainer("messageContainer");
|
messageContainer = new WebMarkupContainer("messageContainer");
|
||||||
|
@ -84,7 +84,7 @@ public class PrivateMessagesWidget extends Panel {
|
|||||||
recipient = recipientDao.reLoad(item.getModelObject());
|
recipient = recipientDao.reLoad(item.getModelObject());
|
||||||
if (recipient.getDateRead() == null) {
|
if (recipient.getDateRead() == null) {
|
||||||
recipient.setDateRead(GregorianCalendar.getInstance().getTime());
|
recipient.setDateRead(GregorianCalendar.getInstance().getTime());
|
||||||
recipientDao.save(recipient);
|
recipient = recipientDao.save(recipient);
|
||||||
}
|
}
|
||||||
|
|
||||||
messageContainer = new WebMarkupContainer("messageContainer");
|
messageContainer = new WebMarkupContainer("messageContainer");
|
||||||
|
@ -384,7 +384,7 @@ public class EditFinalSeminarFormPanel extends Panel {
|
|||||||
.getActiveParticipations();
|
.getActiveParticipations();
|
||||||
if (!allList.contains(al) && !al.isPreDeleted()) {
|
if (!allList.contains(al) && !al.isPreDeleted()) {
|
||||||
al.setFinalSeminar(editSeminar);
|
al.setFinalSeminar(editSeminar);
|
||||||
finalSeminarActiveParticipationDao.save(al);
|
al = finalSeminarActiveParticipationDao.save(al);
|
||||||
|
|
||||||
} else if (al.isPreDeleted() && allList.contains(al)) {
|
} else if (al.isPreDeleted() && allList.contains(al)) {
|
||||||
finalSeminarActiveParticipationDao
|
finalSeminarActiveParticipationDao
|
||||||
|
@ -7,11 +7,12 @@ import org.apache.wicket.markup.html.list.ListItem;
|
|||||||
import org.apache.wicket.markup.html.list.ListView;
|
import org.apache.wicket.markup.html.list.ListView;
|
||||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
import org.apache.wicket.markup.html.panel.Panel;
|
||||||
|
import org.apache.wicket.model.Model;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
|
|
||||||
public class ProjectFinalSeminarContainerPanel extends Panel {
|
public class ProjectFinalSeminarContainerPanel extends Panel {
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ public class ProjectFinalSeminarContainerPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(ListItem<FinalSeminar> item) {
|
protected void populateItem(ListItem<FinalSeminar> item) {
|
||||||
item.add(new ProjectFinalSeminarPanel("seminarPanel", item.getModelObject(), isSupervisorView));
|
item.add(new ProjectFinalSeminarPanel("seminarPanel", new Model<FinalSeminar>(item.getModelObject()), isSupervisorView));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -46,7 +46,11 @@ import se.su.dsv.scipro.repository.FileRepository;
|
|||||||
import se.su.dsv.scipro.repository.SortOrder;
|
import se.su.dsv.scipro.repository.SortOrder;
|
||||||
import se.su.dsv.scipro.repository.components.FileDownloadLink;
|
import se.su.dsv.scipro.repository.components.FileDownloadLink;
|
||||||
import se.su.dsv.scipro.repository.components.FileOpenLink;
|
import se.su.dsv.scipro.repository.components.FileOpenLink;
|
||||||
import se.su.dsv.scipro.util.*;
|
import se.su.dsv.scipro.util.CollectionFilterUtil;
|
||||||
|
import se.su.dsv.scipro.util.DateFormatter;
|
||||||
|
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
||||||
|
import se.su.dsv.scipro.util.Predicate;
|
||||||
|
import se.su.dsv.scipro.util.TurnitinComponent;
|
||||||
|
|
||||||
public class ProjectFinalSeminarPanel extends Panel {
|
public class ProjectFinalSeminarPanel extends Panel {
|
||||||
|
|
||||||
@ -70,14 +74,14 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
private Dialog editSeminarDialog;
|
private Dialog editSeminarDialog;
|
||||||
private EditSeminarForm editSeminarForm;
|
private EditSeminarForm editSeminarForm;
|
||||||
|
|
||||||
public ProjectFinalSeminarPanel(final String id, final FinalSeminar seminar,
|
public ProjectFinalSeminarPanel(final String id, final Model<FinalSeminar> seminarModel,
|
||||||
final boolean isSupervisorView) {
|
final boolean isSupervisorView) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|
||||||
setVersioned(false);
|
setVersioned(false);
|
||||||
|
|
||||||
EditForm editForm;
|
EditForm editForm;
|
||||||
add(editForm = new EditForm("editForm", seminar));
|
add(editForm = new EditForm("editForm", seminarModel));
|
||||||
|
|
||||||
editSeminarDialogContainer = new WebMarkupContainer("dialogContainer");
|
editSeminarDialogContainer = new WebMarkupContainer("dialogContainer");
|
||||||
editSeminarDialog = new Dialog("dialog");
|
editSeminarDialog = new Dialog("dialog");
|
||||||
@ -89,10 +93,10 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
editSeminarDialogContainer.setOutputMarkupId(true);
|
editSeminarDialogContainer.setOutputMarkupId(true);
|
||||||
editSeminarDialogContainer.add(editSeminarForm = new EditSeminarForm("editSeminarForm"));
|
editSeminarDialogContainer.add(editSeminarForm = new EditSeminarForm("editSeminarForm"));
|
||||||
editSeminarForm.setOutputMarkupId(true);
|
editSeminarForm.setOutputMarkupId(true);
|
||||||
add(new Label("seminarLocation", seminar.getRoom()));
|
add(new Label("seminarLocation", seminarModel.getObject().getRoom()));
|
||||||
add(new Label("projectClass", seminar.getProject().getProjectClass().getName()));
|
add(new Label("projectClass", seminarModel.getObject().getProject().getProjectClass().getName()));
|
||||||
add(new Label("seminarLanguage", seminar.getPresentationLanguage().toString()));
|
add(new Label("seminarLanguage", seminarModel.getObject().getPresentationLanguage().toString()));
|
||||||
add(new Label("thesisLanguage", seminar.getReportLanguage().toString()));
|
add(new Label("thesisLanguage", seminarModel.getObject().getReportLanguage().toString()));
|
||||||
|
|
||||||
if (!isSupervisorView) {
|
if (!isSupervisorView) {
|
||||||
editForm.setVisible(false);
|
editForm.setVisible(false);
|
||||||
@ -104,10 +108,10 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
.isFinalSeminarThesisMustBeAPDF() && !isSupervisorView);
|
.isFinalSeminarThesisMustBeAPDF() && !isSupervisorView);
|
||||||
add(pdfLabel);
|
add(pdfLabel);
|
||||||
int totalAttendees = 1;
|
int totalAttendees = 1;
|
||||||
totalAttendees += seminar.getActiveParticipations().size();
|
totalAttendees += seminarModel.getObject().getActiveParticipations().size();
|
||||||
totalAttendees += seminar.getProject().getProjectFollowers().size();
|
totalAttendees += seminarModel.getObject().getProject().getProjectFollowers().size();
|
||||||
totalAttendees += seminar.getProject().getProjectParticipants().size();
|
totalAttendees += seminarModel.getObject().getProject().getProjectParticipants().size();
|
||||||
totalAttendees += seminar.getOppositions().size();
|
totalAttendees += seminarModel.getObject().getOppositions().size();
|
||||||
|
|
||||||
final Dialog attendeesDialog = new Dialog("attendeesDialog");
|
final Dialog attendeesDialog = new Dialog("attendeesDialog");
|
||||||
attendeesDialog.setModal(true);
|
attendeesDialog.setModal(true);
|
||||||
@ -121,7 +125,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
attendeesDialog.add(attendeesDialogContainer);
|
attendeesDialog.add(attendeesDialogContainer);
|
||||||
add(attendeesDialog);
|
add(attendeesDialog);
|
||||||
|
|
||||||
add(new FinalSeminarDetailsPanel("finalSeminarDetailsPanel", seminar, false));
|
add(new FinalSeminarDetailsPanel("finalSeminarDetailsPanel", seminarModel.getObject(), false));
|
||||||
|
|
||||||
final AjaxLink<Void> totalAttendeesLink = new AjaxLink<Void>("totalAttendeesLink") {
|
final AjaxLink<Void> totalAttendeesLink = new AjaxLink<Void>("totalAttendeesLink") {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -129,7 +133,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
attendeesDialogContainer.replace(new FinalSeminarDetailsPanel(
|
attendeesDialogContainer.replace(new FinalSeminarDetailsPanel(
|
||||||
"attendeesDialogContent", seminar, false));
|
"attendeesDialogContent", seminarModel.getObject(), false));
|
||||||
target.addComponent(attendeesDialogContainer);
|
target.addComponent(attendeesDialogContainer);
|
||||||
attendeesDialog.open(target);
|
attendeesDialog.open(target);
|
||||||
}
|
}
|
||||||
@ -140,14 +144,14 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
add(new Label("totalAttendees", String.valueOf(totalAttendees)));
|
add(new Label("totalAttendees", String.valueOf(totalAttendees)));
|
||||||
|
|
||||||
add(new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedDateLabel("seminarDate", seminar.getStartDate()));
|
add(new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedDateLabel("seminarDate", seminarModel.getObject().getStartDate()));
|
||||||
|
|
||||||
add(new DateFormatter(DateFormatter.FORMAT.REDUCED).createFormattedDateLabel("seminarEndDate", seminar.getEndDate()));
|
add(new DateFormatter(DateFormatter.FORMAT.REDUCED).createFormattedDateLabel("seminarEndDate", seminarModel.getObject().getEndDate()));
|
||||||
/*
|
/*
|
||||||
* Deadline -7 days removed, deadline is now the start-date of the
|
* Deadline -7 days removed, deadline is now the start-date of the
|
||||||
* seminar
|
* seminar
|
||||||
*/
|
*/
|
||||||
finalSubmissionDate = new DateTime(seminar.getStartDate()).minusDays(7).toDate();
|
finalSubmissionDate = new DateTime(seminarModel.getObject().getStartDate()).minusDays(7).toDate();
|
||||||
|
|
||||||
add(new Label("seminarReportTitle", new Model<String>() {
|
add(new Label("seminarReportTitle", new Model<String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -155,7 +159,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public String getObject() {
|
public String getObject() {
|
||||||
|
|
||||||
return seminar.getDocument() == null ? "" : seminar.getDocument().getName();
|
return seminarModel.getObject().getDocument() == null ? "" : seminarModel.getObject().getDocument().getName();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -164,14 +168,14 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return seminar.getDocument() != null;
|
return seminarModel.getObject().getDocument() != null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
uploadInfoContainer.add(new DateFormatter().createFormattedDateLabel("uploadDate", seminar.getDocumentUploadDate()));
|
uploadInfoContainer.add(new DateFormatter().createFormattedDateLabel("uploadDate", seminarModel.getObject().getDocumentUploadDate()));
|
||||||
|
|
||||||
if (seminar.getDocumentUploader() != null) {
|
if (seminarModel.getObject().getDocumentUploader() != null) {
|
||||||
uploadInfoContainer.add(seminar.getDocumentUploader().getDisplayComponent("uploader"));
|
uploadInfoContainer.add(seminarModel.getObject().getDocumentUploader().getDisplayComponent("uploader"));
|
||||||
} else {
|
} else {
|
||||||
uploadInfoContainer.add(new EmptyPanel("uploader"));
|
uploadInfoContainer.add(new EmptyPanel("uploader"));
|
||||||
}
|
}
|
||||||
@ -188,10 +192,11 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
String url = turnitinComponent.returnReport(seminar.getTurnitinId());
|
String url = turnitinComponent.returnReport(seminarModel.getObject().getTurnitinId());
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
seminar.setCheckedForPlagirism(true);
|
seminarModel.getObject().setCheckedForPlagirism(true);
|
||||||
finalSeminarDao.save(seminar);
|
seminarModel.setObject(seminarModel.getObject());
|
||||||
|
// seminar = finalSeminarDao.save(seminar);
|
||||||
}
|
}
|
||||||
setResponsePage(new TurnitinPopupPage(url));
|
setResponsePage(new TurnitinPopupPage(url));
|
||||||
}
|
}
|
||||||
@ -199,14 +204,14 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
turnItLink.setPopupSettings(new PopupSettings(PopupSettings.SCROLLBARS));
|
turnItLink.setPopupSettings(new PopupSettings(PopupSettings.SCROLLBARS));
|
||||||
turnItLink.setOutputMarkupPlaceholderTag(true);
|
turnItLink.setOutputMarkupPlaceholderTag(true);
|
||||||
turnItLink.setVisible(false);
|
turnItLink.setVisible(false);
|
||||||
if (seminar.getTurnitinId() != null) {
|
if (seminarModel.getObject().getTurnitinId() != null) {
|
||||||
if (seminar.isCheckedForPlagirism())
|
if (seminarModel.getObject().isCheckedForPlagirism())
|
||||||
plagiarismLabel.setDefaultModelObject("Yes");
|
plagiarismLabel.setDefaultModelObject("Yes");
|
||||||
turnItLink.setVisible(isSupervisorView);
|
turnItLink.setVisible(isSupervisorView);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadInfoContainer.add(new FileDownloadLink("download", seminar.getDocument()).add(new ImageObject("downloadIcon", ImageObject.SIXTEEN + ImageObject.DOCUMENT_DOWN)));
|
uploadInfoContainer.add(new FileDownloadLink("download", seminarModel.getObject().getDocument()).add(new ImageObject("downloadIcon", ImageObject.SIXTEEN + ImageObject.DOCUMENT_DOWN)));
|
||||||
uploadInfoContainer.add(new FileOpenLink("open", seminar.getDocument()).add(new ImageObject("openIcon", ImageObject.SIXTEEN + ImageObject.DOCUMENT_VIEW)));
|
uploadInfoContainer.add(new FileOpenLink("open", seminarModel.getObject().getDocument()).add(new ImageObject("openIcon", ImageObject.SIXTEEN + ImageObject.DOCUMENT_VIEW)));
|
||||||
uploadInfoContainer.add(plagiarismLabel);
|
uploadInfoContainer.add(plagiarismLabel);
|
||||||
uploadInfoContainer.add(turnItLink);
|
uploadInfoContainer.add(turnItLink);
|
||||||
uploadInfoContainer.add(checkPlagiarismLabel);
|
uploadInfoContainer.add(checkPlagiarismLabel);
|
||||||
@ -217,14 +222,14 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
|
|
||||||
return !isSupervisorView && seminar.getActiveParticipations().isEmpty()
|
return !isSupervisorView && seminarModel.getObject().getActiveParticipations().isEmpty()
|
||||||
&& seminar.getOppositions().isEmpty() && seminar.getTurnitinId() == null;
|
&& seminarModel.getObject().getOppositions().isEmpty() && seminarModel.getObject().getTurnitinId() == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubmit() {
|
public void onSubmit() {
|
||||||
try {
|
try {
|
||||||
seminarUploadController.deleteSeminarReport(seminar);
|
seminarUploadController.deleteSeminarReport(seminarModel.getObject());
|
||||||
setResponsePage(ProjectStartPage.class);
|
setResponsePage(ProjectStartPage.class);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
error("Cannot delete report, opponents or active participants have signed up already");
|
error("Cannot delete report, opponents or active participants have signed up already");
|
||||||
@ -245,11 +250,11 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return seminar.getOppositions().size() == 0;
|
return seminarModel.getObject().getOppositions().size() == 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add(new ListView<FinalSeminarOpposition>("opponentList", seminar.getOppositions()) {
|
add(new ListView<FinalSeminarOpposition>("opponentList", seminarModel.getObject().getOppositions()) {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -284,12 +289,12 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return seminar.getActiveParticipations().size() == 0;
|
return seminarModel.getObject().getActiveParticipations().size() == 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add(new ListView<FinalSeminarActiveParticipation>("activeParticipantsList",
|
add(new ListView<FinalSeminarActiveParticipation>("activeParticipantsList",
|
||||||
seminar.getActiveParticipations()) {
|
seminarModel.getObject().getActiveParticipations()) {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -301,7 +306,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
add(new SeminarDocumentUploadForm(seminar) {
|
add(new SeminarDocumentUploadForm(seminarModel.getObject()) {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -310,7 +315,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
* Show when: - no report uploaded && finalSubmissionDate has
|
* Show when: - no report uploaded && finalSubmissionDate has
|
||||||
* not passed && it's not a supervisor view
|
* not passed && it's not a supervisor view
|
||||||
*/
|
*/
|
||||||
return seminar.getDocument() == null
|
return seminarModel.getObject().getDocument() == null
|
||||||
/*
|
/*
|
||||||
* Still show the final submission deadline as 7 days prior to
|
* Still show the final submission deadline as 7 days prior to
|
||||||
* seminar but allow upload until seminar takes place.
|
* seminar but allow upload until seminar takes place.
|
||||||
@ -325,7 +330,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return finalSubmissionDate.before(new Date()) && seminar.getDocument() == null;
|
return finalSubmissionDate.before(new Date()) && seminarModel.getObject().getDocument() == null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -341,7 +346,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return seminar.getDocument() == null && finalSubmissionDate.after(new Date());
|
return seminarModel.getObject().getDocument() == null && finalSubmissionDate.after(new Date());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -351,8 +356,8 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
add(uploadDeadlineInfoContainer);
|
add(uploadDeadlineInfoContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectFinalSeminarPanel(final String id, final FinalSeminar seminar) {
|
public ProjectFinalSeminarPanel(final String id, final Model<FinalSeminar> seminarModel) {
|
||||||
this(id, seminar, false);
|
this(id, seminarModel, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SeminarDocumentUploadForm extends AbstractUploadForm {
|
private class SeminarDocumentUploadForm extends AbstractUploadForm {
|
||||||
@ -411,7 +416,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 5882957818616996808L;
|
private static final long serialVersionUID = 5882957818616996808L;
|
||||||
|
|
||||||
public EditForm(String name, final FinalSeminar seminar) {
|
public EditForm(String name, final Model<FinalSeminar> seminarModel) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
add(new AjaxButton("edit", new Model<String>("Edit Final Seminar")) {
|
add(new AjaxButton("edit", new Model<String>("Edit Final Seminar")) {
|
||||||
@ -420,7 +425,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
FinalSeminar seminar2 = finalSeminarDao.reLoad(seminar);
|
FinalSeminar seminar2 = finalSeminarDao.reLoad(seminarModel.getObject());
|
||||||
editSeminarForm.removeAll();
|
editSeminarForm.removeAll();
|
||||||
editSeminarForm.add(new EditFinalSeminarFormPanel("editSeminarDetails", seminar2, false));
|
editSeminarForm.add(new EditFinalSeminarFormPanel("editSeminarDetails", seminar2, false));
|
||||||
target.addComponent(editSeminarForm);
|
target.addComponent(editSeminarForm);
|
||||||
|
@ -246,7 +246,7 @@ public class PeerPortalControllerImpl implements PeerPortalController {
|
|||||||
if (request.getStatus() != RequestStatus.WAITING) {
|
if (request.getStatus() != RequestStatus.WAITING) {
|
||||||
// reset status
|
// reset status
|
||||||
request.setStatus(RequestStatus.WAITING);
|
request.setStatus(RequestStatus.WAITING);
|
||||||
peerRequestDao.save(request);
|
request = peerRequestDao.save(request);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class PeerRequestListPanel extends Panel {
|
|||||||
}else {
|
}else {
|
||||||
// Request has aborted review, set canceled in order to keep statistics
|
// Request has aborted review, set canceled in order to keep statistics
|
||||||
req.setStatus(RequestStatus.CANCELED);
|
req.setStatus(RequestStatus.CANCELED);
|
||||||
peerRequestDao.save(req);
|
req = peerRequestDao.save(req);
|
||||||
info("The request was canceled");
|
info("The request was canceled");
|
||||||
}
|
}
|
||||||
target.addComponent(PeerRequestListPanel.this);
|
target.addComponent(PeerRequestListPanel.this);
|
||||||
|
@ -171,7 +171,7 @@ public abstract class StudentPeerInfoRequestsPanel extends Panel {
|
|||||||
// Request has aborted review, set canceled in order to keep statistics
|
// Request has aborted review, set canceled in order to keep statistics
|
||||||
info("The request was canceled");
|
info("The request was canceled");
|
||||||
reloadedRequest.setStatus(RequestStatus.CANCELED);
|
reloadedRequest.setStatus(RequestStatus.CANCELED);
|
||||||
peerRequestDao.save(reloadedRequest);
|
reloadedRequest = peerRequestDao.save(reloadedRequest);
|
||||||
}
|
}
|
||||||
target.addComponent(StudentPeerInfoRequestsPanel.this);
|
target.addComponent(StudentPeerInfoRequestsPanel.this);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class ExpiredRequestWorker extends AbstractWorker {
|
|||||||
} else {
|
} else {
|
||||||
// Request has aborted review, set canceled in order to keep statistics
|
// Request has aborted review, set canceled in order to keep statistics
|
||||||
request.setStatus(RequestStatus.CANCELED);
|
request.setStatus(RequestStatus.CANCELED);
|
||||||
peerRequestDao.save(request);
|
request = peerRequestDao.save(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
package se.su.dsv.scipro.project.pages;
|
package se.su.dsv.scipro.project.pages;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.model.LoadableDetachableModel;
|
import org.apache.wicket.model.Model;
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
import se.su.dsv.scipro.SciProSession;
|
||||||
import se.su.dsv.scipro.checklists.panels.CheckListModel;
|
|
||||||
import se.su.dsv.scipro.checklists.panels.ListCheckListPanel;
|
import se.su.dsv.scipro.checklists.panels.ListCheckListPanel;
|
||||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
import se.su.dsv.scipro.security.auth.Authorization;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
@ -28,7 +22,7 @@ public class ProjectChecklistPage extends ProjectPage {
|
|||||||
super(pp);
|
super(pp);
|
||||||
|
|
||||||
pp.put(Project.PP_PROJECT_ID, SciProSession.get().getActiveProject().getId());
|
pp.put(Project.PP_PROJECT_ID, SciProSession.get().getActiveProject().getId());
|
||||||
add(new ListCheckListPanel("listCheckListPanel", CheckListRole.AUTHOR,getActiveProject()));
|
add(new ListCheckListPanel("listCheckListPanel", CheckListRole.AUTHOR, new Model<Project>(getActiveProject())));
|
||||||
//add(new TrafficLightPanel("trafficLightPanel"));
|
//add(new TrafficLightPanel("trafficLightPanel"));
|
||||||
//add(new CreateCheckListTemplatePanel("createCheckList"));
|
//add(new CreateCheckListTemplatePanel("createCheckList"));
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class ProjectPartnerPage extends ProjectPage {
|
|||||||
ProjectPartner ex = (ProjectPartner) partnerForm.getModelObject();
|
ProjectPartner ex = (ProjectPartner) partnerForm.getModelObject();
|
||||||
ex.setProjectClass(selected);
|
ex.setProjectClass(selected);
|
||||||
// partnerForm.setDefaultModelObject(projectPartnerDao.save(ex));
|
// partnerForm.setDefaultModelObject(projectPartnerDao.save(ex));
|
||||||
projectPartnerDao.save(ex);
|
ex = projectPartnerDao.save(ex);
|
||||||
info("OK");
|
info("OK");
|
||||||
|
|
||||||
infoText.clearInput(); //clear the text area
|
infoText.clearInput(); //clear the text area
|
||||||
|
@ -61,7 +61,7 @@ public class LogEntriesPanel extends Panel{
|
|||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
LogEntry toBeRemoved = logEntryDao.reLoad(logEntry);
|
LogEntry toBeRemoved = logEntryDao.reLoad(logEntry);
|
||||||
toBeRemoved.setDeleted(true);
|
toBeRemoved.setDeleted(true);
|
||||||
logEntryDao.save(toBeRemoved);
|
toBeRemoved = logEntryDao.save(toBeRemoved);
|
||||||
logEntryList.remove(toBeRemoved);
|
logEntryList.remove(toBeRemoved);
|
||||||
target.addComponent(logEntryListContainer);
|
target.addComponent(logEntryListContainer);
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class NotificationsPanel extends Panel {
|
|||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
WebNotification notification = item.getModelObject();
|
WebNotification notification = item.getModelObject();
|
||||||
notification.setReadByUser(true);
|
notification.setReadByUser(true);
|
||||||
webNotificationDao.save(notification);
|
notification = webNotificationDao.save(notification);
|
||||||
target.addComponent(webMarkupContainer);
|
target.addComponent(webMarkupContainer);
|
||||||
countOfNotifications = numberOfNotificationsModel.getObject();
|
countOfNotifications = numberOfNotificationsModel.getObject();
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ public class NotificationsPanel extends Panel {
|
|||||||
for (WebNotification webnotification : webNotificationDao
|
for (WebNotification webnotification : webNotificationDao
|
||||||
.getWebNotifications(SciProSession.get().getUser())) {
|
.getWebNotifications(SciProSession.get().getUser())) {
|
||||||
webnotification.setReadByUser(true);
|
webnotification.setReadByUser(true);
|
||||||
webNotificationDao.save(webnotification);
|
webnotification = webNotificationDao.save(webnotification);
|
||||||
}
|
}
|
||||||
countOfNotifications = numberOfNotificationsModel.getObject();
|
countOfNotifications = numberOfNotificationsModel.getObject();
|
||||||
target.addComponent(webMarkupContainer);
|
target.addComponent(webMarkupContainer);
|
||||||
|
@ -21,6 +21,7 @@ import se.su.dsv.scipro.admin.pages.ProjectManagementPage;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.Dao.SortableParams.Sort;
|
import se.su.dsv.scipro.data.dao.interfaces.Dao.SortableParams.Sort;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
|
import se.su.dsv.scipro.data.facade.ProjectFacade;
|
||||||
import se.su.dsv.scipro.dataproviders.NewProjectDataProvider;
|
import se.su.dsv.scipro.dataproviders.NewProjectDataProvider;
|
||||||
import se.su.dsv.scipro.reusable.DatesPanel;
|
import se.su.dsv.scipro.reusable.DatesPanel;
|
||||||
import se.su.dsv.scipro.reusable.FilterProjectClassPanel;
|
import se.su.dsv.scipro.reusable.FilterProjectClassPanel;
|
||||||
@ -29,9 +30,9 @@ import se.su.dsv.scipro.reusable.FilterStringPanel;
|
|||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
|
||||||
public class ProjectManagementPanel extends Panel {
|
public class ProjectManagementPanel extends Panel {
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private ProjectDao projectDao;
|
private ProjectFacade projectFacade;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -134,14 +135,12 @@ public class ProjectManagementPanel extends Panel {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
Project p2 = projectDao.reLoad(p);
|
projectFacade.deleteProject(p);
|
||||||
projectDao.delete(p2);
|
|
||||||
ajaxRefresh(target);
|
ajaxRefresh(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
item.add(deleteLink);
|
item.add(deleteLink);
|
||||||
//>>>>>>> cascade
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,6 @@ import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightChecklist;
|
|||||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightProjectIdeas;
|
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightProjectIdeas;
|
||||||
import se.su.dsv.scipro.conference.pages.ProjectConferencePage;
|
import se.su.dsv.scipro.conference.pages.ProjectConferencePage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.log.pages.ProjectLogPage;
|
|
||||||
import se.su.dsv.scipro.peer.pages.ProjectPeerPortalPage;
|
import se.su.dsv.scipro.peer.pages.ProjectPeerPortalPage;
|
||||||
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
||||||
import se.su.dsv.scipro.project.pages.NoActiveProjectPage;
|
import se.su.dsv.scipro.project.pages.NoActiveProjectPage;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package se.su.dsv.scipro.supervisor.pages;
|
package se.su.dsv.scipro.supervisor.pages;
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
|
import org.apache.wicket.model.Model;
|
||||||
|
|
||||||
import se.su.dsv.scipro.checklists.panels.ListCheckListPanel;
|
import se.su.dsv.scipro.checklists.panels.ListCheckListPanel;
|
||||||
import se.su.dsv.scipro.checklists.panels.SupervisorAddChecklistPanel;
|
import se.su.dsv.scipro.checklists.panels.SupervisorAddChecklistPanel;
|
||||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorMyProjects;
|
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorMyProjects;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
import se.su.dsv.scipro.security.auth.Authorization;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
@ -18,7 +20,7 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
|||||||
public class SupervisorChecklistPage extends AbstractSupervisorProjectDetailsPage implements MenuHighlightSupervisorMyProjects {
|
public class SupervisorChecklistPage extends AbstractSupervisorProjectDetailsPage implements MenuHighlightSupervisorMyProjects {
|
||||||
public SupervisorChecklistPage(PageParameters pp) {
|
public SupervisorChecklistPage(PageParameters pp) {
|
||||||
super(pp);
|
super(pp);
|
||||||
add(new ListCheckListPanel("listCheckListPanel", CheckListRole.SUPERVISOR, projectModel.getObject()));
|
add(new ListCheckListPanel("listCheckListPanel", CheckListRole.SUPERVISOR, new Model<Project>(projectModel.getObject())));
|
||||||
add(new SupervisorAddChecklistPanel("addChecklistPanel", pp, projectModel.getObject()));
|
add(new SupervisorAddChecklistPanel("addChecklistPanel", pp, projectModel.getObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
<div class="append-bottom">
|
<div class="append-bottom">
|
||||||
<label>Select what languages you can supervise in: </label>
|
<label>Select what languages you can supervise in: </label>
|
||||||
<div wicket:id="languagelistview">
|
<div wicket:id="languagelistview">
|
||||||
<span wicket:id="languagelabel"></span> <input type="checkbox"
|
<input type="checkbox" wicket:id="languagecheckbox" />
|
||||||
wicket:id="languagecheckbox" />
|
<span wicket:id="languagelabel"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -38,15 +38,15 @@
|
|||||||
<div class="span-11">
|
<div class="span-11">
|
||||||
<label>Available</label>
|
<label>Available</label>
|
||||||
<div wicket:id="regularlistview">
|
<div wicket:id="regularlistview">
|
||||||
<span wicket:id="regularlabel"></span> <input type="checkbox"
|
<input type="checkbox" wicket:id="regularcheckbox" />
|
||||||
wicket:id="regularcheckbox" />
|
<span wicket:id="regularlabel"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span-11 last">
|
<div class="span-11 last">
|
||||||
<label>Selected</label>
|
<label>Selected</label>
|
||||||
<div wicket:id="regularlistview2">
|
<div wicket:id="regularlistview2">
|
||||||
<span wicket:id="regularlabel"></span> <input type="checkbox"
|
<input type="checkbox" wicket:id="regularcheckbox" />
|
||||||
wicket:id="regularcheckbox" />
|
<span wicket:id="regularlabel"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,7 +10,6 @@ import se.su.dsv.scipro.activityplan.pages.SupervisorActivityPlanPage;
|
|||||||
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
||||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorChecklist;
|
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorChecklist;
|
||||||
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
||||||
import se.su.dsv.scipro.log.pages.SupervisorLogPage;
|
|
||||||
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorProjectDetailsPage;
|
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorProjectDetailsPage;
|
||||||
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
||||||
import se.su.dsv.scipro.supervisor.pages.SupervisorFilePage;
|
import se.su.dsv.scipro.supervisor.pages.SupervisorFilePage;
|
||||||
|
@ -41,13 +41,13 @@ public class UserFacade {
|
|||||||
//the line below is why the unit disappears when saving a supervisor profile- the unit is never specified so it saves null over the existing value.
|
//the line below is why the unit disappears when saving a supervisor profile- the unit is never specified so it saves null over the existing value.
|
||||||
// employee.getKeywords().setKeywords(keywords);
|
// employee.getKeywords().setKeywords(keywords);
|
||||||
employee.getCapabilities().setLanguages(languages);
|
employee.getCapabilities().setLanguages(languages);
|
||||||
supervisorDao.save(employee);
|
employee = supervisorDao.save(employee);
|
||||||
userDao.save(employee.getUser());
|
userDao.save(employee.getUser());
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
public void saveUserProfileData(final User user){
|
public void saveUserProfileData(User user){
|
||||||
if(user == null)
|
if(user == null)
|
||||||
throw new IllegalArgumentException("Null user is not allowed");
|
throw new IllegalArgumentException("Null user is not allowed");
|
||||||
userDao.save(user);
|
user = userDao.save(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class CheckPlagiarismEventWorker extends AbstractWorker {
|
|||||||
checkPlagiarismEventDao.delete(cpe);
|
checkPlagiarismEventDao.delete(cpe);
|
||||||
String turnitinId = turnitinComponent.quickSubmitPaper(fd, fd.getName(), uploader.getFirstName(), uploader.getLastName(), seminar.getProject().getTitle(20));
|
String turnitinId = turnitinComponent.quickSubmitPaper(fd, fd.getName(), uploader.getFirstName(), uploader.getLastName(), seminar.getProject().getTitle(20));
|
||||||
seminar.setTurnitinId(turnitinId);
|
seminar.setTurnitinId(turnitinId);
|
||||||
finalSeminarDao.save(seminar);
|
seminar = finalSeminarDao.save(seminar);
|
||||||
this.commitTransaction();
|
this.commitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,40 +166,6 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
masterProjectIdea.getKeywords().getAll().clear();
|
masterProjectIdea.getKeywords().getAll().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* a master supervisor can handle master project ideas */
|
|
||||||
public void testMasterSupervisor() {
|
|
||||||
runFirstTest(masterSupervisor, masterProjectClass, masterProjectIdea);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* a bachelor supervisor can handle bachelor project Ideas */
|
|
||||||
public void testBachelorSupervisor() {
|
|
||||||
runFirstTest(bachelorSupervisor, bachelorProjectClass, bachelorProjectIdea);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* a masterSupervisor can handle bachelorProjectIdeas */
|
|
||||||
public void testMasterSupervisor_v2() {
|
|
||||||
runFirstTest(masterSupervisor, masterProjectClass, bachelorProjectIdea);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void runFirstTest(final Employee supervisor, final ProjectClass projectClass, final ProjectIdea projectIdea) {
|
|
||||||
supervisorAvailability.add(new Availability(supervisor, 0L, 1, projectClass));
|
|
||||||
unmatchedProjectIdeas.add(projectIdea);
|
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
|
||||||
assertFalse(result.matches.size() == 0);
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(projectIdea));
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(supervisor));
|
|
||||||
assertTrue(result.unmatched.size() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -218,7 +184,7 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Rollback
|
@Rollback
|
||||||
/* a bachelor supervisor should NOT be able to handle a rejected (bachelor) projectIdea */
|
/* a bachelor supervisor should NOT be able to handle a rejected (bachelor) projectIdea */
|
||||||
public void testRejectedProjectIdea() {
|
public void testRejectedProjectIdea() {
|
||||||
runSecondTest(bachelorSupervisor, bachelorProjectClass, bachelorProjectIdea);
|
testRejectedMatch(bachelorSupervisor, bachelorProjectClass, bachelorProjectIdea);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -226,10 +192,10 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Rollback
|
@Rollback
|
||||||
/* a master supervisor should NOT be able to handle a rejected (bachelor) projectIdea */
|
/* a master supervisor should NOT be able to handle a rejected (bachelor) projectIdea */
|
||||||
public void testRejectedProjectIdea_v2() {
|
public void testRejectedProjectIdea_v2() {
|
||||||
runSecondTest(masterSupervisor, masterProjectClass, bachelorProjectIdea);
|
testRejectedMatch(masterSupervisor, masterProjectClass, bachelorProjectIdea);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runSecondTest(final Employee supervisor, final ProjectClass projectClass, final ProjectIdea projectIdea) {
|
private void testRejectedMatch(final Employee supervisor, final ProjectClass projectClass, final ProjectIdea projectIdea) {
|
||||||
addRejectedMatch(supervisor, projectIdea); // adds a rejected match to the projectIdea
|
addRejectedMatch(supervisor, projectIdea); // adds a rejected match to the projectIdea
|
||||||
supervisorAvailability.add(new Availability(supervisor, 0L, 1, projectClass));
|
supervisorAvailability.add(new Availability(supervisor, 0L, 1, projectClass));
|
||||||
unmatchedProjectIdeas.add(projectIdea);
|
unmatchedProjectIdeas.add(projectIdea);
|
||||||
@ -238,6 +204,8 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
assertTrue(result.unmatched.size() == 1);
|
assertTrue(result.unmatched.size() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// helper that is used by testRejectedMatch
|
||||||
private void addRejectedMatch(final Employee supervisor, final ProjectIdea projectIdea) {
|
private void addRejectedMatch(final Employee supervisor, final ProjectIdea projectIdea) {
|
||||||
Match rejectedMatch = new Match();
|
Match rejectedMatch = new Match();
|
||||||
rejectedMatch.setStatus(Match.Status.REJECTED);
|
rejectedMatch.setStatus(Match.Status.REJECTED);
|
||||||
@ -252,7 +220,7 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* a bachelor supervisor can handle a projectIdea which has been rejected by another (bachelor) supervisor, even if the other supervisor has a higher score */
|
/* a bachelor supervisor can handle a projectIdea which has been rejected by another (bachelor) supervisor, even if the other supervisor has a higher score */
|
||||||
public void testRejectByOtherSupervisor() {
|
public void testShouldSuperviseIdeaRejectedByAnotherSupervisor() {
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
||||||
@ -287,28 +255,11 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* a preferred "bachelor" supervisor should NOT handle a master projectIdea */
|
|
||||||
public void testIncorrectProjectClass() {
|
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
|
||||||
supervisorAvailability.add(new Availability(masterSupervisor, 0L, 1, masterProjectClass));
|
|
||||||
masterProjectIdea.setPreferredSupervisor(bachelorSupervisor2);
|
|
||||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
|
||||||
assertTrue(result.matches.size() > 0);
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(masterProjectIdea));
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(masterSupervisor));
|
|
||||||
assertTrue(result.unmatched.size() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* keywords of 16 points should supersede a preferred supervisor of 15 points */
|
/* keywords of 16 points should supersede a preferred supervisor of 15 points */
|
||||||
public void testHighestScore() {
|
public void testValidKeyWords() {
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
projectIdeaList.add(bachelorProjectIdea);
|
projectIdeaList.add(bachelorProjectIdea);
|
||||||
@ -328,36 +279,11 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
assertTrue(result.unmatched.size() == 0);
|
assertTrue(result.unmatched.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* keywords of 6 points should supersede keywords of 3 points */
|
|
||||||
public void testHighestScore_v2() {
|
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
|
||||||
projectIdeaList.add(bachelorProjectIdea);
|
|
||||||
List<Employee> supervisorList = new ArrayList<Employee>();
|
|
||||||
supervisorList.add(bachelorSupervisor);
|
|
||||||
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeWord, "test unit", false)); // 3
|
|
||||||
supervisorList.clear();
|
|
||||||
supervisorList.add(bachelorSupervisor2);
|
|
||||||
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeWord, "UML", false)); // 3
|
|
||||||
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeWord, "Design", false)); // 3
|
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
|
||||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
|
||||||
assertTrue(result.matches.size() > 0);
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
|
|
||||||
assertTrue(result.unmatched.size() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* deleted keywords of 6 points should NOT supersede valid keywords of 3 points */
|
/* deleted keywords of 6 points should NOT supersede valid keywords of 3 points */
|
||||||
public void testHighestScore_v3() {
|
public void testDeletedKeyWords() {
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
projectIdeaList.add(bachelorProjectIdea);
|
projectIdeaList.add(bachelorProjectIdea);
|
||||||
@ -382,7 +308,7 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* the preferred LANGUAGE of the project idea should determine even when two supervisors NOT have the same score */
|
/* the preferred LANGUAGE of the project idea should determine even when two supervisors NOT have the same score */
|
||||||
public void testPreferredLanguage() {
|
public void testPreferredLanguageDetermines() {
|
||||||
Set<Language> languageSet = new HashSet<Language>();
|
Set<Language> languageSet = new HashSet<Language>();
|
||||||
Language language_sv = languageDao.save(new Language("Swedish"));
|
Language language_sv = languageDao.save(new Language("Swedish"));
|
||||||
languageSet.add(language_sv);
|
languageSet.add(language_sv);
|
||||||
@ -466,7 +392,7 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* the supervisor with no available "slots" should NOT be chosen even when this supervisor has the highest score */
|
/* the supervisor with no available "slots" should never be chosen (even when this supervisor has the highest score) */
|
||||||
public void testNoAvailableSlots() {
|
public void testNoAvailableSlots() {
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
@ -489,8 +415,8 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* a supervisor with the highest available slot should NOT be chosen when this supervisor has less score */
|
/* the supervisor with the highest points should be chosen even if there exists a supervisor with more available "slots" */
|
||||||
public void testHighestAvailableSlot() {
|
public void testHighestAvailablePoints() {
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
projectIdeaList.add(bachelorProjectIdea);
|
projectIdeaList.add(bachelorProjectIdea);
|
||||||
@ -511,13 +437,11 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* test that the number Availability#numMatched has increased with one and that the supervisor with highest available slots are chosen */
|
/* test that Availability#numMatched has increased with one after a match */
|
||||||
public void testNumMatchedHasIncreased() {
|
public void testNumMatchedHasIncreased() {
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 4, bachelorProjectClass));
|
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 4, bachelorProjectClass));
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
|
||||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for(Availability availability : supervisorAvailability) {
|
for(Availability availability : supervisorAvailability) {
|
||||||
if(availability.getSupervisor().equals(bachelorSupervisor2)) {
|
if(availability.getSupervisor().equals(bachelorSupervisor2)) {
|
||||||
@ -529,7 +453,6 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
assertTrue(found);
|
assertTrue(found);
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||||
assertTrue(result.matches.size() > 0);
|
assertTrue(result.matches.size() > 0);
|
||||||
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
|
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
|
||||||
found = false;
|
found = false;
|
||||||
@ -545,156 +468,182 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// We now perform 4 tests to verify the correctness of the method GreedyMatchingAlgorithm # Pair # compareTo,
|
||||||
|
// which sorts the list of matches, i. e. Pairs according to specific criterias
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* neither a bachelor or a master supervisor are preferred to handle a bachelor idea when compatibility, keywords, scores etc are equal */
|
/* Test 1.
|
||||||
public void testBachelorOrMaster() {
|
* ==================================================================================
|
||||||
Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
*
|
||||||
supervisorAvailability.add(new Availability(masterSupervisor, 0L, 1, bachelorProjectClass));
|
* Prerequisites: two supervisors are matched against one bachelor project idea,
|
||||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
* both supervisors have the SAME "total availability" (9)
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
* and they both have a calculated match of 10 points,
|
||||||
projectIdeaList.add(bachelorProjectIdea);
|
*
|
||||||
List<Employee> supervisorList = new ArrayList<Employee>();
|
* Tests: in the first test we verify that "henrikH" is found, because "davidH"
|
||||||
supervisorList.add(bachelorSupervisor2);
|
* has less availability slots (4) for bachelor project ideas
|
||||||
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeWord, "Design", false));
|
*
|
||||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
* */
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
public void testDavidH_Has_Less_Available_Slots_For_Bachelor() {
|
||||||
assertTrue(result.matches.size() > 0);
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
|
|
||||||
assertTrue(result.unmatched.size() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* test that a master which has filled up his slot for bachelor but has slots left for master can supervise a bachelor idea */
|
|
||||||
public void testSlotForMasterSupervisor() {
|
|
||||||
//Employee bachelorSupervisor2 = createEmployee("David", "Hallberg", languages);
|
|
||||||
supervisorAvailability.add(new Availability(masterSupervisor, 3L, 3, bachelorProjectClass));
|
|
||||||
supervisorAvailability.add(new Availability(masterSupervisor, 3L, 4, bachelorProjectClass));
|
|
||||||
//supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
|
||||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
|
||||||
assertTrue(result.matches.size() > 0);
|
|
||||||
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(masterSupervisor));
|
|
||||||
assertTrue(result.unmatched.size() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* test that the supervisor who has the highest total slot available will be chosen */
|
|
||||||
public void testIncreaseSlotForMasterSupervisor() {
|
|
||||||
Employee davidH = createEmployee("David", "Hallberg", languages);
|
|
||||||
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
|
||||||
//ProjectIdea firstBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
|
||||||
supervisorAvailability.add(new Availability(henrikH, 2L, 3, bachelorProjectClass)); // total slot = 2
|
|
||||||
supervisorAvailability.add(new Availability(henrikH, 3L, 4, masterProjectClass));
|
|
||||||
supervisorAvailability.add(new Availability(davidH, 1L, 1, bachelorProjectClass)); // total slot = 1
|
|
||||||
supervisorAvailability.add(new Availability(davidH, 0L, 1, masterProjectClass));
|
|
||||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
|
||||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
|
||||||
|
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
|
||||||
assertTrue(result.matches.size() > 0);
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(masterProjectIdea));
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(henrikH));
|
|
||||||
assertTrue(result.matches.get(1).getProjectIdea().equals(bachelorProjectIdea));
|
|
||||||
assertTrue(result.matches.get(1).getSupervisor().equals(henrikH));
|
|
||||||
assertTrue(result.unmatched.size() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* test that a master supervisor is chosen for a master project idea which has the same points as a bachelor project idea */
|
|
||||||
public void testIncreaseSlotForMasterSupervisor_v2() {
|
|
||||||
Employee davidH = createEmployee("David", "Hallberg", languages);
|
|
||||||
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
|
||||||
supervisorAvailability.add(new Availability(henrikH, 3L, 3, bachelorProjectClass));
|
|
||||||
supervisorAvailability.add(new Availability(henrikH, 3L, 4, masterProjectClass));
|
|
||||||
supervisorAvailability.add(new Availability(davidH, 0L, 1, bachelorProjectClass));
|
|
||||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
|
||||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
|
||||||
bachelorProjectIdea.setPreferredSupervisor(henrikH);
|
|
||||||
masterProjectIdea.setPreferredSupervisor(henrikH);
|
|
||||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
|
||||||
assertTrue(result.matches.size() > 0);
|
|
||||||
assertTrue(result.matches.get(0).getPoints() == 10);
|
|
||||||
assertTrue(result.matches.get(1).getPoints() == 0);
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(henrikH));
|
|
||||||
assertTrue(result.matches.get(1).getSupervisor().equals(davidH));
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(masterProjectIdea));
|
|
||||||
assertTrue(result.matches.get(1).getProjectIdea().equals(bachelorProjectIdea));
|
|
||||||
assertTrue(result.unmatched.size() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
/* three supervisors which are matched against three project ideas */
|
|
||||||
public void testIncreaseSlotForMasterSupervisor_v3() {
|
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
List<Employee> supervisorList = new ArrayList<Employee>();
|
List<Employee> supervisorList = new ArrayList<Employee>();
|
||||||
|
|
||||||
Employee davidH = createEmployee("David", "Hallberg", languages);
|
Employee davidH = createEmployee("David", "Hallberg", languages);
|
||||||
supervisorAvailability.clear();
|
supervisorAvailability.add(new Availability(davidH, 1L, 5, bachelorProjectClass));
|
||||||
supervisorAvailability.add(new Availability(davidH, 0L, 5, bachelorProjectClass));
|
|
||||||
supervisorAvailability.add(new Availability(davidH, 0L, 5, masterProjectClass));
|
supervisorAvailability.add(new Availability(davidH, 0L, 5, masterProjectClass));
|
||||||
|
|
||||||
|
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
||||||
|
supervisorAvailability.add(new Availability(henrikH, 0L, 5, bachelorProjectClass));
|
||||||
|
supervisorAvailability.add(new Availability(henrikH, 1L, 5, masterProjectClass));
|
||||||
|
supervisorList.add(henrikH);
|
||||||
|
|
||||||
|
ProjectIdea secondBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
||||||
|
projectIdeaList.clear();
|
||||||
|
projectIdeaList.add(secondBachelorIdea); // David Hallberg is preferred supervisor for this project idea
|
||||||
|
secondBachelorIdea.setPreferredSupervisor(davidH);
|
||||||
|
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
||||||
|
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development__", false));
|
||||||
|
|
||||||
|
unmatchedProjectIdeas.add(secondBachelorIdea);
|
||||||
|
|
||||||
|
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||||
|
assertTrue(result.matches.size() == 1);
|
||||||
|
assertTrue(result.matches.get(0).getPoints() == 10);
|
||||||
|
assertTrue(result.matches.get(0).getSupervisor().equals(henrikH));
|
||||||
|
assertTrue(result.matches.get(0).getProjectIdea().equals(secondBachelorIdea));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Transactional
|
||||||
|
@Rollback
|
||||||
|
/* .
|
||||||
|
* Test 2.
|
||||||
|
* ==================================================================================
|
||||||
|
* Prerequisites: two supervisors are matched against one bachelor project idea,
|
||||||
|
* both supervisors have the SAME "total availability" (9)
|
||||||
|
* and they both have a calculated match of 10 points,
|
||||||
|
*
|
||||||
|
* Tests: In the second test we verify that "davidH" is found, because "henrikH"
|
||||||
|
* has less availability slots (4) for bachelor project ideas
|
||||||
|
* */
|
||||||
|
public void testHenrikH_Has_Less_Available_Slots_For_Bachelor() {
|
||||||
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
|
List<Employee> supervisorList = new ArrayList<Employee>();
|
||||||
|
Employee davidH = createEmployee("David", "Hallberg", languages);
|
||||||
|
supervisorAvailability.add(new Availability(davidH, 0L, 5, bachelorProjectClass));
|
||||||
|
supervisorAvailability.add(new Availability(davidH, 1L, 5, masterProjectClass));
|
||||||
|
|
||||||
|
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
||||||
|
supervisorAvailability.add(new Availability(henrikH, 1L, 5, bachelorProjectClass));
|
||||||
|
supervisorAvailability.add(new Availability(henrikH, 0L, 5, masterProjectClass));
|
||||||
|
supervisorList.add(henrikH);
|
||||||
|
|
||||||
|
ProjectIdea secondBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
||||||
|
projectIdeaList.clear();
|
||||||
|
projectIdeaList.add(secondBachelorIdea); // David Hallberg is preferred supervisor for this project idea
|
||||||
|
secondBachelorIdea.setPreferredSupervisor(davidH);
|
||||||
|
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
||||||
|
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development__", false));
|
||||||
|
|
||||||
|
unmatchedProjectIdeas.add(secondBachelorIdea);
|
||||||
|
|
||||||
|
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||||
|
assertTrue(result.matches.size() == 1);
|
||||||
|
assertTrue(result.matches.get(0).getPoints() == 10);
|
||||||
|
assertTrue(result.matches.get(0).getSupervisor().equals(davidH));
|
||||||
|
assertTrue(result.matches.get(0).getProjectIdea().equals(secondBachelorIdea));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Transactional
|
||||||
|
@Rollback
|
||||||
|
/* Test 3.
|
||||||
|
* ==================================================================================
|
||||||
|
* Prerequisites: two supervisors are matched against one bachelor project idea,
|
||||||
|
* both supervisors have "open" availability slots for both master and bachelor projects
|
||||||
|
* the "total availability" is DIFFERENT 8 slots vs. 9 slots for the supervisors but they have both a calculated match of 10 points,
|
||||||
|
*
|
||||||
|
* Tests: We now perform a third test "testDavidH_Has_Less_Total_Available_Slots", here we test that "henrikH" is found, because "davidH"
|
||||||
|
* has less "total available" slots (8) compared to 9 for "henrikH" for project ideas (master + bachelor)
|
||||||
|
* */
|
||||||
|
public void testDavidH_Has_Less_Total_Available_Slots() {
|
||||||
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
|
List<Employee> supervisorList = new ArrayList<Employee>();
|
||||||
|
Employee davidH = createEmployee("David", "Hallberg", languages);
|
||||||
|
supervisorAvailability.add(new Availability(davidH, 0L, 4, bachelorProjectClass));
|
||||||
|
supervisorAvailability.add(new Availability(davidH, 1L, 5, masterProjectClass));
|
||||||
|
|
||||||
|
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
||||||
|
supervisorAvailability.add(new Availability(henrikH, 1L, 5, bachelorProjectClass));
|
||||||
|
supervisorAvailability.add(new Availability(henrikH, 0L, 5, masterProjectClass));
|
||||||
|
supervisorList.add(henrikH);
|
||||||
|
|
||||||
|
ProjectIdea secondBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
||||||
|
projectIdeaList.clear();
|
||||||
|
projectIdeaList.add(secondBachelorIdea); // David Hallberg is preferred supervisor for this project idea
|
||||||
|
secondBachelorIdea.setPreferredSupervisor(davidH);
|
||||||
|
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
||||||
|
addKeyWords(supervisorList, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development__", false));
|
||||||
|
|
||||||
|
unmatchedProjectIdeas.add(secondBachelorIdea);
|
||||||
|
|
||||||
|
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||||
|
assertTrue(result.matches.size() == 1);
|
||||||
|
assertTrue(result.matches.get(0).getPoints() == 10);
|
||||||
|
assertTrue(result.matches.get(0).getSupervisor().equals(henrikH));
|
||||||
|
assertTrue(result.matches.get(0).getProjectIdea().equals(secondBachelorIdea));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Transactional
|
||||||
|
@Rollback
|
||||||
|
/* Test 4
|
||||||
|
* =============================================================================================
|
||||||
|
* The test verifies that project classes are regarded when sorting matched Pairs (containing a project idea and a supervisor)
|
||||||
|
* The test also verifies that the matching algorithm can handle more "complicated" match situations.
|
||||||
|
* */
|
||||||
|
public void testThreeSupervisorsAndThreeProjectIdeas_Available_Slots_Are_The_Same() {
|
||||||
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
|
List<Employee> supervisorList = new ArrayList<Employee>();
|
||||||
|
Employee davidH = createEmployee("David", "Hallberg", languages);
|
||||||
|
supervisorAvailability.add(new Availability(davidH, 0L, 5, bachelorProjectClass));
|
||||||
|
supervisorAvailability.add(new Availability(davidH, 0L, 5, masterProjectClass));
|
||||||
supervisorList.clear();
|
supervisorList.clear();
|
||||||
supervisorList.add(davidH);
|
supervisorList.add(davidH);
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeArea, "IT för lärande", false));
|
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeWord, "Business process management (BPM)", false));
|
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeWord, "Flexibelt lärande", false));
|
|
||||||
|
|
||||||
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
||||||
supervisorAvailability.add(new Availability(henrikH, 0L, 5, bachelorProjectClass));
|
supervisorAvailability.add(new Availability(henrikH, 0L, 5, bachelorProjectClass));
|
||||||
supervisorAvailability.add(new Availability(henrikH, 0L, 5, masterProjectClass));
|
supervisorAvailability.add(new Availability(henrikH, 0L, 5, masterProjectClass));
|
||||||
|
|
||||||
supervisorList.clear();
|
supervisorList.clear();
|
||||||
supervisorList.add(henrikH);
|
supervisorList.add(henrikH);
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeArea, "Technology Enhanced Learning", false));
|
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeArea, "ICT for Development", false));
|
addKeyWords(supervisorList, null, createKeyword(keywordTypeArea, "ICT for Development", false));
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeWord, "Flexibelt lärande", false));
|
addKeyWords(supervisorList, null, createKeyword(keywordTypeArea, "ICT for Development__", false));
|
||||||
|
|
||||||
Employee henrikBergstr = createEmployee("Henrik", "Bergström", languages); // login henrikbe
|
Employee henrikBergstr = createEmployee("Henrik", "Bergström", languages); // login henrikbe
|
||||||
supervisorAvailability.add(new Availability(henrikBergstr, 0L, 5, bachelorProjectClass));
|
supervisorAvailability.add(new Availability(henrikBergstr, 0L, 5, bachelorProjectClass));
|
||||||
supervisorAvailability.add(new Availability(henrikBergstr, 0L, 5, masterProjectClass));
|
supervisorAvailability.add(new Availability(henrikBergstr, 0L, 5, masterProjectClass));
|
||||||
|
|
||||||
supervisorList.clear();
|
supervisorList.clear();
|
||||||
supervisorList.add(henrikBergstr);
|
supervisorList.add(henrikBergstr);
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeWord, "ACT Agera i kommunikation med teknik", false));
|
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeWord, "System development", false));
|
addKeyWords(supervisorList, null, createKeyword(keywordTypeWord, "System development", false));
|
||||||
addKeyWords(supervisorList, null, createKeyword(keywordTypeWord, "IT-architectures", false));
|
|
||||||
|
|
||||||
ProjectIdea firstBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
ProjectIdea firstBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
||||||
projectIdeaList.clear();
|
projectIdeaList.clear();
|
||||||
projectIdeaList.add(firstBachelorIdea); // no preferred supervisor for this project idea
|
projectIdeaList.add(firstBachelorIdea); // no preferred supervisor for this project idea
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeWord, "System development", false));
|
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeWord, "System development", false));
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeWord, "Enterprise 2.0", false));
|
|
||||||
|
|
||||||
ProjectIdea masterIdea = createProjectIdea(masterProjectClass, applicationPeriod);
|
ProjectIdea masterIdea = createProjectIdea(masterProjectClass, applicationPeriod);
|
||||||
projectIdeaList.clear();
|
projectIdeaList.clear();
|
||||||
projectIdeaList.add(masterIdea); // no preferred supervisor for this project idea
|
projectIdeaList.add(masterIdea); // no preferred supervisor for this project idea
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "Interaction design", false));
|
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "Digital Systems Security", false));
|
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeWord, "System development", false));
|
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeWord, "System development", false));
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeWord, "Information system theory", false));
|
|
||||||
|
|
||||||
ProjectIdea secondBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
ProjectIdea secondBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
||||||
projectIdeaList.clear();
|
projectIdeaList.clear();
|
||||||
projectIdeaList.add(secondBachelorIdea); // David Hallberg is preferred supervisor for this project idea
|
projectIdeaList.add(secondBachelorIdea); // David Hallberg is preferred supervisor for this project idea
|
||||||
secondBachelorIdea.setPreferredSupervisor(davidH);
|
secondBachelorIdea.setPreferredSupervisor(davidH);
|
||||||
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "E-government and E-democracy", false));
|
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development", false));
|
||||||
|
addKeyWords(null, projectIdeaList, createKeyword(keywordTypeArea, "ICT for Development__", false));
|
||||||
|
|
||||||
unmatchedProjectIdeas.clear();
|
|
||||||
unmatchedProjectIdeas.add(firstBachelorIdea);
|
unmatchedProjectIdeas.add(firstBachelorIdea);
|
||||||
unmatchedProjectIdeas.add(secondBachelorIdea);
|
unmatchedProjectIdeas.add(secondBachelorIdea);
|
||||||
unmatchedProjectIdeas.add(masterIdea);
|
unmatchedProjectIdeas.add(masterIdea);
|
||||||
@ -703,15 +652,16 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
assertTrue(result.matches.size() == 3);
|
assertTrue(result.matches.size() == 3);
|
||||||
|
|
||||||
assertTrue(result.matches.get(0).getPoints() == 10);
|
assertTrue(result.matches.get(0).getPoints() == 10);
|
||||||
assertTrue(result.matches.get(1).getPoints() == 5);
|
|
||||||
assertTrue(result.matches.get(2).getPoints() == 5);
|
|
||||||
|
|
||||||
assertTrue(result.matches.get(0).getSupervisor().equals(davidH));
|
assertTrue(result.matches.get(0).getSupervisor().equals(davidH));
|
||||||
assertTrue(result.matches.get(1).getSupervisor().equals(henrikH));
|
|
||||||
assertTrue(result.matches.get(2).getSupervisor().equals(henrikH));
|
|
||||||
|
|
||||||
assertTrue(result.matches.get(0).getProjectIdea().equals(secondBachelorIdea));
|
assertTrue(result.matches.get(0).getProjectIdea().equals(secondBachelorIdea));
|
||||||
|
|
||||||
|
assertTrue(result.matches.get(1).getPoints() == 5);
|
||||||
|
assertTrue(result.matches.get(1).getSupervisor().equals(henrikH));
|
||||||
assertTrue(result.matches.get(1).getProjectIdea().equals(firstBachelorIdea));
|
assertTrue(result.matches.get(1).getProjectIdea().equals(firstBachelorIdea));
|
||||||
|
|
||||||
|
assertTrue(result.matches.get(2).getPoints() == 5);
|
||||||
|
assertTrue(result.matches.get(2).getSupervisor().equals(henrikH));
|
||||||
assertTrue(result.matches.get(2).getProjectIdea().equals(masterIdea));
|
assertTrue(result.matches.get(2).getProjectIdea().equals(masterIdea));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user