Changes

From SME Server
Jump to navigationJump to search
Line 138: Line 138:  
# and translatable strings in here:  /etc/e-smith/locale/en-us/etc/e-smith/web/functions/<contrib name> the format is XML- like whereas SM2 requires a more perl l- ike structure.  
 
# and translatable strings in here:  /etc/e-smith/locale/en-us/etc/e-smith/web/functions/<contrib name> the format is XML- like whereas SM2 requires a more perl l- ike structure.  
 
   
 
   
   
I have not really understood how formMagick works, but mostly the subroutine names and code shows what is needed.
 
I have not really understood how formMagick works, but mostly the subroutine names and code shows what is needed.
   Line 156: Line 155:  
signal-event smanager-refresh
 
signal-event smanager-refresh
 
</syntaxhighlight>
 
</syntaxhighlight>
and sometimes i need to use CTL-F5 to refresh the browser cache before seeing the result of a change.
+
and sometimes I need to use CTL-F5 to refresh the browser cache before seeing the result of a change (especially CSS changes)
    
Remember to set Mode = "development" in the mojolicious config file so that Perl run time errors are shown usefully. See above.
 
Remember to set Mode = "development" in the mojolicious config file so that Perl run time errors are shown usefully. See above.
Line 371: Line 370:     
==The Template Files (dhcpman.html.ep and partials)==
 
==The Template Files (dhcpman.html.ep and partials)==
 +
The top level .ep file starts like this:<syntaxhighlight lang="perl">
 +
% layout 'default', title => "Sme server 2 - DHCP Manager", share_dir => './';
 +
 +
% content_for 'module' => begin
 +
<div id="module" class="module dhcpman-panel">
 +
 +
    % if ($config->{debug} == 1) {
 +
<p>
 +
%= dumper $c->current_route
 +
</p>
 +
    % }
 +
   
 +
    <h1><%=$title%></h1>
 +
    %= $modul
 +
   
 +
  %if ($dhcp_data->{first}) {
 +
    <br><p>
 +
%=$c->render_to_string(inline =>$c->l($dhcp_data->{first}))
 +
</p>
 +
 +
%}
 +
</syntaxhighlight>All Mojolicious commands are indicated by a "%" in the first non space character. If the next character is an equals sign then the result of the expression is output.
 +
 +
Lines which do not start with a "%" are output anyway (and are usually htrml tags).
 +
 +
More details about the content of the .ep files are available [https://docs.mojolicious.org/Mojolicious/Guides/Rendering#toc here] and [https://docs.mojolicious.org/Mojolicious/Plugin/DefaultHelpers here].
 +
 +
Please note the initial "div" which has a class of "module" and "<modulename>-panel". This allows specific formatting in the AdminLTE theme.
 +
 +
Also note the use of "debug" config field. This can be used to show debug information.
 +
 +
The next part comprises that common success and error panels, and then the branch according to the $trt parameter which controls which panel details are shown.<syntaxhighlight lang="perl">
 +
%} elsif ($dhcp_data->{success}) {
 +
<div class='sme-border'>
 +
      <h2> Operation Status Report</h2><p>
 +
%= $c->l($dhcp_data->{success});
 +
</p>
 +
</div>
 +
 +
  %} elsif ($dhcp_data->{error}) {
 +
  <div class='sme-error'>
 +
      <h2> Operation Status Report - error</h2><p>
 +
%= $c->l($dhcp_data->{error});
 +
</p>
 +
    </div>
 +
%}
 +
 +
    % if ($dhcp_data->{trt} eq 'LEASES') {
 +
%= include 'partials/_dhcpm_leases'
 +
    %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
 +
    %= include 'partials/_dhcpm_winpopup'
 +
    %} elsif ($dhcp_data->{trt} eq 'SCAN') {
 +
    %= include 'partials/_dhcpm_scan'
 +
%}
 +
</syntaxhighlight>and finally the front panel details is defined:<syntaxhighlight>
 +
else {  #PARAMS
 +
      #Front parameter panel here...
 +
 +
 +
%}
 +
 +
</div>
 +
%end
 +
</syntaxhighlight>
    
===Mojolicious Meta Commands===
 
===Mojolicious Meta Commands===

Navigation menu