added setting for whether supervisors can accept or reject project ideas themselves
This commit is contained in:
parent
4af195cf9d
commit
7234378897
resources/db_update_scripts
src/main
java/se/su/dsv/scipro
admin/pages/settings
data/dataobjects
supervisor/panels
resources/META-INF
@ -0,0 +1 @@
|
||||
ALTER TABLE general_system_settings ADD supervisorsCanAcceptDeclinePIs bit(1) NOT NULL
|
@ -32,6 +32,14 @@
|
||||
<td><input name="7" type="checkbox" wicket:id="mailNotifications" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="7">Supervisors can accept and decline project ideas:</label>
|
||||
</td>
|
||||
<td><input name="7" type="checkbox" wicket:id="supervisorsCanAcceptDeclinePIs" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<button type="submit">
|
||||
|
@ -37,10 +37,12 @@ public class AdminGeneralSettingsPage extends AbstractAdminSettingsPage {
|
||||
TextField<String> systemFromMail = new RequiredTextField<String>("systemFromMail");
|
||||
TextField<String> smtpServer = new RequiredTextField<String>("smtpServer");
|
||||
CheckBox mailNotifications = new CheckBox("mailNotifications");
|
||||
CheckBox supervisorsCanAcceptDeclinePIs = new CheckBox("supervisorsCanAcceptDeclinePIs");
|
||||
add(mailFromName);
|
||||
add(systemFromMail);
|
||||
add(smtpServer);
|
||||
add(mailNotifications);
|
||||
add(supervisorsCanAcceptDeclinePIs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +49,18 @@ public class GeneralSystemSettings extends DomainObject{
|
||||
private String turnItInSurname = "Aschan";
|
||||
|
||||
@Basic(optional=true)
|
||||
private int projectPartnerDaysToLive;
|
||||
private int projectPartnerDaysToLive;
|
||||
|
||||
@Basic(optional=false)
|
||||
private boolean supervisorsCanAcceptDeclinePIs = true;
|
||||
|
||||
public boolean getSupervisorsCanAcceptDeclinePIs(){
|
||||
return supervisorsCanAcceptDeclinePIs;
|
||||
}
|
||||
|
||||
public void setSupervisorsCanAcceptDeclinePIs(boolean supervisorsCanAcceptDeclinePIs){
|
||||
this.supervisorsCanAcceptDeclinePIs = supervisorsCanAcceptDeclinePIs;
|
||||
}
|
||||
|
||||
@Basic(optional=false)
|
||||
private boolean finalSeminarThesisMustBeAPDF = false;
|
||||
|
@ -7,13 +7,18 @@
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<form wicket:id="form">
|
||||
<div class="append-bottom"><button wicket:id="acceptButton">Accept to supervise</button></div>
|
||||
<!-- <div class="append-bottom"><input type="button" value="Accept to supervise"></div> -->
|
||||
<div class="append-top">Or enter a reason to decline: (at least
|
||||
5 characters)</div>
|
||||
<textarea wicket:id="reason" rows="5" style="width: 100%;"></textarea>
|
||||
<button wicket:id="declineButton"
|
||||
style="float: right; margin-top: 1em;">Decline</button>
|
||||
<div wicket:id="wmc1">
|
||||
<div class="append-bottom"><button wicket:id="acceptButton">Accept to supervise</button></div>
|
||||
<!-- <div class="append-bottom"><input type="button" value="Accept to supervise"></div> -->
|
||||
<div class="append-top">Or enter a reason to decline: (at least
|
||||
5 characters)</div>
|
||||
<textarea wicket:id="reason" rows="5" style="width: 100%;"></textarea>
|
||||
<button wicket:id="declineButton"
|
||||
style="float: right; margin-top: 1em;">Decline</button>
|
||||
</div>
|
||||
<div wicket:id="wmc2"><div wicket:id="info"></div></div>
|
||||
|
||||
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
|
@ -3,6 +3,8 @@ package se.su.dsv.scipro.supervisor.panels;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextArea;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
@ -10,8 +12,8 @@ import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.apache.wicket.validation.validator.StringValidator;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.Match.Status;
|
||||
@ -23,7 +25,9 @@ public abstract class SupervisorAcceptDeclinePanel2 extends Panel {
|
||||
private MatchDao matchDao;
|
||||
@SpringBean
|
||||
private MatchFacade matchFacade;
|
||||
|
||||
@SpringBean
|
||||
private GeneralSystemSettingsDao gDao;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private long matchId;
|
||||
|
||||
@ -58,33 +62,47 @@ public abstract class SupervisorAcceptDeclinePanel2 extends Panel {
|
||||
public SupervisorAcceptDeclineForm(String id, final LoadableDetachableModel<Match> matchModel) {
|
||||
super(id);
|
||||
this.matchModel = matchModel;
|
||||
|
||||
add(new AjaxLink("acceptButton"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
matchDao.changeStatus(SciProSession.get().getUser(), matchModel.getObject(), Status.CONFIRMED);
|
||||
onUpdate(target);
|
||||
System.out.println("accept");
|
||||
}
|
||||
}).setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
|
||||
|
||||
WebMarkupContainer wmc1 = new WebMarkupContainer("wmc1");
|
||||
|
||||
add(wmc1);
|
||||
|
||||
|
||||
wmc1.add(new AjaxLink("acceptButton") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
matchDao.changeStatus(SciProSession.get().getUser(), matchModel.getObject(), Status.CONFIRMED);
|
||||
onUpdate(target);
|
||||
System.out.println("accept");
|
||||
}
|
||||
}).setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
|
||||
|
||||
reason = new TextArea<String>("reason", new PropertyModel<String>(this, "reasonString"));
|
||||
reason.setRequired(true);
|
||||
reason.add(StringValidator.minimumLength(5));
|
||||
reason.setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
|
||||
add(reason);
|
||||
wmc1.add(reason);
|
||||
|
||||
add(new AjaxButton("declineButton"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
if (reason.getModelObject() != null && reason.getModelObject().length() > 4){
|
||||
matchFacade.reject(matchModel.getObject(), SciProSession.get().getUser(), reasonString);
|
||||
onUpdate(target);
|
||||
}
|
||||
}
|
||||
}).setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
|
||||
wmc1.add(new AjaxButton("declineButton") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
if (reason.getModelObject() != null && reason.getModelObject().length() > 4) {
|
||||
matchFacade.reject(matchModel.getObject(), SciProSession.get().getUser(), reasonString);
|
||||
onUpdate(target);
|
||||
}
|
||||
}
|
||||
}).setVisible(!matchModel.getObject().getStatus().equals(Match.Status.CONFIRMED));
|
||||
|
||||
WebMarkupContainer wmc2 = new WebMarkupContainer("wmc2");
|
||||
wmc2.add(new Label("info", "Accepting and declining project ideas has been disabled. If you have any questions, "
|
||||
+ "contact your GRUA or the administrator."));
|
||||
add(wmc2);
|
||||
wmc1.setVisible(gDao.getGeneralSystemSettingsInstance().getSupervisorsCanAcceptDeclinePIs());
|
||||
wmc2.setVisible(!gDao.getGeneralSystemSettingsInstance().getSupervisorsCanAcceptDeclinePIs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,11 @@ package se.su.dsv.scipro.supervisor.panels;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
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.LoadableDetachableModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
|
||||
@ -16,7 +14,8 @@ public abstract class SupervisorProjectIdeaDialogPanel extends Panel {
|
||||
|
||||
@SpringBean
|
||||
MatchDao matchDao;
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Dialog dialog;
|
||||
@ -67,7 +66,10 @@ public abstract class SupervisorProjectIdeaDialogPanel extends Panel {
|
||||
link.add(new Label("linkLabel", matchModel.getObject().getProjectIdea().getTitle()));
|
||||
add(link);
|
||||
dialog.add(new WatsonInfoPanel("watsonPanel", matchModel.getObject().getProjectIdea()));
|
||||
dialog.add(new SupervisorAcceptDeclinePanel2("acceptDeclinePanel", matchModel.getObject()){
|
||||
|
||||
SupervisorAcceptDeclinePanel2 acceptDeclinePanel;
|
||||
|
||||
dialog.add(acceptDeclinePanel = new SupervisorAcceptDeclinePanel2("acceptDeclinePanel", matchModel.getObject()){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -23,7 +23,7 @@
|
||||
value="true" />
|
||||
<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.MySQLInnoDBDialect" />
|
||||
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"></property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user