diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Targets/CreateStarterWebsite/CreateStarterWebsite-Custom.pm b/Targets/CreateStarterWebsite/CreateStarterWebsite-Custom.pm deleted file mode 100644 index a0c3567..0000000 --- a/Targets/CreateStarterWebsite/CreateStarterWebsite-Custom.pm +++ /dev/null @@ -1,63 +0,0 @@ -# -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:42:48 -# -# -# Routines to be edited by the developer to provide validation for parameters -# and provison of the control data for table(s) -# -use esmith::util; -use esmith::HostsDB; -use esmith::AccountsDB; -use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; - - -#The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); - -# Validation routines - parameters for each panel - - sub validate_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -# Get control data for tables(s) - - -# Return hash with values from row in which link clicked on table - - sub get_selected_PARAMS { - my $c = shift; - my $selected = shift; #Parameter is name of selected row. - my $is_new_record = shift; #Indicates new record required (defaults) - my %ret = {}; - return $ret; - } - - -#after sucessful modify or create or whatever and submit then perfom (if the params validate) - - sub perform_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -sub create_link{ - # WIP - my ($c,$route, $panel, $index) = shift; - my $link = "$route?trt=$panel&Selected=$index"; - return $link; -} -1; diff --git a/Targets/CreateStarterWebsite/CreateStarterWebsite-Custom.pm.new b/Targets/CreateStarterWebsite/CreateStarterWebsite-Custom.pm.new deleted file mode 100644 index 934992d..0000000 --- a/Targets/CreateStarterWebsite/CreateStarterWebsite-Custom.pm.new +++ /dev/null @@ -1,63 +0,0 @@ -# -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-18 09:02:36 -# -# -# Routines to be edited by the developer to provide validation for parameters -# and provison of the control data for table(s) -# lcPackageName=json5_dict["PackageName"].lower(), - -use esmith::HostsDB; -use esmith::AccountsDB; -use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; - - -#The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); - -# Validation routines - parameters for each panel - - sub validate_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -# Get control data for tables(s) - - -# Return hash with values from row in which link clicked on table - - sub get_selected_PARAMS { - my $c = shift; - my $selected = shift; #Parameter is name of selected row. - my $is_new_record = shift; #Indicates new record required (defaults) - my %ret = {}; - return $ret; - } - - -#after sucessful modify or create or whatever and submit then perfom (if the params validate) - - sub perform_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -sub create_link{ - # WIP - my ($c,$route, $panel, $index) = shift; - my $link = "$route?trt=$panel&Selected=$index"; - return $link; -} -1; diff --git a/Targets/CreateStarterWebsite/CreateStarterWebsite.pm b/Targets/CreateStarterWebsite/CreateStarterWebsite.pm deleted file mode 100644 index 1b2903f..0000000 --- a/Targets/CreateStarterWebsite/CreateStarterWebsite.pm +++ /dev/null @@ -1,243 +0,0 @@ -package SrvMngr::Controller::CreateStarterWebsite; -# -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:42:48 -# -#---------------------------------------------------------------------- -# heading : Miscellaneous -# description : Create Starter Website -# navigation : 2000 400 -# -# name : createstarterwebsite, method : get, url : /createstarterwebsite, ctlact : CreateStarterWebsite#main -# name : createstarterwebsiteu, method : post, url : /createstarterwebsiteu, ctlact : CreateStarterWebsite#do_update -# name : createstarterwebsited, method : get, url : /createstarterwebsited, ctlact : CreateStarterWebsite#do_display -# -# routes : end -# -# Documentation: https://wiki.contribs.org/CreateStarterWebsite -#---------------------------------------------------------------------- - -# -# Scheme of things: -# -# TBA!! - -use strict; -use warnings; -use Mojo::Base 'Mojolicious::Controller'; - -use constant FALSE => 0; -use constant TRUE => 1; - -use Locale::gettext; -use SrvMngr::I18N; -use SrvMngr qw(theme_list init_session); - -use Data::Dumper; - -use esmith::util; -use esmith::HostsDB; -use esmith::AccountsDB; -use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; - - -#The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); - -require '/usr/share/smanager/lib/SrvMngr/Controller/CreateStarterWebsite-Custom.pm'; #The code that is to be added by the developer - -sub main { -# -# Initial entry - route is "/" -# -#set initial panel -#for initial panel: - #Specifiy panel to enter - #load up _data hash with DB fields - #load up stash with pointer(s) to control fields hash(= get-)) - #and a pointer to the prefix_data hash -#render initial panel - - my $c = shift; - $c->app->log->info( $c->log_req ); - - my %csw_data = (); - my $title = $c->l('csw_Create_Starter_Website'); - my $modul = ''; - - $csw_data{'trt'} = 'PARAMS'; - - #Load any DB entries into the _data area so as they are preset in the form - # which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE - my $db = $cdb; #pickup local or global db or Default to config - - - # and table control fields - - - $c->stash( - title => $title, - modul => $modul, - csw_data => \%csw_data - ); - $c->render( template => "createstarterwebsite" ); -} - -# Post request with params - submit from the form -sub do_update { -# -# Return after submit pushed on panel (this is a post) - route is "/u" -# parameters in the params hash. -# -#load up all params into prefix_data hash: -#By panel (series of if statements - only one executed): - #call validate-PANEL() - return ret = ok or error message - -#if validation not ok: - #render back to current panel with error message in stash -#otherwise: - #By panel (series of if statements - only one executed): - #do whatever is required: call perform-PANEL() - return "ok" or Error Message - #call signal-event for any global actions specified (check it exists - error and continue?) - #if action smeserver--update exists - #signal_event smeserver--update - #call signal-event for any specific actions for thids panel (check it exists first - error and continue) - #set success in stash - #if no "nextpanel" entry: - #set firstpanel - #else - #set nextpanel - #call render - - my $c = shift; - $c->app->log->info($c->log_req); - - my %csw_data = (); - my $title = $c->l('csw_Create_Starter_Website'); - - # Accessing all POST parameters - my %params = $c->req->params->to_hash; - - # Get number of POST parameters - my $num_params = keys %params; - - #Params are available in the hash "params" - copy to the prefix_data hash - while (my ($key, $value) = each %{$c->req->params->to_hash}) { - $csw_data{$key} = $value; - } - - # the value of trt will tell you which panel has returned - my $trt = $c->param('trt') || 'PARAMS'; #hidden control on every form. - my $ret = 'ok'; - #Validate the parameters in a custom sub one for each panel (although only one of these will be executed) - - my $thispanel; - - if ($trt eq 'PARAMS'){ - #Validate form parameters for panel PARAMS - $ret = $c->validate_PARAMS(\%csw_data); - $thispanel = 'PARAMS'; - } - - - if ($ret ne "ok") { - # return to the panel with error message - $c->stash(error => $c->l($ret)); - $c->render("createstarterwebsite"); - } else { - #Do whatever is needed, including writing values to the DB - - if ($trt eq 'PARAMS'){ - #do whatever is required ... - $ret = $c->perform_PARAMS(\%csw_data); - if ($ret ne "ok") { - # return to the panel with error message - $c->stash(error => $c->l($ret)); - $c->render("createstarterwebsite"); - } else { - $c->stash( success => $c->l('csw_PARAMS_panel_action_was_successful')); #A bit bland - edit it in the lex file - } - } - - # and call any signal-events needed - - - # Setup shared data and call panel - $c->stash( - title => $title, - csw_data => \%csw_data - ); - if ('none' eq 'none') { - $csw_data{'trt'} = 'PARAMS'; - } else { - $csw_data{'trt'} = 'none'; - } - $c->render("createstarterwebsite"); - } -} - -sub do_display { -# -# Return after link clicked in table (this is a get) - route is "/d" -# Expects ?trt=PANEL&selected="TableRowName" plus any other required -# -# OR it maybe a post from the main panel to add a new record -# -#load up all supplied params into prefix_data hash -#call get-selected-PANEL() - returns hash of all relevent parameters -#load up returned hash into prefix_data -#render - to called panel - - my $c = shift; - $c->app->log->info($c->log_req); - - my %csw_data = (); - my $title = $c->l('csw_Create_Starter_Website'); - - # Accessing all parameters - my %params = $c->req->params->to_hash; - - # Get number of parameters - my $num_params = keys %params; - - #Tag as Post or Get (ie. create new entry or edit existing one - my $is_new_record = ($c->req->method() eq 'POST'); - - #Params are available in the hash "params" - copy to the prefix_data hash - while (my ($key, $value) = each %{$c->req->params->to_hash}) { - $csw_data{$key} = $value; - } - - # the value of trt will tell you which panel has returned - my $trt = $c->param('trt') || 'PARAMS'; #Indicates where to go now - - # Now add in the params from the selected row from the table - - my %selectedrow; - - if ($trt eq 'PARAMS'){ - #Validate form parameters for panel PARAMS - %selectedrow = $c->get_selected_PARAMS($csw_data{'Selected'},$is_new_record); - } - - - #Copy in the selected row params to the prefix_data hash to pass to the panel - while (my ($key, $value) = each %selectedrow){ - $csw_data{$key} = $value; - } - # Where to go now - $csw_data{'trt'} = $trt; - - # Data for panel - $c->stash( - title => $title, - csw_data => \%csw_data - ); - $c->render("createstarterwebsite"); -} -1; diff --git a/Targets/CreateStarterWebsite/_csw_PARAMS.html.ep b/Targets/CreateStarterWebsite/_csw_PARAMS.html.ep deleted file mode 100644 index 81001c8..0000000 --- a/Targets/CreateStarterWebsite/_csw_PARAMS.html.ep +++ /dev/null @@ -1,101 +0,0 @@ -%# -%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:42:48 -%# -
- -

- %= l('csw_Hello_PARAMS'); -

- % my $btn = l('csw_APPLY'); - %= form_for "CreateStarterWebsited" => (method => 'POST') => begin - - % param 'trt' => $csw_data->{trt} unless param 'trt'; - %= hidden_field 'trt' => $csw_data->{trt} - %# Inputs etc in here. - -

<%=l('csw_Create_a_starter_website')%>

- -

<%=l('csw_Manage_CreateStarterWebsite_settings:')%>

- -

- %=l('csw_To_create_a_simple_web') -

- -

- %=l('csw_You_can_leave_any_field') -

- -

- %=l('csw_The_text_that_you_enter') -

- -

- %=l('csw_Do_not_use_this_optionif') -

- -

- %=l('csw_') - - % param 'companyName' => $csw_data->{companyName} unless param 'companyName'; - %= text_field 'companyName', size => '50', class => 'textinput companyName' , pattern=>'.*' , placeholder=>'companyName' -

- -

- %=l('csw_First_header,_typically_used_for') -

- -

- %=l('csw_') - - % param 'header1' => $csw_data->{header1} unless param 'header1'; - %= text_field 'header1', size => '50', class => 'textinput header1' , pattern=>'.*' , placeholder=>'header1' -

- -

- %=l('csw_Text_following_first_header,_typically') -

- - - %=l('csw_') - - % param 'text1' => $csw_data->{text1} unless param 'text1'; - %= text_area 'text1', cols=>40, rows=>10 -
- -

- %=l('csw_Second_header,_typically_used_for') -

- -

- %=l('csw_') - - % param 'header2' => $csw_data->{header2} unless param 'header2'; - %= text_field 'header2', size => '50', class => 'textinput header2' , pattern=>'.*' , placeholder=>'header2' -

- -

- %=l('csw_Text_following_second_header,_typically') -

- - - %=l('csw_') - - % param 'text2' => $csw_data->{text2} unless param 'text2'; - %= text_area 'text2', cols=>40, rows=>10 -
- -

- %=l('csw_When_you_create_this_web') -

- -

- %=l('csw_Do_you_wish_to_proceed?') -

- - %# Probably finally by a submit. - %end -
diff --git a/Targets/CreateStarterWebsite/createstarterwebsite.css b/Targets/CreateStarterWebsite/createstarterwebsite.css deleted file mode 100644 index 1f83de9..0000000 --- a/Targets/CreateStarterWebsite/createstarterwebsite.css +++ /dev/null @@ -1,24 +0,0 @@ -/* - Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:42:48 -*/ -.CreateStarterWebsite-panel {} -.name {} -.rout {} -.head {} -.subh {} -.para1 {} -.para2 {} -.para3 {} -.para4 {} -.text1 {} -.para5 {} -.text2 {} -.para6 {} -.text3 {} -.para7 {} -.text4 {} -.para8 {} -.text5 {} -.para9 {} -.para10 {} -.subm6 {} diff --git a/Targets/CreateStarterWebsite/createstarterwebsite.html.ep b/Targets/CreateStarterWebsite/createstarterwebsite.html.ep deleted file mode 100644 index ac2bf5f..0000000 --- a/Targets/CreateStarterWebsite/createstarterwebsite.html.ep +++ /dev/null @@ -1,52 +0,0 @@ -%# -%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:42:48 -%# -% layout 'default', title => "Sme server 2 - Create Starter Website", share_dir => './'; -%# css specific to this panel: -% content_for 'module' => begin -%= stylesheet '/css/createstarterwebsite.css' -
- - % if ($config->{debug} == 1) { -

- %= dumper $c->current_route -

- % } - -

<%=$title%>

- - % if ( stash('modul') ) { - %= $c->render_to_string(inline => stash('modul') ); - % } - - %if ($csw_data->{first}) { -

- %=$c->render_to_string(inline =>$c->l($csw_data->{first})) -

- - %} elsif ($csw_data->{success}) { -
-

Operation Status Report

- %= $c->l($csw_data->{success}); -

-
- - %} elsif ($csw_data->{error}) { -
-

Operation Status Report - error

- %= $c->l($csw_data->{error}); -

-
- %} - - %#Routing to partials according to trt parameter. - %#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement' - - % if ($csw_data->{trt} eq "PARAMS") { - %= include 'partials/_csw_PARAMS' - %} - - - -
-%end diff --git a/Targets/CreateStarterWebsite/createstarterwebsite_en.lex b/Targets/CreateStarterWebsite/createstarterwebsite_en.lex deleted file mode 100644 index fde603f..0000000 --- a/Targets/CreateStarterWebsite/createstarterwebsite_en.lex +++ /dev/null @@ -1,20 +0,0 @@ -# -# Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:42:48 -# -'csw_You_can_leave_any_field' => 'You can leave any field blank if you do not need it. ', -'csw_Do_you_wish_to_proceed?' => 'Do you wish to proceed?', -'csw_Text_following_second_header,_typically' => 'Text following second header, Typically used for contact or ordering information:', -'csw_Create_Starter_Website' => 'Create Starter Website', -'csw_Hello_PARAMS' => 'Hello PARAMS', -'csw_The_text_that_you_enter' => 'The text that you enter below will be line wrapped for a nicer appearance in your web page. Leave a blank line whenever you want to start a new paragraph. If you need to force a line break without starting a new paragraph (for example after each line of a mailing address), Then type the four-character sequence', -'csw_Text_following_first_header,_typically' => 'Text following first header, Typically used for a paragraph of marketing information. ', -'csw_Second_header,_typically_used_for' => 'Second header, Typically used for short phrases such as For more information or To order our products:', -'csw_When_you_create_this_web' => 'When you create this web page, The file index. Htm will be overwritten in your web site directory. ', -'csw_Manage_CreateStarterWebsite_settings:' => 'Manage CreateStarterWebsite settings:', -'csw_Do_not_use_this_optionif' => 'Do not use this optionif you have already customized your web site, Since it will overwrite the index. Htm file in your web site directory. ', -'csw_Create_a_starter_website' => 'Create a starter website', -'csw_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful', -'csw_To_create_a_simple_web' => 'To create a simple web page for your company, Fill in the fields below and click onCreate. ', -'csw_First_header,_typically_used_for' => 'First header, Typically used for short phrases such as Leader in the field of textile manufacturing', -'csw_APPLY' => 'Apply', -'csw_' => '', diff --git a/Targets/DiskUsage/DiskUsage-Custom.pm b/Targets/DiskUsage/DiskUsage-Custom.pm deleted file mode 100644 index bbdd83e..0000000 --- a/Targets/DiskUsage/DiskUsage-Custom.pm +++ /dev/null @@ -1,87 +0,0 @@ -# -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:30:26 -# -# -# Routines to be edited by the developer to provide validation for parameters -# and provison of the control data for table(s) -# -use esmith::util; -use esmith::HostsDB; -use esmith::AccountsDB; -use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; - - -#The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); - -# Validation routines - parameters for each panel - - sub validate_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -# Get control data for tables(s) - - sub get_Table1 { - # Return an array of hashes of the contents for each row and column for Table1 - # default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc" - my $c = shift; - my $control_data = $self->stash('Table1'); - my @ret = {} -# foreach my $colHead (@$control_data) { -# my ret{$colHead} = "$colhead-1" -# }; - return \@ret - } - - sub get_Table2 { - # Return an array of hashes of the contents for each row and column for Table2 - # default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc" - my $c = shift; - my $control_data = $self->stash('Table2'); - my @ret = {} -# foreach my $colHead (@$control_data) { -# my ret{$colHead} = "$colhead-1" -# }; - return \@ret - } - - -# Return hash with values from row in which link clicked on table - - sub get_selected_PARAMS { - my $c = shift; - my $selected = shift; #Parameter is name of selected row. - my $is_new_record = shift; #Indicates new record required (defaults) - my %ret = {}; - return $ret; - } - - -#after sucessful modify or create or whatever and submit then perfom (if the params validate) - - sub perform_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -sub create_link{ - # WIP - my ($c,$route, $panel, $index) = shift; - my $link = "$route?trt=$panel&Selected=$index"; - return $link; -} -1; diff --git a/Targets/DiskUsage/DiskUsage-Custom.pm.new b/Targets/DiskUsage/DiskUsage-Custom.pm.new deleted file mode 100644 index 932b4a3..0000000 --- a/Targets/DiskUsage/DiskUsage-Custom.pm.new +++ /dev/null @@ -1,87 +0,0 @@ -# -# Routines to be edited by the developer to provide validation for parameters -# and provison of the control data for table(s) -# -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-16 11:18 -# - -use esmith::util; -use esmith::HostsDB; -use esmith::AccountsDB; -use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; - - -#The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); - -# Validation routines - parameters for each panel - - sub validate_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -# Get control data for tables(s) - - sub get_Table1 { - # Return an array of hashes of the contents for each row and column for Table1 - # default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc" - my $c = shift; - my $control_data = $self->stash('Table1'); - my @ret = {} -# foreach my $colHead (@$control_data) { -# my ret{$colHead} = "$colhead-1" -# }; - return \@ret - } - - sub get_Table2 { - # Return an array of hashes of the contents for each row and column for Table2 - # default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc" - my $c = shift; - my $control_data = $self->stash('Table2'); - my @ret = {} -# foreach my $colHead (@$control_data) { -# my ret{$colHead} = "$colhead-1" -# }; - return \@ret - } - - -# Return hash with values from row in which link clicked on table - - sub get_selected_PARAMS { - my $c = shift; - my $selected = shift; #Parameter is name of selected row. - my $is_new_record = shift; #Indicates new record required (defaults) - my %ret = {}; - return $ret; - } - - -#after sucessful modify or create or whatever and submit then perfom (if the params validate) - - sub perform_PARAMS { - my $c = shift; - my $prefix_data = shift; #Data hash as parameter - my $ret = 'ok'; - return $ret; - } - - -sub create_link{ - # WIP - my ($c,$route, $panel, $index) = shift; - my $link = "$route?trt=$panel&Selected=$index"; - return $link; -} -1; diff --git a/Targets/DiskUsage/DiskUsage.pm b/Targets/DiskUsage/DiskUsage.pm deleted file mode 100644 index 0ca4f11..0000000 --- a/Targets/DiskUsage/DiskUsage.pm +++ /dev/null @@ -1,245 +0,0 @@ -package SrvMngr::Controller::DiskUsage; -# -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:30:26 -# -#---------------------------------------------------------------------- -# heading : Miscellaneous -# description : Disk Usage -# navigation : 2000 400 -# -# name : diskusage, method : get, url : /diskusage, ctlact : DiskUsage#main -# name : diskusageu, method : post, url : /diskusageu, ctlact : DiskUsage#do_update -# name : diskusaged, method : get, url : /diskusaged, ctlact : DiskUsage#do_display -# -# routes : end -# -# Documentation: https://wiki.contribs.org/DiskUsage -#---------------------------------------------------------------------- - -# -# Scheme of things: -# -# TBA!! - -use strict; -use warnings; -use Mojo::Base 'Mojolicious::Controller'; - -use constant FALSE => 0; -use constant TRUE => 1; - -use Locale::gettext; -use SrvMngr::I18N; -use SrvMngr qw(theme_list init_session); - -use Data::Dumper; - -use esmith::util; -use esmith::HostsDB; -use esmith::AccountsDB; -use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; - - -#The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); - -require '/usr/share/smanager/lib/SrvMngr/Controller/DiskUsage-Custom.pm'; #The code that is to be added by the developer - -sub main { -# -# Initial entry - route is "/" -# -#set initial panel -#for initial panel: - #Specifiy panel to enter - #load up _data hash with DB fields - #load up stash with pointer(s) to control fields hash(= get-)) - #and a pointer to the prefix_data hash -#render initial panel - - my $c = shift; - $c->app->log->info( $c->log_req ); - - my %du_data = (); - my $title = $c->l('du_Disk_Usage'); - my $modul = ''; - - $du_data{'trt'} = 'PARAMS'; - - #Load any DB entries into the _data area so as they are preset in the form - # which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE - my $db = $cdb; #pickup local or global db or Default to config - - - # and table control fields - $c->stash(Table1=>$c->get_Table1()); - $c->stash(Table2=>$c->get_Table2()); - - - $c->stash( - title => $title, - modul => $modul, - du_data => \%du_data - ); - $c->render( template => "diskusage" ); -} - -# Post request with params - submit from the form -sub do_update { -# -# Return after submit pushed on panel (this is a post) - route is "/u" -# parameters in the params hash. -# -#load up all params into prefix_data hash: -#By panel (series of if statements - only one executed): - #call validate-PANEL() - return ret = ok or error message - -#if validation not ok: - #render back to current panel with error message in stash -#otherwise: - #By panel (series of if statements - only one executed): - #do whatever is required: call perform-PANEL() - return "ok" or Error Message - #call signal-event for any global actions specified (check it exists - error and continue?) - #if action smeserver--update exists - #signal_event smeserver--update - #call signal-event for any specific actions for thids panel (check it exists first - error and continue) - #set success in stash - #if no "nextpanel" entry: - #set firstpanel - #else - #set nextpanel - #call render - - my $c = shift; - $c->app->log->info($c->log_req); - - my %du_data = (); - my $title = $c->l('du_Disk_Usage'); - - # Accessing all POST parameters - my %params = $c->req->params->to_hash; - - # Get number of POST parameters - my $num_params = keys %params; - - #Params are available in the hash "params" - copy to the prefix_data hash - while (my ($key, $value) = each %{$c->req->params->to_hash}) { - $du_data{$key} = $value; - } - - # the value of trt will tell you which panel has returned - my $trt = $c->param('trt') || 'PARAMS'; #hidden control on every form. - my $ret = 'ok'; - #Validate the parameters in a custom sub one for each panel (although only one of these will be executed) - - my $thispanel; - - if ($trt eq 'PARAMS'){ - #Validate form parameters for panel PARAMS - $ret = $c->validate_PARAMS(\%du_data); - $thispanel = 'PARAMS'; - } - - - if ($ret ne "ok") { - # return to the panel with error message - $c->stash(error => $c->l($ret)); - $c->render("diskusage"); - } else { - #Do whatever is needed, including writing values to the DB - - if ($trt eq 'PARAMS'){ - #do whatever is required ... - $ret = $c->perform_PARAMS(\%du_data); - if ($ret ne "ok") { - # return to the panel with error message - $c->stash(error => $c->l($ret)); - $c->render("diskusage"); - } else { - $c->stash( success => $c->l('du_PARAMS_panel_action_was_successful')); #A bit bland - edit it in the lex file - } - } - - # and call any signal-events needed - - - # Setup shared data and call panel - $c->stash( - title => $title, - du_data => \%du_data - ); - if ('none' eq 'none') { - $du_data{'trt'} = 'PARAMS'; - } else { - $du_data{'trt'} = 'none'; - } - $c->render("diskusage"); - } -} - -sub do_display { -# -# Return after link clicked in table (this is a get) - route is "/d" -# Expects ?trt=PANEL&selected="TableRowName" plus any other required -# -# OR it maybe a post from the main panel to add a new record -# -#load up all supplied params into prefix_data hash -#call get-selected-PANEL() - returns hash of all relevent parameters -#load up returned hash into prefix_data -#render - to called panel - - my $c = shift; - $c->app->log->info($c->log_req); - - my %du_data = (); - my $title = $c->l('du_Disk_Usage'); - - # Accessing all parameters - my %params = $c->req->params->to_hash; - - # Get number of parameters - my $num_params = keys %params; - - #Tag as Post or Get (ie. create new entry or edit existing one - my $is_new_record = ($c->req->method() eq 'POST'); - - #Params are available in the hash "params" - copy to the prefix_data hash - while (my ($key, $value) = each %{$c->req->params->to_hash}) { - $du_data{$key} = $value; - } - - # the value of trt will tell you which panel has returned - my $trt = $c->param('trt') || 'PARAMS'; #Indicates where to go now - - # Now add in the params from the selected row from the table - - my %selectedrow; - - if ($trt eq 'PARAMS'){ - #Validate form parameters for panel PARAMS - %selectedrow = $c->get_selected_PARAMS($du_data{'Selected'},$is_new_record); - } - - - #Copy in the selected row params to the prefix_data hash to pass to the panel - while (my ($key, $value) = each %selectedrow){ - $du_data{$key} = $value; - } - # Where to go now - $du_data{'trt'} = $trt; - - # Data for panel - $c->stash( - title => $title, - du_data => \%du_data - ); - $c->render("diskusage"); -} -1; diff --git a/Targets/DiskUsage/_du_PARAMS.html.ep b/Targets/DiskUsage/_du_PARAMS.html.ep deleted file mode 100644 index ffaaba6..0000000 --- a/Targets/DiskUsage/_du_PARAMS.html.ep +++ /dev/null @@ -1,83 +0,0 @@ -%# -%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:30:26 -%# -
- -

- %= l('du_Hello_PARAMS'); -

- % my $btn = l('du_APPLY'); - %= form_for "DiskUsaged" => (method => 'POST') => begin - - % param 'trt' => $du_data->{trt} unless param 'trt'; - %= hidden_field 'trt' => $du_data->{trt} - %# Inputs etc in here. - -

<%=l('du_Disk_usage')%>

- -

<%=l('du_Manage_DiskUsage_settings:')%>

- -

- %=l('du_Wed_Sep_11_19:01:00_BST') -

- -
-	Filesystem             Size  Used Avail Use% Mounted on
-/dev/mapper/main-root   29G  4.8G   24G  17% /
-devtmpfs               2.0G     0  2.0G   0% /dev
-tmpfs                  2.0G   12K  2.0G   1% /dev/shm
-tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
-tmpfs                  2.0G  648K  2.0G   1% /run
-/dev/sda1              497M  111M  386M  23% /boot'
-
- - -
- - - - - - - - - % my $control_data = $self->stash('Table1'); - % foreach my $row (@$control_data) { - - - - - - %} - -
<%=l('du_I-bays')%><%=l('du_Usage')%><%=l('du_Path')%>
<%=$c->render_to_string(inline=>$row->{'Table1-I-bays'})%><%=$c->render_to_string(inline=>$row->{'Table1-Usage'})%><%=$c->render_to_string(inline=>$row->{'Table1-Path'})%>
- - -
- - - - - - - - - % my $control_data = $self->stash('Table2'); - % foreach my $row (@$control_data) { - - - - - - %} - -
<%=l('du_Users')%><%=l('du_Usage')%><%=l('du_Path')%>
<%=$c->render_to_string(inline=>$row->{'Table2-Users'})%><%=$c->render_to_string(inline=>$row->{'Table2-Usage'})%><%=$c->render_to_string(inline=>$row->{'Table2-Path'})%>
- - - %# Probably finally by a submit. - %end -
diff --git a/Targets/DiskUsage/diskusage.css b/Targets/DiskUsage/diskusage.css deleted file mode 100644 index e48c885..0000000 --- a/Targets/DiskUsage/diskusage.css +++ /dev/null @@ -1,16 +0,0 @@ -/* - Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:30:26 -*/ -.DiskUsage-panel {} -.name {} -.rout {} -.head {} -.subh {} -.para1 {} -.pref1 {} -.tabl1 {} -thead .tabl1 {} -tbody .tabl1 {} -.tabl2 {} -thead .tabl2 {} -tbody .tabl2 {} diff --git a/Targets/DiskUsage/diskusage.html.ep b/Targets/DiskUsage/diskusage.html.ep deleted file mode 100644 index 5fb8a6d..0000000 --- a/Targets/DiskUsage/diskusage.html.ep +++ /dev/null @@ -1,52 +0,0 @@ -%# -%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:30:26 -%# -% layout 'default', title => "Sme server 2 - Disk Usage", share_dir => './'; -%# css specific to this panel: -% content_for 'module' => begin -%= stylesheet '/css/diskusage.css' -
- - % if ($config->{debug} == 1) { -

- %= dumper $c->current_route -

- % } - -

<%=$title%>

- - % if ( stash('modul') ) { - %= $c->render_to_string(inline => stash('modul') ); - % } - - %if ($du_data->{first}) { -

- %=$c->render_to_string(inline =>$c->l($du_data->{first})) -

- - %} elsif ($du_data->{success}) { -
-

Operation Status Report

- %= $c->l($du_data->{success}); -

-
- - %} elsif ($du_data->{error}) { -
-

Operation Status Report - error

- %= $c->l($du_data->{error}); -

-
- %} - - %#Routing to partials according to trt parameter. - %#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement' - - % if ($du_data->{trt} eq "PARAMS") { - %= include 'partials/_du_PARAMS' - %} - - - -
-%end diff --git a/Targets/DiskUsage/diskusage_en.lex b/Targets/DiskUsage/diskusage_en.lex deleted file mode 100644 index 0d4dec6..0000000 --- a/Targets/DiskUsage/diskusage_en.lex +++ /dev/null @@ -1,14 +0,0 @@ -# -# Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-22 11:30:26 -# -'du_I-bays' => 'I-bays', -'du_APPLY' => 'Apply', -'du_Disk_Usage' => 'Disk Usage', -'du_Hello_PARAMS' => 'Hello PARAMS', -'du_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful', -'du_Wed_Sep_11_19:01:00_BST' => 'Wed Sep 11 19:01:00 BST 2024', -'du_Path' => 'Path', -'du_Usage' => 'Usage', -'du_Users' => 'Users', -'du_Disk_usage' => 'Disk usage', -'du_Manage_DiskUsage_settings:' => 'Manage DiskUsage settings:', diff --git a/Targets/Diskusage/Diskusage-Custom.pm b/Targets/Diskusage/Diskusage-Custom.pm old mode 100644 new mode 100755 diff --git a/Targets/Diskusage/Diskusage.pm b/Targets/Diskusage/Diskusage.pm old mode 100644 new mode 100755 diff --git a/Targets/Diskusage/_d_PARAMS.html.ep b/Targets/Diskusage/_d_PARAMS.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Diskusage/diskusage.css b/Targets/Diskusage/diskusage.css old mode 100644 new mode 100755 diff --git a/Targets/Diskusage/diskusage.html.ep b/Targets/Diskusage/diskusage.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Diskusage/diskusage_en.lex b/Targets/Diskusage/diskusage_en.lex old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/Letsencrypt-Custom.pm b/Targets/Letsencrypt/Letsencrypt-Custom.pm old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/Letsencrypt.pm b/Targets/Letsencrypt/Letsencrypt.pm old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep b/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/_lets_CHECKALLENABLEDDOMAINS.html.ep b/Targets/Letsencrypt/_lets_CHECKALLENABLEDDOMAINS.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/_lets_CHECKONEDOMAIN.html.ep b/Targets/Letsencrypt/_lets_CHECKONEDOMAIN.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/_lets_LIST.html.ep b/Targets/Letsencrypt/_lets_LIST.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/_lets_PARAMS.html.ep b/Targets/Letsencrypt/_lets_PARAMS.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/letsencrypt.css b/Targets/Letsencrypt/letsencrypt.css old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/letsencrypt.html.ep b/Targets/Letsencrypt/letsencrypt.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Letsencrypt/letsencrypt_en.lex b/Targets/Letsencrypt/letsencrypt_en.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/Nfsshare-Custom.pm b/Targets/Nfsshare/Nfsshare-Custom.pm old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/Nfsshare-Custom.pm.new b/Targets/Nfsshare/Nfsshare-Custom.pm.new old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/Nfsshare.pm b/Targets/Nfsshare/Nfsshare.pm old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/_nfs_PARAMS.html.ep b/Targets/Nfsshare/_nfs_PARAMS.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/_nfs_TABLE.html.ep b/Targets/Nfsshare/_nfs_TABLE.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfs_PARAMS.html.ep b/Targets/Nfsshare/nfs_PARAMS.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfs_TABLE.html.ep b/Targets/Nfsshare/nfs_TABLE.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare-lexfiles.zip b/Targets/Nfsshare/nfsshare-lexfiles.zip old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare.html.ep b/Targets/Nfsshare/nfsshare.html.ep old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_bg.lex b/Targets/Nfsshare/nfsshare_bg.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_de.lex b/Targets/Nfsshare/nfsshare_de.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_dk.lex b/Targets/Nfsshare/nfsshare_dk.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_el.lex b/Targets/Nfsshare/nfsshare_el.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_en.lex b/Targets/Nfsshare/nfsshare_en.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_en.po b/Targets/Nfsshare/nfsshare_en.po old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_es.lex b/Targets/Nfsshare/nfsshare_es.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_es.po b/Targets/Nfsshare/nfsshare_es.po old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_et.lex b/Targets/Nfsshare/nfsshare_et.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_fr.lex b/Targets/Nfsshare/nfsshare_fr.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_hu.lex b/Targets/Nfsshare/nfsshare_hu.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_id.lex b/Targets/Nfsshare/nfsshare_id.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_il.lex b/Targets/Nfsshare/nfsshare_il.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_it.lex b/Targets/Nfsshare/nfsshare_it.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_jp.lex b/Targets/Nfsshare/nfsshare_jp.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_nl.lex b/Targets/Nfsshare/nfsshare_nl.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_no.lex b/Targets/Nfsshare/nfsshare_no.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_pl.lex b/Targets/Nfsshare/nfsshare_pl.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_pt-br.lex b/Targets/Nfsshare/nfsshare_pt-br.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_pt.lex b/Targets/Nfsshare/nfsshare_pt.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_ro.lex b/Targets/Nfsshare/nfsshare_ro.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_ru.lex b/Targets/Nfsshare/nfsshare_ru.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_sl.lex b/Targets/Nfsshare/nfsshare_sl.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_sv.lex b/Targets/Nfsshare/nfsshare_sv.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_th.lex b/Targets/Nfsshare/nfsshare_th.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_tr.lex b/Targets/Nfsshare/nfsshare_tr.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_zh-cn.lex b/Targets/Nfsshare/nfsshare_zh-cn.lex old mode 100644 new mode 100755 diff --git a/Targets/Nfsshare/nfsshare_zh-tw.lex b/Targets/Nfsshare/nfsshare_zh-tw.lex old mode 100644 new mode 100755 diff --git a/Targets/Nutups/Nutups-Custom.pm b/Targets/Nutups/Nutups-Custom.pm old mode 100644 new mode 100755 index 0606bc2..35038dc --- a/Targets/Nutups/Nutups-Custom.pm +++ b/Targets/Nutups/Nutups-Custom.pm @@ -191,12 +191,17 @@ sub get_model_options { return ['Error occurred']; } +<<<<<<< HEAD # Remove "/usr/sbin" from the front of each line +======= + # Remove "/usr/sbin/" from the front of each line +>>>>>>> 75aaf422042b2af06071fd64175eb15f6c4ae92b s{^/usr/sbin/}{} for @output; # Trim whitespace from each element and return the array chomp(@output); # Remove newline characters from each line return @output; # Return the array of modified output lines +<<<<<<< HEAD } sub get_ups_details { @@ -230,5 +235,7 @@ sub get_ups_details { } return $formatted_output; +======= +>>>>>>> 75aaf422042b2af06071fd64175eb15f6c4ae92b } -1; \ No newline at end of file +1; diff --git a/Targets/Nutups/Nutups.pm b/Targets/Nutups/Nutups.pm old mode 100644 new mode 100755 diff --git a/Targets/Nutups/_nut_CONFIG.html.ep b/Targets/Nutups/_nut_CONFIG.html.ep old mode 100644 new mode 100755 index 446a6df..a080655 --- a/Targets/Nutups/_nut_CONFIG.html.ep +++ b/Targets/Nutups/_nut_CONFIG.html.ep @@ -137,4 +137,4 @@ %# Probably finally by a submit. %end - \ No newline at end of file + diff --git a/Targets/Nutups/_nut_STATUS.html.ep b/Targets/Nutups/_nut_STATUS.html.ep old mode 100644 new mode 100755 index e03c415..e8ea7aa --- a/Targets/Nutups/_nut_STATUS.html.ep +++ b/Targets/Nutups/_nut_STATUS.html.ep @@ -7,7 +7,7 @@ SelectInput(); }; - % if ($config->{debug} == 1) { + % if (config->{debug} == 1) {
 			%= dumper $nut_data
 		
@@ -45,4 +45,4 @@ %# Probably finally by a submit. %end - \ No newline at end of file + diff --git a/Targets/Nutups/nutups.css b/Targets/Nutups/nutups.css old mode 100644 new mode 100755 diff --git a/Targets/Nutups/nutups.html.ep b/Targets/Nutups/nutups.html.ep old mode 100644 new mode 100755 index e4e3871..e15eade --- a/Targets/Nutups/nutups.html.ep +++ b/Targets/Nutups/nutups.html.ep @@ -8,7 +8,7 @@ %= javascript '/js/nutups.js'
- % if ($config->{debug} == 1) { + % if (config->{debug} == 1) {
 		%= dumper $c->current_route
 		%= dumper $nut_data->{trt}
@@ -55,4 +55,4 @@
 
 
 
-%end \ No newline at end of file +%end diff --git a/Targets/Nutups/nutups.js b/Targets/Nutups/nutups.js old mode 100644 new mode 100755 diff --git a/Targets/Nutups/nutups_en.lex b/Targets/Nutups/nutups_en.lex old mode 100644 new mode 100755 diff --git a/Targets/Nutups/spec.nutUPS b/Targets/Nutups/spec.nutUPS new file mode 100755 index 0000000..e103f91 --- /dev/null +++ b/Targets/Nutups/spec.nutUPS @@ -0,0 +1,27 @@ +main page = status +config page: +-nut status : enable/disabled + + nut mode : standalone|netserver|netclient + if netclient mode + +ask for SlaveUPS "UPSNAME@IP" and SlavePass "" +set Master as no when saving + + if standalone or netserver + +either use default value for NUT device, or allow to set them +${nut-driver@UPS }{Model} usbhid-ups you can use a drop-down listing all the device rpm -ql nut|grep /usr/sbin +${nut-driver@UPS }{Device} auto +only if Model genericups: +${nut-driver@UPS }{Type} +${nut-driver@UPS }{mfr} +${nut-driver@UPS }{mdl} +on saving set nut{Master} to yes if mode standalone or netserver +if mode=netserver set nut{access} to private otherwise set as localhost +run signal-event nut-conf + +if enabled the status page could return upsc UPS@localhost, or if slave upsc UPSNAME@IP +if netclient set nut-monitor status to enabled and set status disabled to nut-server and all existing nut-driver@* ( we can set multiple via cli, so a loop would be great there) +if standalone|netserver then enable all nut related service if nut enabled +if nut disabled then set all related services to disabled diff --git a/Templates/controller.pm.tem b/Templates/controller.pm.tem index 5505e06..68bcd1f 100644 --- a/Templates/controller.pm.tem +++ b/Templates/controller.pm.tem @@ -42,7 +42,11 @@ use esmith::NetworksDB; use esmith::HostsDB; use esmith::DomainsDB; - +my $cdb +my $adb +my $ndb +my $hdb +my $ddb require '/usr/share/smanager/lib/SrvMngr/Controller/${PackageName}-Custom.pm'; #The code that is to be added by the developer @@ -62,11 +66,11 @@ sub main { $c->app->log->info( $c->log_req ); #The most common ones - my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); - my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); + $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my %${prefix}_data = (); my $title = $c->l('${prefix}_${MenuDescription}'); @@ -116,11 +120,11 @@ sub do_update { my $modul = ''; #The most common ones - you might want to comment out any not used. - my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); - my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); + $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my %${prefix}_data = (); my $title = $c->l('${prefix}_${MenuDescription}'); @@ -200,11 +204,11 @@ sub do_display { $c->app->log->info($c->log_req); #The most common ones - you might want to comment out any not used. - my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); - my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); + $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my %${prefix}_data = (); my $title = $c->l('${prefix}_${MenuDescription}'); diff --git a/Templates/custom.pm.tem b/Templates/custom.pm.tem index 61df817..52be2d7 100644 --- a/Templates/custom.pm.tem +++ b/Templates/custom.pm.tem @@ -18,11 +18,11 @@ use constant TRUE => 1; #The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); +#my $cdb +#my $adb +#my $ndb +#my $hdb +#my $ddb # Validation routines - parameters for each panel diff --git a/Templates/html_controls.html.ep.xml b/Templates/html_controls.html.ep.xml old mode 100644 new mode 100755 diff --git a/Templates/languages.json b/Templates/languages.json old mode 100644 new mode 100755 diff --git a/Templates/layout.html.ep.tem b/Templates/layout.html.ep.tem index 99ca07b..f73c3e3 100644 --- a/Templates/layout.html.ep.tem +++ b/Templates/layout.html.ep.tem @@ -28,16 +28,16 @@ %} elsif ($c->stash('success')) {
-

<%=$c->l('Status Report') %>

- %= $c->l($c->stash('success')); +

+ %= $c->l($c->stash('success'));


%} elsif ($c->stash('error')) {
-

<%=$c->l('Error Status Report') %>

- %= $c->l($c->stash('error')); +

+ %= $c->l($c->stash('error'));


diff --git a/Templates/partial.html.ep.tem b/Templates/partial.html.ep.tem old mode 100644 new mode 100755 diff --git a/activate-python-env b/activate-python-env old mode 100644 new mode 100755 diff --git a/copySM2.sh b/copySM2.sh index e0d949b..ebb1e31 100755 --- a/copySM2.sh +++ b/copySM2.sh @@ -5,7 +5,10 @@ if [ $# -ne 3 ]; then exit 1 fi export REMOTE=/home/brianr/$1/usr/share/smanager -cd ~/clients/SM2/SM2Gen/venv/Targets/$3 +mkdir -p $REMOTE +export LOCAL=~/clients/SM2/SM2Gen/venv +export SME11IP=$1.thereadclan.me.uk +cd $LOCAL/Targets/$3 echo `pwd` # controller file name is just capitalised cont_file=$(echo "$3" | awk '{ @@ -21,16 +24,17 @@ echo $cont_file #fi mkdir -p $REMOTE/lib/SrvMngr/Controller mkdir -p $REMOTE/themes/default/templates/partials/ -mkdir -p $REMOTE/lib/SrvMngr/I18N/Modules/Nfsshare -mkdir -p $REMOTE/themes/default/templates/ +mkdir -p $REMOTE/themes/default/public/css +mkdir -p $REMOTE/themes/default/public/js cp -fv *.pm $REMOTE/lib/SrvMngr/Controller cp -fv *.css $REMOTE/themes/default/public/css +cp -fv *.js $REMOTE/themes/default/public/js cp -fv _$2*.html.ep $REMOTE/themes/default/templates/partials/ find . -maxdepth 1 -type f -name "[!_]*\.ep" | xargs -I% bash -c 'cp -fv % $REMOTE/themes/default/templates/' mkdir -p $REMOTE/lib/SrvMngr/I18N/Modules/$3 cp -fv *.lex $REMOTE/lib/SrvMngr/I18N/Modules/$3 rm -f $REMOTE/lib/SrvMngr/I18N/Modules/$3/*.pm -ssh -p 1234 root@$1.thereadclan.me.uk 'signal-event smanager-refresh' +ssh -p 1234 root@$SME11IP 'signal-event smanager-refresh' exit 0 diff --git a/getmyip b/getmyip deleted file mode 100755 index fc9b5ef..0000000 --- a/getmyip +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# List of services to query for the public IP -services=( - "ifconfig.me" - "ipinfo.io/ip" - "icanhazip.com" - "api.ipify.org" - "ident.me" - "ip.tyk.nu" - "checkip.amazonaws.com" - "ipecho.net/plain" - "myip.dnsomatic.com" - "ip.seeip.org" - "ipapi.co/ip" - "wtfismyip.com/text" - "openident.net/ip" - "ifconfig.co/ip" -) - -# Function to shuffle the array of services -shuffle_services() { - local i - for ((i=${#services[@]} - 1; i > 0; i--)); do - local j=$((RANDOM % (i + 1))) - local temp="${services[i]}" - services[i]="${services[j]}" - services[j]="$temp" - done -} - -# Function to fetch the public IP address -get_public_ip() { - shuffle_services - for service in "${services[@]}"; do - public_ip=$(curl -s --max-time 5 "$service") - - # Check if the curl request was successful and there's a valid IP address - if [[ $? -eq 0 && $public_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - logger -t public_ip_script "Service used: $service, IP found: $public_ip" - echo "$public_ip" - return - fi - done - - # If none of the services returned a valid IP, output an error message - echo "Failed to retrieve public IP using all services." >&2 - logger -t public_ip_script "Error: Failed to retrieve public IP using all services." - exit 1 -} - -# Execute the function -get_public_ip - diff --git a/html/CreateStarterWebsite.html b/html/CreateStarterWebsite.html old mode 100644 new mode 100755 diff --git a/html/DiskUsage.html b/html/DiskUsage.html old mode 100644 new mode 100755 diff --git a/html/Diskusage.html b/html/Diskusage.html old mode 100644 new mode 100755 diff --git a/html/letsencrypt-config.html b/html/letsencrypt-config.html old mode 100644 new mode 100755 diff --git a/html/letsencrypt-list-1.html b/html/letsencrypt-list-1.html old mode 100644 new mode 100755 diff --git a/html/letsencrypt-list.html b/html/letsencrypt-list.html old mode 100644 new mode 100755 diff --git a/include/site/python3.12/igraph/igraphmodule_api.h b/include/site/python3.12/igraph/igraphmodule_api.h new file mode 100644 index 0000000..8ab364b --- /dev/null +++ b/include/site/python3.12/igraph/igraphmodule_api.h @@ -0,0 +1,69 @@ +/* -*- mode: C -*- */ +/* vim:set ts=2 sw=2 sts=2 et: */ +/* + IGraph library. + Copyright (C) 2006-2023 Tamas Nepusz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA + +*/ + +#ifndef Py_IGRAPHMODULE_H +#define Py_IGRAPHMODULE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* C API functions */ +#define PyIGraph_FromCGraph_NUM 0 +#define PyIGraph_FromCGraph_RETURN PyObject* +#define PyIGraph_FromCGraph_PROTO (igraph_t *graph) + +#define PyIGraph_ToCGraph_NUM 1 +#define PyIGraph_ToCGraph_RETURN igraph_t* +#define PyIGraph_ToCGraph_PROTO (PyObject *graph) + +/* Total number of C API pointers */ +#define PyIGraph_API_pointers 2 + +#ifdef IGRAPH_MODULE + /* This section is used when compiling igraphmodule.c */ + static PyIGraph_FromCGraph_RETURN PyIGraph_FromCGraph PyIGraph_FromCGraph_PROTO; + static PyIGraph_ToCGraph_RETURN PyIGraph_ToCGraph PyIGraph_ToCGraph_PROTO; +#else + /* This section is used in modules that use igraph's API */ + static void** PyIGraph_API; +# define PyIGraph_FromCGraph \ + (*(PyIGraph_FromCGraph_RETURN (*)PyIGraph_FromCGraph_PROTO) \ + PyIGraph_API[PyIGraph_FromCGraph_NUM]) +# define PyIGraph_ToCGraph \ + (*(PyIGraph_ToCGraph_RETURN (*)PyIGraph_ToCGraph_PROTO) \ + PyIGraph_API[PyIGraph_ToCGraph_NUM]) + + /* Return -1 and set exception on error, 0 on success */ + static int import_igraph(void) { + PyIGraph_API = (void **)PyCapsule_Import("igraph._igraph._C_API", 0); + return (PyIGraph_API != NULL) ? 0 : -1; + } + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !defined(Py_IGRAPHMODULE_H) */ diff --git a/json5/CreateStarterWebsite.json5 b/json5/CreateStarterWebsite.json5 old mode 100644 new mode 100755 diff --git a/json5/DiskUsage.json5 b/json5/DiskUsage.json5 old mode 100644 new mode 100755 diff --git a/json5/Diskusage.json5 b/json5/Diskusage.json5 old mode 100644 new mode 100755 diff --git a/json5/Letsencrypt-config.json5 b/json5/Letsencrypt-config.json5 old mode 100644 new mode 100755 diff --git a/json5/Letsencrypt-list.json5 b/json5/Letsencrypt-list.json5 old mode 100644 new mode 100755 diff --git a/json5/Letsencrypt.json5 b/json5/Letsencrypt.json5 old mode 100644 new mode 100755 diff --git a/json5/Nfsshare.json5 b/json5/Nfsshare.json5 old mode 100644 new mode 100755 diff --git a/json5/Nutups.json5 b/json5/Nutups.json5 old mode 100644 new mode 100755 diff --git a/json5/letsencrypt-list-1.json5 b/json5/letsencrypt-list-1.json5 old mode 100644 new mode 100755 diff --git a/sent_bugs.db b/sent_bugs.db deleted file mode 100644 index cb1ea5f..0000000 Binary files a/sent_bugs.db and /dev/null differ diff --git a/sm1-html-2-json5.py b/sm1-html-2-json5.py old mode 100644 new mode 100755 diff --git a/sm2gen.py b/sm2gen.py old mode 100644 new mode 100755