settings for notification priority
Change-Id: I08af3a8627cac79f84ac1ab0ff0d606f3b9eb4e7
This commit is contained in:
parent
f79c13a645
commit
348c4cc2d4
src/main/java/se/su/dsv/scipro/basepanels
@ -1,19 +1,27 @@
|
||||
<!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>
|
||||
<form wicket:id="userSettingsForm">
|
||||
<div class="span-10 last">
|
||||
<div class="info-box rounded-box span-10 last">If you do not have any projects to choose from, contact your supervisor and ask him/her to register a thesis course for you in Daisy.</div>
|
||||
</div>
|
||||
<div class="span-10 last">
|
||||
<label for="activeProject">Active project</label>
|
||||
<select name="Active project" wicket:id="activeProject" id="activeProject"></select>
|
||||
<div>
|
||||
<input type="submit" wicket:id="applyButton" value="Apply">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
<wicket:panel>
|
||||
<form wicket:id="userSettingsForm">
|
||||
<div class="span-10 last">
|
||||
<div class="info-box rounded-box span-10 last">If you do not
|
||||
have any projects to choose from, contact your supervisor and ask
|
||||
him/her to register a thesis course for you in Daisy.</div>
|
||||
</div>
|
||||
<div class="span-10 last">
|
||||
<label for="activeProject">Active project</label> <select
|
||||
name="Active project" wicket:id="activeProject" id="activeProject"></select>
|
||||
<div class="span-10 last">
|
||||
<label>Mail notifications you want</label>
|
||||
<div wicket:id="notificationPriority"><input type="radio" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" ><img src="css/blueprint/plugins/buttons/icons/tick.png" alt=""/> Save changes</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -5,13 +5,14 @@ import java.util.List;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.DropDownChoice;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.IChoiceRenderer;
|
||||
import org.apache.wicket.markup.html.form.RadioChoice;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
@ -20,6 +21,8 @@ import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
/**
|
||||
*
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
@ -36,16 +39,18 @@ public class UserSettingsPanel extends Panel {
|
||||
|
||||
public UserSettingsPanel(String id) {
|
||||
super(id);
|
||||
|
||||
add(new UserSettingsForm("userSettingsForm"));
|
||||
UserSettings userSettings = userSettingsDao.getUserSettings(SciProSession.get().getUser());
|
||||
if(userSettings == null)
|
||||
userSettings = new UserSettings(SciProSession.get().getUser());
|
||||
add(new UserSettingsForm("userSettingsForm", new CompoundPropertyModel<UserSettings>(userSettings)));
|
||||
}
|
||||
|
||||
private class UserSettingsForm extends Form<Void> {
|
||||
private class UserSettingsForm extends Form<UserSettings> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Project activeProject;
|
||||
|
||||
public UserSettingsForm(String id) {
|
||||
super(id);
|
||||
public UserSettingsForm(String id, IModel<UserSettings> model) {
|
||||
super(id, model);
|
||||
activeProject = SciProSession.get().getActiveProject();
|
||||
|
||||
List<Project> userProjects = new ArrayList<Project>();
|
||||
@ -67,14 +72,22 @@ public class UserSettingsPanel extends Panel {
|
||||
});
|
||||
projectChoice.setNullValid(true);
|
||||
add(projectChoice);
|
||||
Button applyButton = new Button("applyButton"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onSubmit(){
|
||||
setResponsePage(this.getPage().getClass(),this.getPage().getPageParameters());
|
||||
}
|
||||
};
|
||||
add(applyButton);
|
||||
|
||||
NotificationPriority[] array = NotificationPriority.values();
|
||||
|
||||
List<NotificationPriority> notificationPriorities = new ArrayList<NotificationPriority>(Arrays.asList(array));
|
||||
|
||||
RadioChoice<NotificationPriority> radioChoice = new RadioChoice<NotificationPriority>("notificationPriority", notificationPriorities );
|
||||
add(radioChoice);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubmit(){
|
||||
userSettingsDao.save(getModelObject());
|
||||
setResponsePage(this.getPage().getClass(),this.getPage().getPageParameters());
|
||||
}
|
||||
}//UserSettingsForm
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user