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);
}
}
}
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);
}
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());
}
}
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;
}
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;
}
Aggregations