Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

By default, uPortal 4.1 uses the Respondr theme and has the mUniversality mobile view disabled.  Even if you switch to use the Universality theme, mUniversality mobile view is disabled.  If you want to re-enable it for either theme, then do the following:follow the steps on this page.

There are a number of ways to edit this file to do this. The snippet above adds a mapping that will always match and set the profile to mobileDefault. This should be the first mapping.

Step 1: Edit userContext.xml

  • Open userContext.xml for editing (uportal-war/src/main/resources/properties/contexts/userContext.xml)
  • Uncomment the reference to the bean userAgentProfileMapper in the profileMapper bean.

    Code Block
    ....
        <bean id="profileMapper" class="org.jasig.portal.layout.ChainingProfileMapperImpl">
            <property name="defaultProfileName" value="default" />
            <property name="subMappers">
                <util:list>
                    <ref bean="sessionAttributeProfileMapper" />
                    <!--
                     | uPortal 4.1 promotes a responsive design theme Respondr.  The older uPortal 3.x, 4.0x
                     | mUniversality view is by default disabled.  To re-enable it so those user agent strings that
                     | match the regex instruction get the mUniversality view, uncomment the following bean.
                     +-->
                    <ref bean="userAgentProfileMapper" />
    .....
        </bean>

Step 2 (optional):  Update the user-agent pattern strings

Since few uPortal 4.1 adopters use mUniversality, or for international considerations where the user-agent string does not match a mobile device in use, update the mobile.user.agent.regex in the pom.xml for any user-agent strings you find are not matched.

Code Block
languagexml
titlepom.xml (temporary change)
<!-- 
 | When a user-agent profile mapping is enabled (see userContext.xml), uPortal uses this expression to
 | determine whether the user is on a mobile device, such as a phone or a tablet, or a desktop/laptop
 | browser;  users may also choose the mobile/non-mobile experience when they log in.
 +-->
<mobile.user.agent.regex>(.*iPhone.*)|(.*Android.*)|(.*IEMobile.*)|(.*Safari.*Pre.*)|(.*Nokia.*AppleWebKit.*)|(.*Black[Bb]erry.*)|(.*Opera Mobile.*)|(.*Windows Phone.*)|(.*Fennec.*)|(.*Minimo.*)</mobile.user.agent.regex>

Step 3: Rebuild/Redeploy uPortal

Code Block
ant clean deploy-war

Step

...

4: Restart tomcat

Restart your tomcat server to see the changes.

Step

...

5: Test your changes using the User Agent

You can make sure that your full site is being rendered by verifying the mobile view isn't is being displaying by doing the following:  

uPortal4 decides to serve the desktop or mobile themes based on the User Agent string sent by the browser headers. All browsers allow you to switch your User Agent string to pretend to be a different browser. This is done either through built in debug tools (Safari, Chrome, IE) or through an addon (FireFox and Chrome). The User Agent is detected once and then stored in your session. You need to clear your cookies after changing the User Agent. Some browsers/tools reset the User Agent when they are restarted.

5a) Approach 1 (preferred): Changing the User Agent

Changing the User Agent in Safari

...

  1. In the Developer Tools, choose Cache > clear session cookies to clear your session.

5b) Approach 2 (not preferred): Forcing mUnversality for any user-agent string

Alternately, you can temporarily edit pom.xml to always serve the mobile theme regardless of User Agent. Modify the user-agent string to a mapping that matches ".*".  This approach is not preferred because if you leave this, you would always have a mobile experience, even for desktop environments.

 

 

...

Code Block
languagexml
titlepom.xml (temporary change)
<!-- 
 | When a user-agent profile mapping is enabled (see userContext.xml), uPortal uses this expression to
 | determine whether the user is on a mobile device, such as a phone or a tablet, or a desktop/laptop
 | browser;  users may also choose the mobile/non-mobile experience when they log in.
 +-->
<mobile.user.agent.regex>.*</mobile.user.agent.regex>
Warning
iconfalse
titleHaving problems with these instructions?

Please send us feedback at uportal-user@lists.ja-sig.org