java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.ConfigUIHelper

public class ConfigUIHelperextends HelperBase
Helper class for rendering and processing user interface configuration pages in the I2P router console.

This class provides methods to generate HTML for various UI configuration sections including:

  • Theme selection and display options
  • Mobile console settings
  • Language selection interface
  • Console password management forms

The class extends HelperBase and uses the router context to access configuration properties and internationalization messages. All methods return HTML strings that can be directly embedded in JSP pages.

Key functionality includes:

  • Scanning for available themes from filesystem and configuration
  • Managing language preferences with ISO 639-1/639-2 codes
  • Handling console authentication settings
  • Providing mobile console and app embedding options
  • Field Details

    • langs

      private static final String[][] langs
      Each language has the ISO code, the flag, the name, and the optional country name. Alphabetical by the English language name please (not by the ISO code). See http://en.wikipedia.org/wiki/ISO_639-1 . Any language-specific flag added to the icon set must be added to the top-level build.xml for the updater. As of 0.9.12, ISO 639-2 three-letter codes are supported also. Note: To avoid truncation, ensure language name is no longer than 17 chars.
  • Constructor Details

    • ConfigUIHelper

      public ConfigUIHelper()
      Create a new helper for UI configuration.
  • Method Details

    • getSettings

      public String getSettings()
      Generates HTML for theme selection and display options configuration.

      Renders a section containing:

      • Available theme selection with radio buttons and thumbnails
      • Universal theming checkbox for applying themes across all apps
      • Alternative font (Sora) selection option

      Themes are discovered from the filesystem and user configuration properties. The current theme is pre-selected based on router configuration.

      Returns:
      HTML string containing the theme selection interface
    • getForceMobileConsole

      public String getForceMobileConsole()
      Generates HTML for mobile console and app embedding configuration options.

      Renders checkboxes for:

      • Forcing the mobile console interface to be used
      • Embedding I2PSnark and I2PMail applications within the console

      Includes a tooltip recommendation to enable universal theming when embedding applications for consistent visual appearance.

      Returns:
      HTML string containing mobile console configuration options
    • themeSet

      private Set<String> themeSet()
      Retrieves all available themes from the filesystem and user configuration.

      Scans the docs/themes/console directory for theme directories and also checks for user-installed themes defined in router configuration properties. The default theme is always included as a fallback.

      Themes are returned in alphabetical order using a TreeSet for natural sorting.

      Returns:
      a sorted Set containing all available theme names (untranslated)
    • getLangSettings

      public String getLangSettings()
      Generates HTML for language selection interface.

      Renders radio buttons for all available languages with their corresponding flag icons and display names. The current language is pre-selected based on the router's language configuration.

      Supports both ISO 639-1 two-letter codes and ISO 639-2 three-letter codes. Languages with country-specific variants include the country name in parentheses. The "Untagged strings" option is only shown for advanced users.

      Performs intelligent language matching by first trying the full language+country code, then falling back to the language-only code, and finally defaulting to English.

      Returns:
      HTML string containing the language selection interface with flags and labels
    • hasUsers

      public boolean hasUsers()
      Returns true if any console users are configured.
      Returns:
      true if at least one user exists, false otherwise
    • getPasswordForm

      public String getPasswordForm()
      Generates HTML for console password management interface.

      Renders a form for managing router console authentication including:

      • Display of existing configured users with deletion options
      • Input fields for adding new username and password
      • Help text for password recovery and configuration guidance

      The delete user button is hidden when no users are configured. When users exist, shows a table with checkboxes for removal and the current usernames. Always includes fields for adding new users.

      Returns:
      HTML string containing the password management form