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

This commit is contained in:
joha-asc 2011-07-29 10:25:12 +02:00
commit 890fd5daef
10 changed files with 100 additions and 49 deletions

@ -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

@ -6,11 +6,13 @@
</head>
<body>
<wicket:panel>
<div wicket:id="stateOfMindContainer">
<form wicket:id="form">
<table wicket:id="group">
<tr wicket:id="persons">
<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>
</table>
@ -24,6 +26,37 @@
</div>
</div>
</div>
-->
<td><img wicket:id="image"/></td>
</tr>
<tr>
</tr>
</table>
</div>
</div>
</div>
</wicket:panel>
</body>
</html>
<!--
<!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">
<table wicket:id="group">
<tr wicket:id="lights">
<td><input type="radio" wicket:id="radio" /></td>
<td> <img wicket:id="image"/></td>
</tr>
</table>
</div>
>>>>>>> checklists
</wicket:panel>
</body>
</html> -->

@ -4,9 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.Radio;
import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.list.ListItem;
@ -24,9 +22,7 @@ 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.data.enums.StateOfMind;
import se.su.dsv.scipro.knol.resource.page.StaticImage;
import edu.emory.mathcs.backport.java.util.Arrays;
/**
* @author fnorbe@dsv.su.se
@ -34,6 +30,12 @@ import edu.emory.mathcs.backport.java.util.Arrays;
public class TrafficLightPanel extends Panel {
private List<TrafficLight> lights;
enum TrafficLight{
GREEN, YELLOW, RED, NOT
}
private static final long serialVersionUID = 8862892008428526067L;
@SpringBean
@ -50,37 +52,51 @@ public class TrafficLightPanel extends Panel {
public TrafficLightPanel(String id) {
super(id);
WebMarkupContainer stateOfMindContainer = new WebMarkupContainer("stateOfMindContainer");
add(stateOfMindContainer);
Form<StateOfMind> f = new Form<StateOfMind>("form");
stateOfMindContainer.add(f);
RadioGroup<StateOfMind> group = new RadioGroup<StateOfMind>("group");
f.add(group);
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<StateOfMind> persons = new ListView<StateOfMind>("persons",
Arrays.asList(StateOfMind.values())) {
protected void populateItem(ListItem<StateOfMind> item) {
StateOfMind stateOfMind = item.getModelObject();
item.add(new Radio<StateOfMind>("radio", item.getModel()));
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 (stateOfMind.equals(StateOfMind.FINE)) {
if (trafficLight.equals(TrafficLight.GREEN)) {
image = new StaticImage("image", new Model<String>(
"images/icons/green_ball_32.png"));
} else if (stateOfMind.equals(StateOfMind.NEEDHELP)) {
} else if (trafficLight.equals(TrafficLight.YELLOW)) {
image = new StaticImage("image", new Model<String>(
"images/icons/red_ball_32.png"));
} else if (stateOfMind.equals(StateOfMind.NEUTRAL)) {
"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(persons);
group.add(lightList);
}
List<CheckList> checkLists = checkListDao.findCheckLists(SciProSession.get()
.getActiveProject());
.getActiveProject());{
if (checkLists.size() < 1) {
CheckList checkList = new CheckList("Test", SciProSession.get().getActiveProject());
CheckListQuestion checkListQuestion = new CheckListQuestion("Testquestion?");

@ -56,7 +56,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 +72,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,7 +99,8 @@ 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();
@ -118,7 +119,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 +149,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 +170,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;
}

@ -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;

@ -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.

@ -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();

@ -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>

Binary file not shown.

After

(image error) Size: 1.1 KiB