diff --git a/src/main/java/org/olat/resource/accesscontrol/ui/AccessConfigurationController.java b/src/main/java/org/olat/resource/accesscontrol/ui/AccessConfigurationController.java index 956c963c9bd1e04438b76d42a101a94b26098109..9b3a8c8bd537387fdc5e1946ca4a37e28f7ec514 100644 --- a/src/main/java/org/olat/resource/accesscontrol/ui/AccessConfigurationController.java +++ b/src/main/java/org/olat/resource/accesscontrol/ui/AccessConfigurationController.java @@ -69,6 +69,7 @@ public class AccessConfigurationController extends FormBasicController { private MultipleSelectionElement confirmationEmailEl; private final List<FormLink> addMethods = new ArrayList<>(); + private int counter = 0; private final String displayName; private final OLATResource resource; @@ -200,6 +201,7 @@ public class AccessConfigurationController extends FormBasicController { if(event.equals(Event.DONE_EVENT)) { OfferAccess newLink = newMethodCtrl.commitChanges(); addConfiguration(newLink); + confControllerContainer.setDirty(true); fireEvent(ureq, Event.CHANGED_EVENT); } cmc.deactivate(); @@ -286,15 +288,17 @@ public class AccessConfigurationController extends FormBasicController { confControllers.add(infos); if(editable) { - FormLink editLink = uifactory.addFormLink("edit_" + link.getKey(), "edit", "edit", null, confControllerContainer, Link.BUTTON_SMALL); + FormLink editLink = uifactory.addFormLink("edit_" + (++counter), "edit", "edit", null, confControllerContainer, Link.BUTTON_SMALL); editLink.setUserObject(infos); editLink.setIconLeftCSS("o_icon o_icon-fw o_icon_edit"); confControllerContainer.add(editLink.getName(), editLink); + infos.setEditButton(editLink); - FormLink delLink = uifactory.addFormLink("del_" + link.getKey(), "delete", "delete", null, confControllerContainer, Link.BUTTON_SMALL); + FormLink delLink = uifactory.addFormLink("del_" + (++counter), "delete", "delete", null, confControllerContainer, Link.BUTTON_SMALL); delLink.setUserObject(infos); delLink.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item"); confControllerContainer.add(delLink.getName(), delLink); + infos.setDeleteButton(delLink); } updateConfirmationEmail(); @@ -398,6 +402,9 @@ public class AccessConfigurationController extends FormBasicController { private String dates; private OfferAccess link; private final boolean paymentMethod; + + private FormLink editButton; + private FormLink deleteButton; public AccessInfo(String name, boolean paymentMethod, String infos, OfferAccess link) { this.name = name; @@ -469,5 +476,21 @@ public class AccessConfigurationController extends FormBasicController { this.link = link; this.dates = null; } + + public FormLink getEditButton() { + return editButton; + } + + public void setEditButton(FormLink editButton) { + this.editButton = editButton; + } + + public FormLink getDeleteButton() { + return deleteButton; + } + + public void setDeleteButton(FormLink deleteButton) { + this.deleteButton = deleteButton; + } } } \ No newline at end of file diff --git a/src/main/java/org/olat/resource/accesscontrol/ui/_content/configuration_list.html b/src/main/java/org/olat/resource/accesscontrol/ui/_content/configuration_list.html index 1ee2da3b39ab0beda0d7a6204d49bf4c3123236d..6c7e73dd2c71d9bbe3f3526f2a70c47962377498 100644 --- a/src/main/java/org/olat/resource/accesscontrol/ui/_content/configuration_list.html +++ b/src/main/java/org/olat/resource/accesscontrol/ui/_content/configuration_list.html @@ -14,11 +14,11 @@ <div id="desc_${confController.link.key}" style="display:none;"><div>$r.xssScan($desc)</div></div> #end <div class="pull-right"> - #if($r.available("edit_$confController.link.key")) - $r.render("edit_$confController.link.key") + #if($r.available($confController.editButton.component.componentName)) + $r.render($confController.editButton) #end - #if($r.available("del_$confController.link.key")) - $r.render("del_$confController.link.key") + #if($r.available($confController.deleteButton.component.componentName)) + $r.render($confController.deleteButton) #end </div> </div>