protected void addMethod(UserRequest ureq, AccessMethod method) { Offer offer = acService.createOffer(resource, displayName); OfferAccess link = acService.createOfferAccess(offer, method); removeAsListenerAndDispose(newMethodCtrl); AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); if (handler != null) { newMethodCtrl = handler.createConfigurationController(ureq, getWindowControl(), link); } if (newMethodCtrl != null) { listenTo(newMethodCtrl); String title = handler.getMethodName(getLocale()); cmc = new CloseableModalController( getWindowControl(), translate("close"), newMethodCtrl.getInitialComponent(), true, title); cmc.activate(); listenTo(cmc); } else { OfferAccess newLink = acService.saveOfferAccess(link); addConfiguration(newLink); } }
protected void addConfiguration(OfferAccess link) { AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); AccessInfo infos = new AccessInfo(handler.getMethodName(getLocale()), handler.isPaymentMethod(), null, link); confControllers.add(infos); if (editable) { FormLink editLink = uifactory.addFormLink( "edit_" + link.getKey(), "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); FormLink delLink = uifactory.addFormLink( "del_" + link.getKey(), "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); } }
private GenericTreeModel buildTreeModel() { GenericTreeModel gtm = new GenericTreeModel(); GenericTreeNode root = new GenericTreeNode(); root.setTitle(translate("menu.members")); root.setAltText(translate("menu.members.alt")); gtm.setRootNode(root); GenericTreeNode node = new GenericTreeNode(translate("menu.members"), CMD_MEMBERS); node.setAltText(translate("menu.members.alt")); root.addChild(node); node = new GenericTreeNode(translate("menu.groups"), CMD_GROUPS); node.setAltText(translate("menu.groups.alt")); root.addChild(node); if (acModule.isEnabled()) { // check if the course is managed and/or has offers if (!RepositoryEntryManagedFlag.isManaged(repoEntry, RepositoryEntryManagedFlag.bookings) || acService.isResourceAccessControled(repoEntry.getOlatResource(), null)) { node = new GenericTreeNode(translate("menu.orders"), CMD_BOOKING); node.setAltText(translate("menu.orders.alt")); root.addChild(node); } } node = new GenericTreeNode(translate("menu.rights"), CMD_RIGHTS); node.setAltText(translate("menu.rights.alt")); root.addChild(node); return gtm; }
@Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { if (editable) { List<AccessMethod> methods = acService.getAvailableMethods(getIdentity(), ureq.getUserSession().getRoles()); for (AccessMethod method : methods) { AccessMethodHandler handler = acModule.getAccessMethodHandler(method.getType()); if (handler.isPaymentMethod() && !allowPaymentMethod) { continue; } String title = handler.getMethodName(getLocale()); FormLink add = uifactory.addFormLink( "create." + handler.getType(), title, null, formLayout, Link.LINK | Link.NONTRANSLATED); add.setUserObject(method); add.setIconLeftCSS(("o_icon " + method.getMethodCssClass() + "_icon o_icon-lg").intern()); addMethods.add(add); formLayout.add(add.getName(), add); } ((FormLayoutContainer) formLayout).contextPut("methods", addMethods); } String confPage = velocity_root + "/configuration_list.html"; confControllerContainer = FormLayoutContainer.createCustomFormLayout("conf-controllers", getTranslator(), confPage); confControllerContainer.setRootForm(mainForm); formLayout.add(confControllerContainer); loadConfigurations(); confControllerContainer.contextPut("confControllers", confControllers); if (!embbed) { setFormTitle("accesscontrol.title"); setFormContextHelp( AccessConfigurationController.class.getPackage().getName(), "accesscontrol.html", "chelp.accesscontrol.hover"); if (editable) { final FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator()); buttonGroupLayout.setRootForm(mainForm); formLayout.add(buttonGroupLayout); formLayout.add("buttonLayout", buttonGroupLayout); uifactory.addFormSubmitButton("save", buttonGroupLayout); } } confControllerContainer.contextPut( "emptyConfigGrantsFullAccess", Boolean.valueOf(emptyConfigGrantsFullAccess)); }
private void editMethod(UserRequest ureq, AccessInfo infos) { OfferAccess link = infos.getLink(); removeAsListenerAndDispose(editMethodCtrl); AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); if (handler != null) { editMethodCtrl = handler.editConfigurationController(ureq, getWindowControl(), link); } if (editMethodCtrl != null) { listenTo(editMethodCtrl); String title = handler.getMethodName(getLocale()); cmc = new CloseableModalController( getWindowControl(), translate("close"), editMethodCtrl.getInitialComponent(), true, title); cmc.activate(); listenTo(cmc); } }