E2.0 Workbench Podcast 6 – WebCenter Portal Mobile Templates using Adaptive Styles

| 13 | Enterprise 2.0 Workbench, Mobile, UI, WebCenter

Subscribe to this Podcast on iTunes

It is difficult to have a discussion around web experience today without talking about mobile. Mobile has rapidly evolved from something that only a technically inclined group of users participated in (hey – look I can view the weather forecast on my phone!), to an omnipresent extension of our navigation, knowledge and interaction with the world. It is not surprising then that organizations need to embrace technical capabilities to engage customers, partners and prospects within this medium.

WebCenter Portal offers a variety of capabilities around mobile, some running on device, while others offering development platforms to cater to a wide range of devices – both off and on device. The pace of device capability is hurdling forward at a tremendous pace, as table and other form factors have grown rapidly in adoption. Depending on the project needs with a WebCenter Portal it may make sense to look at using CSS3 and Adaptive Design techniques to provide both a desktop browser, tablet and mobile experience from a single code base*

Only a few short years ago it was important to cater to a very wide range of devices web capabilities. Thankfully those days are coming to a close, as consumers of the “Facebook” generation frequently want the best access to news, events and services related to them and their social interactions.

Ok – enough around the introduction. How do we take WebCenter Portal onto a mobile? What do we want to achieve with the mobile version?


What we will Achieve

  1. The mobile experience will optimize the browsing experience for an iPhone style viewport, removing the login box and dropping the Offerings to below the page body. This simple example shows how with basic CSS we can easily change the visibility and positioning of the elements. Keep in mind that because this is client side, some items still remain within the document object model, but are removed in the user’s view. With EL these could be removed when the sever processes the user request, so that they would not show in the page markup behind the scenes, but in our case we are just going to use this as an example to illustrate Adaptive Design.
  2. We will also change the navigation for easier use on a small form factor device.  In our case – and this is just an example – we are going to disable the dropdown functionality available on the desktop, assuming that child pages would have their own respective detail navigation.  In an actual deployment it may be more likely to use other techniques to handle this, but we do it here to show the difference that various CSS modification based on viewport size can have.
The figure below roughly depicts what happens when our “viewport” drops below 600px.  The site is bare-bones, but setup to convey key points that you can work into your own designs.


How will we do it?

  1. CC3 Media Queries – CSS3 affords us the ability to understand the size of a user’s viewport and respond accordingly with styles tailored to a given user’s device. This means that we can adjust our user interface on the basis of desktop, tablet, mobile and even the big display in Times Square as needed
  2. Portal Skin Family – WebCenter offers some nice skins around the Fusion UI, but for our example we need to set our skin to “simple” in the trinidad-config.xml file to give us the most control over the page style.
  3. Viewport Meta Tag – We need to add a meta tag to let the browser know how to behave with our page (see more detail related to mobile meta tags) to keep our work abstracted from the core of WebCenter I used JQuery to append the meta tag within the header as follows$(‘head’).append(”);
  4. WebCenter Page Template – For the purposes of this demonstration I created a slimmed down template with IDs and classes that make it very CSS edit friendly for this example.
  5. IE – what would a post about the web be like without some caveats around IE? IE9 embraces the latest around media queries, but prior versions need a little extra love. We won’t showcase it in our example, but this great post over at Web Designer Wall – Adaptive & Responsive Design with CSS Media Queries dives right in to the gritty details of legacy support and how with a few extra files it is actually not too bad.



  
  







<script>
$('head').append('<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />');
</script>





    
     


        


          
            

                

                

                

              

                

                  
                    
                  

                  
                    
                  
                

                
                  
                

              

            
          
        

        

        


        

        

pageTemplate_adaptive content content


mediaquery.css – CSS3 using Media Queries


Source code included in download package below code block

.contentbody
{
  width: 960px;
  margin: 0 auto;
}

.header
{
  height: 50px;
}

#maincontent {
	width: 600px;
	float: left;
}

#sidebar {
	width: 280px;
	float: right;
}

#sitelogo
{
  background: url("../images/webcenter.png") ;
  height: 61px;
  width: 126px;
}

#mobileloginlink
{
  display: none;
}

.footer
{
}

.clear
{
  clear: both;
}

#nav{
	list-style:none;
	font-weight:bold;
	margin-bottom:10px;
	float:left;
	width:100%;
}
#nav li{
	float:left;
	margin-right:10px;
	position:relative;
}
#nav a{
	display:block;
	padding:5px;
	color:#fff;
	background:#888;
	text-decoration:none;
}
#nav a:hover{
	color:#fff;
	background:#6b0c36;
}
#nav ul{
	background:#fff;
	background:rgba(255,255,255,0);
	list-style:none;
	position:absolute;
	left:-9999px;
  margin-left: -40px;
}
#nav ul li{
	float:none;
}
#nav ul a{
	white-space:nowrap;
}
#nav li:hover ul{
	left:0;
}
#nav li:hover a{
	background:#000;
}
#nav li:hover ul a{
	text-decoration:none;
  font-weight: normal;
}
#nav li:hover ul li a:hover{
	background:#333;
}

/* CSS that will be used for screens <= 600px */
@media all and (max-width: 600px)
{

.headerloginbox
{
  display: none;
}

#mobileloginlink
{
  display: block;
}

.contentbody
{
  width: 300px;
  margin: 0 auto;
}  

  #maincontent
  {
    width: 100%;
  }

  #sidebar
  {
    clear: both;
    float: left;
    background: #efefef;
  }

  #nav li:hover ul a{
    display:none;
  }
}



Sample Code Download

  • Download the sample portal project code - please note that it is not 100% identical to the video code, but has all key elements (in the video the mediaquery.css file was located in "styles" vs "css" as in the download version.


Great Resources


Many other great techniques are possible through Adaptive Design. I suggest that you check out the following posts for more information.

Happy mobiling!

* Please note that this blog represents my own views and not those of Oracle. The techniques illustrated here are an implementation approach and sample.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
radhikac 5 pts

John,

Have you come across any Mobile/ tablet Webcenter UI's that may need file uploads ? One major problem we have for iPad interfaces are the file browse and upload features.

Thanks

Radhika

John Brunswick 6 pts moderator

radhikac Hey Radhikac,

I have not personally worked with that before. What is the specific issue you are running into?

Cheers,

John

tim.hickey 5 pts

John,

I have got this working and have added some code for detecting ipads as well. But I am trying to now add some normal Webcenter Components on to the page. And I want the same effect of showing and hiding the regions.

But it seems I can only use your .headlerloginbox class to do this. When I try to create my class it is not working. I noticed the ID and classes are the same. Can you explain some more how I might go trying to get Webcenter Components to work the same way.

Thanks

Tim

John Brunswick 6 pts moderator

tim.hickey Thanks Tim. The easiest way may be to apply a custom class to the component that you wish to show / hide vs what is autogenerated out of the box. For an ADF component you can add the styleclass attribute (e.g. styleclass="headerloginbox") as you noted. This would give you tighter control than attempting to leverage an existing class. If you would like I would be more than happy to check out your sample code.

nickolmsted 5 pts

One other note is it looks like the above video was cut off at the end? Will there be a part 2 to the video?

John Brunswick 6 pts moderator

nickolmsted Thanks Nick. It was very late at night when I wrapped up the video (4AM), so I actually moved the demo to the front and the code walkthrough to the back, so there is not a part 2 as of now. I will review it though, as I do not want it to be too confusing. After awhile I can only listen to myself so much without going a bit crazy :-)

nickolmsted 5 pts

Hi Jon - thanks for the above article. I have a couple of questions:

1. Can the above techniques also be used with a WebCenter Spaces template?

2. Within your template when do you decide to use HTML vs ADF? It seems you only use HTML when you need to manipulate the DOM through jQuery.

John Brunswick 6 pts moderator

nickolmsted Thanks Nick. Please note that my following comments reflect my own views and not necessarily those of Oracle, but

1. Yes - there would just be more markup in the template that may make it a bit more complex. Given what people do within a Spaces instance it may make sense to look at the <a href="http://www.oracle.com/technetwork/middleware/webcenter/iphone-163241.html" rel="nofollow">iPhone application</a> if collaboration is the focus and if that is a device that is targeted for use.

2. JQuery was a quick way to append information within the head of the DOM. However, you could use ADF to add them as well, but I have not tied it with the viewport information specifically - http://technology.amis.nl/blog/4631/adf-11g-include-meta-data-tags-in-head-element-using-afdocument-and-metacontainer-facet. Hope that helps!

nickolmsted 5 pts

John Brunswick Thanks for the quick replies. Very much appreciated!