Changes

Jump to navigation Jump to search
Line 3: Line 3:  
== Introduction ==
 
== Introduction ==
    +
There are 3 possibilities for incorporating an existing (legacy) contrib into Server manager 2:
    +
# Re-code the contrib into the Mojolicious environment in which SM2 is written.  This is documented [[Server Manager2 create panel for contrib|here]].
 +
# Code up a "dummy" perl panel using mojolicious (see example below) which is inserted uatomatically into the menu and calls the "embedded.html.ep" template file.
 +
# Just import the current contrib and access it through the "Legacy" category on the menu.
    +
This page explains (2) and (3) in a bit more detail.
 +
 +
== Code up a dummy page which calls the legacy panel ==
 +
 +
===== ffff =====
 +
If you want to be able to control the position and category in the menu for the legacy contrib then you'll need to create a perl program in: the directory:<syntaxhighlight lang="shell">
 +
/usr/share/smanager/SrvMngr/Controller
 +
</syntaxhighlight>
 +
 +
 +
Here is an example for the smeserver-userpanel contrib:<syntaxhighlight lang="perl">
 +
package SrvMngr::Controller::Userpanelaccess;
 +
 +
#----------------------------------------------------------------------
 +
# heading    : User management
 +
# description : User Panel Access
 +
# navigation  : 2000 150
 +
# menu        :
 +
#----------------------------------------------------------------------
 +
# name  : userpanelaccess,    method : get,  url : /userpanelaccess,    ctlact : Userpanelaccess#main
 +
#
 +
# routes : end
 +
#----------------------------------------------------------------------
 +
 +
use strict;
 +
use warnings;
 +
 +
use Mojo::Base 'Mojolicious::Controller';
 +
 +
use Locale::gettext;
 +
use SrvMngr::I18N;
 +
use SrvMngr qw(theme_list init_session);
 +
 +
#use SrvMngr::Model::Main;
 +
 +
 +
sub main {
 +
 +
    my $c = shift;
 +
    $c->app->log->info($c->log_req);
 +
 +
    my $title = $c->l('User panel access');
 +
    $c->stash( title => $title, modul => 'https://mailserver.bjsystems.co.uk/server-manager/cgi-bin/userpanelaccess', height => 600 );
 +
    $c->render(template => 'embedded');
 +
 +
}
 +
1;
 +
 +
</syntaxhighlight>This file will need to be here:<syntaxhighlight lang="shell">
 +
/usr/share/smanager/SrvMngr/Controller/Userpanelaccess.pm
 +
</syntaxhighlight>Note the menu entries at the top, and the route specification (the capitalisation and case matching is important here)
 +
 +
Also note the full URL for the SM1 (legacy) contrib, and also the window length (it defaults to 600px if you do not specify).
 +
 +
This all that is necessary to customise the menu entry for a legacy contrib.
 +
 +
== Just install the contribs rpm and call it from the "Legacy" category ==
 +
Server manager 2 will scan for installed contribs, and any that are not fully compatible with Mojolicious will just load the menu entry, using the package name as a link, under the "Legacy" category, normally at the bottom of the menu stack.
 +
 +
== The need to login into Server Manager 1 ==
 +
If the legacy contrib does not show after clicking on the menu entry (either for mode (2) or (3) above), then it is probably that you are not logged into SM1.  This can be achieved using the button in the top border of SM2 titled "Legacy SM". You can almost certainly use the same credentials that you used to go into SM2.  Unfortunately the two programs use different login mechanisms.
    
== Bugs ==
 
== Bugs ==

Navigation menu