use of org.olat.core.commons.services.analytics.AnalyticsSPI in project OpenOLAT by OpenOLAT.
the class AnalyticsSPIChooserFormController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (serviceEl == source) {
if (serviceEl.isOneSelected()) {
// get the currently selected provider or NULL and store the value in the module
String serviceId = serviceEl.getSelectedKey();
List<AnalyticsSPI> spies = analyticsModule.getAnalyticsProviders();
AnalyticsSPI spi = null;
for (AnalyticsSPI aSpi : spies) {
if (aSpi.getId().equals(serviceId)) {
spi = aSpi;
break;
}
}
analyticsModule.setAnalyticsProvider(spi);
if (spi == null) {
logAudit("Analytics module has been disabled", null);
} else {
logAudit("Analytics provider changed to " + spi.getName(), spi.getId());
}
fireEvent(ureq, Event.DONE_EVENT);
}
}
}
use of org.olat.core.commons.services.analytics.AnalyticsSPI in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method initializeBase.
private void initializeBase(UserRequest ureq, WindowManager winman, ComponentCollection mainPanel) {
// component-id of mainPanel for the window id
mainVc.contextPut("o_winid", mainPanel.getDispatchID());
BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
mainVc.contextPut("enforceTopFrame", securityModule.isForceTopFrame());
// add optional css classes
mainVc.contextPut("bodyCssClasses", bodyCssClasses);
Window w = wbo.getWindow();
mainVc.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
// control part for ajax-communication. returns an empty panel if ajax
// is not enabled, so that ajax can be turned on on the fly for
// development mode
jsServerC = wbo.createAJAXController(ureq);
mainVc.put("jsServer", jsServerC.getInitialComponent());
// init with no bookmark (=empty bc)
mainVc.contextPut("o_bc", "");
mainVc.contextPut("o_serverUri", Settings.createServerURI());
// the current language; used e.g. by screenreaders
mainVc.contextPut("lang", ureq.getLocale().toString());
// some user properties
if (ureq.getUserSession().isAuthenticated()) {
Identity ident = ureq.getIdentity();
StringBuilder sb = new StringBuilder();
sb.append("{ identity : ").append(ident.getKey());
User user = ident.getUser();
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_PROPS_ID, ureq.getUserSession().getRoles().isOLATAdmin());
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
String escapedValue = StringHelper.escapeJavaScript(userPropertyHandler.getUserProperty(user, getLocale()));
sb.append(", ").append(userPropertyHandler.getName()).append(" : \"").append(escapedValue).append("\"");
}
sb.append("}");
mainVc.contextPut("userJSON", sb);
}
// the current GUI theme and the global settings that contains the
// font-size. both are pushed as objects so that window.dirty always reads
// out the correct value
mainVc.contextPut("theme", w.getGuiTheme());
mainVc.contextPut("globalSettings", winman.getGlobalSettings());
// also add the optional theme javascript
addThemeJS();
// Add JS analytics code, e.g. for google analytics
if (analyticsModule.isAnalyticsEnabled()) {
AnalyticsSPI analyticsSPI = analyticsModule.getAnalyticsProvider();
mainVc.contextPut("analytics", analyticsSPI.analyticsInitPageJavaScript());
}
// content panel
contentPanel = new Panel("olatContentPanel");
mainVc.put("olatContentPanel", contentPanel);
mainVc.contextPut("o_winid", w.getDispatchID());
mainVc.contextPut("buildversion", Settings.getVersion());
if (wbo.isDebuging()) {
debugC = wbo.createDebugDispatcherController(ureq, getWindowControl());
mainVc.put("guidebug", debugC.getInitialComponent());
}
// Inline translation interceptor. when the translation tool is enabled it
// will start the translation tool in translation mode, if the overlay
// feature is enabled it will start in customizing mode
// fxdiff: allow user-managers to use the inline translation also.
UserSession usess = ureq.getUserSession();
if (usess.isAuthenticated() && (usess.getRoles().isOLATAdmin() || usess.getRoles().isUserManager()) && (i18nModule.isTransToolEnabled() || i18nModule.isOverlayEnabled())) {
inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
Preferences guiPrefs = usess.getGuiPreferences();
Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
i18nManager.setMarkLocalizedStringsEnabled(usess, isInlineTranslationEnabled);
mainVc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
}
// debug info if debugging
if (wbo.isDebuging()) {
developmentC = wbo.createDevelopmentController(ureq, getWindowControl());
mainVc.put("development", developmentC.getInitialComponent());
}
// put the global js translator mapper path into the main window
mainVc.contextPut("jsTranslationMapperPath", BaseChiefController.jsTranslationMapperPath);
// master window
// w.addListener(this); // to be able to report "browser reload" to the user
w.setContentPane(mainPanel);
}
use of org.olat.core.commons.services.analytics.AnalyticsSPI in project openolat by klemens.
the class BaseFullWebappController method initializeBase.
private void initializeBase(UserRequest ureq, WindowManager winman, ComponentCollection mainPanel) {
// component-id of mainPanel for the window id
mainVc.contextPut("o_winid", mainPanel.getDispatchID());
BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
mainVc.contextPut("enforceTopFrame", securityModule.isForceTopFrame());
// add optional css classes
mainVc.contextPut("bodyCssClasses", bodyCssClasses);
Window w = wbo.getWindow();
mainVc.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
// control part for ajax-communication. returns an empty panel if ajax
// is not enabled, so that ajax can be turned on on the fly for
// development mode
jsServerC = wbo.createAJAXController(ureq);
mainVc.put("jsServer", jsServerC.getInitialComponent());
// init with no bookmark (=empty bc)
mainVc.contextPut("o_bc", "");
mainVc.contextPut("o_serverUri", Settings.createServerURI());
// the current language; used e.g. by screenreaders
mainVc.contextPut("lang", ureq.getLocale().toString());
// some user properties
if (ureq.getUserSession().isAuthenticated()) {
Identity ident = ureq.getIdentity();
StringBuilder sb = new StringBuilder();
sb.append("{ identity : ").append(ident.getKey());
User user = ident.getUser();
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_PROPS_ID, ureq.getUserSession().getRoles().isOLATAdmin());
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
String escapedValue = StringHelper.escapeJavaScript(userPropertyHandler.getUserProperty(user, getLocale()));
sb.append(", ").append(userPropertyHandler.getName()).append(" : \"").append(escapedValue).append("\"");
}
sb.append("}");
mainVc.contextPut("userJSON", sb);
}
// the current GUI theme and the global settings that contains the
// font-size. both are pushed as objects so that window.dirty always reads
// out the correct value
mainVc.contextPut("theme", w.getGuiTheme());
mainVc.contextPut("globalSettings", winman.getGlobalSettings());
// also add the optional theme javascript
addThemeJS();
// Add JS analytics code, e.g. for google analytics
if (analyticsModule.isAnalyticsEnabled()) {
AnalyticsSPI analyticsSPI = analyticsModule.getAnalyticsProvider();
mainVc.contextPut("analytics", analyticsSPI.analyticsInitPageJavaScript());
}
// content panel
contentPanel = new Panel("olatContentPanel");
mainVc.put("olatContentPanel", contentPanel);
mainVc.contextPut("o_winid", w.getDispatchID());
mainVc.contextPut("buildversion", Settings.getVersion());
if (wbo.isDebuging()) {
debugC = wbo.createDebugDispatcherController(ureq, getWindowControl());
mainVc.put("guidebug", debugC.getInitialComponent());
}
// Inline translation interceptor. when the translation tool is enabled it
// will start the translation tool in translation mode, if the overlay
// feature is enabled it will start in customizing mode
// fxdiff: allow user-managers to use the inline translation also.
UserSession usess = ureq.getUserSession();
if (usess.isAuthenticated() && (usess.getRoles().isOLATAdmin() || usess.getRoles().isUserManager()) && (i18nModule.isTransToolEnabled() || i18nModule.isOverlayEnabled())) {
inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
Preferences guiPrefs = usess.getGuiPreferences();
Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
i18nManager.setMarkLocalizedStringsEnabled(usess, isInlineTranslationEnabled);
mainVc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
}
// debug info if debugging
if (wbo.isDebuging()) {
developmentC = wbo.createDevelopmentController(ureq, getWindowControl());
mainVc.put("development", developmentC.getInitialComponent());
}
// put the global js translator mapper path into the main window
mainVc.contextPut("jsTranslationMapperPath", BaseChiefController.jsTranslationMapperPath);
// master window
// w.addListener(this); // to be able to report "browser reload" to the user
w.setContentPane(mainPanel);
}
use of org.olat.core.commons.services.analytics.AnalyticsSPI in project openolat by klemens.
the class AnalyticsSPIChooserFormController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (serviceEl == source) {
if (serviceEl.isOneSelected()) {
// get the currently selected provider or NULL and store the value in the module
String serviceId = serviceEl.getSelectedKey();
List<AnalyticsSPI> spies = analyticsModule.getAnalyticsProviders();
AnalyticsSPI spi = null;
for (AnalyticsSPI aSpi : spies) {
if (aSpi.getId().equals(serviceId)) {
spi = aSpi;
break;
}
}
analyticsModule.setAnalyticsProvider(spi);
if (spi == null) {
logAudit("Analytics module has been disabled", null);
} else {
logAudit("Analytics provider changed to " + spi.getName(), spi.getId());
}
fireEvent(ureq, Event.DONE_EVENT);
}
}
}
use of org.olat.core.commons.services.analytics.AnalyticsSPI in project OpenOLAT by OpenOLAT.
the class AnalyticsAdminController method doInitSpiConfigController.
/**
* Helper to init the SPI configuration controller based on the currently active configuration
* @param ureq
*/
private void doInitSpiConfigController(UserRequest ureq) {
AnalyticsSPI currentSPI = analyticsModule.getAnalyticsProvider();
if (currentSPI != null) {
// use SPI factory method to create the admin controller
spiConfigCtr = currentSPI.createAdminController(ureq, getWindowControl());
listenTo(spiConfigCtr);
mainVC.put("spiConfigCtr", spiConfigCtr.getInitialComponent());
} else {
mainVC.remove("spiConfigCtr");
}
}
Aggregations