String moduleName = req.getParameter( "context" );
OutputStream out = resp.getOutputStream();
resp.setContentType( "text/javascript" ); //$NON-NLS-1$
resp.setHeader( "Cache-Control", "no-cache" ); //$NON-NLS-1$
IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, getPentahoSession( req ) );
String activeTheme = (String) getPentahoSession( req ).getAttribute( "pentaho-user-theme" );
String ua = req.getHeader( "User-Agent" );
// check if we're coming from a mobile device, if so, lock to system default (crystal)
if ( !StringUtils.isEmpty( ua ) && ua.matches( ".*(?i)(iPad|iPod|iPhone|Android).*" ) ) {
activeTheme = PentahoSystem.getSystemSetting( "default-theme", "crystal" );
}
if ( activeTheme == null ) {
try {
activeTheme = settingsService.getUserSetting( "pentaho-user-theme", null ).getSettingValue();
} catch ( Exception ignored ) { // the user settings service is not valid in the agile-bi deployment of the
// server
}
if ( activeTheme == null ) {
activeTheme = PentahoSystem.getSystemSetting( "default-theme", "crystal" );