Search in sources :

Example 91 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.

the class GroupChoiceForm method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == manageChecklistTable) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent tableEvent = (TableEvent) event;
            Long identityKey = manageTableData.getParticipantKeyAt(tableEvent.getRowId());
            selectedIdentity = securityManager.loadIdentityByKey(identityKey, false);
            if (tableEvent.getActionId().equals(EDIT_ACTION)) {
                initEditTable(ureq, selectedIdentity);
                VelocityContainer vcManageUser = createVelocityContainer("manageUser");
                vcManageUser.put("table", editChecklistTable.getInitialComponent());
                String name = selectedIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()) + " " + selectedIdentity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
                visitingCardButton = LinkFactory.createLink("cl.manage.user.visitingcard", vcManageUser, this);
                visitingCardButton.setCustomDisplayText(name);
                removeAsListenerAndDispose(cmc);
                cmc = new CloseableModalController(getWindowControl(), translate("cl.close"), vcManageUser, true, translate("cl.edit.title"));
                listenTo(cmc);
                cmc.activate();
            } else if (tableEvent.getActionId().equals(DETAILS_ACTION)) {
                openVisitingCard(ureq);
            }
        }
    } else if (source == editChecklistTable) {
        if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            if (tmse.getAction().equals("save")) {
                BitSet selection = tmse.getSelection();
                updateCheckpointsFor(selectedIdentity, selection);
                initManageTable(ureq);
            }
            cmc.deactivate();
        }
    } else if (source == groupForm) {
        if (event == Event.CHANGED_EVENT) {
            initManageTable(ureq);
        } else if (event.getCommand().equals(GroupChoiceForm.EXPORT_TABLE)) {
            downloadResults(ureq);
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) BitSet(java.util.BitSet) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 92 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.

the class LinksPortletRunController method buildEditorPanel.

private void buildEditorPanel() {
    VelocityContainer editorVC = this.createVelocityContainer("editorLinkOverview");
    Map<String, PortletInstitution> content = LinksPortlet.getContent();
    if (content != null && !content.isEmpty()) {
        ArrayList<String> allInst = new ArrayList<String>();
        ArrayList<String> allInstTranslated = new ArrayList<String>();
        HashMap<Integer, ArrayList<String>> allInstWithLinkIds = new HashMap<Integer, ArrayList<String>>();
        int instCount = 1;
        for (Iterator<String> iterator = content.keySet().iterator(); iterator.hasNext(); ) {
            String inst = iterator.next();
            allInst.add(inst);
            String instTranslated = inst;
            if (inst.equals(LinksPortlet.ACCESS_ALL))
                instTranslated = translate("access.all");
            if (inst.equals(LinksPortlet.ACCESS_REG))
                instTranslated = translate("access.registered.users");
            if (inst.equals(LinksPortlet.ACCESS_GUEST))
                instTranslated = translate("access.guests");
            allInstTranslated.add(instTranslated);
            PortletInstitution portletsForInst = content.get(inst);
            // collect identifiers to find them in VC.
            ArrayList<String> instLinksIdentifiers = new ArrayList<String>();
            // add add-link per institution
            LinkFactory.createCustomLink(LINKADD + inst, LINKADD + inst, "add.link", Link.BUTTON_XSMALL, editorVC, this);
            for (PortletLink link : portletsForInst.getLinks()) {
                String linkID = link.getIdentifier();
                LinkFactory.createCustomLink(LINKID + linkID, "inst" + inst, link.getTitle(), Link.LINK + Link.NONTRANSLATED, editorVC, this);
                // add remove-links
                LinkFactory.createCustomLink(LINKDEL + linkID, "inst" + inst, "-", Link.BUTTON_XSMALL + Link.NONTRANSLATED, editorVC, this);
                instLinksIdentifiers.add(linkID);
            }
            allInstWithLinkIds.put(instCount, instLinksIdentifiers);
            instCount++;
        }
        editorVC.contextPut("allInst", allInst);
        editorVC.contextPut("allInstTranslated", allInstTranslated);
        editorVC.contextPut("allInstWithLinkIds", allInstWithLinkIds);
    }
    backLink = LinkFactory.createButtonXSmall("back", editorVC, this);
    backLink.setIconLeftCSS("o_icon o_icon-fw o_icon_edit");
    backLink.setPrimary(true);
    viewPanel.setContent(editorVC);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 93 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class RightsMetadataEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    String authorListPage = velocity_root + "/author_list.html";
    authorCont = FormLayoutContainer.createCustomFormLayout("owners", getTranslator(), authorListPage);
    authorCont.setLabel("rights.owners", null);
    formLayout.add(authorCont);
    authorCont.setRootForm(mainForm);
    reloadAuthors();
    VelocityContainer vc = authorCont.getFormItemComponent();
    managerOwners = LinkFactory.createButton("manage.owners", vc, this);
    authorCont.put("manage.owners", managerOwners);
    if (licenseModule.isEnabled(licenseHandler)) {
        license = licenseService.loadOrCreateLicense(item);
        LicenseSelectionConfig licenseSelectionConfig = LicenseUIFactory.createLicenseSelectionConfig(licenseHandler, license.getLicenseType());
        licenseEl = uifactory.addDropdownSingleselect("rights.license", formLayout, licenseSelectionConfig.getLicenseTypeKeys(), licenseSelectionConfig.getLicenseTypeValues(getLocale()));
        licenseEl.setElementCssClass("o_sel_repo_license");
        licenseEl.setMandatory(licenseSelectionConfig.isLicenseMandatory());
        if (licenseSelectionConfig.getSelectionLicenseTypeKey() != null) {
            licenseEl.select(licenseSelectionConfig.getSelectionLicenseTypeKey(), true);
        }
        licenseEl.addActionListener(FormEvent.ONCHANGE);
        licensorEl = uifactory.addTextElement("rights.licensor", 1000, license.getLicensor(), formLayout);
        String freetext = licenseService.isFreetext(license.getLicenseType()) ? license.getFreetext() : "";
        licenseFreetextEl = uifactory.addTextAreaElement("rights.freetext", 4, 72, freetext, formLayout);
        LicenseUIFactory.updateVisibility(licenseEl, licensorEl, licenseFreetextEl);
        licenseTextEl = uifactory.addStaticTextElement("rights.licenseText", "", "", formLayout);
        updateLicenseText();
        buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
        buttonsCont.setRootForm(mainForm);
        formLayout.add(buttonsCont);
        okButton = uifactory.addFormSubmitButton("ok", "ok", buttonsCont);
        uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    }
}
Also used : LicenseSelectionConfig(org.olat.core.commons.services.license.ui.LicenseSelectionConfig) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 94 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class RegistrationController method setErrorPage.

private VelocityContainer setErrorPage(String errorKey, WindowControl wControl) {
    String error = getTranslator().translate(errorKey);
    wControl.setError(error);
    VelocityContainer errorContainer = createVelocityContainer("error");
    errorContainer.contextPut("errorMsg", error);
    return errorContainer;
}
Also used : VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 95 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class SearchUserTool method getMenuComponent.

@Override
public Component getMenuComponent(UserRequest ureq, VelocityContainer container) {
    if (searchC == null) {
        String resourceUrl = null;
        BusinessControl bc = wControl.getBusinessControl();
        if (bc != null) {
            resourceUrl = bc.getAsString();
        }
        searchC = new SearchInputController(ureq, wControl, resourceUrl, DisplayOption.STANDARD);
        searchC.setResourceContextEnable(false);
        searchC.setAssessmentListener(ureq);
    }
    String componentName = "search-menu-" + CodeHelper.getRAMUniqueID();
    String velocity_root = Util.getPackageVelocityRoot(SearchControllerFactory.class);
    String pagePath = velocity_root + "/search_tool.html";
    VelocityContainer search = new VelocityContainer(componentName, pagePath, container.getTranslator(), this);
    search.setDomReplacementWrapperRequired(false);
    search.put("search_input", searchC.getInitialComponent());
    container.put(componentName, search);
    return search;
}
Also used : SearchInputController(org.olat.search.ui.SearchInputController) BusinessControl(org.olat.core.id.context.BusinessControl) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Aggregations

VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)162 Component (org.olat.core.gui.components.Component)22 ArrayList (java.util.ArrayList)16 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)14 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)14 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)14 Link (org.olat.core.gui.components.link.Link)12 Panel (org.olat.core.gui.components.panel.Panel)12 UserRequest (org.olat.core.gui.UserRequest)10 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)10 List (java.util.List)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)8 WindowControl (org.olat.core.gui.control.WindowControl)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 Translator (org.olat.core.gui.translator.Translator)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 HashMap (java.util.HashMap)6 Collectors (java.util.stream.Collectors)6 Mapper (org.olat.core.dispatcher.mapper.Mapper)6 BarSeries (org.olat.core.gui.components.chart.BarSeries)6