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 Summary
FieldsFields inherited from class HelperBase
_context, _log, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected LogThe log instance.protected WriterThe writer for output.static final StringChecked attribute for HTML checkboxes.static final StringProperty key for advanced mode.static final StringSelected attribute for HTML select options.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionGenerates HTML for mobile console and app embedding configuration options.Generates HTML for language selection interface.Generates HTML for console password management interface.Generates HTML for theme selection and display options configuration.booleanhasUsers()Returns true if any console users are configured.themeSet()Retrieves all available themes from the filesystem and user configuration.Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, isAdvanced, ngettext, setContextId, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected StringgetChecked(String prop) Get the checked attribute for a boolean property.booleanCheck if advanced mode is enabled.Translate a string with plural forms (ngettext).voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreWriter(Writer out) Store the writer for output.
Field Details
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
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
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
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
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
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