Merge branch 'activityplan' into develop
* activityplan: Redesigned UpcomingEventsPanel daily commit
This commit is contained in:
commit
816f29ee28
src/main
java/se/su/dsv/scipro
data/dataobjects
project/panels
webapp
@ -67,7 +67,7 @@ public class ProjectEvent extends Event {
|
||||
|
||||
@Override
|
||||
protected void onFormSubmit(AjaxRequestTarget target) {
|
||||
System.out.println("On form submitt in event class");
|
||||
//System.out.println("On form submitt in event class");
|
||||
callback.doCallback(target);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<p></p>
|
||||
<span class="event-title" wicket:id="eventTitle">Event title here</span>
|
||||
<div>
|
||||
<img wicket:id="eventDeleteIcon" class="right" />
|
||||
<img wicket:id="eventEditIcon" class="right" />
|
||||
<div>
|
||||
<div wicket:id="showDetailsIcon" class="left"></div>
|
||||
<span wicket:id="eventDueDate" class="span-2 left month"></span>
|
||||
<div>
|
||||
<a href="#" wicket:id="eventPageLink"><span wicket:id="statusIcon"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p></p>
|
||||
<div wicket:id="eventDetailsContainer" style="display:none;">
|
||||
<div wicket:id="eventDetails"></div>
|
||||
</div>
|
||||
<!--
|
||||
<div wicket:id="showDetailsIcon" class="left"></div>
|
||||
<div wicket:id="month" class="span-1 left month"></div>
|
||||
<img wicket:id="calendarIcon" class="left">
|
||||
|
||||
<div>
|
||||
<div>
|
||||
|
||||
<span wicket:id="eventTitle">Event title here</span>
|
||||
|
||||
<img wicket:id="eventDeleteIcon" class="right" />
|
||||
<img wicket:id="eventEditIcon" class="right" />
|
||||
<a href="#" class="right" wicket:id="eventPageLink"><img wicket:id="eventPageLinkIcon" /></a>
|
||||
<span wicket:id="eventDueDate" class ="right"></span>
|
||||
<div wicket:id="statusIcon"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p></p>
|
||||
<div wicket:id="eventDetailsContainer" style="display:none;">
|
||||
<div wicket:id="eventDetails"></div>
|
||||
</div> -->
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,186 @@
|
||||
package se.su.dsv.scipro.project.panels;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
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.link.Link;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.core.effects.EffectSpeed;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.EventDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.HandInActivityDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Event;
|
||||
import se.su.dsv.scipro.data.dataobjects.HandInActivity;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.icons.AjaxActionIcon;
|
||||
import se.su.dsv.scipro.icons.ExpandContractActionIcon;
|
||||
import se.su.dsv.scipro.icons.IconPanel;
|
||||
import se.su.dsv.scipro.icons.ImageIcon;
|
||||
import se.su.dsv.scipro.schedule.baseevent.panels.EventScheduleDetailsPanel;
|
||||
import se.su.dsv.scipro.util.IAjaxCallback;
|
||||
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
||||
import se.su.dsv.scipro.util.WiQueryCoreEffectsHelper;
|
||||
|
||||
public abstract class EventLayoutPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
protected EventDao eventDao;
|
||||
|
||||
@SpringBean
|
||||
protected ProjectDao projectDao;
|
||||
|
||||
@SpringBean
|
||||
protected RoleDao roleDao;
|
||||
|
||||
@SpringBean
|
||||
protected HandInActivityDao handInActivityDao;
|
||||
|
||||
public EventLayoutPanel(String id, final Event event, final Project project, final boolean isSupervisorView){
|
||||
super(id);
|
||||
final User user = SciProSession.get().getUser();
|
||||
|
||||
//add(new CalendarIconImage("calendarIcon", event.getDueDate()));
|
||||
//add(new DateLabel("month", new Model<Date>(event.getDueDate()), new PatternDateConverter("MMM", false)));
|
||||
add(new DateLabel("eventDueDate", new Model<Date>(event.getDueDate()), new PatternDateConverter("yyyy-MM-dd HH:mm", false)));
|
||||
add(new Label("eventTitle", event.getTitle()));
|
||||
|
||||
final WebMarkupContainer eventDetailsContainer = new WebMarkupContainer("eventDetailsContainer");
|
||||
eventDetailsContainer.setOutputMarkupId(true);
|
||||
eventDetailsContainer.add(new EmptyPanel("eventDetails"));
|
||||
add(eventDetailsContainer);
|
||||
|
||||
final ExpandContractActionIcon showDetailsIcon = new ExpandContractActionIcon("showDetailsIcon"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onExpand(AjaxRequestTarget target) {
|
||||
eventDetailsContainer.replace(new EventScheduleDetailsPanel("eventDetails", event));
|
||||
target.addComponent(eventDetailsContainer);
|
||||
target.appendJavascript(WiQueryCoreEffectsHelper.slideDownJs(eventDetailsContainer, EffectSpeed.FAST));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContract(AjaxRequestTarget target) {
|
||||
target.appendJavascript(WiQueryCoreEffectsHelper.slideUpJs(eventDetailsContainer, EffectSpeed.FAST));
|
||||
}
|
||||
|
||||
};
|
||||
add(showDetailsIcon);
|
||||
|
||||
Link<Void> eventPageLink = new Link<Void>("eventPageLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
onEventDetailsClick();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
add(eventPageLink);
|
||||
|
||||
add(new AjaxActionIcon("eventEditIcon", AjaxActionIcon.ICON_EDIT){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onClick(AjaxRequestTarget target) {
|
||||
final IAjaxCallback cb = new IAjaxCallback(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void doCallback(AjaxRequestTarget onSubmitTarget) {
|
||||
closeDialogAndRefreshListView(onSubmitTarget);
|
||||
}
|
||||
};
|
||||
|
||||
replaceAndOpenDialog(target, event.getCreationPanel("containerContent", cb, isSupervisorView));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(){
|
||||
return eventDao.isEditable(event, user);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
add(new AjaxActionIcon("eventDeleteIcon", AjaxActionIcon.ICON_DELETE){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onClick(AjaxRequestTarget target) {
|
||||
eventDao.lazyDelete(event);
|
||||
refreshListView(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(){
|
||||
return eventDao.isDeletable(event, user);
|
||||
}
|
||||
|
||||
}.add(new JavascriptEventConfirmation("onclick", "Delete " + event.getTitle() + "?")));
|
||||
|
||||
/*if(event.isRequireHandIn()){
|
||||
add(new IconPanel("handInRequiredIcon", ImageIcon.ICON_RED_FLAG){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
return "Hand in required";
|
||||
}
|
||||
});
|
||||
} else {
|
||||
add(new EmptyPanel("handInRequiredIcon"));
|
||||
}*/
|
||||
|
||||
String statusIcon = ImageIcon.ICON_EMPTY;
|
||||
final Model<String> statusMsgModel = new Model<String>("");
|
||||
//Check the status
|
||||
if(eventDao.eventIsDone(event, user, project)) {
|
||||
statusIcon = ImageIcon.ICON_EVENT_DONE;
|
||||
statusMsgModel.setObject("Event is done");
|
||||
} else if (event.isRequireHandIn()){
|
||||
//Ok, event is not done
|
||||
HandInActivity hia = handInActivityDao.getHandInActivity(event, project);
|
||||
//if there are hand ins and the event is not done, it must be awaiting feedback
|
||||
if(hia != null && hia.getHandIns().size() > 0){
|
||||
statusMsgModel.setObject("Awaiting supervisor feedback");
|
||||
} else {
|
||||
statusMsgModel.setObject("No hand in uploaded yet");
|
||||
}
|
||||
statusIcon = ImageIcon.ICON_EVENT_ALERT;
|
||||
} else {
|
||||
//The event must be upcoming
|
||||
if(event.getDueDate().getTime() > new Date().getTime()){
|
||||
statusMsgModel.setObject("Event upcoming");
|
||||
statusIcon = ImageIcon.ICON_EVENT_UPCOMING;
|
||||
}
|
||||
}
|
||||
|
||||
eventPageLink.add(new IconPanel("statusIcon", statusIcon){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
return statusMsgModel.getObject();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract void replaceAndOpenDialog(AjaxRequestTarget target, Panel replacePanel);
|
||||
public abstract void refreshListView(AjaxRequestTarget target);
|
||||
public abstract void closeDialogAndRefreshListView(AjaxRequestTarget target);
|
||||
public abstract void onEventDetailsClick();
|
||||
}
|
@ -26,8 +26,6 @@ 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{
|
||||
@ -100,7 +98,7 @@ public class UpcomingEventPanel extends Panel{
|
||||
@Override
|
||||
protected void populateItem(ListItem<Event> item) {
|
||||
final Event e = item.getModelObject();
|
||||
item.add(new EventSchedulePanel("eventPanel", e, project, false){
|
||||
item.add(new EventLayoutPanel("eventPanel", e, project, false){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -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>
|
||||
|
||||
|
||||
|
@ -1042,4 +1042,14 @@ div.wicket-aa ul li.selected {
|
||||
background-color: #dedeff;
|
||||
padding: 0px;
|
||||
margin:0;
|
||||
}
|
||||
}
|
||||
|
||||
.month{
|
||||
font-size: 1em;
|
||||
font-style: strong;
|
||||
}
|
||||
|
||||
.event-title{
|
||||
font-size: 1.4em;
|
||||
font-style: strong;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user