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>
|
||||
<tbody>
|
||||
<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="level"></span></td>
|
||||
<td><span wicket:id="grantedBy"></span></td>
|
||||
|
@ -1,6 +1,4 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
@ -30,120 +28,122 @@ import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
||||
|
||||
public class AdminExemptionPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = -2758001349423204276L;
|
||||
private String userSearch;
|
||||
private DataView<Exemption> dataView;
|
||||
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);
|
||||
private static final long serialVersionUID = -2758001349423204276L;
|
||||
private String userSearch;
|
||||
private DataView<Exemption> dataView;
|
||||
private WebMarkupContainer container;
|
||||
|
||||
OnChangeAjaxBehavior userSearchTextBehaviour =
|
||||
new OnChangeAjaxBehavior() {
|
||||
@SpringBean
|
||||
private ExemptionDao exemptionDao;
|
||||
|
||||
private static final long serialVersionUID =
|
||||
-3243439315735164519L;
|
||||
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);
|
||||
|
||||
@Override
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
updateListView(container);
|
||||
container.add(dataView);
|
||||
container.add(new PagingNavigator("pagingNavigator",
|
||||
dataView));
|
||||
target.addComponent(container);
|
||||
}
|
||||
OnChangeAjaxBehavior userSearchTextBehaviour =
|
||||
new OnChangeAjaxBehavior() {
|
||||
|
||||
};
|
||||
final Dialog dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.add(new EmptyPanel("dialogContent"));
|
||||
private static final long serialVersionUID =
|
||||
-3243439315735164519L;
|
||||
|
||||
dialog.setWidth(500);
|
||||
dialog.setHeight(380);
|
||||
add(dialog);
|
||||
|
||||
AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
updateListView(container);
|
||||
container.add(dataView);
|
||||
container.add(new PagingNavigator("pagingNavigator",
|
||||
dataView));
|
||||
target.addComponent(container);
|
||||
}
|
||||
|
||||
@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));
|
||||
};
|
||||
final Dialog dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.add(new EmptyPanel("dialogContent"));
|
||||
|
||||
searchField.add(userSearchTextBehaviour);
|
||||
add(searchField);
|
||||
updateListView(container);
|
||||
dialog.setWidth(500);
|
||||
dialog.setHeight(380);
|
||||
add(dialog);
|
||||
|
||||
container.add(dataView);
|
||||
add(container);
|
||||
container.add(new PagingNavigator("pagingNavigator", dataView));
|
||||
AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@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) {
|
||||
container.removeAll();
|
||||
ExemptionDaoParams exemptionDaoParams = new ExemptionDaoParams();
|
||||
if (userSearch != null) {
|
||||
if (userSearch.length() >= 3) {
|
||||
exemptionDaoParams.setAuthorNameLike(userSearch);
|
||||
}
|
||||
}
|
||||
loadUserDataView(new QueryableDataProvider<Exemption, ExemptionDaoParams>(
|
||||
exemptionDao, exemptionDaoParams));
|
||||
searchField.add(userSearchTextBehaviour);
|
||||
add(searchField);
|
||||
updateListView(container);
|
||||
|
||||
};
|
||||
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 =
|
||||
2828792237574112923L;
|
||||
private void updateListView(final WebMarkupContainer container) {
|
||||
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 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?"));
|
||||
public void loadUserDataView(IDataProvider<Exemption> exemptionDataProvider) {
|
||||
dataView =
|
||||
new DataView<Exemption>("listView", exemptionDataProvider, 10) {
|
||||
|
||||
}
|
||||
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.dataobjects.Student;
|
||||
import se.su.dsv.scipro.util.AutoCompleteStringFormatter;
|
||||
|
||||
public class StudentSelector extends Panel {
|
||||
|
||||
@ -37,7 +38,8 @@ public class StudentSelector extends Panel {
|
||||
|
||||
@Override
|
||||
protected String getTextValue(Student s){
|
||||
return s.getUser().toString();
|
||||
// return s.getUser().toString();
|
||||
return AutoCompleteStringFormatter.formatString(s.getUser());
|
||||
}
|
||||
@Override
|
||||
protected String getIdValue(Student s){
|
||||
|
Loading…
x
Reference in New Issue
Block a user