Conflitct fixes
This commit is contained in:
commit
cfabfec340
pom.xml
src
main
java/se/su/dsv/scipro
admin/pages
basepages
components
data
dao
dataobjects
peer
data/dao
interfaces
pages
AbstractProjectPeerPage.javaAbstractSupervisorPeerPage.javaProjectPeerReviewPage.javaSupervisorPeerReviewPage.java
panels
project
repository
schedule/baseevent/panels
util/xml
resources/META-INF
webapp
test/java/se/su/dsv/scipro
9
pom.xml
9
pom.xml
@ -21,7 +21,6 @@
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- WICKET DEPENDENCIES -->
|
||||
<dependency>
|
||||
@ -34,7 +33,13 @@
|
||||
<artifactId>wicket-spring</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Servlet API, needed for compilation. -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- LOGGING DEPENDENCIES - LOG4J -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
@ -56,7 +56,5 @@ public class AdminProjectPartnerPage extends AbstractAdminPage {
|
||||
|
||||
|
||||
}
|
||||
|
||||
//generalsystemsettings för att spara datum
|
||||
|
||||
}
|
||||
|
@ -14,9 +14,17 @@
|
||||
<td><input type="checkbox" wicket:id="peerRatingsEnabled" name="peerRatingsEnabled"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="peerDisplayNumberOfReviewsPerformed">Display users number of reviews performed on portal page</label></td>
|
||||
<td><label for="peerDisplayNumberOfReviewsPerformed">Display users number of reviews performed on portal page:</label></td>
|
||||
<td><input type="checkbox" wicket:id="peerDisplayNumberOfReviewsPerformed" name="peerDisplayNumberOfReviewsPerformed"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="peerDisplayLatestReviews">Display the latest submitted reviews on portal page:</label></td>
|
||||
<td><input type="checkbox" wicket:id="peerDisplayLatestReviews" name="peerDisplayLatestReviews"></td>
|
||||
</tr>
|
||||
<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>
|
||||
</table>
|
||||
</form>
|
||||
<h5 class="peer-title">Settings for levels</h5>
|
||||
|
@ -59,17 +59,36 @@ public class AdminPeerSettingsPage extends AbstractAdminSettingsPage {
|
||||
|
||||
private class PeerRatingsSettingsForm extends Form<GeneralSystemSettings> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private TextField<Integer> numberOfLatestReviewsDisplayed;
|
||||
|
||||
public PeerRatingsSettingsForm(String id, IModel<GeneralSystemSettings> model) {
|
||||
super(id, model);
|
||||
|
||||
CheckBox peerRatingsEnabled = new CheckBox("peerRatingsEnabled");
|
||||
add(peerRatingsEnabled);
|
||||
CheckBox peerDisplayNumberOfReviewsPerformed = new CheckBox("peerDisplayNumberOfReviewsPerformed");
|
||||
add(peerDisplayNumberOfReviewsPerformed);
|
||||
add(peerDisplayNumberOfReviewsPerformed);
|
||||
CheckBox peerDisplayLatestReviews = new CheckBox("peerDisplayLatestReviews");
|
||||
add(peerDisplayLatestReviews);
|
||||
|
||||
numberOfLatestReviewsDisplayed =
|
||||
new TextField<Integer>("numberOfLatestReviewsDisplayed");
|
||||
numberOfLatestReviewsDisplayed.setRequired(true);
|
||||
add(numberOfLatestReviewsDisplayed);
|
||||
|
||||
// Checkbox for activating/inactiviting links to reviews in the Latest reviewers panel.
|
||||
//
|
||||
/*CheckBox publicReviewsActivated = new CheckBox("publicReviewsActivated");
|
||||
add(publicReviewsActivated);*/
|
||||
}
|
||||
@Override
|
||||
public void onSubmit(){
|
||||
setModelObject(generalSystemSettingsDao.save(getModelObject()));
|
||||
if (getModelObject().getNumberOfLatestReviewsDisplayed() == 0) {
|
||||
warn("Number of reviews to show has been changed to 1. If you don't want to show any reviews, please hide the panel.");
|
||||
getModelObject().setNumberOfLatestReviewsDisplayed(1);
|
||||
}
|
||||
setModelObject(generalSystemSettingsDao.save(getModelObject()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
<!--[if IE 9]> <html class="ie ie9 lte9"> <![endif]-->
|
||||
<!--[if gt IE 9]> <html> <![endif]-->
|
||||
<!--[if !IE]><!-->
|
||||
<html lang="en" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<html lang="en"
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@ -27,13 +28,26 @@
|
||||
<!-- <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 || [];
|
||||
_gaq.push(['_setAccount', 'UA-24546333-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="ajax-loader" style="display: none;"><img src="images/ajax-loader.gif" class="ajax-loader-image" alt="" /></div>
|
||||
<div id="ajax-loader" style="display: none;"><img
|
||||
src="images/ajax-loader.gif" class="ajax-loader-image" alt="" /></div>
|
||||
<div wicket:id="systemNotice" id="system-notice"></div>
|
||||
<div class="container">
|
||||
<wicket:child />
|
||||
</div>
|
||||
<div class="container"><wicket:child /></div>
|
||||
</body>
|
||||
</html>
|
||||
<!--[if gt IE 9]> </html> <![endif]-->
|
||||
|
@ -13,7 +13,6 @@ import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
||||
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.Panel;
|
||||
import org.apache.wicket.model.Model;
|
||||
|
||||
@ -43,7 +42,7 @@ public abstract class AbstractMenuPanel extends Panel {
|
||||
}
|
||||
|
||||
|
||||
public AbstractMenuPanel(final String id, final Class<? extends Page> tabCommonSuperClass,final Class<? extends Page> containerClass) {
|
||||
public AbstractMenuPanel(final String id, final Class<? extends Page> menuContainerCommonSuperClass,final Class<? extends Page> containerClass) {
|
||||
super(id);
|
||||
|
||||
final WebMarkupContainer menuContainer = new WebMarkupContainer("menuContainer");
|
||||
@ -56,9 +55,24 @@ public abstract class AbstractMenuPanel extends Panel {
|
||||
@Override
|
||||
protected void populateItem( ListItem<MenuItem> item ) {
|
||||
final MenuItem mi = item.getModelObject();
|
||||
if( (mi.getTargetClass().getSuperclass().isAssignableFrom(containerClass)
|
||||
&& mi.getTargetClass().getSuperclass() != tabCommonSuperClass)
|
||||
|| mi.getTargetClass() == containerClass){
|
||||
boolean highLightAsCurrentByInterface = false;
|
||||
Class<?> menuItemInterface = mi.getMenuHilightInterface();
|
||||
if( menuItemInterface != null ){
|
||||
for( Class<?> actualPageInterface : containerClass.getInterfaces() ){
|
||||
if( actualPageInterface.equals(menuItemInterface) ){
|
||||
highLightAsCurrentByInterface = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( highLightAsCurrentByInterface || mi.getTargetClass() == containerClass
|
||||
||
|
||||
(
|
||||
mi.getTargetClass().getSuperclass().isAssignableFrom(containerClass)
|
||||
&&
|
||||
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)
|
||||
@ -104,22 +118,37 @@ public abstract class AbstractMenuPanel extends Panel {
|
||||
private Class<? extends Page> targetClass;
|
||||
private PageParameters pp;
|
||||
private String iconName;
|
||||
private Class<? extends MenuHighlight> menuHilightInterface;
|
||||
|
||||
public MenuItem(final String name, final Class<? extends Page> targetClass) {
|
||||
this(name, targetClass, null, null);
|
||||
this(name, targetClass, null, null, null);
|
||||
}
|
||||
|
||||
public MenuItem(final String name, final Class<? extends Page> targetClass, final Class<? extends MenuHighlight> menuHilightInterface) {
|
||||
this(name, targetClass, menuHilightInterface, null, null);
|
||||
}
|
||||
|
||||
public MenuItem(final String name, final Class<? extends Page> targetClass, PageParameters pp){
|
||||
this(name, targetClass, pp, null);
|
||||
this(name, targetClass, null, pp, null);
|
||||
}
|
||||
public MenuItem(final String name, final Class<? extends Page> targetClass, final Class<? extends MenuHighlight> menuHilightInterface, PageParameters pp){
|
||||
this(name, targetClass, menuHilightInterface, pp, null);
|
||||
}
|
||||
|
||||
public MenuItem(final String name, final Class<? extends Page> targetClass, String iconName) {
|
||||
this(name, targetClass, null, iconName);
|
||||
this(name, targetClass, null, null, iconName);
|
||||
}
|
||||
public MenuItem(final String name, final Class<? extends Page> targetClass, final Class<? extends MenuHighlight> menuHilightInterface, String iconName) {
|
||||
this(name, targetClass, menuHilightInterface, null, iconName);
|
||||
}
|
||||
|
||||
public MenuItem(final String name, final Class<? extends Page> targetClass, PageParameters pp, String iconName) {
|
||||
this(name, targetClass, null, pp, iconName);
|
||||
}
|
||||
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.pp = pp;
|
||||
this.iconName = iconName == null ? ImageIcon.ICON_EMPTY : iconName;
|
||||
}
|
||||
@ -139,6 +168,16 @@ public abstract class AbstractMenuPanel extends Panel {
|
||||
public String getIconName() {
|
||||
return iconName;
|
||||
}
|
||||
|
||||
public MenuItem setMenuHilightInterface(Class<? extends MenuHighlight> menuHilightInterface) {
|
||||
this.menuHilightInterface = menuHilightInterface;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Class<? extends MenuHighlight> getMenuHilightInterface() {
|
||||
return menuHilightInterface;
|
||||
}
|
||||
|
||||
|
||||
}//MenuItem
|
||||
|
||||
|
12
src/main/java/se/su/dsv/scipro/components/MenuHighlight.java
Normal file
12
src/main/java/se/su/dsv/scipro/components/MenuHighlight.java
Normal file
@ -0,0 +1,12 @@
|
||||
package se.su.dsv.scipro.components;
|
||||
|
||||
/**
|
||||
* Base interface only signaling intent, that is if a menu item needs to be highlighted.
|
||||
* Should preferably not be used directly, subclass it instead so intent is clear.
|
||||
*
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
*
|
||||
*/
|
||||
public interface MenuHighlight {
|
||||
|
||||
}
|
@ -32,6 +32,8 @@ public interface EventDao extends LazyDeleteDao<Event> {
|
||||
|
||||
public List<Event> getUpcomingEventsByUserAndProject(final User u, final Project p);
|
||||
|
||||
public List<Event> getUpcomingEventsByUserAndProject(final User u, final Project p, final Integer limit);
|
||||
|
||||
public Event getNextEvent(final User u, final Project p, final Event event);
|
||||
|
||||
public boolean hasHandInsInHandInActivity(final Event event);
|
||||
|
@ -64,6 +64,7 @@ public class EventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Event> implement
|
||||
events.addAll(d.getEventsByUserAndProject(u, p, fromDate, toDate, limit));
|
||||
}
|
||||
Collections.sort(events);
|
||||
System.out.println(events);
|
||||
return events;
|
||||
}
|
||||
|
||||
@ -83,6 +84,10 @@ public class EventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Event> implement
|
||||
return getEvents(u, p, new Date(), null, null);
|
||||
}
|
||||
|
||||
public List<Event> getUpcomingEventsByUserAndProject(final User u, final Project p, Integer limit){
|
||||
return getEvents(u, p, new Date(), null, limit);
|
||||
}
|
||||
|
||||
public Event getNextEvent(final User u, final Project p, final Event e) {
|
||||
List<Event> list = getEvents(u, p, e.getDueDate() , null, 1);
|
||||
if(list.size() == 0){
|
||||
|
@ -89,6 +89,7 @@ public class GroupEventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<GroupEvent>
|
||||
if(toDate != null){
|
||||
geQuery.setParameter("toDate", toDate);
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
return geQuery.getResultList();
|
||||
@ -131,6 +132,7 @@ public class GroupEventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<GroupEvent>
|
||||
if(toDate != null){
|
||||
query.setParameter("toDate", toDate);
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
return query.getResultList();
|
||||
|
@ -132,18 +132,19 @@ public abstract class Event extends LazyDeletableDomainObject
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (this.getClass() != obj.getClass())
|
||||
return false;
|
||||
if (obj instanceof Event){
|
||||
|
||||
Event other = (Event) obj;
|
||||
|
||||
Event other = (Event) obj;
|
||||
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -153,7 +154,7 @@ public abstract class Event extends LazyDeletableDomainObject
|
||||
|
||||
@Override
|
||||
public int compareTo(Event other) {
|
||||
int dcomp = (int) (dueDate.getTime() - other.dueDate.getTime());
|
||||
int dcomp = dueDate.compareTo(other.dueDate);
|
||||
if(dcomp == 0)
|
||||
return id.compareTo(other.id);
|
||||
else
|
||||
|
@ -71,6 +71,15 @@ public class GeneralSystemSettings extends DomainObject{
|
||||
|
||||
@Basic(optional=false)
|
||||
private String smtpServer = "mail.dsv.su.se";
|
||||
|
||||
private boolean peerDisplayLatestReviews = true;
|
||||
|
||||
@Basic(optional=false)
|
||||
private int numberOfLatestReviewsDisplayed = 3;
|
||||
|
||||
@Basic(optional=false)
|
||||
private boolean publicReviewsActivated = true;
|
||||
|
||||
|
||||
public GeneralSystemSettings(){
|
||||
}
|
||||
@ -221,8 +230,24 @@ public class GeneralSystemSettings extends DomainObject{
|
||||
public void setSmtpServer(String smtpServer) {
|
||||
this.smtpServer = smtpServer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void setPeerDisplayLatestReviews(boolean peerDisplayLatestReviews) {
|
||||
this.peerDisplayLatestReviews = peerDisplayLatestReviews;
|
||||
}
|
||||
public boolean isPeerDisplayLatestReviews() {
|
||||
return peerDisplayLatestReviews;
|
||||
}
|
||||
public int getNumberOfLatestReviewsDisplayed() {
|
||||
return numberOfLatestReviewsDisplayed;
|
||||
}
|
||||
public void setNumberOfLatestReviewsDisplayed(int numberOfLatestReviewsDisplayed) {
|
||||
this.numberOfLatestReviewsDisplayed = numberOfLatestReviewsDisplayed;
|
||||
}
|
||||
public boolean isPublicReviewsActivated() {
|
||||
return publicReviewsActivated;
|
||||
}
|
||||
public void setPublicReviewsActivated(boolean publicReviewsActivated) {
|
||||
this.publicReviewsActivated = publicReviewsActivated;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ public interface PeerReviewDao extends LazyDeleteDao<PeerReview> {
|
||||
public int countStudentsWithReviews(final long minimumNumberOfReviews, final Date since);
|
||||
|
||||
public int countStudentsWithReviews();
|
||||
|
||||
public int countSubmittedReviews();
|
||||
|
||||
public List<PeerReview> findReviewsSortedByDate(final int firstResult, final Integer limit);
|
||||
|
||||
/**
|
||||
* Find given peer reviews for a given project and student
|
||||
|
@ -385,4 +385,55 @@ public class PeerReviewDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<PeerReview>
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<PeerReview> findReviewsSortedByDate(final int firstResult, final Integer limit) {
|
||||
|
||||
return getJpaTemplate().execute(new JpaCallback<List<PeerReview>>() {
|
||||
public List<PeerReview> doInJpa(EntityManager em)
|
||||
throws PersistenceException {
|
||||
|
||||
String q = "select pr " +
|
||||
"from PeerReview pr " +
|
||||
"where pr.submitted = true " +
|
||||
"and pr.deleted = false " +
|
||||
"and pr.aborted = false " +
|
||||
"order by pr.lastModified desc";
|
||||
|
||||
|
||||
TypedQuery<PeerReview> query = em.createQuery(q, PeerReview.class);
|
||||
|
||||
query.setMaxResults(limit != null ? limit : 3);
|
||||
query.setFirstResult(firstResult);
|
||||
|
||||
try {
|
||||
return query.getResultList();
|
||||
} catch (NoResultException e) {
|
||||
return new LinkedList<PeerReview>();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countSubmittedReviews() {
|
||||
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
||||
public Integer doInJpa(EntityManager em)
|
||||
throws PersistenceException {
|
||||
|
||||
String q = "select count(pr) " +
|
||||
"from PeerReview pr " +
|
||||
"where pr.submitted = true " +
|
||||
"and pr.deleted = false " +
|
||||
"and pr.aborted = false";
|
||||
|
||||
TypedQuery<Long> query = em.createQuery(q, Long.class);
|
||||
|
||||
try {
|
||||
return query.getSingleResult().intValue();
|
||||
} catch (NoResultException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}); }
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package se.su.dsv.scipro.peer.interfaces;
|
||||
|
||||
import se.su.dsv.scipro.components.MenuHighlight;
|
||||
/**
|
||||
* Used to highlight hierarchy for peer review pages
|
||||
*
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
*
|
||||
*/
|
||||
public interface MenuHighlightReviewPage extends MenuHighlight{
|
||||
|
||||
}
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
||||
@ -13,6 +12,7 @@ import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.exceptions.AccessDeniedException;
|
||||
import se.su.dsv.scipro.icons.ImageIcon;
|
||||
import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
|
||||
import se.su.dsv.scipro.peer.interfaces.MenuHighlightReviewPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectPage;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
@ -30,7 +30,7 @@ public abstract class AbstractProjectPeerPage extends ProjectPage {
|
||||
protected List<MenuItem> getItemList() {
|
||||
final List<MenuItem> items = new ArrayList<MenuItem>();
|
||||
items.add(new MenuItem("Peer portal", ProjectPeerPortalPage.class, ImageIcon.ICON_FIND));
|
||||
items.add(new MenuItem("My requests & reviews", ProjectPeerStatsPage.class, ImageIcon.ICON_STATISTICS));
|
||||
items.add(new MenuItem("My requests & reviews", ProjectPeerStatsPage.class, MenuHighlightReviewPage.class, ImageIcon.ICON_STATISTICS));
|
||||
items.add(new MenuItem("Request peer review", PeerRequestSubmissionPage.class, ImageIcon.ICON_ADD));
|
||||
items.add(new MenuItem("How to write a good review", ProjectPeerReviewGuidePage.class, ImageIcon.ICON_HELP));
|
||||
return items;
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import org.apache.wicket.PageParameters;
|
||||
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
||||
import se.su.dsv.scipro.icons.ImageIcon;
|
||||
import se.su.dsv.scipro.peer.interfaces.MenuHighlightReviewPage;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorPage;
|
||||
@ -21,7 +22,7 @@ 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, ImageIcon.ICON_STATISTICS));
|
||||
items.add(new MenuItem("My projects", SupervisorPeerStatsPage.class, MenuHighlightReviewPage.class, ImageIcon.ICON_STATISTICS));
|
||||
items.add(new MenuItem("Peer portal", SupervisorPeerPortalPage.class, ImageIcon.ICON_FIND));
|
||||
items.add(new MenuItem("How to write a good review", SupervisorPeerReviewGuidePage.class, ImageIcon.ICON_HELP));
|
||||
return items;
|
||||
|
@ -6,9 +6,10 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import se.su.dsv.scipro.exceptions.PageNotFoundException;
|
||||
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerReviewDao;
|
||||
import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
|
||||
import se.su.dsv.scipro.peer.interfaces.MenuHighlightReviewPage;
|
||||
import se.su.dsv.scipro.peer.panels.PeerReviewPanel;
|
||||
|
||||
public class ProjectPeerReviewPage extends AbstractProjectPeerPage {
|
||||
public class ProjectPeerReviewPage extends AbstractProjectPeerPage implements MenuHighlightReviewPage {
|
||||
|
||||
@SpringBean
|
||||
private PeerReviewDao peerReviewDao;
|
||||
|
@ -6,9 +6,10 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import se.su.dsv.scipro.exceptions.PageNotFoundException;
|
||||
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerReviewDao;
|
||||
import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
|
||||
import se.su.dsv.scipro.peer.interfaces.MenuHighlightReviewPage;
|
||||
import se.su.dsv.scipro.peer.panels.PeerReviewPanel;
|
||||
|
||||
public class SupervisorPeerReviewPage extends AbstractSupervisorPeerPage {
|
||||
public class SupervisorPeerReviewPage extends AbstractSupervisorPeerPage implements MenuHighlightReviewPage {
|
||||
|
||||
@SpringBean
|
||||
private PeerReviewDao peerReviewDao;
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div>
|
||||
<table>
|
||||
<tbody wicket:id="listView">
|
||||
<tr>
|
||||
<td wicket:id="reviewer"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#" wicket:id="reviewLink">Review date: <span wicket:id="reviewDate"></span></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<i><span wicket:id="noReviewersFoundMessage"></span></i>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" wicket:id="showMore">Show more...</a>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,135 @@
|
||||
package se.su.dsv.scipro.peer.panels;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.ComponentTag;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
||||
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.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerReviewDao;
|
||||
import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
|
||||
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
||||
|
||||
public class LatestReviewPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private PeerReviewDao peerReviewDao;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param model
|
||||
* the number of users to show by default - also defines how many
|
||||
* users to show when clicking showmore
|
||||
*/
|
||||
public LatestReviewPanel(String id, final Model<Integer> model, final boolean publicLinks) {
|
||||
super(id, model);
|
||||
|
||||
setOutputMarkupId(true);
|
||||
|
||||
final int totalCount = peerReviewDao.countSubmittedReviews();
|
||||
|
||||
final LoadableDetachableModel<List<PeerReview>> listModel = new LoadableDetachableModel<List<PeerReview>>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<PeerReview> load() {
|
||||
return peerReviewDao.findReviewsSortedByDate(0, model.getObject());
|
||||
}
|
||||
};
|
||||
|
||||
final ListView<PeerReview> listView = new ListView<PeerReview>("listView", listModel) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<PeerReview> item) {
|
||||
PeerReview pr = item.getModelObject();
|
||||
item.add(pr.getReviewer().getUser().getDisplayComponent("reviewer"));
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Label dateLabel = new Label("reviewDate", df.format(pr.getLastModified()));
|
||||
|
||||
if(publicLinks) {
|
||||
PageParameters pp = new PageParameters();
|
||||
pp.put(PeerReview.PP_PEER_REVIEW_ID, pr.getId());
|
||||
BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("reviewLink", ProjectPeerReviewPage.class, pp);
|
||||
link.add(dateLabel);
|
||||
item.add(link);
|
||||
} else {
|
||||
LinkToSpanContainer ltsc = new LinkToSpanContainer("reviewLink");
|
||||
ltsc.add(dateLabel);
|
||||
item.add(ltsc);
|
||||
}
|
||||
add(item);
|
||||
}
|
||||
};
|
||||
|
||||
add(new Label("noReviewersFoundMessage", "No reviewers found") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return listView.size() == 0;
|
||||
}
|
||||
});
|
||||
|
||||
add(listView);
|
||||
|
||||
add(new AjaxLink<Void>("showMore") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
Integer i = model.getObject();
|
||||
i += model.getObject();
|
||||
model.setObject(i);
|
||||
target.addComponent(LatestReviewPanel.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return listView.size() < totalCount;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public LatestReviewPanel(String id) {
|
||||
this(id, new Model<Integer>(3), false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Change html markup from a href to span when links are disabled.
|
||||
* Used when publicly viewable peer reviews is activated/inactivated.
|
||||
*/
|
||||
class LinkToSpanContainer extends WebMarkupContainer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public LinkToSpanContainer(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onComponentTag(final ComponentTag tag) {
|
||||
tag.setName("span");
|
||||
tag.remove("href");
|
||||
|
||||
super.onComponentTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -72,6 +72,12 @@
|
||||
</div>
|
||||
<!-- End left column -->
|
||||
<div class="span-6 last">
|
||||
<wicket:enclosure>
|
||||
<div class="rounded-box">
|
||||
<span class="box-title">Latest reviewers</span>
|
||||
<div wicket:id="latestReviewPanel" class="append-bottom"></div>
|
||||
</div>
|
||||
</wicket:enclosure>
|
||||
<wicket:enclosure>
|
||||
<div class="rounded-box">
|
||||
<span class="box-title">Most frequent reviewers</span>
|
||||
@ -86,7 +92,6 @@
|
||||
<div>
|
||||
<i><span class="small right">Last 12 months</span></i>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
|
@ -216,7 +216,10 @@ public class PeerPortalPanel extends Panel {
|
||||
|
||||
GeneralSystemSettings gsettings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
|
||||
final String mostFrequentPanel = "mostFrequentPanel";
|
||||
final String latestReviewPanel ="latestReviewPanel";
|
||||
final String bestRatedContainer = "bestRatedContainer";
|
||||
int displayedReviews = gsettings.getNumberOfLatestReviewsDisplayed();
|
||||
|
||||
|
||||
if(gsettings.isPeerDisplayNumberOfReviewsPerformed()){
|
||||
add(new MostFrequentReviewersPanel(mostFrequentPanel));
|
||||
@ -228,6 +231,18 @@ public class PeerPortalPanel extends Panel {
|
||||
} else {
|
||||
add(new InvisiblePanel(bestRatedContainer));
|
||||
}
|
||||
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.
|
||||
if (gsettings.isPublicReviewsActivated()) {
|
||||
add(new LatestReviewPanel(latestReviewPanel, new Model<Integer>(displayedReviews), true));
|
||||
} else {
|
||||
add(new LatestReviewPanel(latestReviewPanel, new Model<Integer>(displayedReviews), false));
|
||||
}
|
||||
} else {
|
||||
add(new InvisiblePanel(latestReviewPanel));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,11 +14,9 @@
|
||||
<li><strong>Accept date: </strong><span wicket:id="acceptDate">2011-03-08 10:58</span></li>
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
<wicket:enclosure>
|
||||
<div wicket:id="ratingPanelContainer">
|
||||
<strong>Review rating:</strong>
|
||||
<div wicket:id="ratingPanel"></div>
|
||||
</wicket:enclosure>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
|
@ -4,6 +4,7 @@ import java.util.Date;
|
||||
|
||||
import org.apache.wicket.datetime.PatternDateConverter;
|
||||
import org.apache.wicket.datetime.markup.html.basic.DateLabel;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
@ -37,11 +38,11 @@ public class ReviewPageReviewDetailsPanel extends Panel {
|
||||
add(review.getProject().getHeadSupervisor().getUser().getDisplayComponent("supervisor"));
|
||||
add(new DateLabel("acceptDate", new Model<Date>(review.getDateCreated()), dpc));
|
||||
|
||||
final String ratingPanel = "ratingPanel";
|
||||
final String ratingPanelContainer = "ratingPanelContainer";
|
||||
if(generalSystemSettingsDao.getGeneralSystemSettingsInstance().isPeerRatingsEnabled()){
|
||||
add(new PeerReviewRatingPanel(ratingPanel, reviewModel ));
|
||||
add(new WebMarkupContainer(ratingPanelContainer).add(new PeerReviewRatingPanel("ratingPanel", reviewModel )));
|
||||
} else {
|
||||
add(new InvisiblePanel(ratingPanel));
|
||||
add(new InvisiblePanel(ratingPanelContainer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,9 @@
|
||||
<h5 class="peer-title">Final seminar for this project</h5>
|
||||
<div wicket:id="projectSeminarPanel"></div>
|
||||
</div>
|
||||
<div class="span-10 last">
|
||||
<div wicket:id="upcomingEventPanel"></div>
|
||||
</div>
|
||||
<!-- <div class="span-10 last">-->
|
||||
<!-- <h5 class="peer-title">Oppositions & Active participations</h5>-->
|
||||
<!-- <div wicket:id="oppositionStatsPanel"></div>-->
|
||||
|
@ -12,6 +12,7 @@ import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
||||
import se.su.dsv.scipro.peer.panels.StudentPeerInfoRequestsPanel;
|
||||
import se.su.dsv.scipro.project.panels.NotificationsPanel;
|
||||
import se.su.dsv.scipro.project.panels.StateOfMindPanel;
|
||||
import se.su.dsv.scipro.project.panels.UpcomingEventPanel;
|
||||
import se.su.dsv.scipro.schedule.panels.ProjectProgressPanel;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
@ -34,6 +35,7 @@ public class ProjectStartPage extends ProjectPage {
|
||||
add(new FeedbackPanel("feedback"));
|
||||
add(new ProjectFinalSeminarContainerPanel("projectSeminarPanel", activeProject));
|
||||
//add(new StudentOppositionStatsPanel("oppositionStatsPanel", activeProject));
|
||||
add(new UpcomingEventPanel("upcomingEventPanel", activeProject, 3));
|
||||
leftColumn.add(new StudentPeerInfoRequestsPanel("peerRequests", null, activeProject){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -45,8 +47,10 @@ public class ProjectStartPage extends ProjectPage {
|
||||
ProjectProgressPanel progressPanel = new ProjectProgressPanel("progress", activeProject);
|
||||
leftColumn.add(progressPanel.getHelpIcon("progressHelp"));
|
||||
leftColumn.add(progressPanel);
|
||||
|
||||
|
||||
leftColumn.add(new NotificationsPanel("notificationPanel"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="span-10 last">
|
||||
<h5 class="peer-title">Upcoming events</h5>
|
||||
<div wicket:id="eventListContainer" class="span-10 last">
|
||||
<div class="span-10 last"></div>
|
||||
<div class="span-10 last" wicket:id="events">
|
||||
<div wicket:id="eventPanel"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div wicket:id="dialog">
|
||||
<div wicket:id="dialogContainer">
|
||||
<div wicket:id="containerContent">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,174 @@
|
||||
package se.su.dsv.scipro.project.panels;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.Page;
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
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.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.core.effects.EffectSpeed;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.EventDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Event;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.project.pages.ProjectEventPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectScheduleGeneratorPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectSchedulePlannerPage;
|
||||
import se.su.dsv.scipro.schedule.baseevent.panels.EventSchedulePanel;
|
||||
import se.su.dsv.scipro.util.WiQueryCoreEffectsHelper;
|
||||
|
||||
public class UpcomingEventPanel extends Panel{
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4481663857329726445L;
|
||||
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
|
||||
@SpringBean
|
||||
private EventDao eventDao;
|
||||
|
||||
private Project project;
|
||||
private User user;
|
||||
private ListView<Event> eventList;
|
||||
private IModel<List<Event>> listModel;
|
||||
private WebMarkupContainer eventListContainer;
|
||||
private int amountToShow;
|
||||
private WebMarkupContainer dialogContainer;
|
||||
private Dialog dialog;
|
||||
private Model<String> dialogTitle = new Model<String>("");
|
||||
|
||||
public UpcomingEventPanel(String id, final Project p, final int amountToShow){
|
||||
super(id);
|
||||
this.project = projectDao.reLoad(p);
|
||||
this.user = SciProSession.get().getUser();
|
||||
this.amountToShow = amountToShow;
|
||||
|
||||
dialogContainer = new WebMarkupContainer("dialogContainer");
|
||||
dialogContainer.setOutputMarkupId(true);
|
||||
dialogContainer.setVersioned(false);
|
||||
dialogContainer.add(new EmptyPanel("containerContent"));
|
||||
dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.add(dialogContainer);
|
||||
dialog.setWidth(600);
|
||||
dialog.setHeight(450);
|
||||
dialog.setTitle(dialogTitle);
|
||||
add(dialog);
|
||||
|
||||
listModel = new LoadableDetachableModel<List<Event>>(){
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4397997418096384845L;
|
||||
|
||||
@Override
|
||||
protected List<Event> load() {
|
||||
List<Event> list = eventDao.getEventsByUserAndProject(user, project,
|
||||
new Date(), null, null);
|
||||
if(amountToShow < list.size()){ //use this to limit the events shown
|
||||
list = list.subList(0, amountToShow);
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
eventList = new ListView<Event>("events", listModel){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<Event> item) {
|
||||
final Event e = item.getModelObject();
|
||||
item.add(new EventSchedulePanel("eventPanel", e, project, false){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void replaceAndOpenDialog(AjaxRequestTarget target,
|
||||
Panel replacePanel) {
|
||||
dialogContainer.replace(replacePanel);
|
||||
target.addComponent(dialogContainer);
|
||||
dialog.open(target);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshListView(AjaxRequestTarget target) {
|
||||
target.addComponent(WiQueryCoreEffectsHelper.fadeIn(eventListContainer, EffectSpeed.FAST));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeDialogAndRefreshListView(AjaxRequestTarget target) {
|
||||
target.addComponent(WiQueryCoreEffectsHelper.fadeIn(eventListContainer, EffectSpeed.FAST));
|
||||
dialog.close(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEventDetailsClick() {
|
||||
PageParameters pp = getEventPageParameters();
|
||||
pp.add(Event.PP_EVENT_ID, String.valueOf(e.getId()));
|
||||
setResponsePage(getEventPageClass(), pp);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
add(item);
|
||||
}
|
||||
};
|
||||
|
||||
/*@Override
|
||||
protected void populateItem(ListItem<Event> item) {
|
||||
final Event e = item.getModelObject();
|
||||
item.add(new Label("title", e.getTitle()));
|
||||
item.add(new Label("date", e.getDueDate().toString()));
|
||||
}
|
||||
|
||||
};*/
|
||||
|
||||
eventListContainer = new WebMarkupContainer("eventListContainer");
|
||||
eventListContainer.setOutputMarkupId(true);
|
||||
eventListContainer.add(eventList);
|
||||
add(eventListContainer);
|
||||
}
|
||||
|
||||
|
||||
public Class<? extends Page> getGeneratorPageClass() {
|
||||
return ProjectScheduleGeneratorPage.class;
|
||||
}
|
||||
|
||||
public Class<? extends Page> getEventPageClass() {
|
||||
return ProjectEventPage.class;
|
||||
}
|
||||
|
||||
public PageParameters getSchedulePageParameters(){
|
||||
return new PageParameters();
|
||||
}
|
||||
public PageParameters getGeneratorPageParameters(){
|
||||
return new PageParameters();
|
||||
}
|
||||
public PageParameters getEventPageParameters(){
|
||||
return new PageParameters();
|
||||
}
|
||||
|
||||
}
|
@ -115,8 +115,10 @@ public class FileOpenLink extends ResourceLink<Void> {
|
||||
in = fileRepository.retrieveFileByIdentifier(fileDesc.getIdentifier());
|
||||
return in;
|
||||
}
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
in.close();
|
||||
if( in != null )
|
||||
in.close();
|
||||
}
|
||||
@Override
|
||||
public long length(){
|
||||
|
@ -33,7 +33,6 @@ public class RepositoryDownloadPage extends WebPage {
|
||||
failAndRedirect();
|
||||
|
||||
String uuid = pp.getString(PP_KEY);
|
||||
//System.out.println("Attempting to download:"+uuid);
|
||||
try{
|
||||
FileDescription fd = fileRepository.retrieveFileDescriptionByIdentifier(uuid);
|
||||
IResourceStream stream = fileRepository.getFileStream(fd);
|
||||
|
@ -165,8 +165,10 @@ public abstract class EventSchedulePanel extends Panel {
|
||||
statusIcon = ImageIcon.ICON_EVENT_ALERT;
|
||||
} else {
|
||||
//The event must be upcoming
|
||||
statusMsgModel.setObject("Event upcoming");
|
||||
statusIcon = ImageIcon.ICON_EVENT_UPCOMING;
|
||||
if(event.getDueDate().getTime() > new Date().getTime()){
|
||||
statusMsgModel.setObject("Event upcoming");
|
||||
statusIcon = ImageIcon.ICON_EVENT_UPCOMING;
|
||||
}
|
||||
}
|
||||
|
||||
add(new IconPanel("statusIcon", statusIcon){
|
||||
|
@ -0,0 +1,106 @@
|
||||
package se.su.dsv.scipro.util.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* Utility class for providing configurable namespace contexts, satisfies specification defined in the NamespaceContext interface.
|
||||
* The default namespace-prefixes (DEFAULT_NS_PREFIX, XML_NS_PREFIX and XMLNS_ATTRIBUTE) are automatically mapped to defaults and are not configurable from clients.
|
||||
* Typical usage:
|
||||
* <code>
|
||||
* MutableNamespaceContext mnc = new MutableNamespaceContext();
|
||||
* mnc.setMapping("somePrefix", "someNamespaceURI");
|
||||
* XPath xp = .....
|
||||
* xp.setNamespaceContext(mnc);
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
public final class MutableNamespaceContext implements NamespaceContext {
|
||||
private final Map<String,String> nsMap = new HashMap<String,String>();
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public MutableNamespaceContext(){
|
||||
setupDefaults();
|
||||
}
|
||||
/**
|
||||
* Attempts to resolve the given prefix into a namespaceURI.
|
||||
* @return The namespace URI or XMLConstants.NULL_NS_URI if no mapping is found.
|
||||
* @throws IllegalStateException if the given prefix is null.
|
||||
*/
|
||||
@Override
|
||||
public String getNamespaceURI(String prefix){
|
||||
if(prefix == null)
|
||||
throw new IllegalStateException("A null prefix not allowed");
|
||||
if(!nsMap.containsKey(prefix))
|
||||
return XMLConstants.NULL_NS_URI;
|
||||
else
|
||||
return nsMap.get(prefix);
|
||||
}
|
||||
/**
|
||||
* Resolves all registered prefixes for the given URI.
|
||||
* @param uri
|
||||
* @return An iterator of all registered prefixes for the given URI, the empty iterator if none are found.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Iterator<String> getPrefixes(String URI) {
|
||||
if(URI == null)
|
||||
throw new IllegalStateException("A null URI not allowed");
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(Map.Entry<String, String> entry : nsMap.entrySet()){
|
||||
if(entry.getValue().equals(URI))
|
||||
list.add(entry.getKey());
|
||||
}
|
||||
return Collections.unmodifiableList(list).iterator();
|
||||
}
|
||||
/**
|
||||
* Resolves one prefix for the given URI.
|
||||
* @param uri
|
||||
* @return The registered prefix
|
||||
*/
|
||||
@Override
|
||||
public String getPrefix(String URI) {
|
||||
if(URI == null)
|
||||
throw new IllegalStateException("A null URI not allowed");
|
||||
final Iterator<String> itr = getPrefixes(URI);
|
||||
if(itr.hasNext())
|
||||
return itr.next();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Sets a prefix to URI mapping.
|
||||
* Overwrites existing mappings if existing, does not allow setting any of the default name space prefix mappings or mapping alternative prefixes for the default name space URI's.
|
||||
* @param prefix
|
||||
* @param URI
|
||||
* @throws IllegalStateException if either argument is null.
|
||||
*/
|
||||
public void setMapping(final String prefix, final String URI){
|
||||
if(prefix==null || URI==null)
|
||||
throw new IllegalStateException("Null prefix or URI not allowed");
|
||||
if(!prefix.equals(XMLConstants.DEFAULT_NS_PREFIX) && !prefix.equals(XMLConstants.XML_NS_PREFIX) && !prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)
|
||||
&& !URI.equals(XMLConstants.XML_NS_URI) && !URI.equals(XMLConstants.XML_NS_URI) && !URI.equals(XMLConstants.NULL_NS_URI))
|
||||
nsMap.put(prefix, URI);
|
||||
}
|
||||
/**
|
||||
* Clear user defined mappings.
|
||||
*/
|
||||
public void clearMappings(){
|
||||
nsMap.clear();
|
||||
setupDefaults();
|
||||
}
|
||||
private void setupDefaults(){
|
||||
nsMap.put(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
|
||||
nsMap.put(XMLConstants.XMLNS_ATTRIBUTE, XMLConstants.XMLNS_ATTRIBUTE_NS_URI);
|
||||
nsMap.put(XMLConstants.DEFAULT_NS_PREFIX, XMLConstants.NULL_NS_URI);
|
||||
}
|
||||
}
|
@ -78,15 +78,17 @@
|
||||
<property name="hibernate.generate_statistics" value="false" />
|
||||
|
||||
<!-- DEVELOPMENT VARIABLE, REMOVE FOR PRODUCTION USE -->
|
||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
||||
|
||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
||||
|
||||
|
||||
<!-- production settings database -->
|
||||
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
|
||||
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"></property>
|
||||
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/scipro"></property>
|
||||
<property name="hibernate.connection.username" value="scipro"></property>
|
||||
<property name="hibernate.connection.password" value="pighleef"></property>
|
||||
<property name="hibernate.connection.username" value="root"></property>
|
||||
<property name="hibernate.connection.password" value="juju"></property>
|
||||
<property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"></property>
|
||||
<property name="hibernate.c3p0.min_size" value="3"></property>
|
||||
<property name="hibernate.c3p0.max_size" value="6"></property>
|
||||
|
@ -64,8 +64,8 @@
|
||||
<!-- Use deployment for production, development for development -->
|
||||
<context-param>
|
||||
<param-name>configuration</param-name>
|
||||
<!-- <param-value>development</param-value>-->
|
||||
<param-value>deployment</param-value>
|
||||
<param-value>development</param-value>
|
||||
<!--<param-value>deployment</param-value>-->
|
||||
</context-param>
|
||||
|
||||
|
||||
|
@ -511,7 +511,7 @@ ul.multiobject-selected-list li {
|
||||
.multi-tab-menu li {
|
||||
float:left;
|
||||
background:url("../images/tab_left.gif") no-repeat left top;
|
||||
margin:0;
|
||||
margin:0 0 3px 0;
|
||||
padding:0 0 0 9px;
|
||||
border-bottom: 1px solid #78645A;
|
||||
}
|
||||
|
@ -6,10 +6,14 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
@ -23,6 +27,8 @@ import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import se.su.dsv.scipro.util.xml.MutableNamespaceContext;
|
||||
|
||||
/**
|
||||
* Assert that deploy configuration is upheld before build can be completed.
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
@ -34,6 +40,7 @@ public class TestDeployConfiguration {
|
||||
private static String repositoryContext = "META-INF"+File.separator+"repositoryContext.xml";
|
||||
private static String baseRepository = "META-INF"+File.separator+"base-repository.xml";
|
||||
private static String webXmlPath = "src"+File.separator+"main"+File.separator+"webapp"+File.separator+"WEB-INF"+File.separator+"web.xml";
|
||||
private static final String applicationContextPath = "applicationContext.xml";
|
||||
|
||||
@Test
|
||||
public void testWicketDeploymentConfiguration() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException {
|
||||
@ -98,6 +105,27 @@ public class TestDeployConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExternalAuthCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='acceptExternalAuthentication']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteUserLookupCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='enableRemoteUserLookup']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteUserRemoteUserLookupUrlCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("https://thesis.dsv.su.se/match/json", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupUrl']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
private InputSource getInputSource(String filePath) throws IOException{
|
||||
String theString = readResourceAsString(filePath);
|
||||
InputStream is = new ByteArrayInputStream(theString.getBytes());
|
||||
@ -114,5 +142,11 @@ public class TestDeployConfiguration {
|
||||
IOUtils.copy(in, writer, charset);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
private XPath getApplicationContextXPath(){
|
||||
XPath xPath = XPathFactory.newInstance().newXPath();
|
||||
MutableNamespaceContext mnc = new MutableNamespaceContext();
|
||||
mnc.setMapping("beanNS","http://www.springframework.org/schema/beans");
|
||||
xPath.setNamespaceContext(mnc);
|
||||
return xPath;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.util.TreeSet;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -32,6 +33,7 @@ import se.su.dsv.scipro.data.dataobjects.User;
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@Ignore
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class TestCommentThreadDaoJpa {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package se.su.dsv.scipro.dao.jpa;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -16,7 +17,7 @@ import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectPartner;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
|
||||
|
||||
@Ignore
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class TestProjectPartnerDaoJPA {
|
||||
|
@ -1,27 +1,6 @@
|
||||
package se.su.dsv.scipro.dao.jpa;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.EventDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectScheduleDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Event;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectSchedule;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
* @author Dan Kjellman <dan-kjel@dsv.su.se>
|
||||
@ -29,6 +8,7 @@ import se.su.dsv.scipro.data.dataobjects.ProjectSchedule;
|
||||
*/
|
||||
//@RunWith(SpringJUnit4ClassRunner.class)
|
||||
//@ContextConfiguration
|
||||
@Ignore
|
||||
public class TestProjectScheduleDaoJPA {
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
|
||||
import org.apache.wicket.spring.test.ApplicationContextMock;
|
||||
import org.apache.wicket.util.tester.WicketTester;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
@ -61,6 +62,7 @@ import se.su.dsv.scipro.repository.util.RepositoryManager;
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@Ignore
|
||||
public class BaseWicketTest {
|
||||
|
||||
protected WicketTester tester;
|
||||
@ -108,7 +110,7 @@ public class BaseWicketTest {
|
||||
|
||||
@Mock EntityManagerFactoryInfo entityManagerFactory = Mockito.mock(LocalEntityManagerFactoryBean.class);
|
||||
|
||||
@Before
|
||||
//@Before
|
||||
public void setup() {
|
||||
/*
|
||||
* Setup a new mock applicationContext
|
||||
|
@ -63,6 +63,8 @@ public class TestWicketPages extends BaseWicketTest {
|
||||
@Test
|
||||
public void testStartPage() throws Exception {
|
||||
|
||||
|
||||
this.setLoggedIn(false);
|
||||
tester.startPage(HomePage.class);
|
||||
tester.assertRenderedPage(LoginPage.class);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user