-
Notifications
You must be signed in to change notification settings - Fork 0
/
TemplateFrontEnd.pm
69 lines (48 loc) · 1.15 KB
/
TemplateFrontEnd.pm
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
package eTrevolution::TemplateFrontEnd;
use strict;
use vars qw( $core );
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Const -compile => qw(OK);
use eTrevolution::eThreads::Core;
sub child_init {
my ($child_pool,$s) = @_;
$core = new eTrevolution::eThreads::Core;
return Apache::OK;
}
sub handler {
my $r = shift;
$core = new eTrevolution::eThreads::Core if (!$core);
my $inst = $core->load_instance_objects;
$inst->{gholders}->register(
['template', sub { return &handle_template($inst,@_); }]
);
$r->content_type("text/html");
my $content;
$inst->{gholders}->handle_template_tree(
$inst->{template}->get_tree,
$content
);
$r->print($content);
$r->connection->notes->set(
'container/id' => $inst->{container}{id}
);
$r->connection->notes->set(
'container/name' => $inst->{container}{name}
);
$inst->DESTROY;
return Apache::OK;
}
sub handle_template {
my $inst = shift;
my $i = shift;
my $tmplt = $inst->new_object("Template",$i->args->{DEFAULT});
if ($tmplt->load_from_sub($inst)) {
return $inst->{gholders}->handle_template_tree(
$tmplt->get_tree,$_[0]
);
} else {
return undef;
}
}
1;