fixed proper identifiers for exemption creation
This commit is contained in:
parent
8337cf2b21
commit
45f487f790
src/main/java/se/su/dsv/scipro
@ -37,7 +37,7 @@
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr wicket:id="listView">
|
<tr wicket:id="listView">
|
||||||
<td><span wicket:id="name"></span></td>
|
<td><span wicket:id="name"></span> <span wicket:id="mail"></span></td>
|
||||||
<td><span wicket:id="comment"></span></td>
|
<td><span wicket:id="comment"></span></td>
|
||||||
<td><span wicket:id="level"></span></td>
|
<td><span wicket:id="level"></span></td>
|
||||||
<td><span wicket:id="grantedBy"></span></td>
|
<td><span wicket:id="grantedBy"></span></td>
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.admin.pages.match;
|
package se.su.dsv.scipro.admin.pages.match;
|
||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||||
@ -30,120 +28,122 @@ import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
|||||||
|
|
||||||
public class AdminExemptionPanel extends Panel {
|
public class AdminExemptionPanel extends Panel {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2758001349423204276L;
|
private static final long serialVersionUID = -2758001349423204276L;
|
||||||
private String userSearch;
|
private String userSearch;
|
||||||
private DataView<Exemption> dataView;
|
private DataView<Exemption> dataView;
|
||||||
private WebMarkupContainer container;
|
private WebMarkupContainer container;
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private ExemptionDao exemptionDao;
|
|
||||||
|
|
||||||
public AdminExemptionPanel(String id) {
|
|
||||||
super(id);
|
|
||||||
TextField<String> searchField =
|
|
||||||
new TextField<String>("searchField", new PropertyModel<String>(
|
|
||||||
this, "userSearch"));
|
|
||||||
container = new WebMarkupContainer("container");
|
|
||||||
container.setOutputMarkupId(true);
|
|
||||||
|
|
||||||
OnChangeAjaxBehavior userSearchTextBehaviour =
|
@SpringBean
|
||||||
new OnChangeAjaxBehavior() {
|
private ExemptionDao exemptionDao;
|
||||||
|
|
||||||
private static final long serialVersionUID =
|
public AdminExemptionPanel(String id) {
|
||||||
-3243439315735164519L;
|
super(id);
|
||||||
|
TextField<String> searchField =
|
||||||
|
new TextField<String>("searchField", new PropertyModel<String>(
|
||||||
|
this, "userSearch"));
|
||||||
|
container = new WebMarkupContainer("container");
|
||||||
|
container.setOutputMarkupId(true);
|
||||||
|
|
||||||
@Override
|
OnChangeAjaxBehavior userSearchTextBehaviour =
|
||||||
protected void onUpdate(AjaxRequestTarget target) {
|
new OnChangeAjaxBehavior() {
|
||||||
updateListView(container);
|
|
||||||
container.add(dataView);
|
|
||||||
container.add(new PagingNavigator("pagingNavigator",
|
|
||||||
dataView));
|
|
||||||
target.addComponent(container);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
private static final long serialVersionUID =
|
||||||
final Dialog dialog = new Dialog("dialog");
|
-3243439315735164519L;
|
||||||
dialog.setModal(true);
|
|
||||||
dialog.setAutoOpen(false);
|
|
||||||
dialog.add(new EmptyPanel("dialogContent"));
|
|
||||||
|
|
||||||
dialog.setWidth(500);
|
@Override
|
||||||
dialog.setHeight(380);
|
protected void onUpdate(AjaxRequestTarget target) {
|
||||||
add(dialog);
|
updateListView(container);
|
||||||
|
container.add(dataView);
|
||||||
AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
container.add(new PagingNavigator("pagingNavigator",
|
||||||
private static final long serialVersionUID = 1L;
|
dataView));
|
||||||
|
target.addComponent(container);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
};
|
||||||
public void onClick(AjaxRequestTarget target) {
|
final Dialog dialog = new Dialog("dialog");
|
||||||
dialog.replace(new AdminExemptionCreatePanel("dialogContent"));
|
dialog.setModal(true);
|
||||||
target.addComponent(dialog);
|
dialog.setAutoOpen(false);
|
||||||
dialog.setTitle("Grant exemption...");
|
dialog.add(new EmptyPanel("dialogContent"));
|
||||||
dialog.open(target);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
add(createLink);
|
|
||||||
createLink.add(new ImageObject("addIcon", ImageObject.SIXTEEN + ImageObject.ADD));
|
|
||||||
|
|
||||||
searchField.add(userSearchTextBehaviour);
|
dialog.setWidth(500);
|
||||||
add(searchField);
|
dialog.setHeight(380);
|
||||||
updateListView(container);
|
add(dialog);
|
||||||
|
|
||||||
container.add(dataView);
|
AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
||||||
add(container);
|
private static final long serialVersionUID = 1L;
|
||||||
container.add(new PagingNavigator("pagingNavigator", dataView));
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
dialog.replace(new AdminExemptionCreatePanel("dialogContent"));
|
||||||
|
target.addComponent(dialog);
|
||||||
|
dialog.setTitle("Grant exemption...");
|
||||||
|
dialog.open(target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
add(createLink);
|
||||||
|
createLink.add(new ImageObject("addIcon", ImageObject.SIXTEEN + ImageObject.ADD));
|
||||||
|
|
||||||
private void updateListView(final WebMarkupContainer container) {
|
searchField.add(userSearchTextBehaviour);
|
||||||
container.removeAll();
|
add(searchField);
|
||||||
ExemptionDaoParams exemptionDaoParams = new ExemptionDaoParams();
|
updateListView(container);
|
||||||
if (userSearch != null) {
|
|
||||||
if (userSearch.length() >= 3) {
|
|
||||||
exemptionDaoParams.setAuthorNameLike(userSearch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loadUserDataView(new QueryableDataProvider<Exemption, ExemptionDaoParams>(
|
|
||||||
exemptionDao, exemptionDaoParams));
|
|
||||||
|
|
||||||
};
|
container.add(dataView);
|
||||||
|
add(container);
|
||||||
|
container.add(new PagingNavigator("pagingNavigator", dataView));
|
||||||
|
|
||||||
public void loadUserDataView(IDataProvider<Exemption> exemptionDataProvider) {
|
}
|
||||||
dataView =
|
|
||||||
new DataView<Exemption>("listView", exemptionDataProvider, 10) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID =
|
private void updateListView(final WebMarkupContainer container) {
|
||||||
2828792237574112923L;
|
container.removeAll();
|
||||||
|
ExemptionDaoParams exemptionDaoParams = new ExemptionDaoParams();
|
||||||
|
if (userSearch != null) {
|
||||||
|
if (userSearch.length() >= 3) {
|
||||||
|
exemptionDaoParams.setAuthorNameLike(userSearch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadUserDataView(new QueryableDataProvider<Exemption, ExemptionDaoParams>(
|
||||||
|
exemptionDao, exemptionDaoParams));
|
||||||
|
|
||||||
@Override
|
};
|
||||||
protected void populateItem(Item<Exemption> item) {
|
|
||||||
final Exemption excemption = item.getModelObject();
|
|
||||||
item.add(new Label("name", excemption.getAuthor().getUser()
|
|
||||||
.getFullName()));
|
|
||||||
item.add(new Label("level", excemption.getProjectClass()
|
|
||||||
.getName()));
|
|
||||||
item.add(new Label("comment", excemption.getComment()));
|
|
||||||
item.add(new Label("grantedBy", excemption.getGrantedBy()
|
|
||||||
.getFullName()));
|
|
||||||
|
|
||||||
AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink"){
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
public void loadUserDataView(IDataProvider<Exemption> exemptionDataProvider) {
|
||||||
public void onClick(AjaxRequestTarget target) {
|
dataView =
|
||||||
exemptionDao.delete(exemptionDao.reLoad(excemption));
|
new DataView<Exemption>("listView", exemptionDataProvider, 10) {
|
||||||
info("Revoked exemption");
|
|
||||||
target.addComponent(container);
|
|
||||||
target.addComponent(getPage().get("feedbackPanel"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
item.add(removeLink);
|
|
||||||
removeLink.add(new ImageObject("removeIcon", ImageObject.SIXTEEN + ImageObject.DELETE));
|
|
||||||
removeLink.add(new JavascriptEventConfirmation("onclick", "Are you sure you want to remove this?"));
|
|
||||||
|
|
||||||
}
|
private static final long serialVersionUID =
|
||||||
|
2828792237574112923L;
|
||||||
|
|
||||||
};
|
@Override
|
||||||
}
|
protected void populateItem(Item<Exemption> item) {
|
||||||
|
final Exemption excemption = item.getModelObject();
|
||||||
|
item.add(new Label("name", excemption.getAuthor().getUser()
|
||||||
|
.getFullName()));
|
||||||
|
item.add(new Label("mail", excemption.getAuthor().getUser().getEmailAddress()));
|
||||||
|
item.add(new Label("level", excemption.getProjectClass()
|
||||||
|
.getName()));
|
||||||
|
item.add(new Label("comment", excemption.getComment()));
|
||||||
|
item.add(new Label("grantedBy", excemption.getGrantedBy()
|
||||||
|
.getFullName()));
|
||||||
|
|
||||||
|
|
||||||
|
AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink"){
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
exemptionDao.delete(exemptionDao.reLoad(excemption));
|
||||||
|
info("Revoked exemption");
|
||||||
|
target.addComponent(container);
|
||||||
|
target.addComponent(getPage().get("feedbackPanel"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
item.add(removeLink);
|
||||||
|
removeLink.add(new ImageObject("removeIcon", ImageObject.SIXTEEN + ImageObject.DELETE));
|
||||||
|
removeLink.add(new JavascriptEventConfirmation("onclick", "Are you sure you want to remove this?"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import org.wicketstuff.objectautocomplete.ObjectAutoCompleteRenderer;
|
|||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
|
import se.su.dsv.scipro.util.AutoCompleteStringFormatter;
|
||||||
|
|
||||||
public class StudentSelector extends Panel {
|
public class StudentSelector extends Panel {
|
||||||
|
|
||||||
@ -37,7 +38,8 @@ public class StudentSelector extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTextValue(Student s){
|
protected String getTextValue(Student s){
|
||||||
return s.getUser().toString();
|
// return s.getUser().toString();
|
||||||
|
return AutoCompleteStringFormatter.formatString(s.getUser());
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected String getIdValue(Student s){
|
protected String getIdValue(Student s){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user