Understanding Parallels H-Sphere Templates

What Are Templates

Parallels H-Sphere templates lay behind the Parallels H-Sphere Control Panel Web interface. For the most part, templates are written using Freemarker Java processing language for dynamic content generation.

Location of Templates

Template root directory

Parallels H-Sphere template root directory is by default ~cpanel/shiva/shiva-templates. It is set by the TEMPLATE_PATH parameter in the ~cpanel/shiva/psoft_config/hsphere.properties file:

TEMPLATE_PATH = /hsphere/local/home/cpanel/shiva/shiva-templates/

Default (common) design directory

Design, or skin, is the Control Panel GUI representation. Each design is defined by its own sets of templates, images, CSS styles, JavaScripts, etc. The most important part of GUI, templates, are placed in separate subdirectories of the template root directory in accordance with a design they belong to. The special common subdirectory is used to store templates that are the same for different designs. Also, this directory contains templates for the Left Menu design which is the default Parallels H-Sphere design. The path to this directory, relative to TEMPLATE_PATH, is set in hsphere.properties:

DEFAULT_TEMPLATES = common/

Important: Common template directory must always exist!

Custom template directory

Custom template directory is usually ~cpanel/shiva/custom/templates. Its location is set in hsphere.properties:

USER_TEMPLATE_PATH=/hsphere/local/home/cpanel/shiva/custom/templates/

Custom templates directory structure should correspond with the default template root directory (shiva-templates) tree. However, you should be aware that templates in the custom template directory override the corresponding templates in the default template directory, thus all modifications and new features in existing default templates coming with new Parallels H-Sphere releases would be also overriden by custom templates. Therefore, only customized templates should be placed to your custom template directory.

System E-Mail Notification Templates

System email notifications templates are used to generate standard Parallels H-Sphere e-mail messages sent to customers or to admins on certain events related to account management, billing, and the like. It is made possible to edit these messages directly from Control Panel, in plain text or HTML and for each of the available languages, without the need of customizing the default templates.

E-mail templates are located in the ~cpanel/shiva/shiva-templates/common/mail directory and have .txt extension. See the list of the system e-mail templates.

Skeletons

Skeleton templates, or skeletons, are special templates designed to generate user default sites for newly created domains in corresponding domain subdirectories of user home directories. Skeleton templates are written in HTML (without Freemarker instructions) and located in the /hsphere/shared/skel directory. See how to modify default skeletons.

Web Interface Templates

Templates for generating Control Panel interface pages are of the following types:

Main Templates

Main, or basic, templates are templates for generating the entire Web page in CP. The code of a main template represents a framework that contains calls of functions for generation of the page header, menu and footer, and includes control templates for processing forms.

Main templates are .html files located in the ~cpanel/shiva/shiva-templates/<design>/ directories for each design.

Control Templates

Contol templates, or controls, are responsible for generation and management of forms in the working area of Parallels H-Sphere interface. They represent the part of HTML code included in the main templates.

Control templates are with or without form field validation mechanism implemented:

Control templates are located in the ~cpanel/shiva/shiva-templates/<design>/control directories for each group of main templates.

Control templates assign submit templates that do not have visual HTML representation and serve solely to process form submits.

Submit Templates

Submit templates do not have visual representation. They contain instructions to be performed upon the form submit. These templates provide server-side validation of submitted data and scenarios of subsequent actions if submit is successful or if an error occurs. Submit template files have .sbm extension.

Function Templates

These templates contain collections of functions (or macros) used in other templates, for example, for drawing menu, footer and header.

Templates For Special Purposes

There are some Web interface templates that do not fall into any of the above mentioned categories. They are designed for special tasks such as to draw a menu on the left, or the page header or footer, or login page, etc. Some special purpose templates are located in the ~cpanel/shiva/shiva-templates/<design>/design/ directory, some like signup_top.html.in or signup_bottom.html in the ~cpanel/shiva/shiva- templates/<design>/signup directory. There is no general classification for such templates.

Context Help Templates

Context help templates are special templates for generating online help message in popup windows. Each context help template has its topic header and body. They can be modified as usual Parallels H-Sphere templates.

Online help files are located in the ~cpanel/shiva/shiva-templates/common/online_help directory. They have .oh extension and contain the text in HTML format. See the instructions how to add context help pages to Parallels H-Sphere interface. Also read about context help in different languages.

Designs

Design, or skin, is the Control Panel GUI representation. It provides a different look of menu (left menu or dropdown menu on the top, or no menu present at all), CSS styles, colors and images, and the Quick Access page with icon links to different CP pages.

These are basic Parallels H-Sphere designs whose templates are located in the corresponding design template directories of ~cpanel/shiva/shiva-templates (referred to as <design> in the document):

If a certain template is not found for a particular design, Parallels H-Sphere gets that template in the common directory.

The default design configuration file design_config.xml is located in the ~cpanel/shiva/psoft/hsphere/ directory.

Replacements

Replacements are templates that override basic templates for particular plans. Replacements' root directory for each design is the ~cpanel/shiva/shiva- templates/<design>/replacements directory. Replacements are located in separate subdirectories specified in plan settings as the Template Directory parameter, relative to the replacement directory.

Parallels H-Sphere first searches for a template in the <design>/replacements/<plan> directory which has the same structure as the <design> directory. If the template is not found, it starts to look for it in the <design> directory. Read more about template lookup sequence.

Template Directory Structure

Template Lookup Sequence

  1. Parallels H-Sphere searches for a template of a particular design first in the custom template directory in replacements, then, if the template is not found there, it proceeds to the corresponding default template directory:

    ~cpanel/shiva/custom/templates/<design>/replacements/

    ~cpanel/shiva/shiva-templates/<design>/replacements/

  2. If the template is not found in replacements, Parallels H-Sphere searches in the design directory, first in among the custom templates, then amonng the corresponding default templates:

    ~cpanel/shiva/custom/templates/<design>/

    ~cpanel/shiva/shiva-templates/<design>/

  3. If the template is not found for this design, the search continues in the same sequence in the common design template directory:

    ~cpanel/shiva/custom/templates/common/replacements/

    ~cpanel/shiva/shiva-templates/common/replacements/

    ~cpanel/shiva/custom/templates/common/

    ~cpanel/shiva/shiva-templates/common/