Merge branch 'activityplan' into develop
* activityplan: Done with upcomingEventPanel events now order properly daily commit weekend commit Added upcomingeventpanel
This commit is contained in:
commit
d222f0c4cd
src/main
java/se/su/dsv/scipro
admin/pages
data
project
schedule/baseevent/panels
resources/META-INF
webapp/WEB-INF
@ -56,7 +56,5 @@ public class AdminProjectPartnerPage extends AbstractAdminPage {
|
||||
|
||||
|
||||
}
|
||||
|
||||
//generalsystemsettings för att spara datum
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -34,6 +34,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.ProjectWallPanel;
|
||||
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,7 +47,9 @@ public class ProjectStartPage extends ProjectPage {
|
||||
ProjectProgressPanel progressPanel = new ProjectProgressPanel("progress", activeProject);
|
||||
leftColumn.add(progressPanel.getHelpIcon("progressHelp"));
|
||||
leftColumn.add(progressPanel);
|
||||
//leftColumn.add(new UpcomingEventPanel("upcomingEventPanel", activeProject));
|
||||
leftColumn.add(new ProjectWallPanel("projectWallPanel", activeProject));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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){
|
||||
|
@ -88,8 +88,8 @@
|
||||
<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>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user