use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class SmsPhoneComponentRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
SmsPhoneComponent smsCmp = (SmsPhoneComponent) source;
SmsPhoneElement smsFte = smsCmp.getSmsPhoneElement();
String id = smsCmp.getFormDispatchId();
String phoneNumber = smsFte.getPhone();
if (!StringHelper.containsNonWhitespace(phoneNumber)) {
phoneNumber = smsFte.getTranslator().translate("sms.phone.not.available");
}
sb.append("<p id=\"").append(id).append("\" ").append(" class='form-control-static ");
if (StringHelper.containsNonWhitespace(smsCmp.getElementCssClass())) {
sb.append(smsCmp.getElementCssClass());
}
sb.append("'>").append(phoneNumber).append("</p>");
sb.append("<div class='o_form_example help-block'>").append(smsFte.getTranslator().translate("sms.phone.hint")).append("</div>");
if (smsFte.getAndResetFormDirty()) {
FormJSHelper.setFlexiFormDirtyOnLoad(sb, smsFte.getRootForm());
}
sb.append("<div class='form-inline'>");
FormLink editLink = smsFte.getEditLink();
if (editLink != null && editLink.isVisible()) {
Component cmp = editLink.getComponent();
cmp.getHTMLRendererSingleton().render(renderer, sb, cmp, ubu, translator, renderResult, args);
}
if (StringHelper.containsNonWhitespace(phoneNumber)) {
sb.append(" ");
FormLink removeLink = smsFte.getRemoveLink();
if (removeLink != null && removeLink.isVisible()) {
Component cmp = removeLink.getComponent();
cmp.getHTMLRendererSingleton().render(renderer, sb, cmp, ubu, translator, renderResult, args);
}
}
sb.append("</div>");
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class DialogElementListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == tableEl) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
DialogElementRow row = tableModel.getObject(se.getIndex());
if ("forum".equals(se.getCommand())) {
fireEvent(ureq, new SelectRowEvent(row));
} else if ("delete".equals(se.getCommand())) {
doConfirmDelete(ureq, row);
}
}
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if ("download".equals(cmd)) {
doFileDelivery(ureq, (DialogElement) link.getUserObject());
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class BGCopySingleGroupStep method getStepTitle.
@Override
public FormItem getStepTitle() {
String groupName = StringHelper.escapeHtml(groupToCopy.getName());
String title = getTranslator().translate("copy.wizard.bgstep", new String[] { groupName });
FormLink fl = new FormLinkImpl("copy.wizard." + groupToCopy.getKey(), null, title, Link.FLEXIBLEFORMLNK + Link.NONTRANSLATED);
fl.setTranslator(getTranslator());
return fl;
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class FavoritBusinessGroupListController method searchTableItems.
@Override
protected List<BGTableItem> searchTableItems(BusinessGroupQueryParams params) {
List<BusinessGroupRow> rows = businessGroupService.findBusinessGroupsWithMemberships(params, getIdentity());
List<BGTableItem> items = new ArrayList<>(rows.size());
for (BusinessGroupRow row : rows) {
BusinessGroupMembership membership = row.getMember();
Boolean allowLeave = membership != null;
Boolean allowDelete = isAdmin() ? Boolean.TRUE : (membership == null ? null : new Boolean(membership.isOwner()));
FormLink markLink = uifactory.addFormLink("mark_" + row.getKey(), "mark", "", null, null, Link.NONTRANSLATED);
markLink.setIconLeftCSS(row.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
BGTableItem item = new BGTableItem(row, markLink, allowLeave, allowDelete);
items.add(item);
}
return items;
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class PendingEnrollmentController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("reservations", reservations);
}
for (ReservationWrapper reservation : reservations) {
FormLink acceptLink = uifactory.addFormLink("accept_" + reservation.getKey(), "accept", null, formLayout, Link.BUTTON);
acceptLink.setUserObject(reservation);
acceptLink.setIconLeftCSS("o_icon o_icon_accept");
FormLink rejectLink = uifactory.addFormLink("reject_" + reservation.getKey(), "reject", null, formLayout, Link.BUTTON);
rejectLink.setUserObject(reservation);
rejectLink.setIconLeftCSS("o_icon o_icon_reject");
formLayout.add(acceptLink.getName(), acceptLink);
formLayout.add(rejectLink.getName(), rejectLink);
}
// Button layout
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
formLayout.add(buttonLayout);
uifactory.addFormSubmitButton("submit", "ok", buttonLayout);
uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
Aggregations