use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
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.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class AccessConfigurationController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (addMethods.contains(source)) {
AccessMethod method = (AccessMethod) source.getUserObject();
addMethod(ureq, method);
} else if (source instanceof FormLink) {
FormLink button = (FormLink) source;
String cmd = button.getCmd();
if ("delete".equals(cmd)) {
AccessInfo infos = (AccessInfo) source.getUserObject();
removeMethod(infos);
fireEvent(ureq, Event.CHANGED_EVENT);
} else if ("edit".equals(cmd)) {
AccessInfo infos = (AccessInfo) source.getUserObject();
editMethod(ureq, infos);
}
} else if (confirmationEmailEl == source) {
setConfirmationEmail(confirmationEmailEl.isAtLeastSelected(1));
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class AccessConfigurationController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// contextHelptexts for Label
HelpTooltip acMethodsLabelHelp = new HelpTooltip("acMethodsLabelHelp", "Legen Sie fest unter welchen Bedingungen Benutzer diese Ressource buchen können.", "Course Settings#_buchungsmethode", getLocale());
((FormLayoutContainer) formLayout).put("acMethodsLabelHelp", acMethodsLabelHelp);
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[] onValues = new String[] { "" };
confirmationEmailEl = uifactory.addCheckboxesHorizontal("confirmation.email", formLayout, onKeys, onValues);
confirmationEmailEl.addActionListener(FormEvent.ONCHANGE);
confirmationEmailEl.setVisible(false);
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);
boolean confirmationEmail = false;
for (AccessInfo info : confControllers) {
Offer offer = info.getLink().getOffer();
confirmationEmail |= offer.isConfirmationEmail();
}
if (confirmationEmail) {
confirmationEmailEl.select(onKeys[0], true);
}
if (!embbed) {
setFormTitle("accesscontrol.title");
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));
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class PortfolioResultDetailsController method popupDeadlineBox.
/**
* @param ureq
*/
private void popupDeadlineBox(UserRequest ureq, EPStructuredMap map) {
String title = translate("map.deadline.change");
removeAsListenerAndDispose(deadlineCtr);
deadlineCtr = new DeadlineController(ureq, getWindowControl(), map);
listenTo(deadlineCtr);
removeAsListenerAndDispose(deadlineCalloutCtr);
FormLink changeDeadlineLink = mapToElements.get(map).changeDeadlineLink;
deadlineCalloutCtr = new CloseableCalloutWindowController(ureq, getWindowControl(), deadlineCtr.getInitialComponent(), changeDeadlineLink, title, true, "o_ep_deadline_callout");
listenTo(deadlineCalloutCtr);
deadlineCalloutCtr.activate();
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class CustomfieldsFormController method formInnerEvent.
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source instanceof FormLink) {
FormLink link = (FormLink) source;
if (link.getName().equals(ADD_FIELD_LINK)) {
if (customFields.size() < MAX_NBR_CUSTOM_FIELDS) {
// Add new custom-field
int indexNewCustomField = customFields.size();
customFields.add(new CustomField("", "", false));
// first remove existing submit button, add it again at the end
flc.remove(formSubmit);
createFormElemente(this.flc, indexNewCustomField, customFields.get(indexNewCustomField));
formSubmit = uifactory.addFormSubmitButton("save", this.flc);
} else {
this.showInfo("info.max.nbr.custom.fields");
}
} else {
int deleteElementNumber = ((Integer) link.getUserObject()).intValue();
getLogger().debug("remove customfield #=" + deleteElementNumber);
customFields.remove(deleteElementNumber);
initFormElements(flc);
}
}
this.flc.setDirty(true);
}
Aggregations