Search in sources :

Example 31 with AccessMethodHandler

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());
    }
}
Also used : AccessTransaction(org.olat.resource.accesscontrol.AccessTransaction) AccessMethod(org.olat.resource.accesscontrol.model.AccessMethod) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Example 32 with AccessMethodHandler

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);
    }
}
Also used : OfferAccess(org.olat.resource.accesscontrol.OfferAccess) Offer(org.olat.resource.accesscontrol.Offer) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Example 33 with AccessMethodHandler

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();
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Example 34 with AccessMethodHandler

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);
    }
}
Also used : OfferAccess(org.olat.resource.accesscontrol.OfferAccess) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Example 35 with AccessMethodHandler

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);
    }
}
Also used : OfferAccess(org.olat.resource.accesscontrol.OfferAccess) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Aggregations

AccessMethodHandler (org.olat.resource.accesscontrol.method.AccessMethodHandler)38 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)12 OfferAccess (org.olat.resource.accesscontrol.OfferAccess)12 ArrayList (java.util.ArrayList)10 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)10 AccessMethod (org.olat.resource.accesscontrol.model.AccessMethod)10 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 PriceMethod (org.olat.repository.ui.PriceMethod)8 OLATResource (org.olat.resource.OLATResource)8 Offer (org.olat.resource.accesscontrol.Offer)6 OLATResourceAccess (org.olat.resource.accesscontrol.model.OLATResourceAccess)6 PriceMethodBundle (org.olat.resource.accesscontrol.model.PriceMethodBundle)6 Date (java.util.Date)4 HelpTooltip (org.olat.core.gui.components.helpTooltip.HelpTooltip)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 AccessResult (org.olat.resource.accesscontrol.AccessResult)4 AccessTransaction (org.olat.resource.accesscontrol.AccessTransaction)4 HashSet (java.util.HashSet)2