![]() |
![]() |
3 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package My::MyApp;
use strict;
use warnings;
use base 'CGI::Application';
use CGI::Application::Plugin::Session;
use CGI::Application::Plugin::Authentication;
use CGI::Application::Plugin::Redirect;
use CGI::Application::Plugin::Forward;
use CGI::Application::Plugin::DebugScreen;
use CGI::Application::Plugin::ValidateRM;
use CGI::Application::Plugin::ConfigAuto qw/cfg/;
use CGI::Application::Plugin::HtmlTidy;
use Data::Dumper qw/Dumper/;
$Data::Dumper::Sortkeys = 1;
sub setup {
my $self = shift;
$self->start_mode('mode1');
$self->mode_param('rm');
$self->run_modes(
'mode1' => 'do_stuff',
'protected' => 'geschuetzt',
);
$self->param('CMS' => $self->query->url(-full=>1,));
} # /setup
sub cgiapp_init {
my $self = shift;
# Set some defaults for DFV unless they already exist.
$self->param('dfv_defaults') ||
$self->param('dfv_defaults', {
missing_optional_valid => 1,
filters => 'trim',
msgs => {
any_errors => 'FehlerLoop',
prefix => 'Error_',
invalid => 'Ungültig',
missing => 'Fehlend:',
format => '<span class="dfv-errors">%s</span>',
},
});
$self->param('Grafik' => $self->cfg('Grafik'));
#$self->authen->config(
# DRIVER => [ 'Generic', { user1 => '123' } ],
#);
#$self->authen->protected_runmodes('protected');
##$self->authen->protected_runmodes(':all');
} # /cgiapp_init
sub do_stuff {
my $self = shift;
my $url = $self->param('CMS') . '/MyApp/protected';
my $ausg = qq~
<a href="$url">Linmk zu geschütztem Bereich</a>
~;
return $ausg;
} # /do_stuff
sub geschuetzt {
my $self = shift;
my $ausg = qq~
Willkommen im speziell geschützten Bereich.
~;
return $ausg;
} # /geschuetzt
sub cgiapp_postrun {
my $self = shift;
my $output_ref = shift;
# Sete den Rahmen um den Inhalt, der in den verschiedenen Runmodes erstellt wurde.
my $t = $self->load_tmpl('_hauptTemplate.tmpl', associate => $self);
$t->param('Seiteninhalt' => $$output_ref);
$$output_ref = $t->output();
$self->htmltidy_clean($output_ref);
} # /cgiapp_postrun
1;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package My::MyApp::Admin;
use base 'CGI::Application';
use CGI::Application::Plugin::ConfigAuto qw/cfg/;
use CGI::Application::Plugin::DBH (qw/dbh_config dbh/);
use CGI::Application::Plugin::Authentication;
use CGI::Application::Plugin::HtmlTidy;
sub cgiapp_init {
my $self = shift;
My::MyApp::Admin::->authen->config(
DRIVER => [ 'Generic', { user1 => '123' } ],
);
#$self->authen->protected_runmodes(':all');
My::MyApp::Admin::authen->protected_runmodes(':all');
} # /cgiapp_init
sub setup {
my $self = shift;
$self->start_mode('start');
$self->run_modes(
start => 'aufgabenbereich',
authentifikationsFormular => 'authentifikationsFormular',
logout => 'logout',
);
} # /setup
sub aufgabenbereich {
my $self = shift;
return "Mein Aufgabenbereich";
} # /authen_mode
sub authentifikationsFormular {
my $self = shift;
my $t = $self->load_tmpl('_admin_loginFormular.tmpl');
$t->param("CMS" => $self->query->url(-full => 1,));
return $t->output();
return "Formular zum einloggen";
} # /authentifikationsFormular
sub logout {
my $self = shift;
return "logout formular";
} # /logout
sub cgiapp_postrun {
my $self = shift;
my $output_ref = shift;
# Sete den Rahmen um den Inhalt, der in den verschiedenen Runmodes erstellt wurde.
my $t = $self->load_tmpl('_admin_hauptTemplate.tmpl', associate => $self);
$t->param('Seiteninhalt' => $$output_ref);
$$output_ref = $t->output();
$self->htmltidy_clean($output_ref);
} # /cgiapp_postrun
1;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/Perl/bin/perl
use strict;
use warnings;
use FindBin qw($Bin);
use CGI::Carp qw/ fatalsToBrowser warningsToBrowser /;
use Data::Dumper qw/Dumper/;
use CGI::Application::Dispatch;
$Data::Dumper::Sortkeys = 1;
$ENV{CGI_APP_DEBUG} = 1;
CGI::Application::Dispatch->dispatch(
prefix => 'My',
default => 'MyApp',
args_to_new => {
TMPL_PATH => 'Templates/',
PARAMS => {
cfg_file => $Bin . '/Konfiguration/dispatchtest.pl',
htmltidy_config => { config_file => $Bin . '/Konfiguration/tidy.conf', },
},
},
);
![]() |
![]() |
3 Einträge, 1 Seite |