You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Tiger Gui <ti...@gmail.com> on 2012/02/11 10:58:24 UTC

Standard & Mobile template switch improvement patch

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 [tigergui1990@gmail.com]

Re: Standard & Mobile template switch improvement patch

Posted by Tiger Gui <ti...@gmail.com>.
Hi ,

During my test, i found if users can redirect to mobile template in
any pages of standard template, user experience is not so good, and
this even cause some redirect bugs. So I create another patch to
confirm users can only switch between standard & mobile template in
*index* page.

move these codes:
<div class="mobile">
       <a href="?deviceType=mobile" alt="View Mobile Weblog">View Mobile
Weblog</a>
   </div>

from sidebar.vm to weblog.vm.

Please review and merge it, thank you :-)

[1] https://issues.apache.org/jira/browse/ROL-1938

2012/2/14 David Johnson <sn...@gmail.com>:
> Yes. I committed the patch, but with one small change. See the comment I added here:
> https://issues.apache.org/jira/browse/ROL-1937
>
> - Dave
>
>
> On Feb 14, 2012, at 12:12 AM, Tiger Gui wrote:
>
>> Hi,
>>
>> Do you guys reviewed this patch ? I want to do more job after this
>> patch merged into trunk. So, i am just waiting for your feedback for
>> your. Thank you.
>>
>> 2012/2/11 Tiger Gui <ti...@gmail.com>:
>>> 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 [tigergui1990@gmail.com]
>>
>>
>>
>> --
>> Best Regards
>> ----------------------------------------------------
>> Tiger Gui [tigergui1990@gmail.com]
>



-- 
Best Regards
----------------------------------------------------
Tiger Gui [tigergui1990@gmail.com]

Re: Standard & Mobile template switch improvement patch

Posted by Tiger Gui <ti...@gmail.com>.
Ok, i saw it now, thank you :-)

2012/2/14 David Johnson <sn...@gmail.com>:
> Yes. I committed the patch, but with one small change. See the comment I added here:
> https://issues.apache.org/jira/browse/ROL-1937
>
> - Dave
>
>
> On Feb 14, 2012, at 12:12 AM, Tiger Gui wrote:
>
>> Hi,
>>
>> Do you guys reviewed this patch ? I want to do more job after this
>> patch merged into trunk. So, i am just waiting for your feedback for
>> your. Thank you.
>>
>> 2012/2/11 Tiger Gui <ti...@gmail.com>:
>>> 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 [tigergui1990@gmail.com]
>>
>>
>>
>> --
>> Best Regards
>> ----------------------------------------------------
>> Tiger Gui [tigergui1990@gmail.com]
>



-- 
Best Regards
----------------------------------------------------
Tiger Gui [tigergui1990@gmail.com]

Re: Standard & Mobile template switch improvement patch

Posted by David Johnson <sn...@gmail.com>.
Yes. I committed the patch, but with one small change. See the comment I added here:
https://issues.apache.org/jira/browse/ROL-1937

- Dave


On Feb 14, 2012, at 12:12 AM, Tiger Gui wrote:

> Hi,
> 
> Do you guys reviewed this patch ? I want to do more job after this
> patch merged into trunk. So, i am just waiting for your feedback for
> your. Thank you.
> 
> 2012/2/11 Tiger Gui <ti...@gmail.com>:
>> 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 [tigergui1990@gmail.com]
> 
> 
> 
> -- 
> Best Regards
> ----------------------------------------------------
> Tiger Gui [tigergui1990@gmail.com]


Re: Standard & Mobile template switch improvement patch

Posted by Tiger Gui <ti...@gmail.com>.
Hi,

Do you guys reviewed this patch ? I want to do more job after this
patch merged into trunk. So, i am just waiting for your feedback for
your. Thank you.

2012/2/11 Tiger Gui <ti...@gmail.com>:
> 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 [tigergui1990@gmail.com]



-- 
Best Regards
----------------------------------------------------
Tiger Gui [tigergui1990@gmail.com]