• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Create Mobile UI for Existing Jforum Website

 
Greenhorn
Posts: 6
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Does Jforum2 supports for Creating one Extra "VIEW" for Mobile UI?
if yes, then can you please suggest me the code place from where i can put condition to redirect to Proper View (either for PC or Mobile) depending upon the USER-AGENT.
For Example if User-agent is "Mozilla-Windows" so it should process for existing PC UI templates and if User-Agent is "Safari-iphone" then it should process for Mobile UI templates.
is it Possible in Jforum?

Please help me on this

Thanks
Shahid
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not in stock JForum. That is something we added in our version that runs here at JavaRanch; https://coderanch.com/mobile is the mobile start page. So it's certainly something that can be added, but it was also quite a bit of work.
 
Shehzaad khan
Greenhorn
Posts: 6
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay..

Can you please give me some idea how you have created and detecting two Views for coderanch?

actually what i m planning to do is this way
Basically, I want to detect the user's browser, so I can differentiate between mobile version website and desktop version website. Moreover, for the mobile version site,

i first will detect whether request is from Mobile User Agent or Desktop user Agent.
suppose for viewing Forum List Page, in ForumAction.list



And i will have to create new mobile Compatible template forums.list.mobile.htm

But for this i will need to do changes in every Action

So is there any place in Jforum.java or other controller file where i can put my code before initializing Template Context, So that i should use that template context (Mobile) for that session??

For Example for Windows browser it should initialize Template Context from "/templates/default/"
and for Mobile Browser it should initialize Template Context from "/templates/mobile/"

its a rough idea that i m thinking to implement



and it would be great if you give me some Basic idea on Jforum MVC architecture working..



Really Thanks for your Help


Shahid
 
author & internet detective
Posts: 41986
911
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shehzaad khan wrote:okay..

Can you please give me some idea how you have created and detecting two Views for coderanch?


We did something similar to what you propose, but a bit more centralized. In the Command class, we changed one method to:

Then in the template mapping we defined a mobile template for each template. (For the pages that don't have mobile views, it points to the same html file as the non-mobile view. This also let us transition one at a time.)

The other significant piece of functionality is an enum we created called MobileStatus.java (code attached). We show the mobile view if the user typed /mobile in the URL or is on a mobile type device (as determined by WURFLManager). We then keep track of the information so once a user is mobile, he/she stays mobile unless explicitly clicking the full site link.
Filename: MobileStatus.java
File size: 3 Kbytes
 
Shehzaad khan
Greenhorn
Posts: 6
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for guiding me on this..
as i understood, you are maintaining the MobileStatus value in session unless user asks for desktop version,this means page will not every time check for which UI request is coming and this will speed up the process and yes this logic will also let us transition one at a time..

It would be great if you give some idea which places you have checked Mobile status in centralized way,
and where the below static method will be useful?



And as you are already checking mobile type device (as determined by WURFLManager) in MobileStatus.java file using isOnMobileDevice(request)
then what is the use of method "isMobileRequest()" which is mentioned in below code???


Thanks in Advanced...

Shahid
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whether you're using a mobile device, or whether you want to look at the mobile site are two different issues that we wanted to keep separate. No need to force the user to use one or the other.
 
Jeanne Boyarsky
author & internet detective
Posts: 41986
911
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shehzaad khan wrote:It would be great if you give some idea which places you have checked Mobile status in centralized way,
and where the below static method will be useful?


It's useful in the constructor of WebRequestContext so I can see whether it is a mobile request or not. That's the method setTemplate() is calling in my sample above.
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic