use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project openolat by klemens.
the class TransactionDetailsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
String page = velocity_root + "/transaction_details.html";
FormLayoutContainer detailsLayout = FormLayoutContainer.createCustomFormLayout("transaction-details-layout", getTranslator(), page);
formLayout.add(detailsLayout);
detailsLayout.setRootForm(mainForm);
AccessTransaction transaction = wrapper.getTransaction();
DetailsForm detailsForm = new DetailsForm(ureq, getWindowControl(), transaction, mainForm);
detailsLayout.add("simple", detailsForm.getInitialFormItem());
AccessMethod method = transaction.getMethod();
AccessMethodHandler handler = acModule.getAccessMethodHandler(method.getType());
FormController controller = handler.createTransactionDetailsController(ureq, getWindowControl(), order, wrapper.getPart(), method, mainForm);
if (controller != null) {
uifactory.addSpacerElement("details-spacer", detailsLayout, false);
detailsLayout.add("custom", controller.getInitialFormItem());
}
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project openolat by klemens.
the class AccessConfigurationController method addMethod.
protected void addMethod(UserRequest ureq, AccessMethod method) {
boolean confirmationEmail = confirmationEmailEl.isVisible() && confirmationEmailEl.isAtLeastSelected(1);
Offer offer = acService.createOffer(resource, displayName);
offer.setConfirmationEmail(confirmationEmail);
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);
}
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project openolat by klemens.
the class AccessConfigurationController method addConfiguration.
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);
}
updateConfirmationEmail();
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project openolat by klemens.
the class AccessConfigurationController method editMethod.
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);
}
}
use of org.olat.resource.accesscontrol.method.AccessMethodHandler in project openolat by klemens.
the class MainAccessController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
backLink = uifactory.addFormLink("back", formLayout, Link.LINK_BACK);
FormLayoutContainer methodChooseContainer = FormLayoutContainer.createDefaultFormLayout("methodChooser", getTranslator());
methodChooseContainer.setRootForm(mainForm);
formLayout.add("methodChooser", methodChooseContainer);
for (OfferAccess link : links) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
String methodName = handler.getMethodName(getLocale());
FormLink accessButton = uifactory.addFormLink("m_" + link.getKey(), methodName, null, methodChooseContainer, Link.BUTTON + Link.NONTRANSLATED);
accessButton.setUserObject(link);
accessButtons.add(accessButton);
}
}
Aggregations