line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
XAO::DO::Web::Header - Simple HTML header |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Currently is only useful in XAO::Web site context. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Simple HTML header object. Accepts the following arguments, modifies |
12
|
|
|
|
|
|
|
them as appropriate and displays "/bits/page-header" template passing the |
13
|
|
|
|
|
|
|
rest of arguments unmodified. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=over |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=item title => 'Page title' |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Passed as is. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=item description => 'Page description for search engines' |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This is converted to |
24
|
|
|
|
|
|
|
. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=item keywords => 'Page keywords for search engines' |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This is converted to |
29
|
|
|
|
|
|
|
. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item path => '/bits/alternative-template-path' |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Header template path, default is "/bits/page-header". |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item type => 'text/csv' |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Allows you to set page type to something different then default |
38
|
|
|
|
|
|
|
"text/html". If you set type the template would not be displayed! If you |
39
|
|
|
|
|
|
|
still need it - call Header again without "type" argument. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Setting type to anything other than text/... switches the output to byte |
42
|
|
|
|
|
|
|
mode, the same as calling $config->force_byte_output(1). It also removes |
43
|
|
|
|
|
|
|
the "charset" extention on the Content-Type header. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=back |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Would pass the folowing arguments to the template: |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item META |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Keywords and description combined. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item TITLE |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The value of 'title' argument above. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=back |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Example: |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
<%Header title="Site Search" keywords="super, duper, hyper, commerce"%> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
No publicly available methods except overriden display(). |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 EXPORTS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Nothing. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Copyright (c) 2005 Andrew Maltsev |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Copyright (c) 2001-2004 Andrew Maltsev, XAO Inc. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
-- http://ejelta.com/xao/ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SEE ALSO |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Recommended reading: |
84
|
|
|
|
|
|
|
L, |
85
|
|
|
|
|
|
|
L. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
############################################################################### |
90
|
|
|
|
|
|
|
package XAO::DO::Web::Header; |
91
|
3
|
|
|
3
|
|
2251
|
use strict; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
100
|
|
92
|
3
|
|
|
3
|
|
23
|
use XAO::Utils qw(:args :debug :html); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
698
|
|
93
|
3
|
|
|
3
|
|
19
|
use XAO::Objects; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
98
|
|
94
|
3
|
|
|
3
|
|
19
|
use base XAO::Objects->load(objname => 'Web::Page'); |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
19
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
our $VERSION='2.004'; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
############################################################################### |
99
|
|
|
|
|
|
|
# Displaying HTML header. |
100
|
|
|
|
|
|
|
# |
101
|
|
|
|
|
|
|
sub display ($;%) { |
102
|
12
|
|
|
12
|
1
|
25
|
my $self=shift; |
103
|
12
|
|
|
|
|
34
|
my $args=get_args(\@_); |
104
|
|
|
|
|
|
|
|
105
|
12
|
50
|
|
|
|
103
|
if(my $content_type=$args->{'type'}) { |
106
|
12
|
|
|
|
|
44
|
$self->siteconfig->header_args(-type => $content_type); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# For older code compatibility, whenever the page content type is |
109
|
|
|
|
|
|
|
# switched away from text/* the default output is in bytes, not |
110
|
|
|
|
|
|
|
# characters. |
111
|
|
|
|
|
|
|
# |
112
|
12
|
100
|
|
|
|
41
|
if($content_type !~ /^text\//) { |
113
|
8
|
|
|
|
|
20
|
$self->siteconfig->force_byte_output(1); |
114
|
8
|
|
|
|
|
21
|
$self->siteconfig->header_args(-charset => ''); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
12
|
|
|
|
|
28
|
return; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
0
|
0
|
|
|
|
|
if($args->{'http.name'}) { |
121
|
|
|
|
|
|
|
$self->siteconfig->header_args( |
122
|
0
|
|
0
|
|
|
|
$args->{'http.name'} => $args->{'http.value'} || '' |
123
|
|
|
|
|
|
|
); |
124
|
0
|
|
|
|
|
|
return; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my $meta=''; |
128
|
|
|
|
|
|
|
$meta.=qq(\n) |
129
|
0
|
0
|
|
|
|
|
if $args->{'keywords'}; |
130
|
|
|
|
|
|
|
$meta.=qq(\n) |
131
|
0
|
0
|
|
|
|
|
if $args->{'description'}; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
0
|
|
|
|
my $title=$args->{'title'} || |
134
|
|
|
|
|
|
|
$self->siteconfig->get('default_title') || |
135
|
|
|
|
|
|
|
"XAO::Web -- No Title"; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
$self->object->display($args,{ |
138
|
|
|
|
|
|
|
path => $args->{'path'} || "/bits/page-header", |
139
|
|
|
|
|
|
|
TITLE => $title, |
140
|
|
|
|
|
|
|
GIVEN_TITLE => $args->{'title'} || '', |
141
|
|
|
|
|
|
|
META => $meta, |
142
|
|
|
|
|
|
|
KEYWORDS => $args->{'keywords'}, |
143
|
0
|
|
0
|
|
|
|
DESCRIPTION => $args->{'description'}, |
|
|
|
0
|
|
|
|
|
144
|
|
|
|
|
|
|
}); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
############################################################################### |
148
|
|
|
|
|
|
|
1; |