use of org.olat.core.gui.components.form.flexible.FormItemContainer in project OpenOLAT by OpenOLAT.
the class CPMetadataEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_cp_metadata");
// title-field
String titleString = page.getTitle();
title = uifactory.addTextElement("title", "cpmd.flexi.title", 256, titleString, formLayout);
title.setElementCssClass("o_sel_cp_title");
title.setDisplaySize(32);
title.setMandatory(true);
title.setNotEmptyCheck("cpmd.flexi.mustbefilled");
FormItemContainer buttonContainer = FormLayoutContainer.createButtonLayout("buttonContainer", getTranslator());
formLayout.add(buttonContainer);
uifactory.addFormSubmitButton("save", buttonContainer);
uifactory.addFormCancelButton("cancel", buttonContainer, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.FormItemContainer in project OpenOLAT by OpenOLAT.
the class OAuthAdminController method initCustomProviders.
private void initCustomProviders() {
// remove old ones
for (ConfigurableProviderWrapper providerWrapper : providerWrappers) {
FormItemContainer layoutCont = providerWrapper.getLayoutCont();
customProvidersCont.remove(layoutCont);
}
providerWrappers.clear();
List<OAuthSPI> configurableSpies = oauthModule.getAllConfigurableSPIs();
for (OAuthSPI configurableSpi : configurableSpies) {
if (configurableSpi instanceof OpenIdConnectFullConfigurableProvider) {
ConfigurableProviderWrapper wrapper = initOpenIDConnectIFFullConfigurableProviders(customProvidersCont, (OpenIdConnectFullConfigurableProvider) configurableSpi);
if (wrapper != null) {
providerWrappers.add(wrapper);
}
}
}
}
use of org.olat.core.gui.components.form.flexible.FormItemContainer in project OpenOLAT by OpenOLAT.
the class TrueFalseEditorController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FormLayoutContainer metadata = FormLayoutContainer.createDefaultFormLayout("metadata", getTranslator());
if (itemBuilder.getQuestionType() == QTI21QuestionType.matchdraganddrop) {
metadata.setFormContextHelp("Test editor QTI 2.1 in detail#details_testeditor_fragetypen_draganddrop");
} else {
metadata.setFormContextHelp("Test editor QTI 2.1 in detail#details_testeditor_fragetypen_match");
}
metadata.setRootForm(mainForm);
formLayout.add(metadata);
formLayout.add("metadata", metadata);
titleEl = uifactory.addTextElement("title", "form.imd.title", -1, itemBuilder.getTitle(), metadata);
titleEl.setElementCssClass("o_sel_assessment_item_title");
titleEl.setMandatory(true);
titleEl.setEnabled(!readOnly);
String description = itemBuilder.getQuestion();
textEl = uifactory.addRichTextElementForQTI21("desc", "form.imd.descr", description, 8, -1, itemContainer, metadata, ureq.getUserSession(), getWindowControl());
textEl.setEnabled(!readOnly);
textEl.setVisible(!readOnly);
if (readOnly) {
FlowFormItem textReadOnlyEl = new FlowFormItem("descro", itemFile);
textReadOnlyEl.setLabel("form.imd.descr", null);
textReadOnlyEl.setBlocks(itemBuilder.getQuestionBlocks());
textReadOnlyEl.setMapperUri(mapperUri);
metadata.add(textReadOnlyEl);
}
// responses
String page = velocity_root + "/match_truefalse.html";
answersCont = FormLayoutContainer.createCustomFormLayout("answers", getTranslator(), page);
answersCont.setRootForm(mainForm);
answersCont.contextPut("showHeaders", (itemBuilder.getQuestionType() == QTI21QuestionType.matchdraganddrop));
formLayout.add(answersCont);
formLayout.add("answers", answersCont);
MatchInteraction interaction = itemBuilder.getMatchInteraction();
if (interaction != null) {
List<SimpleAssociableChoice> sourceChoices = itemBuilder.getSourceChoices();
for (SimpleAssociableChoice sourceChoice : sourceChoices) {
wrapSource(ureq, sourceChoice, sourceWrappers);
}
List<TargetWrapper> targetChoices = itemBuilder.getTargetChoices().stream().map(c -> new TargetWrapper(c)).collect(Collectors.toList());
answersCont.contextPut("targetChoices", targetChoices);
}
answersCont.contextPut("sourceChoices", sourceWrappers);
answersCont.contextPut("restrictedEdit", restrictedEdit || readOnly);
answersCont.contextPut("responseIdentifier", itemBuilder.getResponseIdentifier());
int maxAssociations = itemBuilder.getMatchInteraction().getMaxAssociations();
answersCont.contextPut("interactionMaxAssociations", maxAssociations);
JSAndCSSFormItem js = new JSAndCSSFormItem("js", new String[] { "js/jquery/qti/jquery.match.js" });
formLayout.add(js);
if (!readOnly) {
uifactory.addFormSubmitButton("submit", answersCont);
}
if (!restrictedEdit && !readOnly) {
addRowButton = uifactory.addFormLink("add.match.row", answersCont, Link.BUTTON);
addRowButton.setElementCssClass("o_sel_match_add_row");
addRowButton.setIconLeftCSS("o_icon o_icon_add");
}
}
use of org.olat.core.gui.components.form.flexible.FormItemContainer in project OpenOLAT by OpenOLAT.
the class MediaDetailsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("title", StringHelper.escapeHtml(media.getTitle()));
layoutCont.contextPut("description", StringHelper.xssScan(media.getDescription()));
layoutCont.contextPut("iconCssClass", handler.getIconCssClass(media));
mediaCtrl = handler.getMediaController(ureq, getWindowControl(), media, new StandardMediaRenderingHints());
if (mediaCtrl != null) {
listenTo(mediaCtrl);
layoutCont.put("media", mediaCtrl.getInitialComponent());
}
String metaPage = velocity_root + "/media_details_metadata.html";
FormLayoutContainer metaCont = FormLayoutContainer.createCustomFormLayout("meta", getTranslator(), metaPage);
layoutCont.add("meta", metaCont);
metaCont.setRootForm(mainForm);
metaCont.contextPut("media", media);
String author = userManager.getUserDisplayName(media.getAuthor());
metaCont.contextPut("author", author);
if (media.getCollectionDate() != null) {
String collectionDate = Formatter.getInstance(getLocale()).formatDate(media.getCollectionDate());
metaCont.contextPut("collectionDate", collectionDate);
}
if (media.getBusinessPath() != null) {
gotoOriginalLink = LinkFactory.createLink("goto.original", metaCont.getFormItemComponent(), this);
}
if (StringHelper.containsNonWhitespace(media.getMetadataXml())) {
Object metadata = MetadataXStream.get().fromXML(media.getMetadataXml());
metaCont.contextPut("metadata", metadata);
}
List<Category> categories = portfolioService.getCategories(media);
if (categories != null && categories.size() > 0) {
Map<String, String> categoriesMap = categories.stream().collect(Collectors.toMap(c -> c.getName(), c -> c.getName()));
TextBoxListElement categoriesEl = uifactory.addTextBoxListElement("categories", "categories", "categories.hint", categoriesMap, metaCont, getTranslator());
categoriesEl.setHelpText(translate("categories.hint"));
categoriesEl.setElementCssClass("o_sel_ep_tagsinput");
categoriesEl.setEnabled(false);
}
List<FormLink> binderLinks = new ArrayList<>(usedInList.size());
Set<Long> binderUniqueKeys = new HashSet<>();
for (BinderPageUsage binder : usedInList) {
if (binderUniqueKeys.contains(binder.getBinderKey()))
continue;
FormLink link;
if (binder.getBinderKey() == null) {
link = uifactory.addFormLink("binder_" + (++counter), "page", binder.getPageTitle(), null, metaCont, Link.LINK | Link.NONTRANSLATED);
binderUniqueKeys.add(binder.getPageKey());
} else {
link = uifactory.addFormLink("binder_" + (++counter), "binder", binder.getBinderTitle(), null, metaCont, Link.LINK | Link.NONTRANSLATED);
binderUniqueKeys.add(binder.getBinderKey());
}
link.setUserObject(binder);
binderLinks.add(link);
}
metaCont.contextPut("binderLinks", binderLinks);
}
}
use of org.olat.core.gui.components.form.flexible.FormItemContainer in project OpenOLAT by OpenOLAT.
the class TranslationToolStartCrumbController method initSearchItemsElements.
private void initSearchItemsElements(FormUIFactory formFactory, FormItemContainer formLayout, String[] bundlesKeys, String[] bundlesValues) {
FormItemContainer searchLayoutContainer = FormLayoutContainer.createDefaultFormLayout("searchLayoutContainer", getTranslator());
formLayout.add(searchLayoutContainer);
// Add search input field
searchInput = formFactory.addTextElement("searchInput", "start.search.input", 100, "", searchLayoutContainer);
// Add search selecton for searching in keys or values
String[] searchKeyValueKeys = new String[] { KEYS_KEY, KEYS_VALUE };
String[] searchKeyValueValues = new String[] { translate("generic.key"), translate("generic.value") };
searchKeyValueSelection = formFactory.addRadiosHorizontal("searchKeyValueSelection", "start.search.in", searchLayoutContainer, searchKeyValueKeys, searchKeyValueValues);
searchKeyValueSelection.select(KEYS_VALUE, true);
// Add search selecton for reference or target search
String[] searchReferenceTargetKeys = new String[] { KEYS_REFERENCE, KEYS_TARGET };
String[] searchReferenceTargetValues;
if (customizingMode) {
searchReferenceTargetValues = new String[] { translate("generic.customize.lang.reference"), translate("generic.customize.lang.target") };
} else {
searchReferenceTargetValues = new String[] { translate("generic.lang.reference"), translate("generic.lang.target") };
}
searchReferenceTargetSelection = formFactory.addRadiosHorizontal("searchReferenceTargetSelection", "start.search.in", searchLayoutContainer, searchReferenceTargetKeys, searchReferenceTargetValues);
searchReferenceTargetSelection.select(KEYS_TARGET, true);
// Add search bundles selector : reuse keys from above
searchBundlesSelection = formFactory.addDropdownSingleselect("searchBundlesSelection", searchLayoutContainer, bundlesKeys, bundlesValues, null);
searchBundlesSelection.setLabel("generic.limit.bundles", null);
searchBundlesSelection.addActionListener(FormEvent.ONCHANGE);
searchBundlesSelection.select(ALL_BUNDLES_IDENTIFYER, true);
// Add search bundles children switch
searchBundlesIncludeBundlesChildrenSwitch = formFactory.addCheckboxesHorizontal("searchBundlesIncludeBundlesChildrenSwitch", "generic.limit.bundles.includeChildren", searchLayoutContainer, new String[] { KEYS_ENABLED }, new String[] { KEYS_EMPTY });
searchBundlesIncludeBundlesChildrenSwitch.select(KEYS_ENABLED, true);
searchBundlesIncludeBundlesChildrenSwitch.addActionListener(FormEvent.ONCLICK);
searchBundlesIncludeBundlesChildrenSwitch.setEnabled(false);
// Add priority sort switch
searchBundlesPrioritySortSwitch = formFactory.addCheckboxesHorizontal("searchBundlesPrioritySortSwitch", "generic.sort.by.priority", searchLayoutContainer, new String[] { KEYS_ENABLED }, new String[] { KEYS_EMPTY });
searchBundlesPrioritySortSwitch.select(KEYS_ENABLED, true);
searchBundlesPrioritySortSwitch.addActionListener(FormEvent.ONCLICK);
formLayout.add(searchBundlesPrioritySortSwitch);
// Add button to trigger search
FormItemContainer searchButtonLayoutContainer = FormLayoutContainer.createButtonLayout("searchButtonLayoutContainer", getTranslator());
searchLayoutContainer.add(searchButtonLayoutContainer);
searchListButton = uifactory.addFormLink("searchListButton", "generic.listButton", null, searchButtonLayoutContainer, Link.BUTTON);
searchTranslateButton = uifactory.addFormLink("searchTranslateButton", "generic.translateButton", null, searchButtonLayoutContainer, Link.BUTTON);
}
Aggregations