wood burning stoves 2.0*
The moose likes JForum and the fly likes Create Mobile UI for Existing Jforum Website Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Create Mobile UI for Existing Jforum Website" Watch "Create Mobile UI for Existing Jforum Website" New topic
Author

Create Mobile UI for Existing Jforum Website

Shehzaad khan
Greenhorn

Joined: May 07, 2012
Posts: 5

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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
Not in stock JForum. That is something we added in our version that runs here at JavaRanch; http://www.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.


Ping & DNS - my free Android networking tools app
Shehzaad khan
Greenhorn

Joined: May 07, 2012
Posts: 5

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
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30384
    
150

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.


[Download MobileStatus.java] Download



[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Shehzaad khan
Greenhorn

Joined: May 07, 2012
Posts: 5

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
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30384
    
150

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create Mobile UI for Existing Jforum Website