use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class PrintUserTool method getMenuComponent.
@Override
public Component getMenuComponent(UserRequest ureq, VelocityContainer container) {
String componentName = "print-" + CodeHelper.getRAMUniqueID();
String velocity_root = Util.getPackageVelocityRoot(PrintUserTool.class);
String pagePath = velocity_root + "/print.html";
VelocityContainer print = new VelocityContainer(componentName, pagePath, container.getTranslator(), this);
print.setDomReplacementWrapperRequired(false);
container.put(componentName, print);
return print;
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class GuiDemoPushPopController method event.
public void event(UserRequest ureq, Component source, Event event) {
if (source == pushButton) {
VelocityContainer container = this.createVelocityContainer("guidemo-pushpop");
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, container, null);
listenTo(layoutCtr);
windowStack.push(layoutCtr.getInitialComponent());
container.put("guidemo.window.control.push", pushButton);
container.put("guidemo.window.control.pop", popButton);
container.contextPut("stack", getStackHTMLRepresentation());
getWindowControl().pushToMainArea(container);
} else if (source == popButton) {
if (windowStack.isEmpty()) {
fireEvent(ureq, Event.DONE_EVENT);
} else {
getWindowControl().pop();
windowStack.pop();
}
}
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class LoginAuthprovidersController method initLoginContent.
private VelocityContainer initLoginContent(UserRequest ureq, String provider) {
// in every case we build the container for pages to fill the panel
VelocityContainer contentBorn = createVelocityContainer("main_loging", "login");
// browser not supported messages
// true if browserwarning should be showed
boolean bwo = Settings.isBrowserAjaxBlacklisted(ureq);
contentBorn.contextPut("browserWarningOn", bwo ? Boolean.TRUE : Boolean.FALSE);
// prepare login
if (provider == null) {
provider = loginModule.getDefaultProviderName();
}
AuthenticationProvider authProvider = loginModule.getAuthenticationProvider(provider);
if (authProvider == null) {
authProvider = loginModule.getAuthenticationProviderHeuristic(provider);
}
// clean-up controllers
if (authController != null) {
removeAsListenerAndDispose(authController);
}
for (Controller controller : authControllers) {
removeAsListenerAndDispose(controller);
}
authControllers.clear();
// recreate controllers
authController = authProvider.createController(ureq, getWindowControl());
listenTo(authController);
contentBorn.put("loginComp", authController.getInitialComponent());
contentBorn.contextPut("currentProvider", authProvider.getName());
Collection<AuthenticationProvider> providers = loginModule.getAuthenticationProviders();
List<AuthenticationProvider> providerSet = new ArrayList<>(providers.size());
int count = 0;
for (AuthenticationProvider prov : providers) {
if (prov.isEnabled()) {
providerSet.add(prov);
if (!prov.getName().equals(authProvider.getName())) {
// hang these components to the component tree, for state-less behavior
Controller controller = prov.createController(ureq, getWindowControl());
authControllers.add(controller);
Component cmp = controller.getInitialComponent();
contentBorn.put("dormant_" + count++, cmp);
listenTo(controller);
}
}
}
contentBorn.contextPut("providerSet", providerSet);
contentBorn.contextPut("locale", ureq.getLocale());
// prepare info message
InfoMessageManager mrg = CoreSpringFactory.getImpl(InfoMessageManager.class);
String infomsg = mrg.getInfoMessage();
if (infomsg != null && infomsg.length() > 0) {
contentBorn.contextPut("infomsg", infomsg);
}
String infomsgNode = mrg.getInfoMessageNodeOnly();
if (infomsgNode != null && infomsgNode.length() > 0) {
contentBorn.contextPut("infomsgNode", infomsgNode);
}
// add additional login intro message for custom content
String customMsg = translate("login.custommsg");
if (!StringUtils.isBlank(customMsg)) {
contentBorn.contextPut("logincustommsg", customMsg);
}
// add additional login footer message for custom content
String footerMsg = translate("login.customfootermsg");
if (!StringUtils.isBlank(footerMsg)) {
contentBorn.contextPut("loginfootermsg", footerMsg);
}
// login is blocked?
if (AuthHelper.isLoginBlocked()) {
contentBorn.contextPut("loginBlocked", Boolean.TRUE);
}
// guest link
if (loginModule.isGuestLoginEnabled()) {
anoLink = LinkFactory.createButton("menu.guest", contentBorn, this);
anoLink.setIconLeftCSS("o_icon o_icon-2x o_icon_provider_guest");
anoLink.setTitle("menu.guest.alt");
anoLink.setEnabled(!AuthHelper.isLoginBlocked());
}
return contentBorn;
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class LoginAuthprovidersController method showAboutPage.
protected void showAboutPage() {
VelocityContainer aboutVC = createVelocityContainer("about");
// Add version info and licenses
aboutVC.contextPut("version", Settings.getFullVersionInfo());
// Add translator and languages info
I18nManager i18nMgr = I18nManager.getInstance();
Collection<String> enabledKeysSet = i18nModule.getEnabledLanguageKeys();
Map<String, String> langNames = new HashMap<String, String>();
Map<String, String> langTranslators = new HashMap<String, String>();
String[] enabledKeys = ArrayHelper.toArray(enabledKeysSet);
String[] names = new String[enabledKeys.length];
for (int i = 0; i < enabledKeys.length; i++) {
String key = enabledKeys[i];
String langName = i18nMgr.getLanguageInEnglish(key, i18nModule.isOverlayEnabled());
langNames.put(key, langName);
names[i] = langName;
String author = i18nMgr.getLanguageAuthor(key);
langTranslators.put(key, author);
}
ArrayHelper.sort(enabledKeys, names, true, true, true);
aboutVC.contextPut("enabledKeys", enabledKeys);
aboutVC.contextPut("langNames", langNames);
aboutVC.contextPut("langTranslators", langTranslators);
dmzPanel.pushContent(aboutVC);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class LoginAuthprovidersController method showAccessibilityPage.
protected void showAccessibilityPage() {
VelocityContainer accessibilityVC = createVelocityContainer("accessibility");
dmzPanel.pushContent(accessibilityVC);
}
Aggregations