Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1823

zktheme cookie is not set to reflect preferred theme

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 6.5.0, 6.5.2
    • Fix Version/s: None
    • Component/s: Theme
    • Labels:
      None

      Description

      When using sapphire as a preferred theme, "zktheme" cookie with value "sapphire" is not set at the client, causing HTML body to incorrectly have CSS class="breeze" instead of "sapphire".

      zk.xml config:
      <library-property>
      <name>org.zkoss.theme.preferred</name>
      <value>sapphire</value>
      </library-property>

      This issue could be fixed by extending StandardThemeProvider and overriding getThemeURIs method like this:

      @Override
      public Collection<Object> getThemeURIs(Execution exec, List<Object> uris) {
      super.getThemeURIs(exec, uris);

      // Fixing theme cookie (won't be set otherwise)
      if (Https.getCookieValue((HttpServletRequest) exec.getNativeRequest(), "zktheme") == null)

      { Themes.setTheme(exec, Themes.getCurrentTheme()); // will set cookie value }

      return uris;
      }

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            gediminas gediminas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: