Line 163: |
Line 163: |
| === Navigation Menu and Routing Tables === | | === Navigation Menu and Routing Tables === |
| Here is the heading for "untested" skeleton for the controller file.:<syntaxhighlight lang="perl"> | | Here is the heading for "untested" skeleton for the controller file.:<syntaxhighlight lang="perl"> |
− | #!/usr/bin/perl -wU
| + | package SrvMngr::Controller::Dhcpman; |
− | | |
| #---------------------------------------------------------------------- | | #---------------------------------------------------------------------- |
| # heading : Configuration | | # heading : Configuration |
Line 174: |
Line 173: |
| # name : dhcpman2, method : get, url : /dhcpman2, ctlact : Dhcpman#do_winpopup | | # name : dhcpman2, method : get, url : /dhcpman2, ctlact : Dhcpman#do_winpopup |
| # name : dhcpman3, method : get, url : /dhcpman3, ctlact : Dhcpman#do_scan | | # name : dhcpman3, method : get, url : /dhcpman3, ctlact : Dhcpman#do_scan |
− | # name : dhcpman4, method : get, url : /dhcpman4, ctlact : Dhcpman#do_delete_lease | + | # name : dhcpman4, method : get, url : /dhcpman4, ctlact : Dhcpman#do_delete_all_leases |
| # name : dhcpman5, method : get, url : /dhcpman5, ctlact : Dhcpman#do_update_config | | # name : dhcpman5, method : get, url : /dhcpman5, ctlact : Dhcpman#do_update_config |
| + | # name : dhcpman6, method : get, url : /dhcpman6, ctlact : Dhcpman#do_delete_one_lease |
| + | # name : dhcpman7, method : get, url : /dhcpman7, ctlact : Dhcpman#do_refresh_leases |
| + | # name : dhcpman8, method : get, url : /dhcpman8, ctlact : Dhcpman#winpopup |
| # | | # |
| # routes : end | | # routes : end |
Line 220: |
Line 222: |
| # | | # |
| my $c = shift; | | my $c = shift; |
| + | die("hello world"); |
| $dhcp_data{"first"} = 'dhcp_DESCRIPTION'; | | $dhcp_data{"first"} = 'dhcp_DESCRIPTION'; |
| do_display( $c, %dhcp_data ); | | do_display( $c, %dhcp_data ); |
Line 229: |
Line 232: |
| # | | # |
| my $c = shift; | | my $c = shift; |
| + | $c->app->log->info( $c->log_req ); |
| my $title = $c->l("dhcp_DHCPD_SETTINGS_TITLE"); | | my $title = $c->l("dhcp_DHCPD_SETTINGS_TITLE"); |
| my $modul = ''; | | my $modul = ''; |
Line 237: |
Line 241: |
| $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data ); | | $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data ); |
| $c->render( template => 'dhcpman' ); | | $c->render( template => 'dhcpman' ); |
| + | } |
| + | |
| | | |
| sub do_leases { | | sub do_leases { |
Line 297: |
Line 303: |
| my $ret = update_config($c); | | my $ret = update_config($c); |
| if ($ret == 'ok') { | | if ($ret == 'ok') { |
− | dhcp_data{"success"}=dhcp_CONFIG_SAVED_OK | + | dhcp_data{"success"}=dhcp_CONFIG_SAVED_OK; |
− | do_display($c) | + | do_leases($c); |
− | else dhcp_data{"error"}=$ret | + | } |
− | return | + | else {dhcp_data{"error"}=$ret;} |
| + | return ; |
| } | | } |
| | | |
Line 311: |
Line 318: |
| my $ret = delete_all_leases($c); | | my $ret = delete_all_leases($c); |
| if ($ret == 'ok') { | | if ($ret == 'ok') { |
− | dhcp_data{"success"}=dhcp_CONFIG_SAVED_OK | + | dhcp_data{"success"}=dhcp_CONFIG_SAVED_OK; |
− | do_leases($c) | + | do_leases($c); |
− | else dhcp_data{"error"}=$ret | + | } |
− | return | + | else {dhcp_data{"error"}=$ret;} |
| + | return ; |
| } | | } |
| | | |
Line 330: |
Line 338: |
| my $ret = delete_lease($c); | | my $ret = delete_lease($c); |
| if ($ret == 'ok') { | | if ($ret == 'ok') { |
− | dhcp_data{"sucess"}=dhcp_CONFIG_SAVED_OK | + | dhcp_data{"success"}=dhcp_CONFIG_SAVED_OK; |
− | do_leases($c) | + | do_leases($c); |
− | else dhcp_data{"error"}=$ret | + | } |
− | return | + | else {dhcp_data{"error"}=$ret;} |
| + | return ; |
| } | | } |
| | | |
Line 367: |
Line 376: |
| return "ok"; | | return "ok"; |
| } | | } |
| + | |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |