Hi All,
I have created a issue and submit in it as a attach file in Roller's
issue system here[1]. This is the mainly changes:
1. if there is a "g_ut" parameter, we will parse its value, "standard"
means use standard template, else we use mobile template
public static DeviceType getRequestType(HttpServletRequest request) {
DeviceType type = DeviceType.standard;
String g_ut = request.getParameter(USER_AGENT_PARAMETER);
if(g_ut !=null){
return g_ut.trim().equals("standard") ?
DeviceType.standard :
DeviceType.mobile;
}
String cookie = getCookieValue(request.getCookies(),
USER_REQUEST_TYPE, null);
if (cookie != null) {
return cookie.equals("standard") ? DeviceType.standard
: DeviceType.mobile;
}
if (isMobileDevice(request)) {
type = DeviceType.mobile;
}
return type;
}
2. then we can confirm the link to mobile template is
"http://localhost:8080/roller/?g_ut=mobile", the link to standard
template is "http://localhost:8080/roller/?g_ut=standard"
3. in standard theme sidebar.vm, we set cookie
"roller_user_request_type=standard" with "path=/", in
weblog-mobile.vm, we set cookie "roller_user_request_type=mobile". So,
after that, we can use cookie to determine standard or mobile
template.
4.improve standard/mobile theme switch button looking, just as shown
in attach figure file
I have tested it in my PC, iphone and android phone and hope you guys
can have a review of it and merge it to trunk, thank you :-)
[1] https://issues.apache.org/jira/browse/ROL-1937
--
Best Regards
----------------------------------------------------
Tiger Gui [[email protected]]