Apache Roller
  1. Apache Roller
  2. ROL-1937

Standard and Mobile template switch improvement patch

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1
    • Fix Version/s: 5.1
    • Labels:
    • Environment:
      Win 7 Chrome/Firefox; IPad, IPhone, Android HTC Desire

      Description

      Problem discussed in Roller dev mail list :

      > 1. I click the "view mobile weblog" button, frontpage does not change
      > to mobile device template, i have to refresh current page to enter
      > mobile template. Is it normal ? When i want to come back from mobile
      > template, it works same, click and refresh.
      >

      Yes. That was a problem that i could not solve. When you click on the
      button , You need to refresh the page to see the changes.

      1. newbutton.PNG
        52 kB
        Tiger Gui
      2. roller.zip
        6 kB
        Tiger Gui

        Activity

        Hide
        Tiger Gui added a comment -

        Patch to improve standard mobile template switch

        Show
        Tiger Gui added a comment - Patch to improve standard mobile template switch
        Hide
        Tiger Gui added a comment -

        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

        Show
        Tiger Gui added a comment - 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
        Hide
        Tiger Gui added a comment -

        Patch to improve standard and mobile template, with image file in this zip file

        Show
        Tiger Gui added a comment - Patch to improve standard and mobile template, with image file in this zip file
        Hide
        Tiger Gui added a comment -

        new button looking

        Show
        Tiger Gui added a comment - new button looking
        Hide
        Dave Johnson (Inactive) added a comment -

        THANKS for the patch! I committed it with one minor fix: I renamed the request parameter "g_ut" to the more descriptive name "deviceType".

        Show
        Dave Johnson (Inactive) added a comment - THANKS for the patch! I committed it with one minor fix: I renamed the request parameter "g_ut" to the more descriptive name "deviceType".

          People

          • Assignee:
            Roller Unassigned
            Reporter:
            Tiger Gui
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 48h
              48h
              Remaining:
              Remaining Estimate - 48h
              48h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development