java.lang.Object
net.i2p.router.web.FormHandler
net.i2p.router.web.helpers.ConfigUIHandler
Handles router console UI configuration and theme management. Processes theme selection, mobile console settings, user management, language settings, password configuration, and display preferences for the router console interface.
Nested Class Summary
Nested classes/interfaces inherited from class FormHandler
FormHandler.MessageModifier and TypeClassDescriptionstatic classMessage class to encapsulate the message text and the canClose flag.Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe name of the config being edited.private booleanTrue to embed the apps in the console.private booleanTrue to force the mobile console.private booleanTrue if the form is to be saved.private booleanTrue to allow theming of all pages.private booleanTrue to display the Sora font.private static final PatternPattern of characters allowed in config keys.Fields inherited from class FormHandler
_action, _context, _log, _method, _out, _requestWrapper, _session, _settingsModifier and TypeFieldDescriptionprotected StringForm action.protected RouterContextRouter context.protected LogClass logger.protected StringRequest method.protected WriterOutput writer.protected RequestWrapperOnly for multipart/form-data.protected HttpSessionHTTP session for nonce validation.protected MapNot for multipart/form-data, will be null.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprivate voidaddUser()Adds a console user from the form.private voiddelUser()Deletes a console user from the form.protected voidImplement this to perform the final processing (in turn, adding formNotice and formError messages, etc)private voidNote - lang change is handled inCSSHelperbut we still need to save it here.voidsetEmbedApps(String baa) Enables embedded application display.voidForces the mobile console interface.voidsetShouldsave(String moo) Sets the save flag for configuration changes.voidSets the theme name for configuration.voidEnables universal theming support.voidsetUseSoraFont(String baa) Enables Sora font usage.private voidupdateLoginTheme(String theme) Updates the theme of the login page.Methods inherited from class FormHandler
_t, _t, _t, _x, addFormError, addFormError, addFormErrorNoEscape, addFormErrorNoEscape, addFormNotice, addFormNotice, addFormNoticeNoEscape, addFormNoticeNoEscape, getAllMessages, getErrors, getJettyString, getNotices, isAdvanced, resolveEffectiveAction, setAction, setContextId, setNonce, setRequestWrapper, setSettings, storeMethod, storeSession, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter This is a lot more expensive than _t(s), so use sparingly.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected voidaddFormError(String errorMsg) Add an error message to display Use if it does not include a link.protected voidaddFormError(String errorMsg, boolean canClose) Add an error message to display Use if it does not include a link.protected voidAdd an error message to display Use if it includes a link or other formatting.protected voidaddFormErrorNoEscape(String msg, boolean canClose) Add an error message to display Use if it includes a link or other formatting.protected voidaddFormNotice(String msg) Add a non-error message to display Use if it does not include a link.protected voidaddFormNotice(String msg, boolean canClose) Add a non-error message to display Use if it does not include a link.protected voidAdd a non-error message to display Use if it includes a link or other formatting.protected voidaddFormNoticeNoEscape(String msg, boolean canClose) Add a non-error message to display Use if it includes a link or other formatting.Display everything, wrap it in a div for consistent presentation.Display any error messages (processing the form if it hasn't been yet).protected StringgetJettyString(String key) FormHandler.setSettings(Map)must have been called previously Curses Jetty for returning arrays.Display any non-error messages (processing the form if it hasn't been yet).booleanSame as HelperBase.static StringresolveEffectiveAction(String action, Map<?, ?> settings) Resolve which operation the user actually requested.voidAction value.voidsetContextId(String contextId) Configure this bean to query a particular router context.voidNonce value.voidOnly set by formhandler.jsi for multipart/form-data.voidsetSettings(Map settings) For many forms, it's easiest just to put all the parameters here.voidstoreMethod(String val) Call this to prevent changes using GET.voidstoreSession(HttpSession session) For nonce validation.voidstoreWriter(Writer out) Store the output writer for inline form processing.
Field Details
CONFIG_PATTERN
Pattern of characters allowed in config keys._shouldSave
private boolean _shouldSaveTrue if the form is to be saved._universalTheming
private boolean _universalThemingTrue to allow theming of all pages._forceMobileConsole
private boolean _forceMobileConsoleTrue to force the mobile console._embedApps
private boolean _embedAppsTrue to embed the apps in the console._useSoraFont
private boolean _useSoraFontTrue to display the Sora font._config
The name of the config being edited.
Constructor Details
ConfigUIHandler
public ConfigUIHandler()ConfigUIHandler default constructor.
Method Details
processForm
protected void processForm()Description copied from class:FormHandlerImplement this to perform the final processing (in turn, adding formNotice and formError messages, etc)Will only be called if _action is non-null and the nonce is valid.
- Specified by:
processFormin classFormHandler
setShouldsave
Sets the save flag for configuration changes.- Parameters:
moo- the JSP form value; any string, including null, enables the save
setUniversalTheming
Enables universal theming support.- Parameters:
baa- the JSP form value; any string, including null, enables universal theming
setForceMobileConsole
Forces the mobile console interface.- Parameters:
baa- the JSP form value; any string, including null, forces the mobile console
setEmbedApps
Enables embedded application display.- Parameters:
baa- the JSP form value; any string, including null, enables embedded application display
setUseSoraFont
Enables Sora font usage.- Parameters:
baa- the JSP form value; any string, including null, enables the Sora font
setTheme
Sets the theme name for configuration.- Parameters:
val- the theme name
saveChanges
private void saveChanges()Note - lang change is handled inCSSHelperbut we still need to save it here.addUser
private void addUser()Adds a console user from the form.delUser
private void delUser()Deletes a console user from the form.updateLoginTheme
Updates the theme of the login page.- Parameters:
theme- the new theme name