Merge branch 'develop' of ssh://git.dsv.su.se/git/scipro/scipro into develop

This commit is contained in:
Fredrik Friis 2011-08-08 17:06:46 +09:00
commit c926a58c02
151 changed files with 2163 additions and 1518 deletions
.gitignore
src/main/java/se/su/dsv/scipro
SciProApplication.propertiesSciProSession.java
admin
basepages
basepanels
checklists/panels
components
conference
data
json
message/models
opponent/panels
peer
project
repository
security/auth
wiquery/mainmenu
workerthreads

3
.gitignore vendored

@ -3,3 +3,6 @@
\.classpath
\target/**/*
\target/*
/.settings
/.classpath
/target

@ -0,0 +1,23 @@
# Properties used by the NotificationControllerImpl.
# Web notifications:
conferencePost.webNotification = ${firstName} ${lastName} posted on conference "{0}".
pm.webNotification = ${firstName} ${lastName} wrote a private message to you.
comment.webNotification = ${firstName} ${lastName} commented on a post on conference "{0}".
finalSeminarEdit.webNotification = Final seminar for project "${project}" has been edited.
finalSeminarCreated.webNotification = Head supervisor for "${project}" has created a final seminar, room ${room}, {0,date,yyyy-MM-dd HH:mm}{1,date,-HH:mm}
finalSeminarCreatedOpponent.webNotification = Head supervisor for "${project}" has created a final seminar and added you as an opponent, room ${room}, {0,date,yyyy-MM-dd HH:mm}{1,date,-HH:mm}
thesisUpload.webNotification = Thesis for the project "${project}" has been uploaded.
oppositionUpload.webNotification = Opposition report for the project "${finalSeminar.project}" has been uploaded by ${opponent.user}.
reviewAccepted.webNotification = Your peer request was accepted by {0}, he/she now has {1, number} days to complete a review.
reviewCompletedforRequester.webNotification = Your peer request has now been reviewed and is available.
reviewCompletedforRequestSupervisor.webNotification = You are getting this message because you are supervisor of "${peerRequest.project.title}". A peer review on this project has been completed and is available for you.
reviewCompletedforReviewSupervisor.webNotification = ${reviewer.user} in project: ${project.title} has performed a peer review.
reviewRated.webNotification = Your review has been rated.
# Mail notifications
mailSubject = Notification from SciPro
acceptPeerReviewSubject = Your request for peer review has been accepted
completedReviewSubject = A peer review has been completed
reviewRatedSubject = You have received a rating for a review you have done
mailNotification = Hello {0}, \n\n{1}\n\nClick on the link to see it in Scipro: \n{2} \n\nThis is an auto-generated message from SciPro.
mailBody = \n\n{0}

@ -186,6 +186,8 @@ public class SciProSession extends WebSession {
Project activeProject = userSettings.getActiveProject();
if(activeProject != null)
activeProjectId = activeProject.getId();
else
activeProjectId = null;
}
else {
userSettings = new UserSettings(user);

@ -34,7 +34,7 @@ public abstract class AbstractAdminSettingsPage extends AbstractAdminPage {
items.add(new MenuItem("Server Environment", AdminServerEnvironmentSettingsPage.class));
items.add(new MenuItem("Final seminar general settings", AdminFinalSeminarSettingsPage.class));
items.add(new MenuItem("Final seminar project level settings", AdminFinalSeminarSettingsPerProjectClassPage.class));
items.add(new MenuItem("Level settings", AdminPeerSettingsPage.class));
items.add(new MenuItem("Peer portal settings", AdminPeerSettingsPage.class));
items.add(new MenuItem("Edit levels", AdminProjectClassSettingsPage.class));
return items;

@ -0,0 +1,27 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CheckLists</title>
</head>
<body>
<wicket:extend>
<div class="span-22 last">
<!-- Left column -->
<div class="span-10 colborder">
<div class="span-10 last">
<div wicket:id="cCLPanel"></div>
</div>
</div>
<!-- Right column -->
<div class="span-10 last">
<div class="span-10 last">
<div wicket:id="listCLPanel"></div>
</div>
</div>
</div>
</wicket:extend>
</body>
</html>

@ -0,0 +1,36 @@
package se.su.dsv.scipro.admin.pages;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.SubmitLink;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.checklists.panels.CreateCheckListTemplatePanel;
import se.su.dsv.scipro.checklists.panels.ListCheckListTemplatePanel;
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
import se.su.dsv.scipro.project.panels.ProjectPartnerPanel;
import se.su.dsv.scipro.security.auth.Authorization;
import se.su.dsv.scipro.security.auth.roles.Roles;
/**
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
@Authorization(authorizedRoles={Roles.SYSADMIN, Roles.ADMIN})
public class AdminCheckListPage extends AbstractAdminPage {
public static final String MAIN_MENU_LABEL = "CheckLists";
public AdminCheckListPage(PageParameters pp) {
super(pp);
add(new CreateCheckListTemplatePanel("cCLPanel"));
add(new ListCheckListTemplatePanel("listCLPanel"));
}
}

@ -19,7 +19,7 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
*
*/
@Authorization(authorizedRoles={Roles.SYSADMIN})
@Authorization(authorizedRoles={Roles.SYSADMIN, Roles.ADMIN})
public class AdminProjectPartnerPage extends AbstractAdminPage {
@SpringBean

@ -24,7 +24,11 @@
<tr>
<td><label for="numberOfLatestReviewsDisplayed">Number of reviews to show in the "Latest reviewers" panel: </label></td>
<td><input type="text" wicket:id="numberOfLatestReviewsDisplayed" name="numberOfLatestReviewsDisplayed" /></td>
</tr>
</tr>
<tr>
<td><label for="publicReviewsActivated">Activate public reviews with links in "Latest reviewers" panel: </label></td>
<td><input type="checkbox" wicket:id="publicReviewsActivated" name="publicReviewsActivated" /></td>
</tr>
</table>
</form>
<h5 class="peer-title">Settings for levels</h5>

@ -77,10 +77,8 @@ public class AdminPeerSettingsPage extends AbstractAdminSettingsPage {
numberOfLatestReviewsDisplayed.setRequired(true);
add(numberOfLatestReviewsDisplayed);
// Checkbox for activating/inactiviting links to reviews in the Latest reviewers panel.
//
/*CheckBox publicReviewsActivated = new CheckBox("publicReviewsActivated");
add(publicReviewsActivated);*/
CheckBox publicReviewsActivated = new CheckBox("publicReviewsActivated");
add(publicReviewsActivated);
}
@Override
public void onSubmit(){

@ -3,15 +3,16 @@
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:extend>
<h3 class="section">Server/Request environment</h3>
<div style="overflow:auto;height:390px;">
<ul>
<li wicket:id="requestAttributes">
<span wicket:id="name">[name]</span>:
<span wicket:id="value">[value]</span>
</li>
</ul>
<h5 class="peer-title">Server/Request environment</h5>
<div>
<div style="overflow: auto; height: 360px;">
<ul>
<li wicket:id="requestAttributes"><span wicket:id="name">[name]</span>:
<span wicket:id="value">[value]</span>
</li>
</ul>
</div>
</div>
</wicket:extend>
</wicket:extend>
</body>
</html>

@ -6,6 +6,7 @@ import java.util.List;
import org.apache.wicket.Page;
import se.su.dsv.scipro.admin.pages.AbstractAdminPage;
import se.su.dsv.scipro.admin.pages.AdminCheckListPage;
import se.su.dsv.scipro.admin.pages.AdminFinalSeminarPage;
import se.su.dsv.scipro.admin.pages.AdminProjectPartnerPage;
import se.su.dsv.scipro.admin.pages.AdminRolePage;
@ -39,6 +40,7 @@ public class AdminTabMenuPanel extends AbstractMenuPanel {
items.add(new MenuItem("Settings", AdminGeneralSettingsPage.class, ImageIcon.ICON_SETTINGS));
items.add(new MenuItem("Role management", AdminRolePage.class));
items.add(new MenuItem("Project partner", AdminProjectPartnerPage.class));
items.add(new MenuItem("CheckList", AdminCheckListPage.class));
return items;
}

@ -25,10 +25,6 @@
<link href='http://fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css' /> -->
<!--<link rel="stylesheet" href="css/scipro.css" media="screen,projection" />-->
<!-- <link type="text/css" href="css/smoothness/jquery-ui-1.8.10.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.10.custom.min.js"></script> -->
<script type="text/javascript">
var _gaq = _gaq || [];

@ -0,0 +1,16 @@
package se.su.dsv.scipro.basepanels;
import org.apache.wicket.Page;
import se.su.dsv.scipro.components.AbstractMenuPanel;
public abstract class AbstractBaseMenuPanel extends AbstractMenuPanel {
private static final long serialVersionUID = 3738086567246191811L;
public AbstractBaseMenuPanel(final String id,final Class<? extends Page> menuContainerCommonSuperClass, final Class<? extends Page> containerClass) {
super(id,menuContainerCommonSuperClass,containerClass);
}
@Override
protected MenuType getMenuType() {
return MenuType.TAB;
}
}

@ -1,13 +1,19 @@
<!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>
<wicket:panel>
<header id="main-header" class="span-24">
<div class="prepend-1 span-5">
<h1 id="logo"><a href="#" wicket:id="homeLink" title="SciPro">SciPro</a></h1>
</div>
<div wicket:id="mainMenuPanel"></div>
</header>
</wicket:panel>
<wicket:panel>
<header id="main-header" class="span-24">
<div class="prepend-1 span-5">
<h1 id="logo">
<a href="#" wicket:id="homeLink" title="SciPro">SciPro</a>
</h1>
</div>
<div class="prepend-2 span-15 last user-links"
wicket:id="userLinksPanel"></div>
<div wicket:id="mainMenuPanel" class="main-menu prepend-6"></div>
<div wicket:id="serviceMenuPanel" class="service-menu"></div>
</header>
</wicket:panel>
</body>
</html>

@ -1,9 +1,7 @@
package se.su.dsv.scipro.basepanels;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.markup.html.panel.Panel;
import se.su.dsv.scipro.SciProApplication;
@ -14,17 +12,13 @@ import se.su.dsv.scipro.SciProApplication;
*
*/
public class HeaderPanel extends Panel {
private static final long serialVersionUID = 1L;
public HeaderPanel(String id, Class<? extends Page> containerClass) {
super(id);
add(new BookmarkablePageLink<Void>("homeLink", SciProApplication.get().getHomePage()));
MainMenuPanel mainMenuPanel = new MainMenuPanel("mainMenuPanel", containerClass);
add(mainMenuPanel);
add(new MainMenuPanel("mainMenuPanel", containerClass));
add(new ServiceMenuPanel("serviceMenuPanel", containerClass));
add(new UserLinksPanel("userLinksPanel"));
}
}

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<nav id="main-nav">
<div class="span-18 last">
<div class="prepend-2 span-15 last" id="user-links" wicket:id="userLinksPanel"></div>
<div class="span-18 last">
<ul id="nav-list">
<li class="nav-list-item" id="home-menu-item" wicket:id="homeMenuItem"></li>
<li class="nav-list-item" id="messages-menu-item" wicket:id="messagesMenuItem"></li>
<li class="nav-list-item" id="project-menu-item" wicket:id="projectMenuItem"></li>
<li class="nav-list-item" id="supervisor-menu-item" wicket:id="supervisorMenuItem"></li>
<li class="nav-list-item" id="resources-menu-item" wicket:id="resourcesMenuItem"></li>
<li class="nav-list-item" id="admin-menu-item" wicket:id="adminMenuItem"></li>
</ul>
</div>
</div>
</nav>
</wicket:panel>
</body>
</html>

@ -4,121 +4,25 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.Page;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.odlabs.wiquery.core.commons.IWiQueryPlugin;
import org.odlabs.wiquery.core.commons.WiQueryResourceManager;
import org.odlabs.wiquery.core.javascript.JsStatement;
import se.su.dsv.scipro.HomePage;
import se.su.dsv.scipro.SciProApplication;
import se.su.dsv.scipro.admin.pages.AdminScheduleTemplatesPage;
import se.su.dsv.scipro.admin.pages.AdminStartPage;
import se.su.dsv.scipro.admin.pages.ProjectManagementPage;
import se.su.dsv.scipro.admin.pages.SystemMaintenancePage;
import se.su.dsv.scipro.basepages.MenuPage;
import se.su.dsv.scipro.basepanels.mainmenu.MainMenuItem;
import se.su.dsv.scipro.basepanels.mainmenu.MenuItem;
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
import se.su.dsv.scipro.peer.pages.PeerReviewTemplatePage;
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
import se.su.dsv.scipro.project.pages.ProjectStartPage;
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
import se.su.dsv.scipro.security.auth.roles.Roles;
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectsFinalSeminarPage;
import se.su.dsv.scipro.supervisor.pages.SupervisorStartPage;
import se.su.dsv.scipro.wiquery.mainmenu.MainMenuJavascriptResourceReference;
public class MainMenuPanel extends Panel implements IWiQueryPlugin {
public class MainMenuPanel extends AbstractBaseMenuPanel {
private static final long serialVersionUID = 3738086567246191811L;
public MainMenuPanel(String id, Class<? extends Page> containerClass) {
super(id);
add(new MainMenuItem("homeMenuItem", HomePage.MAIN_MENU_LABEL, HomePage.class, containerClass, null));
/*
* Messages
*/
MainMenuItem messagesMenuItem = new MainMenuItem("messagesMenuItem", PrivateMessagesPage.MAIN_MENU_LABEL, PrivateMessagesPage.class, containerClass, null);
MetaDataActionStrategy.authorize(messagesMenuItem, Roles.SYSADMIN); // TODO: Hidden for initial deployment
add(messagesMenuItem);
/*
* Project/Author
*/
List<MenuItem> projectMenuSubItems = new ArrayList<MenuItem>();
projectMenuSubItems.add(new MenuItem(ProjectStartPage.MAIN_MENU_LABEL, ProjectStartPage.class));
projectMenuSubItems.add(new MenuItem(ProjectOppositionPage.MAIN_MENU_LABEL, ProjectOppositionPage.class));
projectMenuSubItems.add(new MenuItem(FinalSeminarProjectListPage.MAIN_MENU_LABEL, FinalSeminarProjectListPage.class));
MainMenuItem projectMenuItem = new MainMenuItem("projectMenuItem", ProjectStartPage.MAIN_MENU_LABEL, ProjectStartPage.class, containerClass, projectMenuSubItems);
add(projectMenuItem);
/*
* Supervisor
*/
List<MenuItem> supervisorMenuSubItems = new ArrayList<MenuItem>();
//supervisorMenuSubItems.add(new MenuItem("Schedule Templates", SupervisorProjectsFinalSeminarPage.class));
supervisorMenuSubItems.add(new MenuItem(SupervisorStartPage.MAIN_MENU_LABEL, SupervisorStartPage.class));
supervisorMenuSubItems.add(new MenuItem(SupervisorProjectsFinalSeminarPage.MAIN_MENU_LABEL, SupervisorProjectsFinalSeminarPage.class));
MainMenuItem supervisorMenuItem = new MainMenuItem("supervisorMenuItem", SupervisorStartPage.MAIN_MENU_LABEL, SupervisorStartPage.class, containerClass, supervisorMenuSubItems);
MetaDataActionStrategy.authorize(supervisorMenuItem, new Roles[]{Roles.EXTERNAL, Roles.EMPLOYEE});
add(supervisorMenuItem);
/*
* Resource
*/
MainMenuItem resourcesMenuItem = new MainMenuItem("resourcesMenuItem", ResourcePage.MAIN_MENU_LABEL, ResourcePage.class, containerClass, null);
MetaDataActionStrategy.authorize(resourcesMenuItem, Roles.SYSADMIN ); // TODO: Hidden for initial deployment
add(resourcesMenuItem);
/*
* Admin
*/
List<MenuItem> adminMenuSubItems = new ArrayList<MenuItem>();
adminMenuSubItems.add(new MenuItem(AdminScheduleTemplatesPage.MAIN_MENU_LABEL, AdminScheduleTemplatesPage.class));
adminMenuSubItems.add(new MenuItem(SystemMaintenancePage.MAIN_MENU_LABEL, SystemMaintenancePage.class));
adminMenuSubItems.add(new MenuItem(ProjectManagementPage.MAIN_MENU_LABEL, ProjectManagementPage.class));
adminMenuSubItems.add(new MenuItem(PeerReviewTemplatePage.MAIN_MENU_LABEL, PeerReviewTemplatePage.class));
MainMenuItem adminMenuItem = new MainMenuItem("adminMenuItem", AdminStartPage.MAIN_MENU_LABEL, AdminStartPage.class, containerClass, adminMenuSubItems);
MetaDataActionStrategy.authorize(adminMenuItem, Roles.ADMIN);
add(adminMenuItem);
UserLinksPanel userLinksPanel = new UserLinksPanel("userLinksPanel");
add(userLinksPanel);
super(id,HomePage.class,containerClass);
}
@Override
public void contribute(WiQueryResourceManager wiQueryResourceManager) {
wiQueryResourceManager.addJavaScriptResource(MainMenuJavascriptResourceReference.get());
}
@Override
public JsStatement statement() {
return null;
}
/**
* @deprecated see {@link se.su.dsv.scipro.basepanels.mainmenu.AbstractMainMenuItem#getMenuLink(String)}
*/
@SuppressWarnings("unused")
private BookmarkablePageLink<Void> getMenuLink(String id, final Class<? extends Page> targetPageClass, final Class<? extends Page> containerClass){
return getMenuLink(id, targetPageClass, null, containerClass);
protected List<MenuItem> getItemList(){
List<MenuItem> list = new ArrayList<MenuItem>();
list.add(new MenuItem(ProjectStartPage.MAIN_MENU_LABEL,ProjectStartPage.class));
list.add(new MenuItem(SupervisorStartPage.MAIN_MENU_LABEL,SupervisorStartPage.class));
list.add(new MenuItem(AdminStartPage.MAIN_MENU_LABEL,AdminStartPage.class));
return list;
}
/**
* @deprecated see {@link se.su.dsv.scipro.basepanels.mainmenu.AbstractMainMenuItem#getMenuLink(String, PageParameters)}
*/
private BookmarkablePageLink<Void> getMenuLink(String id, final Class<? extends Page> targetPageClass, final PageParameters pp, final Class<? extends Page> containerClass){
BookmarkablePageLink<Void> result = new BookmarkablePageLink<Void>(id, targetPageClass, pp);
result.setOutputMarkupId(true);
if(targetPageClass == containerClass || (targetPageClass.getSuperclass().isAssignableFrom(containerClass) && targetPageClass.getSuperclass() != MenuPage.class) ){
result.setMarkupId("current");
}
return result;
}
}

@ -0,0 +1,24 @@
package se.su.dsv.scipro.basepanels;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.Page;
import se.su.dsv.scipro.basepages.MenuPage;
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
public class ServiceMenuPanel extends AbstractBaseMenuPanel {
private static final long serialVersionUID = 3738086567246191811L;
public ServiceMenuPanel(String id, Class<? extends Page> containerClass) {
super(id,MenuPage.class,containerClass);
}
@Override
protected List<MenuItem> getItemList(){
List<MenuItem> list = new ArrayList<MenuItem>();
list.add(new MenuItem(ResourcePage.MAIN_MENU_LABEL,ResourcePage.class));
list.add(new MenuItem(PrivateMessagesPage.MAIN_MENU_LABEL,PrivateMessagesPage.class));
return list;
}
}

@ -1,62 +0,0 @@
package se.su.dsv.scipro.basepanels.mainmenu;
import org.apache.wicket.Page;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Panel;
import se.su.dsv.scipro.basepages.MenuPage;
/**
* Abstract Class for Main Menu Items
*
* @author patrick
*
*/
public abstract class AbstractMainMenuItem extends Panel {
private static final long serialVersionUID = 2849283400267381932L;
protected Class<? extends Page> targetPageClass;
protected Class<? extends Page> containerPageClass;
private String menuLabel;
protected BookmarkablePageLink<Void> menuItemLink;
public AbstractMainMenuItem(String id, String label, Class<? extends Page> targetPageClass, Class<? extends Page> containerPageClass) {
super(id);
this.menuLabel = label;
this.targetPageClass = targetPageClass;
this.containerPageClass = containerPageClass;
}
public String getMenuLabel() {
return menuLabel;
}
/**
* {@link #getMenuLink(String, PageParameters)}
*/
protected BookmarkablePageLink<Void> getMenuLink(String id) {
return getMenuLink(id, null);
}
/**
* Creates a bookmarkable page link for the main menu.
*
* @param id
* @param pp
* @return
* @author Martin Peters
*/
protected BookmarkablePageLink<Void> getMenuLink(String id, final PageParameters pp) {
BookmarkablePageLink<Void> result = new BookmarkablePageLink<Void>(id, targetPageClass, pp);
result.setOutputMarkupId(true);
if(targetPageClass == containerPageClass || (targetPageClass.getSuperclass().isAssignableFrom(containerPageClass) && targetPageClass.getSuperclass() != MenuPage.class) ){
//TODO Should prefereably be replaced with the line below because repeating id's aren't valid html. I couldn't get the CSS to work though //mpeters
result.setMarkupId("current");
//result.add(new AttributeAppender("class", new Model<String>("current"), " "));
}
return result;
}
}

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<span class="menu-item">
<a wicket:id="mainMenuItemLink"><span wicket:id="mainMenuItemLabel"></span></a>
<img class="nav-arrow" wicket:id="mainMenuItemArrow" />
</span>
<div class="submenu rounded-bl rounded-br"><span wicket:id="mainMenuListItemSubMenu"><span wicket:id="subMenuItem"></span></span></div>
</wicket:panel>
</body>
</html>

@ -1,79 +0,0 @@
package se.su.dsv.scipro.basepanels.mainmenu;
import java.util.List;
import org.apache.wicket.Page;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.ContextImage;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.Model;
/**
* Main Menu Item, the upper level of the main menu hierarchy.
*
* @author patrick
*
*/
public class MainMenuItem extends AbstractMainMenuItem {
private static final long serialVersionUID = 6103131868992599100L;
@SuppressWarnings("unused")
private List<MenuItem> subItems;
public MainMenuItem(String id, String label, final Class<? extends Page> targetPageClass, final Class<? extends Page> containerClass, final List<MenuItem> subItems) {
super(id, label, targetPageClass, containerClass);
this.subItems = subItems;
if (subItems != null)
this.add(new AttributeAppender("class", true, new Model<String>("parent"), " "));
menuItemLink = getMenuLink("mainMenuItemLink");
menuItemLink.add(new Label("mainMenuItemLabel", getMenuLabel()));
add(menuItemLink);
ContextImage mainMenuItemArrow = new ContextImage("mainMenuItemArrow", "images/site_nav_arrow2.png") {
private static final long serialVersionUID = 1793336840409311960L;
/* (non-Javadoc)
* @see org.apache.wicket.Component#isVisible()
*/
@Override
public boolean isVisible() {
return subItems != null;
}
};
mainMenuItemArrow.setOutputMarkupPlaceholderTag(true);
add(mainMenuItemArrow);
ListView<MenuItem> subItemListView = new ListView<MenuItem>("mainMenuListItemSubMenu", subItems) {
private static final long serialVersionUID = -1444218885819118389L;
@Override
protected void populateItem(ListItem<MenuItem> item) {
MenuItem obj = item.getModelObject();
item.add(obj.createSubItem("subMenuItem", containerClass));
add(item);
}
/* (non-Javadoc)
* @see org.apache.wicket.Component#isVisible()
*/
@Override
public boolean isVisible() {
return subItems != null;
}
};
subItemListView.setOutputMarkupPlaceholderTag(true);
add(subItemListView);
}
}

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<a href="#" wicket:id="mainMenuSubItemLink"><span wicket:id="mainMenuSubItemLabel">[Link]</span></a>
</wicket:panel>
</body>
</html>

@ -1,27 +0,0 @@
package se.su.dsv.scipro.basepanels.mainmenu;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
/**
* Main Menu Sub Items
*
* @author patrick
*
*/
public class MainMenuSubItem extends AbstractMainMenuItem {
private static final long serialVersionUID = 8903203088965767242L;
public MainMenuSubItem(String id, String label, Class<? extends Page> targetPageClass,
Class<? extends Page> containerPageClass) {
super(id, label, targetPageClass, containerPageClass);
menuItemLink = getMenuLink("mainMenuSubItemLink");
menuItemLink.add(new Label("mainMenuSubItemLabel", getMenuLabel()));
add(menuItemLink);
}
}

@ -1,47 +0,0 @@
package se.su.dsv.scipro.basepanels.mainmenu;
import java.util.List;
import org.apache.wicket.IClusterable;
import org.apache.wicket.Page;
/**
* Helper Class for preparing the creation of main menu items
* @author patrick
*
*/
public class MenuItem implements IClusterable {
private static final long serialVersionUID = -5341715569517881163L;
private String menuLabel;
private Class<? extends Page> targetPageClass;
public MenuItem(String menuLabel, Class<? extends Page> targetPageClass) {
this.menuLabel = menuLabel;
this.targetPageClass = targetPageClass;
}
/**
* Creates a Main Menu Sub Item
*
* @param id
* @param containerPageClass
* @return
*/
public MainMenuSubItem createSubItem(String id, Class<? extends Page> containerPageClass) {
return new MainMenuSubItem(id, menuLabel, targetPageClass, containerPageClass);
}
/**
* Creates a Main Menu Item
*
* @param id
* @param containerPageClass
* @param subItems
* @return
*/
public MainMenuItem createMenuItem(String id, Class<? extends Page> containerPageClass, List<MenuItem> subItems) {
return new MainMenuItem(id, menuLabel, targetPageClass, containerPageClass, subItems);
}
}

@ -0,0 +1,40 @@
<!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="feedbackPanel"></div>
<form wicket:id="form">
<div>
Template name: <input wicket:id="title" type="text" />
</div>
<p></p>
<div wicket:id="radioChoice">
<input type="radio" />
</div>
<div>
<form wicket:id="addQuestionForm">
<div wicket:id="container">
<div>Questions</div>
<div wicket:id="questions">
<span wicket:id=questionLabel></span>
</div>
</div>
<div>
<input wicket:id="question" type="text" />
</div>
<input wicket:id="addQuestionButton" type="submit" />
</form>
</div>
<p></p>
<input wicket:id="save" type="submit" />
</form>
</wicket:panel>
</body>
</html>

@ -0,0 +1,150 @@
package se.su.dsv.scipro.checklists.panels;
import java.util.List;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.RadioChoice;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
/**
* @author fnorbe@dsv.su.se
*/
public class CreateCheckListTemplatePanel extends Panel {
private static final long serialVersionUID = 8862892008428526067L;
@SpringBean
private CheckListTemplateDao checkListTemplateDao;
@SpringBean
private ProjectClassDao projectClassDao;
private String question = "";
private String title = "";
private final FeedbackPanel feedbackPanel;
private ProjectClass projectClass;
private CheckListTemplate checkListTemplate = new CheckListTemplate();
public CreateCheckListTemplatePanel(String id) {
super(id);
projectClass = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
feedbackPanel = new FeedbackPanel("feedbackPanel");
feedbackPanel.setOutputMarkupId(true);
add(feedbackPanel);
Form<CheckListTemplate> form = new Form<CheckListTemplate>("form");
final Form<CheckListTemplate> addQuestionForm = new Form<CheckListTemplate>("addQuestionForm");
final TextField<String> titleField = new RequiredTextField<String>("title",
new PropertyModel<String>(this, "title"));
titleField.setOutputMarkupId(true);
final TextField<String> questionField = new RequiredTextField<String>("question",
new PropertyModel<String>(this, "question"));
questionField.setOutputMarkupId(true);
questionField.setRequired(false);
RadioChoice<ProjectClass> radioChoice = new RadioChoice<ProjectClass>("radioChoice",
new PropertyModel<ProjectClass>(this, "projectClass"), projectClassDao.findAll());
final IModel<List<String>> questionModel = new LoadableDetachableModel<List<String>>(){
private static final long serialVersionUID = 1L;
@Override
protected List<String> load() {
return checkListTemplate.getQuestions();
}
};
final WebMarkupContainer container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
ListView<String> listView = new ListView<String>("questions", questionModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<String> item) {
Label question = new Label("questionLabel", item.getModel().getObject());
item.add(question);
}
};
container.add(listView);
//add(new FeedbackPanel("feedbackPanel"));
AjaxButton save = new AjaxButton("save", new Model<String>("Save template")) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
checkListTemplate.setLevel(projectClass);
checkListTemplate.setCreator(SciProSession.get().getUser());
checkListTemplate.setName(title);
checkListTemplateDao.save(checkListTemplate);
checkListTemplate = new CheckListTemplate();
title ="";
question="";
target.addComponent(container);
target.addComponent(titleField);
}
};
AjaxButton addQuestionButton = new AjaxButton("addQuestionButton", new Model<String>("Add question")) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
if(question != null || question != ""){
checkListTemplate.getQuestions().add(new String(question));
}
questionModel.detach();
question = "";
target.addComponent(questionField);
target.addComponent(container);
}
};
addQuestionForm.add(questionField);
addQuestionForm.add(container);
addQuestionForm.add(addQuestionButton);
form.add(titleField);
form.add(radioChoice);
form.add(addQuestionForm);
form.add(save);
add(form);
};
}

@ -0,0 +1,66 @@
package se.su.dsv.scipro.checklists.panels;
import java.util.List;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
import se.su.dsv.scipro.data.dataobjects.CheckList;
import se.su.dsv.scipro.data.dataobjects.Project;
import se.su.dsv.scipro.data.enums.CheckListRole;
/**
* @author Fredrik Norberg fnorbe@dsv.su.se
*
*/
public class ListCheckListPanel extends Panel {
private List<CheckList> checkLists;
private CheckListRole role;
private CheckListDao checkListDao;
private Project project;
private static final long serialVersionUID = 1L;
public ListCheckListPanel(String id, CheckListRole role, final Project project) {
super(id);
this.role = role;
checkLists = checkListDao.findCheckLists(project, role);
IModel<List<CheckList>> checkListModel = new LoadableDetachableModel<List<CheckList>>() {
private static final long serialVersionUID = 1L;
@Override
protected List<CheckList> load() {
return project.getCheckLists();
}
};
final WebMarkupContainer container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
ListView<CheckList> checkLists = new ListView<CheckList>("checkLists", checkListModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<CheckList> item) {
Label listName = new Label("listName", item.getModel().getObject().getName());
item.add(listName);
}
};
container.add(checkLists);
}
}

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
</head>
<body>
<wicket:panel>
<div wicket:id="container">
<div wicket:id="checkListTemplates">
<div wicket:id="templateName"></div>
<div wicket:id="templateOwner"></div>
</div>
</div>
</wicket:panel>
</body>
</html>

@ -0,0 +1,68 @@
package se.su.dsv.scipro.checklists.panels;
import java.util.List;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
/**
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
public class ListCheckListTemplatePanel extends Panel{
@SpringBean
private CheckListTemplateDao checkListTemplateDao;
private static final long serialVersionUID = 1L;
public ListCheckListTemplatePanel(String id) {
super(id);
IModel<List<CheckListTemplate>> checkListTemplateModel = new LoadableDetachableModel<List<CheckListTemplate>>() {
private static final long serialVersionUID = 1L;
@Override
protected List<CheckListTemplate> load() {
return checkListTemplateDao.findAll();
}
};
final WebMarkupContainer container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
ListView<CheckListTemplate> checkListTemplates = new ListView<CheckListTemplate>("checkListTemplates", checkListTemplateModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<CheckListTemplate> item) {
Label templateName = new Label("templateName", new PropertyModel<String>(item.getModel(),"name"));
Label templateOwner = new Label("templateOwner", new PropertyModel<String>(item.getModel(), "creator"));
item.add(templateName);
item.add(templateOwner);
}
};
container.add(checkListTemplates);
add(container);
}
}

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
</head>
<body>
<wicket:panel>
<div wicket:id="trafficLightContainer">
<div wicket:id="group">
<div wicket:id="lights">
<table >
<tr >
<td><input type="radio" wicket:id="radio" /></td>
<td><img wicket:id="image"/></td>
</tr>
<tr>
</tr>
</table>
</div>
</div>
</div>
</wicket:panel>
</body>
</html>

@ -0,0 +1,85 @@
package se.su.dsv.scipro.checklists.panels;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Radio;
import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
import se.su.dsv.scipro.data.dataobjects.CheckList;
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
import se.su.dsv.scipro.knol.resource.page.StaticImage;
/**
* @author fnorbe@dsv.su.se
*/
public class TrafficLightPanel extends Panel {
private List<TrafficLight> lights;
enum TrafficLight{
GREEN, YELLOW, RED, NOT
}
private static final long serialVersionUID = 8862892008428526067L;
public TrafficLightPanel(String id) {
super(id);
WebMarkupContainer trafficLightContainer = new WebMarkupContainer(
"trafficLightContainer");
add(trafficLightContainer);
lights = new ArrayList<TrafficLight>();
lights.add(TrafficLight.GREEN);lights.add(TrafficLight.YELLOW);lights.add(TrafficLight.RED);lights.add(TrafficLight.NOT);
RadioGroup<TrafficLight> group = new RadioGroup<TrafficLight>("group");
trafficLightContainer.add(group);
ListView<TrafficLight> lightList = new ListView<TrafficLight>("lights", lights) {
private static final long serialVersionUID = 1L;
protected void populateItem(ListItem<TrafficLight> item) {
TrafficLight trafficLight = item.getModelObject();
item.add(new Radio<TrafficLight>("radio", item.getModel()));
StaticImage image = null;
if (trafficLight.equals(TrafficLight.GREEN)) {
image = new StaticImage("image", new Model<String>(
"images/icons/green_ball_32.png"));
} else if (trafficLight.equals(TrafficLight.YELLOW)) {
image = new StaticImage("image", new Model<String>(
"images/icons/red_ball_32.png"));
} else if (trafficLight.equals(TrafficLight.RED)) {
image = new StaticImage("image", new Model<String>(
"images/icons/yellow_ball_32.png"));
}
else if (trafficLight.equals(TrafficLight.NOT)) {
image = new StaticImage("image", new Model<String>(
"images/icons/grey_ball_32.png"));
}
item.add(image);
};
};
group.add(lightList);
}
}

@ -0,0 +1,109 @@
package se.su.dsv.scipro.checklists.panels;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
import se.su.dsv.scipro.data.dataobjects.CheckList;
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
public class ViewCheckListPanel extends Panel {
private static final long serialVersionUID = 1L;
@SpringBean
private CheckListDao checkListDao;
@SpringBean
private CheckListAnswerDao checkListAnswerDao;
@SpringBean
private CheckListQuestionDao checkListQuestionDao;
@SpringBean
private CheckListTemplateDao checkListTemplateDao;
public ViewCheckListPanel(String id){
super(id);
/* List<CheckList> checkLists = checkListDao.findCheckLists(SciProSession.get()
.getActiveProject());{
if (checkLists.size() < 1) {
CheckList checkList = new CheckList("Test", SciProSession.get().getActiveProject());
CheckListQuestion checkListQuestion = new CheckListQuestion("Testquestion?");
checkListQuestion = checkListQuestionDao.save(checkListQuestion);
checkList.getQuestions().add(checkListQuestion);
checkList = checkListDao.save(checkList);
}
ListView<CheckList> checkListsListView = new ListView<CheckList>("checkLists", checkLists) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<CheckList> item) {
ListView<CheckListQuestion> listView = new ListView<CheckListQuestion>(
"listView",
new ArrayList<CheckListQuestion>(item.getModel().getObject().getQuestions())) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<CheckListQuestion> item) {
CheckListQuestion checkListQuestion = item.getModel().getObject();
if(checkListQuestion.getAnswers().size() == 0){
CheckListAnswer checkListAnswer = new CheckListAnswer(SciProSession.get().getUser(), CheckListQuestionAnswer.GREEN);
checkListAnswer = checkListAnswerDao.save(checkListAnswer);
checkListQuestion.getAnswers().add(checkListAnswer);
checkListQuestionDao.save(checkListQuestion);
}
item.add(new Label("question", item.getModel().getObject().getQuestion()));
ListView<CheckListAnswer> listView = new ListView<CheckListAnswer>(
"listViewAnswer",
new ArrayList<CheckListAnswer>(item.getModel().getObject().getAnswers())) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<CheckListAnswer> item) {
item.add(new Label("answer", item.getModel().getObject().getAnswer().toString()));
}
};
item.add(listView);
}
};
item.add(listView);
}
};
add(checkListsListView);
};*/
}
}

@ -18,6 +18,11 @@ import org.apache.wicket.model.Model;
import se.su.dsv.scipro.icons.ImageIcon;
/**
* ABC-class for menu's of different types.
* Subclasses should implement their own data feed mechanics via <code>getItemList</code> and provide a menu type via <code>getMenuType</code>
* The returned menu-type is used to provide CSS-class mappings for the menu structure, see the MenuType enum for alternatives.
*/
public abstract class AbstractMenuPanel extends Panel {
private static final long serialVersionUID = 1L;
@ -33,6 +38,9 @@ public abstract class AbstractMenuPanel extends Panel {
}
};
/**
* Enumeration of supported menu types.
*/
public enum MenuType {
NONE,
TAB,
@ -41,7 +49,12 @@ public abstract class AbstractMenuPanel extends Panel {
VERTICAL
}
/**
* Superclass constructor, arguments
* @param id Wicket identifier for the component
* @param menuContainerCommonSuperClass [Needs documentation]
* @param containerClass [Needs documentation]
*/
public AbstractMenuPanel(final String id, final Class<? extends Page> menuContainerCommonSuperClass,final Class<? extends Page> containerClass) {
super(id);
@ -56,7 +69,7 @@ public abstract class AbstractMenuPanel extends Panel {
protected void populateItem( ListItem<MenuItem> item ) {
final MenuItem mi = item.getModelObject();
boolean highLightAsCurrentByInterface = false;
Class<?> menuItemInterface = mi.getMenuHilightInterface();
Class<?> menuItemInterface = mi.getMenuHighlightInterface();
if( menuItemInterface != null ){
for( Class<?> actualPageInterface : containerClass.getInterfaces() ){
if( actualPageInterface.equals(menuItemInterface) ){
@ -72,7 +85,7 @@ public abstract class AbstractMenuPanel extends Panel {
&&
mi.getTargetClass().getSuperclass() != menuContainerCommonSuperClass
)
){
){
//item.setMarkupId("current");
//item.setOutputMarkupId(true);
//Replaced the above because it generates invalid markup if two menus are added to the same page (id no longer unique)
@ -99,11 +112,15 @@ public abstract class AbstractMenuPanel extends Panel {
}
/**
* May not rely on anything in the implementing class's constructor as this will not have been initialized yet.
* Items are rendered from left to right as you might expect, first item in the list will be first tab item on the left.
* Items are rendered from left to right (or top to bottom depending on type of menu) as you might expect,
* the first item in the list will be the first menu item on the left/top.
* @return
*/
protected abstract List<MenuItem> getItemList();
/**
* Implement in subclass to return the wanted MenuType.
* @return
*/
protected abstract MenuType getMenuType();
/**
@ -118,7 +135,7 @@ public abstract class AbstractMenuPanel extends Panel {
private Class<? extends Page> targetClass;
private PageParameters pp;
private String iconName;
private Class<? extends MenuHighlight> menuHilightInterface;
private Class<? extends MenuHighlight> menuHighlightInterface;
public MenuItem(final String name, final Class<? extends Page> targetClass) {
this(name, targetClass, null, null, null);
@ -148,7 +165,7 @@ public abstract class AbstractMenuPanel extends Panel {
public MenuItem(final String name, final Class<? extends Page> targetClass, final Class<? extends MenuHighlight> menuHilightInterface, PageParameters pp, String iconName) {
this.name = name;
this.targetClass = targetClass;
this.menuHilightInterface = menuHilightInterface;
this.menuHighlightInterface = menuHilightInterface;
this.pp = pp;
this.iconName = iconName == null ? ImageIcon.ICON_EMPTY : iconName;
}
@ -169,13 +186,13 @@ public abstract class AbstractMenuPanel extends Panel {
return iconName;
}
public MenuItem setMenuHilightInterface(Class<? extends MenuHighlight> menuHilightInterface) {
this.menuHilightInterface = menuHilightInterface;
public MenuItem setMenuHighlightInterface(Class<? extends MenuHighlight> menuHighlightInterface) {
this.menuHighlightInterface = menuHighlightInterface;
return this;
}
public Class<? extends MenuHighlight> getMenuHilightInterface() {
return menuHilightInterface;
public Class<? extends MenuHighlight> getMenuHighlightInterface() {
return menuHighlightInterface;
}

@ -5,12 +5,12 @@ 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.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.protocol.http.RequestUtils;
@ -53,24 +53,10 @@ public class ProjectConferencePage extends ProjectPage {
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();
}
}
}
}
Long projectId = pp.getAsLong("pid");
Long boardMessageId = pp.getAsLong("cid");
if (projectId == null && SciProSession.get().getActiveProject() != null) {
projectId = String.valueOf(SciProSession.get().getActiveProject().getId());
projectId = SciProSession.get().getActiveProject().getId();
}
if (projectId != null) {
final Project project = projectDao.load(Long.valueOf(projectId));
@ -126,23 +112,23 @@ public class ProjectConferencePage extends ProjectPage {
messageBoard.setTitle(projectModel.getObject().getTitle());
messageBoard = messageBoardDao.save(messageBoard);
}
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
messageBoardModel = new AbstractReadOnlyModel<MessageBoard>() {
private static final long serialVersionUID = 1L;
@Override
protected MessageBoard load() {
public MessageBoard getObject() {
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>() {
if (bm != null) {
boardMessageModel = new AbstractReadOnlyModel<BoardMessage>() {
private static final long serialVersionUID = 1L;
@Override
protected BoardMessage load() {
public BoardMessage getObject() {
return boardMessageDao.reLoad(bm);
}
};

@ -11,6 +11,7 @@ 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.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.protocol.http.RequestUtils;
@ -56,22 +57,8 @@ public class SupervisorConferencePage extends AbstractSupervisorPage {
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();
}
}
}
}
Long projectId = pp.getAsLong(PROJECTID);
Long boardMessageId = pp.getAsLong("cid");
if (projectId == null) {
add(new EmptyPanel("conferencePanel"));
} else {
@ -122,23 +109,24 @@ public class SupervisorConferencePage extends AbstractSupervisorPage {
messageBoard.setTitle(projectModel.getObject().getTitle());
messageBoard = messageBoardDao.save(messageBoard);
}
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
messageBoardModel = new AbstractReadOnlyModel<MessageBoard>() {
private static final long serialVersionUID = 1L;
@Override
protected MessageBoard load() {
public MessageBoard getObject() {
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>() {
if (bm != null) {
boardMessageModel = new AbstractReadOnlyModel<BoardMessage>() {
private static final long serialVersionUID = 1L;
@Override
protected BoardMessage load() {
public BoardMessage getObject() {
return boardMessageDao.reLoad(bm);
}
};

@ -32,6 +32,7 @@ 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.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.User;
@ -51,6 +52,8 @@ public class ConferencePanel extends Panel {
private BoardMessageDao boardMessageDao;
@SpringBean
private CommentThreadDao commentThreadDao;
@SpringBean
private MessageBoardDao messageBoardDao;
@SpringBean
private NotificationController notificationController;
@ -61,6 +64,7 @@ public class ConferencePanel extends Panel {
private IModel<BoardMessage> boardMessageModel;
private Set<SubscriberModel> subscriberModels;
private FeedbackPanel feedbackPanel;
private final static int BOARDMESSAGESPERPAGE = 10;
public ConferencePanel(String id, IModel<MessageBoard> messageBoardModel,
Set<SubscriberModel> subscriberModels, IModel<BoardMessage> boardMessageModel) {
@ -80,7 +84,7 @@ public class ConferencePanel extends Panel {
feedbackPanel = new FeedbackPanel("feedbackPanel");
feedbackPanel.setOutputMarkupId(true);
add(feedbackPanel);
add(new SendWallMessageForm("sendForm"));
webMarkupContainer = new WebMarkupContainer("container");
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
@ -88,11 +92,15 @@ public class ConferencePanel extends Panel {
webMarkupContainer.setOutputMarkupId(true);
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
add(webMarkupContainer);
if (boardMessageModel != null) {
int index = boardMessageDao.getBoardMessageSortOrderIndex(boardMessageModel.getObject());
dataView.setCurrentPage(index/BOARDMESSAGESPERPAGE);
}
}
public void loadUserDataView(IDataProvider<BoardMessage> boardMessageDataProvider) {
dataView = new DataView<BoardMessage>("boardMessageDataView", boardMessageDataProvider, 10) {
dataView = new DataView<BoardMessage>("boardMessageDataView", boardMessageDataProvider, BOARDMESSAGESPERPAGE) {
private static final long serialVersionUID = 1L;
@ -112,8 +120,10 @@ public class ConferencePanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
BoardMessage boardMessageTemp = boardMessageDao.reLoad(bm);
boardMessageDao.delete(boardMessageTemp);
MessageBoard mb = messageBoardModel.getObject();
mb.removeFromBoardMessages(boardMessageDao.reLoad(bm));
messageBoardDao.save(mb);
boardMessageDao.delete(boardMessageDao.reLoad(bm));
webMarkupContainer.removeAll();
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
webMarkupContainer.add(dataView);
@ -242,23 +252,28 @@ public class ConferencePanel extends Panel {
} else {
BoardMessage bm = new BoardMessage();
bm.setMessage(message);
bm.setMessageBoard(messageBoardModel.getObject());
bm.setFromUser(SciProSession.get().getUser());
bm = boardMessageDao.save(bm);
MessageBoard mb = messageBoardModel.getObject();
mb.addToBoardMessages(bm);
messageBoardDao.save(mb);
for (SubscriberModel subscriberModel : subscriberModels) {
notificationController.notifyConferencePost(subscriberModel.getUser(), message, messageBoardModel.getObject().getTitle(),
notificationController.notifyConferencePost(subscriberModel.getUser(),
message, messageBoardModel.getObject().getTitle(),
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);
target.addComponent(messageTextArea);
}
target.addComponent(feedbackPanel);
}

@ -6,11 +6,10 @@ import org.apache.wicket.markup.html.form.upload.FileUpload;
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.repository.util.FileStorageException;
public interface FinalSeminarUploadController extends IClusterable {
void deleteSeminarFilesRecursive(FinalSeminar seminar);
void deleteOpponentFiles(FinalSeminarOpposition opp);
/**
@ -20,6 +19,15 @@ public interface FinalSeminarUploadController extends IClusterable {
* @throws Exception
*/
FinalSeminar deleteSeminarReport(FinalSeminar seminar) throws Exception;
/**
* Delete the upload report for the seminar, adminOverrideMode = true means no intentional exceptions will be thrown
* @param seminar
* @param adminOverrideMode
* @return
* @throws Exception
*/
FinalSeminar deleteSeminarReport(FinalSeminar seminar, boolean adminOverrideMode) throws Exception;
void storeSeminarDocument(FileUpload upload, User uploader, FinalSeminar seminar) throws Exception;

@ -26,9 +26,6 @@ public interface NotificationController {
public void notifyForComment(final User user, final String message,
final NotificationPriority notificationPriority, final String title,
final String classId, final String absolutePath);
public void notifyReplyPrivateMessage(final User user, final String message,
final String url);
public void notifyFinalSeminarEdited(final User user,
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,

@ -78,17 +78,9 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
}
private void delete(String path) {
fileRepository.delete(path);
}
public void deleteSeminarFilesRecursive(final FinalSeminar seminar) throws FileStorageException {
if (seminar.getDocument() != null) {
//delete(getRepositorySeminarPath(seminar)); Use of deprecated path/method
delete(seminar.getDocument().getPath());
}
}
public void deleteOpponentFiles(final FinalSeminarOpposition opp) throws FileStorageException {
if (opp.getOpponentReport() != null) {
//delete(getRepositoryOppositionPath(opp)); Use of deprecated path/method
@ -103,18 +95,31 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
* @return
* @throws Exception
*/
public FinalSeminar deleteSeminarReport(FinalSeminar seminar) throws Exception {
public FinalSeminar deleteSeminarReport(FinalSeminar seminar) throws Exception{
return deleteSeminarReport(seminar, false);
}
/**
* Delete the upload report for the seminar, adminOverrideMode = true means no intentional exceptions will be thrown
* @param seminar
* @param adminOverrideMode
* @return
* @throws Exception
*/
public FinalSeminar deleteSeminarReport(FinalSeminar seminar, boolean adminOverrideMode) throws Exception {
seminar = finalSeminarDao.reLoad(seminar);
if (!seminar.getOppositions().isEmpty() || !seminar.getActiveParticipations().isEmpty()) {
throw new Exception(
"Cannot delete seminar report, seminar has opponents or active participants");
if( !adminOverrideMode ){
if (!seminar.getOppositions().isEmpty() || !seminar.getActiveParticipations().isEmpty()) {
throw new Exception(
"Cannot delete seminar report, seminar has opponents or active participants");
}
}
for (CheckPlagiarismEvent cpe : checkPlagiarismEventDao.getWithFileDescription(seminar
.getDocument())) {
checkPlagiarismEventDao.delete(cpe);
}
fileRepository.delete(seminar.getDocument().getPath());
if(seminar.getDocument() != null)
if(seminar.getDocument().getPath() != null)
fileRepository.delete(seminar.getDocument().getPath());
seminar.setDocument(null);
return finalSeminarDao.save(seminar);
}
@ -183,11 +188,11 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
}
} catch (IOException e) {
Logger.getRootLogger().log(Level.ERROR,
Logger.getLogger(this.getClass()).log(Level.ERROR,
"Error while storing seminardocument: " + e.getMessage());
throw new Exception(e);
} catch (PersistenceException e) {
Logger.getRootLogger().log(Level.ERROR,
Logger.getLogger(this.getClass()).log(Level.ERROR,
"Error while storing seminardocument : " + e.getMessage());
if (fd != null) {
fileDescriptionDao.delete(fd);
@ -228,11 +233,11 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
}
} catch (IOException e) {
Logger.getRootLogger().log(Level.ERROR,
Logger.getLogger(this.getClass()).log(Level.ERROR,
"Error while storing opposition report: " + e.getMessage());
throw new Exception(e);
} catch (PersistenceException e) {
Logger.getRootLogger().log(Level.ERROR,
Logger.getLogger(this.getClass()).log(Level.ERROR,
"Error while storing opposition: " + e.getMessage());
if (fd != null) {

@ -111,7 +111,7 @@ public class HandInControllerImpl implements HandInController, IClusterable {
return true;
} catch (Exception e) {
//Something went wrong...
Logger.getRootLogger().log(Level.ERROR, "An error occured while storing a handin..."+ e.getMessage());
Logger.getLogger(this.getClass()).log(Level.ERROR, "An error occured while storing a handin..."+ e.getMessage());
//Delete from repository
//TODO: Possible delete the hand in activity folder for the event as well if it's empty

@ -81,7 +81,7 @@ public class HandInFeedbackControllerImpl implements HandInFeedbackController {
handIn.setStatus(oldStatus);
handInFeedbackDao.save(handIn.getFeedback());
handInDao.save(handIn);
Logger.getRootLogger().log(Level.ERROR, "Failed to store feedback " + e.getMessage());
Logger.getLogger(this.getClass()).log(Level.ERROR, "Failed to store feedback " + e.getMessage());
return false;
}
}

@ -1,11 +1,9 @@
package se.su.dsv.scipro.data.controllers.impl;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Properties;
import org.apache.wicket.PageParameters;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.protocol.http.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -32,7 +30,6 @@ import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
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.util.PropsUtils;
/**
* TODO Think this through and do it properly, this is a rush-job implemented
@ -65,7 +62,7 @@ public class NotificationControllerImpl implements NotificationController {
String systemFromName = generalSystemSettings.getMailFromName();
String systemFromEmail = generalSystemSettings.getSystemFromMail();
boolean sendMailEnabled = generalSystemSettings.isMailNotifications();
// Mailnotifications
// Mail notifications
if (sendMailEnabled) {
UserSettings userSettings = userSettingsDao.getUserSettings(usertoNotify);
if (userSettings == null) {
@ -112,7 +109,7 @@ public class NotificationControllerImpl implements NotificationController {
}
}
// Webnotifications
// Web notifications
WebNotification notification = new WebNotification();
notification.setUser(usertoNotify);
notification.setInfoText(notificationMessage.getWebNotificationMessage());
@ -120,86 +117,46 @@ public class NotificationControllerImpl implements NotificationController {
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;
/*
* String resources is available in file SciProApplication.properties.
*/
private String generateMail(String userFirstName, String addMessage,
String absoluteUrl) {
return new StringResourceModel("mailNotification", null, new Object[] {
userFirstName, addMessage, absoluteUrl }).getString();
}
@Override
public void notifyPrivateMessage(final User user, final String message,
final String url) {
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;
String webNotificationMessage = new StringResourceModel("pm.webNotification",
new Model<User>(SciProSession.get().getUser())).getString();
String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
String mailMessage = webNotificationMessage + mailBody;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
mailSubject, mailMessage);
processNotification(user, notificationMessage, url, NotificationPriority.MEDIUM);
}
@Override
public void notifyConferencePost(final User user, final String message,
final String messageboardTitle, final NotificationPriority notificationPriority,
final String absolutePath) {
final String url) {
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 quote = props.getProperty("quote");
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
+ quote + messageboardTitle + quote;
String mailMessage = webNotificationMessage + twoNewLines + message;
String webNotificationMessage = new StringResourceModel("conferencePost.webNotification",
new Model<User>(SciProSession.get().getUser()), new Object[] {messageboardTitle}).getString();
String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
String mailMessage = webNotificationMessage + mailBody;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, notificationPriority);
processNotification(user, notificationMessage, url, notificationPriority);
}
@Override
@ -207,69 +164,27 @@ public class NotificationControllerImpl implements NotificationController {
final NotificationPriority notificationPriority, final String title,
final String classId, 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;
String webNotificationMessage = new StringResourceModel("comment.webNotification",
new Model<User>(SciProSession.get().getUser()), new Object[] { title }).getString();
String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
String mailMessage = webNotificationMessage + mailBody;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath + "&" + classId,
processNotification(user, notificationMessage, absolutePath + "/cid/" + classId,
notificationPriority);
}
@Override
public void notifyReplyPrivateMessage(final User user, final String message,
final String absolutePath) {
Properties props = null;
try {
props = PropsUtils.load("notification.properties");
} catch (Exception e) {
e.printStackTrace();
}
String mailSubject = props.getProperty("mailSubject");
String privateMessageNotification = props.getProperty("privateMessageReplyNotification");
String twoNewLines = props.getProperty("twoNewLines");
String webNotificationMessage = SciProSession.get().getUser() + privateMessageNotification;
String mailMessage = webNotificationMessage + twoNewLines + message;
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, NotificationPriority.MEDIUM);
}
@Override
public void notifyFinalSeminarEdited(final User user,
final FinalSeminar finalSeminar, 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 finalSeminarReportEdited = props.getProperty("finalSeminarOppositionReportEdited");
String finalSeminarOppositionReportBeenEdited = props
.getProperty("finalSeminarOppositionReportBeenEdited");
String quote = props.getProperty("quote");
String webNotificationMessage = new StringResourceModel("finalSeminarEdit.webNotification", new Model<FinalSeminar>(finalSeminar)).getString();
String webNotificationMessage = finalSeminarReportEdited + quote
+ finalSeminar.getProject().getTitle() + quote
+ finalSeminarOppositionReportBeenEdited;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
String mailMessage = webNotificationMessage;
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
@ -279,37 +194,17 @@ public class NotificationControllerImpl implements NotificationController {
@Override
public void notifyCreateFinalSeminar(final User user,
final FinalSeminar finalSemniar, final NotificationPriority notificationPriority,
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
final String absolutePath, final boolean opponent) {
Properties props = null;
try {
props = PropsUtils.load("notification.properties");
} catch (Exception e) {
e.printStackTrace();
}
String created = props.getProperty("finalSeminarCreated");
String mailSubject = props.getProperty("mailSubject");
String project = "";
String webNotificationMessage = "";
if (!opponent) {
project = props.getProperty("finalSeminarProject");
webNotificationMessage = new StringResourceModel("finalSeminarCreated.webNotification", new Model<FinalSeminar>(finalSeminar), new Object[]{finalSeminar.getStartDate(), finalSeminar.getEndDate()}).getString();
} else {
project = props.getProperty("finalSeminarProjectOpponnent");
webNotificationMessage = new StringResourceModel("finalSeminarCreatedOpponent.webNotification", new Model<FinalSeminar>(finalSeminar), new Object[]{finalSeminar.getStartDate(), finalSeminar.getEndDate()}).getString();
}
String comma = props.getProperty("comma");
String space = props.getProperty("space");
String quote = props.getProperty("quote");
DateFormat dfFrom = new SimpleDateFormat("yyyy-MM-dd HH:mm");
DateFormat dfTo = new SimpleDateFormat("-HH:mm");
String webNotificationMessage = created + quote + finalSemniar.getProject().getTitle()
+ quote + project + finalSemniar.getRoom() + comma + space
+ dfFrom.format(finalSemniar.getStartDate())
+ dfTo.format(finalSemniar.getEndDate());
String mailMessage = webNotificationMessage;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
@ -321,108 +216,58 @@ public class NotificationControllerImpl implements NotificationController {
final FinalSeminar finalSeminar, 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 finalSeminarReportUploaded = props.getProperty("finalSeminarReportUploaded");
String finalSeminarReportBeenUploaded = props.getProperty("finalSeminarReportBeenUploaded");
String quote = props.getProperty("quote");
String webNotificationMessage = finalSeminarReportUploaded + quote
+ finalSeminar.getProject().getTitle() + quote + finalSeminarReportBeenUploaded;
String webNotificationMessage = new StringResourceModel("thesisUpload.webNotification",
new Model<FinalSeminar>(finalSeminar)).getString();
String mailMessage = webNotificationMessage;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, notificationPriority);
processNotification(user, notificationMessage, absolutePath, notificationPriority);
System.out.println(generateMail(user.getFirstName(), notificationMessage.getMailMessage(), absolutePath));
}
@Override
public void notifyOppositionUploaded(final User user,
final FinalSeminarOpposition opposition,
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 finalSeminarOppositionReportUploaded = props
.getProperty("finalSeminarOppositionReportUploaded");
String finalSeminarOppositionReportBeenUploaded = props
.getProperty("finalSeminarOppositionReportBeenUploaded");
String dot = props.getProperty("dot");
String quote = props.getProperty("quote");
String space = props.getProperty("space");
String webNotificationMessage = finalSeminarOppositionReportUploaded + quote
+ opposition.getFinalSeminar().getProject().getTitle() + quote
+ finalSeminarOppositionReportBeenUploaded
+ opposition.getOpponent().getUser().getFirstName() + space
+ opposition.getOpponent().getUser().getLastName() + dot;
String webNotificationMessage = new StringResourceModel("oppositionUpload.webNotification",
new Model<FinalSeminarOpposition>(opposition)).getString();
String mailMessage = webNotificationMessage;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, notificationPriority);
}
public void notifyAcceptOfReview(PeerRequest request, Student student, Project project) {
try {
Properties props = null;
String webNotificationMessage = new StringResourceModel("reviewAccepted.webNotification", null, new Object[]{student.getUser(), project.getProjectClass().getProjectClassSettings()
.getNumDaysToSubmitPeerReview()}).getString();
String mailSubject = new StringResourceModel("acceptPeerReviewSubject", null).getString();
props = PropsUtils.load("notification.properties");
User requestingUser = request.getRequester().getUser();
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();
String messageBody = requestAccepted
+ student.getUser().toString()
+ heShe
+ project.getProjectClass().getProjectClassSettings()
.getNumDaysToSubmitPeerReview() + complete;
String webNotificationMessage = requestAccepted + student.getUser().toString();
NotificationMessage notificationMessage = new NotificationMessage(
String messageBody = webNotificationMessage;
NotificationMessage notificationMessage = new NotificationMessage(
webNotificationMessage, mailSubject, messageBody);
PageParameters pp = new PageParameters();
PageParameters pp = new PageParameters();
String peerStatsUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
String peerStatsUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
.urlFor(ProjectPeerStatsPage.class, pp).toString());
processNotification(requestingUser, notificationMessage, peerStatsUrl,
processNotification(requestingUser, notificationMessage, peerStatsUrl,
NotificationPriority.MEDIUM);
} catch (Exception e) {
e.printStackTrace();
}
}
public void notifyCompletionOfReview(PeerReview review) {
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");
String mailSubject = new StringResourceModel("completedReviewSubject", null).getString();
PeerRequest peerRequest = review.getPeerRequest();
User requestingUser = peerRequest.getRequester().getUser();
@ -435,21 +280,26 @@ public class NotificationControllerImpl implements NotificationController {
.urlFor(SupervisorPeerReviewPage.class, pp).toString());
// Message for student when his/her review request is completed.
String messageBody = requestReviewed;
String webNotificationMessageForRequester = new StringResourceModel(
"reviewCompletedforRequester.webNotification",
new Model<PeerReview>(review)).getString();
NotificationMessage notificationMessage = new NotificationMessage(messageBody,
mailSubject, messageBody);
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessageForRequester,
mailSubject, webNotificationMessageForRequester);
processNotification(requestingUser, notificationMessage, reviewUrl,
NotificationPriority.MEDIUM);
// Message for supervisor of the project with a completed review.
messageBody = supervisorMessageBody + peerRequest.getProject().getTitle()
+ supervisorMessageBody2;
String webNotificationMessageForSupervisorOfProject = new StringResourceModel(
"reviewCompletedforRequestSupervisor.webNotification",
new Model<PeerReview>(review)).getString();
User requestSupervisor = peerRequest.getProject().getHeadSupervisor().getUser();
NotificationMessage notificationMessageSupervisorOfProject = new NotificationMessage(
messageBody, mailSubject, messageBody);
webNotificationMessageForSupervisorOfProject, mailSubject, webNotificationMessageForSupervisorOfProject);
processNotification(requestSupervisor, notificationMessageSupervisorOfProject,
supervisorReviewUrl, NotificationPriority.MEDIUM);
@ -457,36 +307,22 @@ public class NotificationControllerImpl implements NotificationController {
// Message for supervisor of the reviewer that have made a review
// for another project.
String webNotificationMessage = review.getReviewer().getUser().toString() + inProject
+ review.getProject().getTitle() + hasPerformed;
messageBody = supervisorMessageBody + review.getProject().getTitle()
+ commaWithLinebreak + review.getReviewer().getUser().toString()
+ supervisorMessageBody3;
String webNotificationMessageForSupervisorOfReviewer = new StringResourceModel(
"reviewCompletedforReviewSupervisor.webNotification",
new Model<PeerReview>(review)).getString();
User reviewSupervisor = review.getProject().getHeadSupervisor().getUser();
NotificationMessage notificationMessageSupervisorOfReviewer = new NotificationMessage(
webNotificationMessage, mailSubject, messageBody);
webNotificationMessageForSupervisorOfReviewer, mailSubject, webNotificationMessageForSupervisorOfReviewer);
processNotification(reviewSupervisor, notificationMessageSupervisorOfReviewer,
supervisorReviewUrl, NotificationPriority.MEDIUM);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* TODO Rewrite
*
* @param review
*/
public void notifyOfReviewRating(PeerReview review) {
try {
Properties props = null;
props = PropsUtils.load("notification.properties");
String mailSubject = props.getProperty("reviewRatedSubject");
String reviewRatedBody = props.getProperty("reviewRatedBody");
String webNotificationMessage = new StringResourceModel("reviewRated.webNotification", null).getString();
String mailSubject = new StringResourceModel("completedReviewSubject", null).getString();
User reviewingUser = review.getReviewer().getUser();
PageParameters pp = new PageParameters();
@ -494,16 +330,12 @@ public class NotificationControllerImpl implements NotificationController {
String projectReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
.urlFor(ProjectPeerReviewPage.class, pp).toString());
String messageBody = reviewRatedBody;
String mailMessage = webNotificationMessage;
NotificationMessage notificationMessage = new NotificationMessage(messageBody,
mailSubject, messageBody);
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
processNotification(reviewingUser, notificationMessage, projectReviewUrl,
NotificationPriority.MEDIUM);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -4,7 +4,6 @@ import java.util.List;
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
import se.su.dsv.scipro.data.dataobjects.User;
/**
* @author Johan Aschan - aschan@dsv.su.se
@ -17,4 +16,6 @@ public interface BoardMessageDao extends Dao<BoardMessage>{
final int count);
public int getBoardMessageListCount(final MessageBoard mb);
public int getBoardMessageSortOrderIndex(final BoardMessage bm);
}

@ -0,0 +1,7 @@
package se.su.dsv.scipro.data.dao.interfaces;
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
public interface CheckListAnswerDao extends Dao<CheckListAnswer> {
}

@ -0,0 +1,14 @@
package se.su.dsv.scipro.data.dao.interfaces;
import java.util.List;
import se.su.dsv.scipro.data.dataobjects.CheckList;
import se.su.dsv.scipro.data.dataobjects.Project;
import se.su.dsv.scipro.data.enums.CheckListRole;
public interface CheckListDao extends Dao<CheckList> {
public List<CheckList> findCheckLists(final Project project, CheckListRole role);
//use this if a dataview is necesary
//public int countCheckLists (final CheckList cl, Project project);
}

@ -0,0 +1,7 @@
package se.su.dsv.scipro.data.dao.interfaces;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
public interface CheckListQuestionDao extends Dao<CheckListQuestion> {
}

@ -0,0 +1,8 @@
package se.su.dsv.scipro.data.dao.interfaces;
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
public interface CheckListTemplateDao extends Dao<CheckListTemplate> {
}

@ -4,7 +4,6 @@
package se.su.dsv.scipro.data.dao.interfaces;
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;
/**
@ -15,6 +14,6 @@ import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
public interface MessageBoardDao extends Dao<MessageBoard>{
public MessageBoard getMessageBoard(Commentable commentableDomainObject);
public MessageBoard getMessageBoard(final Commentable commentableDomainObject);
}

@ -19,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
import se.su.dsv.scipro.data.dataobjects.User;
/**
* @author Johan Aschan - aschan@dsv.su.se
@ -44,7 +43,7 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
TypedQuery<BoardMessage> query = em
.createQuery(
"select bm FROM BoardMessage bm, MessageBoard mb " +
"WHERE bm member of mb.boardMessageSet AND mb = :mb ORDER BY bm.dateCreated DESC", BoardMessage.class);
"WHERE bm member of mb.boardMessages AND mb = :mb ORDER BY bm.dateCreated DESC", BoardMessage.class);
query.setHint(QueryHints.HINT_CACHEABLE, "true");
query.setParameter("mb", mb);
query.setFirstResult(first);
@ -68,7 +67,7 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
TypedQuery<Long> query = em
.createQuery(
"SELECT COUNT (bm) FROM BoardMessage bm, MessageBoard mb " +
"WHERE bm member of mb.boardMessageSet AND mb = :mb", Long.class);
"WHERE bm member of mb.boardMessages AND mb = :mb", Long.class);
query.setHint(QueryHints.HINT_CACHEABLE, "true");
query.setParameter("mb", mb);
return query.getSingleResult().intValue();
@ -77,6 +76,24 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
});
}
// Hibernate seemms not to support the index operator for the moment, but this query should be used if it does in the future.
@Override
@Transactional(readOnly = true)
public int getBoardMessageSortOrderIndex(final BoardMessage bm){
return getJpaTemplate().execute(new JpaCallback<Integer>() {
@Override
public Integer doInJpa(EntityManager em)
throws PersistenceException {
TypedQuery<Integer> query = em
.createQuery(
"SELECT index(b) FROM MessageBoard mb JOIN mb.boardMessages b " +
"WHERE b = :bm", Integer.class);
query.setHint(QueryHints.HINT_CACHEABLE, "true");
query.setParameter("bm", bm);
return query.getSingleResult().intValue();
}
});
}
}

@ -0,0 +1,23 @@
package se.su.dsv.scipro.data.dao.jpa;
import org.springframework.stereotype.Repository;
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
/**
*
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
@Repository("checkListAnswerDao")
public class CheckListAnswerDaoJPAImp extends AbstractDaoJPAImp<CheckListAnswer>
implements CheckListAnswerDao {
public CheckListAnswerDaoJPAImp() {
super(CheckListAnswer.class);
}
}

@ -0,0 +1,74 @@
package se.su.dsv.scipro.data.dao.jpa;
import java.util.ArrayList;
import java.util.Date;
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.joda.time.DateTime;
import org.springframework.orm.jpa.JpaCallback;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
import se.su.dsv.scipro.data.dataobjects.CheckList;
import se.su.dsv.scipro.data.dataobjects.Project;
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
import se.su.dsv.scipro.data.enums.CheckListRole;
/**
*
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
@Repository("checkListDao")
public class CheckListDaoJPAImp extends AbstractDaoJPAImp<CheckList> implements CheckListDao {
public CheckListDaoJPAImp() {
super(CheckList.class);
}
public List<CheckList> findCheckLists(final Project project, CheckListRole role) {
return getJpaTemplate().execute(new JpaCallback<List<CheckList>>() {
public List<CheckList> doInJpa(EntityManager em) throws PersistenceException {
String q = "select s " + "from CheckList s " + "where s.project = :project";
TypedQuery<CheckList> query = em.createQuery(q, CheckList.class);
query.setParameter("project", project);
query.setHint(QueryHints.HINT_CACHEABLE, "true");
try {
return query.getResultList();
} catch (NoResultException e) {
return new ArrayList<CheckList>();
}
}
});
}
//use this if a dataview is necesary
/*@Override
@Transactional(readOnly = true)
public int countCheckLists(final CheckList cl,final Project project) {
return getJpaTemplate().execute(new JpaCallback<Integer>() {
@Override
public Integer doInJpa(EntityManager em)
throws PersistenceException {
String q = "SELECT COUNT(cl) from CheckList cl WHERE cl.project = :p" ;
TypedQuery<Long> query = em.createQuery(q,
Long.class);
query.setHint(QueryHints.HINT_CACHEABLE, "true");
query.setParameter("p", project);
return (query.getSingleResult()).intValue();
}
});
}*/
}

@ -0,0 +1,21 @@
package se.su.dsv.scipro.data.dao.jpa;
import org.springframework.stereotype.Repository;
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
/**
*
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
@Repository("checkListQuestionDao")
public class CheckListQuestionDaoJPAImp extends AbstractDaoJPAImp<CheckListQuestion>
implements CheckListQuestionDao {
public CheckListQuestionDaoJPAImp() {
super(CheckListQuestion.class);
}
}

@ -0,0 +1,23 @@
package se.su.dsv.scipro.data.dao.jpa;
import org.springframework.stereotype.Repository;
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
/**
*
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
@Repository("checkListTemplateDao")
public class CheckListTemplateDaoJPAImp extends AbstractDaoJPAImp<CheckListTemplate>
implements CheckListTemplateDao {
public CheckListTemplateDaoJPAImp() {
super(CheckListTemplate.class);
}
}

@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
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.User;
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;

@ -7,14 +7,12 @@ import java.util.ArrayList;
import java.util.List;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
@ -48,9 +46,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
@OneToMany
private List<BoardMessage> replyMessageList = new ArrayList<BoardMessage>(0);
@ManyToOne(optional=false)
private MessageBoard messageBoard;
@Override
public Long getId() {
return id;
@ -65,20 +60,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
}
/**
* @return the messageBoard
*/
public MessageBoard getMessageBoard() {
return messageBoard;
}
/**
* @param messageBoard the messageBoard to set
*/
public void setMessageBoard(MessageBoard messageBoard) {
this.messageBoard = messageBoard;
}
@Override
public String getCommentKey() {
return BoardMessage.class.getCanonicalName().toString();
@ -140,8 +121,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
}
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;
}

@ -0,0 +1,137 @@
package se.su.dsv.scipro.data.dataobjects;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Sort;
import org.hibernate.annotations.SortType;
/**
*
* @author Fredrik Norberg fnorbe@dsv.su.se
*
*/
@Entity
@Table(name = "checklist")
@Cacheable(true)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
// Hibernate
public class CheckList extends DomainObject {
private static final long serialVersionUID = 2959377496669050427L;
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String name;
@ManyToOne(optional = false)
private Project project;
@OneToMany
@Sort(type = SortType.NATURAL)
private SortedSet<CheckListQuestion> questions = new TreeSet<CheckListQuestion>();
public CheckList() {
}
public CheckList(String name, Project project) {
this.name = name;
this.project = project;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
/**
* @return the questions
*/
public SortedSet<CheckListQuestion> getQuestions() {
return questions;
}
/**
* @param questions
* the questions to set
*/
public void setQuestions(SortedSet<CheckListQuestion> questions) {
this.questions = questions;
}
/**
* @return the project
*/
public Project getProject() {
return project;
}
/**
* @param project the project to set
*/
public void setProject(Project project) {
this.project = project;
}
@Override
public int hashCode() {
final int weight = 31;
int result = 17;
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CheckList) {
CheckList other = (CheckList) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
return false;
}
/**
* @return the name
*/
public String getName() {
return name;
}
}

@ -0,0 +1,124 @@
package se.su.dsv.scipro.data.dataobjects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
/**
* @author Fredrik Norberg fnorbe@dsv.su.se
*
*/
@Entity
@Table(name = "checklist_answer")
public class CheckListAnswer extends DomainObject {
private static final long serialVersionUID = 2959377496669050427L;
@Id
@GeneratedValue
private Long id;
@Enumerated(EnumType.STRING)
@Column(nullable=false)
private CheckListQuestionAnswer answer;
@ManyToOne(optional=false)
private User user;
@Lob
private String comment;
public CheckListAnswer() {
}
public CheckListAnswer(User user, CheckListQuestionAnswer answer) {
this.user = user;
this.answer = answer;
}
public CheckListAnswer(User user, CheckListQuestionAnswer answer, String comment) {
this.user = user;
this.answer = answer;
this.comment = comment;
}
public CheckListQuestionAnswer getAnswer() {
return answer;
}
public void setAnswer(CheckListQuestionAnswer answer) {
this.answer = answer;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* @return the comment
*/
public String getComment() {
return comment;
}
/**
* @param comment the comment to set
*/
public void setComment(String comment) {
this.comment = comment;
}
@Override
public int hashCode() {
final int weight = 31;
int result = 17;
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CheckListAnswer) {
CheckListAnswer other = (CheckListAnswer) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
return false;
}
}

@ -0,0 +1,133 @@
package se.su.dsv.scipro.data.dataobjects;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* @author Fredrik Norberg - fnorbe@dsv.su.se
*/
@Entity
@Table(name = "checklist_question")
@Cacheable(true)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CheckListQuestion extends DomainObject implements
Comparable<CheckListQuestion> {
private static final long serialVersionUID = 2959377496669050427L;
@Id
@GeneratedValue
private Long id;
@Lob
@Column(nullable = false)
private String question;
@Column(nullable = false)
private int questionNumber;
@OneToMany
private List<CheckListAnswer> answers = new ArrayList<CheckListAnswer>(1);
public CheckListQuestion() {
}
public CheckListQuestion(String question) {
this.question = question;
questionNumber = answers.size() + 1;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public int getQuestionNumber() {
return questionNumber;
}
public void setQuestionNumber(int questionNumber) {
this.questionNumber = questionNumber;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* @return the answers
*/
public List<CheckListAnswer> getAnswers() {
return answers;
}
/**
* @param answers the answers to set
*/
public void setAnswers(List<CheckListAnswer> answers) {
this.answers = answers;
}
@Override
public int hashCode() {
final int weight = 31;
int result = 17;
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CheckListQuestion) {
CheckListQuestion other = (CheckListQuestion) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
return false;
}
@Override
public String toString() {
return getQuestion();
}
@Override
public int compareTo(CheckListQuestion other) {
return other.questionNumber - questionNumber;
}
}

@ -0,0 +1,126 @@
package se.su.dsv.scipro.data.dataobjects;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
@Entity
@Table(name="checklist_template")
public class CheckListTemplate extends DomainObject {
private static final long serialVersionUID = 2959377496669050427L;
@Id
@GeneratedValue
private Long id;
@Column(nullable=false)
private String name;
@Lob
@ElementCollection
private List<String> questions = new ArrayList<String>(1);
@ManyToOne(optional=false)
private User creator;
@ManyToOne(optional=false)
private ProjectClass level;
public CheckListTemplate() {}
public CheckListTemplate(String name, User creator) {
this.name = name;
this.creator = creator;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setCreator(User creator) {
this.creator = creator;
}
public User getCreator() {
return creator;
}
public List<String> getQuestions(){
return questions;
}
public void setQuestions(List<String> questions){
this.questions = questions;
}
/**
* @return the level
*/
public ProjectClass getLevel() {
return level;
}
/**
* @param level the level to set
*/
public void setLevel(ProjectClass level) {
this.level = level;
}
@Override
public int hashCode() {
final int weight = 31;
int result = 17;
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CheckListTemplate){
CheckListTemplate other = (CheckListTemplate) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
return false;
}
}

@ -154,7 +154,17 @@ public abstract class Event extends LazyDeletableDomainObject
@Override
public int compareTo(Event other) {
return (int) (dueDate.getTime() - other.dueDate.getTime());
int dcomp = dueDate.compareTo(other.dueDate);
if (dcomp == 0){
if (id == null){
return -1;
}else if(other.id == null){
return 1;
}
else return id.compareTo(other.id);
}
return dcomp;
}
public Panel getDisplayPanel(String id){

@ -4,6 +4,7 @@
package se.su.dsv.scipro.data.dataobjects;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
@ -15,7 +16,10 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.OrderColumn;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
@ -70,32 +74,27 @@ public class MessageBoard extends DomainObject{
if(getCommentableKey().length() > 255)
throw new IllegalArgumentException("CommentThread-commentableKey may not be longer than 255 characters");
}
@OrderColumn(name="orderIndex")
@ManyToMany
private List<BoardMessage> boardMessages = new ArrayList<BoardMessage>();
@Sort(type=SortType.NATURAL)
@OneToMany(mappedBy="messageBoard", orphanRemoval=true, cascade=CascadeType.ALL, targetEntity=BoardMessage.class)
private SortedSet<BoardMessage> boardMessageSet = new TreeSet<BoardMessage>();
public List<BoardMessage> getBoardMessageList() {
return new ArrayList<BoardMessage>(boardMessageSet);
}
public SortedSet<BoardMessage> getBoardMessageSet() {
return boardMessageSet;
}
public void setBoardMessageSet( SortedSet<BoardMessage> boardMessageList) {
this.boardMessageSet = boardMessageList;
}
/**
* @return the commentableKey
*/
public String getCommentableKey() {
return commentableKey;
}
public void addToBoardMessages(BoardMessage boardMessage){
int pos = Collections.binarySearch(boardMessages, boardMessage);
if (pos < 0) {
pos = -pos - 1;
}
boardMessages.add(pos, boardMessage);
}
public void removeFromBoardMessages(BoardMessage boardMessage){
boardMessages.remove(boardMessage);
}
/**
* @param commentableKey the commentableKey to set
*/

@ -1,6 +1,8 @@
package se.su.dsv.scipro.data.dataobjects;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
@ -41,6 +43,7 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
private static final long serialVersionUID = 9071570648984376188L;
public static final String PP_PROJECT_ID = "pid";
@Id
@GeneratedValue
@ -82,6 +85,10 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
private String statusMessage = "";
private Date daisyStartDate;
@OneToMany(targetEntity=CheckList.class, cascade=CascadeType.ALL, orphanRemoval=true)
@Sort(type=SortType.NATURAL) //Required by hibernate
private List<CheckList> checkLists = new ArrayList<CheckList>();
public Project() {}
@ -208,6 +215,18 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
public List<CheckList> getCheckLists() {
return checkLists;
}
public void setCheckLists(List<CheckList> checkLists) {
this.checkLists = checkLists;
}
public void addCheckList(CheckList cl){
checkLists.add(cl);
}
@Override
public int hashCode() {
@ -268,6 +287,5 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
final public String getCommentKey() {
return Project.class.getCanonicalName().toString();
}
}

@ -0,0 +1,7 @@
package se.su.dsv.scipro.data.enums;
public enum CheckListQuestionAnswer {
RED,
GREEN,
YELLOW
}

@ -0,0 +1,7 @@
package se.su.dsv.scipro.data.enums;
public enum CheckListRole {
AUTHOR,
SUPERVISOR,
ADMIN
}

@ -40,7 +40,7 @@ public class DefaultUserFullLookup implements IUserLookup {
private Logger logger;
public DefaultUserFullLookup(){
logger = Logger.getRootLogger();
logger = Logger.getLogger(this.getClass());
}
/**

@ -39,7 +39,7 @@ public class DefaultUserLookup implements IUserLookup {
private Logger logger;
public DefaultUserLookup(){
logger = Logger.getRootLogger();
logger = Logger.getLogger(this.getClass());
}
/**

@ -33,7 +33,7 @@ public class ImportWorkerLookup {
private Logger logger;
public ImportWorkerLookup(){
logger = Logger.getRootLogger();
logger = Logger.getLogger(this.getClass());
}
public void lookup(Date updatedAfter, String type) throws IOException{

@ -71,7 +71,7 @@ public abstract class JsonResponseHandler implements IResponseHandler {
public JsonResponseHandler(){
super();
logger = Logger.getRootLogger();
logger = Logger.getLogger(this.getClass());
}

@ -52,7 +52,7 @@ public class RequestSender {
public RequestSender(IResponseHandler responseHandler, String url, Map<String, String> parameters, int requestType){
logger = Logger.getRootLogger();
logger = Logger.getLogger(this.getClass());
if(requestType != REQUEST_TYPE_GET && requestType != REQUEST_TYPE_POST){
logger.log(Level.ERROR, "Could not send request, no request type specified");

@ -89,7 +89,7 @@ public class ReplyMessageModel implements IClusterable {
r.setToUser(originalMessage.getFromUser());
r.setPrivateMessage(pm);
r = recipientDao.save(r);
notificationController.notifyReplyPrivateMessage(originalMessage.getFromUser(), getReplySubject() +"\n\n" + getReplyText(), PrivateMessagesPage.getAbsoluteURL());
notificationController.notifyPrivateMessage(originalMessage.getFromUser(), getReplySubject() +"\n\n" + getReplyText(), PrivateMessagesPage.getAbsoluteURL());
}

@ -2,78 +2,73 @@
<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<div wicket:id="titleContainer">
<strong>Project Title: </strong> <span wicket:id="projectTitle"></span>
<div>
<strong>Room: </strong> <span wicket:id="room"></span>
</div>
</div>
<div class="append-bottom">
<div>
<strong>Head supervisor:</strong>
</div>
<span wicket:id="headSupervisor"></span>
</div>
<div>
<strong>Author(s): </strong>
<ul class="no-list-style">
<li wicket:id="authorsList"><span wicket:id="author"></span></li>
</ul>
</div>
<wicket:panel>
<div wicket:id="feedback"></div>
<div wicket:id="titleContainer"><strong>Project Title: </strong>
<span wicket:id="projectTitle"></span>
<div><strong>Room: </strong> <span wicket:id="room"></span></div>
</div>
<div class="append-bottom">
<div><strong>Head supervisor:</strong></div>
<span wicket:id="headSupervisor"></span></div>
<div><strong>Author(s): </strong>
<ul class="no-list-style">
<li wicket:id="authorsList"><span wicket:id="author"></span></li>
</ul>
</div>
<div>
<strong>Co-supervisor(s): </strong>
<ul class="no-list-style">
<li wicket:id="coSupervisorsList"><span
wicket:id="coSupervisor"></span></li>
</ul>
</div>
<div><strong>Co-supervisor(s): </strong>
<ul class="no-list-style">
<li wicket:id="coSupervisorsList"><span wicket:id="coSupervisor"></span></li>
</ul>
</div>
<div>
<strong>Reviewer(s): </strong>
<ul class="no-list-style">
<li wicket:id="reviewersList"><span wicket:id="reviewer"></span>
</li>
</ul>
</div>
<div><strong>Reviewer(s): </strong>
<ul class="no-list-style">
<li wicket:id="reviewersList"><span wicket:id="reviewer"></span>
</li>
</ul>
</div>
<div wicket:id="detailsContainer">
<div>
<strong>Opponent(s): </strong>
<ul class="no-list-style">
<li wicket:id="opponentsList"><span wicket:id="opponent"></span>
</li>
</ul>
</div>
<div>
<strong>Active participant(s): </strong>
<ul class="no-list-style">
<li wicket:id="activeParticipantsList"><span
wicket:id="activeParticipant"></span></li>
</ul>
</div>
<div>
<strong>Presentation Language: </strong>
<div wicket:id="seminarLanguage"></div>
</div>
<div>
<strong>Thesis/Report Language: </strong>
<div wicket:id="thesisLanguage"></div>
</div>
<strong>Thesis/Report: </strong>
<div>
<span wicket:id="seminarReportTitle"></span> <span
wicket:id="uploadInfoContainer"> <a href="#"
wicket:id="open"><img
src="images/icons/document-preview_16x16.png" alt="Open/Preview" />
</a> <a href="#" wicket:id="download"><img
src="images/icons/download_16x16.png" alt="Download" /> </a> </span>
</div>
<div wicket:id="detailsContainer">
<div><strong>Opponent(s): </strong>
<ul class="no-list-style">
<li wicket:id="opponentsList"><span wicket:id="opponent"></span>
<div wicket:id="oppositionContainer"><strong>Report:</strong> <span wicket:id="oppositionReportTitle"></span> <a href="#"
wicket:id="open"><img
src="images/icons/document-preview_16x16.png" alt="Open/Preview" />
</a> <a href="#" wicket:id="download"><img
src="images/icons/download_16x16.png" alt="Download" /> </a> <a href="#"
wicket:id="deleteOppositionReport"><img
src="images/icons/delete_16x16.png" alt="delete" /> </a>
</div>
</wicket:panel>
</li>
</ul>
</div>
<div><strong>Active participant(s): </strong>
<ul class="no-list-style">
<li wicket:id="activeParticipantsList"><span
wicket:id="activeParticipant"></span></li>
</ul>
</div>
<div><strong>Presentation Language: </strong>
<div wicket:id="seminarLanguage"></div>
</div>
<div><strong>Thesis/Report Language: </strong>
<div wicket:id="thesisLanguage"></div>
</div>
<strong>Thesis/Report: </strong>
<div><span wicket:id="seminarReportTitle"></span> <span
wicket:id="uploadInfoContainer"> <a href="#" wicket:id="open"><img
src="images/icons/document-preview_16x16.png" alt="Open/Preview" /> </a>
<a href="#" wicket:id="download"><img
src="images/icons/download_16x16.png" alt="Download" /> </a> <a href="#"
wicket:id="deleteSeminarReport"><img
src="images/icons/delete_16x16.png" alt="delete" /> </a> </span></div>
</div>
</wicket:panel>
</body>
</html>

@ -3,16 +3,21 @@ package se.su.dsv.scipro.opponent.panels;
import java.util.ArrayList;
import java.util.List;
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.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.data.controllers.FinalSeminarUploadController;
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarDao;
import se.su.dsv.scipro.data.dao.interfaces.FinalSeminarOppositionDao;
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
import se.su.dsv.scipro.data.dataobjects.FinalSeminarActiveParticipation;
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
@ -23,6 +28,9 @@ import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
import se.su.dsv.scipro.repository.components.FileDownloadLink;
import se.su.dsv.scipro.repository.components.FileOpenLink;
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
import se.su.dsv.scipro.security.auth.roles.Roles;
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
public class FinalSeminarDetailsPanel extends Panel {
@ -30,11 +38,15 @@ public class FinalSeminarDetailsPanel extends Panel {
@SpringBean
private FinalSeminarDao finalSeminarDao;
@SpringBean
private FinalSeminarOppositionDao finalSeminarOppositionDao;
@SpringBean
private FinalSeminarUploadController finalSeminarUploadController;
public FinalSeminarDetailsPanel(final String id, final FinalSeminar seminar2,
final boolean details) {
public FinalSeminarDetailsPanel(final String id, final FinalSeminar seminar2, final boolean details) {
super(id);
this.setOutputMarkupId(true);
add(new FeedbackPanel("feedback"));
final FinalSeminar seminar = finalSeminarDao.reLoad(seminar2);
final Project project = seminar.getProject();
WebMarkupContainer titleContainer = new WebMarkupContainer("titleContainer") {
@ -53,8 +65,7 @@ public class FinalSeminarDetailsPanel extends Panel {
});
titleContainer.add(new Label("room", seminar.getRoom()));
add(titleContainer);
add(new ListView<Student>("authorsList", new ArrayList<Student>(
project.getProjectParticipants())) {
add(new ListView<Student>("authorsList", new ArrayList<Student>(project.getProjectParticipants())) {
private static final long serialVersionUID = 1L;
@Override
@ -111,41 +122,77 @@ public class FinalSeminarDetailsPanel extends Panel {
};
detailsContainer.add(new ListView<FinalSeminarOpposition>("opponentsList", seminar
.getOppositions()) {
detailsContainer.add(new ListView<FinalSeminarOpposition>("opponentsList", seminar.getOppositions()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<FinalSeminarOpposition> item) {
item.add(item.getModelObject().getOpponent().getUser()
.getDisplayComponent("opponent", true));
protected void populateItem(final ListItem<FinalSeminarOpposition> item) {
item.add(item.getModelObject().getOpponent().getUser().getDisplayComponent("opponent", true));
WebMarkupContainer oppCon = new WebMarkupContainer("oppositionContainer"){
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible(){
return item.getModelObject().getOpponentReport() != null;
}
};
//Students are not allowed to view other students opposition reports
MetaDataActionStrategy.authorize(oppCon, Roles.EMPLOYEE);
item.add(oppCon);
String reportTitle = "";
if(item.getModelObject().getOpponentReport() != null)
reportTitle = item.getModelObject().getOpponentReport().getName();
oppCon.add(new Label("oppositionReportTitle", reportTitle));
oppCon.add(new FileDownloadLink("download", item.getModelObject().getOpponentReport()));
oppCon.add(new FileOpenLink("open", item.getModelObject().getOpponentReport()));
oppCon.add(new AjaxLink<Void>("deleteOppositionReport"){
private static final long serialVersionUID = 1L;
{
MetaDataActionStrategy.authorize(this, Roles.ADMIN);
this.add(new JavascriptEventConfirmation("onclick", "Do you really want to delete this user-uploaded report?"));
}
@Override
public void onClick(AjaxRequestTarget target) {
try{
finalSeminarUploadController.deleteOpponentFiles(item.getModelObject());
FinalSeminarOpposition opp = item.getModelObject();
opp.setOpponentReport(null);
opp = finalSeminarOppositionDao.save(opp);
item.setModelObject(opp);
info("Opposition report deleted");
} catch(Exception e){
e.printStackTrace();
error("Something went wrong, see log files for stacktrace");
}
target.addComponent(FinalSeminarDetailsPanel.this);
}
});
add(item);
}
});
detailsContainer.add(new ListView<FinalSeminarActiveParticipation>(
"activeParticipantsList", seminar.getActiveParticipations()) {
detailsContainer.add(new ListView<FinalSeminarActiveParticipation>("activeParticipantsList", seminar.getActiveParticipations()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<FinalSeminarActiveParticipation> item) {
item.add(item.getModelObject().getUser()
.getDisplayComponent("activeParticipant", true));
item.add(item.getModelObject().getUser().getDisplayComponent("activeParticipant", true));
add(item);
}
});
detailsContainer.add(new Label("seminarLanguage", seminar.getPresentationLanguage()
.toString()));
detailsContainer.add(new Label("seminarLanguage", seminar.getPresentationLanguage().toString()));
detailsContainer.add(new Label("thesisLanguage", seminar.getReportLanguage().toString()));
detailsContainer.add(new Label("seminarReportTitle", new Model<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return seminar.getDocument() == null ? "No thesis/report uploaded" : seminar
.getDocument().getName();
return seminar.getDocument() == null ? "No thesis/report uploaded" : seminar.getDocument().getName();
}
}));
@ -161,6 +208,27 @@ public class FinalSeminarDetailsPanel extends Panel {
uploadInfoContainer.add(new FileDownloadLink("download", seminar.getDocument()));
uploadInfoContainer.add(new FileOpenLink("open", seminar.getDocument()));
uploadInfoContainer.add(new AjaxLink<Void>("deleteSeminarReport") {
private static final long serialVersionUID = 1L;
{
MetaDataActionStrategy.authorize(this, Roles.ADMIN);
this.add(new JavascriptEventConfirmation("onclick", "Do you really want to delete this user-uploaded report?"));
}
@Override
public void onClick(AjaxRequestTarget target) {
try {
finalSeminarUploadController.deleteSeminarReport(seminar, true);
seminar.setDocument(null); //Only to repaint the ajax call without the document icons
info("Report deleted");
} catch (Exception e) {
e.printStackTrace();
error("Deletion failed");
}
target.addComponent(FinalSeminarDetailsPanel.this);
}
});
detailsContainer.add(uploadInfoContainer);
add(detailsContainer);

@ -5,6 +5,7 @@
<wicket:panel>
<div class="span-22 prepend-top last">
<div wicket:id="feedback"></div>
<table class="rounded-table seminar-table even-rows">
<tr>
<th>Date</th>

@ -47,8 +47,8 @@ import se.su.dsv.scipro.opponent.models.OpponentModel;
public class OpponentListViewPanel extends Panel {
/**
*
*/
*
*/
private static final long serialVersionUID = 4988253889884804250L;
@SpringBean
@ -76,6 +76,10 @@ public class OpponentListViewPanel extends Panel {
super(id);
this.adminView = adminView;
loadListView(seminarList);
feedbackPanel = new FeedbackPanel("feedback");
add(feedbackPanel);
this.setOutputMarkupId(true);
editSeminarDialogContainer = new WebMarkupContainer("dialogContainer");
editSeminarDialog = new Dialog("dialog");
editSeminarDialog.setModal(true);
@ -96,7 +100,7 @@ public class OpponentListViewPanel extends Panel {
add(contactsSeminarDialog);
contactsDialogContainer.setOutputMarkupId(true);
contactsDialogContainer.add(contactsSeminarForm = new ContactsSeminarForm(
"contactsSeminarForm"));
"contactsSeminarForm"));
contactsSeminarForm.setOutputMarkupId(true);
add(linkListView);
@ -125,7 +129,7 @@ public class OpponentListViewPanel extends Panel {
User headSupervisor = seminar.getProject().getHeadSupervisor().getUser();
headSupervisorString += headSupervisor.getFirstName() + " "
+ headSupervisor.getLastName();
+ headSupervisor.getLastName();
item.add(new Label("headSupervisor", headSupervisorString));
item.add(new Label("projectClass", seminar.getProject().getProjectClass().getName()));
@ -191,20 +195,25 @@ public class OpponentListViewPanel extends Panel {
@Override
public void onClick(AjaxRequestTarget target) {
FinalSeminar seminar2 = finalSeminarDao.reLoad(seminar);
seminarUploadController.deleteSeminarFilesRecursive(seminar2);
for (FinalSeminarActiveParticipation al : seminar2
.getActiveParticipations()) {
finalSeminarActiveParticipationDao.delete(al);
}
try{
seminarUploadController.deleteSeminarReport(seminar2, true);
for (FinalSeminarActiveParticipation al : seminar2
.getActiveParticipations()) {
finalSeminarActiveParticipationDao.delete(al);
}
for (FinalSeminarOpposition fso : seminar2
.getOppositions()) {
seminarUploadController.deleteOpponentFiles(fso);
finalSeminarOppositionDao.delete(fso);
for (FinalSeminarOpposition fso : seminar2
.getOppositions()) {
seminarUploadController.deleteOpponentFiles(fso);
finalSeminarOppositionDao.delete(fso);
}
finalSeminarDao.delete(seminar2);
info("Final seminar deleted");
} catch (Exception e){
error("Something went wrong, see logs for stacktrace");
e.printStackTrace();
}
finalSeminarDao.delete(seminar2);
setResponsePage(AdminFinalSeminarPage.class);
target.addComponent(OpponentListViewPanel.this);
}
@Override
@ -227,7 +236,7 @@ public class OpponentListViewPanel extends Panel {
@Override
public CharSequence decorateScript(CharSequence script) {
String ret = "if(!confirm('The attendees of this seminar will NOT be notified that the seminar has been deleted, are you sure you wish to delete it?')) return false; "
+ script;
+ script;
return ret;
}
};
@ -243,8 +252,8 @@ public class OpponentListViewPanel extends Panel {
private class EditSeminarForm extends Form<OpponentModel> {
/**
*
*/
*
*/
private static final long serialVersionUID = -5004827722926732419L;
public EditSeminarForm(String name) {
@ -257,8 +266,8 @@ public class OpponentListViewPanel extends Panel {
private class EditForm extends Form<Void> {
/**
*
*/
*
*/
private static final long serialVersionUID = 5882957818616996808L;
public EditForm(String name, final FinalSeminar seminar) {
@ -290,8 +299,8 @@ public class OpponentListViewPanel extends Panel {
private class ContactsSeminarForm extends Form<OpponentModel> {
/**
*
*/
*
*/
private static final long serialVersionUID = -5004827722926732419L;
public ContactsSeminarForm(String name) {
@ -306,8 +315,8 @@ public class OpponentListViewPanel extends Panel {
private class ContactsForm extends Form<Void> {
/**
*
*/
*
*/
private static final long serialVersionUID = -8271761600388217566L;
public ContactsForm(String name, final FinalSeminar seminar) {
@ -316,8 +325,8 @@ public class OpponentListViewPanel extends Panel {
add(new AjaxButton("contacts", new Model<String>("Details")) {
/**
*
*/
*
*/
private static final long serialVersionUID = 1211337464815824507L;
@Override

@ -23,22 +23,15 @@ public class ProjectFinalSeminarContainerPanel extends Panel {
public ProjectFinalSeminarContainerPanel(final String id, final Project project, final boolean isSupervisorView){
super(id);
final List<FinalSeminar> seminars = finalSeminarDao.findFinalSeminarsByProject(project);
List<FinalSeminar> seminars = finalSeminarDao.findFinalSeminarsByProject(project);
if(isSupervisorView && !seminars.isEmpty() ){
if(isSupervisorView && seminars.isEmpty() ){
add(new OpponentPanel("addSeminar", project));
}
else {
add(new EmptyPanel("addSeminar"));
}
add(new Label("noSeminarsMessage", "No final seminar has been created for this project"){
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible(){
return seminars.size() == 0;
}
});
add(new Label("noSeminarsMessage", "No final seminar has been created for this project").setVisible(seminars.isEmpty()));
add(new ListView<FinalSeminar>("seminarList", seminars){
private static final long serialVersionUID = 1L;

@ -221,7 +221,7 @@ public class ProjectFinalSeminarPanel extends Panel {
public boolean isVisible() {
return !isSupervisorView && seminar.getActiveParticipations().isEmpty()
&& seminar.getOppositions().isEmpty() && seminar.getTurnitinId() != null;
&& seminar.getOppositions().isEmpty() && seminar.getTurnitinId() == null;
}
@Override

@ -237,7 +237,7 @@ public class PeerPortalControllerImpl implements PeerPortalController {
return review;
} catch (Exception e) {
Logger.getRootLogger().log(Level.ERROR,
Logger.getLogger(this.getClass()).log(Level.ERROR,
"Error while accepting peer request: " + e.getMessage());
if (review.getId() != null) {
// Something must have gone wrong while updating request status
@ -286,7 +286,7 @@ public class PeerPortalControllerImpl implements PeerPortalController {
return peerRequestDao.save(request);
}
} catch (Exception e) {
Logger.getRootLogger().log(Level.ERROR,
Logger.getLogger(this.getClass()).log(Level.ERROR,
"Error while storing Peer Request: " + e.getMessage());
if (request.getId() != null) {
peerRequestDao.delete(request);
@ -328,7 +328,7 @@ public class PeerPortalControllerImpl implements PeerPortalController {
review.setFile(fdesc.get(0));
return true;
} catch (Exception e) {
Logger.getRootLogger().log(Level.ERROR,
Logger.getLogger(this.getClass()).log(Level.ERROR,
"Error while storing file for peer review: " + e.getMessage());
if (review.getFile() != null) {
// Clean up the repository

@ -4,9 +4,12 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.components.AbstractMenuPanel;
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
import se.su.dsv.scipro.data.dataobjects.Project;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.exceptions.AccessDeniedException;
@ -20,6 +23,9 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
@Authorization(authorizedRoles={Roles.SYSADMIN}) //TODO Hidden for initial deployment
public abstract class AbstractProjectPeerPage extends ProjectPage {
@SpringBean
private GeneralSystemSettingsDao generalSystemSettingsDao;
public AbstractProjectPeerPage(final PageParameters pp) {
super(pp);
@ -45,7 +51,7 @@ public abstract class AbstractProjectPeerPage extends ProjectPage {
}
protected void checkAccessPrivileges(final PeerReview peerReview) {
GeneralSystemSettings gsettings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
final Project requestingProject = peerReview.getPeerRequest().getProject();
final User user = SciProSession.get().getUser();
if( SciProSession.get().authorizedForRole(Roles.SYSADMIN) ) //Can view any review
@ -55,6 +61,8 @@ public abstract class AbstractProjectPeerPage extends ProjectPage {
final Project reviewingProject = peerReview.getProject();
if( projectDao.isPartOf(user, reviewingProject) )
return;
if(gsettings.isPublicReviewsActivated())
return;
//If we've come this far, the user doesn't have access to the project and it's reviews
throw new AccessDeniedException(this);
}

@ -21,9 +21,9 @@ public abstract class AbstractSupervisorPeerPage extends AbstractSupervisorPage
@Override
protected List<MenuItem> getItemList() {
final List<MenuItem> items = new ArrayList<MenuItem>();
items.add(new MenuItem("My projects", SupervisorPeerStatsPage.class, MenuHighlightReviewPage.class, ImageIcon.ICON_STATISTICS));
final List<MenuItem> items = new ArrayList<MenuItem>();
items.add(new MenuItem("Peer portal", SupervisorPeerPortalPage.class, ImageIcon.ICON_FIND));
items.add(new MenuItem("My projects", SupervisorPeerStatsPage.class, MenuHighlightReviewPage.class, ImageIcon.ICON_STATISTICS));
items.add(new MenuItem("How to write a good review", SupervisorPeerReviewGuidePage.class, ImageIcon.ICON_HELP));
return items;
}

@ -1,86 +1,102 @@
<!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>
<wicket:extend>
<div class="span-22">
<div wicket:id="feedbackPanel"></div>
<form wicket:id="requestForm" class="wizard-form">
<div class="span-22 last">
<div class="span-11 colborder">
<div>
<fieldset>
<legend>Step 1 - Read instructions</legend>
<p>The instructions are located in the box to the right</p>
</fieldset>
<fieldset>
<legend wicket:id="fileUploadLabel">[Step 2 - Attach a file]</legend>
<input wicket:id="fileUpload" type="file" />
</fieldset>
<fieldset>
<legend>Step 3 - Write review guideline/comment (optional)</legend>
<textarea wicket:id="comment"></textarea>
</fieldset>
</div>
</div>
<div class="span-8 last info-box rounded-box">
<ul>
<li><p>Providing a review template is of great help for the reviewer, browse available templates and try to find an appropriate one!</p></li>
<li><p>If you cannot find an suitable review template, make sure to use the review guideline/comment to point out what you'd like feedback on.</p></li>
<li><p>If a review template covers too much, make sure to point out questions that you don't feel like they apply</p></li>
<li><p>If you're missing relevant questions in the review template, make sure to mention them in the comment.</p></li>
<li><p>If you have several files you'd like to attach, compress them to an archived file (ie. zip-file).</p></li>
<li><p><strong>Remember that the more guidelines (review template, questions you'd like answered etc.) you provide the reviewer, the greater the chance of a useful review!</strong></p></li>
</ul>
<wicket:extend>
<div class="span-22">
<div wicket:id="feedbackPanel"></div>
<form wicket:id="requestForm" class="wizard-form">
<div class="span-22">
<div>
<h5 class="peer-title">Step 1 - Read instructions</h5>
<ul>
<li>Providing a review template is of great help for the
reviewer, browse available templates and try to find an
appropriate one!</li>
<li>If you cannot find an suitable review template, make
sure to use the review guideline/comment to point out what you'd
like feedback on.</li>
<li>If a review template covers too much, make sure to point
out questions that you don't feel like they apply</li>
<li>If you're missing relevant questions in the review
template, make sure to mention them in the comment.</li>
<li>If you have several files you'd like to attach, compress
them to an archived file (ie. zip-file).</li>
<li>Remember that the more guidelines (review template,
questions you'd like answered etc.) you provide the reviewer,
the greater the chance of a useful review!</li>
</ul>
</div>
<div class="span-22 forcedPaddingBottom">
<div class="span-11 first">
<h5 class="peer-title" wicket:id="fileUploadLabel">[Step 2 -
Attach a file]</h5>
<input wicket:id="fileUpload" type="file" style="margin-top:2em;"/>
</div>
<div class="span-11 last">
<h5 class="peer-title">Step 3 - Write review
guideline/comment (optional)</h5>
<textarea wicket:id="comment"></textarea>
</div>
</div>
</div>
</div>
<div class="span-22 last">
<fieldset>
<legend>Step 4 - Select a suitable review template (optional)</legend>
<div wicket:id="listContainer">
<table class="rounded-table">
<tr>
<th>Select</th>
<th>Name</th>
<th>Description</th>
<th>Questions</th>
<th>Preview</th>
</tr>
<tr>
<td colspan="5"><i><span wicket:id="noTemplatesFoundMsg"></span></i></td>
</tr>
<tr wicket:id="templateList">
<td><a wicket:id="selectTemplateLink" href="#">Select</a></td>
<td><span wicket:id="templateName"></span></td>
<td><div class="span-8"><span wicket:id="templateDescription"></span></div></td>
<td><span wicket:id="templateNumQuestions"></span></td>
<td><a href="#" wicket:id="previewTemplateLink">Preview</a></td>
</tr>
<tr><td wicket:id="pager" colspan="5"></td></tr>
</table>
</div>
<div wicket:id="selectedTemplateContainer">
<strong>Selected template: </strong>
<span wicket:id="selectedTemplate"></span>
<a href="#" wicket:id="unSelectTemplateLink">
<img class="icon-12" src="images/icons/delete_16x16.png" alt="Unselect template"/> Unselect
</a>
</div>
</fieldset>
<fieldset>
<legend>Step 5 - Submit your request</legend>
<div wicket:id="feedbackPanel">
<!-- The feedback panel -->
</div>
<div>
<button wicket:id="sendRequestButton" class="button">Submit your request for review
<img src="css/blueprint/plugins/buttons/icons/tick.png" alt=""/>
<div class="span-22">
<h5 class="peer-title">Step 4 - Select a suitable review
template (optional)</h5>
<div wicket:id="listContainer">
<table class="rounded-table">
<tr>
<th>Select</th>
<th>Name</th>
<th>Description</th>
<th>Questions</th>
<th>Preview</th>
</tr>
<tr>
<td colspan="5"><i><span
wicket:id="noTemplatesFoundMsg"></span>
</i>
</td>
</tr>
<tr wicket:id="templateList">
<td><a wicket:id="selectTemplateLink" href="#">Select</a>
</td>
<td><span wicket:id="templateName"></span>
</td>
<td><div class="span-8">
<span wicket:id="templateDescription"></span>
</div>
</td>
<td><span wicket:id="templateNumQuestions"></span>
</td>
<td><a href="#" wicket:id="previewTemplateLink"><img src="images/icons/document-preview_16x16.png" class="icon-16" alt="Preview template"/></a>
</td>
</tr>
<tr>
<td wicket:id="pager" colspan="5"></td>
</tr>
</table>
</div>
<div wicket:id="selectedTemplateContainer" class="forcedPaddingBottom">
<strong>Selected template: </strong> <span
wicket:id="selectedTemplate"></span> <a href="#"
wicket:id="unSelectTemplateLink"> <img class="icon-12"
src="images/icons/delete_16x16.png" alt="Unselect template" />
Unselect </a>
</div>
<h5 class="peer-title">Step 5 - Submit your request</h5>
<div wicket:id="feedbackPanel">
<!-- The feedback panel -->
</div>
<div>
<button wicket:id="sendRequestButton" class="button">
Submit your request for review <img
src="css/blueprint/plugins/buttons/icons/tick.png" alt="" />
</button>
</div>
</fieldset>
</div>
</form>
</div>
</wicket:extend>
</div>
</div>
</form>
</div>
</wicket:extend>
</body>
</html>

@ -2,6 +2,10 @@ package se.su.dsv.scipro.peer.pages;
import org.apache.wicket.PageParameters;
import se.su.dsv.scipro.security.auth.Authorization;
import se.su.dsv.scipro.security.auth.roles.Roles;
@Authorization(authorizedRoles={Roles.SYSADMIN})
public class ProjectPeerReviewGuidePage extends AbstractProjectPeerPage {
public ProjectPeerReviewGuidePage(PageParameters pp) {

@ -2,6 +2,10 @@ package se.su.dsv.scipro.peer.pages;
import org.apache.wicket.PageParameters;
import se.su.dsv.scipro.security.auth.Authorization;
import se.su.dsv.scipro.security.auth.roles.Roles;
@Authorization(authorizedRoles={Roles.SYSADMIN})
public class SupervisorPeerReviewGuidePage extends AbstractSupervisorPeerPage {
public SupervisorPeerReviewGuidePage(PageParameters pp) {

@ -89,7 +89,7 @@
<span class="box-title">Best rated reviewers</span>
<div wicket:id="bestRatedPanel" class="append-bottom"></div>
</div>
<div>
<div wicket:id="statsTimespanContainer">
<i><span class="small right">Last 12 months</span></i>
</div>
</div>

@ -221,16 +221,23 @@ public class PeerPortalPanel extends Panel {
int displayedReviews = gsettings.getNumberOfLatestReviewsDisplayed();
boolean showStatsTimespan = false;
if(gsettings.isPeerDisplayNumberOfReviewsPerformed()){
add(new MostFrequentReviewersPanel(mostFrequentPanel));
showStatsTimespan = true;
} else {
add(new InvisiblePanel(mostFrequentPanel));
}
if( gsettings.isPeerRatingsEnabled() ){
add(new WebMarkupContainer(bestRatedContainer).add(new BestRatedReviewersPanel("bestRatedPanel") ) );
showStatsTimespan = true;
} else {
add(new InvisiblePanel(bestRatedContainer));
}
WebMarkupContainer statsTimespanContainer = new WebMarkupContainer("statsTimespanContainer");
statsTimespanContainer.setVisible(showStatsTimespan);
add(statsTimespanContainer);
if(gsettings.isPeerDisplayLatestReviews()) {
// Checkbox on the AdminPeerSettingsPage is not visible since it's
// not decided what kind of info that should be public for students.

@ -6,7 +6,7 @@
<body>
<wicket:panel>
<div class="append-bottom">
<h6>Requests with completed reviews</h6>
<h6>Completed reviews</h6>
<i wicket:id="noReceivedReviewsCompletedMessage"></i>
<ul class="no-list-style small">
<li wicket:id="receivedReviewsCompleted">
@ -20,7 +20,7 @@
</div>
<div class="append-bottom">
<h6>Requests with reviews in progress</h6>
<h6>In progress</h6>
<i wicket:id="noReceivedReviewsInProgressMessage"></i>
<ul class="no-list-style small">
<li wicket:id="receivedReviewsInProgress">
@ -34,7 +34,7 @@
</div>
<div class="append-bottom">
<h6>Requests waiting to be accepted</h6>
<h6>Awaiting review</h6>
<div wicket:id="peerInfoRequestsFeedback"></div>
<i wicket:id="noAwaitingAcceptMsg"></i>
<ul class="no-list-style small">

@ -6,7 +6,7 @@
<body>
<wicket:panel>
<div class="append-bottom">
<h6>Reviews completed</h6>
<h6>Completed</h6>
<i wicket:id="noAcceptedReviewsCompletedMessage"></i>
<ul class="no-list-style small">
<li wicket:id="acceptedReviewsCompleted">
@ -19,7 +19,7 @@
</div>
<div class="append-bottom">
<h6>Reviews in progress</h6>
<h6>In progress</h6>
<i wicket:id="noAcceptedInProgressMessage"></i>
<ul class="no-list-style small">
<li wicket:id="acceptedInProgress">
@ -32,7 +32,7 @@
</div>
<div>
<h6>Reviews aborted: <span wicket:id="abortedReviews"></span></h6>
<h6>Aborted: <span wicket:id="abortedReviews"></span></h6>
</div>
</wicket:panel>
</body>

@ -43,7 +43,7 @@ public class ExpiredReviewResetWorker extends AbstractWorker {
Date expirationDate = new DateTime().minusDays(settings.getNumDaysToSubmitPeerReview()).toDate();
if( peerReview.getDateCreated().compareTo( expirationDate ) < 0 ) {
Logger logger = Logger.getRootLogger();
Logger logger = Logger.getLogger(this.getClass());
logger.log(Level.INFO,"Expiring peerReview: "+peerReview+" and making "+peerRequest+" available for review again");
peerReview.setAborted(true);

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:extend>
<!-- <div wicket:id="trafficLightPanel"></div> -->
<!-- <div wicket:id="createCheckList"></div> -->
</wicket:extend>
</body>
</html>

@ -0,0 +1,27 @@
package se.su.dsv.scipro.project.pages;
import org.apache.wicket.PageParameters;
import se.su.dsv.scipro.SciProSession;
import se.su.dsv.scipro.checklists.panels.ListCheckListPanel;
import se.su.dsv.scipro.data.enums.CheckListRole;
import se.su.dsv.scipro.security.auth.Authorization;
import se.su.dsv.scipro.security.auth.roles.Roles;
/**
* @author Fredrik Norberg - fnorbe@dsv.su.se
*
*/
@Authorization(authorizedRoles={Roles.SYSADMIN})
public class ProjectChecklistPage extends ProjectPage {
public ProjectChecklistPage(PageParameters pp) {
super(pp);
add(new ListCheckListPanel("listCheckListPanel", CheckListRole.AUTHOR,
SciProSession.get().getActiveProject()));
//add(new TrafficLightPanel("trafficLightPanel"));
//add(new CreateCheckListTemplatePanel("createCheckList"));
}
}

@ -27,6 +27,7 @@ public abstract class ProjectPage extends MenuPage implements FilePanelContainer
public ProjectPage(PageParameters pp) {
Project activeProject = SciProSession.get().getActiveProject();
User u = SciProSession.get().getUser();
if(activeProject == null && (this.getClass() != NoActiveProjectPage.class && this.getClass() != ProjectPartnerPage.class)){
User user = SciProSession.get().getUser();

@ -7,7 +7,6 @@
<div class="span-22 last">
<div wicket:id=feedback></div>
<!-- Left column -->
<div class="span-10 colborder">
<div class="span-10 last">
<h5 class="peer-title">Look for project partner</h5>

@ -59,7 +59,6 @@ public class ProjectPartnerPage extends ProjectPage {
private DataView<ProjectPartner> dataView;
private WebMarkupContainer wmc;
private IModel<List<ProjectPartner>> listModel;
private RadioChoice<ProjectClass> degreeChoice;
private RadioChoice<ProjectClass> showChoice;
@ -76,7 +75,7 @@ public class ProjectPartnerPage extends ProjectPage {
settings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
choices = new ArrayList<ProjectClass>();
days = settings.getProjectPartnerDaysToLive();
setDays(settings.getProjectPartnerDaysToLive());
ProjectClass bachelor = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
choices.add(bachelor);
choices.add(projectClassDao.getProjectClass(ProjectClass.MASTER));
@ -142,7 +141,6 @@ public class ProjectPartnerPage extends ProjectPage {
private void loadListView(ProjectPartnerDataProvider projectPartnerDataProvider){
dataView = new DataView<ProjectPartner>("list", projectPartnerDataProvider, 5 ){
//wmc.add(new ListView<ProjectPartner>("list", new PropertyModel<List<ProjectPartner>>(this, "ProjectPartnerDao.getProjectPartner")){
@ -160,5 +158,13 @@ public class ProjectPartnerPage extends ProjectPage {
}
};
}
public int getDays() {
return days;
}
public void setDays(int days) {
this.days = days;
}
}

@ -18,6 +18,7 @@ import se.su.dsv.scipro.project.pages.ProjectPage;
import se.su.dsv.scipro.project.pages.ProjectPartnerPage;
import se.su.dsv.scipro.project.pages.ProjectSchedulePlannerPage;
import se.su.dsv.scipro.project.pages.ProjectStartPage;
import se.su.dsv.scipro.project.pages.ProjectChecklistPage;
import se.su.dsv.scipro.repository.panels.ProjectFilePanel;
/**
@ -47,6 +48,7 @@ public class ProjectTabMenuPanel extends AbstractMenuPanel {
itemList.add(new MenuItem("Peer review", ProjectPeerPortalPage.class));
itemList.add(new MenuItem("All Final Seminars", FinalSeminarProjectListPage.class));
itemList.add(new MenuItem("Conference", ProjectConferencePage.class));
itemList.add(new MenuItem("Checklists", ProjectChecklistPage.class));
} else {
itemList.add(new MenuItem("No active project!", NoActiveProjectPage.class));
itemList.add(new MenuItem("Project Partner", ProjectPartnerPage.class));
@ -56,7 +58,7 @@ public class ProjectTabMenuPanel extends AbstractMenuPanel {
@Override
protected MenuType getMenuType() {
return MenuType.TAB;
return MenuType.TAB_MULTIPLE_ROWS;
}
}

Binary file not shown.

Before

(image error) Size: 852 B

After

(image error) Size: 2.5 KiB

Binary file not shown.

Before

(image error) Size: 829 B

After

(image error) Size: 3.4 KiB

@ -64,7 +64,7 @@
<tbody>
<tr>
<td></td>
<td><a href="#" wicket:id="up">[..]</a></td>
<td><a href="#" wicket:id="up"><img src="images/icons/daisyIcons/plain/folder_up.png" class="icon-24" alt="Parent folder"/></a></td>
</tr>
</tbody>
@ -72,7 +72,7 @@
<tr wicket:id="content">
<td><a href="delete" wicket:id="delete"><img src="images/icons/edit-delete_16x16.png" alt="X" /></a></td>
<td><a href="#" wicket:id="link"><img wicket:id="folderIcon" src="#" alt="folderIcon" /> <span wicket:id="name">name</span></a></td>
<td><a href="#" wicket:id="link"><img wicket:id="folderIcon" src="#" alt="folderIcon" class="icon-24"/> <span wicket:id="name">name</span></a></td>
<td><span wicket:id="created"></span></td>
</tr>
</tbody>

@ -39,7 +39,7 @@ public class Authenticator {
//Catch exceptions if
} catch (LoginException le){
Logger logger = Logger.getRootLogger();
Logger logger = Logger.getLogger(this.getClass());
logger.log(Level.ERROR, "System error, Failed to create logincontext:" + le.getMessage());
throw le;
} catch (SecurityException se){

@ -1,20 +0,0 @@
package se.su.dsv.scipro.wiquery.mainmenu;
import org.apache.wicket.markup.html.resources.JavascriptResourceReference;
public class MainMenuJavascriptResourceReference extends
JavascriptResourceReference {
private static final long serialVersionUID = -5062441830192125794L;
private static MainMenuJavascriptResourceReference INSTANCE =
new MainMenuJavascriptResourceReference();
private MainMenuJavascriptResourceReference() {
super(MainMenuJavascriptResourceReference.class, "jquery.mainmenu.js");
}
public static MainMenuJavascriptResourceReference get() {
return INSTANCE;
}
}

@ -1,49 +0,0 @@
$(document).ready(function() {
$("img.nav-arrow").click(function() {
var parent = $(this).parents(".parent");
if (parent != null)
showMenu(parent);
})
.mouseover(function() {
//$(this).attr("src", "./images/site_nav_arrow_hover.png");
})
.mouseout(function() {
//$(this).attr("src", "./images/site_nav_arrow.png");
});
$(document).click(function(e) {
if ($(e.target).parents("#nav-list").length == 0) {
closeMenus(null);
}
});
$(document).mouseover(function(e) {
if ($(e.target).parents("#main-nav").length == 0) {
closeMenus(null);
}
});
addCurrentClassToIdentifier = function(identifier) {
var t = $("#nav-list").find(identifier).parents(".nav-list-item").get(0);
$(t).addClass("current");
};
closeMenus = function(node) {
$("#nav-list .parent").children(".over").each(function() {
if (this != node || node == null) {
$(this).removeClass("over");
}
});
};
showMenu = function(node) {
var thisMenu = $(node);
var isActive = $(node).find("div.submenu").hasClass("over");
closeMenus(thisMenu);
if (!isActive) {
thisMenu.find("div.submenu").toggleClass("over");
}
};
addCurrentClassToIdentifier("#current");
});

@ -105,7 +105,7 @@ public abstract class AbstractWorker extends Thread {
this.commitTransaction();
} catch ( Exception e ){
this.rollbackTransaction();
Logger logger = Logger.getRootLogger();
Logger logger = Logger.getLogger(this.getClass());
logger.log(Level.ERROR, getNameString(this.getClass())+" failed to save it's workerdata!");
}

Some files were not shown because too many files have changed in this diff Show More