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

zktheme cookie is not set to reflect preferred theme

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 6.5.0, 6.5.2
    • Theme
    • None

      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;
      }

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

              Created:
              Updated: