58.1. Introduction to Themes

Webmin versions 0.83 and above support themes, which are sets of alternate user interfaces, graphics, and color schemes. A user can choose which theme he wants by going into Webmin Configuration and clicking on Webmin Themes. Multiple themes can be installed, but only one can be active for a Webmin user at any one time. If no theme is active, the default colors and layout are used.

Like a module, a theme is a directory under the Webmin root directory that contains certain files. The most important is the theme.info file, which has the same name=value format as the module.info file, one per line. The only required name and its value is:

desc A description for this theme, such as My Webmin Theme. This is the text that will appear in the theme selection menu.

A theme can also contain a config file, also in name=value format. The values defined in this file control the behaviour of the standard header and footer functions. Supported names and their values are:

cs_page A six-character hex string in RRGGBB format for the background color of Webmin pages.

cs_link A six-character hex string in RRGGBB format for the color of visited and unvisited links on Webmin pages.

cs_text A six-character hex string in RRGGBB format for the color of normal text.

bgimage A relative URL (like /images/background.gif) for a background image to be displayed on all pages.

noindex If set to 1, the HTML generated by the header function will not include a Webmin Index link. This is useful if another frame is used for the main index.

brand HTML for an image or text to be displayed in the top-right corner of the main index page.

brand_url A URL to which the brand image is linked. These two options are usually combined to create a company icon that links to its homepage in customized versions of Webmin.

headhtml HTML that will be included inside the <head> section of each Webmin page.

headinclude The name of a file in your theme directory whose contents will be included inside the <head> section of each page.

inbody Text that will be included inside the <body> tag itself.

prebody HTML that will be included at the top of the <body> section of each page. The following substitutions will be done in the HTML:

%HOSTNAME% will be replaced with the system's hostname.

%VERSION% will be replaced with the Webmin version.

%USER% will be replaced with the current user's login.

%OS% will be replaced with the OS name and version.

texttitles If set to 1, the titles on all pages will be displayed as HTML text rather than using letter images.

postbody HTML that will be included at the bottom of the <body> section on each page. The same substitutions as prebody are used.

tb Text that will be included inside the <tr> tag in table header rows.

cb Text that will be included inside the <tr> tag in table rows below the header.

functions The name of a file in your theme's directory that contains Perl functions for overriding the default header, footer, and error functions. See Section 58.3 “Theme Functions” for more details.

noicons If set to 1, the standard generate_icon and icons_table functions will display only a name instead of an icon. This can be useful if your theme is designed for text-only or low bandwidth use.

Many of these options will not work automatically if your theme uses the functions option to create its own replacement for the header function. They are normally checked for and implemented by the standard header function, so if you define your own it will need to check the %tconfig global hash and interpret the values that it contains in the same way if you still want them to be configurable in the theme's config file.

When you have created a theme and want to distribute it to other people, it should be packaged up. Just like modules, themes are packaged as an optionally compressed tar file of the theme directory, usually with a .wbt extension. They can then be installed through the Webmin Themes page in the Webmin Configuration module.

Just like modules, themes can also be packaged as RPMs, which are suitable for installing on servers on which the RPM version of Webmin itself is already installed. You can download a script called makemodulerpm.pl from www.webmin.com/makemodulerpm.pl that can package up a theme directory into an RPM by creating the spec file automatically.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.208.183