File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create Mobile UI for Existing Jforum Website

 
Shehzaad khan
Greenhorn
Posts: 5
Eclipse IDE Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shehzaad khan
Greenhorn
Posts: 5
Eclipse IDE Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33674
316
Eclipse IDE Java VI Editor
  • 1
  • Mark post as helpful
  • send pies
  • 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
Description:
File size: 3 Kbytes
[Download MobileStatus.java] Download Attachment
 
Shehzaad khan
Greenhorn
Posts: 5
Eclipse IDE Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • 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
Marshal
Posts: 33674
316
Eclipse IDE Java VI Editor
  • 1
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic