Merge branch 'develop' of ssh://git.dsv.su.se/git/scipro/scipro into develop
* 'develop' of ssh://git.dsv.su.se/git/scipro/scipro: (125 commits) upcoming event to left column hide heading authorization and format fix removed commentthread null pointer exception for supervisore deletedcommentethrad deletedcommentethrad null check remove projectconferencetest namechange dito deletes textarea after submitg format fix hide set all read and pagfinator text format fix Support for restinterface for comments Add rest possiblity name change from relativePath, to absolute name change from relativePath, to absolute ...
This commit is contained in:
commit
4c46988337
src/main/java/se/su/dsv/scipro
SciProApplication.java
admin
pages/settings
AdminFinalSeminarSettingsPage.htmlAdminFinalSeminarSettingsPage.javaAdminGeneralSettingsPage.htmlAdminGeneralSettingsPage.java
panels
basepanels
commentthread
conference
model
pages
ProjectConferencePage.htmlProjectConferencePage.javaSupervisorConferencePage.htmlSupervisorConferencePage.java
panels
data
controllers
dao
interfaces
BoardMessageDao.javaMessageBoardDao.javaMessageDao.javaSupervisorBoardMessageDao.javaSupervisorMessageBoardDao.javaUserDao.javaWebNotificationDao.java
jpa
dataobjects
Board.javaBoardMessage.javaCommentThread.javaFinalSeminar.javaGeneralSystemSettings.javaMailEvent.javaMessage.javaMessageBoard.javaPrivateMessage.javaProject.javaRecipient.javaSupervisorBoardMessage.javaSupervisorMessageBoard.javaUserSettings.javaWebNotification.java
enums
dataproviders
json
knol/resource/panels
FileResourcePanel.javaResourceBookmarkableCategoryPanel.javaResourceBookmarkablePanel.javaResourceBookmarkableTagPanel.javaResourceListPanel.javaResourcesPanel.java
message/models
opponent
models
panels
AvailableFinalSeminarHelpPanel.javaChangeViewPanel.javaEditFinalSeminarFormPanel.htmlEditFinalSeminarFormPanel.javaFinalSeminarDetailsPanel.javaOpponentListViewPanel.htmlOpponentListViewPanel.javaOpponentPanel.javaOpponentStudentViewListPanel.javaProjectActiveParticipationsPanel.javaProjectFinalSeminarPanel.htmlProjectFinalSeminarPanel.javaProjectOppositionsPanel.javaStudentOppositionStatsPanel.java
peer/data/dao/controllers
project
@ -32,6 +32,8 @@ 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.errorpages.AccessDeniedPage;
|
import se.su.dsv.scipro.basepages.errorpages.AccessDeniedPage;
|
||||||
import se.su.dsv.scipro.basepages.errorpages.NotFoundPage;
|
import se.su.dsv.scipro.basepages.errorpages.NotFoundPage;
|
||||||
|
import se.su.dsv.scipro.conference.pages.ProjectConferencePage;
|
||||||
|
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
||||||
import se.su.dsv.scipro.json.pages.JsonDeletePrivateMessagePage;
|
import se.su.dsv.scipro.json.pages.JsonDeletePrivateMessagePage;
|
||||||
import se.su.dsv.scipro.json.pages.JsonDeleteRecipientPage;
|
import se.su.dsv.scipro.json.pages.JsonDeleteRecipientPage;
|
||||||
import se.su.dsv.scipro.json.pages.JsonLoginPage;
|
import se.su.dsv.scipro.json.pages.JsonLoginPage;
|
||||||
@ -50,6 +52,18 @@ import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|||||||
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;
|
||||||
|
import se.su.dsv.scipro.peer.pages.PeerRequestSubmissionPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.PeerReviewTemplateCreationPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.PeerReviewTemplatePage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.PeerReviewTemplatePreviewPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.ProjectPeerPortalPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewGuidePage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.ProjectPeerStatsPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.SupervisorPeerPortalPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewGuidePage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.SupervisorPeerStatsPage;
|
||||||
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;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectEventPage;
|
import se.su.dsv.scipro.project.pages.ProjectEventPage;
|
||||||
@ -200,6 +214,7 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
/*
|
/*
|
||||||
* Project pages
|
* Project pages
|
||||||
*/
|
*/
|
||||||
|
mountBookmarkablePage("project/conference", ProjectConferencePage.class);
|
||||||
mountBookmarkablePage("project/schedule/event", ProjectEventPage.class);
|
mountBookmarkablePage("project/schedule/event", ProjectEventPage.class);
|
||||||
mountBookmarkablePage("project/schedule/generator", ProjectScheduleGeneratorPage.class);
|
mountBookmarkablePage("project/schedule/generator", ProjectScheduleGeneratorPage.class);
|
||||||
mountBookmarkablePage("project/files", ProjectFilePage.class);
|
mountBookmarkablePage("project/files", ProjectFilePage.class);
|
||||||
@ -223,12 +238,13 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
mountBookmarkablePage("supervisor/schedule/groupevent", SupervisorGroupEventPage.class);
|
mountBookmarkablePage("supervisor/schedule/groupevent", SupervisorGroupEventPage.class);
|
||||||
mountBookmarkablePage("supervisor/project/details/schedule/generator", SupervisorScheduleGeneratorPage.class);
|
mountBookmarkablePage("supervisor/project/details/schedule/generator", SupervisorScheduleGeneratorPage.class);
|
||||||
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
||||||
|
mountBookmarkablePage("supervisor/conference", SupervisorConferencePage.class);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Peer pages
|
* Peer pages
|
||||||
*/
|
*/
|
||||||
/* TODO Removed for deployment-test
|
|
||||||
//admin
|
//admin
|
||||||
mountBookmarkablePage("peer/review/template/preview", PeerReviewTemplatePreviewPage.class);
|
mountBookmarkablePage("peer/review/template/preview", PeerReviewTemplatePreviewPage.class);
|
||||||
mountBookmarkablePage("peer/templates/create", PeerReviewTemplateCreationPage.class);
|
mountBookmarkablePage("peer/templates/create", PeerReviewTemplateCreationPage.class);
|
||||||
|
@ -19,8 +19,20 @@
|
|||||||
<td><input name="3" wicket:id="daysBeforeFinalSeminarCanRegisterAsOpponent" type="text" /></td>
|
<td><input name="3" wicket:id="daysBeforeFinalSeminarCanRegisterAsOpponent" type="text" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for="4">File format of uploaded theses and opposition-reports must be PDF:</label></td>
|
<td><label for="4">Turnitin username (should be an instructor with quick submit activated):</label></td>
|
||||||
<td><input name="4" type="checkbox" wicket:id="finalSeminarThesisMustBeAPDF" /></td>
|
<td><input name="4" wicket:id="turnItInUsername" type="text" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="5">Forname for Turnitin user:</label></td>
|
||||||
|
<td><input name="5" wicket:id="turnItInForname" type="text" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="6">Surname for Turnitin user:</label></td>
|
||||||
|
<td><input name="6" wicket:id=turnItInSurname type="text" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="7">File format of uploaded theses and opposition-reports must be PDF:</label></td>
|
||||||
|
<td><input name="7" type="checkbox" wicket:id="finalSeminarThesisMustBeAPDF" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package se.su.dsv.scipro.admin.pages.settings;
|
|||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.markup.html.form.CheckBox;
|
import org.apache.wicket.markup.html.form.CheckBox;
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
|
import org.apache.wicket.markup.html.form.PasswordTextField;
|
||||||
import org.apache.wicket.markup.html.form.RequiredTextField;
|
import org.apache.wicket.markup.html.form.RequiredTextField;
|
||||||
import org.apache.wicket.markup.html.form.TextField;
|
import org.apache.wicket.markup.html.form.TextField;
|
||||||
import org.apache.wicket.model.CompoundPropertyModel;
|
import org.apache.wicket.model.CompoundPropertyModel;
|
||||||
@ -28,16 +29,22 @@ public class AdminFinalSeminarSettingsPage extends AbstractAdminSettingsPage {
|
|||||||
|
|
||||||
private class FinalSeminarSettingsForm extends Form<GeneralSystemSettings> {
|
private class FinalSeminarSettingsForm extends Form<GeneralSystemSettings> {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public FinalSeminarSettingsForm(String id, IModel<GeneralSystemSettings> model) {
|
public FinalSeminarSettingsForm(String id, IModel<GeneralSystemSettings> model) {
|
||||||
super(id, model );
|
super(id, model );
|
||||||
TextField<Integer> activeParticipation = new RequiredTextField<Integer>("finalSeminarMaxActiveParticipants");
|
TextField<Integer> activeParticipation = new RequiredTextField<Integer>("finalSeminarMaxActiveParticipants");
|
||||||
TextField<Integer> registerAsActive = new RequiredTextField<Integer>("daysBeforeFinalSeminarCanRegisterAsActiveParticipant");
|
TextField<Integer> registerAsActive = new RequiredTextField<Integer>("daysBeforeFinalSeminarCanRegisterAsActiveParticipant");
|
||||||
TextField<Integer> registerAsOpponent = new RequiredTextField<Integer>("daysBeforeFinalSeminarCanRegisterAsOpponent");
|
TextField<Integer> registerAsOpponent = new RequiredTextField<Integer>("daysBeforeFinalSeminarCanRegisterAsOpponent");
|
||||||
|
TextField<String> turnitinUsername = new RequiredTextField<String>("turnItInUsername");
|
||||||
|
TextField<String> turnitinForname = new RequiredTextField<String>("turnItInForname");
|
||||||
|
TextField<String> turnitinSurname = new RequiredTextField<String>("turnItInSurname");
|
||||||
CheckBox pdfCheckBox = new CheckBox("finalSeminarThesisMustBeAPDF");
|
CheckBox pdfCheckBox = new CheckBox("finalSeminarThesisMustBeAPDF");
|
||||||
add(registerAsActive);
|
add(registerAsActive);
|
||||||
add(registerAsOpponent);
|
add(registerAsOpponent);
|
||||||
add(activeParticipation);
|
add(activeParticipation);
|
||||||
|
add(turnitinUsername);
|
||||||
|
add(turnitinForname);
|
||||||
|
add(turnitinSurname);
|
||||||
add(pdfCheckBox);
|
add(pdfCheckBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,44 @@
|
|||||||
<html
|
<html
|
||||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||||
<body>
|
<body>
|
||||||
<wicket:extend>
|
<wicket:extend>
|
||||||
<h1>General Settings</h1>
|
<h5 class="peer-title">General Settings</h5>
|
||||||
</wicket:extend>
|
<form wicket:id="finalSeminarSettingsForm">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><label for="1">Sender name for e-mail
|
||||||
|
notifications:</label>
|
||||||
|
</td>
|
||||||
|
<td><input name="1" wicket:id="mailFromName" type="text" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="2">Sender address for e-mail
|
||||||
|
notifications:</label>
|
||||||
|
</td>
|
||||||
|
<td><input name="2" wicket:id="systemFromMail" type="text" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="3">SMTP server address:</label>
|
||||||
|
</td>
|
||||||
|
<td><input name="3" wicket:id="smtpServer" type="text" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="7">Enable e-mail notifications:</label>
|
||||||
|
</td>
|
||||||
|
<td><input name="7" type="checkbox" wicket:id="mailNotifications" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<button type="submit">
|
||||||
|
<img src="css/blueprint/plugins/buttons/icons/tick.png" alt="" />
|
||||||
|
Save changes
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</wicket:extend>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,13 +1,50 @@
|
|||||||
package se.su.dsv.scipro.admin.pages.settings;
|
package se.su.dsv.scipro.admin.pages.settings;
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
|
import org.apache.wicket.markup.html.form.CheckBox;
|
||||||
|
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.model.CompoundPropertyModel;
|
||||||
|
import org.apache.wicket.model.IModel;
|
||||||
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
import se.su.dsv.scipro.admin.pages.AbstractAdminSettingsPage;
|
import se.su.dsv.scipro.admin.pages.AbstractAdminSettingsPage;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||||
|
|
||||||
public class AdminGeneralSettingsPage extends AbstractAdminSettingsPage {
|
public class AdminGeneralSettingsPage extends AbstractAdminSettingsPage {
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||||
|
|
||||||
public AdminGeneralSettingsPage(final PageParameters pp) {
|
public AdminGeneralSettingsPage(final PageParameters pp) {
|
||||||
super(pp);
|
super(pp);
|
||||||
|
|
||||||
|
add(new AdminGeneralSettingsForm(
|
||||||
|
"finalSeminarSettingsForm",
|
||||||
|
new CompoundPropertyModel<GeneralSystemSettings>(generalSystemSettingsDao.getGeneralSystemSettingsInstance())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class AdminGeneralSettingsForm extends Form<GeneralSystemSettings> {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public AdminGeneralSettingsForm(String id, IModel<GeneralSystemSettings> model) {
|
||||||
|
super(id, model );
|
||||||
|
TextField<String> mailFromName = new RequiredTextField<String>("mailFromName");
|
||||||
|
TextField<String> systemFromMail = new RequiredTextField<String>("systemFromMail");
|
||||||
|
TextField<String> smtpServer = new RequiredTextField<String>("smtpServer");
|
||||||
|
CheckBox mailNotifications = new CheckBox("mailNotifications");
|
||||||
|
add(mailFromName);
|
||||||
|
add(systemFromMail);
|
||||||
|
add(smtpServer);
|
||||||
|
add(mailNotifications);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSubmit() {
|
||||||
|
setModelObject( generalSystemSettingsDao.save(getModelObject()) );
|
||||||
|
info("General settings saved");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class AdminRolesPanel extends Panel {
|
|||||||
|
|
||||||
searchField.add(userSearchTextBehaviour);
|
searchField.add(userSearchTextBehaviour);
|
||||||
add(searchField);
|
add(searchField);
|
||||||
loadUserDataView(new UserSearchDataProvider(null, null));
|
loadUserDataView(new UserSearchDataProvider(null, null, null));
|
||||||
|
|
||||||
container.add(dataView);
|
container.add(dataView);
|
||||||
add(container);
|
add(container);
|
||||||
@ -123,18 +123,18 @@ public class AdminRolesPanel extends Panel {
|
|||||||
public void checkRole() {
|
public void checkRole() {
|
||||||
switch (selectedRole) {
|
switch (selectedRole) {
|
||||||
case ALL:
|
case ALL:
|
||||||
loadUserDataView(new UserSearchDataProvider(userSearch, null));
|
loadUserDataView(new UserSearchDataProvider(userSearch, null, null));
|
||||||
break;
|
break;
|
||||||
case EMPLOYEE:
|
case EMPLOYEE:
|
||||||
loadUserDataView(new UserSearchDataProvider(userSearch,
|
loadUserDataView(new UserSearchDataProvider(userSearch,
|
||||||
Employee.class));
|
Employee.class, null));
|
||||||
break;
|
break;
|
||||||
case SYSADMIN:
|
case SYSADMIN:
|
||||||
loadUserDataView(new UserSearchDataProvider(userSearch,
|
loadUserDataView(new UserSearchDataProvider(userSearch,
|
||||||
SysAdmin.class));
|
SysAdmin.class, null));
|
||||||
break;
|
break;
|
||||||
case ADMIN:
|
case ADMIN:
|
||||||
loadUserDataView(new UserSearchDataProvider(userSearch, Admin.class));
|
loadUserDataView(new UserSearchDataProvider(userSearch, Admin.class, null));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
<html
|
||||||
|
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||||
<body>
|
<body>
|
||||||
<wicket:panel>
|
<wicket:panel>
|
||||||
<form wicket:id="userSettingsForm">
|
<form wicket:id="userSettingsForm">
|
||||||
<div class="span-10 last">
|
<div class="span-10 last">
|
||||||
<div class="info-box rounded-box span-10 last">If you do not have any projects to choose from, contact your supervisor and ask him/her to register a thesis course for you in Daisy.</div>
|
<div class="info-box rounded-box span-10 last">If you do not
|
||||||
</div>
|
have any projects to choose from, contact your supervisor and ask
|
||||||
<div class="span-10 last">
|
him/her to register a thesis course for you in Daisy.</div>
|
||||||
<label for="activeProject">Active project</label>
|
</div>
|
||||||
<select name="Active project" wicket:id="activeProject" id="activeProject"></select>
|
<div class="span-10 last">
|
||||||
<div>
|
<label for="activeProject">Active project</label> <select
|
||||||
<input type="submit" wicket:id="applyButton" value="Apply">
|
name="Active project" wicket:id="activeProject" id="activeProject"></select>
|
||||||
</div>
|
<div class="span-10 last">
|
||||||
</div>
|
<label>Mail notifications you want</label>
|
||||||
</form>
|
<div wicket:id="notificationPriority"><input type="radio" />
|
||||||
</wicket:panel>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" ><img src="css/blueprint/plugins/buttons/icons/tick.png" alt=""/> Save changes</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</wicket:panel>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -5,13 +5,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
|
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
|
||||||
import org.apache.wicket.markup.html.form.Button;
|
import org.apache.wicket.markup.html.form.Button;
|
||||||
import org.apache.wicket.markup.html.form.DropDownChoice;
|
import org.apache.wicket.markup.html.form.DropDownChoice;
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
import org.apache.wicket.markup.html.form.IChoiceRenderer;
|
import org.apache.wicket.markup.html.form.IChoiceRenderer;
|
||||||
|
import org.apache.wicket.markup.html.form.RadioChoice;
|
||||||
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.CompoundPropertyModel;
|
||||||
|
import org.apache.wicket.model.IModel;
|
||||||
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;
|
||||||
|
|
||||||
@ -20,6 +21,8 @@ import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Martin Peters - mpeters@dsv.su.se
|
* @author Martin Peters - mpeters@dsv.su.se
|
||||||
@ -36,16 +39,18 @@ public class UserSettingsPanel extends Panel {
|
|||||||
|
|
||||||
public UserSettingsPanel(String id) {
|
public UserSettingsPanel(String id) {
|
||||||
super(id);
|
super(id);
|
||||||
|
UserSettings userSettings = userSettingsDao.getUserSettings(SciProSession.get().getUser());
|
||||||
add(new UserSettingsForm("userSettingsForm"));
|
if(userSettings == null)
|
||||||
|
userSettings = new UserSettings(SciProSession.get().getUser());
|
||||||
|
add(new UserSettingsForm("userSettingsForm", new CompoundPropertyModel<UserSettings>(userSettings)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UserSettingsForm extends Form<Void> {
|
private class UserSettingsForm extends Form<UserSettings> {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private Project activeProject;
|
private Project activeProject;
|
||||||
|
|
||||||
public UserSettingsForm(String id) {
|
public UserSettingsForm(String id, IModel<UserSettings> model) {
|
||||||
super(id);
|
super(id, model);
|
||||||
activeProject = SciProSession.get().getActiveProject();
|
activeProject = SciProSession.get().getActiveProject();
|
||||||
|
|
||||||
List<Project> userProjects = new ArrayList<Project>();
|
List<Project> userProjects = new ArrayList<Project>();
|
||||||
@ -67,14 +72,22 @@ public class UserSettingsPanel extends Panel {
|
|||||||
});
|
});
|
||||||
projectChoice.setNullValid(true);
|
projectChoice.setNullValid(true);
|
||||||
add(projectChoice);
|
add(projectChoice);
|
||||||
Button applyButton = new Button("applyButton"){
|
|
||||||
private static final long serialVersionUID = 1L;
|
NotificationPriority[] array = NotificationPriority.values();
|
||||||
@Override
|
|
||||||
public void onSubmit(){
|
List<NotificationPriority> notificationPriorities = new ArrayList<NotificationPriority>(Arrays.asList(array));
|
||||||
setResponsePage(this.getPage().getClass(),this.getPage().getPageParameters());
|
|
||||||
}
|
RadioChoice<NotificationPriority> radioChoice = new RadioChoice<NotificationPriority>("notificationPriority", notificationPriorities );
|
||||||
};
|
add(radioChoice);
|
||||||
add(applyButton);
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubmit(){
|
||||||
|
userSettingsDao.save(getModelObject());
|
||||||
|
setResponsePage(this.getPage().getClass(),this.getPage().getPageParameters());
|
||||||
}
|
}
|
||||||
}//UserSettingsForm
|
}//UserSettingsForm
|
||||||
|
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
<div wicket:id="container" class="prepend-top last">
|
|
||||||
<div class="comment last" wicket:id="comment">
|
|
||||||
<div class="comment-header last">
|
|
||||||
<div class="last">
|
|
||||||
<span wicket:id="from" class="comment-posted-by">Dan Kjellman</span>
|
|
||||||
</div>
|
|
||||||
<div class="last">
|
|
||||||
<span class="comment-posted-date">Posted: </span>
|
|
||||||
<span wicket:id="date" class="comment-posted-date"></span>
|
|
||||||
<a href="#" wicket:id="editComment">
|
|
||||||
<img class="icon-12" src="images/icons/edit_16x16.png" " alt="Edit" title="Edit" />
|
|
||||||
<span class="small"> Edit</span>
|
|
||||||
</a>
|
|
||||||
<a href="#" wicket:id="deleteComment">
|
|
||||||
<img class="icon-12" src="images/icons/delete_16x16.png" alt="Delete" title="Delete" />
|
|
||||||
<span class="small"> Delete</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="comment-bottom-border last"></div>
|
|
||||||
<div class="comment-area last">
|
|
||||||
<p wicket:id="message">This is the comment</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div wicket:id="navigator" class="comment-pager last"></div>
|
|
||||||
</div>
|
|
||||||
<div class="last comment-form">
|
|
||||||
<form wicket:id="commentForm">
|
|
||||||
<div class="last">
|
|
||||||
<strong>Comment:</strong>
|
|
||||||
</div>
|
|
||||||
<div class="last">
|
|
||||||
<textarea wicket:id="textMessage" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="last">
|
|
||||||
<button wicket:id="submitButton" class="button">Submit comment
|
|
||||||
<img src="images/icons/chat_16x16.png" alt=""/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div wicket:id="dialog">
|
|
||||||
<div wicket:id="dialogContainer" class="comment-form">
|
|
||||||
<form wicket:id="editCommentForm">
|
|
||||||
<div>
|
|
||||||
<textarea wicket:id="editTextMessage" ></textarea>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button wicket:id="submitButton" class="button">Save
|
|
||||||
<img src="css/blueprint/plugins/buttons/icons/tick.png" alt=""/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</wicket:panel>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,298 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.commentthread.panel;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
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.basic.MultiLineLabel;
|
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
|
||||||
import org.apache.wicket.markup.html.form.TextArea;
|
|
||||||
import org.apache.wicket.markup.html.list.ListItem;
|
|
||||||
import org.apache.wicket.markup.html.list.PageableListView;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.model.IModel;
|
|
||||||
import org.apache.wicket.model.Model;
|
|
||||||
import org.apache.wicket.model.PropertyModel;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
|
||||||
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CommentDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CommentThreadDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Comment;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.CommentThread;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
|
||||||
import se.su.dsv.scipro.message.panels.CustomPagingNavigator;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CommentThreadPanel extends Panel {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private CommentThreadDao commentThreadDao;
|
|
||||||
@SpringBean
|
|
||||||
private CommentDao commentDao;
|
|
||||||
|
|
||||||
private WebMarkupContainer webMarkupContainer;
|
|
||||||
|
|
||||||
private PageableListView<Comment> commentListView;
|
|
||||||
private CustomPagingNavigator customPagingNavigator;
|
|
||||||
private int numberOfComments;
|
|
||||||
private TextArea<String> textArea;
|
|
||||||
private WebMarkupContainer dialogContainer;
|
|
||||||
private Dialog dialog;
|
|
||||||
private final IModel<CommentThread> threadModel;
|
|
||||||
private final EditCommentForm editCommentForm;
|
|
||||||
|
|
||||||
public CommentThreadPanel(final String id, final Commentable keyObject, final int numberOfComments) {
|
|
||||||
super(id);
|
|
||||||
|
|
||||||
final String className = keyObject.getCommentKey();
|
|
||||||
final Long classId = keyObject.getId();
|
|
||||||
|
|
||||||
this.numberOfComments = numberOfComments;
|
|
||||||
|
|
||||||
CommentThread commentThread = commentThreadDao.getCommentThread(keyObject);
|
|
||||||
if (commentThread == null) {
|
|
||||||
//TODO rewrite so thread is only created on demand, ie when someone's posted
|
|
||||||
CommentThread ct = new CommentThread(keyObject);
|
|
||||||
commentThread = commentThreadDao.save(ct);
|
|
||||||
}
|
|
||||||
|
|
||||||
threadModel = new DomainObjectDetachableModel<CommentThread>(commentThreadDao, commentThread);
|
|
||||||
|
|
||||||
webMarkupContainer = new WebMarkupContainer("container");
|
|
||||||
webMarkupContainer.setOutputMarkupId(true);
|
|
||||||
generateCommentListView();
|
|
||||||
webMarkupContainer.add(commentListView);
|
|
||||||
add(webMarkupContainer);
|
|
||||||
webMarkupContainer.add(customPagingNavigator);
|
|
||||||
|
|
||||||
Comment newComment = new Comment( SciProSession.get().getUser(), commentThread );
|
|
||||||
add(new CommentForm("commentForm", new Model<Comment>(newComment)));
|
|
||||||
|
|
||||||
dialogContainer = new WebMarkupContainer("dialogContainer");
|
|
||||||
dialog = new Dialog("dialog");
|
|
||||||
dialog.setModal(true);
|
|
||||||
dialog.setAutoOpen(false);
|
|
||||||
dialog.setWidth(470);
|
|
||||||
dialog.add(dialogContainer);
|
|
||||||
add(dialog);
|
|
||||||
|
|
||||||
dialogContainer.setOutputMarkupId(true);
|
|
||||||
editCommentForm = new EditCommentForm("editCommentForm", new DomainObjectDetachableModel<Comment>(commentDao, new Comment()) );
|
|
||||||
dialogContainer.add(editCommentForm);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateCommentListView() {
|
|
||||||
threadModel.detach(); //Forces reinit of model object so collection is attached to session, ugly solution, don't copy..
|
|
||||||
List<Comment> commentList = threadModel.getObject().getCommentsList();
|
|
||||||
|
|
||||||
commentListView = new PageableListView<Comment>("comment", commentList, numberOfComments) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateItem(final ListItem<Comment> item) {
|
|
||||||
final Comment c = item.getModelObject();
|
|
||||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
||||||
item.add(new Label("date", df.format(c.getDateCreated())));
|
|
||||||
item.add( c.getCreator().getDisplayComponent("from") );
|
|
||||||
item.add(new MultiLineLabel("message", new PropertyModel<String>(item.getDefaultModel(), "comment")).setEnabled(false));
|
|
||||||
item.add(new CommentDeleteLink("deleteComment", c));
|
|
||||||
item.add(new CommentEditLink("editComment", c));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
customPagingNavigator = new CustomPagingNavigator("navigator", commentListView) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVisible() {
|
|
||||||
return commentListView.size() > 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CommentForm extends Form<Comment> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public CommentForm(final String id, final IModel<Comment> commentModel) {
|
|
||||||
super(id, commentModel);
|
|
||||||
|
|
||||||
textArea = new TextArea<String>("textMessage",new PropertyModel<String>(commentModel,"comment"));
|
|
||||||
textArea.setOutputMarkupId(true);
|
|
||||||
add(textArea);
|
|
||||||
AjaxButton ajaxButton = new AjaxButton("submitButton", new Model<String>("Submit Comment")) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
|
|
||||||
Comment comment = (Comment) form.getDefaultModelObject();
|
|
||||||
comment = commentDao.save(comment);
|
|
||||||
/*
|
|
||||||
* Do not, on purpose set the forms defaultModelObject to the now persisted object,
|
|
||||||
* we leave the original object so it can be re reused for any number of submits
|
|
||||||
* *
|
|
||||||
*/
|
|
||||||
|
|
||||||
webMarkupContainer.remove(commentListView);
|
|
||||||
webMarkupContainer.remove(customPagingNavigator);
|
|
||||||
textArea.setDefaultModelObject("");
|
|
||||||
generateCommentListView();
|
|
||||||
webMarkupContainer.add(commentListView);
|
|
||||||
webMarkupContainer.add(customPagingNavigator);
|
|
||||||
target.addComponent(textArea);
|
|
||||||
target.addComponent(webMarkupContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
ajaxButton.setOutputMarkupId(true);
|
|
||||||
add(ajaxButton);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CommentDeleteLink extends AjaxLink<Comment> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 5900025667153930797L;
|
|
||||||
private Comment comment;
|
|
||||||
|
|
||||||
public CommentDeleteLink(String id, Comment comment) {
|
|
||||||
super(id);
|
|
||||||
this.comment = comment;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVisible() {
|
|
||||||
SciProSession session = SciProSession.get();
|
|
||||||
if( session.authorizedForRole(Roles.ADMIN) )
|
|
||||||
return true;
|
|
||||||
if( comment.getCreator().equals( session.getUser() ) )
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
|
|
||||||
comment = commentDao.reLoad(comment);
|
|
||||||
comment.getCommentThread().getComments().remove(comment);
|
|
||||||
commentDao.delete(comment);
|
|
||||||
|
|
||||||
webMarkupContainer.remove(commentListView);
|
|
||||||
webMarkupContainer.remove(customPagingNavigator);
|
|
||||||
generateCommentListView();
|
|
||||||
webMarkupContainer.add(commentListView);
|
|
||||||
webMarkupContainer.add(customPagingNavigator);
|
|
||||||
target.addComponent(webMarkupContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CommentEditLink extends AjaxLink<Comment> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 5900025667153930797L;
|
|
||||||
private final Comment comment;
|
|
||||||
|
|
||||||
public CommentEditLink(final String id, final Comment comment) {
|
|
||||||
super(id);
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVisible() {
|
|
||||||
SciProSession session = SciProSession.get();
|
|
||||||
if( session.authorizedForRole(Roles.ADMIN) )
|
|
||||||
return true;
|
|
||||||
if( comment.getCreator().equals( session.getUser() ) )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
editCommentForm.setDefaultModelObject( comment );
|
|
||||||
//editCommentForm.setTextAreaDefaultModelObject( comment.getComment());
|
|
||||||
/*
|
|
||||||
* TODO Investigate bug that occurs when this panel gets hidden and re-shown
|
|
||||||
* in resources-view, edit-text-area displays text from the wrong model-object.
|
|
||||||
*/
|
|
||||||
dialog.open(target);
|
|
||||||
target.addComponent(dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class EditCommentForm extends Form<Comment> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private final TextArea<String> editTextArea;
|
|
||||||
|
|
||||||
public EditCommentForm(final String id, final IModel<Comment> commentModel) {
|
|
||||||
super(id,commentModel);
|
|
||||||
|
|
||||||
editTextArea = new TextArea<String>("editTextMessage",new PropertyModel<String>(commentModel,"comment"));
|
|
||||||
editTextArea.setOutputMarkupId(true);
|
|
||||||
add(editTextArea);
|
|
||||||
dialog.setTitle("Edit Comment");
|
|
||||||
|
|
||||||
AjaxButton ajaxButton = new AjaxButton("submitButton", new Model<String>("Save")) {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
//DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
//Date date = new Date();
|
|
||||||
//df.format(date)
|
|
||||||
//editComment.setComment(((CommentThreadModel) form.getModelObject()).getEditTextMessage() + "\n\nLast edited: " +df.format(date) + " by: " + user.getFirstName() + " " + user.getLastName()) ;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* !!! We do not have to explicitly save object! It is currently being persisted by cascade!
|
|
||||||
*/
|
|
||||||
|
|
||||||
webMarkupContainer.remove(commentListView);
|
|
||||||
webMarkupContainer.remove(customPagingNavigator);
|
|
||||||
generateCommentListView();
|
|
||||||
webMarkupContainer.add(commentListView);
|
|
||||||
webMarkupContainer.add(customPagingNavigator);
|
|
||||||
dialog.close(target);
|
|
||||||
target.addComponent(webMarkupContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
ajaxButton.setOutputMarkupId(true);
|
|
||||||
add(ajaxButton);
|
|
||||||
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Attempt to fix weird incorrect-updating of text-area content when panel is used in resources-view
|
|
||||||
*/
|
|
||||||
public void setTextAreaDefaultModelObject(String string){
|
|
||||||
editTextArea.setDefaultModelObject(string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -6,6 +6,8 @@ package se.su.dsv.scipro.commentthread.panels;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||||
@ -25,14 +27,20 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
|
|||||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
import se.su.dsv.scipro.SciProSession;
|
||||||
|
import se.su.dsv.scipro.conference.model.SubscriberModel;
|
||||||
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationMessage;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CommentDao;
|
import se.su.dsv.scipro.data.dao.interfaces.CommentDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CommentThreadDao;
|
import se.su.dsv.scipro.data.dao.interfaces.CommentThreadDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Comment;
|
import se.su.dsv.scipro.data.dataobjects.Comment;
|
||||||
import se.su.dsv.scipro.data.dataobjects.CommentThread;
|
import se.su.dsv.scipro.data.dataobjects.CommentThread;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
import se.su.dsv.scipro.message.panels.CustomPagingNavigator;
|
import se.su.dsv.scipro.message.panels.CustomPagingNavigator;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
import se.su.dsv.scipro.util.PropsUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
@ -41,11 +49,13 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
|||||||
public class CommentThreadPanel extends Panel {
|
public class CommentThreadPanel extends Panel {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private CommentThreadDao commentThreadDao;
|
private CommentThreadDao commentThreadDao;
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private CommentDao commentDao;
|
private CommentDao commentDao;
|
||||||
|
@SpringBean
|
||||||
|
private NotificationController notificationController;
|
||||||
|
|
||||||
private WebMarkupContainer webMarkupContainer;
|
private WebMarkupContainer webMarkupContainer;
|
||||||
|
|
||||||
@ -57,23 +67,32 @@ public class CommentThreadPanel extends Panel {
|
|||||||
private Dialog dialog;
|
private Dialog dialog;
|
||||||
private final IModel<CommentThread> threadModel;
|
private final IModel<CommentThread> threadModel;
|
||||||
private final EditCommentForm editCommentForm;
|
private final EditCommentForm editCommentForm;
|
||||||
|
private final Set<SubscriberModel> subscriberModels;
|
||||||
|
private final String title;
|
||||||
|
private final Long classId;
|
||||||
|
|
||||||
public CommentThreadPanel(final String id, final Commentable keyObject, final int numberOfComments) {
|
public CommentThreadPanel(final String id, final Commentable keyObject,
|
||||||
|
final int numberOfComments, final Set<SubscriberModel> subscriberModels,
|
||||||
|
final String title) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|
||||||
final String className = keyObject.getCommentKey();
|
final String className = keyObject.getCommentKey();
|
||||||
final Long classId = keyObject.getId();
|
classId = keyObject.getId();
|
||||||
|
|
||||||
|
this.subscriberModels = subscriberModels;
|
||||||
this.numberOfComments = numberOfComments;
|
this.numberOfComments = numberOfComments;
|
||||||
|
this.title = title;
|
||||||
|
|
||||||
CommentThread commentThread = commentThreadDao.getCommentThread(keyObject);
|
CommentThread commentThread = commentThreadDao.getCommentThread(keyObject);
|
||||||
if (commentThread == null) {
|
if (commentThread == null) {
|
||||||
//TODO rewrite so thread is only created on demand, ie when someone's posted
|
// TODO rewrite so thread is only created on demand, ie when
|
||||||
|
// someone's posted
|
||||||
CommentThread ct = new CommentThread(keyObject);
|
CommentThread ct = new CommentThread(keyObject);
|
||||||
commentThread = commentThreadDao.save(ct);
|
commentThread = commentThreadDao.save(ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
threadModel = new DomainObjectDetachableModel<CommentThread>(commentThreadDao, commentThread);
|
threadModel = new DomainObjectDetachableModel<CommentThread>(commentThreadDao,
|
||||||
|
commentThread);
|
||||||
|
|
||||||
webMarkupContainer = new WebMarkupContainer("container");
|
webMarkupContainer = new WebMarkupContainer("container");
|
||||||
webMarkupContainer.setOutputMarkupId(true);
|
webMarkupContainer.setOutputMarkupId(true);
|
||||||
@ -81,10 +100,10 @@ public class CommentThreadPanel extends Panel {
|
|||||||
webMarkupContainer.add(commentListView);
|
webMarkupContainer.add(commentListView);
|
||||||
add(webMarkupContainer);
|
add(webMarkupContainer);
|
||||||
webMarkupContainer.add(customPagingNavigator);
|
webMarkupContainer.add(customPagingNavigator);
|
||||||
|
|
||||||
Comment newComment = new Comment( SciProSession.get().getUser(), commentThread );
|
Comment newComment = new Comment(SciProSession.get().getUser(), commentThread);
|
||||||
add(new CommentForm("commentForm", new Model<Comment>(newComment)));
|
add(new CommentForm("commentForm", new Model<Comment>(newComment)));
|
||||||
|
|
||||||
dialogContainer = new WebMarkupContainer("dialogContainer");
|
dialogContainer = new WebMarkupContainer("dialogContainer");
|
||||||
dialog = new Dialog("dialog");
|
dialog = new Dialog("dialog");
|
||||||
dialog.setModal(true);
|
dialog.setModal(true);
|
||||||
@ -94,15 +113,23 @@ public class CommentThreadPanel extends Panel {
|
|||||||
add(dialog);
|
add(dialog);
|
||||||
|
|
||||||
dialogContainer.setOutputMarkupId(true);
|
dialogContainer.setOutputMarkupId(true);
|
||||||
editCommentForm = new EditCommentForm("editCommentForm", new DomainObjectDetachableModel<Comment>(commentDao, new Comment()) );
|
editCommentForm = new EditCommentForm("editCommentForm",
|
||||||
|
new DomainObjectDetachableModel<Comment>(commentDao, new Comment()));
|
||||||
dialogContainer.add(editCommentForm);
|
dialogContainer.add(editCommentForm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CommentThreadPanel(final String id, final Commentable keyObject,
|
||||||
|
final int numberOfComments) {
|
||||||
|
this(id, keyObject, numberOfComments, null, "");
|
||||||
|
}
|
||||||
|
|
||||||
private void generateCommentListView() {
|
private void generateCommentListView() {
|
||||||
threadModel.detach(); //Forces reinit of model object so collection is attached to session, ugly solution, don't copy..
|
threadModel.detach(); // Forces reinit of model object so collection is
|
||||||
|
// attached to session, ugly solution, don't
|
||||||
|
// copy..
|
||||||
List<Comment> commentList = threadModel.getObject().getCommentsList();
|
List<Comment> commentList = threadModel.getObject().getCommentsList();
|
||||||
|
|
||||||
commentListView = new PageableListView<Comment>("comment", commentList, numberOfComments) {
|
commentListView = new PageableListView<Comment>("comment", commentList, numberOfComments) {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -112,13 +139,14 @@ public class CommentThreadPanel extends Panel {
|
|||||||
final Comment c = item.getModelObject();
|
final Comment c = item.getModelObject();
|
||||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
item.add(new Label("date", df.format(c.getDateCreated())));
|
item.add(new Label("date", df.format(c.getDateCreated())));
|
||||||
item.add( c.getCreator().getDisplayComponent("from") );
|
item.add(c.getCreator().getDisplayComponent("from"));
|
||||||
item.add(new MultiLineLabel("message", new PropertyModel<String>(item.getDefaultModel(), "comment")).setEnabled(false));
|
item.add(new MultiLineLabel("message", new PropertyModel<String>(item
|
||||||
|
.getDefaultModel(), "comment")).setEnabled(false));
|
||||||
item.add(new CommentDeleteLink("deleteComment", c));
|
item.add(new CommentDeleteLink("deleteComment", c));
|
||||||
item.add(new CommentEditLink("editComment", c));
|
item.add(new CommentEditLink("editComment", c));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
customPagingNavigator = new CustomPagingNavigator("navigator", commentListView) {
|
customPagingNavigator = new CustomPagingNavigator("navigator", commentListView) {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -137,10 +165,12 @@ public class CommentThreadPanel extends Panel {
|
|||||||
public CommentForm(final String id, final IModel<Comment> commentModel) {
|
public CommentForm(final String id, final IModel<Comment> commentModel) {
|
||||||
super(id, commentModel);
|
super(id, commentModel);
|
||||||
|
|
||||||
textArea = new TextArea<String>("textMessage",new PropertyModel<String>(commentModel,"comment"));
|
textArea = new TextArea<String>("textMessage", new PropertyModel<String>(commentModel,
|
||||||
|
"comment"));
|
||||||
textArea.setOutputMarkupId(true);
|
textArea.setOutputMarkupId(true);
|
||||||
add(textArea);
|
add(textArea);
|
||||||
AjaxButton ajaxButton = new AjaxButton("submitButton", new Model<String>("Submit Comment")) {
|
AjaxButton ajaxButton = new AjaxButton("submitButton", new Model<String>(
|
||||||
|
"Submit Comment")) {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -149,12 +179,19 @@ public class CommentThreadPanel extends Panel {
|
|||||||
|
|
||||||
Comment comment = (Comment) form.getDefaultModelObject();
|
Comment comment = (Comment) form.getDefaultModelObject();
|
||||||
comment = commentDao.save(comment);
|
comment = commentDao.save(comment);
|
||||||
|
System.out.println(subscriberModels);
|
||||||
|
if (subscriberModels != null) {
|
||||||
|
for (SubscriberModel sm : subscriberModels) {
|
||||||
|
createNotification(sm.getUser(), comment.getComment(),
|
||||||
|
sm.getNotificationPriority(), sm.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Do not, on purpose set the forms defaultModelObject to the now persisted object,
|
* Do not, on purpose set the forms defaultModelObject to
|
||||||
* we leave the original object so it can be re reused for any number of submits
|
* the now persisted object, we leave the original object so
|
||||||
* *
|
* it can be re reused for any number of submits *
|
||||||
*/
|
*/
|
||||||
|
|
||||||
webMarkupContainer.remove(commentListView);
|
webMarkupContainer.remove(commentListView);
|
||||||
webMarkupContainer.remove(customPagingNavigator);
|
webMarkupContainer.remove(customPagingNavigator);
|
||||||
textArea.setDefaultModelObject("");
|
textArea.setDefaultModelObject("");
|
||||||
@ -186,7 +223,7 @@ public class CommentThreadPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
SciProSession session = SciProSession.get();
|
SciProSession session = SciProSession.get();
|
||||||
if( session.authorizedForRole(Roles.ADMIN) )
|
if (session.authorizedForRole(Roles.ADMIN))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -194,11 +231,10 @@ public class CommentThreadPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
|
||||||
comment = commentDao.reLoad(comment);
|
comment = commentDao.reLoad(comment);
|
||||||
comment.getCommentThread().getComments().remove(comment);
|
comment.getCommentThread().getComments().remove(comment);
|
||||||
commentDao.delete(comment);
|
commentDao.delete(comment);
|
||||||
|
|
||||||
webMarkupContainer.remove(commentListView);
|
webMarkupContainer.remove(commentListView);
|
||||||
webMarkupContainer.remove(customPagingNavigator);
|
webMarkupContainer.remove(customPagingNavigator);
|
||||||
generateCommentListView();
|
generateCommentListView();
|
||||||
@ -222,19 +258,21 @@ public class CommentThreadPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
SciProSession session = SciProSession.get();
|
SciProSession session = SciProSession.get();
|
||||||
if( session.authorizedForRole(Roles.ADMIN) )
|
if (session.authorizedForRole(Roles.ADMIN))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
editCommentForm.setDefaultModelObject( comment );
|
editCommentForm.setDefaultModelObject(comment);
|
||||||
//editCommentForm.setTextAreaDefaultModelObject( comment.getComment());
|
// editCommentForm.setTextAreaDefaultModelObject(
|
||||||
|
// comment.getComment());
|
||||||
/*
|
/*
|
||||||
* TODO Investigate bug that occurs when this panel gets hidden and re-shown
|
* TODO Investigate bug that occurs when this panel gets hidden and
|
||||||
* in resources-view, edit-text-area displays text from the wrong model-object.
|
* re-shown in resources-view, edit-text-area displays text from the
|
||||||
|
* wrong model-object.
|
||||||
*/
|
*/
|
||||||
dialog.open(target);
|
dialog.open(target);
|
||||||
target.addComponent(dialog);
|
target.addComponent(dialog);
|
||||||
@ -245,29 +283,35 @@ public class CommentThreadPanel extends Panel {
|
|||||||
private class EditCommentForm extends Form<Comment> {
|
private class EditCommentForm extends Form<Comment> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final TextArea<String> editTextArea;
|
private final TextArea<String> editTextArea;
|
||||||
|
|
||||||
public EditCommentForm(final String id, final IModel<Comment> commentModel) {
|
public EditCommentForm(final String id, final IModel<Comment> commentModel) {
|
||||||
super(id,commentModel);
|
super(id, commentModel);
|
||||||
|
|
||||||
editTextArea = new TextArea<String>("editTextMessage",new PropertyModel<String>(commentModel,"comment"));
|
editTextArea = new TextArea<String>("editTextMessage", new PropertyModel<String>(
|
||||||
|
commentModel, "comment"));
|
||||||
editTextArea.setOutputMarkupId(true);
|
editTextArea.setOutputMarkupId(true);
|
||||||
add(editTextArea);
|
add(editTextArea);
|
||||||
dialog.setTitle("Edit Comment");
|
dialog.setTitle("Edit Comment");
|
||||||
|
|
||||||
AjaxButton ajaxButton = new AjaxButton("submitButton", new Model<String>("Save")) {
|
AjaxButton ajaxButton = new AjaxButton("submitButton", new Model<String>("Save")) {
|
||||||
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) {
|
||||||
//DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
// DateFormat df = new
|
||||||
//Date date = new Date();
|
// SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
//df.format(date)
|
// Date date = new Date();
|
||||||
//editComment.setComment(((CommentThreadModel) form.getModelObject()).getEditTextMessage() + "\n\nLast edited: " +df.format(date) + " by: " + user.getFirstName() + " " + user.getLastName()) ;
|
// df.format(date)
|
||||||
|
// editComment.setComment(((CommentThreadModel)
|
||||||
|
// form.getModelObject()).getEditTextMessage() +
|
||||||
|
// "\n\nLast edited: " +df.format(date) + " by: " +
|
||||||
|
// user.getFirstName() + " " + user.getLastName()) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !!! We do not have to explicitly save object! It is currently being persisted by cascade!
|
* !!! We do not have to explicitly save object! It is
|
||||||
|
* currently being persisted by cascade!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
webMarkupContainer.remove(commentListView);
|
webMarkupContainer.remove(commentListView);
|
||||||
@ -282,14 +326,41 @@ public class CommentThreadPanel extends Panel {
|
|||||||
};
|
};
|
||||||
ajaxButton.setOutputMarkupId(true);
|
ajaxButton.setOutputMarkupId(true);
|
||||||
add(ajaxButton);
|
add(ajaxButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to fix weird incorrect-updating of text-area content when panel is used in resources-view
|
* Attempt to fix weird incorrect-updating of text-area content when
|
||||||
|
* panel is used in resources-view
|
||||||
*/
|
*/
|
||||||
public void setTextAreaDefaultModelObject(String string){
|
public void setTextAreaDefaultModelObject(String string) {
|
||||||
editTextArea.setDefaultModelObject(string);
|
editTextArea.setDefaultModelObject(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createNotification(final User user, final String message,
|
||||||
|
final NotificationPriority notificationPriority, final String absolutePath) {
|
||||||
|
|
||||||
|
Properties props = null;
|
||||||
|
try {
|
||||||
|
props = PropsUtils.load("notification.properties");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String mailSubject = props.getProperty("mailSubject");
|
||||||
|
String conferenceNotification = props.getProperty("conferenceNotificationComment");
|
||||||
|
String twoNewLines = props.getProperty("twoNewLines");
|
||||||
|
|
||||||
|
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
|
||||||
|
+ title;
|
||||||
|
|
||||||
|
String mailMessage = webNotificationMessage + twoNewLines + message;
|
||||||
|
|
||||||
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
|
mailSubject, mailMessage);
|
||||||
|
notificationController.processNotification(user, notificationMessage, absolutePath+"&"+classId
|
||||||
|
,
|
||||||
|
notificationPriority);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.conference.model;
|
||||||
|
|
||||||
|
import org.apache.wicket.IClusterable;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan <aschan@dsv.su.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SubscriberModel implements IClusterable{
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private User user;
|
||||||
|
private String absolutePath;
|
||||||
|
private NotificationPriority notificationPriority;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param user
|
||||||
|
* @param absolutePath
|
||||||
|
* @param notificationPriority
|
||||||
|
*/
|
||||||
|
public SubscriberModel(User user, String absolutePath, NotificationPriority notificationPriority) {
|
||||||
|
super();
|
||||||
|
this.user = user;
|
||||||
|
this.absolutePath = absolutePath;
|
||||||
|
this.notificationPriority = notificationPriority;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the user
|
||||||
|
*/
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param user the user to set
|
||||||
|
*/
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the absolutePath
|
||||||
|
*/
|
||||||
|
public String getAbsolutePath() {
|
||||||
|
return absolutePath;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param absolutePath the absolutePath to set
|
||||||
|
*/
|
||||||
|
public void setAbsolutePath(String absolutePath) {
|
||||||
|
this.absolutePath = absolutePath;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the notificationPriority
|
||||||
|
*/
|
||||||
|
public NotificationPriority getNotificationPriority() {
|
||||||
|
return notificationPriority;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param notificationPriority the notificationPriority to set
|
||||||
|
*/
|
||||||
|
public void setNotificationPriority(NotificationPriority notificationPriority) {
|
||||||
|
this.notificationPriority = notificationPriority;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<!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:extend>
|
||||||
|
<div wicket:id="conferencePanel"></div>
|
||||||
|
</wicket:extend>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,172 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.conference.pages;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.apache.wicket.PageParameters;
|
||||||
|
import org.apache.wicket.RequestCycle;
|
||||||
|
import org.apache.wicket.RestartResponseException;
|
||||||
|
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||||
|
import org.apache.wicket.model.IModel;
|
||||||
|
import org.apache.wicket.model.LoadableDetachableModel;
|
||||||
|
import org.apache.wicket.protocol.http.RequestUtils;
|
||||||
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.SciProApplication;
|
||||||
|
import se.su.dsv.scipro.SciProSession;
|
||||||
|
import se.su.dsv.scipro.conference.model.SubscriberModel;
|
||||||
|
import se.su.dsv.scipro.conference.panels.ConferencePanel;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan <aschan@dsv.su.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// TODO for test
|
||||||
|
@Authorization(authorizedRoles = { Roles.SYSADMIN })
|
||||||
|
public class ProjectConferencePage extends ProjectPage {
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private MessageBoardDao messageBoardDao;
|
||||||
|
@SpringBean
|
||||||
|
private BoardMessageDao boardMessageDao;
|
||||||
|
|
||||||
|
private IModel<Project> projectModel;
|
||||||
|
private IModel<MessageBoard> messageBoardModel;
|
||||||
|
private MessageBoard messageBoard;
|
||||||
|
private IModel<BoardMessage> boardMessageModel;
|
||||||
|
private final static String PROJECTID = "pid";
|
||||||
|
|
||||||
|
public ProjectConferencePage(PageParameters pp) {
|
||||||
|
super(pp);
|
||||||
|
String projectId = pp.getString("pid");
|
||||||
|
String boardMessageId = null;
|
||||||
|
if (projectId != null) {
|
||||||
|
StringTokenizer stringTokenizer = new StringTokenizer(projectId, "&");
|
||||||
|
boolean first = true;
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
if (stringTokenizer.hasMoreTokens()) {
|
||||||
|
if (first) {
|
||||||
|
projectId = stringTokenizer.nextToken().trim();
|
||||||
|
first = false;
|
||||||
|
} else {
|
||||||
|
boardMessageId = stringTokenizer.nextToken().trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (projectId == null && SciProSession.get().getActiveProject() != null) {
|
||||||
|
projectId = String.valueOf(SciProSession.get().getActiveProject().getId());
|
||||||
|
}
|
||||||
|
if (projectId != null) {
|
||||||
|
final Project project = projectDao.load(Long.valueOf(projectId));
|
||||||
|
if (project == null || !projectDao.isPartOf(SciProSession.get().getUser(), project)) {
|
||||||
|
failAndRedirect();
|
||||||
|
} else {
|
||||||
|
projectModel = new LoadableDetachableModel<Project>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Project load() {
|
||||||
|
return projectDao.reLoad(project);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Set<SubscriberModel> subscriberModel = new HashSet<SubscriberModel>();
|
||||||
|
if (projectModel.getObject().getHeadSupervisor() != null) {
|
||||||
|
subscriberModel.add(new SubscriberModel(projectModel.getObject()
|
||||||
|
.getHeadSupervisor().getUser(),
|
||||||
|
SupervisorConferencePage
|
||||||
|
.getAbsoluteForSupervisorConferenceURL(projectModel.getObject()
|
||||||
|
.getId()), NotificationPriority.LOW));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ProjectFollower projectFollower : projectModel.getObject()
|
||||||
|
.getProjectFollowers()) {
|
||||||
|
subscriberModel.add(new SubscriberModel(
|
||||||
|
projectFollower.getFollower().getUser(), SupervisorConferencePage
|
||||||
|
.getAbsoluteForSupervisorConferenceURL(projectModel.getObject()
|
||||||
|
.getId()), NotificationPriority.LOW));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Student student : projectModel.getObject().getProjectParticipants()) {
|
||||||
|
// Prod-kod
|
||||||
|
if (!student.getUser().equals(SciProSession.get().getUser()))
|
||||||
|
subscriberModel
|
||||||
|
.add(new SubscriberModel(student.getUser(),
|
||||||
|
getAbsoluteForProjectConferenceURL(projectModel.getObject()
|
||||||
|
.getId()), NotificationPriority.LOW));
|
||||||
|
// Test-kod
|
||||||
|
// subscriberModel.add(new
|
||||||
|
// SubscriberModel(student.getUser(),
|
||||||
|
// getAbsoluteForProjectConferenceURL(projectModel.getObject().getId()),
|
||||||
|
// NotificationPriority.LOW));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
messageBoard = messageBoardDao.getMessageBoard(projectModel.getObject());
|
||||||
|
if (messageBoard == null) {
|
||||||
|
messageBoard = new MessageBoard(projectModel.getObject());
|
||||||
|
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||||
|
messageBoard = messageBoardDao.save(messageBoard);
|
||||||
|
}
|
||||||
|
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MessageBoard load() {
|
||||||
|
return messageBoardDao.reLoad(messageBoard);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (boardMessageId != null) {
|
||||||
|
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
||||||
|
|
||||||
|
if (bm != null && messageBoard.getBoardMessageSet().contains(bm)) {
|
||||||
|
boardMessageModel = new LoadableDetachableModel<BoardMessage>() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BoardMessage load() {
|
||||||
|
return boardMessageDao.reLoad(bm);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add(new ConferencePanel("conferencePanel", messageBoardModel, subscriberModel,
|
||||||
|
boardMessageModel));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
add(new EmptyPanel("conferencePanel"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void failAndRedirect() {
|
||||||
|
throw new RestartResponseException(SciProApplication.get().getApplicationSettings()
|
||||||
|
.getAccessDeniedPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getAbsoluteForProjectConferenceURL(Long id) {
|
||||||
|
PageParameters pageParameters = new PageParameters();
|
||||||
|
pageParameters.put(PROJECTID, id.toString());
|
||||||
|
return RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
|
.urlFor(ProjectConferencePage.class, pageParameters).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<!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:extend>
|
||||||
|
<div wicket:id="conferencePanel"></div>
|
||||||
|
</wicket:extend>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,166 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.conference.pages;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.apache.wicket.PageParameters;
|
||||||
|
import org.apache.wicket.RequestCycle;
|
||||||
|
import org.apache.wicket.RestartResponseException;
|
||||||
|
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||||
|
import org.apache.wicket.model.IModel;
|
||||||
|
import org.apache.wicket.model.LoadableDetachableModel;
|
||||||
|
import org.apache.wicket.protocol.http.RequestUtils;
|
||||||
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.SciProApplication;
|
||||||
|
import se.su.dsv.scipro.SciProSession;
|
||||||
|
import se.su.dsv.scipro.conference.model.SubscriberModel;
|
||||||
|
import se.su.dsv.scipro.conference.panels.ConferencePanel;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
import se.su.dsv.scipro.security.auth.Authorization;
|
||||||
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan <aschan@dsv.su.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Authorization(authorizedRoles = { Roles.SYSADMIN })
|
||||||
|
public class SupervisorConferencePage extends AbstractSupervisorPage {
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private MessageBoardDao messageBoardDao;
|
||||||
|
@SpringBean
|
||||||
|
protected ProjectDao projectDao;
|
||||||
|
@SpringBean
|
||||||
|
protected BoardMessageDao boardMessageDao;
|
||||||
|
|
||||||
|
private IModel<BoardMessage> boardMessageModel;
|
||||||
|
private IModel<Project> projectModel;
|
||||||
|
private IModel<MessageBoard> messageBoardModel;
|
||||||
|
private MessageBoard messageBoard;
|
||||||
|
private final static String PROJECTID = "pid";
|
||||||
|
|
||||||
|
public SupervisorConferencePage(PageParameters pp) {
|
||||||
|
super(pp);
|
||||||
|
String projectId = pp.getString("pid");
|
||||||
|
String boardMessageId = null;
|
||||||
|
if (projectId != null) {
|
||||||
|
StringTokenizer stringTokenizer = new StringTokenizer(projectId, "&");
|
||||||
|
boolean first = true;
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
if (stringTokenizer.hasMoreTokens()) {
|
||||||
|
if (first) {
|
||||||
|
projectId = stringTokenizer.nextToken().trim();
|
||||||
|
first = false;
|
||||||
|
} else {
|
||||||
|
boardMessageId = stringTokenizer.nextToken().trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (projectId == null) {
|
||||||
|
add(new EmptyPanel("conferencePanel"));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
final Project project = projectDao.load(Long.valueOf(projectId));
|
||||||
|
if (project == null || !projectDao.isPartOf(SciProSession.get().getUser(), project)) {
|
||||||
|
failAndRedirect();
|
||||||
|
} else {
|
||||||
|
projectModel = new LoadableDetachableModel<Project>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Project load() {
|
||||||
|
return projectDao.reLoad(project);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Set<SubscriberModel> subscriberModel = new HashSet<SubscriberModel>();
|
||||||
|
User user = projectModel.getObject().getHeadSupervisor().getUser();
|
||||||
|
if (!user.equals(SciProSession.get().getUser())) {
|
||||||
|
subscriberModel
|
||||||
|
.add(new SubscriberModel(user,
|
||||||
|
getAbsoluteForSupervisorConferenceURL(projectModel.getObject()
|
||||||
|
.getId()), NotificationPriority.LOW));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ProjectFollower projectFollower : projectModel.getObject()
|
||||||
|
.getProjectFollowers()) {
|
||||||
|
if (!user.equals(SciProSession.get().getUser())) {
|
||||||
|
subscriberModel.add(new SubscriberModel(projectFollower.getFollower()
|
||||||
|
.getUser(), getAbsoluteForSupervisorConferenceURL(projectModel
|
||||||
|
.getObject().getId()), NotificationPriority.LOW));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Student student : projectModel.getObject().getProjectParticipants()) {
|
||||||
|
subscriberModel.add(new SubscriberModel(student.getUser(),
|
||||||
|
ProjectConferencePage.getAbsoluteForProjectConferenceURL(projectModel
|
||||||
|
.getObject().getId()), NotificationPriority.LOW));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
messageBoard = messageBoardDao.getMessageBoard(projectModel.getObject());
|
||||||
|
if (messageBoard == null) {
|
||||||
|
messageBoard = new MessageBoard(projectModel.getObject());
|
||||||
|
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||||
|
messageBoard = messageBoardDao.save(messageBoard);
|
||||||
|
}
|
||||||
|
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MessageBoard load() {
|
||||||
|
return messageBoardDao.reLoad(messageBoard);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (boardMessageId != null) {
|
||||||
|
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
||||||
|
|
||||||
|
if (bm != null && messageBoard.getBoardMessageSet().contains(bm)) {
|
||||||
|
boardMessageModel = new LoadableDetachableModel<BoardMessage>() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BoardMessage load() {
|
||||||
|
return boardMessageDao.reLoad(bm);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add(new ConferencePanel("conferencePanel", messageBoardModel, subscriberModel,
|
||||||
|
boardMessageModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void failAndRedirect() {
|
||||||
|
throw new RestartResponseException(SciProApplication.get().getApplicationSettings()
|
||||||
|
.getAccessDeniedPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getAbsoluteForSupervisorConferenceURL(Long id) {
|
||||||
|
PageParameters pageParameters = new PageParameters();
|
||||||
|
pageParameters.add(PROJECTID, id.toString());
|
||||||
|
return RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
|
.urlFor(SupervisorConferencePage.class, pageParameters).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,284 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.conference.panels;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
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.IDataProvider;
|
||||||
|
import org.apache.wicket.model.IModel;
|
||||||
|
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.commentthread.panels.CommentThreadPanel;
|
||||||
|
import se.su.dsv.scipro.conference.model.SubscriberModel;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationMessage;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.CommentThreadDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
import se.su.dsv.scipro.dataproviders.BoardMessageDataProvider;
|
||||||
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
import se.su.dsv.scipro.util.PropsUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ConferencePanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@SpringBean
|
||||||
|
private BoardMessageDao boardMessageDao;
|
||||||
|
@SpringBean
|
||||||
|
private CommentThreadDao commentThreadDao;
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private NotificationController notificationController;
|
||||||
|
|
||||||
|
private DataView<BoardMessage> dataView;
|
||||||
|
private WebMarkupContainer webMarkupContainer;
|
||||||
|
private IModel<MessageBoard> messageBoardModel;
|
||||||
|
private IModel<BoardMessage> boardMessageModel;
|
||||||
|
private Set<SubscriberModel> subscriberModels;
|
||||||
|
|
||||||
|
public ConferencePanel(String id, IModel<MessageBoard> messageBoardModel,
|
||||||
|
Set<SubscriberModel> subscriberModels, IModel<BoardMessage> boardMessageModel) {
|
||||||
|
super(id);
|
||||||
|
this.boardMessageModel = boardMessageModel;
|
||||||
|
this.messageBoardModel = messageBoardModel;
|
||||||
|
this.subscriberModels = subscriberModels;
|
||||||
|
initPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConferencePanel(String id, IModel<MessageBoard> messageBoardModel,
|
||||||
|
Set<SubscriberModel> subscriberModels) {
|
||||||
|
this(id, messageBoardModel, subscriberModels, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPanel() {
|
||||||
|
add(new SendWallMessageForm("sendForm"));
|
||||||
|
webMarkupContainer = new WebMarkupContainer("container");
|
||||||
|
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||||
|
webMarkupContainer.add(dataView);
|
||||||
|
webMarkupContainer.setOutputMarkupId(true);
|
||||||
|
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
||||||
|
add(webMarkupContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadUserDataView(IDataProvider<BoardMessage> boardMessageDataProvider) {
|
||||||
|
|
||||||
|
dataView = new DataView<BoardMessage>("boardMessageDataView", boardMessageDataProvider, 10) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void populateItem(Item<BoardMessage> item) {
|
||||||
|
final BoardMessage bm = item.getModelObject();
|
||||||
|
item.add(new Label("messageLabel", bm.getMessage()));
|
||||||
|
item.add(new Label("messageUser", bm.getFromUser().getFirstName() + " "
|
||||||
|
+ bm.getFromUser().getLastName()));
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
|
item.add(new Label("messageDate", simpleDateFormat.format(bm.getDateCreated())));
|
||||||
|
item.add(new AjaxLink<Void>("delete") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
|
||||||
|
BoardMessage boardMessageTemp = boardMessageDao.reLoad(bm);
|
||||||
|
boardMessageDao.delete(boardMessageTemp);
|
||||||
|
webMarkupContainer.removeAll();
|
||||||
|
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||||
|
webMarkupContainer.add(dataView);
|
||||||
|
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
||||||
|
target.addComponent(webMarkupContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
SciProSession session = SciProSession.get();
|
||||||
|
if (session.authorizedForRole(Roles.ADMIN))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int commentSize = commentThreadDao.getCommentThreadSize(bm);
|
||||||
|
String comments = " Comments";
|
||||||
|
if (commentSize == 1) {
|
||||||
|
comments = " Comment";
|
||||||
|
}
|
||||||
|
final Label comment = new Label("commentNumber", commentSize + comments);
|
||||||
|
|
||||||
|
comment.setOutputMarkupId(true);
|
||||||
|
final WebMarkupContainer webMarkupContainer = new WebMarkupContainer(
|
||||||
|
"commentContainer");
|
||||||
|
webMarkupContainer.setOutputMarkupPlaceholderTag(true);
|
||||||
|
item.add(webMarkupContainer);
|
||||||
|
|
||||||
|
CommentThreadPanel ctp = new CommentThreadPanel("commentThread", bm, 5,
|
||||||
|
subscriberModels, messageBoardModel.getObject().getTitle());
|
||||||
|
ctp.setOutputMarkupPlaceholderTag(true);
|
||||||
|
webMarkupContainer.add(ctp);
|
||||||
|
|
||||||
|
if (boardMessageModel != null && boardMessageModel.getObject().equals(bm)) {
|
||||||
|
comment.setDefaultModelObject("Hide comments");
|
||||||
|
webMarkupContainer.setVisible(true);
|
||||||
|
item.add(new AjaxLink<String>("showComments",
|
||||||
|
new Model<String>("Hide Comments")) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private boolean clicked = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
clicked = !clicked;
|
||||||
|
if (clicked) {
|
||||||
|
comment.setDefaultModelObject("Hide comments");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
int commentSize = commentThreadDao.getCommentThreadSize(bm);
|
||||||
|
|
||||||
|
String comments = " Comments";
|
||||||
|
if (commentSize == 1) {
|
||||||
|
comments = " Comment";
|
||||||
|
}
|
||||||
|
comment.setDefaultModelObject(commentSize + comments);
|
||||||
|
}
|
||||||
|
webMarkupContainer.removeAll();
|
||||||
|
webMarkupContainer.add(new CommentThreadPanel("commentThread",
|
||||||
|
boardMessageDao.reLoad(bm), 5, subscriberModels,
|
||||||
|
messageBoardModel.getObject().getTitle()));
|
||||||
|
webMarkupContainer.setVisible(clicked);
|
||||||
|
target.addComponent(webMarkupContainer);
|
||||||
|
target.addComponent(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
}.add(comment));
|
||||||
|
} else {
|
||||||
|
webMarkupContainer.setVisible(false);
|
||||||
|
item.add(new AjaxLink<String>("showComments",
|
||||||
|
new Model<String>("Show Comments")) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private boolean clicked = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
clicked = !clicked;
|
||||||
|
if (clicked) {
|
||||||
|
comment.setDefaultModelObject("Hide comments");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
int commentSize = commentThreadDao.getCommentThreadSize(bm);
|
||||||
|
|
||||||
|
String comments = " Comments";
|
||||||
|
if (commentSize == 1) {
|
||||||
|
comments = " Comment";
|
||||||
|
}
|
||||||
|
comment.setDefaultModelObject(commentSize + comments);
|
||||||
|
}
|
||||||
|
webMarkupContainer.removeAll();
|
||||||
|
webMarkupContainer.add(new CommentThreadPanel("commentThread",
|
||||||
|
boardMessageDao.reLoad(bm), 5, subscriberModels,
|
||||||
|
messageBoardModel.getObject().getTitle()));
|
||||||
|
webMarkupContainer.setVisible(clicked);
|
||||||
|
target.addComponent(webMarkupContainer);
|
||||||
|
target.addComponent(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
}.add(comment));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SendWallMessageForm extends Form<String> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public SendWallMessageForm(String id) {
|
||||||
|
super(id);
|
||||||
|
final TextArea<String> messageTextArea = new TextArea<String>("textArea",
|
||||||
|
new PropertyModel<String>(this, "message"));
|
||||||
|
messageTextArea.setOutputMarkupId(true);
|
||||||
|
add(messageTextArea);
|
||||||
|
AjaxButton button = new AjaxButton("ajaxButton") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
|
|
||||||
|
BoardMessage bm = new BoardMessage();
|
||||||
|
bm.setMessage(message);
|
||||||
|
bm.setMessageBoard(messageBoardModel.getObject());
|
||||||
|
bm.setFromUser(SciProSession.get().getUser());
|
||||||
|
bm = boardMessageDao.save(bm);
|
||||||
|
|
||||||
|
for (SubscriberModel subscriberModel : subscriberModels) {
|
||||||
|
createNotification(subscriberModel.getUser(), message,
|
||||||
|
subscriberModel.getNotificationPriority(),
|
||||||
|
subscriberModel.getAbsolutePath());
|
||||||
|
}
|
||||||
|
messageTextArea.setDefaultModelObject("");
|
||||||
|
webMarkupContainer.removeAll();
|
||||||
|
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||||
|
webMarkupContainer.add(dataView);
|
||||||
|
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
||||||
|
target.addComponent(webMarkupContainer);
|
||||||
|
target.addComponent(messageTextArea);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
add(button);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createNotification(final User user, final String message,
|
||||||
|
final NotificationPriority notificationPriority, final String absolutePath) {
|
||||||
|
|
||||||
|
Properties props = null;
|
||||||
|
try {
|
||||||
|
props = PropsUtils.load("notification.properties");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String mailSubject = props.getProperty("mailSubject");
|
||||||
|
String conferenceNotification = props.getProperty("conferenceNotification");
|
||||||
|
String twoNewLines = props.getProperty("twoNewLines");
|
||||||
|
|
||||||
|
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
|
||||||
|
+ messageBoardModel.getObject().getTitle();
|
||||||
|
|
||||||
|
String mailMessage = webNotificationMessage + twoNewLines + message;
|
||||||
|
|
||||||
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
|
mailSubject, mailMessage);
|
||||||
|
notificationController.processNotification(user, notificationMessage, absolutePath,
|
||||||
|
notificationPriority);
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,14 @@
|
|||||||
package se.su.dsv.scipro.data.controllers;
|
package se.su.dsv.scipro.data.controllers;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.NotificationEventType;
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Martin Peters - mpeters@dsv.su.se
|
* @author Martin Peters - mpeters@dsv.su.se
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface NotificationController {
|
public interface NotificationController {
|
||||||
|
|
||||||
public void processSystemNotification(
|
|
||||||
User usertoNotify,
|
|
||||||
Roles userRole,
|
|
||||||
String subject,
|
|
||||||
String messageBody,
|
|
||||||
NotificationEventType notificationEvent);
|
|
||||||
|
|
||||||
|
public void processNotification(User usertoNotify, NotificationMessage notificationMessage, String absoluteUrl, NotificationPriority notificationPriority);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.data.controllers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan <aschan@dsv.su.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NotificationMessage {
|
||||||
|
|
||||||
|
private String webNotificationMessage = "";
|
||||||
|
private String mailSubject = "";
|
||||||
|
private String mailMessage = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param webNotificationMessage
|
||||||
|
* @param mailSubject
|
||||||
|
* @param mailMessage
|
||||||
|
*/
|
||||||
|
public NotificationMessage(String webNotificationMessage, String mailSubject, String mailMessage) {
|
||||||
|
super();
|
||||||
|
this.webNotificationMessage = webNotificationMessage;
|
||||||
|
this.mailSubject = mailSubject;
|
||||||
|
this.mailMessage = mailMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the webNotificationMessage
|
||||||
|
*/
|
||||||
|
public String getWebNotificationMessage() {
|
||||||
|
return webNotificationMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param webNotificationMessage
|
||||||
|
* the webNotificationMessage to set
|
||||||
|
*/
|
||||||
|
public void setWebNotificationMessage(String webNotificationMessage) {
|
||||||
|
this.webNotificationMessage = webNotificationMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mailSubject
|
||||||
|
*/
|
||||||
|
public String getMailSubject() {
|
||||||
|
return mailSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mailSubject
|
||||||
|
* the mailSubject to set
|
||||||
|
*/
|
||||||
|
public void setMailSubject(String mailSubject) {
|
||||||
|
this.mailSubject = mailSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mailMessage
|
||||||
|
*/
|
||||||
|
public String getMailMessage() {
|
||||||
|
return mailMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mailMessage
|
||||||
|
* the mailMessage to set
|
||||||
|
*/
|
||||||
|
public void setMailMessage(String mailMessage) {
|
||||||
|
this.mailMessage = mailMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,75 +6,136 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.controllers.NotificationController;
|
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationMessage;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.MailEventDao;
|
import se.su.dsv.scipro.data.dao.interfaces.MailEventDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.WebNotificationDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MailEvent;
|
import se.su.dsv.scipro.data.dataobjects.MailEvent;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.NotificationEventType;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
import se.su.dsv.scipro.util.PropsUtils;
|
import se.su.dsv.scipro.util.PropsUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Think this through and do it properly, this is a rush-job implemented for peer-review
|
* TODO Think this through and do it properly, this is a rush-job implemented
|
||||||
|
* for peer-review
|
||||||
|
*
|
||||||
* @author Martin Peters - mpeters@dsv.su.se
|
* @author Martin Peters - mpeters@dsv.su.se
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class NotificationControllerImpl implements NotificationController {
|
public class NotificationControllerImpl implements NotificationController {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
final protected String systemFromName;
|
@Autowired
|
||||||
final protected String systemFromEmail;
|
private WebNotificationDao notificationDao;
|
||||||
final protected boolean sendMailEnabled;
|
|
||||||
|
@Autowired
|
||||||
public NotificationControllerImpl() {
|
private UserSettingsDao userSettingsDao;
|
||||||
String systemFromName = null;
|
|
||||||
String systemFromEmail = null;
|
@Autowired
|
||||||
boolean sendMailEnabled = false;
|
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||||
try {
|
|
||||||
Properties props = PropsUtils.load("email.properties");
|
|
||||||
systemFromName = props.getProperty("systemFromName");
|
|
||||||
systemFromEmail = props.getProperty("systemFromEmail");
|
|
||||||
sendMailEnabled = Boolean.parseBoolean(props.getProperty("sendMailEnabled"));
|
|
||||||
} catch (Exception e) {
|
|
||||||
systemFromName = "SciPro - Autogenerated message";
|
|
||||||
systemFromEmail = "no-reply@thesis.dsv.su.se";
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
this.systemFromName = systemFromName;
|
|
||||||
this.systemFromEmail = systemFromEmail;
|
|
||||||
this.sendMailEnabled = sendMailEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected MailEventDao mailEventDao;
|
protected MailEventDao mailEventDao;
|
||||||
|
|
||||||
/**
|
|
||||||
* Re-implement to it takes users settings into account
|
|
||||||
* @param user
|
|
||||||
* @param notificationEvent
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected boolean notifyViaMail(User user, Roles userRole, NotificationEventType notificationEvent ) {
|
|
||||||
return sendMailEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processSystemNotification(
|
public void processNotification(User usertoNotify, NotificationMessage notificationMessage,
|
||||||
User usertoNotify,
|
String absoluteUrl, NotificationPriority notificationPriorityForEvent) {
|
||||||
Roles userRole,
|
GeneralSystemSettings generalSystemSettings = generalSystemSettingsDao
|
||||||
String subject,
|
.getGeneralSystemSettingsInstance();
|
||||||
String messageBody,
|
String systemFromName = generalSystemSettings.getMailFromName();
|
||||||
NotificationEventType notificationEvent) {
|
String systemFromEmail = generalSystemSettings.getSystemFromMail();
|
||||||
/*
|
boolean sendMailEnabled = generalSystemSettings.isMailNotifications();
|
||||||
* atm bogus-check if the user want to have this kind of notice for this kind of role
|
// Mailnotifications
|
||||||
*/
|
if (sendMailEnabled) {
|
||||||
if( notifyViaMail(usertoNotify, userRole, notificationEvent) ){
|
UserSettings userSettings = userSettingsDao.getUserSettings(usertoNotify);
|
||||||
MailEvent me = new MailEvent(subject, messageBody, usertoNotify, systemFromName, systemFromEmail, notificationEvent);
|
if (userSettings == null) {
|
||||||
me = mailEventDao.save(me);
|
userSettings = new UserSettings();
|
||||||
|
userSettings.setUser(usertoNotify);
|
||||||
|
userSettings = userSettingsDao.save(userSettings);
|
||||||
|
}
|
||||||
|
NotificationPriority notificationPriorityForUser = userSettings
|
||||||
|
.getNotificationPriority();
|
||||||
|
|
||||||
|
if (notificationPriorityForUser == null) {
|
||||||
|
notificationPriorityForUser = NotificationPriority.MEDIUM;
|
||||||
|
userSettings.setNotificationPriority(notificationPriorityForUser);
|
||||||
|
userSettings = userSettingsDao.save(userSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
String mailMessage = generateMail(usertoNotify.getFirstName(),
|
||||||
|
notificationMessage.getMailMessage(), absoluteUrl);
|
||||||
|
switch (notificationPriorityForUser) {
|
||||||
|
case HIGH:
|
||||||
|
if (notificationPriorityForEvent.equals(NotificationPriority.HIGH)) {
|
||||||
|
MailEvent me = new MailEvent(notificationMessage.getMailSubject(), mailMessage,
|
||||||
|
usertoNotify, systemFromName, systemFromEmail);
|
||||||
|
me = mailEventDao.save(me);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MEDIUM:
|
||||||
|
if (notificationPriorityForEvent.equals(NotificationPriority.HIGH)
|
||||||
|
|| notificationPriorityForEvent.equals(NotificationPriority.MEDIUM)) {
|
||||||
|
MailEvent me = new MailEvent(notificationMessage.getMailSubject(), mailMessage,
|
||||||
|
usertoNotify, systemFromName, systemFromEmail);
|
||||||
|
me = mailEventDao.save(me);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LOW:
|
||||||
|
if (notificationPriorityForEvent.equals(NotificationPriority.HIGH)
|
||||||
|
|| notificationPriorityForEvent.equals(NotificationPriority.MEDIUM)
|
||||||
|
|| notificationPriorityForEvent.equals(NotificationPriority.LOW)) {
|
||||||
|
MailEvent me = new MailEvent(notificationMessage.getMailSubject(), mailMessage,
|
||||||
|
usertoNotify, systemFromName, systemFromEmail);
|
||||||
|
me = mailEventDao.save(me);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Webnotifications
|
||||||
|
WebNotification notification = new WebNotification();
|
||||||
|
notification.setUser(usertoNotify);
|
||||||
|
notification.setInfoText(notificationMessage.getWebNotificationMessage());
|
||||||
|
notification.setUrl(absoluteUrl);
|
||||||
|
notificationDao.save(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String generateMail(String userFirstName, String addMessage, String absoluteUrl) {
|
||||||
|
String message = "";
|
||||||
|
|
||||||
|
Properties props = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
props = PropsUtils.load("notification.properties");
|
||||||
|
String twoNewLines = props.getProperty("twoNewLines");
|
||||||
|
String hello = props.getProperty("hello");
|
||||||
|
String autogenerated = props.getProperty("autogenerated");
|
||||||
|
String twoNewLinesWithComma = props.getProperty("twoNewLinesWithComma");
|
||||||
|
String linkText = props.getProperty("linkText");
|
||||||
|
|
||||||
|
message += hello;
|
||||||
|
message += userFirstName;
|
||||||
|
message += twoNewLinesWithComma;
|
||||||
|
|
||||||
|
message += addMessage;
|
||||||
|
|
||||||
|
message += twoNewLines;
|
||||||
|
message += linkText;
|
||||||
|
message += absoluteUrl;
|
||||||
|
message += twoNewLines;
|
||||||
|
message += autogenerated;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,9 @@ package se.su.dsv.scipro.data.dao.interfaces;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
@ -16,4 +15,6 @@ public interface BoardMessageDao extends Dao<BoardMessage>{
|
|||||||
|
|
||||||
public List<BoardMessage> getBoardMessageList(final MessageBoard mb, final int first,
|
public List<BoardMessage> getBoardMessageList(final MessageBoard mb, final int first,
|
||||||
final int count);
|
final int count);
|
||||||
|
public int getBoardMessageListCount(final MessageBoard mb);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.data.dao.interfaces;
|
package se.su.dsv.scipro.data.dao.interfaces;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
@ -18,5 +15,6 @@ import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
|||||||
|
|
||||||
public interface MessageBoardDao extends Dao<MessageBoard>{
|
public interface MessageBoardDao extends Dao<MessageBoard>{
|
||||||
|
|
||||||
|
public MessageBoard getMessageBoard(Commentable commentableDomainObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dao.interfaces;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public interface MessageDao extends Dao<Message>{
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dao.interfaces;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.SupervisorBoardMessage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public interface SupervisorBoardMessageDao extends Dao<SupervisorBoardMessage>{
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dao.interfaces;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.SupervisorMessageBoard;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public interface SupervisorMessageBoardDao extends Dao<SupervisorMessageBoard>{
|
|
||||||
|
|
||||||
}
|
|
@ -2,8 +2,12 @@ package se.su.dsv.scipro.data.dao.interfaces;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Role;
|
import se.su.dsv.scipro.data.dataobjects.Role;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.enums.ProjectStatus;
|
||||||
|
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
||||||
|
|
||||||
public interface UserDao extends LazyDeleteDao<User> {
|
public interface UserDao extends LazyDeleteDao<User> {
|
||||||
|
|
||||||
@ -20,11 +24,13 @@ public interface UserDao extends LazyDeleteDao<User> {
|
|||||||
List<User> findUserQuery(String searchQuery, boolean students, boolean supervisors, boolean sysadmins, int limit);
|
List<User> findUserQuery(String searchQuery, boolean students, boolean supervisors, boolean sysadmins, int limit);
|
||||||
|
|
||||||
List<User> findUserQuery(String searchQuery, int first,
|
List<User> findUserQuery(String searchQuery, int first,
|
||||||
int count, Class<? extends Role> role);
|
int count, Class<? extends Role> role, final List<User> notIncludeUser);
|
||||||
|
|
||||||
int findUserQueryCount(String searchQuery, Class<? extends Role> role);
|
int findUserQueryCount(final String searchQuery, final Class<? extends Role> roleClass,
|
||||||
|
final List<User> notIncludeList);
|
||||||
int findUserQueryCount(String searchQuery);
|
int findUserQueryCount(String searchQuery);
|
||||||
List<User> findUserQuery(String searchQuery, int first,
|
List<User> findUserQuery(String searchQuery, int first,
|
||||||
int count);
|
int count);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.data.dao.interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public interface WebNotificationDao extends Dao<WebNotification>{
|
||||||
|
|
||||||
|
List<WebNotification> getWebNotifications(final User user);
|
||||||
|
List<WebNotification> getWebNotifications(final User user,final int first,final int count);
|
||||||
|
int getCountOfWebNotifications(final User user);
|
||||||
|
|
||||||
|
}
|
@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
@ -43,8 +44,9 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
|
|||||||
TypedQuery<BoardMessage> query = em
|
TypedQuery<BoardMessage> query = em
|
||||||
.createQuery(
|
.createQuery(
|
||||||
"select bm FROM BoardMessage bm, MessageBoard mb " +
|
"select bm FROM BoardMessage bm, MessageBoard mb " +
|
||||||
"WHERE bm member of mb.boardMessageSet ORDER BY bm.dateCreated DESC", BoardMessage.class);
|
"WHERE bm member of mb.boardMessageSet AND mb = :mb ORDER BY bm.dateCreated DESC", BoardMessage.class);
|
||||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
|
query.setParameter("mb", mb);
|
||||||
query.setFirstResult(first);
|
query.setFirstResult(first);
|
||||||
query.setMaxResults(count);
|
query.setMaxResults(count);
|
||||||
try {
|
try {
|
||||||
@ -56,5 +58,25 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public int getBoardMessageListCount(final MessageBoard mb) {
|
||||||
|
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public Integer doInJpa(EntityManager em)
|
||||||
|
throws PersistenceException {
|
||||||
|
TypedQuery<Long> query = em
|
||||||
|
.createQuery(
|
||||||
|
"SELECT COUNT (bm) FROM BoardMessage bm, MessageBoard mb " +
|
||||||
|
"WHERE bm member of mb.boardMessageSet AND mb = :mb", Long.class);
|
||||||
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
|
query.setParameter("mb", mb);
|
||||||
|
return query.getSingleResult().intValue();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.data.dao.jpa;
|
package se.su.dsv.scipro.data.dao.jpa;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.PersistenceException;
|
import javax.persistence.PersistenceException;
|
||||||
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
|
||||||
import javax.persistence.PersistenceException;
|
import javax.persistence.PersistenceException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
@ -64,7 +63,6 @@ public class EventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Event> implement
|
|||||||
events.addAll(d.getEventsByUserAndProject(u, p, fromDate, toDate, limit));
|
events.addAll(d.getEventsByUserAndProject(u, p, fromDate, toDate, limit));
|
||||||
}
|
}
|
||||||
Collections.sort(events);
|
Collections.sort(events);
|
||||||
System.out.println(events);
|
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.data.dao.jpa;
|
package se.su.dsv.scipro.data.dao.jpa;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.PersistenceException;
|
import javax.persistence.PersistenceException;
|
||||||
@ -17,23 +14,45 @@ import org.springframework.stereotype.Repository;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Role;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Repository("messageBoardDao")
|
@Repository("messageBoardDao")
|
||||||
public class MessageBoardDaoJPAImp extends AbstractDaoJPAImp<MessageBoard>
|
public class MessageBoardDaoJPAImp extends AbstractDaoJPAImp<MessageBoard> implements
|
||||||
implements MessageBoardDao {
|
MessageBoardDao {
|
||||||
|
|
||||||
public MessageBoardDaoJPAImp() {
|
public MessageBoardDaoJPAImp() {
|
||||||
super(MessageBoard.class);
|
super(MessageBoard.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public MessageBoard getMessageBoard(final Commentable commentableDomainObject) {
|
||||||
|
return getJpaTemplate().execute(new JpaCallback<MessageBoard>() {
|
||||||
|
public MessageBoard doInJpa(EntityManager em) throws PersistenceException {
|
||||||
|
final String q = "select t "
|
||||||
|
+ "from MessageBoard t "
|
||||||
|
+ "where t.commentableKey = :commentableKey and t.commentableId = :commentableId ";
|
||||||
|
|
||||||
|
TypedQuery<MessageBoard> query = em.createQuery(q, MessageBoard.class);
|
||||||
|
query.setParameter("commentableKey", commentableDomainObject.getCommentKey());
|
||||||
|
query.setParameter("commentableId", commentableDomainObject.getId());
|
||||||
|
|
||||||
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
|
try {
|
||||||
|
return query.getSingleResult();
|
||||||
|
} catch (NoResultException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package se.su.dsv.scipro.data.dao.jpa;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.MessageDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Repository("messageDao")
|
|
||||||
public class MessageDaoJPAImp extends AbstractDaoJPAImp<Message>
|
|
||||||
implements MessageDao {
|
|
||||||
|
|
||||||
public MessageDaoJPAImp() {
|
|
||||||
super(Message.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.PrivateMessageDao;
|
import se.su.dsv.scipro.data.dao.interfaces.PrivateMessageDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,6 @@ import org.springframework.stereotype.Repository;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectPartnerDao;
|
import se.su.dsv.scipro.data.dao.interfaces.ProjectPartnerDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectPartner;
|
import se.su.dsv.scipro.data.dataobjects.ProjectPartner;
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ import se.su.dsv.scipro.data.dataobjects.ProjectPartner;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Repository("ProjectPartnerDao")
|
@Repository("projectPartnerDao")
|
||||||
public class ProjectPartnerDaoJPAImp extends AbstractDaoJPAImp<ProjectPartner>
|
public class ProjectPartnerDaoJPAImp extends AbstractDaoJPAImp<ProjectPartner>
|
||||||
implements ProjectPartnerDao {
|
implements ProjectPartnerDao {
|
||||||
|
|
||||||
@ -90,7 +89,6 @@ public class ProjectPartnerDaoJPAImp extends AbstractDaoJPAImp<ProjectPartner>
|
|||||||
if(days > 0){
|
if(days > 0){
|
||||||
q+= " and e.dateCreated > :cutOffDate";
|
q+= " and e.dateCreated > :cutOffDate";
|
||||||
}
|
}
|
||||||
q+= " order by e.dateCreated desc";
|
|
||||||
|
|
||||||
TypedQuery<Long> query = em.createQuery(q,
|
TypedQuery<Long> query = em.createQuery(q,
|
||||||
Long.class);
|
Long.class);
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dao.jpa;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.SupervisorBoardMessageDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.SupervisorBoardMessage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Repository("supervisorBoardMessageDao")
|
|
||||||
public class SupervisorBoardMessageDaoJPAImp extends AbstractDaoJPAImp<SupervisorBoardMessage>
|
|
||||||
implements SupervisorBoardMessageDao {
|
|
||||||
|
|
||||||
public SupervisorBoardMessageDaoJPAImp() {
|
|
||||||
super(SupervisorBoardMessage.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dao.jpa;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.SupervisorMessageBoardDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.SupervisorMessageBoard;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Repository("supervisorMessageBoardDao")
|
|
||||||
public class SupervisorMessageBoardDaoJPAImp extends AbstractDaoJPAImp<SupervisorMessageBoard>
|
|
||||||
implements SupervisorMessageBoardDao {
|
|
||||||
|
|
||||||
public SupervisorMessageBoardDaoJPAImp() {
|
|
||||||
super(SupervisorMessageBoard.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Role;
|
import se.su.dsv.scipro.data.dataobjects.Role;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
|
||||||
@ -23,8 +24,7 @@ import se.su.dsv.scipro.data.dataobjects.User;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Repository("userDao")
|
@Repository("userDao")
|
||||||
public class UserDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<User> implements
|
public class UserDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<User> implements UserDao {
|
||||||
UserDao {
|
|
||||||
|
|
||||||
public UserDaoJPAImp() {
|
public UserDaoJPAImp() {
|
||||||
super(User.class);
|
super(User.class);
|
||||||
@ -34,10 +34,8 @@ UserDao {
|
|||||||
public User getUserByIdentifier(final Long identifier) {
|
public User getUserByIdentifier(final Long identifier) {
|
||||||
return getJpaTemplate().execute(new JpaCallback<User>() {
|
return getJpaTemplate().execute(new JpaCallback<User>() {
|
||||||
public User doInJpa(EntityManager em) throws PersistenceException {
|
public User doInJpa(EntityManager em) throws PersistenceException {
|
||||||
TypedQuery<User> query = em
|
TypedQuery<User> query = em.createQuery(
|
||||||
.createQuery(
|
"select u FROM User u WHERE u.identifier = :identifier", User.class);
|
||||||
"select u FROM User u WHERE u.identifier = :identifier",
|
|
||||||
User.class);
|
|
||||||
query.setParameter("identifier", identifier);
|
query.setParameter("identifier", identifier);
|
||||||
try {
|
try {
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
@ -53,8 +51,7 @@ UserDao {
|
|||||||
return getJpaTemplate().execute(new JpaCallback<User>() {
|
return getJpaTemplate().execute(new JpaCallback<User>() {
|
||||||
public User doInJpa(EntityManager em) throws PersistenceException {
|
public User doInJpa(EntityManager em) throws PersistenceException {
|
||||||
TypedQuery<User> query = em.createQuery(
|
TypedQuery<User> query = em.createQuery(
|
||||||
"select u FROM User u WHERE u.emailAddress = :email",
|
"select u FROM User u WHERE u.emailAddress = :email", User.class);
|
||||||
User.class);
|
|
||||||
query.setParameter("email", emailAddress);
|
query.setParameter("email", emailAddress);
|
||||||
try {
|
try {
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
@ -67,16 +64,18 @@ UserDao {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public User getUserByUsername(final String username){
|
public User getUserByUsername(final String username) {
|
||||||
return this.getUserByUsername(username, "DSV.SU.SE");
|
return this.getUserByUsername(username, "DSV.SU.SE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional( readOnly=true )
|
@Transactional(readOnly = true)
|
||||||
public User getUserByUsername(final String username, final String realm){
|
public User getUserByUsername(final String username, final String realm) {
|
||||||
return getJpaTemplate().execute(new JpaCallback<User>() {
|
return getJpaTemplate().execute(new JpaCallback<User>() {
|
||||||
public User doInJpa(EntityManager em) throws PersistenceException {
|
public User doInJpa(EntityManager em) throws PersistenceException {
|
||||||
TypedQuery<User> query = em.createQuery(
|
TypedQuery<User> query = em
|
||||||
"SELECT u FROM User u, Username un WHERE un.username = :username AND un.realm = :realm AND un.user = u AND u.deleted = false", User.class);
|
.createQuery(
|
||||||
|
"SELECT u FROM User u, Username un WHERE un.username = :username AND un.realm = :realm AND un.user = u AND u.deleted = false",
|
||||||
|
User.class);
|
||||||
query.setParameter("username", username);
|
query.setParameter("username", username);
|
||||||
query.setParameter("realm", realm);
|
query.setParameter("realm", realm);
|
||||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
@ -89,29 +88,20 @@ UserDao {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<User> findUserQuery(final String searchQuery, final int limit) {
|
public List<User> findUserQuery(final String searchQuery, final int limit) {
|
||||||
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
||||||
@Override
|
@Override
|
||||||
public List<User> doInJpa(EntityManager em)
|
public List<User> doInJpa(EntityManager em) throws PersistenceException {
|
||||||
throws PersistenceException {
|
TypedQuery<User> query = em.createQuery(
|
||||||
TypedQuery<User> query = em
|
|
||||||
.createQuery(
|
|
||||||
"select distinct u FROM User u, Username un WHERE (lower(un.username) LIKE '"
|
"select distinct u FROM User u, Username un WHERE (lower(un.username) LIKE '"
|
||||||
+ searchQuery
|
+ searchQuery + "%' OR " + "lower(u.firstName) LIKE '"
|
||||||
+ "%' OR "
|
+ searchQuery
|
||||||
+ "lower(u.firstName) LIKE '"
|
+ "%' OR lower(u.firstName || ' ' || u.lastName) LIKE '"
|
||||||
+ searchQuery
|
+ searchQuery + "%' OR lower(u.lastName) LIKE '" + searchQuery
|
||||||
+ "%' OR lower(u.firstName || ' ' || u.lastName) LIKE '"
|
+ "%' OR lower(u.emailAddress) LIKE '" + searchQuery + "%') AND "
|
||||||
+ searchQuery
|
+ "un.user = u ORDER BY u.lastName ASC", User.class);
|
||||||
+ "%' OR lower(u.lastName) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(u.emailAddress) LIKE '"
|
|
||||||
+ searchQuery + "%') AND "
|
|
||||||
+ "un.user = u ORDER BY u.lastName ASC",
|
|
||||||
User.class);
|
|
||||||
query.setMaxResults(limit);
|
query.setMaxResults(limit);
|
||||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
try {
|
try {
|
||||||
@ -125,28 +115,20 @@ UserDao {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<User> findUserQuery(final String searchQuery, final int first,
|
public List<User> findUserQuery(final String searchQuery, final int first, final int count) {
|
||||||
final int count) {
|
|
||||||
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
||||||
@Override
|
@Override
|
||||||
public List<User> doInJpa(EntityManager em)
|
public List<User> doInJpa(EntityManager em) throws PersistenceException {
|
||||||
throws PersistenceException {
|
TypedQuery<User> query = em.createQuery(
|
||||||
TypedQuery<User> query = em
|
|
||||||
.createQuery(
|
|
||||||
"select distinct u FROM User u, Username un WHERE (lower(un.username) LIKE '"
|
"select distinct u FROM User u, Username un WHERE (lower(un.username) LIKE '"
|
||||||
+ searchQuery
|
+ searchQuery + "%' OR " + "lower(u.firstName) LIKE '"
|
||||||
+ "%' OR "
|
+ searchQuery
|
||||||
+ "lower(u.firstName) LIKE '"
|
+ "%' OR lower(u.firstName || ' ' || u.lastName) LIKE '"
|
||||||
+ searchQuery
|
+ searchQuery + "%' OR lower(u.lastName) LIKE '" + searchQuery
|
||||||
+ "%' OR lower(u.firstName || ' ' || u.lastName) LIKE '"
|
+ "%' OR lower(u.emailAddress) LIKE '" + searchQuery + "%') AND "
|
||||||
+ searchQuery
|
+ "un.user = u " +
|
||||||
+ "%' OR lower(u.lastName) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(u.emailAddress) LIKE '"
|
|
||||||
+ searchQuery + "%') AND "
|
|
||||||
+ "un.user = u +" +
|
|
||||||
|
|
||||||
"ORDER BY u.lastName ASC", User.class);
|
"ORDER BY u.lastName ASC", User.class);
|
||||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
query.setFirstResult(first);
|
query.setFirstResult(first);
|
||||||
query.setMaxResults(count);
|
query.setMaxResults(count);
|
||||||
@ -161,12 +143,11 @@ UserDao {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<User> findUserQuery(final String searchQuery, final int first,
|
public List<User> findUserQuery(final String searchQuery, final int first, final int count,
|
||||||
final int count, final Class<? extends Role> roleClass) {
|
final Class<? extends Role> roleClass, final List<User> notIncludeList) {
|
||||||
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
||||||
@Override
|
@Override
|
||||||
public List<User> doInJpa(EntityManager em)
|
public List<User> doInJpa(EntityManager em) throws PersistenceException {
|
||||||
throws PersistenceException {
|
|
||||||
|
|
||||||
String queryString = "SELECT DISTINCT un.user FROM Username un ";
|
String queryString = "SELECT DISTINCT un.user FROM Username un ";
|
||||||
if (roleClass != null) {
|
if (roleClass != null) {
|
||||||
@ -175,27 +156,28 @@ UserDao {
|
|||||||
if (searchQuery == null || searchQuery.equals("")) {
|
if (searchQuery == null || searchQuery.equals("")) {
|
||||||
queryString += "WHERE 1 = 1 ";
|
queryString += "WHERE 1 = 1 ";
|
||||||
} else {
|
} else {
|
||||||
queryString += "WHERE (lower(un.username) LIKE '"
|
queryString += "WHERE (lower(un.username) LIKE '" + searchQuery + "%' OR "
|
||||||
+ searchQuery
|
+ "lower(un.user.firstName) LIKE '" + searchQuery
|
||||||
+ "%' OR "
|
+ "%' OR lower(un.user.firstName || ' ' || un.user.lastName) LIKE '"
|
||||||
+ "lower(un.user.firstName) LIKE '"
|
+ searchQuery + "%' OR lower(un.user.lastName) LIKE '" + searchQuery
|
||||||
+ searchQuery
|
+ "%' OR lower(un.user.emailAddress) LIKE '" + searchQuery + "%') ";
|
||||||
+ "%' OR lower(un.user.firstName || ' ' || un.user.lastName) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(un.user.lastName) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(un.user.emailAddress) LIKE '"
|
|
||||||
+ searchQuery + "%') ";
|
|
||||||
}
|
}
|
||||||
if (roleClass != null) {
|
if (roleClass != null) {
|
||||||
queryString += "AND un.user = rc.user AND rc.deleted = false";
|
queryString += "AND un.user = rc.user AND rc.deleted = false";
|
||||||
}
|
}
|
||||||
|
if (notIncludeList != null) {
|
||||||
|
queryString += " AND un.user NOT IN (:notIncludeList)";
|
||||||
|
}
|
||||||
queryString += " ORDER BY un.user.lastName ASC";
|
queryString += " ORDER BY un.user.lastName ASC";
|
||||||
TypedQuery<User> query = em
|
|
||||||
.createQuery(queryString, User.class);
|
TypedQuery<User> query = em.createQuery(queryString, User.class);
|
||||||
|
if (notIncludeList != null) {
|
||||||
|
query.setParameter("notIncludeList", notIncludeList);
|
||||||
|
}
|
||||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
query.setFirstResult(first);
|
query.setFirstResult(first);
|
||||||
query.setMaxResults(count);
|
query.setMaxResults(count);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
} catch (NoResultException e) {
|
} catch (NoResultException e) {
|
||||||
@ -208,12 +190,12 @@ UserDao {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public int findUserQueryCount(final String searchQuery,final Class<? extends Role> roleClass) {
|
public int findUserQueryCount(final String searchQuery, final Class<? extends Role> roleClass,
|
||||||
|
final List<User> notIncludeList) {
|
||||||
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer doInJpa(EntityManager em)
|
public Integer doInJpa(EntityManager em) throws PersistenceException {
|
||||||
throws PersistenceException {
|
|
||||||
String queryString = "SELECT COUNT (DISTINCT un.user) FROM Username un ";
|
String queryString = "SELECT COUNT (DISTINCT un.user) FROM Username un ";
|
||||||
if (roleClass != null) {
|
if (roleClass != null) {
|
||||||
queryString += ", " + roleClass.getName() + " rc ";
|
queryString += ", " + roleClass.getName() + " rc ";
|
||||||
@ -221,26 +203,25 @@ UserDao {
|
|||||||
if (searchQuery == null || searchQuery.equals("")) {
|
if (searchQuery == null || searchQuery.equals("")) {
|
||||||
queryString += "WHERE 1 = 1 ";
|
queryString += "WHERE 1 = 1 ";
|
||||||
} else {
|
} else {
|
||||||
queryString += "WHERE "
|
queryString += "WHERE " + "(lower(un.username) LIKE '" + searchQuery + "%' OR "
|
||||||
+ "(lower(un.username) LIKE '"
|
+ "lower(un.user.firstName) LIKE '" + searchQuery
|
||||||
+ searchQuery
|
+ "%' OR lower(un.user.firstName || ' ' || un.user.lastName) LIKE '"
|
||||||
+ "%' OR "
|
+ searchQuery + "%' OR lower(un.user.lastName) LIKE '" + searchQuery
|
||||||
+ "lower(un.user.firstName) LIKE '"
|
+ "%' OR lower(un.user.emailAddress) LIKE '" + searchQuery + "%') ";
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(un.user.firstName || ' ' || un.user.lastName) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(un.user.lastName) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(un.user.emailAddress) LIKE '"
|
|
||||||
+ searchQuery + "%') ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roleClass != null) {
|
if (roleClass != null) {
|
||||||
queryString += "AND un.user = rc.user AND rc.deleted = false";
|
queryString += " AND un.user = rc.user AND rc.deleted = false";
|
||||||
}
|
}
|
||||||
TypedQuery<Long> query = em
|
|
||||||
.createQuery(queryString, Long.class);
|
|
||||||
|
|
||||||
|
if (notIncludeList != null) {
|
||||||
|
queryString += " AND un.user NOT IN (:notIncludeList)";
|
||||||
|
}
|
||||||
|
|
||||||
|
TypedQuery<Long> query = em.createQuery(queryString, Long.class);
|
||||||
|
if (notIncludeList != null) {
|
||||||
|
query.setParameter("notIncludeList", notIncludeList);
|
||||||
|
}
|
||||||
return (query.getSingleResult()).intValue();
|
return (query.getSingleResult()).intValue();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -248,18 +229,16 @@ UserDao {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<User> findUserQuery(final String searchQuery,
|
public List<User> findUserQuery(final String searchQuery, final boolean students,
|
||||||
final boolean students, final boolean supervisors,
|
final boolean supervisors, final boolean sysadmins, final int limit) {
|
||||||
final boolean sysadmins, final int limit) {
|
|
||||||
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
return getJpaTemplate().execute(new JpaCallback<List<User>>() {
|
||||||
public List<User> doInJpa(EntityManager em)
|
public List<User> doInJpa(EntityManager em) throws PersistenceException {
|
||||||
throws PersistenceException {
|
|
||||||
|
|
||||||
String selectClause = "select distinct u ";
|
String selectClause = "select distinct u ";
|
||||||
String fromClause = "from User u ";// , Username un ";
|
String fromClause = "from User u ";// , Username un ";
|
||||||
|
|
||||||
String conditions = "where (lower(u.firstName) LIKE lower(:q) "
|
String conditions = "where (lower(u.firstName) LIKE lower(:q) "
|
||||||
+ "OR lower(u.lastName) LIKE lower(:q)) ";
|
+ "OR lower(u.lastName) LIKE lower(:q)) ";
|
||||||
// "OR (lower(un.username) LIKE lower(:q) " +
|
// "OR (lower(un.username) LIKE lower(:q) " +
|
||||||
// "and un.user = u)) ";
|
// "and un.user = u)) ";
|
||||||
|
|
||||||
@ -292,8 +271,7 @@ UserDao {
|
|||||||
|
|
||||||
String orderClause = "order by u.lastName asc";
|
String orderClause = "order by u.lastName asc";
|
||||||
|
|
||||||
String q = selectClause + fromClause + joinClause + conditions
|
String q = selectClause + fromClause + joinClause + conditions + orderClause;
|
||||||
+ orderClause;
|
|
||||||
TypedQuery<User> query = em.createQuery(q, User.class);
|
TypedQuery<User> query = em.createQuery(q, User.class);
|
||||||
query.setParameter("q", searchQuery.trim() + "%");
|
query.setParameter("q", searchQuery.trim() + "%");
|
||||||
|
|
||||||
@ -317,31 +295,21 @@ UserDao {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public int findUserQueryCount(final String searchQuery) {
|
public int findUserQueryCount(final String searchQuery) {
|
||||||
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer doInJpa(EntityManager em)
|
public Integer doInJpa(EntityManager em) throws PersistenceException {
|
||||||
throws PersistenceException {
|
TypedQuery<Long> query = em.createQuery(
|
||||||
TypedQuery<Long> query = em
|
|
||||||
.createQuery(
|
|
||||||
"SELECT COUNT (DISTINCT u) FROM User u, Username un WHERE (lower(un.username) LIKE '"
|
"SELECT COUNT (DISTINCT u) FROM User u, Username un WHERE (lower(un.username) LIKE '"
|
||||||
+ searchQuery
|
+ searchQuery + "%' OR " + "lower(u.firstName) LIKE '"
|
||||||
+ "%' OR "
|
+ searchQuery
|
||||||
+ "lower(u.firstName) LIKE '"
|
+ "%' OR lower(u.firstName || ' ' || u.lastName) LIKE '"
|
||||||
+ searchQuery
|
+ searchQuery + "%' OR lower(u.lastName) LIKE '" + searchQuery
|
||||||
+ "%' OR lower(u.firstName || ' ' || u.lastName) LIKE '"
|
+ "%' OR lower(u.emailAddress) LIKE '" + searchQuery + "%') AND "
|
||||||
+ searchQuery
|
+ "un.user = u ORDER BY u.lastName ASC", Long.class);
|
||||||
+ "%' OR lower(u.lastName) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%' OR lower(u.emailAddress) LIKE '"
|
|
||||||
+ searchQuery
|
|
||||||
+ "%') AND "
|
|
||||||
+ "un.user = u ORDER BY u.lastName ASC",
|
|
||||||
Long.class);
|
|
||||||
|
|
||||||
return (query.getSingleResult()).intValue();
|
return (query.getSingleResult()).intValue();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.data.dao.jpa;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.NoResultException;
|
||||||
|
import javax.persistence.PersistenceException;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
|
import org.hibernate.ejb.QueryHints;
|
||||||
|
import org.springframework.orm.jpa.JpaCallback;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.WebNotificationDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Repository("notificationDao")
|
||||||
|
public class WebNotificationDaoJPAImp extends AbstractDaoJPAImp<WebNotification>
|
||||||
|
implements WebNotificationDao {
|
||||||
|
|
||||||
|
public WebNotificationDaoJPAImp() {
|
||||||
|
super(WebNotification.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
@Override
|
||||||
|
public List<WebNotification> getWebNotifications(final User user){
|
||||||
|
return getJpaTemplate().execute(new JpaCallback<List<WebNotification>>() {
|
||||||
|
@Override
|
||||||
|
public List<WebNotification> doInJpa(EntityManager em)
|
||||||
|
throws PersistenceException {
|
||||||
|
String q = "SELECT n FROM WebNotification n "
|
||||||
|
+ "where n.user = :user AND n.readByUser = false ORDER BY n.dateCreated DESC";
|
||||||
|
|
||||||
|
TypedQuery<WebNotification> query = em.createQuery(q,
|
||||||
|
WebNotification.class);
|
||||||
|
query.setParameter("user", user);
|
||||||
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
|
try {
|
||||||
|
return query.getResultList();
|
||||||
|
} catch (NoResultException e) {
|
||||||
|
return new ArrayList<WebNotification>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
@Override
|
||||||
|
public List<WebNotification> getWebNotifications(final User user,final int first, final int count){
|
||||||
|
return getJpaTemplate().execute(new JpaCallback<List<WebNotification>>() {
|
||||||
|
@Override
|
||||||
|
public List<WebNotification> doInJpa(EntityManager em)
|
||||||
|
throws PersistenceException {
|
||||||
|
String q = "SELECT n FROM WebNotification n "
|
||||||
|
+ "where n.user = :user AND n.readByUser = false ORDER BY n.dateCreated DESC";
|
||||||
|
|
||||||
|
TypedQuery<WebNotification> query = em.createQuery(q,
|
||||||
|
WebNotification.class);
|
||||||
|
query.setParameter("user", user);
|
||||||
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
|
query.setFirstResult(first);
|
||||||
|
query.setMaxResults(count);
|
||||||
|
try {
|
||||||
|
return query.getResultList();
|
||||||
|
} catch (NoResultException e) {
|
||||||
|
return new ArrayList<WebNotification>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
@Override
|
||||||
|
public int getCountOfWebNotifications(final User user){
|
||||||
|
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public Integer doInJpa(EntityManager em)
|
||||||
|
throws PersistenceException {
|
||||||
|
String q = "SELECT COUNT (n) FROM WebNotification n "
|
||||||
|
+ "where n.user = :user AND n.readByUser = false ";
|
||||||
|
|
||||||
|
TypedQuery<Long> query = em.createQuery(q,
|
||||||
|
Long.class);
|
||||||
|
query.setParameter("user", user);
|
||||||
|
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
|
|
||||||
|
return query.getSingleResult().intValue();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -1,88 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dataobjects;
|
|
||||||
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.MappedSuperclass;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
@MappedSuperclass
|
|
||||||
public abstract class Board extends DomainObject{
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
Board other = (Board) obj;
|
|
||||||
if (id == null) {
|
|
||||||
if (other.id != null)
|
|
||||||
return false;
|
|
||||||
} else if (!id.equals(other.id))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,9 +7,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Cacheable;
|
import javax.persistence.Cacheable;
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Lob;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
import org.hibernate.annotations.Cache;
|
||||||
@ -26,13 +31,30 @@ import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
|||||||
@Table(name="board_message")
|
@Table(name="board_message")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||||
public class BoardMessage extends Message implements Commentable {
|
public class BoardMessage extends DomainObject implements Commentable, Comparable<BoardMessage> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Lob
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@ManyToOne(optional=false)
|
||||||
|
private User fromUser;
|
||||||
|
|
||||||
@OneToMany
|
@OneToMany
|
||||||
private List<BoardMessage> replyMessageList = new ArrayList<BoardMessage>(0);
|
private List<BoardMessage> replyMessageList = new ArrayList<BoardMessage>(0);
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
@ManyToOne(optional=false)
|
||||||
private MessageBoard messageBoard;
|
private MessageBoard messageBoard;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public List<BoardMessage> getReplyMessageList() {
|
public List<BoardMessage> getReplyMessageList() {
|
||||||
return replyMessageList;
|
return replyMessageList;
|
||||||
@ -42,7 +64,6 @@ public class BoardMessage extends Message implements Commentable {
|
|||||||
this.replyMessageList = replyMessageList;
|
this.replyMessageList = replyMessageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the messageBoard
|
* @return the messageBoard
|
||||||
@ -62,5 +83,69 @@ public class BoardMessage extends Message implements Commentable {
|
|||||||
public String getCommentKey() {
|
public String getCommentKey() {
|
||||||
return BoardMessage.class.getCanonicalName().toString();
|
return BoardMessage.class.getCanonicalName().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getFromUser() {
|
||||||
|
return fromUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromUser(User fromUser) {
|
||||||
|
this.fromUser = fromUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
BoardMessage other = (BoardMessage) obj;
|
||||||
|
if (id == null) {
|
||||||
|
if (other.id != null)
|
||||||
|
return false;
|
||||||
|
} else if (!id.equals(other.id))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(BoardMessage o) {
|
||||||
|
if( this == o )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if(this.getDateCreated() != null && o.getDateCreated() != null){
|
||||||
|
//Reversed from what you might expect, because normally we want to display newest comment first in listviews
|
||||||
|
return o.getDateCreated().compareTo(this.getDateCreated());
|
||||||
|
}
|
||||||
|
if(this.getId() != null && o.getId() != null)
|
||||||
|
return this.getId().compareTo(o.getId());
|
||||||
|
if(this.message != null && o.message != null)
|
||||||
|
return message.compareTo(o.message);
|
||||||
|
//By now we have to conclude the two objects are basically two objects full of nulls
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
|||||||
public class CommentThread extends DomainObject{
|
public class CommentThread extends DomainObject{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@ -24,79 +24,82 @@ import javax.persistence.Table;
|
|||||||
import org.hibernate.annotations.Cache;
|
import org.hibernate.annotations.Cache;
|
||||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||||
import se.su.dsv.scipro.data.enums.FinalSeminarLanguages;
|
import se.su.dsv.scipro.data.enums.FinalSeminarLanguages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="final_seminar")
|
@Table(name = "final_seminar")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||||
public class FinalSeminar extends DomainObject{
|
public class FinalSeminar extends DomainObject implements Commentable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
@ManyToOne(optional = false)
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
@Basic(optional=false)
|
@Basic(optional = false)
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
|
|
||||||
@Basic(optional=false)
|
@Basic(optional = false)
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
|
|
||||||
@Basic(optional=false)
|
@Basic(optional = false)
|
||||||
private String room;
|
private String room;
|
||||||
|
|
||||||
@OneToMany(mappedBy="finalSeminar")
|
@OneToMany(mappedBy = "finalSeminar")
|
||||||
private List<FinalSeminarActiveParticipation> activeParticipations = new ArrayList<FinalSeminarActiveParticipation>();
|
private List<FinalSeminarActiveParticipation> activeParticipations = new ArrayList<FinalSeminarActiveParticipation>();
|
||||||
|
|
||||||
@OneToMany(mappedBy="finalSeminar")
|
@OneToMany(mappedBy = "finalSeminar")
|
||||||
private List<FinalSeminarOpposition> oppositions = new ArrayList<FinalSeminarOpposition>();
|
private List<FinalSeminarOpposition> oppositions = new ArrayList<FinalSeminarOpposition>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cascading delete, set document to nul will delete the filedescription
|
* Cascading delete, set document to nul will delete the filedescription but
|
||||||
* but not the actual file. Use FinarSeminarUploadController.deleteSeminarReport
|
* not the actual file. Use FinarSeminarUploadController.deleteSeminarReport
|
||||||
* to delete the document
|
* to delete the document
|
||||||
*/
|
*/
|
||||||
@OneToOne(optional = true, orphanRemoval = true, cascade = CascadeType.ALL)
|
@OneToOne(optional = true, orphanRemoval = true, cascade = CascadeType.ALL)
|
||||||
private FileDescription document;
|
private FileDescription document;
|
||||||
|
|
||||||
private Date documentUploadDate;
|
private Date documentUploadDate;
|
||||||
|
|
||||||
private String turnitinId;
|
private String turnitinId;
|
||||||
|
|
||||||
@Basic(optional=false)
|
@Basic(optional = false)
|
||||||
private boolean checkedForPlagirism = false;
|
private boolean checkedForPlagirism = false;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
private User documentUploader;
|
private User documentUploader;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private FinalSeminarLanguages presentationLanguage = FinalSeminarLanguages.ENGLISH;
|
private FinalSeminarLanguages presentationLanguage = FinalSeminarLanguages.ENGLISH;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private FinalSeminarLanguages reportLanguage = FinalSeminarLanguages.ENGLISH;
|
private FinalSeminarLanguages reportLanguage = FinalSeminarLanguages.ENGLISH;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that the uploader and uload date will be reset when document is null
|
* Make sure that the uploader and uload date will be reset when document is
|
||||||
|
* null
|
||||||
*/
|
*/
|
||||||
@PreUpdate
|
@PreUpdate
|
||||||
public void checkReport(){
|
public void checkReport() {
|
||||||
if(document == null){
|
if (document == null) {
|
||||||
setDocumentUploader(null);
|
setDocumentUploader(null);
|
||||||
setDocumentUploadDate(null);
|
setDocumentUploadDate(null);
|
||||||
}
|
}
|
||||||
@ -105,13 +108,11 @@ public class FinalSeminar extends DomainObject{
|
|||||||
public Project getProject() {
|
public Project getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProject(Project project) {
|
public void setProject(Project project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Date getEndDate() {
|
public Date getEndDate() {
|
||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
@ -123,19 +124,19 @@ public class FinalSeminar extends DomainObject{
|
|||||||
public Date getStartDate() {
|
public Date getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Date date) {
|
public void setStartDate(Date date) {
|
||||||
this.startDate = date;
|
this.startDate = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRoom() {
|
public String getRoom() {
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoom(String room) {
|
public void setRoom(String room) {
|
||||||
this.room = room;
|
this.room = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActiveParticipations(List<FinalSeminarActiveParticipation> activeParticipations) {
|
public void setActiveParticipations(List<FinalSeminarActiveParticipation> activeParticipations) {
|
||||||
this.activeParticipations = activeParticipations;
|
this.activeParticipations = activeParticipations;
|
||||||
}
|
}
|
||||||
@ -155,23 +156,23 @@ public class FinalSeminar extends DomainObject{
|
|||||||
public void setDocument(FileDescription document) {
|
public void setDocument(FileDescription document) {
|
||||||
this.document = document;
|
this.document = document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileDescription getDocument() {
|
public FileDescription getDocument() {
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDocumentUploadDate(Date documentUploadDate) {
|
public void setDocumentUploadDate(Date documentUploadDate) {
|
||||||
this.documentUploadDate = documentUploadDate;
|
this.documentUploadDate = documentUploadDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDocumentUploadDate() {
|
public Date getDocumentUploadDate() {
|
||||||
return documentUploadDate;
|
return documentUploadDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDocumentUploader(User documentUploader) {
|
public void setDocumentUploader(User documentUploader) {
|
||||||
this.documentUploader = documentUploader;
|
this.documentUploader = documentUploader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getDocumentUploader() {
|
public User getDocumentUploader() {
|
||||||
return documentUploader;
|
return documentUploader;
|
||||||
}
|
}
|
||||||
@ -211,11 +212,23 @@ public class FinalSeminar extends DomainObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param checkedForPlagirism the checkedForPlagirism to set
|
* @param checkedForPlagirism
|
||||||
|
* the checkedForPlagirism to set
|
||||||
*/
|
*/
|
||||||
public void setCheckedForPlagirism(boolean checkedForPlagirism) {
|
public void setCheckedForPlagirism(boolean checkedForPlagirism) {
|
||||||
this.checkedForPlagirism = checkedForPlagirism;
|
this.checkedForPlagirism = checkedForPlagirism;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* se.su.dsv.scipro.data.dataobjects.interfaces.Commentable#getCommentKey()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
final public String getCommentKey() {
|
||||||
|
return FinalSeminar.class.getCanonicalName().toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -39,6 +39,15 @@ public class GeneralSystemSettings extends DomainObject{
|
|||||||
@Basic(optional=false)
|
@Basic(optional=false)
|
||||||
private int daysBeforeFinalSeminarCanRegisterAsOpponent = 3;
|
private int daysBeforeFinalSeminarCanRegisterAsOpponent = 3;
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
private String turnItInUsername = "joha-asc";
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
private String turnItInForname = "Johan";
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
private String turnItInSurname = "Aschan";
|
||||||
|
|
||||||
@Basic(optional=true)
|
@Basic(optional=true)
|
||||||
private int projectPartnerDaysToLive;
|
private int projectPartnerDaysToLive;
|
||||||
|
|
||||||
@ -52,6 +61,17 @@ public class GeneralSystemSettings extends DomainObject{
|
|||||||
private boolean peerDisplayNumberOfReviewsPerformed = true;
|
private boolean peerDisplayNumberOfReviewsPerformed = true;
|
||||||
|
|
||||||
@Basic(optional=false)
|
@Basic(optional=false)
|
||||||
|
private boolean mailNotifications = true;
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
private String mailFromName = "SciPro";
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
private String systemFromMail = "no-reply@thesis.dsv.su.se";
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
private String smtpServer = "mail.dsv.su.se";
|
||||||
|
|
||||||
private boolean peerDisplayLatestReviews = true;
|
private boolean peerDisplayLatestReviews = true;
|
||||||
|
|
||||||
@Basic(optional=false)
|
@Basic(optional=false)
|
||||||
@ -59,6 +79,7 @@ public class GeneralSystemSettings extends DomainObject{
|
|||||||
|
|
||||||
@Basic(optional=false)
|
@Basic(optional=false)
|
||||||
private boolean publicReviewsActivated = true;
|
private boolean publicReviewsActivated = true;
|
||||||
|
|
||||||
|
|
||||||
public GeneralSystemSettings(){
|
public GeneralSystemSettings(){
|
||||||
}
|
}
|
||||||
@ -125,6 +146,91 @@ public class GeneralSystemSettings extends DomainObject{
|
|||||||
public boolean isPeerDisplayNumberOfReviewsPerformed() {
|
public boolean isPeerDisplayNumberOfReviewsPerformed() {
|
||||||
return peerDisplayNumberOfReviewsPerformed;
|
return peerDisplayNumberOfReviewsPerformed;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @return the turnItInUsername
|
||||||
|
*/
|
||||||
|
public String getTurnItInUsername() {
|
||||||
|
return turnItInUsername;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param turnItInUsername the turnItInUsername to set
|
||||||
|
*/
|
||||||
|
public void setTurnItInUsername(String turnItInUsername) {
|
||||||
|
this.turnItInUsername = turnItInUsername;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the turnItInForname
|
||||||
|
*/
|
||||||
|
public String getTurnItInForname() {
|
||||||
|
return turnItInForname;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param turnItInForname the turnItInForname to set
|
||||||
|
*/
|
||||||
|
public void setTurnItInForname(String turnItInForname) {
|
||||||
|
this.turnItInForname = turnItInForname;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the turnItInSurname
|
||||||
|
*/
|
||||||
|
public String getTurnItInSurname() {
|
||||||
|
return turnItInSurname;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param turnItInSurname the turnItInSurname to set
|
||||||
|
*/
|
||||||
|
public void setTurnItInSurname(String turnItInSurname) {
|
||||||
|
this.turnItInSurname = turnItInSurname;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the mailNotifications
|
||||||
|
*/
|
||||||
|
public boolean isMailNotifications() {
|
||||||
|
return mailNotifications;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param mailNotifications the mailNotifications to set
|
||||||
|
*/
|
||||||
|
public void setMailNotifications(boolean mailNotifications) {
|
||||||
|
this.mailNotifications = mailNotifications;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the mailFromName
|
||||||
|
*/
|
||||||
|
public String getMailFromName() {
|
||||||
|
return mailFromName;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param mailFromName the mailFromName to set
|
||||||
|
*/
|
||||||
|
public void setMailFromName(String mailFromName) {
|
||||||
|
this.mailFromName = mailFromName;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the systemFromMail
|
||||||
|
*/
|
||||||
|
public String getSystemFromMail() {
|
||||||
|
return systemFromMail;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param systemFromMail the systemFromMail to set
|
||||||
|
*/
|
||||||
|
public void setSystemFromMail(String systemFromMail) {
|
||||||
|
this.systemFromMail = systemFromMail;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the smtpServer
|
||||||
|
*/
|
||||||
|
public String getSmtpServer() {
|
||||||
|
return smtpServer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param smtpServer the smtpServer to set
|
||||||
|
*/
|
||||||
|
public void setSmtpServer(String smtpServer) {
|
||||||
|
this.smtpServer = smtpServer;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPeerDisplayLatestReviews(boolean peerDisplayLatestReviews) {
|
public void setPeerDisplayLatestReviews(boolean peerDisplayLatestReviews) {
|
||||||
this.peerDisplayLatestReviews = peerDisplayLatestReviews;
|
this.peerDisplayLatestReviews = peerDisplayLatestReviews;
|
||||||
}
|
}
|
||||||
@ -144,5 +250,4 @@ public class GeneralSystemSettings extends DomainObject{
|
|||||||
this.publicReviewsActivated = publicReviewsActivated;
|
this.publicReviewsActivated = publicReviewsActivated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,7 @@ public class MailEvent extends DomainObject {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional=true)
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private NotificationEventType notificationEventType;
|
|
||||||
|
|
||||||
@JoinTable(name="mail_event_recipients")
|
@JoinTable(name="mail_event_recipients")
|
||||||
@ManyToMany(fetch=FetchType.EAGER)
|
@ManyToMany(fetch=FetchType.EAGER)
|
||||||
@ -73,9 +69,8 @@ public class MailEvent extends DomainObject {
|
|||||||
final String messageBody,
|
final String messageBody,
|
||||||
final User recipient,
|
final User recipient,
|
||||||
final String fromName,
|
final String fromName,
|
||||||
final String fromEmail,
|
final String fromEmail){
|
||||||
final NotificationEventType notificationEventType){
|
this(subject,messageBody,recipient,fromName,fromEmail,null);
|
||||||
this(subject,messageBody,recipient,fromName,fromEmail,null,notificationEventType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailEvent(
|
public MailEvent(
|
||||||
@ -83,9 +78,8 @@ public class MailEvent extends DomainObject {
|
|||||||
final String messageBody,
|
final String messageBody,
|
||||||
final Collection<User> recipients,
|
final Collection<User> recipients,
|
||||||
final String fromName,
|
final String fromName,
|
||||||
final String fromEmail,
|
final String fromEmail){
|
||||||
final NotificationEventType notificationEventType){
|
this(subject,messageBody,recipients,fromName,fromEmail,null);
|
||||||
this(subject,messageBody,recipients,fromName,fromEmail,null,notificationEventType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailEvent(
|
public MailEvent(
|
||||||
@ -94,16 +88,14 @@ public class MailEvent extends DomainObject {
|
|||||||
final User recipient,
|
final User recipient,
|
||||||
final String fromName,
|
final String fromName,
|
||||||
final String fromEmail,
|
final String fromEmail,
|
||||||
final Collection<User> replyTo,
|
final Collection<User> replyTo){
|
||||||
final NotificationEventType notificationEventType){
|
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
this.messageBody = messageBody;
|
this.messageBody = messageBody;
|
||||||
this.recipients.add(recipient);
|
this.recipients.add(recipient);
|
||||||
this.fromName = fromName;
|
this.fromName = fromName;
|
||||||
this.fromEmail = fromEmail;
|
this.fromEmail = fromEmail;
|
||||||
if( replyTo != null )
|
if( replyTo != null )
|
||||||
this.replyTo.addAll(replyTo);
|
this.replyTo.addAll(replyTo);
|
||||||
this.setNotificationEventType(notificationEventType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailEvent(
|
public MailEvent(
|
||||||
@ -112,8 +104,7 @@ public class MailEvent extends DomainObject {
|
|||||||
final Collection<User> recipients,
|
final Collection<User> recipients,
|
||||||
final String fromName,
|
final String fromName,
|
||||||
final String fromEmail,
|
final String fromEmail,
|
||||||
final Collection<User> replyTo,
|
final Collection<User> replyTo
|
||||||
final NotificationEventType notificationEventType
|
|
||||||
){
|
){
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
this.messageBody = messageBody;
|
this.messageBody = messageBody;
|
||||||
@ -121,8 +112,7 @@ public class MailEvent extends DomainObject {
|
|||||||
this.fromName = fromName;
|
this.fromName = fromName;
|
||||||
this.fromEmail = fromEmail;
|
this.fromEmail = fromEmail;
|
||||||
if( replyTo != null )
|
if( replyTo != null )
|
||||||
this.replyTo.addAll(replyTo);
|
this.replyTo.addAll(replyTo);
|
||||||
this.setNotificationEventType(notificationEventType);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,15 +120,6 @@ public class MailEvent extends DomainObject {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setNotificationEventType(NotificationEventType notificationEventType) {
|
|
||||||
this.notificationEventType = notificationEventType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationEventType getNotificationEventType() {
|
|
||||||
return notificationEventType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<User> getRecipients() {
|
public Set<User> getRecipients() {
|
||||||
return recipients;
|
return recipients;
|
||||||
}
|
}
|
||||||
|
@ -1,109 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dataobjects;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.Cacheable;
|
|
||||||
import javax.persistence.DiscriminatorColumn;
|
|
||||||
import javax.persistence.DiscriminatorType;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Inheritance;
|
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.Lob;
|
|
||||||
import javax.persistence.ManyToMany;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.MappedSuperclass;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.UniqueConstraint;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
|
||||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@MappedSuperclass
|
|
||||||
public abstract class Message extends DomainObject implements Comparable<Message> {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Lob
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
|
||||||
private User fromUser;
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getFromUser() {
|
|
||||||
return fromUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFromUser(User fromUser) {
|
|
||||||
this.fromUser = fromUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
Message other = (Message) obj;
|
|
||||||
if (id == null) {
|
|
||||||
if (other.id != null)
|
|
||||||
return false;
|
|
||||||
} else if (!id.equals(other.id))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Message o) {
|
|
||||||
if( this == o )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(this.getDateCreated() != null && o.getDateCreated() != null){
|
|
||||||
//Reversed from what you might expect, because normally we want to display newest comment first in listviews
|
|
||||||
return o.getDateCreated().compareTo(this.getDateCreated());
|
|
||||||
}
|
|
||||||
if(this.getId() != null && o.getId() != null)
|
|
||||||
return this.getId().compareTo(o.getId());
|
|
||||||
if(this.message != null && o.message != null)
|
|
||||||
return message.compareTo(o.message);
|
|
||||||
//By now we have to conclude the two objects are basically two objects full of nulls
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,10 +8,16 @@ import java.util.List;
|
|||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.Cacheable;
|
import javax.persistence.Cacheable;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.PrePersist;
|
||||||
|
import javax.persistence.PreUpdate;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
import org.hibernate.annotations.Cache;
|
||||||
@ -19,6 +25,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
|||||||
import org.hibernate.annotations.Sort;
|
import org.hibernate.annotations.Sort;
|
||||||
import org.hibernate.annotations.SortType;
|
import org.hibernate.annotations.SortType;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
*
|
*
|
||||||
@ -28,7 +36,40 @@ import org.hibernate.annotations.SortType;
|
|||||||
@Table(name="message_board")
|
@Table(name="message_board")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||||
public class MessageBoard extends Board {
|
public class MessageBoard extends DomainObject{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
public String title;
|
||||||
|
|
||||||
|
@Basic(optional=false)
|
||||||
|
@Column(length=255)
|
||||||
|
private String commentableKey;
|
||||||
|
@Basic(optional=false)
|
||||||
|
private Long commentableId;
|
||||||
|
|
||||||
|
public MessageBoard() { }
|
||||||
|
public MessageBoard(Commentable commentable){
|
||||||
|
this.setCommentableKey(commentable.getCommentKey());
|
||||||
|
this.setCommentableId(commentable.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreUpdate
|
||||||
|
@PrePersist
|
||||||
|
public void validate(){
|
||||||
|
if(getCommentableKey().length() > 255)
|
||||||
|
throw new IllegalArgumentException("CommentThread-commentableKey may not be longer than 255 characters");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -36,7 +77,7 @@ public class MessageBoard extends Board {
|
|||||||
@OneToMany(mappedBy="messageBoard", orphanRemoval=true, cascade=CascadeType.ALL, targetEntity=BoardMessage.class)
|
@OneToMany(mappedBy="messageBoard", orphanRemoval=true, cascade=CascadeType.ALL, targetEntity=BoardMessage.class)
|
||||||
private SortedSet<BoardMessage> boardMessageSet = new TreeSet<BoardMessage>();
|
private SortedSet<BoardMessage> boardMessageSet = new TreeSet<BoardMessage>();
|
||||||
|
|
||||||
|
|
||||||
public List<BoardMessage> getBoardMessageList() {
|
public List<BoardMessage> getBoardMessageList() {
|
||||||
return new ArrayList<BoardMessage>(boardMessageSet);
|
return new ArrayList<BoardMessage>(boardMessageSet);
|
||||||
}
|
}
|
||||||
@ -49,5 +90,46 @@ public class MessageBoard extends Board {
|
|||||||
public void setBoardMessageSet( SortedSet<BoardMessage> boardMessageList) {
|
public void setBoardMessageSet( SortedSet<BoardMessage> boardMessageList) {
|
||||||
this.boardMessageSet = boardMessageList;
|
this.boardMessageSet = boardMessageList;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @return the commentableKey
|
||||||
|
*/
|
||||||
|
public String getCommentableKey() {
|
||||||
|
return commentableKey;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param commentableKey the commentableKey to set
|
||||||
|
*/
|
||||||
|
public void setCommentableKey(String commentableKey) {
|
||||||
|
this.commentableKey = commentableKey;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the commentableId
|
||||||
|
*/
|
||||||
|
public Long getCommentableId() {
|
||||||
|
return commentableId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param commentableId the commentableId to set
|
||||||
|
*/
|
||||||
|
public void setCommentableId(Long commentableId) {
|
||||||
|
this.commentableId = commentableId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the title
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param title the title to set
|
||||||
|
*/
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see se.su.dsv.scipro.data.dataobjects.interfaces.Commentable#getCommentKey()
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,9 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
|||||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||||
public class PrivateMessage extends LazyDeletableDomainObject{
|
public class PrivateMessage extends LazyDeletableDomainObject{
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@ -73,12 +73,7 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
|||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private StateOfMind stateOfMind = StateOfMind.NEUTRAL;
|
private StateOfMind stateOfMind = StateOfMind.NEUTRAL;
|
||||||
|
|
||||||
@OneToOne(mappedBy="project")
|
|
||||||
private MessageBoard messageBoard;
|
|
||||||
|
|
||||||
@OneToOne(mappedBy="project")
|
|
||||||
private SupervisorMessageBoard supervisorMessageBoard;
|
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
@ManyToOne(optional=false)
|
||||||
private ProjectClass projectClass;
|
private ProjectClass projectClass;
|
||||||
@ -173,10 +168,6 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageBoard getMessageBoard() {
|
|
||||||
return messageBoard;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param projectClass the projectClass to set
|
* @param projectClass the projectClass to set
|
||||||
*/
|
*/
|
||||||
@ -192,9 +183,6 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
|||||||
this.stateOfMind = stateOfMind;
|
this.stateOfMind = stateOfMind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SupervisorMessageBoard getSupervisorMessageBoard() {
|
|
||||||
return supervisorMessageBoard;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the projectClass
|
* @return the projectClass
|
||||||
|
@ -10,7 +10,6 @@ import javax.persistence.Entity;
|
|||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
import org.hibernate.annotations.Cache;
|
||||||
@ -26,6 +25,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
|||||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||||
public class Recipient extends LazyDeletableDomainObject {
|
public class Recipient extends LazyDeletableDomainObject {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dataobjects;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.Cacheable;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
|
||||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name="supervisor_board_message")
|
|
||||||
@Cacheable(true)
|
|
||||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
|
||||||
public class SupervisorBoardMessage extends Message{
|
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
|
||||||
private SupervisorMessageBoard supervisorMessageBoard;
|
|
||||||
|
|
||||||
@OneToMany
|
|
||||||
private List<SupervisorBoardMessage> replyMessageList = new ArrayList<SupervisorBoardMessage>();
|
|
||||||
|
|
||||||
public SupervisorMessageBoard getSupervisorMessageBoard() {
|
|
||||||
return supervisorMessageBoard;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupervisorMessageBoard(
|
|
||||||
SupervisorMessageBoard supervisorMessageBoard) {
|
|
||||||
this.supervisorMessageBoard = supervisorMessageBoard;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SupervisorBoardMessage> getReplyMessageList() {
|
|
||||||
return replyMessageList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReplyMessageList(List<SupervisorBoardMessage> replyMessageList) {
|
|
||||||
this.replyMessageList = replyMessageList;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.data.dataobjects;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.Cacheable;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
|
||||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "supervisor_message_board")
|
|
||||||
@Cacheable(true)
|
|
||||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
|
||||||
public class SupervisorMessageBoard extends Board {
|
|
||||||
@OneToMany
|
|
||||||
private List<SupervisorBoardMessage> supervisorBoardMessageList = new ArrayList<SupervisorBoardMessage>(1);
|
|
||||||
|
|
||||||
public List<SupervisorBoardMessage> getSupervisorBoardMessageList() {
|
|
||||||
return supervisorBoardMessageList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupervisorBoardMessageList(
|
|
||||||
List<SupervisorBoardMessage> supervisorBoardMessageList) {
|
|
||||||
this.supervisorBoardMessageList = supervisorBoardMessageList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -2,6 +2,8 @@ package se.su.dsv.scipro.data.dataobjects;
|
|||||||
|
|
||||||
import javax.persistence.Cacheable;
|
import javax.persistence.Cacheable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Lob;
|
import javax.persistence.Lob;
|
||||||
@ -11,6 +13,8 @@ import javax.persistence.Table;
|
|||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
import org.hibernate.annotations.Cache;
|
||||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Martin Peters - mpeters@dsv.su.se
|
* @author Martin Peters - mpeters@dsv.su.se
|
||||||
@ -38,6 +42,9 @@ public class UserSettings extends DomainObject {
|
|||||||
private String iPhoneId;
|
private String iPhoneId;
|
||||||
private boolean available = false;
|
private boolean available = false;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private NotificationPriority notificationPriority = NotificationPriority.MEDIUM;
|
||||||
|
|
||||||
@Lob
|
@Lob
|
||||||
private String statusMessage = "";
|
private String statusMessage = "";
|
||||||
|
|
||||||
@ -104,4 +111,19 @@ public class UserSettings extends DomainObject {
|
|||||||
this.activeProject = activeProject;
|
this.activeProject = activeProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the notificationPriority
|
||||||
|
*/
|
||||||
|
public NotificationPriority getNotificationPriority() {
|
||||||
|
return notificationPriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param notificationPriority the notificationPriority to set
|
||||||
|
*/
|
||||||
|
public void setNotificationPriority(NotificationPriority notificationPriority) {
|
||||||
|
this.notificationPriority = notificationPriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,116 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.data.dataobjects;
|
||||||
|
|
||||||
|
import javax.persistence.Cacheable;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Lob;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Cache;
|
||||||
|
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="web_notification")
|
||||||
|
@Cacheable(true)
|
||||||
|
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||||
|
public class WebNotification extends DomainObject{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Lob
|
||||||
|
private String infoText;
|
||||||
|
|
||||||
|
@Lob
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@ManyToOne(optional=false)
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
private boolean readByUser = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the infoText
|
||||||
|
*/
|
||||||
|
public String getInfoText() {
|
||||||
|
return infoText;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param infoText the infoText to set
|
||||||
|
*/
|
||||||
|
public void setInfoText(String infoText) {
|
||||||
|
this.infoText = infoText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the user
|
||||||
|
*/
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param user the user to set
|
||||||
|
*/
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the readByUser
|
||||||
|
*/
|
||||||
|
public boolean isReadByUser() {
|
||||||
|
return readByUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param readByUser the readByUser to set
|
||||||
|
*/
|
||||||
|
public void setReadByUser(boolean readByUser) {
|
||||||
|
this.readByUser = readByUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the url
|
||||||
|
*/
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param url the url to set
|
||||||
|
*/
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -6,6 +6,4 @@ public enum NotificationEventType {
|
|||||||
PEER_REVIEW_ACCEPTED,
|
PEER_REVIEW_ACCEPTED,
|
||||||
PEER_REVIEW_RATED,
|
PEER_REVIEW_RATED,
|
||||||
PEER_REVIEW_GRADED,
|
PEER_REVIEW_GRADED,
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.data.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan <aschan@dsv.su.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum NotificationPriority {
|
||||||
|
HIGH("High"), MEDIUM("Medium"), LOW("Low");
|
||||||
|
|
||||||
|
private String toString;
|
||||||
|
|
||||||
|
NotificationPriority(String toString){
|
||||||
|
this.toString = toString;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return toString;
|
||||||
|
}
|
||||||
|
}
|
@ -9,39 +9,37 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
|
|||||||
|
|
||||||
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
|
|
||||||
public class BoardMessageDataProvider implements IDataProvider<BoardMessage> {
|
public class BoardMessageDataProvider implements IDataProvider<BoardMessage> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private BoardMessageDao boardMessageDao;
|
private BoardMessageDao boardMessageDao;
|
||||||
|
|
||||||
private MessageBoard messageBoard;
|
|
||||||
|
|
||||||
|
|
||||||
public BoardMessageDataProvider(MessageBoard messageBoard) {
|
private IModel<MessageBoard> messageBoard;
|
||||||
|
|
||||||
|
public BoardMessageDataProvider(IModel<MessageBoard> messageBoard) {
|
||||||
InjectorHolder.getInjector().inject(this);
|
InjectorHolder.getInjector().inject(this);
|
||||||
this.messageBoard = messageBoard;
|
this.messageBoard = messageBoard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
//Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<? extends BoardMessage> iterator(int first, int count) {
|
public Iterator<? extends BoardMessage> iterator(int first, int count) {
|
||||||
return boardMessageDao.getBoardMessageList(messageBoard, first, count).iterator();
|
return boardMessageDao.getBoardMessageList(messageBoard.getObject(), first, count)
|
||||||
|
.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return messageBoard.getBoardMessageList().size();
|
return boardMessageDao.getBoardMessageListCount(messageBoard.getObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package se.su.dsv.scipro.dataproviders;
|
package se.su.dsv.scipro.dataproviders;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.wicket.injection.web.InjectorHolder;
|
import org.apache.wicket.injection.web.InjectorHolder;
|
||||||
import org.apache.wicket.markup.repeater.data.IDataProvider;
|
import org.apache.wicket.markup.repeater.data.IDataProvider;
|
||||||
@ -11,9 +12,7 @@ import org.apache.wicket.model.IModel;
|
|||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Role;
|
import se.su.dsv.scipro.data.dataobjects.Role;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
|
||||||
@ -23,6 +22,11 @@ import se.su.dsv.scipro.data.dataobjects.User;
|
|||||||
*/
|
*/
|
||||||
public class UserSearchDataProvider implements IDataProvider<User> {
|
public class UserSearchDataProvider implements IDataProvider<User> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.wicket.model.IDetachable#detach()
|
* @see org.apache.wicket.model.IDetachable#detach()
|
||||||
*/
|
*/
|
||||||
@ -32,6 +36,7 @@ public class UserSearchDataProvider implements IDataProvider<User> {
|
|||||||
|
|
||||||
private String userQuery;
|
private String userQuery;
|
||||||
private Class<? extends Role> role;
|
private Class<? extends Role> role;
|
||||||
|
private List<User> userList;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
@ -44,10 +49,11 @@ public class UserSearchDataProvider implements IDataProvider<User> {
|
|||||||
/**
|
/**
|
||||||
* @param finalSeminarDao
|
* @param finalSeminarDao
|
||||||
*/
|
*/
|
||||||
public UserSearchDataProvider(String userQuery, final Class<? extends Role> role) {
|
public UserSearchDataProvider(String userQuery, final Class<? extends Role> role, List<User> headSupervisor) {
|
||||||
InjectorHolder.getInjector().inject(this);
|
InjectorHolder.getInjector().inject(this);
|
||||||
this.userQuery = userQuery;
|
this.userQuery = userQuery;
|
||||||
this.role = role;
|
this.role = role;
|
||||||
|
this.userList = headSupervisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +64,7 @@ public class UserSearchDataProvider implements IDataProvider<User> {
|
|||||||
@Override
|
@Override
|
||||||
public Iterator<? extends User> iterator(int first, int count) {
|
public Iterator<? extends User> iterator(int first, int count) {
|
||||||
|
|
||||||
return userDao.findUserQuery(userQuery, first, count, role).iterator();
|
return userDao.findUserQuery(userQuery, first, count, role, userList).iterator();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +74,7 @@ public class UserSearchDataProvider implements IDataProvider<User> {
|
|||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
|
|
||||||
return userDao.findUserQueryCount(userQuery, role);
|
return userDao.findUserQueryCount(userQuery, role, userList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.dataproviders;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.apache.wicket.injection.web.InjectorHolder;
|
||||||
|
import org.apache.wicket.markup.repeater.data.IDataProvider;
|
||||||
|
import org.apache.wicket.model.IModel;
|
||||||
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.data.DomainObjectDetachableModel;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.WebNotificationDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class WebNotificationDataProvider implements IDataProvider<WebNotification> {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private WebNotificationDao webNotificationDao;
|
||||||
|
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detach() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebNotificationDataProvider(User user) {
|
||||||
|
InjectorHolder.getInjector().inject(this);
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Iterator<? extends WebNotification> iterator(int first, int count) {
|
||||||
|
return webNotificationDao.getWebNotifications(user, first, count).iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.apache.wicket.markup.repeater.data.IDataProvider#size()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return webNotificationDao.getCountOfWebNotifications(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.apache.wicket.markup.repeater.data.IDataProvider#model(java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IModel<WebNotification> model(WebNotification object) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new DomainObjectDetachableModel<WebNotification>(webNotificationDao, object);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,9 +9,7 @@ import org.apache.log4j.Level;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
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.orm.jpa.JpaTransactionManager;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.TransactionException;
|
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
|
||||||
import se.su.dsv.scipro.ApplicationSettings;
|
import se.su.dsv.scipro.ApplicationSettings;
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package se.su.dsv.scipro.json;
|
package se.su.dsv.scipro.json;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Username;
|
import se.su.dsv.scipro.data.dataobjects.Username;
|
||||||
|
@ -9,18 +9,15 @@ import org.apache.wicket.RequestCycle;
|
|||||||
import org.apache.wicket.markup.html.WebPage;
|
import org.apache.wicket.markup.html.WebPage;
|
||||||
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.data.dao.interfaces.PrivateMessageDao;
|
import se.su.dsv.scipro.data.dao.interfaces.PrivateMessageDao;
|
||||||
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.RecipientDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
import se.su.dsv.scipro.jsonobjects.JsonDeletePrivateMessage;
|
import se.su.dsv.scipro.jsonobjects.JsonDeletePrivateMessage;
|
||||||
import se.su.dsv.scipro.jsonobjects.JsonRecipient;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
@ -10,19 +10,13 @@ import org.apache.wicket.RequestCycle;
|
|||||||
import org.apache.wicket.markup.html.WebPage;
|
import org.apache.wicket.markup.html.WebPage;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
import se.su.dsv.scipro.ApplicationSettings;
|
|
||||||
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.RecipientDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
import se.su.dsv.scipro.data.enums.ProjectStatus;
|
|
||||||
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
@ -3,10 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.json.pages;
|
package se.su.dsv.scipro.json.pages;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.IRequestTarget;
|
import org.apache.wicket.IRequestTarget;
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.RequestCycle;
|
import org.apache.wicket.RequestCycle;
|
||||||
@ -17,12 +13,10 @@ import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,21 +2,14 @@ package se.su.dsv.scipro.json.pages;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.text.DateFormatter;
|
|
||||||
|
|
||||||
import org.apache.wicket.IRequestTarget;
|
import org.apache.wicket.IRequestTarget;
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.RequestCycle;
|
import org.apache.wicket.RequestCycle;
|
||||||
import org.apache.wicket.datetime.PatternDateConverter;
|
|
||||||
import org.apache.wicket.datetime.markup.html.basic.DateLabel;
|
|
||||||
import org.apache.wicket.markup.html.WebPage;
|
import org.apache.wicket.markup.html.WebPage;
|
||||||
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.ApplicationSettings;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
||||||
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.ProjectEventDao;
|
import se.su.dsv.scipro.data.dao.interfaces.ProjectEventDao;
|
||||||
|
@ -10,21 +10,15 @@ import org.apache.wicket.RequestCycle;
|
|||||||
import org.apache.wicket.markup.html.WebPage;
|
import org.apache.wicket.markup.html.WebPage;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
import se.su.dsv.scipro.ApplicationSettings;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.PrivateMessageDao;
|
import se.su.dsv.scipro.data.dao.interfaces.PrivateMessageDao;
|
||||||
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.RecipientDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
import se.su.dsv.scipro.data.enums.ProjectStatus;
|
|
||||||
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
@ -3,16 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.json.pages;
|
package se.su.dsv.scipro.json.pages;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.security.auth.login.FailedLoginException;
|
|
||||||
import javax.security.auth.login.LoginException;
|
|
||||||
|
|
||||||
import org.apache.wicket.IRequestTarget;
|
import org.apache.wicket.IRequestTarget;
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
@ -27,13 +18,9 @@ import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
|||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
import se.su.dsv.scipro.jsonobjects.JsonLogin;
|
|
||||||
import se.su.dsv.scipro.jsonobjects.JsonRecipient;
|
import se.su.dsv.scipro.jsonobjects.JsonRecipient;
|
||||||
import se.su.dsv.scipro.security.auth.Authenticator;
|
|
||||||
import biz.source_code.base64Coder.Base64Coder;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,10 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.json.pages;
|
package se.su.dsv.scipro.json.pages;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.IRequestTarget;
|
import org.apache.wicket.IRequestTarget;
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.RequestCycle;
|
import org.apache.wicket.RequestCycle;
|
||||||
@ -17,14 +13,11 @@ import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
import se.su.dsv.scipro.jsonobjects.JsonRecipient;
|
|
||||||
import se.su.dsv.scipro.jsonobjects.JsonStatus;
|
import se.su.dsv.scipro.jsonobjects.JsonStatus;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,10 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.json.pages;
|
package se.su.dsv.scipro.json.pages;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.IRequestTarget;
|
import org.apache.wicket.IRequestTarget;
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.RequestCycle;
|
import org.apache.wicket.RequestCycle;
|
||||||
@ -17,12 +13,10 @@ import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,31 +6,23 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar;
|
import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar;
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||||
import org.apache.wicket.markup.html.WebResource;
|
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
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.FileUpload;
|
||||||
import org.apache.wicket.markup.html.form.upload.FileUploadField;
|
import org.apache.wicket.markup.html.form.upload.FileUploadField;
|
||||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
|
||||||
import org.apache.wicket.markup.html.link.Link;
|
|
||||||
import org.apache.wicket.markup.html.link.ResourceLink;
|
|
||||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
import org.apache.wicket.markup.html.panel.Panel;
|
||||||
import org.apache.wicket.markup.repeater.RepeatingView;
|
import org.apache.wicket.markup.repeater.RepeatingView;
|
||||||
import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
import org.apache.wicket.util.lang.Bytes;
|
import org.apache.wicket.util.lang.Bytes;
|
||||||
import org.apache.wicket.util.resource.IResourceStream;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
import se.su.dsv.scipro.data.dataobjects.Resource;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
import se.su.dsv.scipro.repository.FileRepository;
|
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.repository.pages.RepositoryDownloadPage;
|
|
||||||
|
|
||||||
public class FileResourcePanel extends Panel{
|
public class FileResourcePanel extends Panel{
|
||||||
|
|
||||||
|
@ -33,18 +33,21 @@ import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|||||||
*/
|
*/
|
||||||
public class ResourceBookmarkableCategoryPanel extends Panel {
|
public class ResourceBookmarkableCategoryPanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private ResourceDao resourceDao;
|
private ResourceDao resourceDao;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private CategoryDao categoryDao;
|
private CategoryDao categoryDao;
|
||||||
|
|
||||||
private Resource resource;
|
|
||||||
|
|
||||||
public ResourceBookmarkableCategoryPanel(String id, PageParameters pp) {
|
public ResourceBookmarkableCategoryPanel(String id, PageParameters pp) {
|
||||||
super(id);
|
super(id);
|
||||||
add(new AjaxLink<Tag>("showAll") {
|
add(new AjaxLink<Tag>("showAll") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
|
||||||
|
@ -3,60 +3,18 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.knol.resource.panels;
|
package se.su.dsv.scipro.knol.resource.panels;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.wicket.IClusterable;
|
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.RestartResponseException;
|
import org.apache.wicket.RestartResponseException;
|
||||||
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.behavior.AttributeAppender;
|
|
||||||
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.ListMultipleChoice;
|
|
||||||
import org.apache.wicket.markup.html.form.TextArea;
|
|
||||||
import org.apache.wicket.markup.html.form.TextField;
|
|
||||||
import org.apache.wicket.markup.html.link.ExternalLink;
|
|
||||||
import org.apache.wicket.markup.html.list.ListItem;
|
|
||||||
import org.apache.wicket.markup.html.list.ListView;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
import org.apache.wicket.markup.html.panel.Panel;
|
||||||
import org.apache.wicket.model.CompoundPropertyModel;
|
|
||||||
import org.apache.wicket.model.Model;
|
|
||||||
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.SciProApplication;
|
import se.su.dsv.scipro.SciProApplication;
|
||||||
import se.su.dsv.scipro.SciProSession;
|
|
||||||
import se.su.dsv.scipro.commentthread.panels.CommentThreadPanel;
|
|
||||||
import se.su.dsv.scipro.components.FormFeedbackPanel;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CommentThreadDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.RatableDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.RatingDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ResourceDao;
|
import se.su.dsv.scipro.data.dao.interfaces.ResourceDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.TagDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Rating;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Resource;
|
import se.su.dsv.scipro.data.dataobjects.Resource;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Tag;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
import se.su.dsv.scipro.data.enums.RatingValue;
|
|
||||||
import se.su.dsv.scipro.data.enums.ResourceType;
|
import se.su.dsv.scipro.data.enums.ResourceType;
|
||||||
import se.su.dsv.scipro.knol.resource.model.ResourceModel;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.BookmarkableResourcePage;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.HtmlWebMarkupContainer;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|
||||||
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
|
||||||
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
@ -64,6 +22,7 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
|||||||
*/
|
*/
|
||||||
public class ResourceBookmarkablePanel extends Panel {
|
public class ResourceBookmarkablePanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
|
@ -31,18 +31,21 @@ import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
|||||||
*/
|
*/
|
||||||
public class ResourceBookmarkableTagPanel extends Panel {
|
public class ResourceBookmarkableTagPanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private ResourceDao resourceDao;
|
private ResourceDao resourceDao;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private TagDao tagDao;
|
private TagDao tagDao;
|
||||||
|
|
||||||
private Resource resource;
|
|
||||||
|
|
||||||
public ResourceBookmarkableTagPanel(String id, PageParameters pp) {
|
public ResourceBookmarkableTagPanel(String id, PageParameters pp) {
|
||||||
super(id);
|
super(id);
|
||||||
add(new AjaxLink<Tag>("showAll") {
|
add(new AjaxLink<Tag>("showAll") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
|
||||||
|
@ -74,6 +74,8 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
|||||||
*/
|
*/
|
||||||
public class ResourceListPanel extends Panel {
|
public class ResourceListPanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private RatingDao ratingDao;
|
private RatingDao ratingDao;
|
||||||
|
|
||||||
@ -113,7 +115,6 @@ public class ResourceListPanel extends Panel {
|
|||||||
private TextArea<String> infoEmbed;
|
private TextArea<String> infoEmbed;
|
||||||
private EditLinkResourceForm editLinkResourceForm;
|
private EditLinkResourceForm editLinkResourceForm;
|
||||||
private EditEmbedResourceForm editEmbedResourceForm;
|
private EditEmbedResourceForm editEmbedResourceForm;
|
||||||
private List<Resource> linkList;
|
|
||||||
private TextArea<String> embedTextArea;
|
private TextArea<String> embedTextArea;
|
||||||
private List<Resource> resourcesList;
|
private List<Resource> resourcesList;
|
||||||
private ResourceType resourceType;
|
private ResourceType resourceType;
|
||||||
@ -130,6 +131,9 @@ public class ResourceListPanel extends Panel {
|
|||||||
listContainer.setOutputMarkupId(true);
|
listContainer.setOutputMarkupId(true);
|
||||||
listContainer.add(pagingNavigator = new CustomPagingNavigator(
|
listContainer.add(pagingNavigator = new CustomPagingNavigator(
|
||||||
"navigator", linkListView) {
|
"navigator", linkListView) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return linkListView.size() > 0;
|
return linkListView.size() > 0;
|
||||||
@ -180,6 +184,9 @@ public class ResourceListPanel extends Panel {
|
|||||||
linkListView = new PageableListView<Resource>("link-item",
|
linkListView = new PageableListView<Resource>("link-item",
|
||||||
resourceList, 20) {
|
resourceList, 20) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(final ListItem<Resource> item) {
|
protected void populateItem(final ListItem<Resource> item) {
|
||||||
final Resource resource = resourceDao.reLoad(item
|
final Resource resource = resourceDao.reLoad(item
|
||||||
@ -193,6 +200,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
if (resource.getHeading() == null) {
|
if (resource.getHeading() == null) {
|
||||||
item.add(new ExternalLink("link", resource.getLink(),
|
item.add(new ExternalLink("link", resource.getLink(),
|
||||||
resource.getLink()) {
|
resource.getLink()) {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return resource.getEmbedCode() == null;
|
return resource.getEmbedCode() == null;
|
||||||
@ -201,6 +213,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
} else {
|
} else {
|
||||||
item.add(new ExternalLink("link", resource.getLink(),
|
item.add(new ExternalLink("link", resource.getLink(),
|
||||||
resource.getHeading()) {
|
resource.getHeading()) {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return resource.getEmbedCode() == null;
|
return resource.getEmbedCode() == null;
|
||||||
@ -208,6 +225,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
item.add(new Label("heading", resource.getHeading()) {
|
item.add(new Label("heading", resource.getHeading()) {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return resource.getEmbedCode() != null;
|
return resource.getEmbedCode() != null;
|
||||||
@ -215,6 +237,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
});
|
});
|
||||||
item.add(new ExternalLink("linkAddress", resource.getLink(),
|
item.add(new ExternalLink("linkAddress", resource.getLink(),
|
||||||
resource.getLink()) {
|
resource.getLink()) {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return resource.getEmbedCode() == null;
|
return resource.getEmbedCode() == null;
|
||||||
@ -257,6 +284,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
item.add(new ListView<Category>("category-item", resource.getCategoryList()) {
|
item.add(new ListView<Category>("category-item", resource.getCategoryList()) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(final ListItem<Category> item) {
|
protected void populateItem(final ListItem<Category> item) {
|
||||||
final Category category = item.getModelObject();
|
final Category category = item.getModelObject();
|
||||||
@ -271,6 +303,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
});
|
});
|
||||||
item.add(new ListView<Tag>("tag-item", resource.getTagList()) {
|
item.add(new ListView<Tag>("tag-item", resource.getTagList()) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(final ListItem<Tag> item) {
|
protected void populateItem(final ListItem<Tag> item) {
|
||||||
final Tag tag = item.getModelObject();
|
final Tag tag = item.getModelObject();
|
||||||
@ -307,6 +344,10 @@ public class ResourceListPanel extends Panel {
|
|||||||
item.add(new AjaxLink<String>("showComments",
|
item.add(new AjaxLink<String>("showComments",
|
||||||
new Model<String>("Show Comments")) {
|
new Model<String>("Show Comments")) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private boolean clicked = false;
|
private boolean clicked = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -337,6 +378,10 @@ public class ResourceListPanel extends Panel {
|
|||||||
}.add(comment));
|
}.add(comment));
|
||||||
item.add(new AjaxLink<Void>("deleteResource") {
|
item.add(new AjaxLink<Void>("deleteResource") {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
Resource link2 = resourceDao.reLoad(resource);
|
Resource link2 = resourceDao.reLoad(resource);
|
||||||
@ -388,6 +433,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
item.add(new AjaxLink<Recipient>("editResource") {
|
item.add(new AjaxLink<Recipient>("editResource") {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
editResource = resourceDao.reLoad(resource);
|
editResource = resourceDao.reLoad(resource);
|
||||||
@ -433,6 +483,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
});
|
});
|
||||||
item.add(new HtmlWebMarkupContainer("embedCode", resource
|
item.add(new HtmlWebMarkupContainer("embedCode", resource
|
||||||
.getEmbedCode()) {
|
.getEmbedCode()) {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return resource.getEmbedCode() != null;
|
return resource.getEmbedCode() != null;
|
||||||
@ -452,6 +507,10 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
private class AddRateButton implements IClusterable {
|
private class AddRateButton implements IClusterable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private AjaxLink<String> ajaxLinkUp, ajaxLinkDown;
|
private AjaxLink<String> ajaxLinkUp, ajaxLinkDown;
|
||||||
|
|
||||||
public AddRateButton(ListItem<Resource> item) {
|
public AddRateButton(ListItem<Resource> item) {
|
||||||
@ -527,6 +586,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
pointLabel.setOutputMarkupId(true);
|
pointLabel.setOutputMarkupId(true);
|
||||||
ajaxLinkUp = new AjaxLink<String>("upLink", new Model<String>("Up")) {
|
ajaxLinkUp = new AjaxLink<String>("upLink", new Model<String>("Up")) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
Resource resourc = resourceDao.reLoad(resource);
|
Resource resourc = resourceDao.reLoad(resource);
|
||||||
@ -583,6 +647,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
ajaxLinkDown = new AjaxLink<String>("downLink", new Model<String>(
|
ajaxLinkDown = new AjaxLink<String>("downLink", new Model<String>(
|
||||||
"Down")) {
|
"Down")) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
Resource resourc = resourceDao.reLoad(resource);
|
Resource resourc = resourceDao.reLoad(resource);
|
||||||
@ -652,10 +721,13 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
private class EditLinkResourceForm extends Form<ResourceModel> {
|
private class EditLinkResourceForm extends Form<ResourceModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private ListView<Tag> tagListView;
|
private ListView<Tag> tagListView;
|
||||||
private List<Tag> tagList;
|
private List<Tag> tagList;
|
||||||
private WebMarkupContainer tagListContainer;
|
private WebMarkupContainer tagListContainer;
|
||||||
private Collection<Category> selectedCategoryCollection = new ArrayList<Category>();
|
|
||||||
|
|
||||||
public EditLinkResourceForm(String name) {
|
public EditLinkResourceForm(String name) {
|
||||||
super(name, new CompoundPropertyModel<ResourceModel>(
|
super(name, new CompoundPropertyModel<ResourceModel>(
|
||||||
@ -689,6 +761,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// Implement dispay here
|
// Implement dispay here
|
||||||
public Object getDisplayValue(Category category) {
|
public Object getDisplayValue(Category category) {
|
||||||
return category.getCategoryName();
|
return category.getCategoryName();
|
||||||
@ -715,6 +792,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
add(new AjaxButton("submitButton", new Model<String>(
|
add(new AjaxButton("submitButton", new Model<String>(
|
||||||
"Save Resource")) {
|
"Save Resource")) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
editResource = resourceDao.reLoad(editResource);
|
editResource = resourceDao.reLoad(editResource);
|
||||||
@ -776,7 +858,7 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -794,6 +876,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
tagListView = new ListView<Tag>("tag-item", tagList) {
|
tagListView = new ListView<Tag>("tag-item", tagList) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(final ListItem<Tag> item) {
|
protected void populateItem(final ListItem<Tag> item) {
|
||||||
final Tag tag = item.getModelObject();
|
final Tag tag = item.getModelObject();
|
||||||
@ -808,6 +895,10 @@ public class ResourceListPanel extends Panel {
|
|||||||
tagContainer
|
tagContainer
|
||||||
.add(deleteLink = new AjaxLink<Void>("deleteTag") {
|
.add(deleteLink = new AjaxLink<Void>("deleteTag") {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
tagList.remove(tag);
|
tagList.remove(tag);
|
||||||
@ -842,10 +933,13 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
private class EditEmbedResourceForm extends Form<ResourceModel> {
|
private class EditEmbedResourceForm extends Form<ResourceModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private ListView<Tag> tagListView;
|
private ListView<Tag> tagListView;
|
||||||
private List<Tag> tagList;
|
private List<Tag> tagList;
|
||||||
private WebMarkupContainer tagListContainer;
|
private WebMarkupContainer tagListContainer;
|
||||||
private Collection<Category> selectedCategoryCollection = new ArrayList<Category>();
|
|
||||||
|
|
||||||
public EditEmbedResourceForm(String name) {
|
public EditEmbedResourceForm(String name) {
|
||||||
super(name, new CompoundPropertyModel<ResourceModel>(
|
super(name, new CompoundPropertyModel<ResourceModel>(
|
||||||
@ -872,6 +966,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// Implement dispay here
|
// Implement dispay here
|
||||||
public Object getDisplayValue(Category category) {
|
public Object getDisplayValue(Category category) {
|
||||||
return category.getCategoryName();
|
return category.getCategoryName();
|
||||||
@ -901,6 +1000,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
add(new AjaxButton("submitButton", new Model<String>(
|
add(new AjaxButton("submitButton", new Model<String>(
|
||||||
"Save Resource")) {
|
"Save Resource")) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
editResource = resourceDao.reLoad(editResource);
|
editResource = resourceDao.reLoad(editResource);
|
||||||
@ -963,7 +1067,7 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -981,6 +1085,11 @@ public class ResourceListPanel extends Panel {
|
|||||||
|
|
||||||
tagListView = new ListView<Tag>("tag-embed-item", tagList) {
|
tagListView = new ListView<Tag>("tag-embed-item", tagList) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(final ListItem<Tag> item) {
|
protected void populateItem(final ListItem<Tag> item) {
|
||||||
final Tag tag = item.getModelObject();
|
final Tag tag = item.getModelObject();
|
||||||
@ -990,6 +1099,10 @@ public class ResourceListPanel extends Panel {
|
|||||||
tagContainer.add(new Label("tagEmbed", tag.getTag()));
|
tagContainer.add(new Label("tagEmbed", tag.getTag()));
|
||||||
tagContainer.add(new AjaxLink<Void>("deleteTagEmbed") {
|
tagContainer.add(new AjaxLink<Void>("deleteTagEmbed") {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
tagList.remove(tag);
|
tagList.remove(tag);
|
||||||
|
@ -51,6 +51,8 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
|||||||
*/
|
*/
|
||||||
public class ResourcesPanel extends Panel {
|
public class ResourcesPanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private TagDao tagDao;
|
private TagDao tagDao;
|
||||||
|
|
||||||
@ -107,6 +109,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
// editCategoriesDialog.setHeight(340);
|
// editCategoriesDialog.setHeight(340);
|
||||||
editCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
|
editCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(JsScopeContext scopeContext) {
|
protected void execute(JsScopeContext scopeContext) {
|
||||||
scopeContext.append("window.location.reload()");
|
scopeContext.append("window.location.reload()");
|
||||||
@ -128,6 +132,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
// addCategoriesDialog.setHeight(340);
|
// addCategoriesDialog.setHeight(340);
|
||||||
addCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
|
addCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(JsScopeContext scopeContext) {
|
protected void execute(JsScopeContext scopeContext) {
|
||||||
scopeContext.append("window.location.reload()");
|
scopeContext.append("window.location.reload()");
|
||||||
@ -142,6 +148,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
add(new AjaxLink<String>("addLinkResource", new Model<String>(
|
add(new AjaxLink<String>("addLinkResource", new Model<String>(
|
||||||
"Add Link Resource")) {
|
"Add Link Resource")) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
target.addComponent(linkDialog);
|
target.addComponent(linkDialog);
|
||||||
@ -152,6 +161,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
add(new AjaxLink<String>("addEmbedResource", new Model<String>(
|
add(new AjaxLink<String>("addEmbedResource", new Model<String>(
|
||||||
"Add Link Resource")) {
|
"Add Link Resource")) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
target.addComponent(embedDialog);
|
target.addComponent(embedDialog);
|
||||||
@ -166,6 +178,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
AjaxLink<String> editCategories, addCategories;
|
AjaxLink<String> editCategories, addCategories;
|
||||||
add(editCategories = new AjaxLink<String>("adminCategories") {
|
add(editCategories = new AjaxLink<String>("adminCategories") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
target.addComponent(editCategoriesDialog);
|
target.addComponent(editCategoriesDialog);
|
||||||
@ -176,6 +190,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
add(addCategories = new AjaxLink<String>("addCategories") {
|
add(addCategories = new AjaxLink<String>("addCategories") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
target.addComponent(addCategoriesDialog);
|
target.addComponent(addCategoriesDialog);
|
||||||
@ -187,6 +203,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class AddLinkResourceForm extends Form<ResourceModel> {
|
private class AddLinkResourceForm extends Form<ResourceModel> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public AddLinkResourceForm(String name) {
|
public AddLinkResourceForm(String name) {
|
||||||
super(name, new CompoundPropertyModel<ResourceModel>(
|
super(name, new CompoundPropertyModel<ResourceModel>(
|
||||||
new ResourceModel()));
|
new ResourceModel()));
|
||||||
@ -215,6 +234,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// Implement dispay here
|
// Implement dispay here
|
||||||
public Object getDisplayValue(Category category) {
|
public Object getDisplayValue(Category category) {
|
||||||
return category.getCategoryName();
|
return category.getCategoryName();
|
||||||
@ -244,6 +265,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
add(new AjaxButton("submitButton", new Model<String>(
|
add(new AjaxButton("submitButton", new Model<String>(
|
||||||
"Save Resource")) {
|
"Save Resource")) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
Resource link = new Resource();
|
Resource link = new Resource();
|
||||||
@ -293,7 +317,7 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -302,12 +326,16 @@ public class ResourcesPanel extends Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class AddEmbedResourceForm extends Form<ResourceModel> {
|
private class AddEmbedResourceForm extends Form<ResourceModel> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public AddEmbedResourceForm(String name) {
|
public AddEmbedResourceForm(String name) {
|
||||||
super(name, new CompoundPropertyModel<ResourceModel>(
|
super(name, new CompoundPropertyModel<ResourceModel>(
|
||||||
new ResourceModel()));
|
new ResourceModel()));
|
||||||
final WebMarkupContainer feedbackContainer = new WebMarkupContainer(
|
final WebMarkupContainer feedbackContainer = new WebMarkupContainer(
|
||||||
"feedbackContainer");
|
"feedbackContainer");
|
||||||
feedbackContainer.setOutputMarkupId(true);
|
feedbackContainer.setOutputMarkupId(true);
|
||||||
|
|
||||||
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<ResourceModel>(
|
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<ResourceModel>(
|
||||||
"feedbackPanel", this);
|
"feedbackPanel", this);
|
||||||
feedbackContainer.add(feedbackPanel);
|
feedbackContainer.add(feedbackPanel);
|
||||||
@ -327,6 +355,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// Implement dispay here
|
// Implement dispay here
|
||||||
public Object getDisplayValue(Category category) {
|
public Object getDisplayValue(Category category) {
|
||||||
return category.getCategoryName();
|
return category.getCategoryName();
|
||||||
@ -354,6 +384,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
add(new AjaxButton("submitButton", new Model<String>(
|
add(new AjaxButton("submitButton", new Model<String>(
|
||||||
"Save Resource")) {
|
"Save Resource")) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
Resource link;
|
Resource link;
|
||||||
@ -408,7 +441,7 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -419,8 +452,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
private class EditCategoriesForm extends Form<CategoryModel> {
|
private class EditCategoriesForm extends Form<CategoryModel> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private Category category;
|
private Category category;
|
||||||
private List<Category> categoryList;
|
|
||||||
|
|
||||||
public EditCategoriesForm(String name) {
|
public EditCategoriesForm(String name) {
|
||||||
super(name, new CompoundPropertyModel<CategoryModel>(
|
super(name, new CompoundPropertyModel<CategoryModel>(
|
||||||
@ -439,6 +472,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
add(categoryName);
|
add(categoryName);
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// Implement dispay here
|
// Implement dispay here
|
||||||
public Object getDisplayValue(Category category) {
|
public Object getDisplayValue(Category category) {
|
||||||
return category.getCategoryName();
|
return category.getCategoryName();
|
||||||
@ -454,6 +489,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
|
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
|
||||||
"selectedCategory", new ListModel<Category>(
|
"selectedCategory", new ListModel<Category>(
|
||||||
categoryDao.findAll()), choiceRenderer) {
|
categoryDao.findAll()), choiceRenderer) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CharSequence getDefaultChoice(Object selected) {
|
protected CharSequence getDefaultChoice(Object selected) {
|
||||||
return "";
|
return "";
|
||||||
@ -482,6 +520,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
add(new AjaxButton("deleteCategory", new Model<String>(
|
add(new AjaxButton("deleteCategory", new Model<String>(
|
||||||
"Delete Category")) {
|
"Delete Category")) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
if (category != null) {
|
if (category != null) {
|
||||||
@ -530,7 +571,7 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -539,6 +580,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
add(new AjaxButton("editButton", new Model<String>("Save Edit")) {
|
add(new AjaxButton("editButton", new Model<String>("Save Edit")) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
@ -565,7 +609,7 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,6 +617,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
add(new AjaxButton("closeButton", new Model<String>("Close")) {
|
add(new AjaxButton("closeButton", new Model<String>("Close")) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
editCategoriesDialog.close(target);
|
editCategoriesDialog.close(target);
|
||||||
@ -581,7 +627,7 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -591,7 +637,7 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
private class AddCategoriesForm extends Form<CategoryModel> {
|
private class AddCategoriesForm extends Form<CategoryModel> {
|
||||||
|
|
||||||
private Category category;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public AddCategoriesForm(String name) {
|
public AddCategoriesForm(String name) {
|
||||||
super(name, new CompoundPropertyModel<CategoryModel>(
|
super(name, new CompoundPropertyModel<CategoryModel>(
|
||||||
@ -610,6 +656,8 @@ public class ResourcesPanel extends Panel {
|
|||||||
add(categoryName);
|
add(categoryName);
|
||||||
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// Implement dispay here
|
// Implement dispay here
|
||||||
public Object getDisplayValue(Category category) {
|
public Object getDisplayValue(Category category) {
|
||||||
return category.getCategoryName();
|
return category.getCategoryName();
|
||||||
@ -625,6 +673,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
|
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
|
||||||
"selectedCategory", new ListModel<Category>(
|
"selectedCategory", new ListModel<Category>(
|
||||||
categoryDao.findAll()), choiceRenderer) {
|
categoryDao.findAll()), choiceRenderer) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CharSequence getDefaultChoice(Object selected) {
|
protected CharSequence getDefaultChoice(Object selected) {
|
||||||
return "";
|
return "";
|
||||||
@ -638,6 +689,9 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
add(new AjaxButton("addButton", new Model<String>("Add Category")) {
|
add(new AjaxButton("addButton", new Model<String>("Add Category")) {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
CategoryModel categoryModel = (CategoryModel) form
|
CategoryModel categoryModel = (CategoryModel) form
|
||||||
@ -667,13 +721,15 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add(new AjaxButton("closeButton", new Model<String>("Close")) {
|
add(new AjaxButton("closeButton", new Model<String>("Close")) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
addCategoriesDialog.close(target);
|
addCategoriesDialog.close(target);
|
||||||
@ -682,7 +738,7 @@ public class ResourcesPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2,19 +2,37 @@ package se.su.dsv.scipro.message.models;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.wicket.IClusterable;
|
import org.apache.wicket.IClusterable;
|
||||||
|
import org.apache.wicket.PageParameters;
|
||||||
|
import org.apache.wicket.Request;
|
||||||
|
import org.apache.wicket.RequestCycle;
|
||||||
import org.apache.wicket.injection.web.InjectorHolder;
|
import org.apache.wicket.injection.web.InjectorHolder;
|
||||||
|
import org.apache.wicket.protocol.http.RequestUtils;
|
||||||
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;
|
||||||
|
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationMessage;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.WebNotificationDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.PrivateMessageDao;
|
import se.su.dsv.scipro.data.dao.interfaces.PrivateMessageDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RecipientDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
||||||
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
import se.su.dsv.scipro.data.dataobjects.PrivateMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
import se.su.dsv.scipro.data.dataobjects.Recipient;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationEventType;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||||
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
import se.su.dsv.scipro.util.PropsUtils;
|
||||||
|
|
||||||
public class PrivateMessageModel implements IClusterable {
|
public class PrivateMessageModel implements IClusterable {
|
||||||
|
|
||||||
@ -26,6 +44,8 @@ public class PrivateMessageModel implements IClusterable {
|
|||||||
private PrivateMessageDao privateMessageDao;
|
private PrivateMessageDao privateMessageDao;
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private RecipientDao recipientDao;
|
private RecipientDao recipientDao;
|
||||||
|
@SpringBean
|
||||||
|
private NotificationController notificationController;
|
||||||
|
|
||||||
private String subject;
|
private String subject;
|
||||||
private String textMessage;
|
private String textMessage;
|
||||||
@ -34,6 +54,8 @@ public class PrivateMessageModel implements IClusterable {
|
|||||||
private List<User> userFinder = new ArrayList<User>();
|
private List<User> userFinder = new ArrayList<User>();
|
||||||
private Collection<User> selectedUserList;
|
private Collection<User> selectedUserList;
|
||||||
|
|
||||||
|
private final static String relativePath = "inbox/";
|
||||||
|
|
||||||
public PrivateMessageModel() {
|
public PrivateMessageModel() {
|
||||||
InjectorHolder.getInjector().inject(this);
|
InjectorHolder.getInjector().inject(this);
|
||||||
}
|
}
|
||||||
@ -53,6 +75,38 @@ public class PrivateMessageModel implements IClusterable {
|
|||||||
rec.setPrivateMessage(pm);
|
rec.setPrivateMessage(pm);
|
||||||
rec = recipientDao.save(rec);
|
rec = recipientDao.save(rec);
|
||||||
}
|
}
|
||||||
|
for(User user: users){
|
||||||
|
createNotification(user, subject +"\n\n" + textMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createNotification(final User user,final String message){
|
||||||
|
Properties props = null;
|
||||||
|
try {
|
||||||
|
props = PropsUtils.load("notification.properties");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String mailSubject = props.getProperty("mailSubject");
|
||||||
|
String privateMessageNotification = props.getProperty("privateMessageNotification");
|
||||||
|
String twoNewLines = props.getProperty("twoNewLines");
|
||||||
|
|
||||||
|
|
||||||
|
String webNotificationMessage = SciProSession.get()
|
||||||
|
.getUser()
|
||||||
|
+ privateMessageNotification;
|
||||||
|
|
||||||
|
String mailMessage = webNotificationMessage + twoNewLines + message;
|
||||||
|
|
||||||
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, mailSubject, mailMessage);
|
||||||
|
notificationController.processNotification(user, notificationMessage,
|
||||||
|
getAbsoluteForPrivateMessageURL(), NotificationPriority.MEDIUM);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getAbsoluteForPrivateMessageURL() {
|
||||||
|
PageParameters pageParameters = new PageParameters();
|
||||||
|
return RequestUtils.toAbsolutePath(RequestCycle.get().urlFor(PrivateMessagesPage.class, pageParameters).toString());
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,15 +5,12 @@ package se.su.dsv.scipro.opponent.models;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.wicket.IClusterable;
|
import org.apache.wicket.IClusterable;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
||||||
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.FinalSeminarLanguages;
|
import se.su.dsv.scipro.data.enums.FinalSeminarLanguages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,6 +19,7 @@ import se.su.dsv.scipro.data.enums.FinalSeminarLanguages;
|
|||||||
*/
|
*/
|
||||||
public class OpponentModel implements IClusterable {
|
public class OpponentModel implements IClusterable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private Project selectedProject;
|
private Project selectedProject;
|
||||||
private Date date;
|
private Date date;
|
||||||
private String startHour = "10";
|
private String startHour = "10";
|
||||||
@ -33,7 +31,6 @@ public class OpponentModel implements IClusterable {
|
|||||||
private List<FinalSeminarActiveParticipation> activeParticipations = new ArrayList<FinalSeminarActiveParticipation>();
|
private List<FinalSeminarActiveParticipation> activeParticipations = new ArrayList<FinalSeminarActiveParticipation>();
|
||||||
private List<FinalSeminarActiveParticipation> opponentList = new ArrayList<FinalSeminarActiveParticipation>();
|
private List<FinalSeminarActiveParticipation> opponentList = new ArrayList<FinalSeminarActiveParticipation>();
|
||||||
private String project;
|
private String project;
|
||||||
private String contactsTextArea;
|
|
||||||
|
|
||||||
private FinalSeminarLanguages presentationLanguage;
|
private FinalSeminarLanguages presentationLanguage;
|
||||||
private FinalSeminarLanguages reportLanguage;
|
private FinalSeminarLanguages reportLanguage;
|
||||||
@ -118,6 +115,20 @@ public class OpponentModel implements IClusterable {
|
|||||||
public FinalSeminarLanguages getReportLanguage() {
|
public FinalSeminarLanguages getReportLanguage() {
|
||||||
return reportLanguage;
|
return reportLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
|
public String getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param project the project to set
|
||||||
|
*/
|
||||||
|
public void setProject(String project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,8 +28,10 @@ public class AvailableFinalSeminarHelpPanel extends Panel {
|
|||||||
int maxActiveParticpants = 0;
|
int maxActiveParticpants = 0;
|
||||||
GeneralSystemSettings settings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
|
GeneralSystemSettings settings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
|
||||||
|
|
||||||
|
|
||||||
registerAsActiveParticpant = settings.getDaysBeforeFinalSeminarCanRegisterAsActiveParticipant();
|
registerAsActiveParticpant = settings.getDaysBeforeFinalSeminarCanRegisterAsActiveParticipant();
|
||||||
registerAsOpponent = settings.getDaysBeforeFinalSeminarCanRegisterAsOpponent();
|
registerAsOpponent = settings.getDaysBeforeFinalSeminarCanRegisterAsOpponent();
|
||||||
|
|
||||||
maxActiveParticpants = settings.getFinalSeminarMaxActiveParticipants();
|
maxActiveParticpants = settings.getFinalSeminarMaxActiveParticipants();
|
||||||
|
|
||||||
ProjectClassSettings bachelorSettings = projectClassDao.getProjectClass(ProjectClass.BACHELOR).getProjectClassSettings();
|
ProjectClassSettings bachelorSettings = projectClassDao.getProjectClass(ProjectClass.BACHELOR).getProjectClassSettings();
|
||||||
|
@ -8,12 +8,10 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
|
import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
|
||||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
import org.apache.wicket.markup.html.form.RadioChoice;
|
import org.apache.wicket.markup.html.form.RadioChoice;
|
||||||
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 se.su.dsv.scipro.dataproviders.FinalSeminarAfterNowDataProvider;
|
import se.su.dsv.scipro.dataproviders.FinalSeminarAfterNowDataProvider;
|
||||||
@ -25,6 +23,7 @@ import se.su.dsv.scipro.dataproviders.FinalSeminarBeforeNowDataProvider;
|
|||||||
*/
|
*/
|
||||||
public class ChangeViewPanel extends Panel{
|
public class ChangeViewPanel extends Panel{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private WebMarkupContainer container;
|
private WebMarkupContainer container;
|
||||||
private boolean admin;
|
private boolean admin;
|
||||||
|
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html
|
||||||
|
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||||
|
<body>
|
||||||
|
<wicket:panel>
|
||||||
|
<form wicket:id="editSeminarForm">
|
||||||
|
<div wicket:id="feedbackPanel"></div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<strong>Project:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<input type="text" class="text" wicket:id="project" />
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<strong>Room (must be booked in Daisy):</strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<input type="text" class="text" wicket:id="room" />
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<strong>Date:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<input type="text" class="text" wicket:id="date" />
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<strong>Starting Time:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-8 last">
|
||||||
|
Hour: <select wicket:id="startHour"></select> Minute: <select
|
||||||
|
wicket:id="startMinute"></select>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<strong>Ending Time:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-8 last">
|
||||||
|
Hour: <select wicket:id="endHour"></select> Minute: <select
|
||||||
|
wicket:id="endMinute"></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span-8 last">
|
||||||
|
<strong>Presentation Language: </strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-8 last">
|
||||||
|
<select wicket:id="presentationLanguage"></select>
|
||||||
|
</div>
|
||||||
|
<div class="span-8 last">
|
||||||
|
<strong>Thesis/Report Language: </strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-8 last">
|
||||||
|
<select wicket:id="reportLanguage"></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span-6 last">
|
||||||
|
<strong>Opponents (optional):</strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last" id="opponents">
|
||||||
|
<div wicket:id="opponentList"></div>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<strong>Active Participants (Optional):</strong>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last" id="opponents">
|
||||||
|
<div wicket:id="activeParticipations"></div>
|
||||||
|
</div>
|
||||||
|
<div class="span-6 last">
|
||||||
|
<input type="submit" wicket:id="submitButton" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</wicket:panel>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,406 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.opponent.panels;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
|
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||||
|
import org.apache.wicket.datetime.DateConverter;
|
||||||
|
import org.apache.wicket.markup.html.form.DropDownChoice;
|
||||||
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
|
import org.apache.wicket.markup.html.form.TextField;
|
||||||
|
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||||
|
import org.apache.wicket.markup.html.panel.Panel;
|
||||||
|
import org.apache.wicket.model.CompoundPropertyModel;
|
||||||
|
import org.apache.wicket.model.Model;
|
||||||
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
import org.apache.wicket.util.convert.IConverter;
|
||||||
|
import org.joda.time.format.DateTimeFormat;
|
||||||
|
import org.joda.time.format.DateTimeFormatter;
|
||||||
|
import org.odlabs.wiquery.ui.datepicker.DatePicker;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.components.autocomplete.AutoCompletionChoicesProvider;
|
||||||
|
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteObjectConverter;
|
||||||
|
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteRenderer;
|
||||||
|
import se.su.dsv.scipro.components.autocomplete.UserProjectMultiObjectAutoCompleteBuilder;
|
||||||
|
import se.su.dsv.scipro.components.autocomplete.UserProjectMultiObjectAutoCompleteField;
|
||||||
|
import se.su.dsv.scipro.data.controllers.FinalSeminarUploadController;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarActiveParticipationDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.data.enums.FinalSeminarLanguages;
|
||||||
|
import se.su.dsv.scipro.opponent.models.OpponentModel;
|
||||||
|
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectsFinalSeminarPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Johan Aschan <aschan@dsv.su.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class EditFinalSeminarFormPanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@SpringBean
|
||||||
|
private FinalSeminarUploadController seminarUploadController;
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private FinalSeminarDao finalSeminarDao;
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private FinalSeminarOppositionDao finalSeminarOppositionDao;
|
||||||
|
@SpringBean
|
||||||
|
private UserDao userDao;
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private RoleDao roleDao;
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private FinalSeminarActiveParticipationDao finalSeminarActiveParticipationDao;
|
||||||
|
|
||||||
|
private FeedbackPanel feedbackPanel;
|
||||||
|
private FinalSeminar editSeminar;
|
||||||
|
private DatePicker<Date> startDateField;
|
||||||
|
private DropDownChoice<String> startHour, startMinute, endHour, endMinute;
|
||||||
|
private UserProjectMultiObjectAutoCompleteField<FinalSeminarActiveParticipation, Long> opponents,
|
||||||
|
activeListerners;
|
||||||
|
private TextField<String> room;
|
||||||
|
private TextField<String> projectLabel;
|
||||||
|
private DropDownChoice<FinalSeminarLanguages> presentationLanguage;
|
||||||
|
private DropDownChoice<FinalSeminarLanguages> reportLanguage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public EditFinalSeminarFormPanel(final String id, final FinalSeminar seminar) {
|
||||||
|
super(id);
|
||||||
|
|
||||||
|
add(new EditSeminarForm("editSeminarForm"));
|
||||||
|
|
||||||
|
FinalSeminar seminar2 = finalSeminarDao.reLoad(seminar);
|
||||||
|
editSeminar = seminar2;
|
||||||
|
startDateField.setDefaultModelObject(seminar2.getStartDate());
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(seminar2.getStartDate());
|
||||||
|
int hourInt = calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
|
String hourString = "";
|
||||||
|
if (hourInt < 10) {
|
||||||
|
hourString = "0" + String.valueOf(hourInt);
|
||||||
|
} else {
|
||||||
|
hourString = String.valueOf(hourInt);
|
||||||
|
}
|
||||||
|
startHour.setDefaultModelObject(hourString);
|
||||||
|
|
||||||
|
int minuteInt = calendar.get(Calendar.MINUTE);
|
||||||
|
String minuteString = "";
|
||||||
|
if (minuteInt < 10) {
|
||||||
|
minuteString = "0" + String.valueOf(minuteInt);
|
||||||
|
} else {
|
||||||
|
minuteString = String.valueOf(minuteInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
startMinute.setDefaultModelObject(minuteString);
|
||||||
|
|
||||||
|
calendar.setTime(seminar2.getEndDate());
|
||||||
|
hourInt = calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
|
hourString = "";
|
||||||
|
if (hourInt < 10) {
|
||||||
|
hourString = "0" + String.valueOf(hourInt);
|
||||||
|
} else {
|
||||||
|
hourString = String.valueOf(hourInt);
|
||||||
|
}
|
||||||
|
endHour.setDefaultModelObject(hourString);
|
||||||
|
|
||||||
|
minuteInt = calendar.get(Calendar.MINUTE);
|
||||||
|
minuteString = "";
|
||||||
|
if (minuteInt < 10) {
|
||||||
|
minuteString = "0" + String.valueOf(minuteInt);
|
||||||
|
} else {
|
||||||
|
minuteString = String.valueOf(minuteInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
endMinute.setDefaultModelObject(minuteString);
|
||||||
|
|
||||||
|
room.setDefaultModelObject(seminar2.getRoom());
|
||||||
|
List<FinalSeminarActiveParticipation> userList = new ArrayList<FinalSeminarActiveParticipation>();
|
||||||
|
for (FinalSeminarOpposition f : seminar2.getOppositions()) {
|
||||||
|
FinalSeminarActiveParticipation al = new FinalSeminarActiveParticipation();
|
||||||
|
al.setUser(f.getOpponent().getUser());
|
||||||
|
al.setProject(f.getProject());
|
||||||
|
userList.add(al);
|
||||||
|
}
|
||||||
|
presentationLanguage.setDefaultModelObject(seminar.getPresentationLanguage());
|
||||||
|
reportLanguage.setDefaultModelObject(seminar.getReportLanguage());
|
||||||
|
opponents.setSelectedObjects(userList);
|
||||||
|
|
||||||
|
activeListerners.setSelectedObjects(seminar2.getActiveParticipations());
|
||||||
|
projectLabel.setDefaultModelObject(seminar.getProject().getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditSeminarForm extends Form<OpponentModel> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5268957422910135323L;
|
||||||
|
|
||||||
|
public EditSeminarForm(String name) {
|
||||||
|
super(name, new CompoundPropertyModel<OpponentModel>(new OpponentModel()));
|
||||||
|
add(feedbackPanel = new FeedbackPanel("feedbackPanel"));
|
||||||
|
feedbackPanel.setOutputMarkupId(true);
|
||||||
|
|
||||||
|
|
||||||
|
add(projectLabel = new TextField<String>("project"));
|
||||||
|
projectLabel.setEnabled(false);
|
||||||
|
|
||||||
|
startDateField = new DatePicker<Date>("date") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final IConverter getConverter(Class<?> type) {
|
||||||
|
return new DateConverter(true) {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDatePattern() {
|
||||||
|
return "yy-dd-mm";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DateTimeFormatter getFormat() {
|
||||||
|
return DateTimeFormat.forPattern("YYYY-MM-dd");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
startDateField.setDateFormat("yy-mm-dd");
|
||||||
|
startDateField.setRequired(true);
|
||||||
|
|
||||||
|
add(room = new TextField<String>("room"));
|
||||||
|
add(startDateField);
|
||||||
|
|
||||||
|
String[] hours = new String[] { "00", "01", "02", "03", "04", "05", "06", "07", "08",
|
||||||
|
"09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21",
|
||||||
|
"22", "23" };
|
||||||
|
String[] minutes = new String[] { "00", "05", "10", "15", "20", "25", "30", "35", "40",
|
||||||
|
"45", "50", "55" };
|
||||||
|
|
||||||
|
startHour = new DropDownChoice<String>("startHour", Arrays.asList(hours));
|
||||||
|
add(startHour);
|
||||||
|
startHour.setRequired(false);
|
||||||
|
startMinute = new DropDownChoice<String>("startMinute", Arrays.asList(minutes));
|
||||||
|
add(startMinute);
|
||||||
|
|
||||||
|
endHour = new DropDownChoice<String>("endHour", Arrays.asList(hours));
|
||||||
|
add(endHour);
|
||||||
|
endHour.setRequired(false);
|
||||||
|
endMinute = new DropDownChoice<String>("endMinute", Arrays.asList(minutes));
|
||||||
|
add(endMinute);
|
||||||
|
|
||||||
|
List<FinalSeminarLanguages> languageOptions = new ArrayList<FinalSeminarLanguages>(
|
||||||
|
Arrays.asList(FinalSeminarLanguages.values()));
|
||||||
|
|
||||||
|
presentationLanguage = new DropDownChoice<FinalSeminarLanguages>(
|
||||||
|
"presentationLanguage", languageOptions);
|
||||||
|
add(presentationLanguage);
|
||||||
|
presentationLanguage.setRequired(true);
|
||||||
|
|
||||||
|
reportLanguage = new DropDownChoice<FinalSeminarLanguages>("reportLanguage",
|
||||||
|
languageOptions);
|
||||||
|
|
||||||
|
add(reportLanguage);
|
||||||
|
reportLanguage.setRequired(true);
|
||||||
|
|
||||||
|
room.setRequired(true);
|
||||||
|
|
||||||
|
AutoCompletionChoicesProvider<FinalSeminarActiveParticipation> choiceProvider = new AutoCompletionChoicesProvider<FinalSeminarActiveParticipation>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<FinalSeminarActiveParticipation> getChoices(String input) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
List<FinalSeminarActiveParticipation> active = new ArrayList<FinalSeminarActiveParticipation>();
|
||||||
|
for (User user : userDao.findUserQuery(input, 10)) {
|
||||||
|
FinalSeminarActiveParticipation ac = new FinalSeminarActiveParticipation();
|
||||||
|
ac.setUser(user);
|
||||||
|
active.add(ac);
|
||||||
|
}
|
||||||
|
return active.iterator();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
UserProjectMultiObjectAutoCompleteBuilder<FinalSeminarActiveParticipation, Long> moac = new UserProjectMultiObjectAutoCompleteBuilder<FinalSeminarActiveParticipation, Long>(
|
||||||
|
choiceProvider);
|
||||||
|
moac.idType(Long.class);
|
||||||
|
moac.autoCompleteRenderer(new MultiObjectAutoCompleteRenderer<FinalSeminarActiveParticipation>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextValue(FinalSeminarActiveParticipation al) {
|
||||||
|
User u = al.getUser();
|
||||||
|
return u.getFirstName() + " " + u.getLastName() + " <" + u.getEmailAddress()
|
||||||
|
+ ">";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getIdValue(FinalSeminarActiveParticipation al) {
|
||||||
|
User u = al.getUser();
|
||||||
|
return u.getId().toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
moac.objectConverter(new MultiObjectAutoCompleteObjectConverter<Long, FinalSeminarActiveParticipation>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FinalSeminarActiveParticipation convertToObject(Long id) {
|
||||||
|
FinalSeminarActiveParticipation ac = new FinalSeminarActiveParticipation();
|
||||||
|
ac.setUser(userDao.load(id));
|
||||||
|
return ac;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
opponents = moac.build("opponentList", null, getModelObject());
|
||||||
|
activeListerners = moac.build("activeParticipations", null, getModelObject());
|
||||||
|
add(opponents);
|
||||||
|
add(activeListerners);
|
||||||
|
|
||||||
|
add(new AjaxButton("submitButton", new Model<String>("Save")) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||||
|
editSeminar = finalSeminarDao.reLoad(editSeminar);
|
||||||
|
OpponentModel opponentModel = (OpponentModel) form.getDefaultModelObject();
|
||||||
|
boolean notSameProject = true;
|
||||||
|
boolean error = false;
|
||||||
|
Project project = editSeminar.getProject();
|
||||||
|
for (Student student : project.getProjectParticipants()) {
|
||||||
|
if (!notSameProject)
|
||||||
|
break;
|
||||||
|
for (FinalSeminarActiveParticipation al : opponentModel.getOpponentList()) {
|
||||||
|
if (student.getUser().equals(al.getUser()) && !al.isPreDeleted()) {
|
||||||
|
notSameProject = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (FinalSeminarActiveParticipation al : opponentModel
|
||||||
|
.getActiveParticipations()) {
|
||||||
|
if (student.getUser().equals(al.getUser()) && !al.isPreDeleted()) {
|
||||||
|
notSameProject = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (FinalSeminarActiveParticipation al : opponentModel.getOpponentList()) {
|
||||||
|
if (al.getProject() == null && !al.isPreDeleted()) {
|
||||||
|
error = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!error) {
|
||||||
|
for (FinalSeminarActiveParticipation al : opponentModel
|
||||||
|
.getActiveParticipations()) {
|
||||||
|
if (al.getProject() == null && !al.isPreDeleted()) {
|
||||||
|
error = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notSameProject && !error) {
|
||||||
|
|
||||||
|
Date date = opponentModel.getDate();
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(date);
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, Integer.valueOf(opponentModel.getStartHour()));
|
||||||
|
cal.set(Calendar.MINUTE, Integer.valueOf(opponentModel.getStartMinute()));
|
||||||
|
|
||||||
|
editSeminar.setStartDate(cal.getTime());
|
||||||
|
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, Integer.valueOf(opponentModel.getEndHour()));
|
||||||
|
cal.set(Calendar.MINUTE, Integer.valueOf(opponentModel.getEndMinute()));
|
||||||
|
editSeminar.setEndDate(cal.getTime());
|
||||||
|
|
||||||
|
editSeminar.setProject(project);
|
||||||
|
editSeminar.setRoom(opponentModel.getRoom());
|
||||||
|
|
||||||
|
editSeminar
|
||||||
|
.setPresentationLanguage(opponentModel.getPresentationLanguage());
|
||||||
|
editSeminar.setReportLanguage(opponentModel.getReportLanguage());
|
||||||
|
|
||||||
|
editSeminar = finalSeminarDao.save(editSeminar);
|
||||||
|
|
||||||
|
for (FinalSeminarActiveParticipation al : opponentModel.getOpponentList()) {
|
||||||
|
|
||||||
|
if (!al.isPreDeleted()) {
|
||||||
|
FinalSeminarOpposition opposition1 = new FinalSeminarOpposition();
|
||||||
|
opposition1.setOpponent(roleDao.makeStudent(al.getUser()));
|
||||||
|
opposition1.setProject(al.getProject());
|
||||||
|
opposition1.setFinalSeminar(editSeminar);
|
||||||
|
opposition1 = finalSeminarOppositionDao.save(opposition1);
|
||||||
|
} else if (al.isPreDeleted()) {
|
||||||
|
List<FinalSeminarOpposition> finalSeminar = finalSeminarOppositionDao
|
||||||
|
.findOppositionsByUserAndProject(al.getUser(),
|
||||||
|
al.getProject(), editSeminar);
|
||||||
|
for (FinalSeminarOpposition fso : finalSeminar) {
|
||||||
|
seminarUploadController.deleteOpponentFiles(fso);
|
||||||
|
finalSeminarOppositionDao.delete(fso);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (FinalSeminarActiveParticipation al : opponentModel
|
||||||
|
.getActiveParticipations()) {
|
||||||
|
editSeminar = finalSeminarDao.reLoad(editSeminar);
|
||||||
|
List<FinalSeminarActiveParticipation> allList = editSeminar
|
||||||
|
.getActiveParticipations();
|
||||||
|
if (!allList.contains(al) && !al.isPreDeleted()) {
|
||||||
|
al.setFinalSeminar(editSeminar);
|
||||||
|
finalSeminarActiveParticipationDao.save(al);
|
||||||
|
|
||||||
|
} else if (al.isPreDeleted() && allList.contains(al)) {
|
||||||
|
finalSeminarActiveParticipationDao
|
||||||
|
.delete(finalSeminarActiveParticipationDao.reLoad(al));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setResponsePage(SupervisorProjectsFinalSeminarPage.class);
|
||||||
|
} else if (!notSameProject && error) {
|
||||||
|
error("Opponent/Active participant is an author in the final seminar");
|
||||||
|
error("Must select a Project for the Opponent/Active participant");
|
||||||
|
} else if (notSameProject && error) {
|
||||||
|
error("Must select a Project for the Opponent/Active participant");
|
||||||
|
} else {
|
||||||
|
error("Opponent/Active participant is an author in the final seminar");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
|
||||||
|
target.addComponent(feedbackPanel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,15 +1,10 @@
|
|||||||
package se.su.dsv.scipro.opponent.panels;
|
package se.su.dsv.scipro.opponent.panels;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.wicket.datetime.PatternDateConverter;
|
|
||||||
import org.apache.wicket.datetime.markup.html.basic.DateLabel;
|
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
|
||||||
import org.apache.wicket.markup.html.form.SubmitLink;
|
|
||||||
import org.apache.wicket.markup.html.list.ListItem;
|
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;
|
||||||
@ -26,7 +21,6 @@ import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
|||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
|
||||||
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;
|
||||||
|
|
||||||
@ -37,23 +31,25 @@ public class FinalSeminarDetailsPanel extends Panel {
|
|||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarDao finalSeminarDao;
|
private FinalSeminarDao finalSeminarDao;
|
||||||
|
|
||||||
public FinalSeminarDetailsPanel(final String id,
|
public FinalSeminarDetailsPanel(final String id, final FinalSeminar seminar2,
|
||||||
final FinalSeminar seminar2, final boolean details) {
|
final boolean details) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|
||||||
final FinalSeminar seminar = finalSeminarDao.reLoad(seminar2);
|
final FinalSeminar seminar = finalSeminarDao.reLoad(seminar2);
|
||||||
final Project project = seminar.getProject();
|
final Project project = seminar.getProject();
|
||||||
WebMarkupContainer titleContainer = new WebMarkupContainer(
|
WebMarkupContainer titleContainer = new WebMarkupContainer("titleContainer") {
|
||||||
"titleContainer") {
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
titleContainer.add(new Label("projectTitle", seminar.getProject()
|
titleContainer.add(new Label("projectTitle", seminar.getProject().getTitle()) {
|
||||||
.getTitle()) {
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
});
|
});
|
||||||
titleContainer.add(new Label("room", seminar.getRoom()));
|
titleContainer.add(new Label("room", seminar.getRoom()));
|
||||||
add(titleContainer);
|
add(titleContainer);
|
||||||
@ -63,15 +59,13 @@ public class FinalSeminarDetailsPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(ListItem<Student> item) {
|
protected void populateItem(ListItem<Student> item) {
|
||||||
item.add(item.getModelObject().getUser()
|
item.add(item.getModelObject().getUser().getDisplayComponent("author", true));
|
||||||
.getDisplayComponent("author", true));
|
|
||||||
add(item);
|
add(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (project.getHeadSupervisor() != null) {
|
if (project.getHeadSupervisor() != null) {
|
||||||
add(project.getHeadSupervisor().getUser()
|
add(project.getHeadSupervisor().getUser().getDisplayComponent("headSupervisor", true));
|
||||||
.getDisplayComponent("headSupervisor", true));
|
|
||||||
} else {
|
} else {
|
||||||
add(new EmptyPanel("headSupervisor"));
|
add(new EmptyPanel("headSupervisor"));
|
||||||
}
|
}
|
||||||
@ -92,8 +86,7 @@ public class FinalSeminarDetailsPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(ListItem<User> item) {
|
protected void populateItem(ListItem<User> item) {
|
||||||
item.add(item.getModelObject().getDisplayComponent(
|
item.add(item.getModelObject().getDisplayComponent("coSupervisor", true));
|
||||||
"coSupervisor", true));
|
|
||||||
add(item);
|
add(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -103,24 +96,23 @@ public class FinalSeminarDetailsPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(ListItem<User> item) {
|
protected void populateItem(ListItem<User> item) {
|
||||||
item.add(item.getModelObject().getDisplayComponent("reviewer",
|
item.add(item.getModelObject().getDisplayComponent("reviewer", true));
|
||||||
true));
|
|
||||||
add(item);
|
add(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
WebMarkupContainer detailsContainer = new WebMarkupContainer(
|
WebMarkupContainer detailsContainer = new WebMarkupContainer("detailsContainer") {
|
||||||
"detailsContainer") {
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
detailsContainer.add(new ListView<FinalSeminarOpposition>("opponentsList",
|
detailsContainer.add(new ListView<FinalSeminarOpposition>("opponentsList", seminar
|
||||||
seminar.getOppositions()) {
|
.getOppositions()) {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -136,8 +128,7 @@ public class FinalSeminarDetailsPanel extends Panel {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(
|
protected void populateItem(ListItem<FinalSeminarActiveParticipation> item) {
|
||||||
ListItem<FinalSeminarActiveParticipation> item) {
|
|
||||||
item.add(item.getModelObject().getUser()
|
item.add(item.getModelObject().getUser()
|
||||||
.getDisplayComponent("activeParticipant", true));
|
.getDisplayComponent("activeParticipant", true));
|
||||||
add(item);
|
add(item);
|
||||||
@ -145,24 +136,20 @@ public class FinalSeminarDetailsPanel extends Panel {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
detailsContainer.add(new Label("seminarLanguage", seminar
|
detailsContainer.add(new Label("seminarLanguage", seminar.getPresentationLanguage()
|
||||||
.getPresentationLanguage().toString()));
|
.toString()));
|
||||||
detailsContainer.add(new Label("thesisLanguage", seminar
|
detailsContainer.add(new Label("thesisLanguage", seminar.getReportLanguage().toString()));
|
||||||
.getReportLanguage().toString()));
|
detailsContainer.add(new Label("seminarReportTitle", new Model<String>() {
|
||||||
detailsContainer.add(new Label("seminarReportTitle",
|
private static final long serialVersionUID = 1L;
|
||||||
new Model<String>() {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getObject() {
|
public String getObject() {
|
||||||
return seminar.getDocument() == null ? "No thesis/report uploaded"
|
return seminar.getDocument() == null ? "No thesis/report uploaded" : seminar
|
||||||
: seminar.getDocument().getName();
|
.getDocument().getName();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
final PatternDateConverter pdc = new PatternDateConverter(
|
|
||||||
"yyyy-MM-dd HH:mm", false);
|
final WebMarkupContainer uploadInfoContainer = new WebMarkupContainer("uploadInfoContainer") {
|
||||||
final WebMarkupContainer uploadInfoContainer = new WebMarkupContainer(
|
|
||||||
"uploadInfoContainer") {
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -171,10 +158,8 @@ public class FinalSeminarDetailsPanel extends Panel {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
uploadInfoContainer.add(new FileDownloadLink("download", seminar
|
uploadInfoContainer.add(new FileDownloadLink("download", seminar.getDocument()));
|
||||||
.getDocument()));
|
uploadInfoContainer.add(new FileOpenLink("open", seminar.getDocument()));
|
||||||
uploadInfoContainer
|
|
||||||
.add(new FileOpenLink("open", seminar.getDocument()));
|
|
||||||
|
|
||||||
detailsContainer.add(uploadInfoContainer);
|
detailsContainer.add(uploadInfoContainer);
|
||||||
add(detailsContainer);
|
add(detailsContainer);
|
||||||
|
@ -1,114 +1,80 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
<html
|
||||||
|
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||||
<body>
|
<body>
|
||||||
<wicket:panel>
|
<wicket:panel>
|
||||||
|
|
||||||
<div class="span-22 prepend-top last">
|
<div class="span-22 prepend-top last">
|
||||||
<table class="rounded-table seminar-table even-rows">
|
<table class="rounded-table seminar-table even-rows">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Level</th>
|
<th>Level</th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Author(s)</th>
|
<th>Author(s)</th>
|
||||||
<th>Head Supervisor</th>
|
<th>Head Supervisor</th>
|
||||||
<th>Reviewer</th>
|
<th>Reviewer</th>
|
||||||
<th title="Opponents" class="shortened-table-header">Opp.</th>
|
<th title="Opponents" class="shortened-table-header">Opp.</th>
|
||||||
<th title="Active Participants" class="shortened-table-header">A.P.</th>
|
<th title="Active Participants" class="shortened-table-header">A.P.</th>
|
||||||
<th title="Total Attendees" class="shortened-table-header">Tot.A.</th>
|
<th title="Total Attendees" class="shortened-table-header">Tot.A.</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr wicket:id="seminar-item">
|
<tr wicket:id="seminar-item">
|
||||||
<td><span wicket:id="date" class="span-2"></span></td>
|
<td><span wicket:id="date" class="span-2"></span>
|
||||||
<td><span wicket:id="projectClass"></span></td>
|
</td>
|
||||||
<td><span wicket:id="title"></span></td>
|
<td><span wicket:id="projectClass"></span>
|
||||||
<td><span wicket:id="authors"></span></td>
|
</td>
|
||||||
<td><span wicket:id="headSupervisor"></span></td>
|
<td><span wicket:id="title"></span>
|
||||||
<td><span wicket:id="reviewer"></span></td>
|
</td>
|
||||||
<td><span wicket:id="opponents"></span></td>
|
<td><span wicket:id="authors"></span>
|
||||||
<td><span wicket:id="activeParticipants"></span></td>
|
</td>
|
||||||
<td><span wicket:id="totalAttendees"></span></td>
|
<td><span wicket:id="headSupervisor"></span>
|
||||||
<td><form wicket:id="contactsForm"><input type="submit" wicket:id="contacts" /></form></td>
|
</td>
|
||||||
<td><form wicket:id="editForm"><input type="submit" wicket:id="edit" /></form></td>
|
<td><span wicket:id="reviewer"></span>
|
||||||
<td><a href="#" wicket:id="delete"><img src="images/icons/delete_16x16.png" alt="Delete" title="Delete"/></a></td>
|
</td>
|
||||||
</tr>
|
<td><span wicket:id="opponents"></span>
|
||||||
<tr>
|
</td>
|
||||||
<td colspan="12"></td>
|
<td><span wicket:id="activeParticipants"></span>
|
||||||
</tr>
|
</td>
|
||||||
</table>
|
<td><span wicket:id="totalAttendees"></span>
|
||||||
<div wicket:id="pagingNavigator"></div>
|
</td>
|
||||||
|
<td><form wicket:id="contactsForm">
|
||||||
<div wicket:id="dialog">
|
<input type="submit" wicket:id="contacts" />
|
||||||
<div wicket:id="dialogContainer">
|
</form>
|
||||||
<form wicket:id="editSeminarForm">
|
</td>
|
||||||
<div wicket:id="feedbackPanel"></div>
|
<td><form wicket:id="editForm">
|
||||||
<div class ="span-6 last">
|
<input type="submit" wicket:id="edit" />
|
||||||
<strong>Project:</strong>
|
</form>
|
||||||
</div>
|
</td>
|
||||||
<div class ="span-6 last">
|
<td><a href="#" wicket:id="delete"><img
|
||||||
<input type="text" class="text" wicket:id="project" />
|
src="images/icons/delete_16x16.png" alt="Delete" title="Delete" />
|
||||||
</div>
|
</a>
|
||||||
<div class ="span-6 last">
|
</td>
|
||||||
<strong>Room (must be booked in Daisy):</strong>
|
</tr>
|
||||||
</div>
|
<tr>
|
||||||
<div class ="span-6 last">
|
<td colspan="12"></td>
|
||||||
<input type="text" class="text" wicket:id="room" />
|
</tr>
|
||||||
</div>
|
</table>
|
||||||
<div class ="span-6 last">
|
<div wicket:id="pagingNavigator"></div>
|
||||||
<strong>Date:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<input type="text" class="text" wicket:id="date" />
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Starting Time:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">Hour: <select wicket:id="startHour"></select> Minute: <select wicket:id="startMinute"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Ending Time:</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">Hour: <select wicket:id="endHour"></select> Minute: <select wicket:id="endMinute"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
<strong>Presentation Language: </strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
<select wicket:id="presentationLanguage"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
<strong>Thesis/Report Language: </strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-8 last">
|
|
||||||
<select wicket:id="reportLanguage"></select>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Opponents (optional):</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last" id="opponents">
|
|
||||||
<div wicket:id="opponentList"></div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last">
|
|
||||||
<strong>Active Participants (Optional):</strong>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last" id="opponents">
|
|
||||||
<div wicket:id="activeParticipations"></div>
|
|
||||||
</div>
|
|
||||||
<div class ="span-6 last"><input type="submit" wicket:id="submitButton" /> </div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div wicket:id="contactsDialog">
|
|
||||||
<div wicket:id="contactsDialogContainer">
|
|
||||||
<form wicket:id="contactsSeminarForm">
|
|
||||||
|
|
||||||
<div wicket:id="finalSeminarAttendees" ></div>
|
<div wicket:id="dialog">
|
||||||
|
<div wicket:id="dialogContainer">
|
||||||
|
<form wicket:id="editSeminarForm">
|
||||||
|
<div wicket:id="editSeminarDetails"></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div wicket:id="contactsDialog">
|
||||||
|
<div wicket:id="contactsDialogContainer">
|
||||||
|
<form wicket:id="contactsSeminarForm">
|
||||||
|
|
||||||
</form>
|
<div wicket:id="finalSeminarAttendees"></div>
|
||||||
</div>
|
|
||||||
</div>
|
</form>
|
||||||
</wicket:panel>
|
</div>
|
||||||
|
</div>
|
||||||
|
</wicket:panel>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -5,26 +5,15 @@ package se.su.dsv.scipro.opponent.panels;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
import org.apache.wicket.ajax.IAjaxCallDecorator;
|
import org.apache.wicket.ajax.IAjaxCallDecorator;
|
||||||
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
|
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
|
||||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||||
import org.apache.wicket.datetime.DateConverter;
|
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
import org.apache.wicket.markup.html.basic.MultiLineLabel;
|
|
||||||
import org.apache.wicket.markup.html.form.DropDownChoice;
|
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
import org.apache.wicket.markup.html.form.ListChoice;
|
|
||||||
import org.apache.wicket.markup.html.form.TextField;
|
|
||||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
||||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||||
@ -35,33 +24,19 @@ import org.apache.wicket.markup.repeater.data.IDataProvider;
|
|||||||
import org.apache.wicket.model.CompoundPropertyModel;
|
import org.apache.wicket.model.CompoundPropertyModel;
|
||||||
import org.apache.wicket.model.Model;
|
import org.apache.wicket.model.Model;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
import org.apache.wicket.util.convert.IConverter;
|
|
||||||
import org.joda.time.format.DateTimeFormat;
|
|
||||||
import org.joda.time.format.DateTimeFormatter;
|
|
||||||
import org.odlabs.wiquery.ui.datepicker.DatePicker;
|
|
||||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||||
|
|
||||||
import se.su.dsv.scipro.admin.pages.AdminFinalSeminarPage;
|
import se.su.dsv.scipro.admin.pages.AdminFinalSeminarPage;
|
||||||
import se.su.dsv.scipro.components.autocomplete.AutoCompletionChoicesProvider;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteObjectConverter;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteRenderer;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.UserProjectMultiObjectAutoCompleteBuilder;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.UserProjectMultiObjectAutoCompleteField;
|
|
||||||
import se.su.dsv.scipro.data.controllers.FinalSeminarUploadController;
|
import se.su.dsv.scipro.data.controllers.FinalSeminarUploadController;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarActiveParticipationDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarActiveParticipationDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.FinalSeminarLanguages;
|
|
||||||
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
||||||
import se.su.dsv.scipro.opponent.models.OpponentModel;
|
import se.su.dsv.scipro.opponent.models.OpponentModel;
|
||||||
|
|
||||||
@ -79,15 +54,6 @@ public class OpponentListViewPanel extends Panel {
|
|||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarDao finalSeminarDao;
|
private FinalSeminarDao finalSeminarDao;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private UserDao userDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ProjectDao projectDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private RoleDao roleDao;
|
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarActiveParticipationDao finalSeminarActiveParticipationDao;
|
private FinalSeminarActiveParticipationDao finalSeminarActiveParticipationDao;
|
||||||
|
|
||||||
@ -101,27 +67,14 @@ public class OpponentListViewPanel extends Panel {
|
|||||||
private FeedbackPanel feedbackPanel;
|
private FeedbackPanel feedbackPanel;
|
||||||
private WebMarkupContainer editSeminarDialogContainer, contactsDialogContainer;
|
private WebMarkupContainer editSeminarDialogContainer, contactsDialogContainer;
|
||||||
private Dialog editSeminarDialog, contactsSeminarDialog;
|
private Dialog editSeminarDialog, contactsSeminarDialog;
|
||||||
private FinalSeminar editSeminar;
|
private EditSeminarForm editSeminarForm;
|
||||||
private ListChoice<Project> projectSelectList;
|
|
||||||
private DatePicker<Date> startDateField;
|
|
||||||
private DatePicker<Date> endDateField;
|
|
||||||
private DropDownChoice<String> startHour, startMinute, endHour, endMinute;
|
|
||||||
private UserProjectMultiObjectAutoCompleteField<FinalSeminarActiveParticipation, Long> moacf,
|
|
||||||
activeListerners;
|
|
||||||
private TextField<String> room;
|
|
||||||
private TextField<String> projectLabel;
|
|
||||||
private MultiLineLabel contactsTextArea;
|
|
||||||
private IDataProvider<FinalSeminar> seminarList;
|
|
||||||
private ContactsSeminarForm contactsSeminarForm;
|
private ContactsSeminarForm contactsSeminarForm;
|
||||||
private DropDownChoice<FinalSeminarLanguages> presentationLanguage, reportLanguage;
|
private boolean adminView;
|
||||||
private boolean adminView, past;
|
|
||||||
|
|
||||||
public OpponentListViewPanel(String id, IDataProvider<FinalSeminar> seminarList,
|
public OpponentListViewPanel(String id, IDataProvider<FinalSeminar> seminarList,
|
||||||
boolean adminView, boolean past) {
|
boolean adminView, boolean past) {
|
||||||
super(id);
|
super(id);
|
||||||
this.seminarList = seminarList;
|
|
||||||
this.adminView = adminView;
|
this.adminView = adminView;
|
||||||
this.past = past;
|
|
||||||
loadListView(seminarList);
|
loadListView(seminarList);
|
||||||
editSeminarDialogContainer = new WebMarkupContainer("dialogContainer");
|
editSeminarDialogContainer = new WebMarkupContainer("dialogContainer");
|
||||||
editSeminarDialog = new Dialog("dialog");
|
editSeminarDialog = new Dialog("dialog");
|
||||||
@ -131,7 +84,8 @@ public class OpponentListViewPanel extends Panel {
|
|||||||
editSeminarDialog.add(editSeminarDialogContainer);
|
editSeminarDialog.add(editSeminarDialogContainer);
|
||||||
add(editSeminarDialog);
|
add(editSeminarDialog);
|
||||||
editSeminarDialogContainer.setOutputMarkupId(true);
|
editSeminarDialogContainer.setOutputMarkupId(true);
|
||||||
editSeminarDialogContainer.add(new EditSeminarForm("editSeminarForm"));
|
editSeminarDialogContainer.add(editSeminarForm = new EditSeminarForm("editSeminarForm"));
|
||||||
|
editSeminarForm.setOutputMarkupId(true);
|
||||||
|
|
||||||
contactsDialogContainer = new WebMarkupContainer("contactsDialogContainer");
|
contactsDialogContainer = new WebMarkupContainer("contactsDialogContainer");
|
||||||
contactsSeminarDialog = new Dialog("contactsDialog");
|
contactsSeminarDialog = new Dialog("contactsDialog");
|
||||||
@ -220,9 +174,10 @@ public class OpponentListViewPanel extends Panel {
|
|||||||
item.add(new Label("totalAttendees", String.valueOf(totalAttendees)));
|
item.add(new Label("totalAttendees", String.valueOf(totalAttendees)));
|
||||||
item.add(new EditForm("editForm", seminar) {
|
item.add(new EditForm("editForm", seminar) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return adminView;
|
return adminView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +209,6 @@ public class OpponentListViewPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return adminView;
|
return adminView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,6 +239,21 @@ public class OpponentListViewPanel extends Panel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class EditSeminarForm extends Form<OpponentModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -5004827722926732419L;
|
||||||
|
|
||||||
|
public EditSeminarForm(String name) {
|
||||||
|
super(name, new CompoundPropertyModel<OpponentModel>(new OpponentModel()));
|
||||||
|
editSeminarDialog.setTitle("Edit Seminar");
|
||||||
|
add(new EmptyPanel("editSeminarDetails"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class EditForm extends Form<Void> {
|
private class EditForm extends Form<Void> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -302,64 +271,9 @@ public class OpponentListViewPanel 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(seminar);
|
||||||
editSeminar = seminar2;
|
editSeminarForm.removeAll();
|
||||||
startDateField.setDefaultModelObject(seminar2.getStartDate());
|
editSeminarForm.add(new EditFinalSeminarFormPanel("editSeminarDetails", seminar2));
|
||||||
Calendar calendar = Calendar.getInstance();
|
target.addComponent(editSeminarForm);
|
||||||
calendar.setTime(seminar2.getStartDate());
|
|
||||||
int hourInt = calendar.get(Calendar.HOUR_OF_DAY);
|
|
||||||
String hourString = "";
|
|
||||||
if (hourInt < 10) {
|
|
||||||
hourString = "0" + String.valueOf(hourInt);
|
|
||||||
} else {
|
|
||||||
hourString = String.valueOf(hourInt);
|
|
||||||
}
|
|
||||||
startHour.setDefaultModelObject(hourString);
|
|
||||||
|
|
||||||
int minuteInt = calendar.get(Calendar.MINUTE);
|
|
||||||
String minuteString = "";
|
|
||||||
if (minuteInt < 10) {
|
|
||||||
minuteString = "0" + String.valueOf(minuteInt);
|
|
||||||
} else {
|
|
||||||
minuteString = String.valueOf(minuteInt);
|
|
||||||
}
|
|
||||||
|
|
||||||
startMinute.setDefaultModelObject(minuteString);
|
|
||||||
|
|
||||||
calendar.setTime(seminar2.getEndDate());
|
|
||||||
hourInt = calendar.get(Calendar.HOUR_OF_DAY);
|
|
||||||
hourString = "";
|
|
||||||
if (hourInt < 10) {
|
|
||||||
hourString = "0" + String.valueOf(hourInt);
|
|
||||||
} else {
|
|
||||||
hourString = String.valueOf(hourInt);
|
|
||||||
}
|
|
||||||
endHour.setDefaultModelObject(hourString);
|
|
||||||
|
|
||||||
minuteInt = calendar.get(Calendar.MINUTE);
|
|
||||||
minuteString = "";
|
|
||||||
if (minuteInt < 10) {
|
|
||||||
minuteString = "0" + String.valueOf(minuteInt);
|
|
||||||
} else {
|
|
||||||
minuteString = String.valueOf(minuteInt);
|
|
||||||
}
|
|
||||||
|
|
||||||
endMinute.setDefaultModelObject(minuteString);
|
|
||||||
|
|
||||||
room.setDefaultModelObject(seminar2.getRoom());
|
|
||||||
List<FinalSeminarActiveParticipation> userList = new ArrayList<FinalSeminarActiveParticipation>();
|
|
||||||
for (FinalSeminarOpposition f : seminar2.getOppositions()) {
|
|
||||||
FinalSeminarActiveParticipation al = new FinalSeminarActiveParticipation();
|
|
||||||
al.setUser(f.getOpponent().getUser());
|
|
||||||
al.setProject(f.getProject());
|
|
||||||
userList.add(al);
|
|
||||||
}
|
|
||||||
presentationLanguage.setDefaultModelObject(seminar.getPresentationLanguage());
|
|
||||||
reportLanguage.setDefaultModelObject(seminar.getReportLanguage());
|
|
||||||
moacf.setSelectedObjects(userList);
|
|
||||||
|
|
||||||
activeListerners.setSelectedObjects(seminar2.getActiveParticipations());
|
|
||||||
projectLabel.setDefaultModelObject(seminar.getProject().getTitle());
|
|
||||||
target.addComponent(editSeminarDialog);
|
|
||||||
editSeminarDialog.open(target);
|
editSeminarDialog.open(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,264 +287,6 @@ public class OpponentListViewPanel extends Panel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditSeminarForm extends Form<OpponentModel> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -5268957422910135323L;
|
|
||||||
|
|
||||||
public EditSeminarForm(String name) {
|
|
||||||
super(name, new CompoundPropertyModel<OpponentModel>(new OpponentModel()));
|
|
||||||
// final WebMarkupContainer feedbackContainer = new
|
|
||||||
// WebMarkupContainer(
|
|
||||||
// "feedbackContainer");
|
|
||||||
// feedbackContainer.setOutputMarkupId(true);
|
|
||||||
// WebMarkupContainer feedbackPanel = new
|
|
||||||
// FormFeedbackPanel<OpponentModel>(
|
|
||||||
// "feedbackPanel", this);
|
|
||||||
// feedbackContainer.add(feedbackPanel);
|
|
||||||
// add(feedbackContainer);
|
|
||||||
|
|
||||||
List<FinalSeminarLanguages> languageOptions = new ArrayList<FinalSeminarLanguages>(
|
|
||||||
Arrays.asList(FinalSeminarLanguages.values()));
|
|
||||||
presentationLanguage = new DropDownChoice<FinalSeminarLanguages>(
|
|
||||||
"presentationLanguage", languageOptions);
|
|
||||||
add(presentationLanguage);
|
|
||||||
presentationLanguage.setRequired(true);
|
|
||||||
|
|
||||||
reportLanguage = new DropDownChoice<FinalSeminarLanguages>("reportLanguage",
|
|
||||||
languageOptions);
|
|
||||||
add(reportLanguage);
|
|
||||||
reportLanguage.setRequired(true);
|
|
||||||
|
|
||||||
add(feedbackPanel = new FeedbackPanel("feedbackPanel"));
|
|
||||||
feedbackPanel.setOutputMarkupId(true);
|
|
||||||
editSeminarDialog.setTitle("Edit final seminar");
|
|
||||||
|
|
||||||
add(projectLabel = new TextField<String>("project"));
|
|
||||||
projectLabel.setEnabled(false);
|
|
||||||
|
|
||||||
startDateField = new DatePicker<Date>("date") {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final IConverter getConverter(Class<?> type) {
|
|
||||||
return new DateConverter(true) {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDatePattern() {
|
|
||||||
return "yy-dd-mm";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected DateTimeFormatter getFormat() {
|
|
||||||
return DateTimeFormat.forPattern("YYYY-MM-dd");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
startDateField.setDateFormat("yy-mm-dd");
|
|
||||||
startDateField.setRequired(true);
|
|
||||||
// startDateField.setShowOn(ShowOnEnum.BOTH);
|
|
||||||
// startDateField.setButtonText("<div class=\"ui-icon ui-icon-calendar\"></div>");
|
|
||||||
add(room = new TextField<String>("room"));
|
|
||||||
add(startDateField);
|
|
||||||
|
|
||||||
startHour = new DropDownChoice<String>("startHour", Arrays.asList(new String[] { "00",
|
|
||||||
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
|
|
||||||
"14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));
|
|
||||||
add(startHour);
|
|
||||||
startHour.setRequired(false);
|
|
||||||
startMinute = new DropDownChoice<String>("startMinute", Arrays.asList(new String[] {
|
|
||||||
"00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" }));
|
|
||||||
add(startMinute);
|
|
||||||
|
|
||||||
endHour = new DropDownChoice<String>("endHour", Arrays.asList(new String[] { "00",
|
|
||||||
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
|
|
||||||
"14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));
|
|
||||||
add(endHour);
|
|
||||||
endHour.setRequired(false);
|
|
||||||
endMinute = new DropDownChoice<String>("endMinute", Arrays.asList(new String[] { "00",
|
|
||||||
"05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" }));
|
|
||||||
add(endMinute);
|
|
||||||
|
|
||||||
room.setRequired(true);
|
|
||||||
|
|
||||||
AutoCompletionChoicesProvider<FinalSeminarActiveParticipation> choiceProvider = new AutoCompletionChoicesProvider<FinalSeminarActiveParticipation>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<FinalSeminarActiveParticipation> getChoices(String input) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
List<FinalSeminarActiveParticipation> active = new ArrayList<FinalSeminarActiveParticipation>();
|
|
||||||
for (User user : userDao.findUserQuery(input, 10)) {
|
|
||||||
FinalSeminarActiveParticipation ac = new FinalSeminarActiveParticipation();
|
|
||||||
ac.setUser(user);
|
|
||||||
active.add(ac);
|
|
||||||
}
|
|
||||||
return active.iterator();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
UserProjectMultiObjectAutoCompleteBuilder<FinalSeminarActiveParticipation, Long> moac = new UserProjectMultiObjectAutoCompleteBuilder<FinalSeminarActiveParticipation, Long>(
|
|
||||||
choiceProvider);
|
|
||||||
moac.idType(Long.class);
|
|
||||||
moac.autoCompleteRenderer(new MultiObjectAutoCompleteRenderer<FinalSeminarActiveParticipation>() {
|
|
||||||
public String getTextValue(FinalSeminarActiveParticipation al) {
|
|
||||||
User u = al.getUser();
|
|
||||||
return u.getFirstName() + " " + u.getLastName() + " <" + u.getEmailAddress()
|
|
||||||
+ ">";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getIdValue(FinalSeminarActiveParticipation al) {
|
|
||||||
User u = al.getUser();
|
|
||||||
return u.getId().toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
moac.objectConverter(new MultiObjectAutoCompleteObjectConverter<Long, FinalSeminarActiveParticipation>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FinalSeminarActiveParticipation convertToObject(Long id) {
|
|
||||||
FinalSeminarActiveParticipation ac = new FinalSeminarActiveParticipation();
|
|
||||||
ac.setUser(userDao.load(id));
|
|
||||||
return ac;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
moacf = moac.build("opponentList", null, getModelObject());
|
|
||||||
activeListerners = moac.build("activeParticipations", null, getModelObject());
|
|
||||||
add(moacf);
|
|
||||||
add(activeListerners);
|
|
||||||
|
|
||||||
add(new AjaxButton("submitButton", new Model<String>("Save")) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
editSeminar = finalSeminarDao.reLoad(editSeminar);
|
|
||||||
OpponentModel opponentModel = (OpponentModel) form.getDefaultModelObject();
|
|
||||||
boolean notSameProject = true;
|
|
||||||
boolean error = false;
|
|
||||||
Project project = editSeminar.getProject();
|
|
||||||
for (Student student : project.getProjectParticipants()) {
|
|
||||||
if (!notSameProject)
|
|
||||||
break;
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel.getOpponentList()) {
|
|
||||||
if (student.getUser().equals(al.getUser()) && !al.isPreDeleted()) {
|
|
||||||
notSameProject = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getActiveParticipations()) {
|
|
||||||
if (student.getUser().equals(al.getUser()) && !al.isPreDeleted()) {
|
|
||||||
notSameProject = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel.getOpponentList()) {
|
|
||||||
if (al.getProject() == null && !al.isPreDeleted()) {
|
|
||||||
error = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!error) {
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getActiveParticipations()) {
|
|
||||||
if (al.getProject() == null && !al.isPreDeleted()) {
|
|
||||||
error = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (notSameProject && !error) {
|
|
||||||
|
|
||||||
Date date = opponentModel.getDate();
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTime(date);
|
|
||||||
cal.set(Calendar.HOUR_OF_DAY, Integer.valueOf(opponentModel.getStartHour()));
|
|
||||||
cal.set(Calendar.MINUTE, Integer.valueOf(opponentModel.getStartMinute()));
|
|
||||||
|
|
||||||
editSeminar.setStartDate(cal.getTime());
|
|
||||||
|
|
||||||
cal.set(Calendar.HOUR_OF_DAY, Integer.valueOf(opponentModel.getEndHour()));
|
|
||||||
cal.set(Calendar.MINUTE, Integer.valueOf(opponentModel.getEndMinute()));
|
|
||||||
editSeminar
|
|
||||||
.setPresentationLanguage(opponentModel.getPresentationLanguage());
|
|
||||||
editSeminar.setReportLanguage(opponentModel.getReportLanguage());
|
|
||||||
editSeminar.setEndDate(cal.getTime());
|
|
||||||
|
|
||||||
editSeminar.setProject(project);
|
|
||||||
editSeminar.setRoom(opponentModel.getRoom());
|
|
||||||
|
|
||||||
editSeminar = finalSeminarDao.save(editSeminar);
|
|
||||||
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel.getOpponentList()) {
|
|
||||||
FinalSeminarOpposition opposition1 = new FinalSeminarOpposition();
|
|
||||||
|
|
||||||
boolean go = true;
|
|
||||||
|
|
||||||
for (FinalSeminarOpposition fso : editSeminar.getOppositions()) {
|
|
||||||
if (fso.getOpponent().getUser().equals(al.getUser())
|
|
||||||
&& fso.getProject().equals(editSeminar.getProject())) {
|
|
||||||
go = false;
|
|
||||||
} else if(fso.getOpponent().getUser().equals(al.getUser())){
|
|
||||||
opposition1 = finalSeminarOppositionDao.reLoad(fso);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!al.isPreDeleted() && go) {
|
|
||||||
|
|
||||||
opposition1.setOpponent(roleDao.makeStudent(al.getUser()));
|
|
||||||
opposition1.setProject(al.getProject());
|
|
||||||
opposition1.setFinalSeminar(editSeminar);
|
|
||||||
opposition1 = finalSeminarOppositionDao.save(opposition1);
|
|
||||||
} else if (al.isPreDeleted()) {
|
|
||||||
List<FinalSeminarOpposition> finalSeminar = finalSeminarOppositionDao
|
|
||||||
.findOppositionsByUserAndProject(al.getUser(),
|
|
||||||
al.getProject(), editSeminar);
|
|
||||||
for (FinalSeminarOpposition fso : finalSeminar) {
|
|
||||||
seminarUploadController.deleteOpponentFiles(fso);
|
|
||||||
finalSeminarOppositionDao.delete(fso);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getActiveParticipations()) {
|
|
||||||
editSeminar = finalSeminarDao.reLoad(editSeminar);
|
|
||||||
List<FinalSeminarActiveParticipation> allList = editSeminar
|
|
||||||
.getActiveParticipations();
|
|
||||||
if (!allList.contains(al) && !al.isPreDeleted()) {
|
|
||||||
al.setFinalSeminar(editSeminar);
|
|
||||||
finalSeminarActiveParticipationDao.save(al);
|
|
||||||
} else if (al.isPreDeleted() && allList.contains(al)) {
|
|
||||||
finalSeminarActiveParticipationDao
|
|
||||||
.delete(finalSeminarActiveParticipationDao.reLoad(al));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
setResponsePage(AdminFinalSeminarPage.class);
|
|
||||||
} else if (!notSameProject && error) {
|
|
||||||
error("Opponent/Active participant is an author in the final seminar");
|
|
||||||
error("Must select a Project for the Opponent/Active participant");
|
|
||||||
} else if (notSameProject && error) {
|
|
||||||
error("Must select a Project for the Opponent/Active participant");
|
|
||||||
} else {
|
|
||||||
error("Opponent/Active participant is an author in the final seminar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target, final Form form) {
|
|
||||||
target.addComponent(feedbackPanel);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ContactsSeminarForm extends Form<OpponentModel> {
|
private class ContactsSeminarForm extends Form<OpponentModel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,6 @@ package se.su.dsv.scipro.opponent.panels;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -128,56 +127,18 @@ public class OpponentPanel extends Panel {
|
|||||||
"feedbackContainer");
|
"feedbackContainer");
|
||||||
project = projectDao.reLoad(project);
|
project = projectDao.reLoad(project);
|
||||||
feedbackContainer.setOutputMarkupId(true);
|
feedbackContainer.setOutputMarkupId(true);
|
||||||
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<OpponentModel>(
|
|
||||||
"feedbackPanel", this);
|
//ComponentFeedbackPanel fungerade inte
|
||||||
|
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<OpponentModel>("feedbackPanel", this);
|
||||||
feedbackContainer.add(feedbackPanel);
|
feedbackContainer.add(feedbackPanel);
|
||||||
add(feedbackContainer);
|
add(feedbackContainer);
|
||||||
List<User> userList = new ArrayList<User>();
|
|
||||||
addSeminarDialog.setTitle("Create Seminar");
|
addSeminarDialog.setTitle("Create Seminar");
|
||||||
TextField<String> projectLabel;
|
TextField<String> projectLabel;
|
||||||
add(projectLabel = new TextField<String>("project"));
|
add(projectLabel = new TextField<String>("project"));
|
||||||
projectLabel.setEnabled(false);
|
projectLabel.setEnabled(false);
|
||||||
projectLabel.setDefaultModelObject(project.getTitle(30));
|
projectLabel.setDefaultModelObject(project.getTitle(30));
|
||||||
// IChoiceRenderer<Project> choiceRenderer = new
|
|
||||||
// IChoiceRenderer<Project>() {
|
|
||||||
//
|
|
||||||
// // Implement dispay here
|
|
||||||
// public Object getDisplayValue(Project project) {
|
|
||||||
// return project.getTitle();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String getIdValue(Project project, int arg1) {
|
|
||||||
// return project.getId().toString();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
// List<Project> projectList =
|
|
||||||
// projectDao.getProjectsByHeadSupervisor(
|
|
||||||
// SciProSession.get().getUser(), ProjectStatus.ACTIVE);
|
|
||||||
//
|
|
||||||
// for (Seminar s : seminarDao.getSeminarForSupervisor(SciProSession
|
|
||||||
// .get().getUser())) {
|
|
||||||
// if (projectList.contains(s.getProject())) {
|
|
||||||
// projectList.remove(s.getProject());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // The offical one
|
|
||||||
// final ListChoice<Project> projectSelectList = new
|
|
||||||
// ListChoice<Project>(
|
|
||||||
// "selectedProject", new ListModel<Project>(projectList),
|
|
||||||
// choiceRenderer) {
|
|
||||||
// @Override
|
|
||||||
// protected CharSequence getDefaultChoice(Object selected) {
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// projectSelectList.setRequired(true);
|
|
||||||
// projectSelectList.setOutputMarkupId(true);
|
|
||||||
// add(projectSelectList);
|
|
||||||
DatePicker<Date> startDateField = new DatePicker<Date>("date") {
|
DatePicker<Date> startDateField = new DatePicker<Date>("date") {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -201,38 +162,36 @@ public class OpponentPanel extends Panel {
|
|||||||
};
|
};
|
||||||
startDateField.setDateFormat("yy-mm-dd");
|
startDateField.setDateFormat("yy-mm-dd");
|
||||||
startDateField.setRequired(true);
|
startDateField.setRequired(true);
|
||||||
// startDateField.setShowOn(ShowOnEnum.BOTH);
|
|
||||||
// startDateField.setButtonText("<div class=\"ui-icon ui-icon-calendar\"></div>");
|
|
||||||
final TextField<String> room;
|
final TextField<String> room;
|
||||||
add(room = new TextField<String>("room"));
|
add(room = new TextField<String>("room"));
|
||||||
room.setRequired(true);
|
room.setRequired(true);
|
||||||
add(startDateField);
|
add(startDateField);
|
||||||
|
|
||||||
|
String[] hourArray = new String[] { "00", "01", "02", "03", "04",
|
||||||
|
"05", "06", "07", "08", "09", "10", "11", "12",
|
||||||
|
"13", "14", "15", "16", "17", "18", "19", "20",
|
||||||
|
"21", "22", "23" };
|
||||||
|
|
||||||
|
String[] minuteArray = new String[] { "00", "05", "10",
|
||||||
|
"15", "20", "25", "30", "35", "40", "45", "50",
|
||||||
|
"55" };
|
||||||
|
|
||||||
DropDownChoice<String> hour = new DropDownChoice<String>("startHour",
|
DropDownChoice<String> hour = new DropDownChoice<String>("startHour",
|
||||||
Arrays.asList(new String[] { "00", "01", "02", "03", "04",
|
Arrays.asList(hourArray));
|
||||||
"05", "06", "07", "08", "09", "10", "11", "12",
|
|
||||||
"13", "14", "15", "16", "17", "18", "19", "20",
|
|
||||||
"21", "22", "23" }));
|
|
||||||
add(hour);
|
add(hour);
|
||||||
hour.setRequired(false);
|
hour.setRequired(false);
|
||||||
DropDownChoice<String> minute = new DropDownChoice<String>(
|
DropDownChoice<String> minute = new DropDownChoice<String>(
|
||||||
"startMinute", Arrays.asList(new String[] { "00", "05", "10",
|
"startMinute", Arrays.asList(minuteArray));
|
||||||
"15", "20", "25", "30", "35", "40", "45", "50",
|
|
||||||
"55" }));
|
|
||||||
add(minute);
|
add(minute);
|
||||||
minute.setRequired(false);
|
minute.setRequired(false);
|
||||||
|
|
||||||
DropDownChoice<String> endHour = new DropDownChoice<String>("endHour",
|
DropDownChoice<String> endHour = new DropDownChoice<String>("endHour",
|
||||||
Arrays.asList(new String[] { "00", "01", "02", "03", "04",
|
Arrays.asList(hourArray));
|
||||||
"05", "06", "07", "08", "09", "10", "11", "12",
|
|
||||||
"13", "14", "15", "16", "17", "18", "19", "20",
|
|
||||||
"21", "22", "23" }));
|
|
||||||
add(endHour);
|
add(endHour);
|
||||||
endHour.setRequired(false);
|
endHour.setRequired(false);
|
||||||
DropDownChoice<String> endMinute = new DropDownChoice<String>(
|
DropDownChoice<String> endMinute = new DropDownChoice<String>(
|
||||||
"endMinute", Arrays.asList(new String[] { "00", "05", "10",
|
"endMinute", Arrays.asList(minuteArray));
|
||||||
"15", "20", "25", "30", "35", "40", "45", "50",
|
|
||||||
"55" }));
|
|
||||||
add(endMinute);
|
add(endMinute);
|
||||||
endMinute.setRequired(false);
|
endMinute.setRequired(false);
|
||||||
|
|
||||||
@ -406,7 +365,7 @@ public class OpponentPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onError(final AjaxRequestTarget target,
|
protected void onError(final AjaxRequestTarget target,
|
||||||
final Form form) {
|
final Form<?> form) {
|
||||||
target.addComponent(feedbackContainer);
|
target.addComponent(feedbackContainer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -6,16 +6,13 @@ package se.su.dsv.scipro.opponent.panels;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.impl.AvalonLogger;
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
import org.apache.wicket.ajax.IAjaxCallDecorator;
|
import org.apache.wicket.ajax.IAjaxCallDecorator;
|
||||||
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
|
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
|
||||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
import org.apache.wicket.markup.html.basic.MultiLineLabel;
|
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
||||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||||
@ -26,7 +23,6 @@ import org.apache.wicket.markup.repeater.data.DataView;
|
|||||||
import org.apache.wicket.markup.repeater.data.IDataProvider;
|
import org.apache.wicket.markup.repeater.data.IDataProvider;
|
||||||
import org.apache.wicket.model.CompoundPropertyModel;
|
import org.apache.wicket.model.CompoundPropertyModel;
|
||||||
import org.apache.wicket.model.Model;
|
import org.apache.wicket.model.Model;
|
||||||
import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.Settings;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||||
@ -36,20 +32,14 @@ import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarActiveParticipationDao;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassSettingsDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
||||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectClassSettings;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.ProjectStatus;
|
|
||||||
import se.su.dsv.scipro.icons.HelpIconDialog;
|
|
||||||
import se.su.dsv.scipro.opponent.models.OpponentModel;
|
import se.su.dsv.scipro.opponent.models.OpponentModel;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
|
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
|
||||||
|
|
||||||
@ -64,35 +54,23 @@ public abstract class OpponentStudentViewListPanel extends Panel {
|
|||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarDao finalSeminarDao;
|
private FinalSeminarDao finalSeminarDao;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ProjectDao projectDao;
|
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarActiveParticipationDao finalSeminarActiveParticipationDao;
|
private FinalSeminarActiveParticipationDao finalSeminarActiveParticipationDao;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarOppositionDao finalSeminarOppositionDao;
|
private FinalSeminarOppositionDao finalSeminarOppositionDao;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ProjectClassDao projectClassDao;
|
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ProjectClassSettingsDao projectClassSettingsDao;
|
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private RoleDao roleDao;
|
private RoleDao roleDao;
|
||||||
|
|
||||||
private WebMarkupContainer editSeminarDialogContainer,
|
private WebMarkupContainer contactsDialogContainer;
|
||||||
contactsDialogContainer;
|
private Dialog contactsSeminarDialog;
|
||||||
private Dialog editSeminarDialog, contactsSeminarDialog;
|
|
||||||
|
|
||||||
private DataView<FinalSeminar> linkListView;
|
private DataView<FinalSeminar> linkListView;
|
||||||
private FeedbackPanel feedbackPanel, feedbackPanel2;
|
private FeedbackPanel feedbackPanel;
|
||||||
private IDataProvider<FinalSeminar> seminarList;
|
|
||||||
private int visibles;
|
|
||||||
private ContactsSeminarForm contactsSeminarForm;
|
private ContactsSeminarForm contactsSeminarForm;
|
||||||
|
|
||||||
protected abstract FeedbackPanel getFeedbackPanel();
|
protected abstract FeedbackPanel getFeedbackPanel();
|
||||||
@ -100,7 +78,6 @@ public abstract class OpponentStudentViewListPanel extends Panel {
|
|||||||
public OpponentStudentViewListPanel(String id,
|
public OpponentStudentViewListPanel(String id,
|
||||||
IDataProvider<FinalSeminar> seminarList) {
|
IDataProvider<FinalSeminar> seminarList) {
|
||||||
super(id);
|
super(id);
|
||||||
this.seminarList = seminarList;
|
|
||||||
loadListView(seminarList);
|
loadListView(seminarList);
|
||||||
feedbackPanel = getFeedbackPanel();
|
feedbackPanel = getFeedbackPanel();
|
||||||
feedbackPanel.setOutputMarkupId(true);
|
feedbackPanel.setOutputMarkupId(true);
|
||||||
|
@ -9,7 +9,6 @@ import org.apache.wicket.datetime.markup.html.basic.DateLabel;
|
|||||||
import org.apache.wicket.markup.html.basic.Label;
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
import org.apache.wicket.markup.html.list.ListItem;
|
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.Panel;
|
import org.apache.wicket.markup.html.panel.Panel;
|
||||||
import org.apache.wicket.model.Model;
|
import org.apache.wicket.model.Model;
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
@ -24,12 +24,6 @@
|
|||||||
<span wicket:id="feedbackPanel"></span>
|
<span wicket:id="feedbackPanel"></span>
|
||||||
|
|
||||||
<div wicket:id="uploadInfoContainer" class="span-10 last">
|
<div wicket:id="uploadInfoContainer" class="span-10 last">
|
||||||
<strong><span wicket:id="checkPlagarism"></span> </strong> <span
|
|
||||||
wicket:id="plagiarismLabel"></span>
|
|
||||||
<div>
|
|
||||||
<a href="#" target="_blank" wicket:id="turnItInLink">Go to
|
|
||||||
Turnitin</a>
|
|
||||||
</div>
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td wicket:id="uploader"></td>
|
<td wicket:id="uploader"></td>
|
||||||
@ -47,6 +41,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<strong><span wicket:id="checkPlagarism"></span> </strong> <span
|
||||||
|
wicket:id="plagiarismLabel"></span>
|
||||||
|
<div>
|
||||||
|
<a href="#" target="_blank" wicket:id="turnItInLink">Go to
|
||||||
|
Turnitin</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div wicket:id="uploadClosedContainer">
|
<div wicket:id="uploadClosedContainer">
|
||||||
<img wicket:id="uploadClosedIcon" /><i> <span
|
<img wicket:id="uploadClosedIcon" /><i> <span
|
||||||
@ -134,68 +134,7 @@
|
|||||||
<div wicket:id="dialog">
|
<div wicket:id="dialog">
|
||||||
<div wicket:id="dialogContainer">
|
<div wicket:id="dialogContainer">
|
||||||
<form wicket:id="editSeminarForm">
|
<form wicket:id="editSeminarForm">
|
||||||
<div wicket:id="feedbackPanel"></div>
|
<div wicket:id="editSeminarDetails"></div>
|
||||||
<div class="span-6 last">
|
|
||||||
<strong>Project:</strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<input type="text" class="text" wicket:id="project" />
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<strong>Room (must be booked in Daisy):</strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<input type="text" class="text" wicket:id="room" />
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<strong>Date:</strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<input type="text" class="text" wicket:id="date" />
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<strong>Starting Time:</strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-8 last">
|
|
||||||
Hour: <select wicket:id="startHour"></select> Minute: <select
|
|
||||||
wicket:id="startMinute"></select>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<strong>Ending Time:</strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-8 last">
|
|
||||||
Hour: <select wicket:id="endHour"></select> Minute: <select
|
|
||||||
wicket:id="endMinute"></select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="span-8 last">
|
|
||||||
<strong>Presentation Language: </strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-8 last">
|
|
||||||
<select wicket:id="presentationLanguage"></select>
|
|
||||||
</div>
|
|
||||||
<div class="span-8 last">
|
|
||||||
<strong>Thesis/Report Language: </strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-8 last">
|
|
||||||
<select wicket:id="reportLanguage"></select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="span-6 last">
|
|
||||||
<strong>Opponents (optional):</strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last" id="opponents">
|
|
||||||
<div wicket:id="opponentList"></div>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<strong>Active Participants (Optional):</strong>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last" id="opponents">
|
|
||||||
<div wicket:id="activeParticipations"></div>
|
|
||||||
</div>
|
|
||||||
<div class="span-6 last">
|
|
||||||
<input type="submit" wicket:id="submitButton" />
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,26 +1,19 @@
|
|||||||
package se.su.dsv.scipro.opponent.panels;
|
package se.su.dsv.scipro.opponent.panels;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||||
import org.apache.wicket.datetime.DateConverter;
|
|
||||||
import org.apache.wicket.datetime.PatternDateConverter;
|
import org.apache.wicket.datetime.PatternDateConverter;
|
||||||
import org.apache.wicket.datetime.markup.html.basic.DateLabel;
|
import org.apache.wicket.datetime.markup.html.basic.DateLabel;
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
import org.apache.wicket.markup.html.basic.MultiLineLabel;
|
|
||||||
import org.apache.wicket.markup.html.form.Button;
|
import org.apache.wicket.markup.html.form.Button;
|
||||||
import org.apache.wicket.markup.html.form.DropDownChoice;
|
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
import org.apache.wicket.markup.html.form.SubmitLink;
|
import org.apache.wicket.markup.html.form.SubmitLink;
|
||||||
import org.apache.wicket.markup.html.form.TextField;
|
|
||||||
import org.apache.wicket.markup.html.form.upload.FileUpload;
|
import org.apache.wicket.markup.html.form.upload.FileUpload;
|
||||||
import org.apache.wicket.markup.html.form.upload.FileUploadField;
|
import org.apache.wicket.markup.html.form.upload.FileUploadField;
|
||||||
import org.apache.wicket.markup.html.link.Link;
|
import org.apache.wicket.markup.html.link.Link;
|
||||||
@ -34,42 +27,24 @@ import org.apache.wicket.model.CompoundPropertyModel;
|
|||||||
import org.apache.wicket.model.Model;
|
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.apache.wicket.util.convert.IConverter;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.format.DateTimeFormat;
|
|
||||||
import org.joda.time.format.DateTimeFormatter;
|
|
||||||
import org.odlabs.wiquery.ui.datepicker.DatePicker;
|
|
||||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
import se.su.dsv.scipro.SciProSession;
|
||||||
import se.su.dsv.scipro.components.autocomplete.AutoCompletionChoicesProvider;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteObjectConverter;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteRenderer;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.UserProjectMultiObjectAutoCompleteBuilder;
|
|
||||||
import se.su.dsv.scipro.components.autocomplete.UserProjectMultiObjectAutoCompleteField;
|
|
||||||
import se.su.dsv.scipro.data.controllers.FinalSeminarUploadController;
|
import se.su.dsv.scipro.data.controllers.FinalSeminarUploadController;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CheckPlagiarismEventDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarActiveParticipationDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.FinalSeminarLanguages;
|
|
||||||
import se.su.dsv.scipro.icons.ImageIcon;
|
import se.su.dsv.scipro.icons.ImageIcon;
|
||||||
import se.su.dsv.scipro.opponent.models.OpponentModel;
|
import se.su.dsv.scipro.opponent.models.OpponentModel;
|
||||||
import se.su.dsv.scipro.opponent.pages.TurnitinPopupPage;
|
import se.su.dsv.scipro.opponent.pages.TurnitinPopupPage;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
||||||
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.supervisor.pages.SupervisorProjectsFinalSeminarPage;
|
|
||||||
import se.su.dsv.scipro.util.TurnitinComponent;
|
import se.su.dsv.scipro.util.TurnitinComponent;
|
||||||
|
|
||||||
public class ProjectFinalSeminarPanel extends Panel {
|
public class ProjectFinalSeminarPanel extends Panel {
|
||||||
@ -80,66 +55,51 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarDao finalSeminarDao;
|
private FinalSeminarDao finalSeminarDao;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private FinalSeminarOppositionDao finalSeminarOppositionDao;
|
|
||||||
@SpringBean
|
|
||||||
private UserDao userDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private CheckPlagiarismEventDao checkPlagiarismEventDao;
|
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private RoleDao roleDao;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private FinalSeminarActiveParticipationDao finalSeminarActiveParticipationDao;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Date finalSubmissionDate;
|
private Date finalSubmissionDate;
|
||||||
|
|
||||||
private FeedbackPanel feedbackPanel;
|
private FeedbackPanel feedbackPanel;
|
||||||
private WebMarkupContainer editSeminarDialogContainer, contactsDialogContainer;
|
private WebMarkupContainer editSeminarDialogContainer;
|
||||||
private Dialog editSeminarDialog, contactsSeminarDialog;
|
private Dialog editSeminarDialog;
|
||||||
private FinalSeminar editSeminar;
|
private EditSeminarForm editSeminarForm;
|
||||||
private DatePicker<Date> startDateField;
|
|
||||||
private DropDownChoice<String> startHour, startMinute, endHour, endMinute;
|
|
||||||
private UserProjectMultiObjectAutoCompleteField<FinalSeminarActiveParticipation, Long> moacf,
|
|
||||||
activeListerners;
|
|
||||||
private TextField<String> room;
|
|
||||||
private TextField<String> projectLabel;
|
|
||||||
private MultiLineLabel contactsTextArea;
|
|
||||||
private DropDownChoice<FinalSeminarLanguages> presentationLanguage;
|
|
||||||
private DropDownChoice<FinalSeminarLanguages> reportLanguage;
|
|
||||||
|
|
||||||
public ProjectFinalSeminarPanel(final String id,
|
public ProjectFinalSeminarPanel(final String id, final FinalSeminar seminar,
|
||||||
final FinalSeminar seminar, final boolean isSupervisorView) {
|
final boolean isSupervisorView) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|
||||||
setVersioned(false);
|
setVersioned(false);
|
||||||
|
|
||||||
final PatternDateConverter pdc = new PatternDateConverter(
|
final PatternDateConverter pdc = new PatternDateConverter("yyyy-MM-dd HH:mm", false);
|
||||||
"yyyy-MM-dd HH:mm", false);
|
|
||||||
EditForm editForm;
|
EditForm editForm;
|
||||||
add(editForm = new EditForm("editForm", seminar));
|
add(editForm = new EditForm("editForm", seminar));
|
||||||
|
|
||||||
|
editSeminarDialogContainer = new WebMarkupContainer("dialogContainer");
|
||||||
|
editSeminarDialog = new Dialog("dialog");
|
||||||
|
editSeminarDialog.setModal(true);
|
||||||
|
editSeminarDialog.setAutoOpen(false);
|
||||||
|
editSeminarDialog.setWidth(470);
|
||||||
|
editSeminarDialog.add(editSeminarDialogContainer);
|
||||||
|
add(editSeminarDialog);
|
||||||
|
editSeminarDialogContainer.setOutputMarkupId(true);
|
||||||
|
editSeminarDialogContainer.add(editSeminarForm = new EditSeminarForm("editSeminarForm"));
|
||||||
|
editSeminarForm.setOutputMarkupId(true);
|
||||||
add(new Label("seminarLocation", seminar.getRoom()));
|
add(new Label("seminarLocation", seminar.getRoom()));
|
||||||
add(new Label("projectClass", seminar.getProject().getProjectClass()
|
add(new Label("projectClass", seminar.getProject().getProjectClass().getName()));
|
||||||
.getName()));
|
add(new Label("seminarLanguage", seminar.getPresentationLanguage().toString()));
|
||||||
add(new Label("seminarLanguage", seminar.getPresentationLanguage()
|
|
||||||
.toString()));
|
|
||||||
add(new Label("thesisLanguage", seminar.getReportLanguage().toString()));
|
add(new Label("thesisLanguage", seminar.getReportLanguage().toString()));
|
||||||
|
|
||||||
if (!isSupervisorView) {
|
if (!isSupervisorView) {
|
||||||
editForm.setVisible(false);
|
editForm.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Label pdfLabel = new Label("mustBePdf", " (PDF required)");
|
Label pdfLabel = new Label("mustBePdf", " (PDF required)");
|
||||||
pdfLabel.setOutputMarkupPlaceholderTag(true);
|
pdfLabel.setOutputMarkupPlaceholderTag(true);
|
||||||
pdfLabel.setVisible(generalSystemSettingsDao.getGeneralSystemSettingsInstance().isFinalSeminarThesisMustBeAPDF() &&!isSupervisorView);
|
pdfLabel.setVisible(generalSystemSettingsDao.getGeneralSystemSettingsInstance()
|
||||||
|
.isFinalSeminarThesisMustBeAPDF() && !isSupervisorView);
|
||||||
add(pdfLabel);
|
add(pdfLabel);
|
||||||
int totalAttendees = 1;
|
int totalAttendees = 1;
|
||||||
totalAttendees += seminar.getActiveParticipations().size();
|
totalAttendees += seminar.getActiveParticipations().size();
|
||||||
@ -159,12 +119,9 @@ 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", seminar,
|
final AjaxLink<Void> totalAttendeesLink = new AjaxLink<Void>("totalAttendeesLink") {
|
||||||
false));
|
|
||||||
|
|
||||||
final AjaxLink<Void> totalAttendeesLink = new AjaxLink<Void>(
|
|
||||||
"totalAttendeesLink") {
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -181,29 +138,17 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
|
|
||||||
add(new Label("totalAttendees", String.valueOf(totalAttendees)));
|
add(new Label("totalAttendees", String.valueOf(totalAttendees)));
|
||||||
|
|
||||||
// add(totalAttendeesLink);
|
add(new DateLabel("seminarDate", new Model<Date>(seminar.getStartDate()), pdc));
|
||||||
|
|
||||||
add(new DateLabel("seminarDate",
|
add(new DateLabel("seminarEndDate", new Model<Date>(seminar.getEndDate()),
|
||||||
new Model<Date>(seminar.getStartDate()), pdc));
|
new PatternDateConverter("HH:mm", false)));
|
||||||
|
|
||||||
add(new DateLabel("seminarEndDate", new Model<Date>(
|
|
||||||
seminar.getEndDate()), new PatternDateConverter("HH:mm", false)));
|
|
||||||
/*
|
/*
|
||||||
* 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)
|
finalSubmissionDate = new DateTime(seminar.getStartDate()).minusDays(7).toDate();
|
||||||
.toDate();
|
|
||||||
|
|
||||||
editSeminarDialogContainer = new WebMarkupContainer("dialogContainer");
|
|
||||||
editSeminarDialog = new Dialog("dialog");
|
|
||||||
editSeminarDialog.setModal(true);
|
|
||||||
editSeminarDialog.setAutoOpen(false);
|
|
||||||
editSeminarDialog.setWidth(470);
|
|
||||||
editSeminarDialog.add(editSeminarDialogContainer);
|
|
||||||
add(editSeminarDialog);
|
|
||||||
editSeminarDialogContainer.setOutputMarkupId(true);
|
|
||||||
editSeminarDialogContainer.add(new EditSeminarForm("editSeminarForm"));
|
|
||||||
|
|
||||||
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;
|
||||||
@ -211,13 +156,11 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public String getObject() {
|
public String getObject() {
|
||||||
|
|
||||||
return seminar.getDocument() == null ? "" : seminar
|
return seminar.getDocument() == null ? "" : seminar.getDocument().getName();
|
||||||
.getDocument().getName();
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
final WebMarkupContainer uploadInfoContainer = new WebMarkupContainer(
|
final WebMarkupContainer uploadInfoContainer = new WebMarkupContainer("uploadInfoContainer") {
|
||||||
"uploadInfoContainer") {
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -226,12 +169,11 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
uploadInfoContainer.add(new DateLabel("uploadDate", new Model<Date>(
|
uploadInfoContainer.add(new DateLabel("uploadDate", new Model<Date>(seminar
|
||||||
seminar.getDocumentUploadDate()), pdc));
|
.getDocumentUploadDate()), pdc));
|
||||||
|
|
||||||
if (seminar.getDocumentUploader() != null) {
|
if (seminar.getDocumentUploader() != null) {
|
||||||
uploadInfoContainer.add(seminar.getDocumentUploader()
|
uploadInfoContainer.add(seminar.getDocumentUploader().getDisplayComponent("uploader"));
|
||||||
.getDisplayComponent("uploader"));
|
|
||||||
} else {
|
} else {
|
||||||
uploadInfoContainer.add(new EmptyPanel("uploader"));
|
uploadInfoContainer.add(new EmptyPanel("uploader"));
|
||||||
}
|
}
|
||||||
@ -250,7 +192,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
public void onClick() {
|
public void onClick() {
|
||||||
TurnitinComponent turnitin = new TurnitinComponent();
|
TurnitinComponent turnitin = new TurnitinComponent();
|
||||||
String url = turnitin.returnReport(seminar.getTurnitinId());
|
String url = turnitin.returnReport(seminar.getTurnitinId());
|
||||||
if(url != null){
|
if (url != null) {
|
||||||
seminar.setCheckedForPlagirism(true);
|
seminar.setCheckedForPlagirism(true);
|
||||||
finalSeminarDao.save(seminar);
|
finalSeminarDao.save(seminar);
|
||||||
}
|
}
|
||||||
@ -266,10 +208,8 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
turnItLink.setVisible(isSupervisorView);
|
turnItLink.setVisible(isSupervisorView);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadInfoContainer.add(new FileDownloadLink("download", seminar
|
uploadInfoContainer.add(new FileDownloadLink("download", seminar.getDocument()));
|
||||||
.getDocument()));
|
uploadInfoContainer.add(new FileOpenLink("open", seminar.getDocument()));
|
||||||
uploadInfoContainer
|
|
||||||
.add(new FileOpenLink("open", seminar.getDocument()));
|
|
||||||
uploadInfoContainer.add(plagiarismLabel);
|
uploadInfoContainer.add(plagiarismLabel);
|
||||||
uploadInfoContainer.add(turnItLink);
|
uploadInfoContainer.add(turnItLink);
|
||||||
uploadInfoContainer.add(checkPlagiarismLabel);
|
uploadInfoContainer.add(checkPlagiarismLabel);
|
||||||
@ -280,9 +220,8 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
|
|
||||||
return !isSupervisorView
|
return !isSupervisorView && seminar.getActiveParticipations().isEmpty()
|
||||||
&& seminar.getActiveParticipations().isEmpty()
|
&& seminar.getOppositions().isEmpty() && seminar.getTurnitinId() != null;
|
||||||
&& seminar.getOppositions().isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -325,18 +264,13 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
protected void populateItem(final ListItem<FileDescription> fileItem) {
|
||||||
|
fileItem.add(new Label("fileName", fileItem.getModelObject().getName()));
|
||||||
|
fileItem.add(new DateLabel("uploadDate", new Model<Date>(o
|
||||||
|
.getDateReported()), pdc));
|
||||||
|
|
||||||
protected void populateItem(
|
fileItem.add(new FileDownloadLink("download", fileItem.getModel()));
|
||||||
final ListItem<FileDescription> fileItem) {
|
fileItem.add(new FileOpenLink("open", fileItem.getModel()));
|
||||||
fileItem.add(new Label("fileName", fileItem
|
|
||||||
.getModelObject().getName()));
|
|
||||||
fileItem.add(new DateLabel("uploadDate",
|
|
||||||
new Model<Date>(o.getDateReported()), pdc));
|
|
||||||
|
|
||||||
fileItem.add(new FileDownloadLink("download", fileItem
|
|
||||||
.getModel()));
|
|
||||||
fileItem.add(new FileOpenLink("open", fileItem
|
|
||||||
.getModel()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -354,13 +288,12 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add(new ListView<FinalSeminarActiveParticipation>(
|
add(new ListView<FinalSeminarActiveParticipation>("activeParticipantsList",
|
||||||
"activeParticipantsList", seminar.getActiveParticipations()) {
|
seminar.getActiveParticipations()) {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateItem(
|
protected void populateItem(ListItem<FinalSeminarActiveParticipation> item) {
|
||||||
ListItem<FinalSeminarActiveParticipation> item) {
|
|
||||||
item.add(item.getModelObject().getUser()
|
item.add(item.getModelObject().getUser()
|
||||||
.getDisplayComponent("activeParticipant", true));
|
.getDisplayComponent("activeParticipant", true));
|
||||||
add(item);
|
add(item);
|
||||||
@ -432,8 +365,7 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
* TODO Fix so that feedback shows up correctly
|
* TODO Fix so that feedback shows up correctly
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public SeminarDocumentUploadForm(final String id,
|
public SeminarDocumentUploadForm(final String id, final FinalSeminar seminar) {
|
||||||
final FinalSeminar seminar) {
|
|
||||||
super(id);
|
super(id);
|
||||||
setMultiPart(true);
|
setMultiPart(true);
|
||||||
|
|
||||||
@ -463,6 +395,20 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class EditSeminarForm extends Form<OpponentModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -5004827722926732419L;
|
||||||
|
|
||||||
|
public EditSeminarForm(String name) {
|
||||||
|
super(name, new CompoundPropertyModel<OpponentModel>(new OpponentModel()));
|
||||||
|
editSeminarDialog.setTitle("Edit Seminar");
|
||||||
|
add(new EmptyPanel("editSeminarDetails"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class EditForm extends Form<Void> {
|
private class EditForm extends Form<Void> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -480,69 +426,9 @@ 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(seminar);
|
||||||
editSeminar = seminar2;
|
editSeminarForm.removeAll();
|
||||||
startDateField.setDefaultModelObject(seminar2
|
editSeminarForm.add(new EditFinalSeminarFormPanel("editSeminarDetails", seminar2));
|
||||||
.getStartDate());
|
target.addComponent(editSeminarForm);
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(seminar2.getStartDate());
|
|
||||||
int hourInt = calendar.get(Calendar.HOUR_OF_DAY);
|
|
||||||
String hourString = "";
|
|
||||||
if (hourInt < 10) {
|
|
||||||
hourString = "0" + String.valueOf(hourInt);
|
|
||||||
} else {
|
|
||||||
hourString = String.valueOf(hourInt);
|
|
||||||
}
|
|
||||||
startHour.setDefaultModelObject(hourString);
|
|
||||||
|
|
||||||
int minuteInt = calendar.get(Calendar.MINUTE);
|
|
||||||
String minuteString = "";
|
|
||||||
if (minuteInt < 10) {
|
|
||||||
minuteString = "0" + String.valueOf(minuteInt);
|
|
||||||
} else {
|
|
||||||
minuteString = String.valueOf(minuteInt);
|
|
||||||
}
|
|
||||||
|
|
||||||
startMinute.setDefaultModelObject(minuteString);
|
|
||||||
|
|
||||||
calendar.setTime(seminar2.getEndDate());
|
|
||||||
hourInt = calendar.get(Calendar.HOUR_OF_DAY);
|
|
||||||
hourString = "";
|
|
||||||
if (hourInt < 10) {
|
|
||||||
hourString = "0" + String.valueOf(hourInt);
|
|
||||||
} else {
|
|
||||||
hourString = String.valueOf(hourInt);
|
|
||||||
}
|
|
||||||
endHour.setDefaultModelObject(hourString);
|
|
||||||
|
|
||||||
minuteInt = calendar.get(Calendar.MINUTE);
|
|
||||||
minuteString = "";
|
|
||||||
if (minuteInt < 10) {
|
|
||||||
minuteString = "0" + String.valueOf(minuteInt);
|
|
||||||
} else {
|
|
||||||
minuteString = String.valueOf(minuteInt);
|
|
||||||
}
|
|
||||||
|
|
||||||
endMinute.setDefaultModelObject(minuteString);
|
|
||||||
room.setDefaultModelObject(seminar2.getRoom());
|
|
||||||
List<FinalSeminarActiveParticipation> userList = new ArrayList<FinalSeminarActiveParticipation>();
|
|
||||||
for (FinalSeminarOpposition f : seminar2.getOppositions()) {
|
|
||||||
FinalSeminarActiveParticipation al = new FinalSeminarActiveParticipation();
|
|
||||||
al.setUser(f.getOpponent().getUser());
|
|
||||||
al.setProject(f.getProject());
|
|
||||||
userList.add(al);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
presentationLanguage.setDefaultModelObject(seminar
|
|
||||||
.getPresentationLanguage());
|
|
||||||
reportLanguage.setDefaultModelObject(seminar
|
|
||||||
.getReportLanguage());
|
|
||||||
|
|
||||||
moacf.setSelectedObjects(userList);
|
|
||||||
|
|
||||||
activeListerners.setSelectedObjects(seminar2.getActiveParticipations());
|
|
||||||
projectLabel.setDefaultModelObject(seminar.getProject().getTitle());
|
|
||||||
target.addComponent(editSeminarDialog);
|
|
||||||
editSeminarDialog.open(target);
|
editSeminarDialog.open(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,267 +442,6 @@ public class ProjectFinalSeminarPanel extends Panel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditSeminarForm extends Form<OpponentModel> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -5268957422910135323L;
|
|
||||||
|
|
||||||
public EditSeminarForm(String name) {
|
|
||||||
super(name, new CompoundPropertyModel<OpponentModel>(new OpponentModel()));
|
|
||||||
// final WebMarkupContainer feedbackContainer = new
|
|
||||||
// WebMarkupContainer(
|
|
||||||
// "feedbackContainer");
|
|
||||||
// feedbackContainer.setOutputMarkupId(true);
|
|
||||||
// WebMarkupContainer feedbackPanel = new
|
|
||||||
// FormFeedbackPanel<OpponentModel>(
|
|
||||||
// "feedbackPanel", this);
|
|
||||||
// feedbackContainer.add(feedbackPanel);
|
|
||||||
// add(feedbackContainer);
|
|
||||||
add(feedbackPanel = new FeedbackPanel("feedbackPanel"));
|
|
||||||
feedbackPanel.setOutputMarkupId(true);
|
|
||||||
editSeminarDialog.setTitle("Edit Seminar");
|
|
||||||
|
|
||||||
add(projectLabel = new TextField<String>("project"));
|
|
||||||
projectLabel.setEnabled(false);
|
|
||||||
|
|
||||||
startDateField = new DatePicker<Date>("date") {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final IConverter getConverter(Class<?> type) {
|
|
||||||
return new DateConverter(true) {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDatePattern() {
|
|
||||||
return "yy-dd-mm";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected DateTimeFormatter getFormat() {
|
|
||||||
return DateTimeFormat.forPattern("YYYY-MM-dd");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
startDateField.setDateFormat("yy-mm-dd");
|
|
||||||
startDateField.setRequired(true);
|
|
||||||
// startDateField.setShowOn(ShowOnEnum.BOTH);
|
|
||||||
// startDateField.setButtonText("<div class=\"ui-icon ui-icon-calendar\"></div>");
|
|
||||||
add(room = new TextField<String>("room"));
|
|
||||||
add(startDateField);
|
|
||||||
|
|
||||||
startHour = new DropDownChoice<String>("startHour", Arrays.asList(new String[] { "00",
|
|
||||||
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
|
|
||||||
"14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));
|
|
||||||
add(startHour);
|
|
||||||
startHour.setRequired(false);
|
|
||||||
startMinute = new DropDownChoice<String>("startMinute", Arrays.asList(new String[] {
|
|
||||||
"00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" }));
|
|
||||||
add(startMinute);
|
|
||||||
|
|
||||||
endHour = new DropDownChoice<String>("endHour", Arrays.asList(new String[] { "00",
|
|
||||||
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
|
|
||||||
"14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));
|
|
||||||
add(endHour);
|
|
||||||
endHour.setRequired(false);
|
|
||||||
endMinute = new DropDownChoice<String>("endMinute", Arrays.asList(new String[] { "00",
|
|
||||||
"05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" }));
|
|
||||||
add(endMinute);
|
|
||||||
|
|
||||||
List<FinalSeminarLanguages> languageOptions = new ArrayList<FinalSeminarLanguages>(
|
|
||||||
Arrays.asList(FinalSeminarLanguages.values()));
|
|
||||||
|
|
||||||
presentationLanguage = new DropDownChoice<FinalSeminarLanguages>(
|
|
||||||
"presentationLanguage", languageOptions);
|
|
||||||
add(presentationLanguage);
|
|
||||||
presentationLanguage.setRequired(true);
|
|
||||||
|
|
||||||
|
|
||||||
reportLanguage = new DropDownChoice<FinalSeminarLanguages>(
|
|
||||||
"reportLanguage", languageOptions);
|
|
||||||
|
|
||||||
add(reportLanguage);
|
|
||||||
reportLanguage.setRequired(true);
|
|
||||||
|
|
||||||
room.setRequired(true);
|
|
||||||
|
|
||||||
AutoCompletionChoicesProvider<FinalSeminarActiveParticipation> choiceProvider = new AutoCompletionChoicesProvider<FinalSeminarActiveParticipation>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<FinalSeminarActiveParticipation> getChoices(
|
|
||||||
String input) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
List<FinalSeminarActiveParticipation> active = new ArrayList<FinalSeminarActiveParticipation>();
|
|
||||||
for (User user : userDao.findUserQuery(input, 10)) {
|
|
||||||
FinalSeminarActiveParticipation ac = new FinalSeminarActiveParticipation();
|
|
||||||
ac.setUser(user);
|
|
||||||
active.add(ac);
|
|
||||||
}
|
|
||||||
return active.iterator();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
UserProjectMultiObjectAutoCompleteBuilder<FinalSeminarActiveParticipation, Long> moac = new UserProjectMultiObjectAutoCompleteBuilder<FinalSeminarActiveParticipation, Long>(
|
|
||||||
choiceProvider);
|
|
||||||
moac.idType(Long.class);
|
|
||||||
moac.autoCompleteRenderer(new MultiObjectAutoCompleteRenderer<FinalSeminarActiveParticipation>() {
|
|
||||||
@Override
|
|
||||||
public String getTextValue(FinalSeminarActiveParticipation al) {
|
|
||||||
User u = al.getUser();
|
|
||||||
return u.getFirstName() + " " + u.getLastName() + " <" + u.getEmailAddress()
|
|
||||||
+ ">";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getIdValue(FinalSeminarActiveParticipation al) {
|
|
||||||
User u = al.getUser();
|
|
||||||
return u.getId().toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
moac.objectConverter(new MultiObjectAutoCompleteObjectConverter<Long, FinalSeminarActiveParticipation>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FinalSeminarActiveParticipation convertToObject(Long id) {
|
|
||||||
FinalSeminarActiveParticipation ac = new FinalSeminarActiveParticipation();
|
|
||||||
ac.setUser(userDao.load(id));
|
|
||||||
return ac;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
moacf = moac.build("opponentList", null, getModelObject());
|
|
||||||
activeListerners = moac.build("activeParticipations", null, getModelObject());
|
|
||||||
add(moacf);
|
|
||||||
add(activeListerners);
|
|
||||||
|
|
||||||
add(new AjaxButton("submitButton", new Model<String>("Save")) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
editSeminar = finalSeminarDao.reLoad(editSeminar);
|
|
||||||
OpponentModel opponentModel = (OpponentModel) form.getDefaultModelObject();
|
|
||||||
boolean notSameProject = true;
|
|
||||||
boolean error = false;
|
|
||||||
Project project = editSeminar.getProject();
|
|
||||||
for (Student student : project.getProjectParticipants()) {
|
|
||||||
if (!notSameProject)
|
|
||||||
break;
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel.getOpponentList()) {
|
|
||||||
if (student.getUser().equals(al.getUser()) && !al.isPreDeleted()) {
|
|
||||||
notSameProject = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getActiveParticipations()) {
|
|
||||||
if (student.getUser().equals(al.getUser()) && !al.isPreDeleted()) {
|
|
||||||
notSameProject = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getOpponentList()) {
|
|
||||||
if (al.getProject() == null && !al.isPreDeleted()) {
|
|
||||||
error = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!error) {
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getActiveParticipations()) {
|
|
||||||
if (al.getProject() == null && !al.isPreDeleted()) {
|
|
||||||
error = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notSameProject && !error) {
|
|
||||||
|
|
||||||
Date date = opponentModel.getDate();
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTime(date);
|
|
||||||
cal.set(Calendar.HOUR_OF_DAY, Integer.valueOf(opponentModel.getStartHour()));
|
|
||||||
cal.set(Calendar.MINUTE, Integer.valueOf(opponentModel.getStartMinute()));
|
|
||||||
|
|
||||||
editSeminar.setStartDate(cal.getTime());
|
|
||||||
|
|
||||||
cal.set(Calendar.HOUR_OF_DAY, Integer.valueOf(opponentModel.getEndHour()));
|
|
||||||
cal.set(Calendar.MINUTE, Integer.valueOf(opponentModel.getEndMinute()));
|
|
||||||
editSeminar.setEndDate(cal.getTime());
|
|
||||||
|
|
||||||
editSeminar.setProject(project);
|
|
||||||
editSeminar.setRoom(opponentModel.getRoom());
|
|
||||||
|
|
||||||
|
|
||||||
editSeminar.setPresentationLanguage(opponentModel
|
|
||||||
.getPresentationLanguage());
|
|
||||||
editSeminar.setReportLanguage(opponentModel
|
|
||||||
.getReportLanguage());
|
|
||||||
|
|
||||||
editSeminar = finalSeminarDao.save(editSeminar);
|
|
||||||
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getOpponentList()) {
|
|
||||||
|
|
||||||
if (!al.isPreDeleted()) {
|
|
||||||
FinalSeminarOpposition opposition1 = new FinalSeminarOpposition();
|
|
||||||
opposition1.setOpponent(roleDao.makeStudent(al
|
|
||||||
.getUser()));
|
|
||||||
opposition1.setProject(al.getProject());
|
|
||||||
opposition1.setFinalSeminar(editSeminar);
|
|
||||||
opposition1 = finalSeminarOppositionDao
|
|
||||||
.save(opposition1);
|
|
||||||
} else if (al.isPreDeleted()) {
|
|
||||||
List<FinalSeminarOpposition> finalSeminar = finalSeminarOppositionDao
|
|
||||||
.findOppositionsByUserAndProject(
|
|
||||||
al.getUser(), al.getProject(),
|
|
||||||
editSeminar);
|
|
||||||
for (FinalSeminarOpposition fso : finalSeminar) {
|
|
||||||
seminarUploadController.deleteOpponentFiles(fso);
|
|
||||||
finalSeminarOppositionDao.delete(fso);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (FinalSeminarActiveParticipation al : opponentModel
|
|
||||||
.getActiveParticipations()) {
|
|
||||||
editSeminar = finalSeminarDao.reLoad(editSeminar);
|
|
||||||
List<FinalSeminarActiveParticipation> allList = editSeminar
|
|
||||||
.getActiveParticipations();
|
|
||||||
if (!allList.contains(al) && !al.isPreDeleted()) {
|
|
||||||
al.setFinalSeminar(editSeminar);
|
|
||||||
finalSeminarActiveParticipationDao.save(al);
|
|
||||||
|
|
||||||
} else if (al.isPreDeleted()
|
|
||||||
&& allList.contains(al)) {
|
|
||||||
finalSeminarActiveParticipationDao
|
|
||||||
.delete(finalSeminarActiveParticipationDao
|
|
||||||
.reLoad(al));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
setResponsePage(SupervisorProjectsFinalSeminarPage.class);
|
|
||||||
} else if (!notSameProject && error) {
|
|
||||||
error("Opponent/Active participant is an author in the final seminar");
|
|
||||||
error("Must select a Project for the Opponent/Active participant");
|
|
||||||
} else if (notSameProject && error) {
|
|
||||||
error("Must select a Project for the Opponent/Active participant");
|
|
||||||
} else {
|
|
||||||
error("Opponent/Active participant is an author in the final seminar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onError(final AjaxRequestTarget target, final Form form) {
|
|
||||||
target.addComponent(feedbackPanel);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import se.su.dsv.scipro.data.dataobjects.Project;
|
|||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
|
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
|
||||||
import se.su.dsv.scipro.repository.FileRepository;
|
|
||||||
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;
|
||||||
|
|
||||||
@ -41,9 +40,6 @@ public class ProjectOppositionsPanel extends Panel {
|
|||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarOppositionDao finalSeminarOppositionDao;
|
private FinalSeminarOppositionDao finalSeminarOppositionDao;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private FileRepository fileRepository;
|
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private FinalSeminarUploadController seminarUploadController;
|
private FinalSeminarUploadController seminarUploadController;
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarActiveParticipationDao;
|
|||||||
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
|
||||||
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.Employee;
|
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
@ -5,6 +5,7 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@ -17,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
||||||
import se.su.dsv.scipro.data.controllers.NotificationController;
|
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||||
|
import se.su.dsv.scipro.data.controllers.NotificationMessage;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.FileDescriptionDao;
|
import se.su.dsv.scipro.data.dao.interfaces.FileDescriptionDao;
|
||||||
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.FileDescription;
|
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
||||||
@ -27,6 +30,7 @@ import se.su.dsv.scipro.data.dataobjects.ProjectClassSettings;
|
|||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.NotificationEventType;
|
import se.su.dsv.scipro.data.enums.NotificationEventType;
|
||||||
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
import se.su.dsv.scipro.exceptions.UpdatedSincePageLoadException;
|
import se.su.dsv.scipro.exceptions.UpdatedSincePageLoadException;
|
||||||
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerRequestDao;
|
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerRequestDao;
|
||||||
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerReviewDao;
|
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerReviewDao;
|
||||||
@ -34,309 +38,381 @@ import se.su.dsv.scipro.peer.data.dataobjects.PeerRequest;
|
|||||||
import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
|
import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
|
||||||
import se.su.dsv.scipro.peer.enums.RequestStatus;
|
import se.su.dsv.scipro.peer.enums.RequestStatus;
|
||||||
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
||||||
|
import se.su.dsv.scipro.peer.pages.ProjectPeerStatsPage;
|
||||||
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewPage;
|
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewPage;
|
||||||
import se.su.dsv.scipro.repository.FileRepository;
|
import se.su.dsv.scipro.repository.FileRepository;
|
||||||
import se.su.dsv.scipro.repository.util.FileStorageException;
|
import se.su.dsv.scipro.repository.util.FileStorageException;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
import se.su.dsv.scipro.util.PropsUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Martin Peters - mpeters@dsv.su.se
|
* @author Martin Peters - mpeters@dsv.su.se
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Controller("peerPortalController")
|
@Controller("peerPortalController")
|
||||||
public class PeerPortalControllerImpl implements PeerPortalController {
|
public class PeerPortalControllerImpl implements PeerPortalController {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static final String PEER_FILE_PATH = "peer/";
|
public static final String PEER_FILE_PATH = "peer/";
|
||||||
public static final String PEER_REQUEST_PATH = PEER_FILE_PATH + "request/";
|
public static final String PEER_REQUEST_PATH = PEER_FILE_PATH + "request/";
|
||||||
public static final String PEER_REVIEW_PATH = PEER_FILE_PATH + "review/";
|
public static final String PEER_REVIEW_PATH = PEER_FILE_PATH + "review/";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PeerRequestDao peerRequestDao;
|
private PeerRequestDao peerRequestDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PeerReviewDao peerReviewDao;
|
private PeerReviewDao peerReviewDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FileRepository fileRepository;
|
private FileRepository fileRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FileDescriptionDao fileDescriptionDao;
|
private FileDescriptionDao fileDescriptionDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectDao projectDao;
|
private ProjectDao projectDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private NotificationController notificationController;
|
private NotificationController notificationController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of PeerRequests and if it is reviewable by the combination of Student + Project. All input parameters are optional
|
* Gets a list of PeerRequests and if it is reviewable by the combination of
|
||||||
* @param projectClass may be null.
|
* Student + Project. All input parameters are optional
|
||||||
* @param project may be null.
|
*
|
||||||
* @param student may be null.
|
* @param projectClass
|
||||||
|
* may be null.
|
||||||
|
* @param project
|
||||||
|
* may be null.
|
||||||
|
* @param student
|
||||||
|
* may be null.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public List<Tuple> getPeerRequests(final ProjectClass projectClass, final Project project, final Student student){
|
public List<Tuple> getPeerRequests(final ProjectClass projectClass, final Project project,
|
||||||
//TODO how to handle project with ProjectClass = UNKNOWN?
|
final Student student) {
|
||||||
|
// TODO how to handle project with ProjectClass = UNKNOWN?
|
||||||
List<PeerRequest> temp = peerRequestDao.getPeerRequests(RequestStatus.WAITING, projectClass );
|
|
||||||
|
List<PeerRequest> temp = peerRequestDao
|
||||||
|
.getPeerRequests(RequestStatus.WAITING, projectClass);
|
||||||
List<Tuple> result = new ArrayList<Tuple>(temp.size());
|
List<Tuple> result = new ArrayList<Tuple>(temp.size());
|
||||||
|
|
||||||
ProjectClassSettings settings = projectClass.getProjectClassSettings();
|
ProjectClassSettings settings = projectClass.getProjectClassSettings();
|
||||||
Date priorityDate = new DateTime().minusDays( settings.getNumDaysBeforePeerRequestPriority() ).toDate();
|
Date priorityDate = new DateTime()
|
||||||
|
.minusDays(settings.getNumDaysBeforePeerRequestPriority()).toDate();
|
||||||
boolean foundExpiredPriorityDate = false;
|
boolean foundExpiredPriorityDate = false;
|
||||||
|
|
||||||
for(PeerRequest peerRequest : temp){
|
for (PeerRequest peerRequest : temp) {
|
||||||
Student requestingStudent = peerRequest.getRequester();
|
Student requestingStudent = peerRequest.getRequester();
|
||||||
Project requestingProject = peerRequest.getProject();
|
Project requestingProject = peerRequest.getProject();
|
||||||
int given = peerReviewDao.countReviewsGiven(requestingStudent, requestingProject);
|
int given = peerReviewDao.countReviewsGiven(requestingStudent, requestingProject);
|
||||||
int received = peerReviewDao.countReviewsReceived(requestingStudent, requestingProject);
|
int received = peerReviewDao.countReviewsReceived(requestingStudent, requestingProject);
|
||||||
|
|
||||||
Pair<Boolean,NotReviewableReason> pair = this.isReviewableTo(peerRequest, student, project); //Checks basics reviewable rules
|
Pair<Boolean, NotReviewableReason> pair = this.isReviewableTo(peerRequest, student,
|
||||||
|
project); // Checks basics reviewable rules
|
||||||
NotReviewableReason notReviewableReason = pair.tail;
|
NotReviewableReason notReviewableReason = pair.tail;
|
||||||
boolean isReviewable = pair.head;
|
boolean isReviewable = pair.head;
|
||||||
if( isReviewable ){ //If it's reviewable at all do following:
|
if (isReviewable) { // If it's reviewable at all do following:
|
||||||
/*
|
/*
|
||||||
* Reviews come sorted, oldest first. If it's older than priorityDate, flag that we've found
|
* Reviews come sorted, oldest first. If it's older than
|
||||||
* one that's "expired".
|
* priorityDate, flag that we've found one that's "expired".
|
||||||
*/
|
*/
|
||||||
boolean reviewOlderThanPriorityDate = priorityDate.compareTo( peerRequest.getDateCreated() ) > 0;
|
boolean reviewOlderThanPriorityDate = priorityDate.compareTo(peerRequest
|
||||||
if( reviewOlderThanPriorityDate ) {
|
.getDateCreated()) > 0;
|
||||||
|
if (reviewOlderThanPriorityDate) {
|
||||||
foundExpiredPriorityDate = true;
|
foundExpiredPriorityDate = true;
|
||||||
}
|
}
|
||||||
if( foundExpiredPriorityDate ){
|
if (foundExpiredPriorityDate) {
|
||||||
/*
|
/*
|
||||||
* If we've found something expired, make only those also older than expiration-date
|
* If we've found something expired, make only those also
|
||||||
* reviewable.
|
* older than expiration-date reviewable.
|
||||||
*/
|
*/
|
||||||
isReviewable = reviewOlderThanPriorityDate;
|
isReviewable = reviewOlderThanPriorityDate;
|
||||||
notReviewableReason = NotReviewableReason.OTHERS_PAST_PRIORITY_AGE;
|
notReviewableReason = NotReviewableReason.OTHERS_PAST_PRIORITY_AGE;
|
||||||
}
|
}
|
||||||
if( (given - received > 0) ) {
|
if ((given - received > 0)) {
|
||||||
/*
|
/*
|
||||||
* ..except those with good ratio, they are reviewable any time
|
* ..except those with good ratio, they are reviewable any
|
||||||
|
* time
|
||||||
*/
|
*/
|
||||||
isReviewable = true;
|
isReviewable = true;
|
||||||
notReviewableReason = null;
|
notReviewableReason = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.add(new Tuple(peerRequest, isReviewable , given, received, notReviewableReason));
|
result.add(new Tuple(peerRequest, isReviewable, given, received, notReviewableReason));
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(result, new Comparator<Tuple>() {
|
Collections.sort(result, new Comparator<Tuple>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Tuple t1, Tuple t2) {
|
public int compare(Tuple t1, Tuple t2) {
|
||||||
if( t1.isReviewable == t2.isReviewable ) //If equal, present oldest first
|
if (t1.isReviewable == t2.isReviewable) // If equal, present
|
||||||
return t1.peerRequest.getDateCreated().compareTo( t2.peerRequest.getDateCreated() );
|
// oldest first
|
||||||
if( t1.isReviewable ) //If unequal, present those that are reviewable first
|
return t1.peerRequest.getDateCreated().compareTo(
|
||||||
|
t2.peerRequest.getDateCreated());
|
||||||
|
if (t1.isReviewable) // If unequal, present those that are
|
||||||
|
// reviewable first
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for "basic reviewability". Does not take into account the more complex rule that looks at all other available requests
|
* Checks for "basic reviewability". Does not take into account the more
|
||||||
|
* complex rule that looks at all other available requests
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Pair<Boolean,NotReviewableReason> isReviewableTo(final PeerRequest peerRequest, final Student student, final Project activeProject){
|
public Pair<Boolean, NotReviewableReason> isReviewableTo(final PeerRequest peerRequest,
|
||||||
if( student == null || activeProject == null || peerRequest == null )
|
final Student student, final Project activeProject) {
|
||||||
return new Pair<Boolean,NotReviewableReason>(false,NotReviewableReason.YOU_ARE_SUPERVISOR);
|
if (student == null || activeProject == null || peerRequest == null)
|
||||||
|
return new Pair<Boolean, NotReviewableReason>(false,
|
||||||
|
NotReviewableReason.YOU_ARE_SUPERVISOR);
|
||||||
|
|
||||||
final Project requestingProject = peerRequest.getProject();
|
final Project requestingProject = peerRequest.getProject();
|
||||||
final ProjectClass requestingProjectClass = requestingProject.getProjectClass();
|
final ProjectClass requestingProjectClass = requestingProject.getProjectClass();
|
||||||
final ProjectClass reviewingProjectClass = activeProject.getProjectClass();
|
final ProjectClass reviewingProjectClass = activeProject.getProjectClass();
|
||||||
/*
|
/*
|
||||||
* You may not review something in a different ProjectClass, current page design prevents this from
|
* You may not review something in a different ProjectClass, current
|
||||||
* happening but it's a cheap safeguard.
|
* page design prevents this from happening but it's a cheap safeguard.
|
||||||
*/
|
*/
|
||||||
if( !requestingProjectClass.equals(reviewingProjectClass) )
|
if (!requestingProjectClass.equals(reviewingProjectClass))
|
||||||
return new Pair<Boolean,NotReviewableReason>(false,NotReviewableReason.DIFFERENT_PROJECTCLASS);
|
return new Pair<Boolean, NotReviewableReason>(false,
|
||||||
//You may not review something you're part of!
|
NotReviewableReason.DIFFERENT_PROJECTCLASS);
|
||||||
if( projectDao.isPartOf(student.getUser(), requestingProject ) )
|
// You may not review something you're part of!
|
||||||
return new Pair<Boolean,NotReviewableReason>(false,NotReviewableReason.PART_OF_PROJECT);
|
if (projectDao.isPartOf(student.getUser(), requestingProject))
|
||||||
|
return new Pair<Boolean, NotReviewableReason>(false,
|
||||||
|
NotReviewableReason.PART_OF_PROJECT);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This last section handles reviews performed previously by the student on the same
|
* This last section handles reviews performed previously by the student
|
||||||
* requesting project and makes sure you cannot accept reviews within a certain time frame
|
* on the same requesting project and makes sure you cannot accept
|
||||||
* after having done one.
|
* reviews within a certain time frame after having done one.
|
||||||
*
|
*
|
||||||
* Using getLastModified is potentially "risky" since this might get updated for reasons other
|
* Using getLastModified is potentially "risky" since this might get
|
||||||
* than one's that should prohibit re-reviewing, thus preventing reviews that should be allowed.
|
* updated for reasons other than one's that should prohibit
|
||||||
|
* re-reviewing, thus preventing reviews that should be allowed.
|
||||||
*/
|
*/
|
||||||
ProjectClassSettings settings = requestingProjectClass.getProjectClassSettings();
|
ProjectClassSettings settings = requestingProjectClass.getProjectClassSettings();
|
||||||
int daysBetweenReviewsOnSameProject = settings.getNumDaysBetweenPeerReviewsOnSameProject();
|
int daysBetweenReviewsOnSameProject = settings.getNumDaysBetweenPeerReviewsOnSameProject();
|
||||||
|
|
||||||
DateTime earliestPermissibleDateSinceReview = new DateTime();
|
DateTime earliestPermissibleDateSinceReview = new DateTime();
|
||||||
earliestPermissibleDateSinceReview = earliestPermissibleDateSinceReview.minusDays(daysBetweenReviewsOnSameProject);
|
earliestPermissibleDateSinceReview = earliestPermissibleDateSinceReview
|
||||||
|
.minusDays(daysBetweenReviewsOnSameProject);
|
||||||
List<PeerReview> performedReviews = peerReviewDao.findPeerReviewsByStudentAndProject(student, activeProject);
|
|
||||||
for(PeerReview pr : performedReviews){
|
List<PeerReview> performedReviews = peerReviewDao.findPeerReviewsByStudentAndProject(
|
||||||
|
student, activeProject);
|
||||||
|
for (PeerReview pr : performedReviews) {
|
||||||
boolean sameProject = pr.getPeerRequest().getProject().equals(requestingProject);
|
boolean sameProject = pr.getPeerRequest().getProject().equals(requestingProject);
|
||||||
if( sameProject ){
|
if (sameProject) {
|
||||||
boolean reviewPerformedBeforeLimit = pr.getLastModified().compareTo( earliestPermissibleDateSinceReview.toDate() ) > 0;
|
boolean reviewPerformedBeforeLimit = pr.getLastModified().compareTo(
|
||||||
if( reviewPerformedBeforeLimit ){
|
earliestPermissibleDateSinceReview.toDate()) > 0;
|
||||||
return new Pair<Boolean,NotReviewableReason>(false,NotReviewableReason.RECENTLY_REVIEWED);
|
if (reviewPerformedBeforeLimit) {
|
||||||
|
return new Pair<Boolean, NotReviewableReason>(false,
|
||||||
|
NotReviewableReason.RECENTLY_REVIEWED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Pair<Boolean,NotReviewableReason>(true,null);
|
return new Pair<Boolean, NotReviewableReason>(true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public PeerReview acceptReview(PeerRequest request, Student student, Project project) throws Exception, UpdatedSincePageLoadException {
|
public PeerReview acceptReview(PeerRequest request, Student student, Project project)
|
||||||
|
throws Exception, UpdatedSincePageLoadException {
|
||||||
|
|
||||||
request = peerRequestDao.reLoad(request);
|
request = peerRequestDao.reLoad(request);
|
||||||
|
|
||||||
if(request.getStatus() != RequestStatus.WAITING){
|
if (request.getStatus() != RequestStatus.WAITING) {
|
||||||
throw new UpdatedSincePageLoadException("Peer request taken since page loaded");
|
throw new UpdatedSincePageLoadException("Peer request taken since page loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerReview review = new PeerReview();
|
PeerReview review = new PeerReview();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Save the review
|
// Save the review
|
||||||
review.setPeerRequest(request);
|
review.setPeerRequest(request);
|
||||||
review.setProject(project);
|
review.setProject(project);
|
||||||
review.setReviewer(student);
|
review.setReviewer(student);
|
||||||
review = peerReviewDao.save(review);
|
review = peerReviewDao.save(review);
|
||||||
|
|
||||||
//Update request status
|
// Update request status
|
||||||
request.setStatus(RequestStatus.TAKEN);
|
request.setStatus(RequestStatus.TAKEN);
|
||||||
request = peerRequestDao.save(request);
|
request = peerRequestDao.save(request);
|
||||||
|
|
||||||
//Notify the requester
|
// Notify the requester
|
||||||
notifyAcceptOfReview(request, student, project);
|
notifyAcceptOfReview(request, student, project);
|
||||||
|
|
||||||
return review;
|
return review;
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
Logger.getRootLogger().log(Level.ERROR, "Error while accepting peer request: " + e.getMessage());
|
Logger.getRootLogger().log(Level.ERROR,
|
||||||
if(review.getId() != null){
|
"Error while accepting peer request: " + e.getMessage());
|
||||||
//Something must have gone wrong while updating request status
|
if (review.getId() != null) {
|
||||||
|
// Something must have gone wrong while updating request status
|
||||||
review = peerReviewDao.reLoad(review);
|
review = peerReviewDao.reLoad(review);
|
||||||
peerReviewDao.delete(review);
|
peerReviewDao.delete(review);
|
||||||
}
|
}
|
||||||
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);
|
peerRequestDao.save(request);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Rewrite using template engine of some sort
|
* TODO Rewrite using template engine of some sort
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param student
|
* @param student
|
||||||
* @param project
|
* @param project
|
||||||
*/
|
*/
|
||||||
protected void notifyAcceptOfReview(PeerRequest request, Student student, Project project){
|
protected void notifyAcceptOfReview(PeerRequest request, Student student, Project project) {
|
||||||
try{
|
try {
|
||||||
|
Properties props = null;
|
||||||
|
|
||||||
|
props = PropsUtils.load("notification.properties");
|
||||||
|
|
||||||
|
String mailSubject = props.getProperty("acceptPeerReviewSubject");
|
||||||
|
String requestAccepted = props.getProperty("requestAccepted");
|
||||||
|
String heShe = props.getProperty("heShe");
|
||||||
|
String complete = props.getProperty("complete");
|
||||||
|
|
||||||
User requestingUser = request.getRequester().getUser();
|
User requestingUser = request.getRequester().getUser();
|
||||||
|
|
||||||
|
String messageBody = requestAccepted
|
||||||
|
+ student.getUser().toString()
|
||||||
|
+ heShe
|
||||||
|
+ project.getProjectClass().getProjectClassSettings()
|
||||||
|
.getNumDaysToSubmitPeerReview() + complete;
|
||||||
|
|
||||||
String subject = "Your request for peer-review has been accepted";
|
String webNotificationMessage = requestAccepted + student.getUser().toString();
|
||||||
|
|
||||||
String messageBody = "Hello "+requestingUser.getFirstName()+",\n\n"+
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
"Your request was accepted by "+student.getUser().toString()+", he/she now has "+
|
mailSubject, messageBody);
|
||||||
project.getProjectClass().getProjectClassSettings().getNumDaysToSubmitPeerReview()+" days to complete a review."+
|
|
||||||
"\n\nThis is an auto-generated message from SciPro";
|
PageParameters pp = new PageParameters();
|
||||||
|
|
||||||
notificationController.processSystemNotification(requestingUser, Roles.STUDENT, subject, messageBody, NotificationEventType.PEER_REVIEW_ACCEPTED);
|
String peerStatsUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
}
|
.urlFor(ProjectPeerStatsPage.class, pp).toString());
|
||||||
catch( Exception e ){
|
|
||||||
|
notificationController.processNotification(requestingUser, notificationMessage,
|
||||||
|
peerStatsUrl, NotificationPriority.MEDIUM);
|
||||||
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Rewrite
|
* TODO Rewrite
|
||||||
|
*
|
||||||
* @param review
|
* @param review
|
||||||
*/
|
*/
|
||||||
public void notifyCompletionOfReview(PeerReview review) {
|
public void notifyCompletionOfReview(PeerReview review) {
|
||||||
try{
|
try {
|
||||||
|
|
||||||
|
Properties props = null;
|
||||||
|
props = PropsUtils.load("notification.properties");
|
||||||
|
String mailSubject = props.getProperty("completedReviewSubject");
|
||||||
|
String requestReviewed = props.getProperty("requestReviewed");
|
||||||
|
String supervisorMessageBody = props.getProperty("supervisorMessageBody");
|
||||||
|
String supervisorMessageBody2 = props.getProperty("supervisorMessageBody2");
|
||||||
|
String supervisorMessageBody3 = props.getProperty("supervisorMessageBody3");
|
||||||
|
String commaWithLinebreak = props.getProperty("commaWithLinebreak");
|
||||||
|
String inProject = props.getProperty("inProject");
|
||||||
|
String hasPerformed = props.getProperty("hasPerformed");
|
||||||
PeerRequest peerRequest = review.getPeerRequest();
|
PeerRequest peerRequest = review.getPeerRequest();
|
||||||
User requestingUser = peerRequest.getRequester().getUser();
|
User requestingUser = peerRequest.getRequester().getUser();
|
||||||
|
|
||||||
String messageFooter = "\n\nThis is an auto-generated message from SciPro";
|
|
||||||
|
|
||||||
PageParameters pp = new PageParameters();
|
PageParameters pp = new PageParameters();
|
||||||
pp.add(PeerReview.PP_PEER_REVIEW_ID, review.getId().toString());
|
pp.add(PeerReview.PP_PEER_REVIEW_ID, review.getId().toString());
|
||||||
String projectReviewUrl = RequestUtils.toAbsolutePath(
|
|
||||||
RequestCycle.get().urlFor(ProjectPeerReviewPage.class, pp).toString());
|
String reviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
String supervisorReviewUrl = RequestUtils.toAbsolutePath(
|
.urlFor(ProjectPeerReviewPage.class, pp).toString());
|
||||||
RequestCycle.get().urlFor(SupervisorPeerReviewPage.class, pp).toString());
|
String supervisorReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
|
.urlFor(SupervisorPeerReviewPage.class, pp).toString());
|
||||||
|
|
||||||
|
//Message for student when his/her review request is completed.
|
||||||
|
String messageBody = requestReviewed;
|
||||||
|
|
||||||
|
NotificationMessage notificationMessage = new NotificationMessage(messageBody,
|
||||||
|
mailSubject, messageBody);
|
||||||
|
|
||||||
|
notificationController.processNotification(requestingUser, notificationMessage,
|
||||||
|
reviewUrl, NotificationPriority.MEDIUM);
|
||||||
|
|
||||||
|
//Message for supervisor of the project with a completed review.
|
||||||
String subject = "A peer review has been completed!";
|
messageBody =
|
||||||
|
supervisorMessageBody
|
||||||
String messageBody = "Hello "+requestingUser.getFirstName()+",\n\n"+
|
+ peerRequest.getProject().getTitle()
|
||||||
"Your request has now been reviewed and is available here:\n"+
|
+ supervisorMessageBody2;
|
||||||
projectReviewUrl+
|
|
||||||
messageFooter;
|
|
||||||
|
|
||||||
notificationController.processSystemNotification(requestingUser, Roles.STUDENT, subject, messageBody, NotificationEventType.PEER_REVIEW_RATED);
|
|
||||||
|
|
||||||
messageBody = "Hello "+peerRequest.getProject().getHeadSupervisor().getUser().getFirstName()+",\n\n"+
|
|
||||||
"You're getting this message because you are supervisor of \""+peerRequest.getProject().getTitle()+"\"."+
|
|
||||||
"\nA peer review on this project has been completed and is available for you to read here:\n"+
|
|
||||||
supervisorReviewUrl+
|
|
||||||
messageFooter;
|
|
||||||
User requestSupervisor = peerRequest.getProject().getHeadSupervisor().getUser();
|
User requestSupervisor = peerRequest.getProject().getHeadSupervisor().getUser();
|
||||||
notificationController.processSystemNotification(requestSupervisor, Roles.EMPLOYEE, subject, messageBody, NotificationEventType.PEER_REVIEW_RATED);
|
|
||||||
|
NotificationMessage notificationMessageSupervisorOfProject = new NotificationMessage(messageBody,
|
||||||
|
mailSubject, messageBody);
|
||||||
|
|
||||||
messageBody = "Hello "+review.getProject().getHeadSupervisor().getUser().getFirstName()+",\n\n"+
|
notificationController.processNotification(requestSupervisor,
|
||||||
"You receive this message because you are supervisor of \""+review.getProject().getTitle()+"\".\n"+
|
notificationMessageSupervisorOfProject, supervisorReviewUrl, NotificationPriority.MEDIUM);
|
||||||
review.getReviewer().getUser().toString()+" has performed a peer review on someone elses work which is available for you to read here:\n"+
|
|
||||||
supervisorReviewUrl+
|
//Message for supervisor of the reviewer that have made a review for another project.
|
||||||
messageFooter;
|
|
||||||
|
String webNotificationMessage = review.getReviewer().getUser().toString() + inProject + review.getProject().getTitle() + hasPerformed;
|
||||||
|
|
||||||
|
messageBody = supervisorMessageBody
|
||||||
|
+ review.getProject().getTitle()
|
||||||
|
+ commaWithLinebreak + review.getReviewer().getUser().toString()
|
||||||
|
+ supervisorMessageBody3;
|
||||||
|
|
||||||
User reviewSupervisor = review.getProject().getHeadSupervisor().getUser();
|
User reviewSupervisor = review.getProject().getHeadSupervisor().getUser();
|
||||||
notificationController.processSystemNotification(reviewSupervisor, Roles.EMPLOYEE, subject, messageBody, NotificationEventType.PEER_REVIEW_RATED);
|
NotificationMessage notificationMessageSupervisorOfReviewer = new NotificationMessage(webNotificationMessage,
|
||||||
|
mailSubject, messageBody);
|
||||||
|
|
||||||
}
|
notificationController.processNotification(reviewSupervisor, notificationMessageSupervisorOfReviewer, supervisorReviewUrl, NotificationPriority.MEDIUM);
|
||||||
catch( Exception e ){
|
|
||||||
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Rewrite
|
* TODO Rewrite
|
||||||
|
*
|
||||||
* @param review
|
* @param review
|
||||||
*/
|
*/
|
||||||
public void notifyOfReviewRating(PeerReview review) {
|
public void notifyOfReviewRating(PeerReview review) {
|
||||||
try{
|
try {
|
||||||
|
Properties props = null;
|
||||||
|
props = PropsUtils.load("notification.properties");
|
||||||
|
String mailSubject = props.getProperty("reviewRatedSubject");
|
||||||
|
String reviewRatedBody = props.getProperty("reviewRatedBody");
|
||||||
User reviewingUser = review.getReviewer().getUser();
|
User reviewingUser = review.getReviewer().getUser();
|
||||||
|
|
||||||
String messageFooter = "\n\nThis is an auto-generated message from SciPro";
|
|
||||||
|
|
||||||
PageParameters pp = new PageParameters();
|
PageParameters pp = new PageParameters();
|
||||||
pp.add(PeerReview.PP_PEER_REVIEW_ID, review.getId().toString());
|
pp.add(PeerReview.PP_PEER_REVIEW_ID, review.getId().toString());
|
||||||
String projectReviewUrl = RequestUtils.toAbsolutePath(
|
String projectReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
RequestCycle.get().urlFor(ProjectPeerReviewPage.class, pp).toString());
|
.urlFor(ProjectPeerReviewPage.class, pp).toString());
|
||||||
|
|
||||||
|
|
||||||
|
String messageBody = reviewRatedBody;
|
||||||
|
|
||||||
String subject = "You've received a rating for a review you've done!";
|
NotificationMessage notificationMessage = new NotificationMessage(messageBody,
|
||||||
|
mailSubject, messageBody);
|
||||||
String messageBody = "Hello "+reviewingUser.getFirstName()+",\n\n"+
|
|
||||||
"Your review has been rated." +
|
notificationController.processNotification(reviewingUser, notificationMessage,
|
||||||
" If you want to see the rating or add a comment to the review, the review is available here:\n"+
|
projectReviewUrl, NotificationPriority.MEDIUM);
|
||||||
projectReviewUrl+
|
|
||||||
messageFooter;
|
} catch (Exception e) {
|
||||||
|
|
||||||
notificationController.processSystemNotification(reviewingUser, Roles.STUDENT, subject, messageBody, NotificationEventType.PEER_REVIEW_GRADED);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch( Exception e ){
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store file to a pre-populated PeerRequest
|
* Store file to a pre-populated PeerRequest
|
||||||
*
|
*
|
||||||
@ -346,92 +422,100 @@ public class PeerPortalControllerImpl implements PeerPortalController {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public PeerRequest storePeerRequest(final FileUpload upload, PeerRequest request)
|
public PeerRequest storePeerRequest(final FileUpload upload, PeerRequest request)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
String path = null;
|
String path = null;
|
||||||
try {
|
try {
|
||||||
request = peerRequestDao.save(request);
|
request = peerRequestDao.save(request);
|
||||||
|
|
||||||
if(request.getId() == null){
|
if (request.getId() == null) {
|
||||||
throw new NullPointerException("Peer request id is null after save");
|
throw new NullPointerException("Peer request id is null after save");
|
||||||
}
|
}
|
||||||
|
|
||||||
path = getAbsolutePeerRequestPath(request);
|
path = getAbsolutePeerRequestPath(request);
|
||||||
|
|
||||||
fileRepository.storeFile(upload, path);
|
fileRepository.storeFile(upload, path);
|
||||||
List<FileDescription> fdesc = fileRepository.searchFiles(path);
|
List<FileDescription> fdesc = fileRepository.searchFiles(path);
|
||||||
if(fdesc.size() == 0){
|
if (fdesc.size() == 0) {
|
||||||
throw new FileStorageException(path, null);
|
throw new FileStorageException(path, null);
|
||||||
} else {
|
} else {
|
||||||
FileDescription fd = fileDescriptionDao.save(fdesc.get(0));
|
FileDescription fd = fileDescriptionDao.save(fdesc.get(0));
|
||||||
request.setFile(fd);
|
request.setFile(fd);
|
||||||
return peerRequestDao.save(request);
|
return peerRequestDao.save(request);
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
Logger.getRootLogger().log(Level.ERROR, "Error while storing Peer Request: " + e.getMessage());
|
Logger.getRootLogger().log(Level.ERROR,
|
||||||
if(request.getId() != null){
|
"Error while storing Peer Request: " + e.getMessage());
|
||||||
|
if (request.getId() != null) {
|
||||||
peerRequestDao.delete(request);
|
peerRequestDao.delete(request);
|
||||||
}
|
}
|
||||||
if(path != null){
|
if (path != null) {
|
||||||
fileRepository.delete(path);
|
fileRepository.delete(path);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a file to the repository and populates the file-attribute on the PeerReview object.
|
* Stores a file to the repository and populates the file-attribute on the
|
||||||
* Note: the file description is not persisted, saving the peer review object will cascade
|
* PeerReview object. Note: the file description is not persisted, saving
|
||||||
* to the file description.
|
* the peer review object will cascade to the file description.
|
||||||
*
|
*
|
||||||
* @param upload the fileupload to store
|
* @param upload
|
||||||
* @param review the review to store the fileupload to
|
* the fileupload to store
|
||||||
|
* @param review
|
||||||
|
* the review to store the fileupload to
|
||||||
* @return true on success, false otherwise
|
* @return true on success, false otherwise
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean storePeerReviewFileUpload(final FileUpload upload, PeerReview review) {
|
public boolean storePeerReviewFileUpload(final FileUpload upload, PeerReview review) {
|
||||||
|
|
||||||
//Return true there is no file upload
|
// Return true there is no file upload
|
||||||
if ( upload == null ){
|
if (upload == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String path = null;
|
String path = null;
|
||||||
try {
|
try {
|
||||||
path = getAbsolutePeerReviewPath(review);
|
path = getAbsolutePeerReviewPath(review);
|
||||||
fileRepository.storeFile(upload, path);
|
fileRepository.storeFile(upload, path);
|
||||||
List<FileDescription> fdesc = fileRepository.searchFiles(path);
|
List<FileDescription> fdesc = fileRepository.searchFiles(path);
|
||||||
if(fdesc.size() == 0){
|
if (fdesc.size() == 0) {
|
||||||
throw new FileStorageException(path, null);
|
throw new FileStorageException(path, null);
|
||||||
}
|
}
|
||||||
review.setFile(fdesc.get(0));
|
review.setFile(fdesc.get(0));
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.getRootLogger().log(Level.ERROR, "Error while storing file for peer review: " + e.getMessage());
|
Logger.getRootLogger().log(Level.ERROR,
|
||||||
if(review.getFile() != null){
|
"Error while storing file for peer review: " + e.getMessage());
|
||||||
//Clean up the repository
|
if (review.getFile() != null) {
|
||||||
|
// Clean up the repository
|
||||||
fileRepository.delete(path);
|
fileRepository.delete(path);
|
||||||
//reset the file attribute
|
// reset the file attribute
|
||||||
review.setFile(null);
|
review.setFile(null);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
private String getAbsolutePeerRequestPath(final PeerRequest request){
|
private String getAbsolutePeerRequestPath(final PeerRequest request) {
|
||||||
if(request.getId() == null){
|
if (request.getId() == null) {
|
||||||
throw new NullPointerException("Trying to get file repository path for PeerRequest with id null");
|
throw new NullPointerException(
|
||||||
|
"Trying to get file repository path for PeerRequest with id null");
|
||||||
}
|
}
|
||||||
return fileRepository.getProjectRootPath(request.getProject().getId()) + PEER_REQUEST_PATH + request.getId();
|
return fileRepository.getProjectRootPath(request.getProject().getId()) + PEER_REQUEST_PATH
|
||||||
|
+ request.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
private String getAbsolutePeerReviewPath(final PeerReview review){
|
private String getAbsolutePeerReviewPath(final PeerReview review) {
|
||||||
if(review.getId() == null){
|
if (review.getId() == null) {
|
||||||
throw new NullPointerException("Trying to get file repository path for PeerReview with id null");
|
throw new NullPointerException(
|
||||||
|
"Trying to get file repository path for PeerReview with id null");
|
||||||
}
|
}
|
||||||
return fileRepository.getProjectRootPath(review.getProject().getId()) + PEER_REVIEW_PATH + review.getId();
|
return fileRepository.getProjectRootPath(review.getProject().getId()) + PEER_REVIEW_PATH
|
||||||
|
+ review.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,6 @@ public class ProjectPartnerPage extends ProjectPage {
|
|||||||
wmc.add(dataView);
|
wmc.add(dataView);
|
||||||
wmc.setOutputMarkupId(true);
|
wmc.setOutputMarkupId(true);
|
||||||
pagingNavigator = new PagingNavigator("navigator", dataView);
|
pagingNavigator = new PagingNavigator("navigator", dataView);
|
||||||
System.out.println(dataView.size());
|
|
||||||
wmc.add(pagingNavigator);
|
wmc.add(pagingNavigator);
|
||||||
add(wmc);
|
add(wmc);
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
<div class="span-22 last">
|
<div class="span-22 last">
|
||||||
<!-- Left column -->
|
<!-- Left column -->
|
||||||
<div class="span-11 colborder" wicket:id="leftColumn">
|
<div class="span-11 colborder" wicket:id="leftColumn">
|
||||||
|
<div class="append-bottom">
|
||||||
|
<h5 class="peer-title">Notifications</h5>
|
||||||
|
<div wicket:id="notificationPanel"></div>
|
||||||
|
</div>
|
||||||
<div class="append-bottom">
|
<div class="append-bottom">
|
||||||
<h5 class="peer-title">State of mind</h5>
|
<h5 class="peer-title">State of mind</h5>
|
||||||
<div wicket:id="stateOfMindPanel"></div>
|
<div wicket:id="stateOfMindPanel"></div>
|
||||||
@ -23,9 +27,8 @@
|
|||||||
<h5 class="peer-title">Peer reviews on project</h5>
|
<h5 class="peer-title">Peer reviews on project</h5>
|
||||||
<div wicket:id="peerRequests"></div>
|
<div wicket:id="peerRequests"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="append-bottom">
|
<div class="span-10 last">
|
||||||
<h5 class="peer-title">Wall</h5>
|
<div wicket:id="upcomingEventPanel"></div>
|
||||||
<div wicket:id="projectWallPanel"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Right column -->
|
<!-- Right column -->
|
||||||
@ -34,9 +37,6 @@
|
|||||||
<h5 class="peer-title">Final seminar for this project</h5>
|
<h5 class="peer-title">Final seminar for this project</h5>
|
||||||
<div wicket:id="projectSeminarPanel"></div>
|
<div wicket:id="projectSeminarPanel"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span-10 last">
|
|
||||||
<div wicket:id="upcomingEventPanel"></div>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="span-10 last">-->
|
<!-- <div class="span-10 last">-->
|
||||||
<!-- <h5 class="peer-title">Oppositions & Active participations</h5>-->
|
<!-- <h5 class="peer-title">Oppositions & Active participations</h5>-->
|
||||||
<!-- <div wicket:id="oppositionStatsPanel"></div>-->
|
<!-- <div wicket:id="oppositionStatsPanel"></div>-->
|
||||||
|
@ -10,7 +10,7 @@ import se.su.dsv.scipro.data.dataobjects.Project;
|
|||||||
import se.su.dsv.scipro.opponent.panels.ProjectFinalSeminarContainerPanel;
|
import se.su.dsv.scipro.opponent.panels.ProjectFinalSeminarContainerPanel;
|
||||||
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
||||||
import se.su.dsv.scipro.peer.panels.StudentPeerInfoRequestsPanel;
|
import se.su.dsv.scipro.peer.panels.StudentPeerInfoRequestsPanel;
|
||||||
import se.su.dsv.scipro.project.panels.ProjectWallPanel;
|
import se.su.dsv.scipro.project.panels.NotificationsPanel;
|
||||||
import se.su.dsv.scipro.project.panels.StateOfMindPanel;
|
import se.su.dsv.scipro.project.panels.StateOfMindPanel;
|
||||||
import se.su.dsv.scipro.project.panels.UpcomingEventPanel;
|
import se.su.dsv.scipro.project.panels.UpcomingEventPanel;
|
||||||
import se.su.dsv.scipro.schedule.panels.ProjectProgressPanel;
|
import se.su.dsv.scipro.schedule.panels.ProjectProgressPanel;
|
||||||
@ -35,7 +35,7 @@ public class ProjectStartPage extends ProjectPage {
|
|||||||
add(new FeedbackPanel("feedback"));
|
add(new FeedbackPanel("feedback"));
|
||||||
add(new ProjectFinalSeminarContainerPanel("projectSeminarPanel", activeProject));
|
add(new ProjectFinalSeminarContainerPanel("projectSeminarPanel", activeProject));
|
||||||
//add(new StudentOppositionStatsPanel("oppositionStatsPanel", activeProject));
|
//add(new StudentOppositionStatsPanel("oppositionStatsPanel", activeProject));
|
||||||
add(new UpcomingEventPanel("upcomingEventPanel", activeProject, 3));
|
leftColumn.add(new UpcomingEventPanel("upcomingEventPanel", activeProject, 3));
|
||||||
leftColumn.add(new StudentPeerInfoRequestsPanel("peerRequests", null, activeProject){
|
leftColumn.add(new StudentPeerInfoRequestsPanel("peerRequests", null, activeProject){
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -47,9 +47,10 @@ public class ProjectStartPage extends ProjectPage {
|
|||||||
ProjectProgressPanel progressPanel = new ProjectProgressPanel("progress", activeProject);
|
ProjectProgressPanel progressPanel = new ProjectProgressPanel("progress", activeProject);
|
||||||
leftColumn.add(progressPanel.getHelpIcon("progressHelp"));
|
leftColumn.add(progressPanel.getHelpIcon("progressHelp"));
|
||||||
leftColumn.add(progressPanel);
|
leftColumn.add(progressPanel);
|
||||||
//leftColumn.add(new UpcomingEventPanel("upcomingEventPanel", activeProject));
|
|
||||||
leftColumn.add(new ProjectWallPanel("projectWallPanel", activeProject));
|
|
||||||
|
leftColumn.add(new NotificationsPanel("notificationPanel"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html
|
||||||
|
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||||
|
<body>
|
||||||
|
<wicket:panel>
|
||||||
|
<div wicket:id="container">
|
||||||
|
<div class="margin">
|
||||||
|
<h3><span wicket:id="newNotifications"></span> new notifications</h3>
|
||||||
|
<a href="#" wicket:id="readAllNotification">Set all read</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div wicket:id="notificationsListView" class="rounded-border-notification">
|
||||||
|
<div wicket:id="infoText"></div>
|
||||||
|
<a href="#" wicket:id="readNotification">Set read</a>
|
||||||
|
<a href="#" wicket:id="bookmarkLink">Go to</a>
|
||||||
|
</div>
|
||||||
|
<div wicket:id="paging"></div>
|
||||||
|
</div>
|
||||||
|
</wicket:panel>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,143 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package se.su.dsv.scipro.project.panels;
|
||||||
|
|
||||||
|
import org.apache.wicket.RequestCycle;
|
||||||
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
|
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||||
|
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||||
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
|
import org.apache.wicket.markup.html.link.Link;
|
||||||
|
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.model.IModel;
|
||||||
|
import org.apache.wicket.model.LoadableDetachableModel;
|
||||||
|
import org.apache.wicket.request.target.basic.RedirectRequestTarget;
|
||||||
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.SciProSession;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.WebNotificationDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
||||||
|
import se.su.dsv.scipro.dataproviders.WebNotificationDataProvider;
|
||||||
|
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 })
|
||||||
|
public class NotificationsPanel extends Panel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@SpringBean
|
||||||
|
private WebNotificationDao webNotificationDao;
|
||||||
|
|
||||||
|
private int countOfNotifications = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public NotificationsPanel(String id) {
|
||||||
|
super(id);
|
||||||
|
|
||||||
|
final IModel<Integer> numberOfNotificationsModel = new LoadableDetachableModel<Integer>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Integer load() {
|
||||||
|
return webNotificationDao.getCountOfWebNotifications(SciProSession.get().getUser());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
countOfNotifications = numberOfNotificationsModel.getObject();
|
||||||
|
|
||||||
|
Label newNotifications = new Label("newNotifications", numberOfNotificationsModel);
|
||||||
|
|
||||||
|
final WebMarkupContainer webMarkupContainer = new WebMarkupContainer("container");
|
||||||
|
webMarkupContainer.setOutputMarkupId(true);
|
||||||
|
add(webMarkupContainer);
|
||||||
|
webMarkupContainer.add(newNotifications);
|
||||||
|
|
||||||
|
WebNotificationDataProvider webNotificationDataProvider = new WebNotificationDataProvider(
|
||||||
|
SciProSession.get().getUser());
|
||||||
|
DataView<WebNotification> notifications = new DataView<WebNotification>(
|
||||||
|
"notificationsListView", webNotificationDataProvider, 5) {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void populateItem(final Item<WebNotification> item) {
|
||||||
|
item.add(new Label("infoText", item.getModel().getObject().getInfoText()));
|
||||||
|
item.add(new Link<Void>("bookmarkLink") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick() {
|
||||||
|
|
||||||
|
WebNotification notification = item.getModelObject();
|
||||||
|
notification.setReadByUser(true);
|
||||||
|
notification = webNotificationDao.save(notification);
|
||||||
|
|
||||||
|
RequestCycle.get().setRequestTarget(
|
||||||
|
new RedirectRequestTarget(notification.getUrl()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
item.add(new AjaxLink<Void>("readNotification") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
WebNotification notification = item.getModelObject();
|
||||||
|
notification.setReadByUser(true);
|
||||||
|
webNotificationDao.save(notification);
|
||||||
|
target.addComponent(webMarkupContainer);
|
||||||
|
countOfNotifications = numberOfNotificationsModel.getObject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
webMarkupContainer.add(new AjaxLink<Void>("readAllNotification") {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
for (WebNotification webnotification : webNotificationDao
|
||||||
|
.getWebNotifications(SciProSession.get().getUser())) {
|
||||||
|
webnotification.setReadByUser(true);
|
||||||
|
webNotificationDao.save(webnotification);
|
||||||
|
}
|
||||||
|
target.addComponent(webMarkupContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
return countOfNotifications > 0;
|
||||||
|
};
|
||||||
|
}.setOutputMarkupPlaceholderTag(true));
|
||||||
|
|
||||||
|
PagingNavigator pagingNavigator = new PagingNavigator("paging", notifications){
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
return countOfNotifications > 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
pagingNavigator.setOutputMarkupPlaceholderTag(true);
|
||||||
|
webMarkupContainer.add(pagingNavigator);
|
||||||
|
webMarkupContainer.add(notifications);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,6 +7,7 @@ import org.apache.wicket.Page;
|
|||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
import se.su.dsv.scipro.SciProSession;
|
||||||
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
||||||
|
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.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;
|
||||||
@ -45,6 +46,7 @@ public class ProjectTabMenuPanel extends AbstractMenuPanel {
|
|||||||
itemList.add(new MenuItem("Opposition & Active participation", ProjectOppositionPage.class));
|
itemList.add(new MenuItem("Opposition & Active participation", ProjectOppositionPage.class));
|
||||||
itemList.add(new MenuItem("Peer review", ProjectPeerPortalPage.class));
|
itemList.add(new MenuItem("Peer review", ProjectPeerPortalPage.class));
|
||||||
itemList.add(new MenuItem("All Final Seminars", FinalSeminarProjectListPage.class));
|
itemList.add(new MenuItem("All Final Seminars", FinalSeminarProjectListPage.class));
|
||||||
|
itemList.add(new MenuItem("Conference", ProjectConferencePage.class));
|
||||||
} else {
|
} else {
|
||||||
itemList.add(new MenuItem("No active project!", NoActiveProjectPage.class));
|
itemList.add(new MenuItem("No active project!", NoActiveProjectPage.class));
|
||||||
itemList.add(new MenuItem("Project Partner", ProjectPartnerPage.class));
|
itemList.add(new MenuItem("Project Partner", ProjectPartnerPage.class));
|
||||||
|
@ -1,216 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.project.panels;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
|
||||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
|
||||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
|
||||||
import org.apache.wicket.markup.html.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.IDataProvider;
|
|
||||||
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.commentthread.panels.CommentThreadPanel;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CommentThreadDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.CommentThread;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.dataproviders.BoardMessageDataProvider;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ProjectWallPanel extends Panel {
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private BoardMessageDao boardMessageDao;
|
|
||||||
@SpringBean
|
|
||||||
private MessageBoardDao messageBoardDao;
|
|
||||||
@SpringBean
|
|
||||||
private CommentThreadDao commentThreadDao;
|
|
||||||
|
|
||||||
private MessageBoard messageBoard;
|
|
||||||
private DataView<BoardMessage> dataView;
|
|
||||||
private WebMarkupContainer webMarkupContainer;
|
|
||||||
|
|
||||||
public ProjectWallPanel(String id, Project project) {
|
|
||||||
super(id);
|
|
||||||
SendWallMessageForm sendWallMessageForm;
|
|
||||||
add(sendWallMessageForm = new SendWallMessageForm("sendForm"));
|
|
||||||
if (project != null) {
|
|
||||||
messageBoard = project.getMessageBoard();
|
|
||||||
if (messageBoard == null) {
|
|
||||||
messageBoard = new MessageBoard();
|
|
||||||
messageBoard.setProject(project);
|
|
||||||
messageBoard = messageBoardDao.save(messageBoard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
webMarkupContainer = new WebMarkupContainer("container");
|
|
||||||
|
|
||||||
loadUserDataView(new BoardMessageDataProvider(messageBoard));
|
|
||||||
webMarkupContainer.add(dataView);
|
|
||||||
webMarkupContainer.setOutputMarkupId(true);
|
|
||||||
webMarkupContainer
|
|
||||||
.add(new PagingNavigator("pagingNavigator", dataView));
|
|
||||||
|
|
||||||
add(webMarkupContainer);
|
|
||||||
|
|
||||||
if(project == null){
|
|
||||||
webMarkupContainer.setVisible(false);
|
|
||||||
sendWallMessageForm.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadUserDataView(
|
|
||||||
IDataProvider<BoardMessage> boardMessageDataProvider) {
|
|
||||||
|
|
||||||
dataView = new DataView<BoardMessage>("boardMessageDataView",
|
|
||||||
boardMessageDataProvider, 10) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateItem(Item<BoardMessage> item) {
|
|
||||||
final BoardMessage bm = item.getModelObject();
|
|
||||||
item.add(new Label("messageLabel", bm.getMessage()));
|
|
||||||
item.add(new Label("messageUser", bm.getFromUser()
|
|
||||||
.getFirstName() + " " + bm.getFromUser().getLastName()));
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
||||||
|
|
||||||
item.add(new Label("messageDate", simpleDateFormat.format(bm.getDateCreated())));
|
|
||||||
item.add(new AjaxLink("delete") {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
|
|
||||||
BoardMessage boardMessageTemp = boardMessageDao.reLoad(bm);
|
|
||||||
boardMessageDao.delete(boardMessageTemp);
|
|
||||||
webMarkupContainer.removeAll();
|
|
||||||
loadUserDataView(new BoardMessageDataProvider(
|
|
||||||
messageBoardDao.reLoad(messageBoard)));
|
|
||||||
webMarkupContainer.add(dataView);
|
|
||||||
webMarkupContainer.add(new PagingNavigator(
|
|
||||||
"pagingNavigator", dataView));
|
|
||||||
target.addComponent(webMarkupContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVisible() {
|
|
||||||
SciProSession session = SciProSession.get();
|
|
||||||
if (session.authorizedForRole(Roles.ADMIN))
|
|
||||||
return true;
|
|
||||||
if (session.getUser().equals(bm.getFromUser()))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
int commentSize = commentThreadDao.getCommentThreadSize(bm);
|
|
||||||
String comments = " Comments";
|
|
||||||
if (commentSize == 1) {
|
|
||||||
comments = " Comment";
|
|
||||||
}
|
|
||||||
final Label comment = new Label("commentNumber", commentSize
|
|
||||||
+ comments);
|
|
||||||
|
|
||||||
comment.setOutputMarkupId(true);
|
|
||||||
final WebMarkupContainer webMarkupContainer = new WebMarkupContainer(
|
|
||||||
"commentContainer");
|
|
||||||
webMarkupContainer.setOutputMarkupPlaceholderTag(true);
|
|
||||||
item.add(webMarkupContainer);
|
|
||||||
|
|
||||||
CommentThreadPanel ctp = new CommentThreadPanel(
|
|
||||||
"commentThread", bm, 5);
|
|
||||||
ctp.setOutputMarkupPlaceholderTag(true);
|
|
||||||
webMarkupContainer.add(ctp);
|
|
||||||
|
|
||||||
webMarkupContainer.setVisible(false);
|
|
||||||
|
|
||||||
item.add(new AjaxLink<String>("showComments",
|
|
||||||
new Model<String>("Show Comments")) {
|
|
||||||
|
|
||||||
private boolean clicked = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
clicked = !clicked;
|
|
||||||
if (clicked) {
|
|
||||||
comment.setDefaultModelObject("Hide comments");
|
|
||||||
} else {
|
|
||||||
|
|
||||||
int commentSize = commentThreadDao
|
|
||||||
.getCommentThreadSize(bm);
|
|
||||||
|
|
||||||
String comments = " Comments";
|
|
||||||
if (commentSize == 1) {
|
|
||||||
comments = " Comment";
|
|
||||||
}
|
|
||||||
comment.setDefaultModelObject(commentSize
|
|
||||||
+ comments);
|
|
||||||
}
|
|
||||||
webMarkupContainer.removeAll();
|
|
||||||
webMarkupContainer.add(new CommentThreadPanel(
|
|
||||||
"commentThread", boardMessageDao.reLoad(bm), 5));
|
|
||||||
webMarkupContainer.setVisible(clicked);
|
|
||||||
target.addComponent(webMarkupContainer);
|
|
||||||
target.addComponent(comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
}.add(comment));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SendWallMessageForm extends Form<String> {
|
|
||||||
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
public SendWallMessageForm(String id) {
|
|
||||||
super(id);
|
|
||||||
final TextArea<String> messageTextArea = new TextArea<String>(
|
|
||||||
"textArea", new PropertyModel<String>(this, "message"));
|
|
||||||
add(messageTextArea);
|
|
||||||
AjaxButton button = new AjaxButton("ajaxButton") {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
BoardMessage bm = new BoardMessage();
|
|
||||||
bm.setMessage(message);
|
|
||||||
bm.setMessageBoard(messageBoardDao.reLoad(messageBoard));
|
|
||||||
bm.setFromUser(SciProSession.get().getUser());
|
|
||||||
bm = boardMessageDao.save(bm);
|
|
||||||
webMarkupContainer.removeAll();
|
|
||||||
loadUserDataView(new BoardMessageDataProvider(
|
|
||||||
messageBoardDao.reLoad(messageBoard)));
|
|
||||||
webMarkupContainer.add(dataView);
|
|
||||||
webMarkupContainer.add(new PagingNavigator(
|
|
||||||
"pagingNavigator", dataView));
|
|
||||||
target.addComponent(webMarkupContainer);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
add(button);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,9 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package se.su.dsv.scipro.project.panels;
|
package se.su.dsv.scipro.project.panels;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.apache.wicket.AttributeModifier;
|
import org.apache.wicket.AttributeModifier;
|
||||||
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
|
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
@ -26,15 +23,12 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
|
|||||||
import org.odlabs.wiquery.ui.core.DefaultJsScopeUiEvent;
|
import org.odlabs.wiquery.ui.core.DefaultJsScopeUiEvent;
|
||||||
import org.odlabs.wiquery.ui.slider.Slider;
|
import org.odlabs.wiquery.ui.slider.Slider;
|
||||||
|
|
||||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
import se.su.dsv.scipro.SciProSession;
|
||||||
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.enums.StateOfMind;
|
import se.su.dsv.scipro.data.enums.StateOfMind;
|
||||||
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
||||||
|
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user