Difference between revisions of "Server Manager2 create panel for contrib"

From SME Server
Jump to navigationJump to search
Line 42: Line 42:
 
         ├── public
 
         ├── public
 
         │   ├── css
 
         │   ├── css
         │   ├── images
+
         │   ├── images  
 
         │   └── js
 
         │   └── js
         └── templates
+
         └── templates - top level .html.ep file (one per theme)
 
             ├── layouts - contains one .html.ep file for each module
 
             ├── layouts - contains one .html.ep file for each module
 
             └── partials - contains partial files - as many as required for modules  
 
             └── partials - contains partial files - as many as required for modules  
 
                           (generally corresponds to subsidiary panels)
 
                           (generally corresponds to subsidiary panels)
 
</pre>
 
</pre>
 +
 +
So each module (contrib in this case), consists of at least 3 files:
 +
 +
# .pm file of perl in the controller directory to gather up the content into a data structure (generally a hash or array)
 +
# .lex or .pm in the I18n/modules directory consisting of translation strings
 +
# .html.ep file in the themes/default/templates/layout

Revision as of 11:09, 8 January 2022

Creating a panel for a Contrib using Server Manager 2

Server Manager 2 is based on the perl library Mojolicious and has as its central tenet that the html structure is kept separate from the content that is displayed, giving a lot of flexibility. It has a structure so that the web pages can have a theme applied independant of the content. Behind the scenes a non blocking web server does the actual work, and comes with lots of additional plugins.

Initially the default theme mimics the current Server Manager pages (which is based on formMagick), however a new theme has also been developed which is based on AdminLTE.

If you follow the rules in this document, then your page should work in both themes without any trouble!

I am using the example of the DHCP Manager contrib which has a simple initial panel and 3 subsidiary panels.

File Structure

/usr/share/smanager
├── conf - contains preferences file.
├── data
├── lib
│   └── SrvMngr
│       ├── Controller - contains .pm files one for each module
│       ├── I18N
│       │   └── Modules
│       │       ├── Backup
...snip ....one for each module - contains translation strings
│       │       ├── Xt_geoip
│       │       └── Yum
│       ├── Model
│       └── Plugin
├── log
├── script
├── t
└── themes
    └── default
        ├── public
        │   ├── css
        │   ├── images 
        │   └── js
        └── templates - top level .html.ep file (one per theme)
            ├── layouts - contains one .html.ep file for each module
            └── partials - contains partial files - as many as required for modules 
                           (generally corresponds to subsidiary panels)

So each module (contrib in this case), consists of at least 3 files:

  1. .pm file of perl in the controller directory to gather up the content into a data structure (generally a hash or array)
  2. .lex or .pm in the I18n/modules directory consisting of translation strings
  3. .html.ep file in the themes/default/templates/layout