line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Toader::Render::General; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
24437
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
89
|
|
4
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
87
|
|
5
|
3
|
|
|
3
|
|
21
|
use base 'Error::Helper'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1116
|
|
6
|
3
|
|
|
3
|
|
2617
|
use Toader::Templates; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
85
|
|
7
|
3
|
|
|
3
|
|
1670
|
use Toader::Entry::Helper; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
80
|
|
8
|
3
|
|
|
3
|
|
22
|
use Toader::Entry::Manage; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
75
|
|
9
|
3
|
|
|
3
|
|
1757
|
use Toader::Page::Helper; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
81
|
|
10
|
3
|
|
|
3
|
|
22
|
use Toader::Page::Manage; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
109
|
|
11
|
3
|
|
|
3
|
|
1861
|
use Toader::Render::CSS; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
83
|
|
12
|
3
|
|
|
3
|
|
1741
|
use Toader::Render::Entry; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
112
|
|
13
|
3
|
|
|
3
|
|
1749
|
use Toader::Render::supportedObjects; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
69
|
|
14
|
3
|
|
|
3
|
|
20
|
use Toader::pathHelper; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
60
|
|
15
|
3
|
|
|
3
|
|
1833
|
use Toader::Gallery; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
102
|
|
16
|
3
|
|
|
3
|
|
32
|
use File::Spec; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
69
|
|
17
|
3
|
|
|
3
|
|
1914
|
use Toader::Directory; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
69
|
|
18
|
3
|
|
|
3
|
|
23
|
use Email::Address; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
59
|
|
19
|
3
|
|
|
3
|
|
1568
|
use Toader::AutoDoc; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
97
|
|
20
|
3
|
|
|
3
|
|
6503
|
use Image::ExifTool; |
|
3
|
|
|
|
|
169101
|
|
|
3
|
|
|
|
|
325
|
|
21
|
3
|
|
|
3
|
|
41
|
use Script::isAperlScript; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
51266
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Toader::Render::General - Renders various general stuff for Toader as well as some other stuff. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 VERSION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Version 0.5.0 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our $VERSION = '0.5.0'; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This initiates the object. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head3 args hash ref |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head4 toader |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This is the L object. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head4 obj |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This is the L object being worked with. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head4 toDir |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This is the path to use for getting back down to the directory. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Lets say we have rendered a single entry to it's page, then it would |
56
|
|
|
|
|
|
|
be "../../", were as if we rendered a page of multiple entries it |
57
|
|
|
|
|
|
|
would be "../". |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The default is "../../". |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This is set to '' if fullURL is set to true. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head4 fullURL |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This is if it should make a non-relative link for when generating links. If set to 1, |
66
|
|
|
|
|
|
|
it makes links non-relative. If not defined/false it uses relative links. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head4 dir |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is the directory that it is currently in. This can differ from the object directory |
71
|
|
|
|
|
|
|
and if not defined will be set to the object directory, which is found via $args{obj}->dirGet. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $g=Toader::Render::General->new(\%args); |
74
|
|
|
|
|
|
|
if($g->error){ |
75
|
|
|
|
|
|
|
warn('error: '.$g->error.":".$g->errorString); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub new{ |
81
|
0
|
|
|
0
|
1
|
|
my %args; |
82
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
83
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
0
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
}; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $self={ |
87
|
|
|
|
|
|
|
error=>undef, |
88
|
|
|
|
|
|
|
errorString=>'', |
89
|
|
|
|
|
|
|
perror=>undef, |
90
|
|
|
|
|
|
|
isatd=>Toader::isaToaderDir->new, |
91
|
|
|
|
|
|
|
soc=>Toader::Render::supportedObjects->new, |
92
|
|
|
|
|
|
|
toDir=>'../../', |
93
|
|
|
|
|
|
|
fullURL=>0, |
94
|
|
|
|
|
|
|
locationSub=>'', |
95
|
|
|
|
|
|
|
errorExtra=>{ |
96
|
|
|
|
|
|
|
flags=>{ |
97
|
|
|
|
|
|
|
1=>'noToaderObj', |
98
|
|
|
|
|
|
|
2=>'notAtoaderObj', |
99
|
|
|
|
|
|
|
3=>'toaderPerror', |
100
|
|
|
|
|
|
|
4=>'noRenderableObj', |
101
|
|
|
|
|
|
|
5=>'notArenderableObj', |
102
|
|
|
|
|
|
|
6=>'objPerror', |
103
|
|
|
|
|
|
|
7=>'noDirSet', |
104
|
|
|
|
|
|
|
8=>'noLinkDefined', |
105
|
|
|
|
|
|
|
9=>'templateFetchErrored', |
106
|
|
|
|
|
|
|
11=>'noToaderdirSpecified', |
107
|
|
|
|
|
|
|
12=>'notAtoaderDir', |
108
|
|
|
|
|
|
|
13=>'noEntryIDspecified', |
109
|
|
|
|
|
|
|
14=>'entryDoesNotExist', |
110
|
|
|
|
|
|
|
15=>'noPageSpecified', |
111
|
|
|
|
|
|
|
16=>'pageDoesNotExist', |
112
|
|
|
|
|
|
|
17=>'noFileSpecified', |
113
|
|
|
|
|
|
|
18=>'templateInitErrored', |
114
|
|
|
|
|
|
|
19=>'r2rErrored', |
115
|
|
|
|
|
|
|
20=>'b2rErrored', |
116
|
|
|
|
|
|
|
21=>'pathhelperInitErrored', |
117
|
|
|
|
|
|
|
22=>'subToaderDirListErrored', |
118
|
|
|
|
|
|
|
23=>'pageManageDirSetErrored', |
119
|
|
|
|
|
|
|
24=>'listPagesErrored', |
120
|
|
|
|
|
|
|
25=>'entryManageErrored', |
121
|
|
|
|
|
|
|
26=>'readEntryErrored', |
122
|
|
|
|
|
|
|
27=>'renderEntryInitErrored', |
123
|
|
|
|
|
|
|
28=>'renderEntryErrored', |
124
|
|
|
|
|
|
|
29=>'noAuthorsLineSpecified', |
125
|
|
|
|
|
|
|
30=>'authorsLineParseFailed', |
126
|
|
|
|
|
|
|
31=>'entryManageDirSetErrored', |
127
|
|
|
|
|
|
|
32=>'pageListErrored', |
128
|
|
|
|
|
|
|
33=>'pageReadErrored', |
129
|
|
|
|
|
|
|
34=>'autoDocFileDotDotError', |
130
|
|
|
|
|
|
|
35=>'noURLinConfig', |
131
|
|
|
|
|
|
|
36=>'noImageURLspecified', |
132
|
|
|
|
|
|
|
37=>'noImageFileSpecified', |
133
|
|
|
|
|
|
|
38=>'imageDoesNotExist', |
134
|
|
|
|
|
|
|
39=>'pathCleanupErrored', |
135
|
|
|
|
|
|
|
40=>'galleryInitErrored', |
136
|
|
|
|
|
|
|
41=>'outputURLnotSpecified', |
137
|
|
|
|
|
|
|
42=>'noSrcPathSpecified', |
138
|
|
|
|
|
|
|
43=>'noURLspecified', |
139
|
|
|
|
|
|
|
44=>'relativeDirContainsAperiod', |
140
|
|
|
|
|
|
|
45=>'noSrcURLspecified', |
141
|
|
|
|
|
|
|
}, |
142
|
|
|
|
|
|
|
}, |
143
|
|
|
|
|
|
|
}; |
144
|
0
|
|
|
|
|
|
bless $self; |
145
|
|
|
|
|
|
|
|
146
|
0
|
0
|
|
|
|
|
if ( defined ( $args{toDir} ) ){ |
147
|
0
|
|
|
|
|
|
$self->{toDir}=$args{toDir}; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
0
|
0
|
|
|
|
|
if ( defined( $args{fullURL} ) ){ |
152
|
0
|
|
|
|
|
|
$self->{fullURL}=$args{fullURL}; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
#make sure we have a usable Toader object |
156
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{toader} ) ){ |
157
|
0
|
|
|
|
|
|
$self->{perror}=1; |
158
|
0
|
|
|
|
|
|
$self->{error}=1; |
159
|
0
|
|
|
|
|
|
$self->{errorString}='No Toader object defined'; |
160
|
0
|
|
|
|
|
|
$self->warn; |
161
|
0
|
|
|
|
|
|
return $self; |
162
|
|
|
|
|
|
|
} |
163
|
0
|
0
|
|
|
|
|
if ( ref( $args{toader} ) ne 'Toader' ){ |
164
|
0
|
|
|
|
|
|
$self->{perror}=1; |
165
|
0
|
|
|
|
|
|
$self->{error}=2; |
166
|
0
|
|
|
|
|
|
$self->{errorString}='The specified Toader object is actually a "'.ref( $args{ref} ).'"'; |
167
|
0
|
|
|
|
|
|
$self->warn; |
168
|
0
|
|
|
|
|
|
return $self; |
169
|
|
|
|
|
|
|
} |
170
|
0
|
0
|
|
|
|
|
if ( ! $args{toader}->errorblank ){ |
171
|
0
|
|
|
|
|
|
$self->{perror}=1; |
172
|
0
|
|
|
|
|
|
$self->{error}=3; |
173
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader object has a permanent error set'; |
174
|
0
|
|
|
|
|
|
$self->warn; |
175
|
0
|
|
|
|
|
|
return $self; |
176
|
|
|
|
|
|
|
} |
177
|
0
|
|
|
|
|
|
$self->{toader}=$args{toader}; |
178
|
0
|
|
|
|
|
|
$self->{ph}=$self->{toader}->getPathHelper; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
#make sure we have a usable object |
181
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{obj} ) ){ |
182
|
0
|
|
|
|
|
|
$self->{perror}=1; |
183
|
0
|
|
|
|
|
|
$self->{error}=4; |
184
|
0
|
|
|
|
|
|
$self->{errorString}='No object specified for the renderable object'; |
185
|
0
|
|
|
|
|
|
$self->warn; |
186
|
0
|
|
|
|
|
|
return $self; |
187
|
|
|
|
|
|
|
} |
188
|
0
|
0
|
|
|
|
|
if ( ! $self->{soc}->isSupported( $args{obj} ) ){ |
189
|
0
|
|
|
|
|
|
$self->{perror}=1; |
190
|
0
|
|
|
|
|
|
$self->{error}=5; |
191
|
0
|
|
|
|
|
|
$self->{errorString}='"'.ref( $args{obj} ).'" does not appear to be a Toader renderable object'; |
192
|
0
|
|
|
|
|
|
$self->warn; |
193
|
0
|
|
|
|
|
|
return $self; |
194
|
|
|
|
|
|
|
} |
195
|
0
|
0
|
|
|
|
|
if ( ! $args{obj}->errorblank ){ |
196
|
0
|
|
|
|
|
|
$self->{perror}=1; |
197
|
0
|
|
|
|
|
|
$self->{error}=6; |
198
|
0
|
|
|
|
|
|
$self->{errorString}='The specified renderable object has a permanent error set'; |
199
|
0
|
|
|
|
|
|
$self->warn; |
200
|
0
|
|
|
|
|
|
return $self; |
201
|
|
|
|
|
|
|
} |
202
|
0
|
|
|
|
|
|
$self->{obj}=$args{obj}; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
#make sure the renderable object has a directory set |
205
|
0
|
|
|
|
|
|
$self->{odir}=$self->{obj}->dirGet; |
206
|
0
|
0
|
|
|
|
|
if ( ! defined( $self->{odir} ) ){ |
207
|
0
|
|
|
|
|
|
$self->{perror}=1; |
208
|
0
|
|
|
|
|
|
$self->{error}=7; |
209
|
0
|
|
|
|
|
|
$self->{errorString}='The renderable object does not have a directory specified'; |
210
|
0
|
|
|
|
|
|
$self->warn; |
211
|
0
|
|
|
|
|
|
return $self; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
#initialize the Toader::pathHelper |
215
|
0
|
|
|
|
|
|
$self->{ph}=Toader::pathHelper->new( $self->{odir} ); |
216
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
217
|
0
|
|
|
|
|
|
$self->{perror}=1; |
218
|
0
|
|
|
|
|
|
$self->{error}=6; |
219
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initiate pathHelper. error="'. |
220
|
|
|
|
|
|
|
$self->{ph}->error.'" errorString="'.$self->{ph}->errorString.'"'; |
221
|
0
|
|
|
|
|
|
$self->warn; |
222
|
0
|
|
|
|
|
|
return $self; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
#cleans up the object directory path |
226
|
0
|
|
|
|
|
|
$self->{odir}=$self->{ph}->cleanup( $self->{odir} ); |
227
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
228
|
0
|
|
|
|
|
|
$self->{perror}=1; |
229
|
0
|
|
|
|
|
|
$self->{error}=39; |
230
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to clean up the path for "'.$self->{odir}.'"'; |
231
|
0
|
|
|
|
|
|
$self->warn; |
232
|
0
|
|
|
|
|
|
return undef; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
#get this once as it does not change and is likely to be used |
236
|
|
|
|
|
|
|
#gets the r2r for the object |
237
|
0
|
|
|
|
|
|
$self->{or2r}=$self->{ph}->relative2root( $self->{odir} ); |
238
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
239
|
0
|
|
|
|
|
|
$self->{perror}=1; |
240
|
0
|
|
|
|
|
|
$self->{error}=19; |
241
|
0
|
|
|
|
|
|
$self->{errorString}='pathHelper failed to find the relative2root path for "'. |
242
|
|
|
|
|
|
|
$self->{odir}.'"'; |
243
|
0
|
|
|
|
|
|
$self->warn; |
244
|
0
|
|
|
|
|
|
return $self; |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
#get the b2r for the object |
247
|
0
|
|
|
|
|
|
$self->{ob2r}=$self->{toDir}.'/'.$self->{ph}->back2root( $self->{odir} ); |
248
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
249
|
0
|
|
|
|
|
|
$self->{perror}=1; |
250
|
0
|
|
|
|
|
|
$self->{error}=20; |
251
|
0
|
|
|
|
|
|
$self->{errorString}='pathHelper failed to find the relative2root path for "'. |
252
|
|
|
|
|
|
|
$self->{odir}.'"'; |
253
|
0
|
|
|
|
|
|
$self->warn; |
254
|
0
|
|
|
|
|
|
return $self; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
#makes gets the directory to work in |
257
|
0
|
0
|
|
|
|
|
if ( defined( $args{dir} ) ){ |
258
|
0
|
|
|
|
|
|
$self->{dir}=$args{dir}; |
259
|
0
|
|
|
|
|
|
$self->{r2r}=$self->{ph}->relative2root( $self->{dir} ); |
260
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
261
|
0
|
|
|
|
|
|
$self->{perror}=1; |
262
|
0
|
|
|
|
|
|
$self->{error}=19; |
263
|
0
|
|
|
|
|
|
$self->{errorString}='pathHelper failed to find the relative2root path for "'. |
264
|
|
|
|
|
|
|
$self->{dir}.'"'; |
265
|
0
|
|
|
|
|
|
return $self; |
266
|
|
|
|
|
|
|
} |
267
|
0
|
|
|
|
|
|
$self->{b2r}=$self->{toDir}.'/'.$self->{toDir}.'/'.$self->{ph}->relative2root( $self->{dir} ); |
268
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
269
|
0
|
|
|
|
|
|
$self->{perror}=1; |
270
|
0
|
|
|
|
|
|
$self->{error}=20; |
271
|
0
|
|
|
|
|
|
$self->{errorString}='pathHelper failed to find the relative2root path for "'. |
272
|
|
|
|
|
|
|
$self->{dir}.'"'; |
273
|
0
|
|
|
|
|
|
return $self; |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
}else{ |
276
|
0
|
|
|
|
|
|
$self->{dir}=$self->{odir}; |
277
|
0
|
|
|
|
|
|
$self->{r2r}=$self->{or2r}; |
278
|
0
|
|
|
|
|
|
$self->{b2r}=$self->{ob2r}; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
#clean up the various paths |
282
|
0
|
|
|
|
|
|
$self->{dir}=File::Spec->canonpath( $self->{dir} ); |
283
|
0
|
|
|
|
|
|
$self->{r2r}=File::Spec->canonpath( $self->{r2r} ); |
284
|
0
|
|
|
|
|
|
$self->{b2r}=File::Spec->canonpath( $self->{b2r} ); |
285
|
0
|
|
|
|
|
|
$self->{or2r}=File::Spec->canonpath( $self->{or2r} ); |
286
|
0
|
|
|
|
|
|
$self->{ob2r}=File::Spec->canonpath( $self->{ob2r} ); |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
#gets the base URL |
289
|
0
|
|
|
|
|
|
my $c=$self->{toader}->getConfig; |
290
|
0
|
0
|
|
|
|
|
if ( defined( $c->{'_'}->{'url'} ) ){ |
291
|
0
|
|
|
|
|
|
$self->{url}=$c->{'_'}->{'url'}; |
292
|
|
|
|
|
|
|
} |
293
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
294
|
0
|
0
|
|
|
|
|
if ( ! defined( $c->{'_'}->{url} ) ){ |
295
|
0
|
|
|
|
|
|
$self->{perror}=1; |
296
|
0
|
|
|
|
|
|
$self->{error}=35; |
297
|
0
|
|
|
|
|
|
$self->{errorString}='No URL specified in the Toader config'; |
298
|
0
|
|
|
|
|
|
$self->warn; |
299
|
0
|
|
|
|
|
|
return $self; |
300
|
|
|
|
|
|
|
} |
301
|
0
|
|
|
|
|
|
$self->{toDir}=''; |
302
|
|
|
|
|
|
|
} |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
#figures out the file directory |
305
|
0
|
|
|
|
|
|
$self->{toFiles}=$self->{b2r}.'/'.$self->{or2r}.'/'.$self->{obj}->filesDir; |
306
|
0
|
|
|
|
|
|
$self->{toFiles}=File::Spec->canonpath( $self->{toFiles} ); |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
#initiates the Templates object |
309
|
0
|
|
|
|
|
|
$self->{t}=Toader::Templates->new({ |
310
|
|
|
|
|
|
|
dir=>$self->{dir}, |
311
|
|
|
|
|
|
|
toader=>$args{toader}, |
312
|
|
|
|
|
|
|
}); |
313
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
314
|
0
|
|
|
|
|
|
$self->{perror}=1; |
315
|
0
|
|
|
|
|
|
$self->{error}=18; |
316
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize the Toader::Templates module'; |
317
|
0
|
|
|
|
|
|
$self->warn; |
318
|
0
|
|
|
|
|
|
return $self; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
#checks if it is at the root or not |
322
|
0
|
|
|
|
|
|
$self->{atRoot}=$self->{ph}->atRoot( $self->{odir} ); |
323
|
|
|
|
|
|
|
|
324
|
0
|
|
|
|
|
|
return $self; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=head2 adlink |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
This generates a link to the the specified documentation file. |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
Three arguments are taken. The first is the relative directory to the |
332
|
|
|
|
|
|
|
Toader root in which it resides, which if left undefined is the same |
333
|
|
|
|
|
|
|
as the object used to initiate this object. The second is file found by |
334
|
|
|
|
|
|
|
autodoc. The third is the text for the link, which if left undefined is |
335
|
|
|
|
|
|
|
the same as the file. |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
If the text is left undefined and the file ends in ".html", the ".html" |
338
|
|
|
|
|
|
|
part is removed. |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
$g->cdlink( $directory, $file, $text ); |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
The template used for this is 'linkDirectory', which by default |
343
|
|
|
|
|
|
|
is as below. |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
[== $text ==] |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
The variables passed to it are as below. |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
url - This is the relative URL for this. |
350
|
|
|
|
|
|
|
text - This to use for with the link. |
351
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
352
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
353
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
354
|
|
|
|
|
|
|
self - The L object. |
355
|
|
|
|
|
|
|
toader - This is a L object. |
356
|
|
|
|
|
|
|
g - This is a L object. |
357
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=cut |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub adlink{ |
362
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
363
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
364
|
0
|
|
|
|
|
|
my $file=$_[2]; |
365
|
0
|
|
|
|
|
|
my $txt=$_[3]; |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
#blanks any previous errors |
368
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
369
|
0
|
|
|
|
|
|
return undef; |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
373
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
# make sure a file is specified |
377
|
0
|
0
|
|
|
|
|
if ( ! defined( $file ) ){ |
378
|
0
|
|
|
|
|
|
$self->{error}=17; |
379
|
0
|
|
|
|
|
|
$self->{errorString}='No file specified'; |
380
|
0
|
|
|
|
|
|
$self->warn; |
381
|
0
|
|
|
|
|
|
return undef; |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
#make sure it does not start with ../ |
385
|
0
|
0
|
|
|
|
|
if ( $file =~ /^\.\.\// ){ |
386
|
0
|
|
|
|
|
|
$self->{error}=34; |
387
|
0
|
|
|
|
|
|
$self->{errorString}='File matches /^..\//'; |
388
|
0
|
|
|
|
|
|
$self->warn; |
389
|
0
|
|
|
|
|
|
return undef; |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
0
|
|
|
|
|
|
my $checker=Script::isAperlScript->new({ |
393
|
|
|
|
|
|
|
any=>1, |
394
|
|
|
|
|
|
|
env=>1, |
395
|
|
|
|
|
|
|
}); |
396
|
|
|
|
|
|
|
#append .html for POD docs |
397
|
0
|
0
|
|
|
|
|
if ( $file =~ /\.[Pp][Oo][Dd]$/ ){ |
398
|
0
|
|
|
|
|
|
$file=$file.'.html'; |
399
|
|
|
|
|
|
|
} |
400
|
0
|
0
|
|
|
|
|
if ( $file =~ /\.[Pp][Mm]$/ ){ |
401
|
0
|
|
|
|
|
|
$file=$file.'.html'; |
402
|
|
|
|
|
|
|
} |
403
|
0
|
0
|
|
|
|
|
if ( $checker->isAperlScript( $self->{dir}.'/'.$file ) ){ |
404
|
0
|
|
|
|
|
|
$file=$file.'.html'; |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
|
407
|
0
|
0
|
|
|
|
|
if ( ! defined( $txt ) ){ |
408
|
0
|
|
|
|
|
|
$txt=$file; |
409
|
0
|
|
|
|
|
|
$txt=~s/\.html$//; |
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
|
412
|
0
|
|
|
|
|
|
my $link=''; |
413
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
414
|
0
|
|
|
|
|
|
$link=$dir.'/.autodoc/.files/'.$file; |
415
|
0
|
|
|
|
|
|
$link=~s/\/\/*/\//g; |
416
|
0
|
|
|
|
|
|
$link=$self->{url}.$link; |
417
|
|
|
|
|
|
|
}else{ |
418
|
0
|
|
|
|
|
|
$link=$self->{b2r}.'/'.$dir.'/.autodoc/.files/'.$file; |
419
|
0
|
|
|
|
|
|
$link=~s/\/\/*/\//g; |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
#renders the AutoDoc link |
423
|
0
|
|
|
|
|
|
my $adlink=$self->{t}->fill_in( |
424
|
|
|
|
|
|
|
'autodocLink', |
425
|
|
|
|
|
|
|
{ |
426
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
427
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
428
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
429
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
430
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
431
|
|
|
|
|
|
|
self=>\$self, |
432
|
|
|
|
|
|
|
g=>\$self, |
433
|
|
|
|
|
|
|
url=>$link, |
434
|
|
|
|
|
|
|
text=>$txt, |
435
|
|
|
|
|
|
|
} |
436
|
|
|
|
|
|
|
); |
437
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
438
|
0
|
|
|
|
|
|
$self->{error}=10; |
439
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
440
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
441
|
0
|
|
|
|
|
|
$self->warn; |
442
|
0
|
|
|
|
|
|
return undef; |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
|
445
|
0
|
|
|
|
|
|
return $adlink; |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=head2 adListLink |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
This returns a link to the documentation list. |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
The template used for this is 'linkAutoDocList', which by default |
453
|
|
|
|
|
|
|
is as below. |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
[== $text ==] |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
The variables passed to it are as below. |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
url - This is the relative URL for this. |
460
|
|
|
|
|
|
|
text - This to use for with the link. |
461
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
462
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
463
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
464
|
|
|
|
|
|
|
self - The L object. |
465
|
|
|
|
|
|
|
toader - This is a L object. |
466
|
|
|
|
|
|
|
g - This is a L object. |
467
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=cut |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
sub adListLink{ |
472
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
473
|
0
|
|
|
|
|
|
my $text=$_[1]; |
474
|
|
|
|
|
|
|
|
475
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
476
|
0
|
|
|
|
|
|
return undef; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
0
|
0
|
|
|
|
|
if (! defined( $text ) ){ |
480
|
0
|
|
|
|
|
|
$text='Documentation'; |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
|
483
|
0
|
|
|
|
|
|
my $link=''; |
484
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
485
|
0
|
|
|
|
|
|
$link=$self->{r2r}; |
486
|
0
|
|
|
|
|
|
$link=~s/\/\/*/\//g; |
487
|
0
|
|
|
|
|
|
$link=$self->{url}.$link; |
488
|
|
|
|
|
|
|
}else{ |
489
|
0
|
|
|
|
|
|
$link=$self->{b2r}.'/'.$self->{r2r}.'/.autodoc/'; |
490
|
0
|
|
|
|
|
|
$link=~s/\/\/*/\//g; |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
#renders the beginning of the authors links |
495
|
0
|
|
|
|
|
|
my $adllink=$self->{t}->fill_in( |
496
|
|
|
|
|
|
|
'linkAutoDocList', |
497
|
|
|
|
|
|
|
{ |
498
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
499
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
500
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
501
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
502
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
503
|
|
|
|
|
|
|
self=>\$self, |
504
|
|
|
|
|
|
|
g=>\$self, |
505
|
|
|
|
|
|
|
url=>$link, |
506
|
|
|
|
|
|
|
text=>$text, |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
); |
509
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
510
|
0
|
|
|
|
|
|
$self->{error}=10; |
511
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
512
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
513
|
0
|
|
|
|
|
|
$self->warn; |
514
|
0
|
|
|
|
|
|
return undef; |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
0
|
|
|
|
|
|
return $adllink; |
518
|
|
|
|
|
|
|
} |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=head2 atRoot |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
This returns a Perl boolean value for if the current directory |
523
|
|
|
|
|
|
|
is the root L directory or not. |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
my $atRoot=$g->atRoot; |
526
|
|
|
|
|
|
|
if ( $aRoot ){ |
527
|
|
|
|
|
|
|
print "At root.\n"; |
528
|
|
|
|
|
|
|
} |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=cut |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
sub atRoot{ |
533
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
534
|
|
|
|
|
|
|
|
535
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
536
|
0
|
|
|
|
|
|
return undef; |
537
|
|
|
|
|
|
|
} |
538
|
|
|
|
|
|
|
|
539
|
0
|
|
|
|
|
|
return $self->{atRoot}; |
540
|
|
|
|
|
|
|
} |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
=head2 authorsLink |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
Used for generating the author line. |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
This parses a From header, such as the value returned |
547
|
|
|
|
|
|
|
from Toader::Entry->fromGet. |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
One value is requied and that is what is to be parsed and |
550
|
|
|
|
|
|
|
returned as a link. |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
$g->authorsLink($entry->fromGet); |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
=head3 Templates |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=head4 authorBegin |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
This begins the authors link section. |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
The default template is blank. |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
The variables passed to it are as below. |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
565
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
566
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
567
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
568
|
|
|
|
|
|
|
toader - This is a L object. |
569
|
|
|
|
|
|
|
self - This the L object. |
570
|
|
|
|
|
|
|
g - This the L object. |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
=head4 authorLink |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
This is a link for one of the authors. |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
The default template is as below. |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
[== $name ==] |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
The variables passed to it are as below. |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
583
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
584
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
585
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
586
|
|
|
|
|
|
|
toader - This is a L object. |
587
|
|
|
|
|
|
|
self - This the L object. |
588
|
|
|
|
|
|
|
g - This the L object. |
589
|
|
|
|
|
|
|
address - The email address of the author. |
590
|
|
|
|
|
|
|
comment - The comment portion of it. |
591
|
|
|
|
|
|
|
original - The original form for this chunk. |
592
|
|
|
|
|
|
|
name - The name of the author. |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
=head4 authorJoin |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
This is used for joining multiple authors. |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
The default template is as below. |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
, |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
The variables passed to it are as below. |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
The variables passed to it are as below. |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
608
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
609
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
610
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
611
|
|
|
|
|
|
|
toader - This is a L object. |
612
|
|
|
|
|
|
|
self - This the L object. |
613
|
|
|
|
|
|
|
g - This the L object. |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
=head4 authorEnd |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
This ends the authors link section. |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
The default template is blank. |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
The variables passed to it are as below. |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
624
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
625
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
626
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
627
|
|
|
|
|
|
|
toader - This is a L object. |
628
|
|
|
|
|
|
|
self - This the L object. |
629
|
|
|
|
|
|
|
g - This the L object. |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=cut |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
sub authorsLink{ |
634
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
635
|
0
|
|
|
|
|
|
my $aline=$_[1]; |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
#blank any previous errors |
638
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
639
|
0
|
|
|
|
|
|
return undef; |
640
|
|
|
|
|
|
|
} |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
#make sure we have a authors line |
643
|
0
|
0
|
|
|
|
|
if ( ! defined( $aline ) ){ |
644
|
0
|
|
|
|
|
|
$self->{error}=29; |
645
|
0
|
|
|
|
|
|
$self->{errorString}='No author line defined'; |
646
|
0
|
|
|
|
|
|
$self->warn; |
647
|
0
|
|
|
|
|
|
return undef; |
648
|
|
|
|
|
|
|
} |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
#parses the address |
651
|
0
|
|
|
|
|
|
my @a=Email::Address->parse($aline); |
652
|
0
|
0
|
|
|
|
|
if ( ! defined( $a[0] ) ){ |
653
|
0
|
|
|
|
|
|
$self->{error}=30; |
654
|
0
|
|
|
|
|
|
$self->{errorString}='The author line "'.$aline.'" could not be parsed'; |
655
|
0
|
|
|
|
|
|
$self->warn; |
656
|
0
|
|
|
|
|
|
return undef; |
657
|
|
|
|
|
|
|
} |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
#process each |
660
|
0
|
|
|
|
|
|
my $int=0; |
661
|
0
|
|
|
|
|
|
my @tojoin; |
662
|
0
|
|
|
|
|
|
while ( defined( $a[$int] ) ){ |
663
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
664
|
|
|
|
|
|
|
'authorLink', |
665
|
|
|
|
|
|
|
{ |
666
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
667
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
668
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
669
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
670
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
671
|
|
|
|
|
|
|
self=>\$self, |
672
|
|
|
|
|
|
|
address=>$a[$int]->address, |
673
|
|
|
|
|
|
|
comment=>$a[$int]->comment, |
674
|
|
|
|
|
|
|
original=>$a[$int]->original, |
675
|
|
|
|
|
|
|
name=>$a[$int]->name, |
676
|
|
|
|
|
|
|
g=>\$self, |
677
|
|
|
|
|
|
|
} |
678
|
|
|
|
|
|
|
); |
679
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
680
|
0
|
|
|
|
|
|
$self->{error}=10; |
681
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
682
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
683
|
0
|
|
|
|
|
|
$self->warn; |
684
|
0
|
|
|
|
|
|
return undef; |
685
|
|
|
|
|
|
|
} |
686
|
|
|
|
|
|
|
|
687
|
0
|
|
|
|
|
|
push( @tojoin, $rendered ); |
688
|
|
|
|
|
|
|
|
689
|
0
|
|
|
|
|
|
$int++; |
690
|
|
|
|
|
|
|
} |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
#renders the joiner |
693
|
0
|
|
|
|
|
|
my $joiner=$self->{t}->fill_in( |
694
|
|
|
|
|
|
|
'authorJoin', |
695
|
|
|
|
|
|
|
{ |
696
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
697
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
698
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
699
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
700
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
701
|
|
|
|
|
|
|
self=>\$self, |
702
|
|
|
|
|
|
|
g=>\$self, |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
); |
705
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
706
|
0
|
|
|
|
|
|
$self->{error}=10; |
707
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
708
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
709
|
0
|
|
|
|
|
|
$self->warn; |
710
|
0
|
|
|
|
|
|
return undef; |
711
|
|
|
|
|
|
|
} |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
#renders the beginning of the authors links |
714
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
715
|
|
|
|
|
|
|
'authorBegin', |
716
|
|
|
|
|
|
|
{ |
717
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
718
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
719
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
720
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
721
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
722
|
|
|
|
|
|
|
self=>\$self, |
723
|
|
|
|
|
|
|
g=>\$self, |
724
|
|
|
|
|
|
|
} |
725
|
|
|
|
|
|
|
); |
726
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
727
|
0
|
|
|
|
|
|
$self->{error}=10; |
728
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
729
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
730
|
0
|
|
|
|
|
|
$self->warn; |
731
|
0
|
|
|
|
|
|
return undef; |
732
|
|
|
|
|
|
|
} |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
#renders the end of the authors links |
736
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
737
|
|
|
|
|
|
|
'authorEnd', |
738
|
|
|
|
|
|
|
{ |
739
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
740
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
741
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
742
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
743
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
744
|
|
|
|
|
|
|
self=>\$self, |
745
|
|
|
|
|
|
|
g=>\$self, |
746
|
|
|
|
|
|
|
} |
747
|
|
|
|
|
|
|
); |
748
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
749
|
0
|
|
|
|
|
|
$self->{error}=10; |
750
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
751
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
752
|
0
|
|
|
|
|
|
$self->warn; |
753
|
0
|
|
|
|
|
|
return undef; |
754
|
|
|
|
|
|
|
} |
755
|
|
|
|
|
|
|
|
756
|
0
|
|
|
|
|
|
return $begin.join( $joiner, @tojoin ).$end; |
757
|
|
|
|
|
|
|
} |
758
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
=head2 autodocList |
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
This a list of generates a table of the various |
762
|
|
|
|
|
|
|
documents. |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
One argument is accepted and the directory under the l root |
765
|
|
|
|
|
|
|
directory. If not specified, it is the same as object used to initate |
766
|
|
|
|
|
|
|
this object. |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
$g->autodocList; |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
=head3 Templates |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=head4 autodocListBegin |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
This initiates the table for the list. |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
The default template is as below. |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
| File |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
The variables passed to it are as below. |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
785
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
786
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
787
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
788
|
|
|
|
|
|
|
toader - This is a L object. |
789
|
|
|
|
|
|
|
self - This the L object. |
790
|
|
|
|
|
|
|
g - This the L object. |
791
|
|
|
|
|
|
|
dir - This is the directory relative to the root L directory. |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
=head4 autodocListRow |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
This is the represents a row in the document table. |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
The default template is as below. |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
| [== $g->adlink( $dir, $file ) ==] |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
The variables passed to it are as below. |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
806
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
807
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
808
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
809
|
|
|
|
|
|
|
toader - This is a L object. |
810
|
|
|
|
|
|
|
self - This the L object. |
811
|
|
|
|
|
|
|
g - This the L object. |
812
|
|
|
|
|
|
|
dir - This is the directory relative to the root L directory. |
813
|
|
|
|
|
|
|
file - This is the file to show. |
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
=head4 autodocListJoin |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
This is used to join the table rows. |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
The default template is blank. |
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
The variables passed to it are as below. |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
824
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
825
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
826
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
827
|
|
|
|
|
|
|
toader - This is a L object. |
828
|
|
|
|
|
|
|
self - This the L object. |
829
|
|
|
|
|
|
|
g - This the L object. |
830
|
|
|
|
|
|
|
dir - This is the directory relative to the root L directory. |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
=head4 autodocListEnd |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
This is ends the documentation list. |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
The default template is as below. |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
| |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
The variables passed to it are as below. |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
843
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
844
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
845
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
846
|
|
|
|
|
|
|
toader - This is a L object. |
847
|
|
|
|
|
|
|
self - This the L object. |
848
|
|
|
|
|
|
|
g - This the L object. |
849
|
|
|
|
|
|
|
dir - This is the directory relative to the root L directory. |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
=cut |
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
sub autodocList{ |
854
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
855
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
#blank any previous errors |
858
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
859
|
0
|
|
|
|
|
|
return undef; |
860
|
|
|
|
|
|
|
} |
861
|
|
|
|
|
|
|
|
862
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
863
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
864
|
|
|
|
|
|
|
} |
865
|
|
|
|
|
|
|
|
866
|
0
|
|
|
|
|
|
my $fullpath=$self->{toader}->getRootDir.'/'.$dir; |
867
|
|
|
|
|
|
|
|
868
|
0
|
|
|
|
|
|
my $ad=Toader::AutoDoc->new( $self->{toader} ); |
869
|
0
|
0
|
|
|
|
|
if ( $ad->error ){ |
870
|
0
|
|
|
|
|
|
$self->{error}=46; |
871
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::AutoDoc. error="'. |
872
|
|
|
|
|
|
|
$ad->error.'" errorString="'.$ad->errorString.'"'; |
873
|
0
|
|
|
|
|
|
$self->warn; |
874
|
0
|
|
|
|
|
|
return undef; |
875
|
|
|
|
|
|
|
} |
876
|
|
|
|
|
|
|
|
877
|
0
|
|
|
|
|
|
$ad->dirSet( $fullpath ); |
878
|
0
|
0
|
|
|
|
|
if ( $ad->error ){ |
879
|
0
|
|
|
|
|
|
$self->{error}=35; |
880
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to set the directory for the Toader::AutoDoc object to "'.$fullpath.'"'; |
881
|
0
|
|
|
|
|
|
$self->warn; |
882
|
0
|
|
|
|
|
|
return undef; |
883
|
|
|
|
|
|
|
} |
884
|
|
|
|
|
|
|
|
885
|
0
|
|
|
|
|
|
my @files=$ad->findDocs; |
886
|
0
|
0
|
|
|
|
|
if ( $ad->error ){ |
887
|
0
|
|
|
|
|
|
$self->{error}=36; |
888
|
0
|
|
|
|
|
|
$self->{errorString}=''; |
889
|
0
|
|
|
|
|
|
$self->warn; |
890
|
0
|
|
|
|
|
|
return undef; |
891
|
|
|
|
|
|
|
} |
892
|
0
|
|
|
|
|
|
@files=sort(@files); |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
#puts together the list of docs |
895
|
0
|
|
|
|
|
|
my $int=0; |
896
|
0
|
|
|
|
|
|
my @links; |
897
|
0
|
|
|
|
|
|
while ( defined( $files[$int] ) ){ |
898
|
|
|
|
|
|
|
|
899
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
900
|
|
|
|
|
|
|
'autodocListRow', |
901
|
|
|
|
|
|
|
{ |
902
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
903
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
904
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
905
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
906
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
907
|
|
|
|
|
|
|
self=>\$self, |
908
|
|
|
|
|
|
|
g=>\$self, |
909
|
|
|
|
|
|
|
file=>$files[$int], |
910
|
|
|
|
|
|
|
dir=>$dir, |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
); |
913
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
914
|
0
|
|
|
|
|
|
$self->{error}=10; |
915
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
916
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
917
|
0
|
|
|
|
|
|
$self->warn; |
918
|
0
|
|
|
|
|
|
return undef; |
919
|
|
|
|
|
|
|
} |
920
|
|
|
|
|
|
|
|
921
|
0
|
|
|
|
|
|
push( @links, $rendered ); |
922
|
|
|
|
|
|
|
|
923
|
0
|
|
|
|
|
|
$int++; |
924
|
|
|
|
|
|
|
} |
925
|
|
|
|
|
|
|
|
926
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
927
|
|
|
|
|
|
|
'autodocListBegin', |
928
|
|
|
|
|
|
|
{ |
929
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
930
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
931
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
932
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
933
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
934
|
|
|
|
|
|
|
self=>\$self, |
935
|
|
|
|
|
|
|
g=>\$self, |
936
|
|
|
|
|
|
|
dir=>$dir, |
937
|
|
|
|
|
|
|
} |
938
|
|
|
|
|
|
|
); |
939
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
940
|
0
|
|
|
|
|
|
$self->{error}=10; |
941
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
942
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
943
|
0
|
|
|
|
|
|
$self->warn; |
944
|
0
|
|
|
|
|
|
return undef; |
945
|
|
|
|
|
|
|
} |
946
|
|
|
|
|
|
|
|
947
|
0
|
|
|
|
|
|
my $join=$self->{t}->fill_in( |
948
|
|
|
|
|
|
|
'autodocListJoin', |
949
|
|
|
|
|
|
|
{ |
950
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
951
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
952
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
953
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
954
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
955
|
|
|
|
|
|
|
self=>\$self, |
956
|
|
|
|
|
|
|
g=>\$self, |
957
|
|
|
|
|
|
|
dir=>$dir, |
958
|
|
|
|
|
|
|
} |
959
|
|
|
|
|
|
|
); |
960
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
961
|
0
|
|
|
|
|
|
$self->{error}=10; |
962
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
963
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
964
|
0
|
|
|
|
|
|
$self->warn; |
965
|
0
|
|
|
|
|
|
return undef; |
966
|
|
|
|
|
|
|
} |
967
|
|
|
|
|
|
|
|
968
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
969
|
|
|
|
|
|
|
'autodocListEnd', |
970
|
|
|
|
|
|
|
{ |
971
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
972
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
973
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
974
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
975
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
976
|
|
|
|
|
|
|
self=>\$self, |
977
|
|
|
|
|
|
|
g=>\$self, |
978
|
|
|
|
|
|
|
dir=>$dir, |
979
|
|
|
|
|
|
|
} |
980
|
|
|
|
|
|
|
); |
981
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
982
|
0
|
|
|
|
|
|
$self->{error}=10; |
983
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
984
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
985
|
0
|
|
|
|
|
|
$self->warn; |
986
|
0
|
|
|
|
|
|
return undef; |
987
|
|
|
|
|
|
|
} |
988
|
|
|
|
|
|
|
|
989
|
0
|
|
|
|
|
|
return $begin.join($join, @links).$end; |
990
|
|
|
|
|
|
|
} |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
=head2 b2r |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
This returns the current value to get back to the root. |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
my $b2r=$g->b2r; |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
=cut |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
sub b2r{ |
1001
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1002
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
#blank any previous errors |
1004
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1005
|
0
|
|
|
|
|
|
return undef; |
1006
|
|
|
|
|
|
|
} |
1007
|
|
|
|
|
|
|
|
1008
|
0
|
|
|
|
|
|
return $self->{b2r}; |
1009
|
|
|
|
|
|
|
} |
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
=head2 cdlink |
1012
|
|
|
|
|
|
|
|
1013
|
|
|
|
|
|
|
This generates a link to the current directory. |
1014
|
|
|
|
|
|
|
|
1015
|
|
|
|
|
|
|
There is one option arguement. This is the text for the link. |
1016
|
|
|
|
|
|
|
If not specified, it defaults to ".". |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
$g->cdlink( "to current directory" ); |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
The template used for this is 'linkDirectory', which by default |
1021
|
|
|
|
|
|
|
is as below. |
1022
|
|
|
|
|
|
|
|
1023
|
|
|
|
|
|
|
[== $text ==] |
1024
|
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
|
The variables passed to it are as below. |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
url - This is the relative URL for this. |
1028
|
|
|
|
|
|
|
text - This to use for with the link. |
1029
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1030
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1031
|
|
|
|
|
|
|
obj - The L object. |
1032
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
1033
|
|
|
|
|
|
|
self - The L object. |
1034
|
|
|
|
|
|
|
toader - This is a L object. |
1035
|
|
|
|
|
|
|
g - This is a L object. |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
=cut |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
sub cdlink{ |
1040
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1041
|
0
|
|
|
|
|
|
my $text=$_[1]; |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
#blank any previous errors |
1044
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1045
|
0
|
|
|
|
|
|
return undef; |
1046
|
|
|
|
|
|
|
} |
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
#set the text to the same as the link if no text is defined |
1049
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
1050
|
0
|
|
|
|
|
|
$text='./'; |
1051
|
|
|
|
|
|
|
} |
1052
|
|
|
|
|
|
|
|
1053
|
0
|
|
|
|
|
|
my $url=$self->{toDir}; |
1054
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
1055
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
1056
|
0
|
|
|
|
|
|
$url=$self->{url}.$self->{r2r}; |
1057
|
|
|
|
|
|
|
} |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
#render it |
1060
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
1061
|
|
|
|
|
|
|
'linkDirectory', |
1062
|
|
|
|
|
|
|
{ |
1063
|
|
|
|
|
|
|
url=>$url, |
1064
|
|
|
|
|
|
|
text=>$text, |
1065
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1066
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1067
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1068
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1069
|
|
|
|
|
|
|
self=>\$self, |
1070
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1071
|
|
|
|
|
|
|
g=>\$self, |
1072
|
|
|
|
|
|
|
} |
1073
|
|
|
|
|
|
|
); |
1074
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1075
|
0
|
|
|
|
|
|
$self->{error}=10; |
1076
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1077
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1078
|
0
|
|
|
|
|
|
$self->warn; |
1079
|
0
|
|
|
|
|
|
return undef; |
1080
|
|
|
|
|
|
|
} |
1081
|
|
|
|
|
|
|
|
1082
|
0
|
|
|
|
|
|
return $rendered; |
1083
|
|
|
|
|
|
|
} |
1084
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
=head2 css |
1086
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
This renders the CSS template and returns it. |
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
$g->css; |
1090
|
|
|
|
|
|
|
|
1091
|
|
|
|
|
|
|
For more information on the CSS template and rendering |
1092
|
|
|
|
|
|
|
please see 'Documentation/CSS.pod'. |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
=cut |
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
sub css{ |
1097
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1098
|
|
|
|
|
|
|
|
1099
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1100
|
0
|
|
|
|
|
|
return undef; |
1101
|
|
|
|
|
|
|
} |
1102
|
|
|
|
|
|
|
|
1103
|
0
|
|
|
|
|
|
my $renderCSS=Toader::Render::CSS->new( $self->{toader} ); |
1104
|
|
|
|
|
|
|
|
1105
|
0
|
|
|
|
|
|
my $css=$renderCSS->renderCSS; |
1106
|
0
|
0
|
|
|
|
|
if ( $renderCSS->error ){ |
1107
|
0
|
|
|
|
|
|
$self->{error}=18; |
1108
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to render the CSS. error="'. |
1109
|
|
|
|
|
|
|
$renderCSS->error.'" errorString="'. |
1110
|
|
|
|
|
|
|
$renderCSS->errorString.'"'; |
1111
|
0
|
|
|
|
|
|
$self->warn; |
1112
|
0
|
|
|
|
|
|
return undef; |
1113
|
|
|
|
|
|
|
} |
1114
|
|
|
|
|
|
|
|
1115
|
0
|
|
|
|
|
|
return $css; |
1116
|
|
|
|
|
|
|
} |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
=head2 cssLocation |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
This returns the relative location to a the CSS file. |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
$g->cssLocation; |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
=cut |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
sub cssLocation{ |
1127
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1128
|
|
|
|
|
|
|
|
1129
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1130
|
0
|
|
|
|
|
|
return undef; |
1131
|
|
|
|
|
|
|
} |
1132
|
|
|
|
|
|
|
|
1133
|
0
|
0
|
|
|
|
|
if ( ! $self->{fullURL} ){ |
1134
|
0
|
|
|
|
|
|
return $self->{b2r}.'/toader.css'; |
1135
|
|
|
|
|
|
|
}else{ |
1136
|
0
|
|
|
|
|
|
return $self->{url}.'toader.css'; |
1137
|
|
|
|
|
|
|
} |
1138
|
|
|
|
|
|
|
} |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
=head2 dlink |
1141
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
This generates a link to a different directory object. |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
Two arguments are taken. |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
The first and required one is the L directory |
1147
|
|
|
|
|
|
|
to link to. This needs to be relative. |
1148
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
The second is the text, which if not specified will will be the |
1150
|
|
|
|
|
|
|
same the link. |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
$g->link( "./foo/bar", "more info on foo/bar" ); |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
The template used for this is 'linkDirectory', which by default |
1155
|
|
|
|
|
|
|
is as below. |
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
[== $text ==] |
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
The variables passed to it are as below. |
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
url - This is the relative URL for this. |
1162
|
|
|
|
|
|
|
text - This to use for with the link. |
1163
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1164
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1165
|
|
|
|
|
|
|
obj - The L object. |
1166
|
|
|
|
|
|
|
c - The L object containing the L config. |
1167
|
|
|
|
|
|
|
self - The L object. |
1168
|
|
|
|
|
|
|
toader - This is a L object. |
1169
|
|
|
|
|
|
|
g - This is a L object. |
1170
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
=cut |
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
sub dlink{ |
1174
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1175
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
1176
|
0
|
|
|
|
|
|
my $text=$_[2]; |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
#blank any previous errors |
1179
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1180
|
0
|
|
|
|
|
|
return undef; |
1181
|
|
|
|
|
|
|
} |
1182
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
#make sure we have a link |
1184
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
1185
|
0
|
|
|
|
|
|
$self->{error}=11; |
1186
|
0
|
|
|
|
|
|
$self->{errorString}='No Toader directory defined'; |
1187
|
0
|
|
|
|
|
|
$self->warn; |
1188
|
0
|
|
|
|
|
|
return undef; |
1189
|
|
|
|
|
|
|
} |
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
#set the text to the same as the link if no text is defined |
1192
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
1193
|
0
|
|
|
|
|
|
$text=$dir; |
1194
|
|
|
|
|
|
|
} |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
#handles it if it is a full path |
1197
|
0
|
|
|
|
|
|
my $dirtest; |
1198
|
0
|
0
|
|
|
|
|
if ( $dir =~ /^\// ){ |
1199
|
0
|
|
|
|
|
|
$dir=$self->{toader}->getRootDir.$dir; |
1200
|
0
|
|
|
|
|
|
$dirtest=$dir; |
1201
|
0
|
|
|
|
|
|
$dir=$self->{ph}->relative2root( $dir ); |
1202
|
|
|
|
|
|
|
}else{ |
1203
|
0
|
|
|
|
|
|
$dirtest=$self->{dir}.'/'.$dir; |
1204
|
|
|
|
|
|
|
} |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
#make sure it is a Toader directory |
1207
|
0
|
0
|
|
|
|
|
if ( ! $self->{isatd}->isaToaderDir( $dirtest ) ){ |
1208
|
0
|
|
|
|
|
|
$self->{error}=12; |
1209
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$dirtest.'" is not a Toader directory'; |
1210
|
0
|
|
|
|
|
|
$self->warn; |
1211
|
0
|
|
|
|
|
|
return undef; |
1212
|
|
|
|
|
|
|
} |
1213
|
|
|
|
|
|
|
|
1214
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
1215
|
0
|
|
|
|
|
|
$dir=$dir; |
1216
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
1217
|
0
|
|
|
|
|
|
$dir=$self->{url}.$dir; |
1218
|
|
|
|
|
|
|
}else{ |
1219
|
0
|
|
|
|
|
|
$dir=$self->{toDir}.$dir; |
1220
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
1221
|
|
|
|
|
|
|
} |
1222
|
|
|
|
|
|
|
|
1223
|
|
|
|
|
|
|
#render it |
1224
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
1225
|
|
|
|
|
|
|
'linkDirectory', |
1226
|
|
|
|
|
|
|
{ |
1227
|
|
|
|
|
|
|
url=>$dir, |
1228
|
|
|
|
|
|
|
text=>$text, |
1229
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1230
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1231
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1232
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1233
|
|
|
|
|
|
|
self=>\$self, |
1234
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1235
|
|
|
|
|
|
|
g=>\$self, |
1236
|
|
|
|
|
|
|
} |
1237
|
|
|
|
|
|
|
); |
1238
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1239
|
0
|
|
|
|
|
|
$self->{error}=10; |
1240
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1241
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1242
|
0
|
|
|
|
|
|
$self->warn; |
1243
|
0
|
|
|
|
|
|
return undef; |
1244
|
|
|
|
|
|
|
} |
1245
|
|
|
|
|
|
|
|
1246
|
0
|
|
|
|
|
|
return $rendered; |
1247
|
|
|
|
|
|
|
} |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
=head2 elink |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
This generates a link to a different directory object. |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
Two arguments are taken. |
1254
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
The first and required one is the L directory containing |
1256
|
|
|
|
|
|
|
the L object. This needs to be relative. |
1257
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
The second is the entry to link to. |
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
The third is the text, which if not specified will will be the |
1261
|
|
|
|
|
|
|
same the link. |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
$g->link( $dir, $entryID, "whatever at foo.bar" ); |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
The template used is 'linkEntry' and the default is as below. |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
[== $text ==] |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
The variables passed are as below. |
1270
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
url - This is the relative URL for this. |
1272
|
|
|
|
|
|
|
text - This to use for with the link. |
1273
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1274
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1275
|
|
|
|
|
|
|
obj - The L object. |
1276
|
|
|
|
|
|
|
c - The L object containing the L config. |
1277
|
|
|
|
|
|
|
self - The L object. |
1278
|
|
|
|
|
|
|
toader - This is a L object. |
1279
|
|
|
|
|
|
|
g - This is a L object. |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
=cut |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
sub elink{ |
1284
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1285
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
1286
|
0
|
|
|
|
|
|
my $entry=$_[2]; |
1287
|
0
|
|
|
|
|
|
my $text=$_[3]; |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
#blank any previous errors |
1290
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1291
|
0
|
|
|
|
|
|
return undef; |
1292
|
|
|
|
|
|
|
} |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
#use the object dir if not is specified |
1295
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
1296
|
0
|
|
|
|
|
|
$self->{error}=11; |
1297
|
0
|
|
|
|
|
|
$self->{errorString}='No Toader directory defined'; |
1298
|
0
|
|
|
|
|
|
$self->warn; |
1299
|
0
|
|
|
|
|
|
return undef; |
1300
|
|
|
|
|
|
|
} |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
#make sure we have a link |
1303
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
1304
|
0
|
|
|
|
|
|
$self->{error}=13; |
1305
|
0
|
|
|
|
|
|
$self->{errorString}='No Toader Entry ID defined'; |
1306
|
0
|
|
|
|
|
|
$self->warn; |
1307
|
0
|
|
|
|
|
|
return undef; |
1308
|
|
|
|
|
|
|
} |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
#set the text to the same as the link if no text is defined |
1311
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
1312
|
0
|
|
|
|
|
|
$text=$entry; |
1313
|
|
|
|
|
|
|
} |
1314
|
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
#handles it if it is a full path |
1316
|
0
|
|
|
|
|
|
my $dirtest; |
1317
|
0
|
0
|
|
|
|
|
if ( $dir =~ /^\// ){ |
1318
|
0
|
|
|
|
|
|
$dir=$self->{toader}->getRootDir.$dir; |
1319
|
0
|
|
|
|
|
|
$dirtest=$dir; |
1320
|
0
|
|
|
|
|
|
$dir=$self->{ph}->relative2root( $dir ); |
1321
|
|
|
|
|
|
|
}else{ |
1322
|
0
|
|
|
|
|
|
$dirtest=$self->{dir}.'/'.$dir; |
1323
|
|
|
|
|
|
|
} |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
#make sure it is a Toader directory |
1326
|
0
|
0
|
|
|
|
|
if ( ! $self->{isatd}->isaToaderDir( $dirtest ) ){ |
1327
|
0
|
|
|
|
|
|
$self->{error}=12; |
1328
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$dirtest.'" is not a Toader directory'; |
1329
|
0
|
|
|
|
|
|
$self->warn; |
1330
|
0
|
|
|
|
|
|
return undef; |
1331
|
|
|
|
|
|
|
} |
1332
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
#make sure entry exists... will also make sure it exists |
1334
|
0
|
|
|
|
|
|
my $eh=Toader::Entry::Helper->new( $self->{toader} ); |
1335
|
0
|
|
|
|
|
|
$eh->setDir( $dirtest ); |
1336
|
0
|
0
|
|
|
|
|
if ( ! $eh->entryExists( $entry ) ){ |
1337
|
0
|
|
|
|
|
|
$self->{error}=14; |
1338
|
0
|
|
|
|
|
|
$self->{errorString}='The entry ID "'.$entry.'" does not exist for the Toader directory "'.$dirtest.'"'; |
1339
|
0
|
|
|
|
|
|
$self->warn; |
1340
|
0
|
|
|
|
|
|
return undef; |
1341
|
|
|
|
|
|
|
} |
1342
|
|
|
|
|
|
|
|
1343
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
1344
|
0
|
|
|
|
|
|
$dir=$dir.'/.entries/'.$entry.'/'; |
1345
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
1346
|
0
|
|
|
|
|
|
$dir=$self->{url}.$dir; |
1347
|
|
|
|
|
|
|
}else{ |
1348
|
0
|
|
|
|
|
|
$dir=$self->{toDir}.$dir.'/.entries/'.$entry.'/'; |
1349
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
1350
|
|
|
|
|
|
|
} |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
#render it |
1353
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
1354
|
|
|
|
|
|
|
'linkEntry', |
1355
|
|
|
|
|
|
|
{ |
1356
|
|
|
|
|
|
|
url=>$dir, |
1357
|
|
|
|
|
|
|
text=>$text, |
1358
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1359
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1360
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1361
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1362
|
|
|
|
|
|
|
self=>\$self, |
1363
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1364
|
|
|
|
|
|
|
g=>\$self, |
1365
|
|
|
|
|
|
|
} |
1366
|
|
|
|
|
|
|
); |
1367
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1368
|
0
|
|
|
|
|
|
$self->{error}=10; |
1369
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1370
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1371
|
0
|
|
|
|
|
|
$self->warn; |
1372
|
0
|
|
|
|
|
|
return undef; |
1373
|
|
|
|
|
|
|
} |
1374
|
|
|
|
|
|
|
|
1375
|
0
|
|
|
|
|
|
return $rendered; |
1376
|
|
|
|
|
|
|
} |
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
=head2 entryArchive |
1379
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
This creates the entry archive for the current directory. |
1381
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
No arguments are taken. |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
$g->entryArchive; |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
=head3 Templates |
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
=head4 entryArchiveBegin |
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
This begins the entry archive table. |
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
| Date | Title | Summary |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
The variables passed to it are as below. |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1398
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1399
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
1400
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
1401
|
|
|
|
|
|
|
toader - This is a L object. |
1402
|
|
|
|
|
|
|
self - This the L object. |
1403
|
|
|
|
|
|
|
g - This the L object. |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
=head4 entryArchiveRow |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
This generates a row in the entry archive table. |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
The default template is as below. |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
|
1412
|
|
|
|
|
|
|
| [== $g->elink( "./", $date, $date ) ==] |
1413
|
|
|
|
|
|
|
| [== $title ==] |
1414
|
|
|
|
|
|
|
| [== $summary ==] |
1415
|
|
|
|
|
|
|
|
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
The variables passed to it are as below. |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1420
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1421
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
1422
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
1423
|
|
|
|
|
|
|
toader - This is a L object. |
1424
|
|
|
|
|
|
|
self - This the L object. |
1425
|
|
|
|
|
|
|
g - This the L object. |
1426
|
|
|
|
|
|
|
date - This is the entry name/date stamp. |
1427
|
|
|
|
|
|
|
title - This is the title of the entyr. |
1428
|
|
|
|
|
|
|
summary - This is a summary of the entry. |
1429
|
|
|
|
|
|
|
|
1430
|
|
|
|
|
|
|
=head4 entryArchiveJoin |
1431
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
This joins the entry rows. |
1433
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
The default template is blank. |
1435
|
|
|
|
|
|
|
|
1436
|
|
|
|
|
|
|
The variables passed to it are as below. |
1437
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1439
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1440
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
1441
|
|
|
|
|
|
|
c - The L object containing the L config. |
1442
|
|
|
|
|
|
|
toader - This is a L object. |
1443
|
|
|
|
|
|
|
self - This the L object. |
1444
|
|
|
|
|
|
|
g - This the L object. |
1445
|
|
|
|
|
|
|
|
1446
|
|
|
|
|
|
|
=head4 entryArchiveEnd |
1447
|
|
|
|
|
|
|
|
1448
|
|
|
|
|
|
|
This ends the authors link section. |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
The default template is as below. |
1451
|
|
|
|
|
|
|
|
1452
|
|
|
|
|
|
|
| |
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
The variables passed to it are as below. |
1455
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1457
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1458
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
1459
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
1460
|
|
|
|
|
|
|
toader - This is a Toader object. |
1461
|
|
|
|
|
|
|
self - This the L object. |
1462
|
|
|
|
|
|
|
g - This the L object. |
1463
|
|
|
|
|
|
|
|
1464
|
|
|
|
|
|
|
=cut |
1465
|
|
|
|
|
|
|
|
1466
|
|
|
|
|
|
|
sub entryArchive{ |
1467
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
#blank any previous errors |
1470
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1471
|
0
|
|
|
|
|
|
return undef; |
1472
|
|
|
|
|
|
|
} |
1473
|
|
|
|
|
|
|
|
1474
|
0
|
|
|
|
|
|
my $em=Toader::Entry::Manage->new( $self->{toader} ); |
1475
|
0
|
|
|
|
|
|
$em->setDir( $self->{odir} ); |
1476
|
0
|
0
|
|
|
|
|
if ( $em->error ){ |
1477
|
0
|
|
|
|
|
|
$self->{error}=25; |
1478
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to set the directory, "'.$self->{odir}. |
1479
|
|
|
|
|
|
|
'", for Toader::Entry::Manage. error="'.$em->error |
1480
|
|
|
|
|
|
|
.'" errorString="'.$em->errorString.'"'; |
1481
|
0
|
|
|
|
|
|
$self->warn; |
1482
|
0
|
|
|
|
|
|
return undef; |
1483
|
|
|
|
|
|
|
} |
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
#lists the entries for the directory |
1486
|
0
|
|
|
|
|
|
my @entries=$em->published; |
1487
|
0
|
0
|
|
|
|
|
if ( $em->error ){ |
1488
|
0
|
|
|
|
|
|
$self->{error}=25; |
1489
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to read the entries for "'.$self->{odir}. |
1490
|
|
|
|
|
|
|
'". error="'.$em->error.'" errorString="'.$em->errorString.'"'; |
1491
|
0
|
|
|
|
|
|
$self->warn; |
1492
|
0
|
|
|
|
|
|
return undef; |
1493
|
|
|
|
|
|
|
} |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
#return '' if there are none |
1496
|
0
|
0
|
|
|
|
|
if ( ! defined( $entries[0] ) ){ |
1497
|
0
|
|
|
|
|
|
return ''; |
1498
|
|
|
|
|
|
|
} |
1499
|
|
|
|
|
|
|
|
1500
|
|
|
|
|
|
|
#sort and order from last to first |
1501
|
0
|
|
|
|
|
|
@entries=sort(@entries); |
1502
|
0
|
|
|
|
|
|
@entries=reverse(@entries); |
1503
|
|
|
|
|
|
|
|
1504
|
|
|
|
|
|
|
#process each one |
1505
|
0
|
|
|
|
|
|
my @tojoin; |
1506
|
0
|
|
|
|
|
|
my $int=0; |
1507
|
0
|
|
|
|
|
|
while ( defined( $entries[$int] ) ){ |
1508
|
0
|
|
|
|
|
|
my $entry=$em->read( $entries[$int] ); |
1509
|
0
|
0
|
|
|
|
|
if ( $em->error ){ |
1510
|
0
|
|
|
|
|
|
$self->{error}=26; |
1511
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to read "'.$entries[$int].'" in "' |
1512
|
|
|
|
|
|
|
.$self->{odir}.'". error="'.$em->error.'" errorstring="' |
1513
|
|
|
|
|
|
|
.$em->errorString.'"'; |
1514
|
0
|
|
|
|
|
|
$self->warn; |
1515
|
0
|
|
|
|
|
|
return undef; |
1516
|
|
|
|
|
|
|
} |
1517
|
|
|
|
|
|
|
|
1518
|
|
|
|
|
|
|
#renders the row |
1519
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
1520
|
|
|
|
|
|
|
'entryArchiveRow', |
1521
|
|
|
|
|
|
|
{ |
1522
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1523
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1524
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1525
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1526
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1527
|
|
|
|
|
|
|
self=>\$self, |
1528
|
|
|
|
|
|
|
title=>$entry->titleGet, |
1529
|
|
|
|
|
|
|
summary=>$entry->summaryGet, |
1530
|
|
|
|
|
|
|
date=>$entry->entryNameGet, |
1531
|
|
|
|
|
|
|
g=>\$self, |
1532
|
|
|
|
|
|
|
} |
1533
|
|
|
|
|
|
|
); |
1534
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1535
|
0
|
|
|
|
|
|
$self->{error}=10; |
1536
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1537
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1538
|
0
|
|
|
|
|
|
$self->warn; |
1539
|
0
|
|
|
|
|
|
return undef; |
1540
|
|
|
|
|
|
|
} |
1541
|
|
|
|
|
|
|
|
1542
|
0
|
|
|
|
|
|
push( @tojoin, $rendered ); |
1543
|
|
|
|
|
|
|
|
1544
|
0
|
|
|
|
|
|
$int++; |
1545
|
|
|
|
|
|
|
} |
1546
|
|
|
|
|
|
|
|
1547
|
|
|
|
|
|
|
#renders the joiner |
1548
|
0
|
|
|
|
|
|
my $joiner=$self->{t}->fill_in( |
1549
|
|
|
|
|
|
|
'entryArchiveJoin', |
1550
|
|
|
|
|
|
|
{ |
1551
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1552
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1553
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1554
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1555
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1556
|
|
|
|
|
|
|
self=>\$self, |
1557
|
|
|
|
|
|
|
g=>\$self, |
1558
|
|
|
|
|
|
|
} |
1559
|
|
|
|
|
|
|
); |
1560
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1561
|
0
|
|
|
|
|
|
$self->{error}=10; |
1562
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1563
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1564
|
0
|
|
|
|
|
|
$self->warn; |
1565
|
0
|
|
|
|
|
|
return undef; |
1566
|
|
|
|
|
|
|
} |
1567
|
|
|
|
|
|
|
|
1568
|
|
|
|
|
|
|
#renders the end of the dir list |
1569
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
1570
|
|
|
|
|
|
|
'entryArchiveEnd', |
1571
|
|
|
|
|
|
|
{ |
1572
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1573
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1574
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1575
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1576
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1577
|
|
|
|
|
|
|
self=>\$self, |
1578
|
|
|
|
|
|
|
g=>\$self, |
1579
|
|
|
|
|
|
|
} |
1580
|
|
|
|
|
|
|
); |
1581
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1582
|
0
|
|
|
|
|
|
$self->{error}=10; |
1583
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1584
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1585
|
0
|
|
|
|
|
|
$self->warn; |
1586
|
0
|
|
|
|
|
|
return undef; |
1587
|
|
|
|
|
|
|
} |
1588
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
#renders the end of the dir list |
1590
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
1591
|
|
|
|
|
|
|
'entryArchiveBegin', |
1592
|
|
|
|
|
|
|
{ |
1593
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1594
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1595
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1596
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1597
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1598
|
|
|
|
|
|
|
self=>\$self, |
1599
|
|
|
|
|
|
|
g=>\$self, |
1600
|
|
|
|
|
|
|
} |
1601
|
|
|
|
|
|
|
); |
1602
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1603
|
0
|
|
|
|
|
|
$self->{error}=10; |
1604
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1605
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1606
|
0
|
|
|
|
|
|
$self->warn; |
1607
|
0
|
|
|
|
|
|
return undef; |
1608
|
|
|
|
|
|
|
} |
1609
|
|
|
|
|
|
|
|
1610
|
0
|
|
|
|
|
|
return $begin.join( $joiner, @tojoin ).$end; |
1611
|
|
|
|
|
|
|
} |
1612
|
|
|
|
|
|
|
|
1613
|
|
|
|
|
|
|
=head2 entriesArchiveLink |
1614
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
Link to the entries directory. |
1616
|
|
|
|
|
|
|
|
1617
|
|
|
|
|
|
|
One argument is taken and that is the text to use. |
1618
|
|
|
|
|
|
|
If not specifieid, it defaults to "Index". |
1619
|
|
|
|
|
|
|
|
1620
|
|
|
|
|
|
|
$g->entriesIndexLink; |
1621
|
|
|
|
|
|
|
|
1622
|
|
|
|
|
|
|
The template is 'entriesArchiveLink' and the default is |
1623
|
|
|
|
|
|
|
as below. |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
[== $text ==] |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
The variables used are as below. |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
url - This is the relative URL for this. |
1630
|
|
|
|
|
|
|
text - This to use for with the link. |
1631
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1632
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1633
|
|
|
|
|
|
|
obj - The L object. |
1634
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
1635
|
|
|
|
|
|
|
self - The L object. |
1636
|
|
|
|
|
|
|
toader - This is a L object. |
1637
|
|
|
|
|
|
|
g - This is a L object. |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
=cut |
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
sub entriesArchiveLink{ |
1642
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1643
|
0
|
|
|
|
|
|
my $text=$_[1]; |
1644
|
|
|
|
|
|
|
|
1645
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
1646
|
0
|
|
|
|
|
|
$text='Archive'; |
1647
|
|
|
|
|
|
|
} |
1648
|
|
|
|
|
|
|
|
1649
|
|
|
|
|
|
|
#blank any previous errors |
1650
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1651
|
0
|
|
|
|
|
|
return undef; |
1652
|
|
|
|
|
|
|
} |
1653
|
|
|
|
|
|
|
|
1654
|
0
|
|
|
|
|
|
my $url; |
1655
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
1656
|
0
|
|
|
|
|
|
$url=$self->{r2r}.'/.entries/archive.html'; |
1657
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
1658
|
0
|
|
|
|
|
|
$url=$self->{url}.$url; |
1659
|
|
|
|
|
|
|
}else{ |
1660
|
0
|
|
|
|
|
|
$url=$self->{toDir}.'/.entries/archive.html'; |
1661
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
1662
|
|
|
|
|
|
|
} |
1663
|
|
|
|
|
|
|
|
1664
|
|
|
|
|
|
|
#render it |
1665
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
1666
|
|
|
|
|
|
|
'entriesArchiveLink', |
1667
|
|
|
|
|
|
|
{ |
1668
|
|
|
|
|
|
|
url=>$url, |
1669
|
|
|
|
|
|
|
text=>$text, |
1670
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1671
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1672
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1673
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1674
|
|
|
|
|
|
|
self=>\$self, |
1675
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1676
|
|
|
|
|
|
|
g=>\$self, |
1677
|
|
|
|
|
|
|
} |
1678
|
|
|
|
|
|
|
); |
1679
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1680
|
0
|
|
|
|
|
|
$self->{error}=10; |
1681
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1682
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1683
|
0
|
|
|
|
|
|
$self->warn; |
1684
|
0
|
|
|
|
|
|
return undef; |
1685
|
|
|
|
|
|
|
} |
1686
|
|
|
|
|
|
|
|
1687
|
0
|
|
|
|
|
|
return $rendered; |
1688
|
|
|
|
|
|
|
} |
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
=head2 entriesLink |
1691
|
|
|
|
|
|
|
|
1692
|
|
|
|
|
|
|
Link to the entries directory. |
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
One argument is taken and that is the text to use. |
1695
|
|
|
|
|
|
|
If not specifieid, it defaults to "Latest". |
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
$g->entriesLink; |
1698
|
|
|
|
|
|
|
|
1699
|
|
|
|
|
|
|
The template 'entriesLink' is used and the default is as below. |
1700
|
|
|
|
|
|
|
|
1701
|
|
|
|
|
|
|
[== $text ==] |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
The variables are as below. |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
url - This is the relative URL for this. |
1706
|
|
|
|
|
|
|
text - This to use for with the link. |
1707
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1708
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1709
|
|
|
|
|
|
|
obj - The L object. |
1710
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
1711
|
|
|
|
|
|
|
self - The L object. |
1712
|
|
|
|
|
|
|
toader - This is a L object. |
1713
|
|
|
|
|
|
|
g - This is a L object. |
1714
|
|
|
|
|
|
|
|
1715
|
|
|
|
|
|
|
=cut |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
sub entriesLink{ |
1718
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1719
|
0
|
|
|
|
|
|
my $text=$_[1]; |
1720
|
|
|
|
|
|
|
|
1721
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
1722
|
0
|
|
|
|
|
|
$text='Latest'; |
1723
|
|
|
|
|
|
|
} |
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
#blank any previous errors |
1726
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1727
|
0
|
|
|
|
|
|
return undef; |
1728
|
|
|
|
|
|
|
} |
1729
|
|
|
|
|
|
|
|
1730
|
0
|
|
|
|
|
|
my $url; |
1731
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
1732
|
0
|
|
|
|
|
|
$url=$self->{r2r}.'/.entries/'; |
1733
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
1734
|
0
|
|
|
|
|
|
$url=$self->{url}.$url; |
1735
|
|
|
|
|
|
|
}else{ |
1736
|
0
|
|
|
|
|
|
$url=$self->{toDir}.'/.entries/'; |
1737
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
1738
|
|
|
|
|
|
|
} |
1739
|
|
|
|
|
|
|
|
1740
|
|
|
|
|
|
|
#render it |
1741
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
1742
|
|
|
|
|
|
|
'entriesLink', |
1743
|
|
|
|
|
|
|
{ |
1744
|
|
|
|
|
|
|
url=>$url, |
1745
|
|
|
|
|
|
|
text=>$text, |
1746
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1747
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1748
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1749
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1750
|
|
|
|
|
|
|
self=>\$self, |
1751
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1752
|
|
|
|
|
|
|
g=>\$self, |
1753
|
|
|
|
|
|
|
} |
1754
|
|
|
|
|
|
|
); |
1755
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1756
|
0
|
|
|
|
|
|
$self->{error}=10; |
1757
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1758
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1759
|
0
|
|
|
|
|
|
$self->warn; |
1760
|
0
|
|
|
|
|
|
return undef; |
1761
|
|
|
|
|
|
|
} |
1762
|
|
|
|
|
|
|
|
1763
|
0
|
|
|
|
|
|
return $rendered; |
1764
|
|
|
|
|
|
|
} |
1765
|
|
|
|
|
|
|
|
1766
|
|
|
|
|
|
|
=head2 flink |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
This generates a link to a included file for the object. |
1769
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
Two arguements are taken. The first and required is the file. |
1771
|
|
|
|
|
|
|
The second and optional is the text to use, which if not specified |
1772
|
|
|
|
|
|
|
is the name of the file. |
1773
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
$g->flink( $file ); |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
The template 'linkFile' is used and the default is as below. |
1777
|
|
|
|
|
|
|
|
1778
|
|
|
|
|
|
|
[== $text ==] |
1779
|
|
|
|
|
|
|
|
1780
|
|
|
|
|
|
|
The variables passed are as below. |
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
url - This is the relative URL for this. |
1783
|
|
|
|
|
|
|
text - This to use for with the link. |
1784
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
1785
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
1786
|
|
|
|
|
|
|
obj - The L object. |
1787
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
1788
|
|
|
|
|
|
|
self - The L object. |
1789
|
|
|
|
|
|
|
toader - This is a L object. |
1790
|
|
|
|
|
|
|
g - This is a L object. |
1791
|
|
|
|
|
|
|
|
1792
|
|
|
|
|
|
|
=cut |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
sub flink{ |
1795
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1796
|
0
|
|
|
|
|
|
my $file=$_[1]; |
1797
|
0
|
|
|
|
|
|
my $text=$_[2]; |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
#blank any previous errors |
1800
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1801
|
0
|
|
|
|
|
|
return undef; |
1802
|
|
|
|
|
|
|
} |
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
#make sure we have a link |
1805
|
0
|
0
|
|
|
|
|
if ( ! defined( $file ) ){ |
1806
|
0
|
|
|
|
|
|
$self->{error}=17; |
1807
|
0
|
|
|
|
|
|
$self->{errorString}='No file specified'; |
1808
|
0
|
|
|
|
|
|
$self->warn; |
1809
|
0
|
|
|
|
|
|
return undef; |
1810
|
|
|
|
|
|
|
} |
1811
|
|
|
|
|
|
|
|
1812
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
1813
|
0
|
|
|
|
|
|
$text=$file; |
1814
|
|
|
|
|
|
|
} |
1815
|
|
|
|
|
|
|
|
1816
|
|
|
|
|
|
|
#creates the URL and cleans it up |
1817
|
0
|
|
|
|
|
|
my $url=$self->{toFiles}.'/'.$file; |
1818
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
#render it |
1821
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
1822
|
|
|
|
|
|
|
'linkFile', |
1823
|
|
|
|
|
|
|
{ |
1824
|
|
|
|
|
|
|
url=>$self->{toFiles}.'/'.$file, |
1825
|
|
|
|
|
|
|
text=>$text, |
1826
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
1827
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
1828
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
1829
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
1830
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
1831
|
|
|
|
|
|
|
self=>\$self, |
1832
|
|
|
|
|
|
|
g=>\$self, |
1833
|
|
|
|
|
|
|
} |
1834
|
|
|
|
|
|
|
); |
1835
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
1836
|
0
|
|
|
|
|
|
$self->{error}=10; |
1837
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
1838
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
1839
|
0
|
|
|
|
|
|
$self->warn; |
1840
|
0
|
|
|
|
|
|
return undef; |
1841
|
|
|
|
|
|
|
} |
1842
|
|
|
|
|
|
|
|
1843
|
0
|
|
|
|
|
|
return $rendered; |
1844
|
|
|
|
|
|
|
} |
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
=head2 galleryDirURL |
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
This returns the URL for a gallery directory. |
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
Three arguments are accepted. The first is the Toader |
1851
|
|
|
|
|
|
|
directory to for the gallery, if not specified it uses |
1852
|
|
|
|
|
|
|
the Toader directory for the current object. The |
1853
|
|
|
|
|
|
|
second is the relative gallery directory, which if not |
1854
|
|
|
|
|
|
|
specified defaults to the '', the root gallery directory. |
1855
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
[== $g->galleryDirURL ==] |
1857
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
=cut |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
sub galleryDirURL{ |
1861
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1862
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
1863
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
1864
|
|
|
|
|
|
|
|
1865
|
|
|
|
|
|
|
#blank any previous errors |
1866
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1867
|
0
|
|
|
|
|
|
return undef; |
1868
|
|
|
|
|
|
|
} |
1869
|
|
|
|
|
|
|
|
1870
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
1871
|
0
|
|
|
|
|
|
$gdir=''; |
1872
|
|
|
|
|
|
|
} |
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
#clean it up, removing any possible multi / |
1875
|
0
|
|
|
|
|
|
$gdir=~s/\/\/*/\//g; |
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
1878
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
1879
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
1880
|
|
|
|
|
|
|
} |
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
#puts together the full path |
1883
|
0
|
|
|
|
|
|
my $toaderDir=$self->{toader}->getRootDir.'/'.$dir; |
1884
|
|
|
|
|
|
|
|
1885
|
|
|
|
|
|
|
#gets a Gallery object |
1886
|
0
|
|
|
|
|
|
my $tg; |
1887
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
1888
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
1889
|
0
|
|
|
|
|
|
$tg->dirSet( $toaderDir ); |
1890
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
1891
|
0
|
|
|
|
|
|
$self->{error}=40; |
1892
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
1893
|
0
|
|
|
|
|
|
$self->warn; |
1894
|
0
|
|
|
|
|
|
return undef; |
1895
|
|
|
|
|
|
|
} |
1896
|
|
|
|
|
|
|
}else{ |
1897
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
1898
|
|
|
|
|
|
|
} |
1899
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
#gets the output URL |
1901
|
0
|
|
|
|
|
|
my $outputURL=$tg->outputURLget; |
1902
|
0
|
0
|
|
|
|
|
if ( ! defined( $outputURL ) ){ |
1903
|
0
|
|
|
|
|
|
$self->{error}=41; |
1904
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the output URL for Toader::Gallery for "'.$dir.'"'; |
1905
|
0
|
|
|
|
|
|
$self->warn; |
1906
|
0
|
|
|
|
|
|
return undef; |
1907
|
|
|
|
|
|
|
} |
1908
|
|
|
|
|
|
|
|
1909
|
0
|
|
|
|
|
|
my $link='.toader-gallery/html/'.$gdir; |
1910
|
0
|
|
|
|
|
|
$link=~s/\/\/*/\//g; |
1911
|
0
|
|
|
|
|
|
return $outputURL.$link; |
1912
|
|
|
|
|
|
|
} |
1913
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
=head2 galleryImageLarge |
1915
|
|
|
|
|
|
|
|
1916
|
|
|
|
|
|
|
This generates the HTML for a large gallery image. |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
Two arguments are taken. The first and optional one is the |
1919
|
|
|
|
|
|
|
directory, which if not specified, it uses the Toader current |
1920
|
|
|
|
|
|
|
directory. The second and required is the gallery directory for |
1921
|
|
|
|
|
|
|
the image, which if not specified it defaults to the root |
1922
|
|
|
|
|
|
|
directory, ''. The third and required is the gallery image. |
1923
|
|
|
|
|
|
|
|
1924
|
|
|
|
|
|
|
[== $g->galleryImageLarge( undef, '', $someImage (. |
1925
|
|
|
|
|
|
|
|
1926
|
|
|
|
|
|
|
This uses imageDiv with the content provided by imageExifTables. |
1927
|
|
|
|
|
|
|
|
1928
|
|
|
|
|
|
|
=cut |
1929
|
|
|
|
|
|
|
|
1930
|
|
|
|
|
|
|
sub galleryImageLarge{ |
1931
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
1932
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
1933
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
1934
|
0
|
|
|
|
|
|
my $image=$_[3]; |
1935
|
|
|
|
|
|
|
|
1936
|
|
|
|
|
|
|
#blank any previous errors |
1937
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
1938
|
0
|
|
|
|
|
|
return undef; |
1939
|
|
|
|
|
|
|
} |
1940
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
1942
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
1943
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
1944
|
|
|
|
|
|
|
} |
1945
|
|
|
|
|
|
|
|
1946
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
1947
|
0
|
|
|
|
|
|
$gdir=''; |
1948
|
|
|
|
|
|
|
} |
1949
|
|
|
|
|
|
|
|
1950
|
|
|
|
|
|
|
#puts together the full path |
1951
|
0
|
|
|
|
|
|
my $toaderDir=$self->{toader}->getRootDir.'/'.$dir; |
1952
|
|
|
|
|
|
|
|
1953
|
|
|
|
|
|
|
#gets a Gallery object |
1954
|
0
|
|
|
|
|
|
my $tg; |
1955
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
1956
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
1957
|
0
|
|
|
|
|
|
$tg->dirSet( $toaderDir ); |
1958
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
1959
|
0
|
|
|
|
|
|
$self->{error}=40; |
1960
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
1961
|
0
|
|
|
|
|
|
$self->warn; |
1962
|
0
|
|
|
|
|
|
return undef; |
1963
|
|
|
|
|
|
|
} |
1964
|
|
|
|
|
|
|
}else{ |
1965
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
1966
|
|
|
|
|
|
|
} |
1967
|
|
|
|
|
|
|
|
1968
|
|
|
|
|
|
|
#gets the output URL |
1969
|
0
|
|
|
|
|
|
my $outputURL=$tg->outputURLget; |
1970
|
0
|
0
|
|
|
|
|
if ( ! defined( $outputURL ) ){ |
1971
|
0
|
|
|
|
|
|
$self->{error}=41; |
1972
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the output URL for Toader::Gallery for "'.$dir.'"'; |
1973
|
0
|
|
|
|
|
|
$self->warn; |
1974
|
0
|
|
|
|
|
|
return undef; |
1975
|
|
|
|
|
|
|
} |
1976
|
|
|
|
|
|
|
|
1977
|
|
|
|
|
|
|
#gets the source path |
1978
|
0
|
|
|
|
|
|
my $srcPath=$tg->srcPathGet; |
1979
|
0
|
0
|
|
|
|
|
if ( ! defined( $srcPath ) ){ |
1980
|
0
|
|
|
|
|
|
$self->{error}=42; |
1981
|
0
|
|
|
|
|
|
$self->{errorString}='No source path specified'; |
1982
|
0
|
|
|
|
|
|
$self->warn; |
1983
|
0
|
|
|
|
|
|
return undef; |
1984
|
|
|
|
|
|
|
} |
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
#puts together the image URL |
1987
|
0
|
|
|
|
|
|
my $imageURL='.toader-gallery/large/'.$gdir.'/'.$image; |
1988
|
0
|
|
|
|
|
|
$imageURL=~s/\/\/*/\//g; |
1989
|
0
|
|
|
|
|
|
$imageURL=$outputURL.$imageURL; |
1990
|
|
|
|
|
|
|
|
1991
|
|
|
|
|
|
|
#returns the URL for the source gallery image |
1992
|
0
|
|
|
|
|
|
my $srcURL=$self->gallerySrcURL( $dir, $gdir, $image ); |
1993
|
|
|
|
|
|
|
|
1994
|
0
|
|
|
|
|
|
my $imagePath=$srcPath.'/'.$gdir.'/'.$image; |
1995
|
0
|
|
|
|
|
|
$imagePath=~s/\/\/*/\//g; |
1996
|
|
|
|
|
|
|
|
1997
|
|
|
|
|
|
|
#puts together the EXIF table |
1998
|
0
|
|
|
|
|
|
my $exifTables=$self->imageExifTables( $imagePath ); |
1999
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
2000
|
0
|
|
|
|
|
|
$self->warnString('imageExifTables failed'); |
2001
|
0
|
|
|
|
|
|
return undef; |
2002
|
|
|
|
|
|
|
} |
2003
|
|
|
|
|
|
|
|
2004
|
0
|
|
|
|
|
|
my $rendered=$self->imageDiv( $imageURL, $srcURL, undef, $exifTables ); |
2005
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
2006
|
0
|
|
|
|
|
|
$self->warnString('imageDiv failed'); |
2007
|
0
|
|
|
|
|
|
return undef; |
2008
|
|
|
|
|
|
|
} |
2009
|
|
|
|
|
|
|
|
2010
|
0
|
|
|
|
|
|
return $rendered; |
2011
|
|
|
|
|
|
|
} |
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
=head2 galleryImageSmall |
2014
|
|
|
|
|
|
|
|
2015
|
|
|
|
|
|
|
This generates the HTML for a small gallery image. |
2016
|
|
|
|
|
|
|
|
2017
|
|
|
|
|
|
|
Two arguments are taken. The first and optional one is the |
2018
|
|
|
|
|
|
|
directory, which if not specified, it uses the Toader current |
2019
|
|
|
|
|
|
|
directory. The second and required is the gallery directory for |
2020
|
|
|
|
|
|
|
the image. The third and required is the gallery image. |
2021
|
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
This invokes imageDiv, using the name of the image as the content. |
2023
|
|
|
|
|
|
|
|
2024
|
|
|
|
|
|
|
[== $g->gallerImageSmall( undef, $gdir, $image ); ==] |
2025
|
|
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
This uses imageDiv with the link URL being the link to the image details |
2027
|
|
|
|
|
|
|
and the lower text being the image file name. |
2028
|
|
|
|
|
|
|
|
2029
|
|
|
|
|
|
|
=cut |
2030
|
|
|
|
|
|
|
|
2031
|
|
|
|
|
|
|
sub galleryImageSmall{ |
2032
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2033
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
2034
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
2035
|
0
|
|
|
|
|
|
my $image=$_[3]; |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
#blank any previous errors |
2038
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2039
|
0
|
|
|
|
|
|
return undef; |
2040
|
|
|
|
|
|
|
} |
2041
|
|
|
|
|
|
|
|
2042
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
2043
|
0
|
|
|
|
|
|
$gdir=''; |
2044
|
|
|
|
|
|
|
} |
2045
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
2047
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
2048
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
2049
|
|
|
|
|
|
|
} |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
#puts together the full path |
2052
|
0
|
|
|
|
|
|
my $toaderDir=$self->{toader}->getRootDir.'/'.$dir; |
2053
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
#gets a Gallery object |
2055
|
0
|
|
|
|
|
|
my $tg; |
2056
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
2057
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
2058
|
0
|
|
|
|
|
|
$tg->dirSet( $toaderDir ); |
2059
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
2060
|
0
|
|
|
|
|
|
$self->{error}=40; |
2061
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
2062
|
0
|
|
|
|
|
|
$self->warn; |
2063
|
0
|
|
|
|
|
|
return undef; |
2064
|
|
|
|
|
|
|
} |
2065
|
|
|
|
|
|
|
}else{ |
2066
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
2067
|
|
|
|
|
|
|
} |
2068
|
|
|
|
|
|
|
|
2069
|
|
|
|
|
|
|
#gets the output URL |
2070
|
0
|
|
|
|
|
|
my $outputURL=$tg->outputURLget; |
2071
|
0
|
0
|
|
|
|
|
if ( ! defined( $outputURL ) ){ |
2072
|
0
|
|
|
|
|
|
$self->{error}=41; |
2073
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the output URL for Toader::Gallery for "'.$dir.'"'; |
2074
|
0
|
|
|
|
|
|
$self->warn; |
2075
|
0
|
|
|
|
|
|
return undef; |
2076
|
|
|
|
|
|
|
} |
2077
|
|
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
#puts together the image URL |
2079
|
0
|
|
|
|
|
|
my $imageURL='.toader-gallery/small/'.$gdir.'/'.$image; |
2080
|
0
|
|
|
|
|
|
$imageURL=~s/\/\/*/\//g; |
2081
|
0
|
|
|
|
|
|
$imageURL=$outputURL.$imageURL; |
2082
|
|
|
|
|
|
|
|
2083
|
|
|
|
|
|
|
#returns the URL for the large gallery image |
2084
|
0
|
|
|
|
|
|
my $largeURL=$self->galleryLargeURL( $dir, $gdir, $image ); |
2085
|
|
|
|
|
|
|
|
2086
|
0
|
|
|
|
|
|
my $rendered=$self->imageDiv( $imageURL, $largeURL, undef, $image ); |
2087
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
2088
|
0
|
|
|
|
|
|
$self->warnString('imageDiv failed'); |
2089
|
0
|
|
|
|
|
|
return undef; |
2090
|
|
|
|
|
|
|
} |
2091
|
|
|
|
|
|
|
|
2092
|
0
|
|
|
|
|
|
return $rendered; |
2093
|
|
|
|
|
|
|
} |
2094
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
=head2 galleryLargeURL |
2096
|
|
|
|
|
|
|
|
2097
|
|
|
|
|
|
|
This returns the large URL for a directory image. |
2098
|
|
|
|
|
|
|
|
2099
|
|
|
|
|
|
|
Three arguments are accepted. The first is the Toader |
2100
|
|
|
|
|
|
|
directory to for the gallery, if not specified it uses |
2101
|
|
|
|
|
|
|
the Toader directory for the current object. The |
2102
|
|
|
|
|
|
|
second is the relative gallery directory, which if not |
2103
|
|
|
|
|
|
|
specified defaults to the '', the root gallery directory. |
2104
|
|
|
|
|
|
|
The third is the image in that directory. |
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
[== $g->galleryLargeURL; ==] |
2107
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
=cut |
2109
|
|
|
|
|
|
|
|
2110
|
|
|
|
|
|
|
sub galleryLargeURL{ |
2111
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2112
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
2113
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
2114
|
0
|
|
|
|
|
|
my $image=$_[3]; |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
#blank any previous errors |
2117
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2118
|
0
|
|
|
|
|
|
return undef; |
2119
|
|
|
|
|
|
|
} |
2120
|
|
|
|
|
|
|
|
2121
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
2122
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
2123
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
2124
|
|
|
|
|
|
|
} |
2125
|
|
|
|
|
|
|
|
2126
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
2127
|
0
|
|
|
|
|
|
$gdir=''; |
2128
|
|
|
|
|
|
|
} |
2129
|
|
|
|
|
|
|
|
2130
|
|
|
|
|
|
|
#make sure there no multi / |
2131
|
0
|
|
|
|
|
|
$gdir=~s/\/\/*/\//g; |
2132
|
|
|
|
|
|
|
|
2133
|
|
|
|
|
|
|
#puts together the full path |
2134
|
0
|
|
|
|
|
|
my $toaderDir=$self->{toader}->getRootDir.'/'.$dir; |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
#gets a Gallery object |
2137
|
0
|
|
|
|
|
|
my $tg; |
2138
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
2139
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
2140
|
0
|
|
|
|
|
|
$tg->dirSet( $toaderDir ); |
2141
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
2142
|
0
|
|
|
|
|
|
$self->{error}=40; |
2143
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
2144
|
0
|
|
|
|
|
|
$self->warn; |
2145
|
0
|
|
|
|
|
|
return undef; |
2146
|
|
|
|
|
|
|
} |
2147
|
|
|
|
|
|
|
}else{ |
2148
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
2149
|
|
|
|
|
|
|
} |
2150
|
|
|
|
|
|
|
|
2151
|
|
|
|
|
|
|
#gets the output URL |
2152
|
0
|
|
|
|
|
|
my $outputURL=$tg->outputURLget; |
2153
|
0
|
0
|
|
|
|
|
if ( ! defined( $outputURL ) ){ |
2154
|
0
|
|
|
|
|
|
$self->{error}=41; |
2155
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the output URL for Toader::Gallery for "'.$dir.'"'; |
2156
|
0
|
|
|
|
|
|
$self->warn; |
2157
|
0
|
|
|
|
|
|
return undef; |
2158
|
|
|
|
|
|
|
} |
2159
|
|
|
|
|
|
|
|
2160
|
0
|
|
|
|
|
|
my $url='.toader-gallery/html/'.$gdir.'/'.$image.'.html'; |
2161
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
2162
|
0
|
|
|
|
|
|
return $outputURL.$url; |
2163
|
|
|
|
|
|
|
} |
2164
|
|
|
|
|
|
|
|
2165
|
|
|
|
|
|
|
=head2 galleryLargeImageURL |
2166
|
|
|
|
|
|
|
|
2167
|
|
|
|
|
|
|
This returns the URL for the large gallery image. |
2168
|
|
|
|
|
|
|
|
2169
|
|
|
|
|
|
|
Three arguments are accepted. The first is the Toader |
2170
|
|
|
|
|
|
|
directory to for the gallery, if not specified it uses |
2171
|
|
|
|
|
|
|
the Toader directory for the current object. The |
2172
|
|
|
|
|
|
|
second is the relative gallery directory, which if not |
2173
|
|
|
|
|
|
|
specified defaults to the '', the root gallery directory. |
2174
|
|
|
|
|
|
|
The third is the image in that directory. |
2175
|
|
|
|
|
|
|
|
2176
|
|
|
|
|
|
|
[== $g->galleryLargeImageURL( undef, $gdir, $image ); ==] |
2177
|
|
|
|
|
|
|
|
2178
|
|
|
|
|
|
|
=cut |
2179
|
|
|
|
|
|
|
|
2180
|
|
|
|
|
|
|
sub galleryLargeImageURL{ |
2181
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2182
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
2183
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
2184
|
0
|
|
|
|
|
|
my $image=$_[3]; |
2185
|
|
|
|
|
|
|
|
2186
|
|
|
|
|
|
|
#blank any previous errors |
2187
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2188
|
0
|
|
|
|
|
|
return undef; |
2189
|
|
|
|
|
|
|
} |
2190
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
2192
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
2193
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
2194
|
|
|
|
|
|
|
} |
2195
|
|
|
|
|
|
|
|
2196
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
2197
|
0
|
|
|
|
|
|
$gdir=''; |
2198
|
|
|
|
|
|
|
} |
2199
|
|
|
|
|
|
|
|
2200
|
|
|
|
|
|
|
#puts together the full path |
2201
|
0
|
|
|
|
|
|
my $toaderDir=$self->{toader}->getRootDir.'/'.$dir; |
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
#gets a Gallery object |
2204
|
0
|
|
|
|
|
|
my $tg; |
2205
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
2206
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
2207
|
0
|
|
|
|
|
|
$tg->dirSet( $toaderDir ); |
2208
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
2209
|
0
|
|
|
|
|
|
$self->{error}=40; |
2210
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
2211
|
0
|
|
|
|
|
|
$self->warn; |
2212
|
0
|
|
|
|
|
|
return undef; |
2213
|
|
|
|
|
|
|
} |
2214
|
|
|
|
|
|
|
}else{ |
2215
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
2216
|
|
|
|
|
|
|
} |
2217
|
|
|
|
|
|
|
|
2218
|
|
|
|
|
|
|
#gets the output URL |
2219
|
0
|
|
|
|
|
|
my $outputURL=$tg->outputURLget; |
2220
|
0
|
0
|
|
|
|
|
if ( ! defined( $outputURL ) ){ |
2221
|
0
|
|
|
|
|
|
$self->{error}=41; |
2222
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the output URL for Toader::Gallery for "'.$dir.'"'; |
2223
|
0
|
|
|
|
|
|
$self->warn; |
2224
|
0
|
|
|
|
|
|
return undef; |
2225
|
|
|
|
|
|
|
} |
2226
|
|
|
|
|
|
|
|
2227
|
0
|
|
|
|
|
|
my $url='.toader-gallery/large/'.$gdir.'/'.$image; |
2228
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
2229
|
0
|
|
|
|
|
|
return $outputURL.$url; |
2230
|
|
|
|
|
|
|
} |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
=head2 galleryLocationbar |
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
Two arguments taken for this. The first argument is required and |
2235
|
|
|
|
|
|
|
it is the relative gallery directory, which if not specified |
2236
|
|
|
|
|
|
|
defaults to the '', the root gallery directory. The second and |
2237
|
|
|
|
|
|
|
optional is a image name, if any. |
2238
|
|
|
|
|
|
|
|
2239
|
|
|
|
|
|
|
[== $g->galleryLocationbar; ==] |
2240
|
|
|
|
|
|
|
|
2241
|
|
|
|
|
|
|
This is largely useful for setting a locationSub for a gallery |
2242
|
|
|
|
|
|
|
item. See L for a example of that. |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
=head3 Templates |
2245
|
|
|
|
|
|
|
|
2246
|
|
|
|
|
|
|
=head4 galleryLocationStart |
2247
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
This starts the location bar insert. |
2249
|
|
|
|
|
|
|
|
2250
|
|
|
|
|
|
|
The default template is as below. |
2251
|
|
|
|
|
|
|
|
2252
|
|
|
|
|
|
|
Gallery Location: |
2253
|
|
|
|
|
|
|
|
2254
|
|
|
|
|
|
|
The variables below are passed to it. |
2255
|
|
|
|
|
|
|
|
2256
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2257
|
|
|
|
|
|
|
self - The L object. |
2258
|
|
|
|
|
|
|
toader - This is a L object. |
2259
|
|
|
|
|
|
|
g - This is a L object. |
2260
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
2261
|
|
|
|
|
|
|
|
2262
|
|
|
|
|
|
|
=head4 galleryLocationPart |
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
This is a one of the gallery directories in the path to the one specified. |
2265
|
|
|
|
|
|
|
|
2266
|
|
|
|
|
|
|
[== $text ==] |
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
The variables below are passed to it. |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2271
|
|
|
|
|
|
|
self - The L object. |
2272
|
|
|
|
|
|
|
toader - This is a L object. |
2273
|
|
|
|
|
|
|
g - This is a L object. |
2274
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
2275
|
|
|
|
|
|
|
gdir - The gallery directory this part is for. |
2276
|
|
|
|
|
|
|
url - The URL for that gallery directory. |
2277
|
|
|
|
|
|
|
text - The text(directory name) for that directory. |
2278
|
|
|
|
|
|
|
|
2279
|
|
|
|
|
|
|
=head4 galleryLocationJoin |
2280
|
|
|
|
|
|
|
|
2281
|
|
|
|
|
|
|
This joins the gallery parts together. |
2282
|
|
|
|
|
|
|
|
2283
|
|
|
|
|
|
|
/ |
2284
|
|
|
|
|
|
|
|
2285
|
|
|
|
|
|
|
The variables below are passed to it. |
2286
|
|
|
|
|
|
|
|
2287
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2288
|
|
|
|
|
|
|
self - The L object. |
2289
|
|
|
|
|
|
|
toader - This is a L object. |
2290
|
|
|
|
|
|
|
g - This is a L object. |
2291
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
2292
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
=head4 galleryLocationEnd |
2294
|
|
|
|
|
|
|
|
2295
|
|
|
|
|
|
|
This ends the gallery location bar. |
2296
|
|
|
|
|
|
|
|
2297
|
|
|
|
|
|
|
The default template is as below. |
2298
|
|
|
|
|
|
|
|
2299
|
|
|
|
|
|
|
|
2300
|
|
|
|
|
|
|
|
2301
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
The variables below are passed to it. |
2303
|
|
|
|
|
|
|
|
2304
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2305
|
|
|
|
|
|
|
self - The L object. |
2306
|
|
|
|
|
|
|
toader - This is a L object. |
2307
|
|
|
|
|
|
|
g - This is a L object. |
2308
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
2309
|
|
|
|
|
|
|
|
2310
|
|
|
|
|
|
|
=head4 galleryLocationImage |
2311
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
This is appended if something is specified for a image. |
2313
|
|
|
|
|
|
|
|
2314
|
|
|
|
|
|
|
The default |
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
|
2317
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
The variables below are passed to it. |
2319
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2321
|
|
|
|
|
|
|
self - The L object. |
2322
|
|
|
|
|
|
|
toader - This is a L object. |
2323
|
|
|
|
|
|
|
g - This is a L object. |
2324
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
2325
|
|
|
|
|
|
|
gdir - The gallery directory this part is for. |
2326
|
|
|
|
|
|
|
url - The URL for that large(details) image page. |
2327
|
|
|
|
|
|
|
text - The text(directory name) for that directory. |
2328
|
|
|
|
|
|
|
|
2329
|
|
|
|
|
|
|
=cut |
2330
|
|
|
|
|
|
|
|
2331
|
|
|
|
|
|
|
sub galleryLocationbar{ |
2332
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2333
|
0
|
|
|
|
|
|
my $gdir=$_[1]; |
2334
|
0
|
|
|
|
|
|
my $image=$_[2]; |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
#blank any previous errors |
2337
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2338
|
0
|
|
|
|
|
|
return undef; |
2339
|
|
|
|
|
|
|
} |
2340
|
|
|
|
|
|
|
|
2341
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
2342
|
0
|
|
|
|
|
|
$gdir=''; |
2343
|
|
|
|
|
|
|
} |
2344
|
|
|
|
|
|
|
|
2345
|
|
|
|
|
|
|
#save this for later errors, if needed |
2346
|
0
|
|
|
|
|
|
my $gdirOrig=$gdir; |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
#makes sure it does not have a ./, which can safely be removed |
2349
|
0
|
|
|
|
|
|
$gdir=~s/^\.\///; |
2350
|
|
|
|
|
|
|
#make sure it does not start with a /, which can safely be removed |
2351
|
0
|
|
|
|
|
|
$gdir=~s/^\///; |
2352
|
|
|
|
|
|
|
#make sure it does not have any multie-/, which can safely be made one |
2353
|
0
|
|
|
|
|
|
$gdir=~s/\/\/*/\//g; |
2354
|
|
|
|
|
|
|
#make sure it does not end in a /, which can safely be removed |
2355
|
0
|
|
|
|
|
|
$gdir=~s/\/$//; |
2356
|
|
|
|
|
|
|
|
2357
|
|
|
|
|
|
|
#if we get here and it still has a period, we have an issue |
2358
|
0
|
0
|
|
|
|
|
if ( $gdir=~/^\./ ){ |
2359
|
0
|
|
|
|
|
|
$self->{error}=44; |
2360
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$gdirOrig.'" can not be used as a relative gallery directory as it starts with a period'; |
2361
|
0
|
|
|
|
|
|
$self->warn; |
2362
|
0
|
|
|
|
|
|
return undef; |
2363
|
|
|
|
|
|
|
} |
2364
|
|
|
|
|
|
|
|
2365
|
|
|
|
|
|
|
#splits the gdir apart |
2366
|
0
|
|
|
|
|
|
my @gdirSplit=split( /\//, $gdir); |
2367
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
#gets a Gallery object |
2369
|
0
|
|
|
|
|
|
my $tg; |
2370
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
2371
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
2372
|
0
|
|
|
|
|
|
$tg->dirSet( $self->{dir} ); |
2373
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
2374
|
0
|
|
|
|
|
|
$self->{error}=40; |
2375
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
2376
|
0
|
|
|
|
|
|
$self->warn; |
2377
|
0
|
|
|
|
|
|
return undef; |
2378
|
|
|
|
|
|
|
} |
2379
|
|
|
|
|
|
|
}else{ |
2380
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
2381
|
|
|
|
|
|
|
} |
2382
|
|
|
|
|
|
|
|
2383
|
|
|
|
|
|
|
#renders the gallery link |
2384
|
0
|
|
|
|
|
|
my $start=$self->{t}->fill_in( |
2385
|
|
|
|
|
|
|
'galleryLocationStart', |
2386
|
|
|
|
|
|
|
{ |
2387
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
2388
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
2389
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
2390
|
|
|
|
|
|
|
self=>\$self, |
2391
|
|
|
|
|
|
|
g=>\$self, |
2392
|
|
|
|
|
|
|
gdir=>$gdir, |
2393
|
|
|
|
|
|
|
} |
2394
|
|
|
|
|
|
|
); |
2395
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
2396
|
0
|
|
|
|
|
|
$self->{error}=10; |
2397
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
2398
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
2399
|
0
|
|
|
|
|
|
$self->warn; |
2400
|
0
|
|
|
|
|
|
return undef; |
2401
|
|
|
|
|
|
|
} |
2402
|
|
|
|
|
|
|
|
2403
|
|
|
|
|
|
|
#renders the gallery link |
2404
|
0
|
|
|
|
|
|
my $joiner=$self->{t}->fill_in( |
2405
|
|
|
|
|
|
|
'galleryLocationJoin', |
2406
|
|
|
|
|
|
|
{ |
2407
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
2408
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
2409
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
2410
|
|
|
|
|
|
|
self=>\$self, |
2411
|
|
|
|
|
|
|
g=>\$self, |
2412
|
|
|
|
|
|
|
gdir=>$gdir, |
2413
|
|
|
|
|
|
|
} |
2414
|
|
|
|
|
|
|
); |
2415
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
2416
|
0
|
|
|
|
|
|
$self->{error}=10; |
2417
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
2418
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
2419
|
0
|
|
|
|
|
|
$self->warn; |
2420
|
0
|
|
|
|
|
|
return undef; |
2421
|
|
|
|
|
|
|
} |
2422
|
|
|
|
|
|
|
|
2423
|
|
|
|
|
|
|
#the parts that will later be joined |
2424
|
0
|
|
|
|
|
|
my @parts; |
2425
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
#gets the url to use |
2427
|
0
|
|
|
|
|
|
my $url=$self->galleryDirURL( undef, undef ); |
2428
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
2429
|
0
|
|
|
|
|
|
$self->warnString('galleryDirURL errored'); |
2430
|
0
|
|
|
|
|
|
return undef; |
2431
|
|
|
|
|
|
|
} |
2432
|
|
|
|
|
|
|
|
2433
|
|
|
|
|
|
|
#renders the gallery link |
2434
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
2435
|
|
|
|
|
|
|
'galleryLocationPart', |
2436
|
|
|
|
|
|
|
{ |
2437
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
2438
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
2439
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
2440
|
|
|
|
|
|
|
self=>\$self, |
2441
|
|
|
|
|
|
|
g=>\$self, |
2442
|
|
|
|
|
|
|
gdir=>$gdir, |
2443
|
|
|
|
|
|
|
url=>$url, |
2444
|
|
|
|
|
|
|
text=>'root', |
2445
|
|
|
|
|
|
|
} |
2446
|
|
|
|
|
|
|
); |
2447
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
2448
|
0
|
|
|
|
|
|
$self->{error}=10; |
2449
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
2450
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
2451
|
0
|
|
|
|
|
|
$self->warn; |
2452
|
0
|
|
|
|
|
|
return undef; |
2453
|
|
|
|
|
|
|
} |
2454
|
0
|
|
|
|
|
|
push( @parts, $rendered ); |
2455
|
|
|
|
|
|
|
|
2456
|
|
|
|
|
|
|
#process each part |
2457
|
0
|
|
|
|
|
|
my $int=0; |
2458
|
0
|
|
|
|
|
|
my $currentGdir=''; |
2459
|
0
|
|
|
|
|
|
while( defined( $gdirSplit[$int] ) ){ |
2460
|
|
|
|
|
|
|
#gets the url to use |
2461
|
0
|
|
|
|
|
|
$currentGdir=$currentGdir.'/'.$gdirSplit[$int]; |
2462
|
0
|
|
|
|
|
|
$currentGdir=~s/\/\/*/\//g; |
2463
|
0
|
|
|
|
|
|
$currentGdir=~s/^\///; |
2464
|
|
|
|
|
|
|
|
2465
|
0
|
|
|
|
|
|
my $url=$self->galleryDirURL( undef, $currentGdir ); |
2466
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
2467
|
0
|
|
|
|
|
|
$self->warnString('galleryDirURL errored'); |
2468
|
0
|
|
|
|
|
|
return undef; |
2469
|
|
|
|
|
|
|
} |
2470
|
|
|
|
|
|
|
|
2471
|
|
|
|
|
|
|
#renders the gallery link |
2472
|
0
|
|
|
|
|
|
$rendered=$self->{t}->fill_in( |
2473
|
|
|
|
|
|
|
'galleryLocationPart', |
2474
|
|
|
|
|
|
|
{ |
2475
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
2476
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
2477
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
2478
|
|
|
|
|
|
|
self=>\$self, |
2479
|
|
|
|
|
|
|
g=>\$self, |
2480
|
|
|
|
|
|
|
gdir=>$gdir, |
2481
|
|
|
|
|
|
|
url=>$url, |
2482
|
|
|
|
|
|
|
text=>$gdirSplit[$int], |
2483
|
|
|
|
|
|
|
} |
2484
|
|
|
|
|
|
|
); |
2485
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
2486
|
0
|
|
|
|
|
|
$self->{error}=10; |
2487
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
2488
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
2489
|
0
|
|
|
|
|
|
$self->warn; |
2490
|
0
|
|
|
|
|
|
return undef; |
2491
|
|
|
|
|
|
|
} |
2492
|
0
|
|
|
|
|
|
push( @parts, $rendered ); |
2493
|
|
|
|
|
|
|
|
2494
|
0
|
|
|
|
|
|
$int++; |
2495
|
|
|
|
|
|
|
} |
2496
|
|
|
|
|
|
|
|
2497
|
|
|
|
|
|
|
#renders the gallery link |
2498
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
2499
|
|
|
|
|
|
|
'galleryLocationEnd', |
2500
|
|
|
|
|
|
|
{ |
2501
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
2502
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
2503
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
2504
|
|
|
|
|
|
|
self=>\$self, |
2505
|
|
|
|
|
|
|
g=>\$self, |
2506
|
|
|
|
|
|
|
gdir=>$gdir, |
2507
|
|
|
|
|
|
|
} |
2508
|
|
|
|
|
|
|
); |
2509
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
2510
|
0
|
|
|
|
|
|
$self->{error}=10; |
2511
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
2512
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
2513
|
0
|
|
|
|
|
|
$self->warn; |
2514
|
0
|
|
|
|
|
|
return undef; |
2515
|
|
|
|
|
|
|
} |
2516
|
|
|
|
|
|
|
|
2517
|
|
|
|
|
|
|
#handles a specified image... |
2518
|
0
|
|
|
|
|
|
my $imageLine=''; |
2519
|
0
|
0
|
|
|
|
|
if ( defined( $image ) ){ |
2520
|
0
|
|
|
|
|
|
my $url=$self->galleryLargeURL( undef, $gdir, $image ); |
2521
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
2522
|
0
|
|
|
|
|
|
$self->warnString('galleryDirURL errored'); |
2523
|
0
|
|
|
|
|
|
return undef; |
2524
|
|
|
|
|
|
|
} |
2525
|
|
|
|
|
|
|
|
2526
|
|
|
|
|
|
|
#renders the image link |
2527
|
0
|
|
|
|
|
|
$imageLine=$self->{t}->fill_in( |
2528
|
|
|
|
|
|
|
'galleryLocationImage', |
2529
|
|
|
|
|
|
|
{ |
2530
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
2531
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
2532
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
2533
|
|
|
|
|
|
|
self=>\$self, |
2534
|
|
|
|
|
|
|
g=>\$self, |
2535
|
|
|
|
|
|
|
gdir=>$gdir, |
2536
|
|
|
|
|
|
|
image=>$image, |
2537
|
|
|
|
|
|
|
url=>$url, |
2538
|
|
|
|
|
|
|
} |
2539
|
|
|
|
|
|
|
); |
2540
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
2541
|
0
|
|
|
|
|
|
$self->{error}=10; |
2542
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
2543
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
2544
|
0
|
|
|
|
|
|
$self->warn; |
2545
|
0
|
|
|
|
|
|
return undef; |
2546
|
|
|
|
|
|
|
} |
2547
|
|
|
|
|
|
|
|
2548
|
|
|
|
|
|
|
} |
2549
|
|
|
|
|
|
|
|
2550
|
0
|
|
|
|
|
|
return $start.join( $joiner, @parts ).$end.$imageLine; |
2551
|
|
|
|
|
|
|
} |
2552
|
|
|
|
|
|
|
|
2553
|
|
|
|
|
|
|
=head2 gallerySmallImageURL |
2554
|
|
|
|
|
|
|
|
2555
|
|
|
|
|
|
|
This returns the URL for the small gallery image. |
2556
|
|
|
|
|
|
|
|
2557
|
|
|
|
|
|
|
Three arguments are accepted. The first is the Toader |
2558
|
|
|
|
|
|
|
directory to for the gallery, if not specified it uses |
2559
|
|
|
|
|
|
|
the Toader directory for the current object. The |
2560
|
|
|
|
|
|
|
second is the relative gallery directory, which if not |
2561
|
|
|
|
|
|
|
specified defaults to the '', the root gallery directory. |
2562
|
|
|
|
|
|
|
The third is the image in that directory. |
2563
|
|
|
|
|
|
|
|
2564
|
|
|
|
|
|
|
[== $g->gallerySmallImageURL; ==] |
2565
|
|
|
|
|
|
|
|
2566
|
|
|
|
|
|
|
=cut |
2567
|
|
|
|
|
|
|
|
2568
|
|
|
|
|
|
|
sub gallerySmallImageURL{ |
2569
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2570
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
2571
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
2572
|
0
|
|
|
|
|
|
my $image=$_[3]; |
2573
|
|
|
|
|
|
|
|
2574
|
|
|
|
|
|
|
#blank any previous errors |
2575
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2576
|
0
|
|
|
|
|
|
return undef; |
2577
|
|
|
|
|
|
|
} |
2578
|
|
|
|
|
|
|
|
2579
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
2580
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
2581
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
2582
|
|
|
|
|
|
|
} |
2583
|
|
|
|
|
|
|
|
2584
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
2585
|
0
|
|
|
|
|
|
$gdir=''; |
2586
|
|
|
|
|
|
|
} |
2587
|
|
|
|
|
|
|
|
2588
|
|
|
|
|
|
|
#puts together the full path |
2589
|
0
|
|
|
|
|
|
my $toaderDir=$self->{toader}->getRootDir.'/'.$dir; |
2590
|
|
|
|
|
|
|
|
2591
|
|
|
|
|
|
|
#gets a Gallery object |
2592
|
0
|
|
|
|
|
|
my $tg; |
2593
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
2594
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
2595
|
0
|
|
|
|
|
|
$tg->dirSet( $toaderDir ); |
2596
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
2597
|
0
|
|
|
|
|
|
$self->{error}=40; |
2598
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
2599
|
0
|
|
|
|
|
|
$self->warn; |
2600
|
0
|
|
|
|
|
|
return undef; |
2601
|
|
|
|
|
|
|
} |
2602
|
|
|
|
|
|
|
}else{ |
2603
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
2604
|
|
|
|
|
|
|
} |
2605
|
|
|
|
|
|
|
|
2606
|
|
|
|
|
|
|
#gets the output URL |
2607
|
0
|
|
|
|
|
|
my $outputURL=$tg->outputURLget; |
2608
|
0
|
0
|
|
|
|
|
if ( ! defined( $outputURL ) ){ |
2609
|
0
|
|
|
|
|
|
$self->{error}=41; |
2610
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the output URL for Toader::Gallery for "'.$dir.'"'; |
2611
|
0
|
|
|
|
|
|
$self->warn; |
2612
|
0
|
|
|
|
|
|
return undef; |
2613
|
|
|
|
|
|
|
} |
2614
|
|
|
|
|
|
|
|
2615
|
0
|
|
|
|
|
|
my $url='.toader-gallery/small/'.$gdir.'/'.$image; |
2616
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
2617
|
0
|
|
|
|
|
|
return $outputURL.$url; |
2618
|
|
|
|
|
|
|
} |
2619
|
|
|
|
|
|
|
|
2620
|
|
|
|
|
|
|
=head2 galleryLink |
2621
|
|
|
|
|
|
|
|
2622
|
|
|
|
|
|
|
This links to a Toader::Gallery gallery. |
2623
|
|
|
|
|
|
|
|
2624
|
|
|
|
|
|
|
There are three optional arguments taken. The first is Toader |
2625
|
|
|
|
|
|
|
directory this is for, if it is not specified, it assumes |
2626
|
|
|
|
|
|
|
it is the current one. The second is the second one is the directory |
2627
|
|
|
|
|
|
|
under it that it should link to, which defaults to the root of it |
2628
|
|
|
|
|
|
|
if none is specified. The third is text of the link, which defaults |
2629
|
|
|
|
|
|
|
to 'Gallery' if not specified. |
2630
|
|
|
|
|
|
|
|
2631
|
|
|
|
|
|
|
[== $g->galleryLink( undef, $gdir, $text ); ==] |
2632
|
|
|
|
|
|
|
|
2633
|
|
|
|
|
|
|
The template used is 'linkGallery'. It is as below. |
2634
|
|
|
|
|
|
|
|
2635
|
|
|
|
|
|
|
[== $text ==] |
2636
|
|
|
|
|
|
|
|
2637
|
|
|
|
|
|
|
The variables passed are as below. |
2638
|
|
|
|
|
|
|
|
2639
|
|
|
|
|
|
|
url - This is the relative URL for this. |
2640
|
|
|
|
|
|
|
text - This to use for with the link. |
2641
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2642
|
|
|
|
|
|
|
self - The L object. |
2643
|
|
|
|
|
|
|
toader - This is a L object. |
2644
|
|
|
|
|
|
|
g - This is a L object. |
2645
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
2646
|
|
|
|
|
|
|
|
2647
|
|
|
|
|
|
|
=cut |
2648
|
|
|
|
|
|
|
|
2649
|
|
|
|
|
|
|
sub galleryLink{ |
2650
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2651
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
2652
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
2653
|
0
|
|
|
|
|
|
my $text=$_[3]; |
2654
|
|
|
|
|
|
|
|
2655
|
|
|
|
|
|
|
|
2656
|
|
|
|
|
|
|
#blank any previous errors |
2657
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2658
|
0
|
|
|
|
|
|
return undef; |
2659
|
|
|
|
|
|
|
} |
2660
|
|
|
|
|
|
|
|
2661
|
|
|
|
|
|
|
#default to the root if nothing is defined for the directory under the gallery |
2662
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
2663
|
0
|
|
|
|
|
|
$gdir=''; |
2664
|
|
|
|
|
|
|
} |
2665
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
#sets the default text if needed... |
2667
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
2668
|
0
|
|
|
|
|
|
$text='Gallery'; |
2669
|
|
|
|
|
|
|
} |
2670
|
|
|
|
|
|
|
|
2671
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
2672
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
2673
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
2674
|
|
|
|
|
|
|
} |
2675
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
#turns the relative directory into a full path and clean it up |
2677
|
0
|
|
|
|
|
|
$dir=$self->{toader}->getRootDir.'/'.$dir; |
2678
|
0
|
|
|
|
|
|
$dir=$self->{ph}->cleanup( $dir ); |
2679
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
2680
|
0
|
|
|
|
|
|
$self->{error}=39; |
2681
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to clean up the path for "'.$dir.'"'; |
2682
|
0
|
|
|
|
|
|
$self->warn; |
2683
|
0
|
|
|
|
|
|
return undef; |
2684
|
|
|
|
|
|
|
} |
2685
|
|
|
|
|
|
|
|
2686
|
|
|
|
|
|
|
#gets a Gallery object |
2687
|
0
|
|
|
|
|
|
my $tg; |
2688
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
2689
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
2690
|
0
|
|
|
|
|
|
$tg->dirSet( $dir ); |
2691
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
2692
|
0
|
|
|
|
|
|
$self->{error}=40; |
2693
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
2694
|
0
|
|
|
|
|
|
$self->warn; |
2695
|
0
|
|
|
|
|
|
return undef; |
2696
|
|
|
|
|
|
|
} |
2697
|
|
|
|
|
|
|
}else{ |
2698
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
2699
|
|
|
|
|
|
|
} |
2700
|
|
|
|
|
|
|
|
2701
|
|
|
|
|
|
|
#gets the output URL |
2702
|
0
|
|
|
|
|
|
my $outputURL=$tg->outputURLget; |
2703
|
0
|
0
|
|
|
|
|
if ( ! defined( $outputURL ) ){ |
2704
|
0
|
|
|
|
|
|
$self->{error}=41; |
2705
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the output directory for Toader::Gallery for "'.$dir.'"'; |
2706
|
0
|
|
|
|
|
|
$self->warn; |
2707
|
0
|
|
|
|
|
|
return undef; |
2708
|
|
|
|
|
|
|
} |
2709
|
|
|
|
|
|
|
|
2710
|
|
|
|
|
|
|
#makes the URL for what is being linked to |
2711
|
0
|
|
|
|
|
|
my $link='.toader-gallery/html/'.$gdir; |
2712
|
0
|
|
|
|
|
|
$link=~s/\/\/*/\//g; |
2713
|
0
|
|
|
|
|
|
$link=$outputURL.$link; |
2714
|
|
|
|
|
|
|
|
2715
|
|
|
|
|
|
|
#renders the gallery link |
2716
|
0
|
|
|
|
|
|
my $galleryLink=$self->{t}->fill_in( |
2717
|
|
|
|
|
|
|
'linkGallery', |
2718
|
|
|
|
|
|
|
{ |
2719
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
2720
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
2721
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
2722
|
|
|
|
|
|
|
self=>\$self, |
2723
|
|
|
|
|
|
|
g=>\$self, |
2724
|
|
|
|
|
|
|
url=>$link, |
2725
|
|
|
|
|
|
|
text=>$text, |
2726
|
|
|
|
|
|
|
} |
2727
|
|
|
|
|
|
|
); |
2728
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
2729
|
0
|
|
|
|
|
|
$self->{error}=10; |
2730
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
2731
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
2732
|
0
|
|
|
|
|
|
$self->warn; |
2733
|
0
|
|
|
|
|
|
return undef; |
2734
|
|
|
|
|
|
|
} |
2735
|
|
|
|
|
|
|
|
2736
|
0
|
|
|
|
|
|
return $galleryLink; |
2737
|
|
|
|
|
|
|
} |
2738
|
|
|
|
|
|
|
|
2739
|
|
|
|
|
|
|
=head2 gallerySrcURL |
2740
|
|
|
|
|
|
|
|
2741
|
|
|
|
|
|
|
This returns the URL for the source gallery image. |
2742
|
|
|
|
|
|
|
|
2743
|
|
|
|
|
|
|
Three arguments are accepted. The first is the Toader |
2744
|
|
|
|
|
|
|
directory to for the gallery, if not specified it uses |
2745
|
|
|
|
|
|
|
the Toader directory for the current object. The |
2746
|
|
|
|
|
|
|
second is the relative gallery directory, which if not |
2747
|
|
|
|
|
|
|
specified defaults to the '', the root gallery directory. |
2748
|
|
|
|
|
|
|
The third is the image in that directory. |
2749
|
|
|
|
|
|
|
|
2750
|
|
|
|
|
|
|
[== $g->gallerySrcURL( undef, $gdir, $image ); ==] |
2751
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
=cut |
2753
|
|
|
|
|
|
|
|
2754
|
|
|
|
|
|
|
sub gallerySrcURL{ |
2755
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2756
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
2757
|
0
|
|
|
|
|
|
my $gdir=$_[2]; |
2758
|
0
|
|
|
|
|
|
my $image=$_[3]; |
2759
|
|
|
|
|
|
|
|
2760
|
|
|
|
|
|
|
#blank any previous errors |
2761
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2762
|
0
|
|
|
|
|
|
return undef; |
2763
|
|
|
|
|
|
|
} |
2764
|
|
|
|
|
|
|
|
2765
|
|
|
|
|
|
|
#gets the directory to use if none is specified |
2766
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
2767
|
0
|
|
|
|
|
|
$dir=$self->{r2r}; |
2768
|
|
|
|
|
|
|
} |
2769
|
|
|
|
|
|
|
|
2770
|
0
|
0
|
|
|
|
|
if ( ! defined( $gdir ) ){ |
2771
|
0
|
|
|
|
|
|
$gdir=''; |
2772
|
|
|
|
|
|
|
} |
2773
|
|
|
|
|
|
|
|
2774
|
|
|
|
|
|
|
#puts together the full path |
2775
|
0
|
|
|
|
|
|
my $toaderDir=$self->{toader}->getRootDir.'/'.$dir; |
2776
|
|
|
|
|
|
|
|
2777
|
|
|
|
|
|
|
#gets a Gallery object |
2778
|
0
|
|
|
|
|
|
my $tg; |
2779
|
0
|
0
|
|
|
|
|
if ( ref( $self->{obj} ) ne 'Toader::Gallery' ){ |
2780
|
0
|
|
|
|
|
|
$tg=Toader::Gallery->new; |
2781
|
0
|
|
|
|
|
|
$tg->dirSet( $toaderDir ); |
2782
|
0
|
0
|
|
|
|
|
if ( $tg->error ){ |
2783
|
0
|
|
|
|
|
|
$self->{error}=40; |
2784
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Gallery'; |
2785
|
0
|
|
|
|
|
|
$self->warn; |
2786
|
0
|
|
|
|
|
|
return undef; |
2787
|
|
|
|
|
|
|
} |
2788
|
|
|
|
|
|
|
}else{ |
2789
|
0
|
|
|
|
|
|
$tg=$self->{obj}; |
2790
|
|
|
|
|
|
|
} |
2791
|
|
|
|
|
|
|
|
2792
|
|
|
|
|
|
|
#gets the output URL |
2793
|
0
|
|
|
|
|
|
my $srcURL=$tg->srcURLget; |
2794
|
0
|
0
|
|
|
|
|
if ( ! defined( $srcURL ) ){ |
2795
|
0
|
|
|
|
|
|
$self->{error}=45; |
2796
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the source URL for Toader::Gallery for "'.$dir.'"'; |
2797
|
0
|
|
|
|
|
|
$self->warn; |
2798
|
0
|
|
|
|
|
|
return undef; |
2799
|
|
|
|
|
|
|
} |
2800
|
|
|
|
|
|
|
|
2801
|
0
|
|
|
|
|
|
my $url=$gdir.'/'.$image; |
2802
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
2803
|
0
|
|
|
|
|
|
return $srcURL.$url; |
2804
|
|
|
|
|
|
|
} |
2805
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
=head2 hasDocs |
2807
|
|
|
|
|
|
|
|
2808
|
|
|
|
|
|
|
This returns true if the current directory has any |
2809
|
|
|
|
|
|
|
documentation. |
2810
|
|
|
|
|
|
|
|
2811
|
|
|
|
|
|
|
if ( $g->hasDocs ){ |
2812
|
|
|
|
|
|
|
print "This directory has documentation..."; |
2813
|
|
|
|
|
|
|
} |
2814
|
|
|
|
|
|
|
|
2815
|
|
|
|
|
|
|
=cut |
2816
|
|
|
|
|
|
|
|
2817
|
|
|
|
|
|
|
sub hasDocs{ |
2818
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2819
|
|
|
|
|
|
|
|
2820
|
|
|
|
|
|
|
#blank any previous errors |
2821
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2822
|
0
|
|
|
|
|
|
return undef; |
2823
|
|
|
|
|
|
|
} |
2824
|
|
|
|
|
|
|
|
2825
|
|
|
|
|
|
|
#returns true if there is a autodoc directory for the current Toader directory |
2826
|
0
|
0
|
|
|
|
|
if ( -d $self->{odir}.'/.toader/autodoc/' ){ |
2827
|
0
|
|
|
|
|
|
return 1; |
2828
|
|
|
|
|
|
|
} |
2829
|
|
|
|
|
|
|
|
2830
|
0
|
|
|
|
|
|
return 0; |
2831
|
|
|
|
|
|
|
} |
2832
|
|
|
|
|
|
|
|
2833
|
|
|
|
|
|
|
=head2 hasEntries |
2834
|
|
|
|
|
|
|
|
2835
|
|
|
|
|
|
|
Check if a entries directory exists for the |
2836
|
|
|
|
|
|
|
Toader directory for the current object. |
2837
|
|
|
|
|
|
|
|
2838
|
|
|
|
|
|
|
A boolean value is returned. |
2839
|
|
|
|
|
|
|
|
2840
|
|
|
|
|
|
|
my $hasEntries=$g->hasEntries; |
2841
|
|
|
|
|
|
|
|
2842
|
|
|
|
|
|
|
=cut |
2843
|
|
|
|
|
|
|
|
2844
|
|
|
|
|
|
|
sub hasEntries{ |
2845
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2846
|
|
|
|
|
|
|
|
2847
|
|
|
|
|
|
|
#blank any previous errors |
2848
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2849
|
0
|
|
|
|
|
|
return undef; |
2850
|
|
|
|
|
|
|
} |
2851
|
|
|
|
|
|
|
|
2852
|
|
|
|
|
|
|
#returns true if there is a entries directory for the current Toader directory |
2853
|
0
|
0
|
|
|
|
|
if ( -d $self->{odir}.'/.toader/entries/' ){ |
2854
|
0
|
|
|
|
|
|
return 1; |
2855
|
|
|
|
|
|
|
} |
2856
|
|
|
|
|
|
|
|
2857
|
0
|
|
|
|
|
|
return 0; |
2858
|
|
|
|
|
|
|
} |
2859
|
|
|
|
|
|
|
|
2860
|
|
|
|
|
|
|
=head2 hasGallery |
2861
|
|
|
|
|
|
|
|
2862
|
|
|
|
|
|
|
This returns true if the current Toader directory has a gallery. |
2863
|
|
|
|
|
|
|
|
2864
|
|
|
|
|
|
|
This is checked for by seeing if the gallery config exists. |
2865
|
|
|
|
|
|
|
|
2866
|
|
|
|
|
|
|
=cut |
2867
|
|
|
|
|
|
|
|
2868
|
|
|
|
|
|
|
sub hasGallery{ |
2869
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2870
|
|
|
|
|
|
|
|
2871
|
|
|
|
|
|
|
#blank any previous errors |
2872
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2873
|
0
|
|
|
|
|
|
return undef; |
2874
|
|
|
|
|
|
|
} |
2875
|
|
|
|
|
|
|
|
2876
|
|
|
|
|
|
|
#returns true if there is a autodoc directory for the current Toader directory |
2877
|
0
|
0
|
|
|
|
|
if ( -f $self->{odir}.'/.toader/gallery.ini' ){ |
2878
|
0
|
|
|
|
|
|
return 1; |
2879
|
|
|
|
|
|
|
} |
2880
|
|
|
|
|
|
|
|
2881
|
0
|
|
|
|
|
|
return 0; |
2882
|
|
|
|
|
|
|
} |
2883
|
|
|
|
|
|
|
|
2884
|
|
|
|
|
|
|
=head2 hasAnyDirs |
2885
|
|
|
|
|
|
|
|
2886
|
|
|
|
|
|
|
This returns true if there are either Toader sub directories or |
2887
|
|
|
|
|
|
|
it is not at root. |
2888
|
|
|
|
|
|
|
|
2889
|
|
|
|
|
|
|
if ( $g->hasAnyDirs ){ |
2890
|
|
|
|
|
|
|
print "Either not at root or there are Toader sub directires..."; |
2891
|
|
|
|
|
|
|
} |
2892
|
|
|
|
|
|
|
|
2893
|
|
|
|
|
|
|
=cut |
2894
|
|
|
|
|
|
|
|
2895
|
|
|
|
|
|
|
sub hasAnyDirs{ |
2896
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
2897
|
|
|
|
|
|
|
|
2898
|
|
|
|
|
|
|
#blank any previous errors |
2899
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
2900
|
0
|
|
|
|
|
|
return undef; |
2901
|
|
|
|
|
|
|
} |
2902
|
|
|
|
|
|
|
|
2903
|
0
|
|
|
|
|
|
my $subs=$self->hasSubDirs; |
2904
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
2905
|
0
|
|
|
|
|
|
$self->warnString('Failed to check if the directory has any Toader sub directories'); |
2906
|
0
|
|
|
|
|
|
return undef; |
2907
|
|
|
|
|
|
|
} |
2908
|
|
|
|
|
|
|
|
2909
|
|
|
|
|
|
|
#return 1 as there are directories |
2910
|
0
|
0
|
|
|
|
|
if ( $subs ){ |
2911
|
0
|
|
|
|
|
|
return 1; |
2912
|
|
|
|
|
|
|
} |
2913
|
|
|
|
|
|
|
|
2914
|
|
|
|
|
|
|
#if we are at root and there no Toader sub directories then this is the only Toader directory |
2915
|
0
|
0
|
|
|
|
|
if ( $self->atRoot ){ |
2916
|
0
|
|
|
|
|
|
return 0; |
2917
|
|
|
|
|
|
|
} |
2918
|
|
|
|
|
|
|
|
2919
|
|
|
|
|
|
|
#we are not at root then there is a directory that can be go gone to |
2920
|
0
|
|
|
|
|
|
return 1; |
2921
|
|
|
|
|
|
|
} |
2922
|
|
|
|
|
|
|
|
2923
|
|
|
|
|
|
|
=head2 hashToTable |
2924
|
|
|
|
|
|
|
|
2925
|
|
|
|
|
|
|
This renders a hash to a table. |
2926
|
|
|
|
|
|
|
|
2927
|
|
|
|
|
|
|
Four arguments are taken. The first and required a hash |
2928
|
|
|
|
|
|
|
reference to operate on. The second and optional is the title |
2929
|
|
|
|
|
|
|
to use for the key column. The third and optional is the title |
2930
|
|
|
|
|
|
|
to use for the value column. The fourth and optional is the |
2931
|
|
|
|
|
|
|
CSS ID to use, which defaults to to "hashToTable". |
2932
|
|
|
|
|
|
|
|
2933
|
|
|
|
|
|
|
my $table=$foo->hashToTable( \%hash ); |
2934
|
|
|
|
|
|
|
|
2935
|
|
|
|
|
|
|
=head3 Templates |
2936
|
|
|
|
|
|
|
|
2937
|
|
|
|
|
|
|
=head4 hashToTableBegin |
2938
|
|
|
|
|
|
|
|
2939
|
|
|
|
|
|
|
This begins the table. |
2940
|
|
|
|
|
|
|
|
2941
|
|
|
|
|
|
|
The default is as below. |
2942
|
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
2944
|
|
|
|
|
|
|
|
2945
|
|
|
|
|
|
|
|
2946
|
|
|
|
|
|
|
The passed variables are as below. |
2947
|
|
|
|
|
|
|
|
2948
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
2949
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
2950
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
2951
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2952
|
|
|
|
|
|
|
toader - This is a L object. |
2953
|
|
|
|
|
|
|
self - This the L object. |
2954
|
|
|
|
|
|
|
g - This the L object. |
2955
|
|
|
|
|
|
|
cssID - The CSS ID to use. |
2956
|
|
|
|
|
|
|
|
2957
|
|
|
|
|
|
|
=head4 hashToTableTitle |
2958
|
|
|
|
|
|
|
|
2959
|
|
|
|
|
|
|
This is a row that acts as the title row at the top of the table. |
2960
|
|
|
|
|
|
|
|
2961
|
|
|
|
|
|
|
It is only rendered if a title is defined for either key or value. |
2962
|
|
|
|
|
|
|
|
2963
|
|
|
|
|
|
|
The default is as below. |
2964
|
|
|
|
|
|
|
|
2965
|
|
|
|
|
|
|
|
2966
|
|
|
|
|
|
|
| [== $keyTitle ==] |
2967
|
|
|
|
|
|
|
| [== $valueTitle ==] |
2968
|
|
|
|
|
|
|
|
2969
|
|
|
|
|
|
|
|
2970
|
|
|
|
|
|
|
|
2971
|
|
|
|
|
|
|
The passed variables are as below. |
2972
|
|
|
|
|
|
|
|
2973
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
2974
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
2975
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
2976
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
2977
|
|
|
|
|
|
|
toader - This is a L object. |
2978
|
|
|
|
|
|
|
self - This the L object. |
2979
|
|
|
|
|
|
|
g - This the L object. |
2980
|
|
|
|
|
|
|
cssID - The CSS ID to use. |
2981
|
|
|
|
|
|
|
keyTitle - The title to use for the key column. |
2982
|
|
|
|
|
|
|
valueTitle - The title to use for th value column. |
2983
|
|
|
|
|
|
|
|
2984
|
|
|
|
|
|
|
=head4 hashToTableRow |
2985
|
|
|
|
|
|
|
|
2986
|
|
|
|
|
|
|
This represents a row containing a key/value pair. |
2987
|
|
|
|
|
|
|
|
2988
|
|
|
|
|
|
|
The default is as below. |
2989
|
|
|
|
|
|
|
|
2990
|
|
|
|
|
|
|
|
2991
|
|
|
|
|
|
|
| [== $key ==] |
2992
|
|
|
|
|
|
|
| [== $value ==] |
2993
|
|
|
|
|
|
|
|
2994
|
|
|
|
|
|
|
|
2995
|
|
|
|
|
|
|
|
2996
|
|
|
|
|
|
|
The passed variables are as below. |
2997
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
2999
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3000
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
3001
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3002
|
|
|
|
|
|
|
toader - This is a L object. |
3003
|
|
|
|
|
|
|
self - This the L object. |
3004
|
|
|
|
|
|
|
g - This the L object. |
3005
|
|
|
|
|
|
|
cssID - The CSS ID to use. |
3006
|
|
|
|
|
|
|
key - The key for the row. |
3007
|
|
|
|
|
|
|
value - The value for the row. |
3008
|
|
|
|
|
|
|
|
3009
|
|
|
|
|
|
|
=head4 hashToTableJoin |
3010
|
|
|
|
|
|
|
|
3011
|
|
|
|
|
|
|
This joins together the rendered rows. |
3012
|
|
|
|
|
|
|
|
3013
|
|
|
|
|
|
|
The default is as below. |
3014
|
|
|
|
|
|
|
|
3015
|
|
|
|
|
|
|
|
3016
|
|
|
|
|
|
|
|
3017
|
|
|
|
|
|
|
The passed variables are as below. |
3018
|
|
|
|
|
|
|
|
3019
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3020
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3021
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
3022
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3023
|
|
|
|
|
|
|
toader - This is a L object. |
3024
|
|
|
|
|
|
|
self - This the L object. |
3025
|
|
|
|
|
|
|
g - This the L object. |
3026
|
|
|
|
|
|
|
cssID - The CSS ID to use. |
3027
|
|
|
|
|
|
|
|
3028
|
|
|
|
|
|
|
=head4 hashToTableEnd |
3029
|
|
|
|
|
|
|
|
3030
|
|
|
|
|
|
|
This ends the table. |
3031
|
|
|
|
|
|
|
|
3032
|
|
|
|
|
|
|
The default is as below. |
3033
|
|
|
|
|
|
|
|
3034
|
|
|
|
|
|
|
| |
3035
|
|
|
|
|
|
|
|
3036
|
|
|
|
|
|
|
The passed variables are as below. |
3037
|
|
|
|
|
|
|
|
3038
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3039
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3040
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
3041
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3042
|
|
|
|
|
|
|
toader - This is a L object. |
3043
|
|
|
|
|
|
|
self - This the L object. |
3044
|
|
|
|
|
|
|
g - This the L object. |
3045
|
|
|
|
|
|
|
cssID - The CSS ID to use. |
3046
|
|
|
|
|
|
|
|
3047
|
|
|
|
|
|
|
=cut |
3048
|
|
|
|
|
|
|
|
3049
|
|
|
|
|
|
|
sub hashToTable{ |
3050
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
3051
|
0
|
|
|
|
|
|
my $hash=$_[1]; |
3052
|
0
|
|
|
|
|
|
my $keyTitle=$_[2]; |
3053
|
0
|
|
|
|
|
|
my $valueTitle=$_[3]; |
3054
|
0
|
|
|
|
|
|
my $cssID=$_[4]; |
3055
|
|
|
|
|
|
|
|
3056
|
|
|
|
|
|
|
#blank any previous errors |
3057
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
3058
|
0
|
|
|
|
|
|
return undef; |
3059
|
|
|
|
|
|
|
} |
3060
|
|
|
|
|
|
|
|
3061
|
|
|
|
|
|
|
#sets the default CSS ID if none is given |
3062
|
0
|
0
|
|
|
|
|
if( !defined( $cssID ) ){ |
3063
|
0
|
|
|
|
|
|
$cssID='hashToTable'; |
3064
|
|
|
|
|
|
|
} |
3065
|
|
|
|
|
|
|
|
3066
|
|
|
|
|
|
|
#checks if it has a column title bar for either |
3067
|
0
|
|
|
|
|
|
my $titleRow=''; |
3068
|
0
|
|
|
|
|
|
my $renderTitleRow=0; |
3069
|
0
|
0
|
0
|
|
|
|
if ( |
3070
|
|
|
|
|
|
|
defined( $keyTitle ) || |
3071
|
|
|
|
|
|
|
defined( $valueTitle ) |
3072
|
|
|
|
|
|
|
){ |
3073
|
0
|
0
|
|
|
|
|
if ( ! defined( $keyTitle ) ){ |
3074
|
0
|
|
|
|
|
|
$keyTitle=''; |
3075
|
|
|
|
|
|
|
} |
3076
|
0
|
0
|
|
|
|
|
if ( ! defined( $valueTitle ) ){ |
3077
|
0
|
|
|
|
|
|
$valueTitle=''; |
3078
|
|
|
|
|
|
|
} |
3079
|
0
|
|
|
|
|
|
$renderTitleRow=1; |
3080
|
|
|
|
|
|
|
} |
3081
|
|
|
|
|
|
|
|
3082
|
|
|
|
|
|
|
#renders the title row if needed... |
3083
|
0
|
0
|
|
|
|
|
if ( $renderTitleRow ){ |
3084
|
0
|
|
|
|
|
|
$titleRow=$self->{t}->fill_in( |
3085
|
|
|
|
|
|
|
'hashToTableTitle', |
3086
|
|
|
|
|
|
|
{ |
3087
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3088
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3089
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3090
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3091
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3092
|
|
|
|
|
|
|
self=>\$self, |
3093
|
|
|
|
|
|
|
g=>\$self, |
3094
|
|
|
|
|
|
|
cssID=>$cssID, |
3095
|
|
|
|
|
|
|
keyTitle=>$keyTitle, |
3096
|
|
|
|
|
|
|
valueTitle=>$valueTitle, |
3097
|
|
|
|
|
|
|
} |
3098
|
|
|
|
|
|
|
); |
3099
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3100
|
0
|
|
|
|
|
|
$self->{error}=10; |
3101
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3102
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3103
|
0
|
|
|
|
|
|
$self->warn; |
3104
|
0
|
|
|
|
|
|
return undef; |
3105
|
|
|
|
|
|
|
} |
3106
|
|
|
|
|
|
|
} |
3107
|
|
|
|
|
|
|
|
3108
|
|
|
|
|
|
|
#renders the top of the table |
3109
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
3110
|
|
|
|
|
|
|
'hashToTableBegin', |
3111
|
|
|
|
|
|
|
{ |
3112
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3113
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3114
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3115
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3116
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3117
|
|
|
|
|
|
|
self=>\$self, |
3118
|
|
|
|
|
|
|
g=>\$self, |
3119
|
|
|
|
|
|
|
cssID=>$cssID, |
3120
|
|
|
|
|
|
|
} |
3121
|
|
|
|
|
|
|
); |
3122
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3123
|
0
|
|
|
|
|
|
$self->{error}=10; |
3124
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3125
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3126
|
0
|
|
|
|
|
|
$self->warn; |
3127
|
0
|
|
|
|
|
|
return undef; |
3128
|
|
|
|
|
|
|
} |
3129
|
|
|
|
|
|
|
|
3130
|
|
|
|
|
|
|
#renders the bottom of the table |
3131
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
3132
|
|
|
|
|
|
|
'hashToTableEnd', |
3133
|
|
|
|
|
|
|
{ |
3134
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3135
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3136
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3137
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3138
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3139
|
|
|
|
|
|
|
self=>\$self, |
3140
|
|
|
|
|
|
|
g=>\$self, |
3141
|
|
|
|
|
|
|
cssID=>$cssID, |
3142
|
|
|
|
|
|
|
} |
3143
|
|
|
|
|
|
|
); |
3144
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3145
|
0
|
|
|
|
|
|
$self->{error}=10; |
3146
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3147
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3148
|
0
|
|
|
|
|
|
$self->warn; |
3149
|
0
|
|
|
|
|
|
return undef; |
3150
|
|
|
|
|
|
|
} |
3151
|
|
|
|
|
|
|
|
3152
|
|
|
|
|
|
|
#renders the row joiner |
3153
|
0
|
|
|
|
|
|
my $join=$self->{t}->fill_in( |
3154
|
|
|
|
|
|
|
'hashToTableJoin', |
3155
|
|
|
|
|
|
|
{ |
3156
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3157
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3158
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3159
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3160
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3161
|
|
|
|
|
|
|
self=>\$self, |
3162
|
|
|
|
|
|
|
g=>\$self, |
3163
|
|
|
|
|
|
|
cssID=>$cssID, |
3164
|
|
|
|
|
|
|
} |
3165
|
|
|
|
|
|
|
); |
3166
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3167
|
0
|
|
|
|
|
|
$self->{error}=10; |
3168
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3169
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3170
|
0
|
|
|
|
|
|
$self->warn; |
3171
|
0
|
|
|
|
|
|
return undef; |
3172
|
|
|
|
|
|
|
} |
3173
|
|
|
|
|
|
|
|
3174
|
|
|
|
|
|
|
#renders each row |
3175
|
0
|
|
|
|
|
|
my @keys=sort {uc($a) cmp uc($b)} keys( %$hash ); |
|
0
|
|
|
|
|
|
|
3176
|
0
|
|
|
|
|
|
my @rows; |
3177
|
0
|
|
|
|
|
|
my $int=0; |
3178
|
0
|
|
|
|
|
|
while( defined( $keys[$int] ) ){ |
3179
|
0
|
|
|
|
|
|
my $row=$self->{t}->fill_in( |
3180
|
|
|
|
|
|
|
'hashToTableRow', |
3181
|
|
|
|
|
|
|
{ |
3182
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3183
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3184
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3185
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3186
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3187
|
|
|
|
|
|
|
self=>\$self, |
3188
|
|
|
|
|
|
|
g=>\$self, |
3189
|
|
|
|
|
|
|
cssID=>$cssID, |
3190
|
|
|
|
|
|
|
key=>$keys[$int], |
3191
|
|
|
|
|
|
|
value=>$hash->{$keys[$int]}, |
3192
|
|
|
|
|
|
|
} |
3193
|
|
|
|
|
|
|
); |
3194
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3195
|
0
|
|
|
|
|
|
$self->{error}=10; |
3196
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3197
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3198
|
0
|
|
|
|
|
|
$self->warn; |
3199
|
0
|
|
|
|
|
|
return undef; |
3200
|
|
|
|
|
|
|
} |
3201
|
0
|
|
|
|
|
|
push( @rows, $row ); |
3202
|
|
|
|
|
|
|
|
3203
|
0
|
|
|
|
|
|
$int++; |
3204
|
|
|
|
|
|
|
} |
3205
|
|
|
|
|
|
|
|
3206
|
0
|
|
|
|
|
|
return $begin.$titleRow.join( $join, @rows ).$end; |
3207
|
|
|
|
|
|
|
} |
3208
|
|
|
|
|
|
|
|
3209
|
|
|
|
|
|
|
=head2 hasSubDirs |
3210
|
|
|
|
|
|
|
|
3211
|
|
|
|
|
|
|
This returns to true if the current object |
3212
|
|
|
|
|
|
|
directory has any Toader sub directories. |
3213
|
|
|
|
|
|
|
|
3214
|
|
|
|
|
|
|
if ( $g->hasSubDirs ){ |
3215
|
|
|
|
|
|
|
print "This directory has sub directories."; |
3216
|
|
|
|
|
|
|
} |
3217
|
|
|
|
|
|
|
|
3218
|
|
|
|
|
|
|
=cut |
3219
|
|
|
|
|
|
|
|
3220
|
|
|
|
|
|
|
sub hasSubDirs{ |
3221
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
3222
|
|
|
|
|
|
|
|
3223
|
|
|
|
|
|
|
#blank any previous errors |
3224
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
3225
|
0
|
|
|
|
|
|
return undef; |
3226
|
|
|
|
|
|
|
} |
3227
|
|
|
|
|
|
|
|
3228
|
|
|
|
|
|
|
#gets a list of directories |
3229
|
0
|
|
|
|
|
|
my @dirs; |
3230
|
0
|
0
|
|
|
|
|
if ( ref( $self->{odir} ) eq 'Toader::Directory' ){ |
3231
|
0
|
|
|
|
|
|
@dirs=$self->{odir}->listSubToaderDirs; |
3232
|
0
|
0
|
|
|
|
|
if ( $self->{odir}->error ){ |
3233
|
0
|
|
|
|
|
|
$self->{error}=22; |
3234
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get a list of Toader sub directories. error="' |
3235
|
|
|
|
|
|
|
.$self->{odir}->error.'" errorString="'.$self->{odir}->errorString.'"'; |
3236
|
0
|
|
|
|
|
|
return undef; |
3237
|
|
|
|
|
|
|
} |
3238
|
|
|
|
|
|
|
}else{ |
3239
|
0
|
|
|
|
|
|
my $dobj=Toader::Directory->new( $self->{toader} ); |
3240
|
0
|
|
|
|
|
|
$dobj->dirSet( $self->{odir} ); |
3241
|
0
|
|
|
|
|
|
@dirs=$dobj->listSubToaderDirs; |
3242
|
0
|
0
|
|
|
|
|
if ( $dobj->error ){ |
3243
|
0
|
|
|
|
|
|
$self->{error}=22; |
3244
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get a list of Toader sub directories. error="' |
3245
|
|
|
|
|
|
|
.$dobj->error.'" errorString="'.$dobj->{odir}->errorString.'"'; |
3246
|
0
|
|
|
|
|
|
return undef; |
3247
|
|
|
|
|
|
|
} |
3248
|
|
|
|
|
|
|
} |
3249
|
|
|
|
|
|
|
|
3250
|
0
|
0
|
|
|
|
|
if ( defined( $dirs[0] ) ){ |
3251
|
0
|
|
|
|
|
|
return 1; |
3252
|
|
|
|
|
|
|
} |
3253
|
|
|
|
|
|
|
|
3254
|
0
|
|
|
|
|
|
return 0; |
3255
|
|
|
|
|
|
|
} |
3256
|
|
|
|
|
|
|
|
3257
|
|
|
|
|
|
|
=head2 imageDiv |
3258
|
|
|
|
|
|
|
|
3259
|
|
|
|
|
|
|
This can be used for creating a captioned image. |
3260
|
|
|
|
|
|
|
|
3261
|
|
|
|
|
|
|
The takes five arguments. The first and required is the URL |
3262
|
|
|
|
|
|
|
for the image. Second and optional is link to use for if the image |
3263
|
|
|
|
|
|
|
is clicked on, which if not defined, the image will not be setup |
3264
|
|
|
|
|
|
|
as a link. The third and optional is a caption to show above the |
3265
|
|
|
|
|
|
|
image, which if left undefined defaults to ''. The fourth and |
3266
|
|
|
|
|
|
|
optional is a caption to show below the image, which if left |
3267
|
|
|
|
|
|
|
undefined defaults to ''. The fifth is the CSS ID to use, |
3268
|
|
|
|
|
|
|
which if not defined defaults to 'imageDiv'. The sixth and |
3269
|
|
|
|
|
|
|
optional is the alt test to use, which if not specified defaults |
3270
|
|
|
|
|
|
|
to the provided image URL.. |
3271
|
|
|
|
|
|
|
|
3272
|
|
|
|
|
|
|
$g-imageDiv( $imageURL, $imageLink, , 'some caption below it'); |
3273
|
|
|
|
|
|
|
|
3274
|
|
|
|
|
|
|
The default template, 'imageDiv' is as below. |
3275
|
|
|
|
|
|
|
|
3276
|
|
|
|
|
|
|
|
3277
|
|
|
|
|
|
|
[== $above ==] |
3278
|
|
|
|
|
|
|
[== if ( defined( $link ) ){ return ' }else{ return '' } ==] |
3279
|
|
|
|
|
|
|
|
3280
|
|
|
|
|
|
|
[== if ( defined( $link ) ){ return ' ' }else{ return '' } ==] |
3281
|
|
|
|
|
|
|
[== $below ==] |
3282
|
|
|
|
|
|
|
|
3283
|
|
|
|
|
|
|
|
3284
|
|
|
|
|
|
|
The variables passed are as below. |
3285
|
|
|
|
|
|
|
|
3286
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3287
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3288
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3289
|
|
|
|
|
|
|
self - The L object. |
3290
|
|
|
|
|
|
|
toader - This is a L object. |
3291
|
|
|
|
|
|
|
g - This is a L object. |
3292
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
3293
|
|
|
|
|
|
|
image - This is the source URL to usse. |
3294
|
|
|
|
|
|
|
above - This is the caption above the image. |
3295
|
|
|
|
|
|
|
below - This is the caption below the image. |
3296
|
|
|
|
|
|
|
link - This is a optional link to link to if the image is clicked on. |
3297
|
|
|
|
|
|
|
alt - This is the alt text for the image. |
3298
|
|
|
|
|
|
|
|
3299
|
|
|
|
|
|
|
=cut |
3300
|
|
|
|
|
|
|
|
3301
|
|
|
|
|
|
|
sub imageDiv{ |
3302
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
3303
|
0
|
|
|
|
|
|
my $imageURL=$_[1]; |
3304
|
0
|
|
|
|
|
|
my $imageLink=$_[2]; |
3305
|
0
|
|
|
|
|
|
my $above=$_[3]; |
3306
|
0
|
|
|
|
|
|
my $below=$_[4]; |
3307
|
0
|
|
|
|
|
|
my $cssID=$_[5]; |
3308
|
0
|
|
|
|
|
|
my $alt=$_[6]; |
3309
|
|
|
|
|
|
|
|
3310
|
|
|
|
|
|
|
#blank any previous errors |
3311
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
3312
|
0
|
|
|
|
|
|
return undef; |
3313
|
|
|
|
|
|
|
} |
3314
|
|
|
|
|
|
|
|
3315
|
|
|
|
|
|
|
#error if we have no URL for the image |
3316
|
0
|
0
|
|
|
|
|
if ( ! defined( $imageURL ) ){ |
3317
|
0
|
|
|
|
|
|
$self->{error}=36; |
3318
|
0
|
|
|
|
|
|
$self->{errorString}='No URL specified for the image'; |
3319
|
0
|
|
|
|
|
|
$self->warn; |
3320
|
0
|
|
|
|
|
|
return undef; |
3321
|
|
|
|
|
|
|
} |
3322
|
|
|
|
|
|
|
|
3323
|
|
|
|
|
|
|
#sets the default value for above if none is given |
3324
|
0
|
0
|
|
|
|
|
if ( ! defined( $above ) ){ |
3325
|
0
|
|
|
|
|
|
$above=''; |
3326
|
|
|
|
|
|
|
} |
3327
|
|
|
|
|
|
|
|
3328
|
|
|
|
|
|
|
#sets the default value for below if none is given |
3329
|
0
|
0
|
|
|
|
|
if ( ! defined( $below ) ){ |
3330
|
0
|
|
|
|
|
|
$below=''; |
3331
|
|
|
|
|
|
|
} |
3332
|
|
|
|
|
|
|
|
3333
|
|
|
|
|
|
|
#sets the default CSS ID if none is specified |
3334
|
0
|
0
|
|
|
|
|
if ( ! defined( $cssID ) ){ |
3335
|
0
|
|
|
|
|
|
$cssID='imageDiv'; |
3336
|
|
|
|
|
|
|
} |
3337
|
|
|
|
|
|
|
|
3338
|
|
|
|
|
|
|
#sets alt to the URL if not specified |
3339
|
0
|
0
|
|
|
|
|
if ( ! defined( $alt ) ){ |
3340
|
0
|
|
|
|
|
|
$alt=$imageURL; |
3341
|
|
|
|
|
|
|
} |
3342
|
|
|
|
|
|
|
|
3343
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
3344
|
|
|
|
|
|
|
'imageDiv', |
3345
|
|
|
|
|
|
|
{ |
3346
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3347
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3348
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3349
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3350
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3351
|
|
|
|
|
|
|
self=>\$self, |
3352
|
|
|
|
|
|
|
g=>\$self, |
3353
|
|
|
|
|
|
|
cssID=>$cssID, |
3354
|
|
|
|
|
|
|
image=>$imageURL, |
3355
|
|
|
|
|
|
|
above=>$above, |
3356
|
|
|
|
|
|
|
below=>$below, |
3357
|
|
|
|
|
|
|
alt=>$alt, |
3358
|
|
|
|
|
|
|
link=>$imageLink, |
3359
|
|
|
|
|
|
|
} |
3360
|
|
|
|
|
|
|
); |
3361
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3362
|
0
|
|
|
|
|
|
$self->{error}=10; |
3363
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3364
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3365
|
0
|
|
|
|
|
|
$self->warn; |
3366
|
0
|
|
|
|
|
|
return undef; |
3367
|
|
|
|
|
|
|
} |
3368
|
|
|
|
|
|
|
|
3369
|
0
|
|
|
|
|
|
return $rendered; |
3370
|
|
|
|
|
|
|
} |
3371
|
|
|
|
|
|
|
|
3372
|
|
|
|
|
|
|
=head2 imageExifTables |
3373
|
|
|
|
|
|
|
|
3374
|
|
|
|
|
|
|
This returns the table of the tags for a image. |
3375
|
|
|
|
|
|
|
|
3376
|
|
|
|
|
|
|
This puts together a tables of the common EXIF tag groups. |
3377
|
|
|
|
|
|
|
|
3378
|
|
|
|
|
|
|
[== $g->imageExifTables( $image ); ==] |
3379
|
|
|
|
|
|
|
|
3380
|
|
|
|
|
|
|
this methode ignores the EXIF tables listed below. |
3381
|
|
|
|
|
|
|
|
3382
|
|
|
|
|
|
|
ExifTool |
3383
|
|
|
|
|
|
|
System |
3384
|
|
|
|
|
|
|
PrintIM |
3385
|
|
|
|
|
|
|
File |
3386
|
|
|
|
|
|
|
Printing |
3387
|
|
|
|
|
|
|
Copy1 |
3388
|
|
|
|
|
|
|
|
3389
|
|
|
|
|
|
|
=head3 Templates |
3390
|
|
|
|
|
|
|
|
3391
|
|
|
|
|
|
|
=head4 imageExifTables |
3392
|
|
|
|
|
|
|
|
3393
|
|
|
|
|
|
|
This begins it. |
3394
|
|
|
|
|
|
|
|
3395
|
|
|
|
|
|
|
The default template is as below. |
3396
|
|
|
|
|
|
|
|
3397
|
|
|
|
|
|
|
Image: [== $filename ==] |
3398
|
|
|
|
|
|
|
[== $tables ==] |
3399
|
|
|
|
|
|
|
|
3400
|
|
|
|
|
|
|
|
3401
|
|
|
|
|
|
|
The variables passed are as below. |
3402
|
|
|
|
|
|
|
|
3403
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3404
|
|
|
|
|
|
|
self - The L object. |
3405
|
|
|
|
|
|
|
toader - This is a L object. |
3406
|
|
|
|
|
|
|
g - This is a L object. |
3407
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
3408
|
|
|
|
|
|
|
filename - This is the name of the image file. |
3409
|
|
|
|
|
|
|
tables - This is the rendered tables from generated by the templates below. |
3410
|
|
|
|
|
|
|
|
3411
|
|
|
|
|
|
|
=head3 imageExifTablesBegin |
3412
|
|
|
|
|
|
|
|
3413
|
|
|
|
|
|
|
This begins the prefixes joining of the tables. |
3414
|
|
|
|
|
|
|
|
3415
|
|
|
|
|
|
|
The default template is blank. |
3416
|
|
|
|
|
|
|
|
3417
|
|
|
|
|
|
|
The variables passed are as below. |
3418
|
|
|
|
|
|
|
|
3419
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3420
|
|
|
|
|
|
|
self - The L object. |
3421
|
|
|
|
|
|
|
toader - This is a L object. |
3422
|
|
|
|
|
|
|
g - This is a L object. |
3423
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
3424
|
|
|
|
|
|
|
|
3425
|
|
|
|
|
|
|
=head3 imageExifTablesGroup |
3426
|
|
|
|
|
|
|
|
3427
|
|
|
|
|
|
|
This is a EXIF tag group. |
3428
|
|
|
|
|
|
|
|
3429
|
|
|
|
|
|
|
The default table is as below. |
3430
|
|
|
|
|
|
|
|
3431
|
|
|
|
|
|
|
|
3432
|
|
|
|
|
|
|
EXIF Tag Group: [== $group ==] |
3433
|
|
|
|
|
|
|
[== $table ==] |
3434
|
|
|
|
|
|
|
|
3435
|
|
|
|
|
|
|
|
3436
|
|
|
|
|
|
|
The variables passed are as below. |
3437
|
|
|
|
|
|
|
|
3438
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3439
|
|
|
|
|
|
|
self - The L object. |
3440
|
|
|
|
|
|
|
toader - This is a L object. |
3441
|
|
|
|
|
|
|
g - This is a L object. |
3442
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
3443
|
|
|
|
|
|
|
group - This is the EXIF tag group. |
3444
|
|
|
|
|
|
|
table - This is the generated by hash2table. |
3445
|
|
|
|
|
|
|
|
3446
|
|
|
|
|
|
|
=head3 imageExifTablesJoin |
3447
|
|
|
|
|
|
|
|
3448
|
|
|
|
|
|
|
This joins the text rendered for imageExifTablesGroup |
3449
|
|
|
|
|
|
|
|
3450
|
|
|
|
|
|
|
The default template is blank. |
3451
|
|
|
|
|
|
|
|
3452
|
|
|
|
|
|
|
The variables passed are as below. |
3453
|
|
|
|
|
|
|
|
3454
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3455
|
|
|
|
|
|
|
self - The L object. |
3456
|
|
|
|
|
|
|
toader - This is a L object. |
3457
|
|
|
|
|
|
|
g - This is a L object. |
3458
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
3459
|
|
|
|
|
|
|
|
3460
|
|
|
|
|
|
|
=head3 imageExifTablesEnd |
3461
|
|
|
|
|
|
|
|
3462
|
|
|
|
|
|
|
This ends the prefixes joining of the tables. |
3463
|
|
|
|
|
|
|
|
3464
|
|
|
|
|
|
|
The default template is blank. |
3465
|
|
|
|
|
|
|
|
3466
|
|
|
|
|
|
|
The variables passed are as below. |
3467
|
|
|
|
|
|
|
|
3468
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3469
|
|
|
|
|
|
|
self - The L object. |
3470
|
|
|
|
|
|
|
toader - This is a L object. |
3471
|
|
|
|
|
|
|
g - This is a L object. |
3472
|
|
|
|
|
|
|
obj - This is the object that Toader was initiated with. |
3473
|
|
|
|
|
|
|
|
3474
|
|
|
|
|
|
|
=cut |
3475
|
|
|
|
|
|
|
|
3476
|
|
|
|
|
|
|
sub imageExifTables{ |
3477
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
3478
|
0
|
|
|
|
|
|
my $image=$_[1]; |
3479
|
|
|
|
|
|
|
|
3480
|
|
|
|
|
|
|
#blank any previous errors |
3481
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
3482
|
0
|
|
|
|
|
|
return undef; |
3483
|
|
|
|
|
|
|
} |
3484
|
|
|
|
|
|
|
|
3485
|
0
|
0
|
|
|
|
|
if ( ! defined( $image ) ){ |
3486
|
0
|
|
|
|
|
|
$self->{error}=37; |
3487
|
0
|
|
|
|
|
|
$self->{errorString}='No image file specified'; |
3488
|
0
|
|
|
|
|
|
$self->warn; |
3489
|
0
|
|
|
|
|
|
return undef; |
3490
|
|
|
|
|
|
|
} |
3491
|
|
|
|
|
|
|
|
3492
|
0
|
0
|
|
|
|
|
if ( ! -f $image ){ |
3493
|
0
|
|
|
|
|
|
$self->{error}=38; |
3494
|
0
|
|
|
|
|
|
$self->{errorString}='The specified image, "'.$image.'", does not exist'; |
3495
|
0
|
|
|
|
|
|
$self->warn; |
3496
|
0
|
|
|
|
|
|
return undef; |
3497
|
|
|
|
|
|
|
} |
3498
|
|
|
|
|
|
|
|
3499
|
0
|
|
|
|
|
|
my $filename=$image; |
3500
|
0
|
|
|
|
|
|
$filename=~s/.*\///; |
3501
|
|
|
|
|
|
|
|
3502
|
0
|
|
|
|
|
|
my $et=Image::ExifTool->new; |
3503
|
0
|
|
|
|
|
|
$et->ExtractInfo( $image ); |
3504
|
|
|
|
|
|
|
|
3505
|
0
|
|
|
|
|
|
my @foundTags=$et->GetFoundTags; |
3506
|
|
|
|
|
|
|
|
3507
|
0
|
|
|
|
|
|
my %tags; |
3508
|
|
|
|
|
|
|
|
3509
|
0
|
|
|
|
|
|
my $int=0; |
3510
|
0
|
|
|
|
|
|
while( defined( $foundTags[$int] ) ){ |
3511
|
0
|
|
|
|
|
|
my $value=$et->GetValue( $foundTags[$int] ); |
3512
|
|
|
|
|
|
|
|
3513
|
0
|
0
|
|
|
|
|
if (ref $value eq 'SCALAR') { |
3514
|
0
|
|
|
|
|
|
$value='(unprintable value)' |
3515
|
|
|
|
|
|
|
} |
3516
|
|
|
|
|
|
|
|
3517
|
0
|
|
|
|
|
|
my @groups=$et->GetGroup( $foundTags[$int] ); |
3518
|
|
|
|
|
|
|
|
3519
|
0
|
|
|
|
|
|
my $int2=0; |
3520
|
0
|
|
|
|
|
|
while( defined( $groups[$int2] ) ){ |
3521
|
0
|
0
|
|
|
|
|
if ( $groups[$int2] eq "" ){ |
3522
|
0
|
|
|
|
|
|
$groups[$int2]='""'; |
3523
|
|
|
|
|
|
|
} |
3524
|
|
|
|
|
|
|
|
3525
|
0
|
0
|
0
|
|
|
|
if ( ( $groups[$int2] ne 'ExifTool' ) && |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
3526
|
|
|
|
|
|
|
( $groups[$int2] ne 'System' ) && |
3527
|
|
|
|
|
|
|
( $groups[$int2] ne 'PrintIM' ) && |
3528
|
|
|
|
|
|
|
( $groups[$int2] ne 'File' ) && |
3529
|
|
|
|
|
|
|
( $groups[$int2] ne 'Printing' ) && |
3530
|
|
|
|
|
|
|
( $groups[$int2] ne 'Copy1' ) |
3531
|
|
|
|
|
|
|
){ |
3532
|
0
|
0
|
|
|
|
|
if ( ! defined( $tags{ $groups[$int2] } ) ){ |
3533
|
0
|
|
|
|
|
|
$tags{ $groups[$int2] }={}; |
3534
|
|
|
|
|
|
|
} |
3535
|
|
|
|
|
|
|
|
3536
|
0
|
|
|
|
|
|
$tags{ $groups[$int2] }{ $foundTags[$int] }=$value; |
3537
|
|
|
|
|
|
|
} |
3538
|
|
|
|
|
|
|
|
3539
|
0
|
|
|
|
|
|
$int2++; |
3540
|
|
|
|
|
|
|
} |
3541
|
|
|
|
|
|
|
|
3542
|
0
|
|
|
|
|
|
$int++; |
3543
|
|
|
|
|
|
|
} |
3544
|
|
|
|
|
|
|
|
3545
|
0
|
|
|
|
|
|
my @groups=sort( keys( %tags ) ); |
3546
|
|
|
|
|
|
|
|
3547
|
0
|
|
|
|
|
|
my @renderedGroups; |
3548
|
|
|
|
|
|
|
|
3549
|
|
|
|
|
|
|
#puts together the Composite table if needed |
3550
|
0
|
|
|
|
|
|
$int=0; |
3551
|
0
|
|
|
|
|
|
while ( defined( $groups[$int] ) ){ |
3552
|
0
|
|
|
|
|
|
my $table=$self->hashToTable( $tags{ $groups[$int] } ); |
3553
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
3554
|
0
|
|
|
|
|
|
$self->warnString('Failed to convert the hash to a table for "'.$groups[$int].'"'); |
3555
|
0
|
|
|
|
|
|
return undef; |
3556
|
|
|
|
|
|
|
} |
3557
|
|
|
|
|
|
|
#renders the table |
3558
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
3559
|
|
|
|
|
|
|
'imageExifTablesGroup', |
3560
|
|
|
|
|
|
|
{ |
3561
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3562
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3563
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3564
|
|
|
|
|
|
|
self=>\$self, |
3565
|
|
|
|
|
|
|
table=>$table, |
3566
|
|
|
|
|
|
|
group=>$groups[$int], |
3567
|
|
|
|
|
|
|
} |
3568
|
|
|
|
|
|
|
); |
3569
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3570
|
0
|
|
|
|
|
|
$self->{error}=10; |
3571
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3572
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3573
|
0
|
|
|
|
|
|
$self->warn; |
3574
|
0
|
|
|
|
|
|
return undef; |
3575
|
|
|
|
|
|
|
} |
3576
|
0
|
|
|
|
|
|
push( @renderedGroups, $rendered ); |
3577
|
|
|
|
|
|
|
|
3578
|
0
|
|
|
|
|
|
$int++; |
3579
|
|
|
|
|
|
|
} |
3580
|
|
|
|
|
|
|
|
3581
|
|
|
|
|
|
|
#renders the table joiner |
3582
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
3583
|
|
|
|
|
|
|
'imageExifTablesBegin', |
3584
|
|
|
|
|
|
|
{ |
3585
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3586
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3587
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3588
|
|
|
|
|
|
|
self=>\$self, |
3589
|
|
|
|
|
|
|
} |
3590
|
|
|
|
|
|
|
); |
3591
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3592
|
0
|
|
|
|
|
|
$self->{error}=10; |
3593
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3594
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3595
|
0
|
|
|
|
|
|
$self->warn; |
3596
|
0
|
|
|
|
|
|
return undef; |
3597
|
|
|
|
|
|
|
} |
3598
|
|
|
|
|
|
|
|
3599
|
|
|
|
|
|
|
#renders the table joiner |
3600
|
0
|
|
|
|
|
|
my $join=$self->{t}->fill_in( |
3601
|
|
|
|
|
|
|
'imageExifTablesJoin', |
3602
|
|
|
|
|
|
|
{ |
3603
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3604
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3605
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3606
|
|
|
|
|
|
|
self=>\$self, |
3607
|
|
|
|
|
|
|
} |
3608
|
|
|
|
|
|
|
); |
3609
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3610
|
0
|
|
|
|
|
|
$self->{error}=10; |
3611
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3612
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3613
|
0
|
|
|
|
|
|
$self->warn; |
3614
|
0
|
|
|
|
|
|
return undef; |
3615
|
|
|
|
|
|
|
} |
3616
|
|
|
|
|
|
|
|
3617
|
|
|
|
|
|
|
#renders the table joiner |
3618
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
3619
|
|
|
|
|
|
|
'imageExifTablesEnd', |
3620
|
|
|
|
|
|
|
{ |
3621
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3622
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3623
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3624
|
|
|
|
|
|
|
self=>\$self, |
3625
|
|
|
|
|
|
|
} |
3626
|
|
|
|
|
|
|
); |
3627
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3628
|
0
|
|
|
|
|
|
$self->{error}=10; |
3629
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3630
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3631
|
0
|
|
|
|
|
|
$self->warn; |
3632
|
0
|
|
|
|
|
|
return undef; |
3633
|
|
|
|
|
|
|
} |
3634
|
|
|
|
|
|
|
|
3635
|
0
|
|
|
|
|
|
my $joinedtables=$begin.join('', @renderedGroups ).$end; |
3636
|
|
|
|
|
|
|
|
3637
|
|
|
|
|
|
|
#renders the tables together |
3638
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
3639
|
|
|
|
|
|
|
'imageExifTables', |
3640
|
|
|
|
|
|
|
{ |
3641
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3642
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3643
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3644
|
|
|
|
|
|
|
self=>\$self, |
3645
|
|
|
|
|
|
|
tables=>$joinedtables, |
3646
|
|
|
|
|
|
|
filename=>$filename, |
3647
|
|
|
|
|
|
|
} |
3648
|
|
|
|
|
|
|
); |
3649
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3650
|
0
|
|
|
|
|
|
$self->{error}=10; |
3651
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3652
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3653
|
0
|
|
|
|
|
|
$self->warn; |
3654
|
0
|
|
|
|
|
|
return undef; |
3655
|
|
|
|
|
|
|
} |
3656
|
|
|
|
|
|
|
|
3657
|
0
|
|
|
|
|
|
return $rendered; |
3658
|
|
|
|
|
|
|
} |
3659
|
|
|
|
|
|
|
|
3660
|
|
|
|
|
|
|
=head2 lastEntries |
3661
|
|
|
|
|
|
|
|
3662
|
|
|
|
|
|
|
This returns the last entries, post rendering each one and joining them. |
3663
|
|
|
|
|
|
|
|
3664
|
|
|
|
|
|
|
There is one optional and that is number of last entries to show. If |
3665
|
|
|
|
|
|
|
not specified, it shows the last 15. |
3666
|
|
|
|
|
|
|
|
3667
|
|
|
|
|
|
|
$g->lastEntries; |
3668
|
|
|
|
|
|
|
|
3669
|
|
|
|
|
|
|
=head3 Templates |
3670
|
|
|
|
|
|
|
|
3671
|
|
|
|
|
|
|
=head4 entryListBegin |
3672
|
|
|
|
|
|
|
|
3673
|
|
|
|
|
|
|
This begins the list of the last entries. |
3674
|
|
|
|
|
|
|
|
3675
|
|
|
|
|
|
|
The default template is blank. |
3676
|
|
|
|
|
|
|
|
3677
|
|
|
|
|
|
|
The passed variables are as below. |
3678
|
|
|
|
|
|
|
|
3679
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3680
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3681
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
3682
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3683
|
|
|
|
|
|
|
toader - This is a L object. |
3684
|
|
|
|
|
|
|
self - This the L object. |
3685
|
|
|
|
|
|
|
g - This the L object. |
3686
|
|
|
|
|
|
|
|
3687
|
|
|
|
|
|
|
=head4 entryListJoin |
3688
|
|
|
|
|
|
|
|
3689
|
|
|
|
|
|
|
This joins the rendered entries. |
3690
|
|
|
|
|
|
|
|
3691
|
|
|
|
|
|
|
The default template is as below. |
3692
|
|
|
|
|
|
|
|
3693
|
|
|
|
|
|
|
|
3694
|
|
|
|
|
|
|
|
3695
|
|
|
|
|
|
|
|
3696
|
|
|
|
|
|
|
The passed variables are as below. |
3697
|
|
|
|
|
|
|
|
3698
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3699
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3700
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
3701
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3702
|
|
|
|
|
|
|
toader - This is a L object. |
3703
|
|
|
|
|
|
|
self - This the L object. |
3704
|
|
|
|
|
|
|
g - This the L object. |
3705
|
|
|
|
|
|
|
|
3706
|
|
|
|
|
|
|
=head4 entryListEnd |
3707
|
|
|
|
|
|
|
|
3708
|
|
|
|
|
|
|
This ends the list of rendered entries. |
3709
|
|
|
|
|
|
|
|
3710
|
|
|
|
|
|
|
The default template is as below. |
3711
|
|
|
|
|
|
|
|
3712
|
|
|
|
|
|
|
|
3713
|
|
|
|
|
|
|
|
3714
|
|
|
|
|
|
|
|
3715
|
|
|
|
|
|
|
The passed variables are as below. |
3716
|
|
|
|
|
|
|
|
3717
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3718
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3719
|
|
|
|
|
|
|
obj - This is the object that it was invoked for. |
3720
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3721
|
|
|
|
|
|
|
toader - This is a L object. |
3722
|
|
|
|
|
|
|
self - This the L object. |
3723
|
|
|
|
|
|
|
g - This the L object. |
3724
|
|
|
|
|
|
|
|
3725
|
|
|
|
|
|
|
=cut |
3726
|
|
|
|
|
|
|
|
3727
|
|
|
|
|
|
|
sub lastEntries{ |
3728
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
3729
|
0
|
|
|
|
|
|
my $show=$_[1]; |
3730
|
|
|
|
|
|
|
|
3731
|
|
|
|
|
|
|
#blank any previous errors |
3732
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
3733
|
0
|
|
|
|
|
|
return undef; |
3734
|
|
|
|
|
|
|
} |
3735
|
|
|
|
|
|
|
|
3736
|
|
|
|
|
|
|
#default to 15 to show |
3737
|
0
|
0
|
|
|
|
|
if ( ! defined( $show ) ){ |
3738
|
0
|
|
|
|
|
|
$show=15; |
3739
|
|
|
|
|
|
|
} |
3740
|
|
|
|
|
|
|
|
3741
|
0
|
|
|
|
|
|
my $em=Toader::Entry::Manage->new( $self->{toader} ); |
3742
|
0
|
|
|
|
|
|
$em->setDir( $self->{odir} ); |
3743
|
0
|
0
|
|
|
|
|
if ( $em->error ){ |
3744
|
0
|
|
|
|
|
|
$self->{error}=25; |
3745
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to set the directory, "'.$self->{odir}. |
3746
|
|
|
|
|
|
|
'", for Toader::Entry::Manage. error="'.$em->error |
3747
|
|
|
|
|
|
|
.'" errorString="'.$em->errorString.'"'; |
3748
|
0
|
|
|
|
|
|
$self->warn; |
3749
|
0
|
|
|
|
|
|
return undef; |
3750
|
|
|
|
|
|
|
} |
3751
|
|
|
|
|
|
|
|
3752
|
|
|
|
|
|
|
#lists the entries for the directory |
3753
|
0
|
|
|
|
|
|
my @entries=$em->list; |
3754
|
0
|
0
|
|
|
|
|
if ( $em->error ){ |
3755
|
0
|
|
|
|
|
|
$self->{error}=25; |
3756
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to read the entries for "'.$self->{odir}. |
3757
|
|
|
|
|
|
|
'". error="'.$em->error.'" errorString="'.$em->errorString.'"'; |
3758
|
0
|
|
|
|
|
|
$self->warn; |
3759
|
0
|
|
|
|
|
|
return undef; |
3760
|
|
|
|
|
|
|
} |
3761
|
|
|
|
|
|
|
|
3762
|
|
|
|
|
|
|
#return '' if there are none |
3763
|
0
|
0
|
|
|
|
|
if ( ! defined( $entries[0] ) ){ |
3764
|
0
|
|
|
|
|
|
return ''; |
3765
|
|
|
|
|
|
|
} |
3766
|
|
|
|
|
|
|
|
3767
|
|
|
|
|
|
|
#sort and order from last to first |
3768
|
0
|
|
|
|
|
|
@entries=sort(@entries); |
3769
|
0
|
|
|
|
|
|
@entries=reverse(@entries); |
3770
|
|
|
|
|
|
|
|
3771
|
|
|
|
|
|
|
#process each one |
3772
|
0
|
|
|
|
|
|
my @tojoin; |
3773
|
0
|
|
|
|
|
|
my $int=0; |
3774
|
0
|
|
|
|
|
|
while ( defined( $entries[$int] ) ){ |
3775
|
0
|
|
|
|
|
|
my $entry=$em->read( $entries[$int] ); |
3776
|
0
|
0
|
|
|
|
|
if ( $em->error ){ |
3777
|
0
|
|
|
|
|
|
$self->{error}=26; |
3778
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to read "'.$entries[$int].'" in "' |
3779
|
|
|
|
|
|
|
.$self->{odir}.'". error="'.$em->error.'" errorstring="' |
3780
|
|
|
|
|
|
|
.$em->errorString.'"'; |
3781
|
0
|
|
|
|
|
|
$self->warn; |
3782
|
0
|
|
|
|
|
|
return undef; |
3783
|
|
|
|
|
|
|
} |
3784
|
|
|
|
|
|
|
|
3785
|
0
|
|
|
|
|
|
my $r=Toader::Render::Entry->new({ |
3786
|
|
|
|
|
|
|
obj=>$entry, |
3787
|
|
|
|
|
|
|
toader=>$self->{toader}, |
3788
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3789
|
|
|
|
|
|
|
}); |
3790
|
0
|
0
|
|
|
|
|
if ( $r->error ){ |
3791
|
0
|
|
|
|
|
|
$self->{error}=27; |
3792
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Render::Entry for "'. |
3793
|
|
|
|
|
|
|
$entries[$int].'" in "'.$self->{odir}.'". error="'.$r->error. |
3794
|
|
|
|
|
|
|
'" errorString="'.$r->errorString.'"'; |
3795
|
0
|
|
|
|
|
|
$self->warn; |
3796
|
0
|
|
|
|
|
|
return undef; |
3797
|
|
|
|
|
|
|
} |
3798
|
|
|
|
|
|
|
|
3799
|
0
|
|
|
|
|
|
my $rendered=$r->content; |
3800
|
0
|
0
|
|
|
|
|
if ( $r->error ){ |
3801
|
0
|
|
|
|
|
|
$self->{error}=28; |
3802
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to render "'.$entries[$int].'" in "' |
3803
|
|
|
|
|
|
|
.$self->{odir}.'". error="'.$r->error.'" errorString="'.$r->errorString.'"'; |
3804
|
0
|
|
|
|
|
|
$self->warn; |
3805
|
0
|
|
|
|
|
|
return undef; |
3806
|
|
|
|
|
|
|
} |
3807
|
|
|
|
|
|
|
|
3808
|
0
|
|
|
|
|
|
push( @tojoin, $rendered ); |
3809
|
|
|
|
|
|
|
|
3810
|
0
|
|
|
|
|
|
$int++; |
3811
|
|
|
|
|
|
|
} |
3812
|
|
|
|
|
|
|
|
3813
|
|
|
|
|
|
|
#renders the joiner |
3814
|
0
|
|
|
|
|
|
my $joiner=$self->{t}->fill_in( |
3815
|
|
|
|
|
|
|
'entryListJoin', |
3816
|
|
|
|
|
|
|
{ |
3817
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3818
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3819
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3820
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3821
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3822
|
|
|
|
|
|
|
self=>\$self, |
3823
|
|
|
|
|
|
|
g=>\$self, |
3824
|
|
|
|
|
|
|
} |
3825
|
|
|
|
|
|
|
); |
3826
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3827
|
0
|
|
|
|
|
|
$self->{error}=10; |
3828
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3829
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3830
|
0
|
|
|
|
|
|
$self->warn; |
3831
|
0
|
|
|
|
|
|
return undef; |
3832
|
|
|
|
|
|
|
} |
3833
|
|
|
|
|
|
|
|
3834
|
|
|
|
|
|
|
#renders the begining of the end of the last entries |
3835
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
3836
|
|
|
|
|
|
|
'entryListBegin', |
3837
|
|
|
|
|
|
|
{ |
3838
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3839
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3840
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3841
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3842
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3843
|
|
|
|
|
|
|
self=>\$self, |
3844
|
|
|
|
|
|
|
g=>\$self, |
3845
|
|
|
|
|
|
|
} |
3846
|
|
|
|
|
|
|
); |
3847
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3848
|
0
|
|
|
|
|
|
$self->{error}=10; |
3849
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3850
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3851
|
0
|
|
|
|
|
|
$self->warn; |
3852
|
0
|
|
|
|
|
|
return undef; |
3853
|
|
|
|
|
|
|
} |
3854
|
|
|
|
|
|
|
|
3855
|
|
|
|
|
|
|
#renders the end of the end of the last entries |
3856
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
3857
|
|
|
|
|
|
|
'entryListEnd', |
3858
|
|
|
|
|
|
|
{ |
3859
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3860
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3861
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3862
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3863
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3864
|
|
|
|
|
|
|
self=>\$self, |
3865
|
|
|
|
|
|
|
g=>\$self, |
3866
|
|
|
|
|
|
|
} |
3867
|
|
|
|
|
|
|
); |
3868
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3869
|
0
|
|
|
|
|
|
$self->{error}=10; |
3870
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3871
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3872
|
0
|
|
|
|
|
|
$self->warn; |
3873
|
0
|
|
|
|
|
|
return undef; |
3874
|
|
|
|
|
|
|
} |
3875
|
|
|
|
|
|
|
|
3876
|
|
|
|
|
|
|
|
3877
|
0
|
|
|
|
|
|
return $begin.join( $joiner, @tojoin ).$end; |
3878
|
|
|
|
|
|
|
} |
3879
|
|
|
|
|
|
|
|
3880
|
|
|
|
|
|
|
=head2 link |
3881
|
|
|
|
|
|
|
|
3882
|
|
|
|
|
|
|
This generates a HTML link. |
3883
|
|
|
|
|
|
|
|
3884
|
|
|
|
|
|
|
Two arguments are taken. The first and required one is the link. |
3885
|
|
|
|
|
|
|
The second is the text, which if not specified will will be the same |
3886
|
|
|
|
|
|
|
the link. |
3887
|
|
|
|
|
|
|
|
3888
|
|
|
|
|
|
|
$g->link( "http://foo.bar/whatever/", "whatever at foo.bar" ); |
3889
|
|
|
|
|
|
|
|
3890
|
|
|
|
|
|
|
The template used is 'link' and by default it is as below. |
3891
|
|
|
|
|
|
|
|
3892
|
|
|
|
|
|
|
[== $text ==] |
3893
|
|
|
|
|
|
|
|
3894
|
|
|
|
|
|
|
The variables passed are as below. |
3895
|
|
|
|
|
|
|
|
3896
|
|
|
|
|
|
|
url - This is the relative URL for this. |
3897
|
|
|
|
|
|
|
text - This to use for with the link. |
3898
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3899
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3900
|
|
|
|
|
|
|
obj - The L object. |
3901
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3902
|
|
|
|
|
|
|
self - The L object. |
3903
|
|
|
|
|
|
|
toader - This is a L object. |
3904
|
|
|
|
|
|
|
g - This is a L object. |
3905
|
|
|
|
|
|
|
|
3906
|
|
|
|
|
|
|
=cut |
3907
|
|
|
|
|
|
|
|
3908
|
|
|
|
|
|
|
sub link{ |
3909
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
3910
|
0
|
|
|
|
|
|
my $link=$_[1]; |
3911
|
0
|
|
|
|
|
|
my $text=$_[2]; |
3912
|
|
|
|
|
|
|
|
3913
|
|
|
|
|
|
|
#blank any previous errors |
3914
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
3915
|
0
|
|
|
|
|
|
return undef; |
3916
|
|
|
|
|
|
|
} |
3917
|
|
|
|
|
|
|
|
3918
|
|
|
|
|
|
|
#make sure we have a link |
3919
|
0
|
0
|
|
|
|
|
if ( ! defined( $link ) ){ |
3920
|
0
|
|
|
|
|
|
$self->{error}=8; |
3921
|
0
|
|
|
|
|
|
$self->{errorString}='No link defined'; |
3922
|
0
|
|
|
|
|
|
$self->warn; |
3923
|
0
|
|
|
|
|
|
return undef; |
3924
|
|
|
|
|
|
|
} |
3925
|
|
|
|
|
|
|
|
3926
|
|
|
|
|
|
|
#set the text to the same as the link if no text is defined |
3927
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
3928
|
0
|
|
|
|
|
|
$text=$link; |
3929
|
|
|
|
|
|
|
} |
3930
|
|
|
|
|
|
|
|
3931
|
|
|
|
|
|
|
#render it |
3932
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
3933
|
|
|
|
|
|
|
'link', |
3934
|
|
|
|
|
|
|
{ |
3935
|
|
|
|
|
|
|
url=>$link, |
3936
|
|
|
|
|
|
|
text=>$text, |
3937
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
3938
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
3939
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
3940
|
|
|
|
|
|
|
self=>\$self, |
3941
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
3942
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
3943
|
|
|
|
|
|
|
g=>\$self, |
3944
|
|
|
|
|
|
|
} |
3945
|
|
|
|
|
|
|
); |
3946
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
3947
|
0
|
|
|
|
|
|
$self->{error}=10; |
3948
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
3949
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
3950
|
0
|
|
|
|
|
|
$self->warn; |
3951
|
0
|
|
|
|
|
|
return undef; |
3952
|
|
|
|
|
|
|
} |
3953
|
|
|
|
|
|
|
|
3954
|
0
|
|
|
|
|
|
return $rendered; |
3955
|
|
|
|
|
|
|
} |
3956
|
|
|
|
|
|
|
|
3957
|
|
|
|
|
|
|
=head2 listDirs |
3958
|
|
|
|
|
|
|
|
3959
|
|
|
|
|
|
|
This builds the side bar list of directories. |
3960
|
|
|
|
|
|
|
|
3961
|
|
|
|
|
|
|
No options are taken. |
3962
|
|
|
|
|
|
|
|
3963
|
|
|
|
|
|
|
$g->listDirs; |
3964
|
|
|
|
|
|
|
|
3965
|
|
|
|
|
|
|
This does not currently play nicely with any thing that will |
3966
|
|
|
|
|
|
|
set fullURL. |
3967
|
|
|
|
|
|
|
|
3968
|
|
|
|
|
|
|
=head3 Templates |
3969
|
|
|
|
|
|
|
|
3970
|
|
|
|
|
|
|
=head4 dirListBegin |
3971
|
|
|
|
|
|
|
|
3972
|
|
|
|
|
|
|
This begins the dirlist. |
3973
|
|
|
|
|
|
|
|
3974
|
|
|
|
|
|
|
The template used is 'dirListBegin' and by default is blank. |
3975
|
|
|
|
|
|
|
|
3976
|
|
|
|
|
|
|
The variables passed are as below. |
3977
|
|
|
|
|
|
|
|
3978
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3979
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3980
|
|
|
|
|
|
|
obj - The L object. |
3981
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
3982
|
|
|
|
|
|
|
self - The L object. |
3983
|
|
|
|
|
|
|
toader - This is a L object. |
3984
|
|
|
|
|
|
|
g - This is a L object. |
3985
|
|
|
|
|
|
|
|
3986
|
|
|
|
|
|
|
=head4 dirListJoin |
3987
|
|
|
|
|
|
|
|
3988
|
|
|
|
|
|
|
This joins items in the directory list. |
3989
|
|
|
|
|
|
|
|
3990
|
|
|
|
|
|
|
The default template is 'dirListJoin' and it is as below. |
3991
|
|
|
|
|
|
|
|
3992
|
|
|
|
|
|
|
|
3993
|
|
|
|
|
|
|
|
3994
|
|
|
|
|
|
|
|
3995
|
|
|
|
|
|
|
The passed variables are as below. |
3996
|
|
|
|
|
|
|
|
3997
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
3998
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
3999
|
|
|
|
|
|
|
obj - The L object. |
4000
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4001
|
|
|
|
|
|
|
self - The L object. |
4002
|
|
|
|
|
|
|
toader - This is a L object. |
4003
|
|
|
|
|
|
|
g - This is a L object. |
4004
|
|
|
|
|
|
|
|
4005
|
|
|
|
|
|
|
=head4 dirListLink |
4006
|
|
|
|
|
|
|
|
4007
|
|
|
|
|
|
|
This is a link for a directory in the directory list. |
4008
|
|
|
|
|
|
|
|
4009
|
|
|
|
|
|
|
The template is 'dirListLink' and it is by default as below. |
4010
|
|
|
|
|
|
|
|
4011
|
|
|
|
|
|
|
[== $text ==] |
4012
|
|
|
|
|
|
|
|
4013
|
|
|
|
|
|
|
The passed variables are as below. |
4014
|
|
|
|
|
|
|
|
4015
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4016
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4017
|
|
|
|
|
|
|
obj - The L> object. |
4018
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4019
|
|
|
|
|
|
|
self - The L object. |
4020
|
|
|
|
|
|
|
toader - This is a L object. |
4021
|
|
|
|
|
|
|
g - This is a L object. |
4022
|
|
|
|
|
|
|
|
4023
|
|
|
|
|
|
|
=head4 dirListEnd |
4024
|
|
|
|
|
|
|
|
4025
|
|
|
|
|
|
|
This ends the directory list. |
4026
|
|
|
|
|
|
|
|
4027
|
|
|
|
|
|
|
The template used is 'dirListEnd' and the default is as below. |
4028
|
|
|
|
|
|
|
|
4029
|
|
|
|
|
|
|
|
4030
|
|
|
|
|
|
|
|
4031
|
|
|
|
|
|
|
|
4032
|
|
|
|
|
|
|
The passed variables are as below. |
4033
|
|
|
|
|
|
|
|
4034
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4035
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4036
|
|
|
|
|
|
|
obj - The L object. |
4037
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4038
|
|
|
|
|
|
|
self - The L object. |
4039
|
|
|
|
|
|
|
toader - This is a L object. |
4040
|
|
|
|
|
|
|
g - This is a L object. |
4041
|
|
|
|
|
|
|
|
4042
|
|
|
|
|
|
|
=cut |
4043
|
|
|
|
|
|
|
|
4044
|
|
|
|
|
|
|
sub listDirs{ |
4045
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4046
|
|
|
|
|
|
|
|
4047
|
|
|
|
|
|
|
#blank any previous errors |
4048
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4049
|
0
|
|
|
|
|
|
return undef; |
4050
|
|
|
|
|
|
|
} |
4051
|
|
|
|
|
|
|
|
4052
|
|
|
|
|
|
|
#renders the joiner |
4053
|
0
|
|
|
|
|
|
my $joiner=$self->{t}->fill_in( |
4054
|
|
|
|
|
|
|
'dirListJoin', |
4055
|
|
|
|
|
|
|
{ |
4056
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4057
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4058
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4059
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4060
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4061
|
|
|
|
|
|
|
self=>\$self, |
4062
|
|
|
|
|
|
|
g=>\$self, |
4063
|
|
|
|
|
|
|
} |
4064
|
|
|
|
|
|
|
); |
4065
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4066
|
0
|
|
|
|
|
|
$self->{error}=10; |
4067
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4068
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4069
|
0
|
|
|
|
|
|
$self->warn; |
4070
|
0
|
|
|
|
|
|
return undef; |
4071
|
|
|
|
|
|
|
} |
4072
|
|
|
|
|
|
|
|
4073
|
|
|
|
|
|
|
#renders the beginning of the dir list |
4074
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
4075
|
|
|
|
|
|
|
'dirListBegin', |
4076
|
|
|
|
|
|
|
{ |
4077
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4078
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4079
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4080
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4081
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4082
|
|
|
|
|
|
|
self=>\$self, |
4083
|
|
|
|
|
|
|
g=>\$self, |
4084
|
|
|
|
|
|
|
} |
4085
|
|
|
|
|
|
|
); |
4086
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4087
|
0
|
|
|
|
|
|
$self->{error}=10; |
4088
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4089
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4090
|
0
|
|
|
|
|
|
$self->warn; |
4091
|
0
|
|
|
|
|
|
return undef; |
4092
|
|
|
|
|
|
|
} |
4093
|
|
|
|
|
|
|
|
4094
|
|
|
|
|
|
|
#renders the end of the dir list |
4095
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
4096
|
|
|
|
|
|
|
'dirListEnd', |
4097
|
|
|
|
|
|
|
{ |
4098
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4099
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4100
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4101
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4102
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4103
|
|
|
|
|
|
|
self=>\$self, |
4104
|
|
|
|
|
|
|
g=>\$self, |
4105
|
|
|
|
|
|
|
} |
4106
|
|
|
|
|
|
|
); |
4107
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4108
|
0
|
|
|
|
|
|
$self->{error}=10; |
4109
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4110
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4111
|
0
|
|
|
|
|
|
$self->warn; |
4112
|
0
|
|
|
|
|
|
return undef; |
4113
|
|
|
|
|
|
|
} |
4114
|
|
|
|
|
|
|
|
4115
|
|
|
|
|
|
|
#gets a list of directories |
4116
|
0
|
|
|
|
|
|
my @dirs; |
4117
|
0
|
0
|
|
|
|
|
if ( ref( $self->{odir} ) eq 'Toader::Directory' ){ |
4118
|
0
|
|
|
|
|
|
@dirs=$self->{odir}->listSubToaderDirs; |
4119
|
0
|
0
|
|
|
|
|
if ( $self->{odir}->error ){ |
4120
|
0
|
|
|
|
|
|
$self->{error}=22; |
4121
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get a list of Toader sub directories. error="' |
4122
|
|
|
|
|
|
|
.$self->{odir}->error.'" errorString="'.$self->{odir}->errorString.'"'; |
4123
|
0
|
|
|
|
|
|
return undef; |
4124
|
|
|
|
|
|
|
} |
4125
|
|
|
|
|
|
|
}else{ |
4126
|
0
|
|
|
|
|
|
my $dobj=Toader::Directory->new( $self->{toader} ); |
4127
|
0
|
|
|
|
|
|
$dobj->dirSet( $self->{odir} ); |
4128
|
0
|
|
|
|
|
|
@dirs=$dobj->listSubToaderDirs; |
4129
|
0
|
0
|
|
|
|
|
if ( $dobj->error ){ |
4130
|
0
|
|
|
|
|
|
$self->{error}=22; |
4131
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get a list of Toader sub directories. error="' |
4132
|
|
|
|
|
|
|
.$dobj->error.'" errorString="'.$dobj->{odir}->errorString.'"'; |
4133
|
0
|
|
|
|
|
|
return undef; |
4134
|
|
|
|
|
|
|
} |
4135
|
|
|
|
|
|
|
} |
4136
|
0
|
|
|
|
|
|
@dirs=sort(@dirs); |
4137
|
|
|
|
|
|
|
|
4138
|
|
|
|
|
|
|
#return black here if there is nothing |
4139
|
0
|
0
|
|
|
|
|
if ( ! defined( $dirs[0] ) ){ |
4140
|
0
|
|
|
|
|
|
return ''; |
4141
|
|
|
|
|
|
|
} |
4142
|
|
|
|
|
|
|
|
4143
|
|
|
|
|
|
|
#will hold it all prior to joining |
4144
|
0
|
|
|
|
|
|
my @tojoin; |
4145
|
|
|
|
|
|
|
|
4146
|
|
|
|
|
|
|
#process it all |
4147
|
0
|
|
|
|
|
|
my $int=0; |
4148
|
0
|
|
|
|
|
|
while ( defined( $dirs[$int] ) ){ |
4149
|
|
|
|
|
|
|
#add the toDir to it |
4150
|
0
|
|
|
|
|
|
my $dir=$self->{toDir}.$dirs[$int]; |
4151
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
4152
|
|
|
|
|
|
|
|
4153
|
|
|
|
|
|
|
#render it |
4154
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
4155
|
|
|
|
|
|
|
'dirListLink', |
4156
|
|
|
|
|
|
|
{ |
4157
|
|
|
|
|
|
|
url=>$dir, |
4158
|
|
|
|
|
|
|
text=>$dirs[$int], |
4159
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4160
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4161
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4162
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4163
|
|
|
|
|
|
|
self=>\$self, |
4164
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4165
|
|
|
|
|
|
|
g=>\$self, |
4166
|
|
|
|
|
|
|
} |
4167
|
|
|
|
|
|
|
); |
4168
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4169
|
0
|
|
|
|
|
|
$self->{error}=10; |
4170
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4171
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4172
|
0
|
|
|
|
|
|
$self->warn; |
4173
|
0
|
|
|
|
|
|
return undef; |
4174
|
|
|
|
|
|
|
} |
4175
|
|
|
|
|
|
|
|
4176
|
0
|
|
|
|
|
|
push( @tojoin, $rendered ); |
4177
|
|
|
|
|
|
|
|
4178
|
0
|
|
|
|
|
|
$int++; |
4179
|
|
|
|
|
|
|
} |
4180
|
|
|
|
|
|
|
|
4181
|
0
|
|
|
|
|
|
return $begin.join( $joiner, @tojoin ).$end; |
4182
|
|
|
|
|
|
|
} |
4183
|
|
|
|
|
|
|
|
4184
|
|
|
|
|
|
|
=head2 listPages |
4185
|
|
|
|
|
|
|
|
4186
|
|
|
|
|
|
|
This returns returns a list of pages. |
4187
|
|
|
|
|
|
|
|
4188
|
|
|
|
|
|
|
No options are taken. |
4189
|
|
|
|
|
|
|
|
4190
|
|
|
|
|
|
|
$g->listPages; |
4191
|
|
|
|
|
|
|
|
4192
|
|
|
|
|
|
|
=head3 Templates |
4193
|
|
|
|
|
|
|
|
4194
|
|
|
|
|
|
|
=head4 pageListBegin |
4195
|
|
|
|
|
|
|
|
4196
|
|
|
|
|
|
|
This begins the page list. |
4197
|
|
|
|
|
|
|
|
4198
|
|
|
|
|
|
|
The template is 'pageListBegin' and is blank. |
4199
|
|
|
|
|
|
|
|
4200
|
|
|
|
|
|
|
The variables passed are as below. |
4201
|
|
|
|
|
|
|
|
4202
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4203
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4204
|
|
|
|
|
|
|
obj - The L object. |
4205
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4206
|
|
|
|
|
|
|
self - The L object. |
4207
|
|
|
|
|
|
|
toader - This is a L object. |
4208
|
|
|
|
|
|
|
g - This is a L object. |
4209
|
|
|
|
|
|
|
|
4210
|
|
|
|
|
|
|
=head4 pageListJoin |
4211
|
|
|
|
|
|
|
|
4212
|
|
|
|
|
|
|
This joins the items in the page list. |
4213
|
|
|
|
|
|
|
|
4214
|
|
|
|
|
|
|
The template is 'pageListJoin' and is blank. |
4215
|
|
|
|
|
|
|
|
4216
|
|
|
|
|
|
|
|
4217
|
|
|
|
|
|
|
|
4218
|
|
|
|
|
|
|
|
4219
|
|
|
|
|
|
|
The variables passed are as below. |
4220
|
|
|
|
|
|
|
|
4221
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4222
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4223
|
|
|
|
|
|
|
obj - The L object. |
4224
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4225
|
|
|
|
|
|
|
self - The L object. |
4226
|
|
|
|
|
|
|
toader - This is a L object. |
4227
|
|
|
|
|
|
|
g - This is a L object. |
4228
|
|
|
|
|
|
|
|
4229
|
|
|
|
|
|
|
=head4 pageListLink |
4230
|
|
|
|
|
|
|
|
4231
|
|
|
|
|
|
|
This is a link to a page |
4232
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
The template is 'pageListLink' and is blank. |
4234
|
|
|
|
|
|
|
|
4235
|
|
|
|
|
|
|
[== $text ==] |
4236
|
|
|
|
|
|
|
|
4237
|
|
|
|
|
|
|
The variables passed are as below. |
4238
|
|
|
|
|
|
|
|
4239
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4240
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4241
|
|
|
|
|
|
|
obj - The L object. |
4242
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4243
|
|
|
|
|
|
|
self - The L object. |
4244
|
|
|
|
|
|
|
toader - This is a L object. |
4245
|
|
|
|
|
|
|
g - This is a L object. |
4246
|
|
|
|
|
|
|
|
4247
|
|
|
|
|
|
|
=head4 pageListEnd |
4248
|
|
|
|
|
|
|
|
4249
|
|
|
|
|
|
|
This joins the items in the page list. |
4250
|
|
|
|
|
|
|
|
4251
|
|
|
|
|
|
|
The template is 'pageListJoin' and is blank. |
4252
|
|
|
|
|
|
|
|
4253
|
|
|
|
|
|
|
|
4254
|
|
|
|
|
|
|
|
4255
|
|
|
|
|
|
|
|
4256
|
|
|
|
|
|
|
The variables passed are as below. |
4257
|
|
|
|
|
|
|
|
4258
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4259
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4260
|
|
|
|
|
|
|
obj - The L object. |
4261
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4262
|
|
|
|
|
|
|
self - The L object. |
4263
|
|
|
|
|
|
|
toader - This is a L object. |
4264
|
|
|
|
|
|
|
g - This is a L object. |
4265
|
|
|
|
|
|
|
|
4266
|
|
|
|
|
|
|
=cut |
4267
|
|
|
|
|
|
|
|
4268
|
|
|
|
|
|
|
sub listPages{ |
4269
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4270
|
|
|
|
|
|
|
|
4271
|
|
|
|
|
|
|
#blank any previous errors |
4272
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4273
|
0
|
|
|
|
|
|
return undef; |
4274
|
|
|
|
|
|
|
} |
4275
|
|
|
|
|
|
|
|
4276
|
|
|
|
|
|
|
#renders the begin |
4277
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
4278
|
|
|
|
|
|
|
'pageListBegin', |
4279
|
|
|
|
|
|
|
{ |
4280
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4281
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4282
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4283
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4284
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4285
|
|
|
|
|
|
|
self=>\$self, |
4286
|
|
|
|
|
|
|
g=>\$self, |
4287
|
|
|
|
|
|
|
} |
4288
|
|
|
|
|
|
|
); |
4289
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4290
|
0
|
|
|
|
|
|
$self->{error}=10; |
4291
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4292
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4293
|
0
|
|
|
|
|
|
$self->warn; |
4294
|
0
|
|
|
|
|
|
return undef; |
4295
|
|
|
|
|
|
|
} |
4296
|
|
|
|
|
|
|
|
4297
|
|
|
|
|
|
|
#renders the joiner |
4298
|
0
|
|
|
|
|
|
my $joiner=$self->{t}->fill_in( |
4299
|
|
|
|
|
|
|
'pageListJoin', |
4300
|
|
|
|
|
|
|
{ |
4301
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4302
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4303
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4304
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4305
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4306
|
|
|
|
|
|
|
self=>\$self, |
4307
|
|
|
|
|
|
|
g=>\$self, |
4308
|
|
|
|
|
|
|
} |
4309
|
|
|
|
|
|
|
); |
4310
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4311
|
0
|
|
|
|
|
|
$self->{error}=10; |
4312
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4313
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4314
|
0
|
|
|
|
|
|
$self->warn; |
4315
|
0
|
|
|
|
|
|
return undef; |
4316
|
|
|
|
|
|
|
} |
4317
|
|
|
|
|
|
|
|
4318
|
|
|
|
|
|
|
#renders the end of the dir list |
4319
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
4320
|
|
|
|
|
|
|
'pageListEnd', |
4321
|
|
|
|
|
|
|
{ |
4322
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4323
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4324
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4325
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4326
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4327
|
|
|
|
|
|
|
self=>\$self, |
4328
|
|
|
|
|
|
|
g=>\$self, |
4329
|
|
|
|
|
|
|
} |
4330
|
|
|
|
|
|
|
); |
4331
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4332
|
0
|
|
|
|
|
|
$self->{error}=10; |
4333
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4334
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4335
|
0
|
|
|
|
|
|
$self->warn; |
4336
|
0
|
|
|
|
|
|
return undef; |
4337
|
|
|
|
|
|
|
} |
4338
|
|
|
|
|
|
|
|
4339
|
|
|
|
|
|
|
#gets a list of pages |
4340
|
0
|
|
|
|
|
|
my $pm=Toader::Page::Manage->new( $self->{toader} ); |
4341
|
0
|
|
|
|
|
|
$pm->setDir( $self->{odir} ); |
4342
|
0
|
0
|
|
|
|
|
if ( $pm->error ){ |
4343
|
0
|
|
|
|
|
|
$self->{error}=23; |
4344
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to set the directory for Toader::Page::Manage. '. |
4345
|
|
|
|
|
|
|
'error="'.$pm->error.'" errorString="'.$pm->errorString.'"'; |
4346
|
0
|
|
|
|
|
|
$self->warn; |
4347
|
0
|
|
|
|
|
|
return undef; |
4348
|
|
|
|
|
|
|
} |
4349
|
0
|
|
|
|
|
|
my @pages=$pm->list; |
4350
|
0
|
0
|
|
|
|
|
if ( $pm->error ){ |
4351
|
0
|
|
|
|
|
|
$self->{error}=24; |
4352
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get a list of pages. error="' |
4353
|
|
|
|
|
|
|
.$pm->error.'" errorString="'.$pm->errorString.'"'; |
4354
|
0
|
|
|
|
|
|
$self->warn; |
4355
|
0
|
|
|
|
|
|
return undef; |
4356
|
|
|
|
|
|
|
} |
4357
|
|
|
|
|
|
|
|
4358
|
|
|
|
|
|
|
#return blank if there pages |
4359
|
0
|
0
|
|
|
|
|
if ( ! defined( $pages[0] ) ){ |
4360
|
0
|
|
|
|
|
|
return ''; |
4361
|
|
|
|
|
|
|
} |
4362
|
|
|
|
|
|
|
|
4363
|
|
|
|
|
|
|
#puts it together |
4364
|
0
|
|
|
|
|
|
my $int=0; |
4365
|
0
|
|
|
|
|
|
my @tojoin; |
4366
|
0
|
|
|
|
|
|
while ( $pages[$int] ){ |
4367
|
|
|
|
|
|
|
#add the toDir to it |
4368
|
0
|
|
|
|
|
|
my $dir=$self->{toDir}.'/.pages/'.$pages[$int].'/'; |
4369
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
4370
|
|
|
|
|
|
|
|
4371
|
|
|
|
|
|
|
#render it |
4372
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
4373
|
|
|
|
|
|
|
'pageListLink', |
4374
|
|
|
|
|
|
|
{ |
4375
|
|
|
|
|
|
|
url=>$dir, |
4376
|
|
|
|
|
|
|
text=>$pages[$int], |
4377
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4378
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4379
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4380
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4381
|
|
|
|
|
|
|
self=>\$self, |
4382
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4383
|
|
|
|
|
|
|
g=>\$self, |
4384
|
|
|
|
|
|
|
} |
4385
|
|
|
|
|
|
|
); |
4386
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4387
|
0
|
|
|
|
|
|
$self->{error}=10; |
4388
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4389
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4390
|
0
|
|
|
|
|
|
$self->warn; |
4391
|
0
|
|
|
|
|
|
return undef; |
4392
|
|
|
|
|
|
|
} |
4393
|
|
|
|
|
|
|
|
4394
|
0
|
|
|
|
|
|
push( @tojoin, $rendered ); |
4395
|
|
|
|
|
|
|
|
4396
|
0
|
|
|
|
|
|
$int++; |
4397
|
|
|
|
|
|
|
} |
4398
|
|
|
|
|
|
|
|
4399
|
0
|
|
|
|
|
|
return $begin.join( $joiner, @tojoin ).$end; |
4400
|
|
|
|
|
|
|
} |
4401
|
|
|
|
|
|
|
|
4402
|
|
|
|
|
|
|
=head2 locationbar |
4403
|
|
|
|
|
|
|
|
4404
|
|
|
|
|
|
|
This puts together the the location bar. |
4405
|
|
|
|
|
|
|
|
4406
|
|
|
|
|
|
|
One argument is taken and that is what to use for the lcation ID. |
4407
|
|
|
|
|
|
|
|
4408
|
|
|
|
|
|
|
$g->locationbar( $locationID ); |
4409
|
|
|
|
|
|
|
|
4410
|
|
|
|
|
|
|
=head3 Templates |
4411
|
|
|
|
|
|
|
|
4412
|
|
|
|
|
|
|
=head4 locationStart |
4413
|
|
|
|
|
|
|
|
4414
|
|
|
|
|
|
|
This starts the location bar. |
4415
|
|
|
|
|
|
|
|
4416
|
|
|
|
|
|
|
The template used is 'locationStart' and the default is as below. |
4417
|
|
|
|
|
|
|
|
4418
|
|
|
|
|
|
|
Location: |
4419
|
|
|
|
|
|
|
|
4420
|
|
|
|
|
|
|
The variabled passed are as below. |
4421
|
|
|
|
|
|
|
|
4422
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4423
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4424
|
|
|
|
|
|
|
obj - The L object. |
4425
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4426
|
|
|
|
|
|
|
self - The L object. |
4427
|
|
|
|
|
|
|
toader - This is a L object. |
4428
|
|
|
|
|
|
|
g - This is a L object. |
4429
|
|
|
|
|
|
|
|
4430
|
|
|
|
|
|
|
=head4 locationPart |
4431
|
|
|
|
|
|
|
|
4432
|
|
|
|
|
|
|
This is a part of the path in the location bar. |
4433
|
|
|
|
|
|
|
|
4434
|
|
|
|
|
|
|
The template used is 'locationPart' and the default is as below. |
4435
|
|
|
|
|
|
|
|
4436
|
|
|
|
|
|
|
[== $text ==] / |
4437
|
|
|
|
|
|
|
|
4438
|
|
|
|
|
|
|
The variables passed are as below. |
4439
|
|
|
|
|
|
|
|
4440
|
|
|
|
|
|
|
url - This is the relative URL for this. |
4441
|
|
|
|
|
|
|
text - This to use for with the link. |
4442
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4443
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4444
|
|
|
|
|
|
|
obj - The L object. |
4445
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4446
|
|
|
|
|
|
|
self - The L object. |
4447
|
|
|
|
|
|
|
toader - This is a L object. |
4448
|
|
|
|
|
|
|
g - This is a L object. |
4449
|
|
|
|
|
|
|
|
4450
|
|
|
|
|
|
|
=head4 locationEnd |
4451
|
|
|
|
|
|
|
|
4452
|
|
|
|
|
|
|
This is the end of the location bar. |
4453
|
|
|
|
|
|
|
|
4454
|
|
|
|
|
|
|
The template used is 'locationEnd' and the default is as below. |
4455
|
|
|
|
|
|
|
|
4456
|
|
|
|
|
|
|
[== $locationID ==] |
4457
|
|
|
|
|
|
|
|
4458
|
|
|
|
|
|
|
|
4459
|
|
|
|
|
|
|
The variables passed are as below. |
4460
|
|
|
|
|
|
|
|
4461
|
|
|
|
|
|
|
url - This is the relative URL for this. |
4462
|
|
|
|
|
|
|
text - This to use for with the link. |
4463
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4464
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4465
|
|
|
|
|
|
|
obj - The L object. |
4466
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4467
|
|
|
|
|
|
|
self - The L object. |
4468
|
|
|
|
|
|
|
toader - This is a L object. |
4469
|
|
|
|
|
|
|
g - This is a L object. |
4470
|
|
|
|
|
|
|
locationID - The string to use for the end location bar. |
4471
|
|
|
|
|
|
|
|
4472
|
|
|
|
|
|
|
=cut |
4473
|
|
|
|
|
|
|
|
4474
|
|
|
|
|
|
|
sub locationbar{ |
4475
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4476
|
0
|
|
|
|
|
|
my $locationID=$_[1]; |
4477
|
|
|
|
|
|
|
|
4478
|
|
|
|
|
|
|
#blank any previous errors |
4479
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4480
|
0
|
|
|
|
|
|
return undef; |
4481
|
|
|
|
|
|
|
} |
4482
|
|
|
|
|
|
|
|
4483
|
0
|
|
|
|
|
|
my @parts=split( /\//, $self->{r2r} ); |
4484
|
|
|
|
|
|
|
|
4485
|
|
|
|
|
|
|
#render it |
4486
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
4487
|
|
|
|
|
|
|
'locationStart', |
4488
|
|
|
|
|
|
|
{ |
4489
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4490
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4491
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4492
|
|
|
|
|
|
|
self=>\$self, |
4493
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4494
|
|
|
|
|
|
|
g=>\$self, |
4495
|
|
|
|
|
|
|
} |
4496
|
|
|
|
|
|
|
); |
4497
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4498
|
0
|
|
|
|
|
|
$self->{error}=10; |
4499
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4500
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4501
|
0
|
|
|
|
|
|
$self->warn; |
4502
|
0
|
|
|
|
|
|
return undef; |
4503
|
|
|
|
|
|
|
} |
4504
|
|
|
|
|
|
|
|
4505
|
|
|
|
|
|
|
#creates the url and cleans it up |
4506
|
0
|
|
|
|
|
|
my $url=$self->{b2r}; |
4507
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
4508
|
|
|
|
|
|
|
|
4509
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
4510
|
0
|
|
|
|
|
|
$url=$self->{url}; |
4511
|
|
|
|
|
|
|
} |
4512
|
|
|
|
|
|
|
|
4513
|
|
|
|
|
|
|
#does the initial link to the root directory |
4514
|
0
|
|
|
|
|
|
$rendered=$rendered.$self->{t}->fill_in( |
4515
|
|
|
|
|
|
|
'locationPart', |
4516
|
|
|
|
|
|
|
{ |
4517
|
|
|
|
|
|
|
url=>$url, |
4518
|
|
|
|
|
|
|
text=>'root', |
4519
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4520
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4521
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4522
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4523
|
|
|
|
|
|
|
self=>\$self, |
4524
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4525
|
|
|
|
|
|
|
g=>\$self, |
4526
|
|
|
|
|
|
|
} |
4527
|
|
|
|
|
|
|
); |
4528
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4529
|
0
|
|
|
|
|
|
$self->{error}=10; |
4530
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4531
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4532
|
0
|
|
|
|
|
|
$self->warn; |
4533
|
0
|
|
|
|
|
|
return undef; |
4534
|
|
|
|
|
|
|
} |
4535
|
|
|
|
|
|
|
|
4536
|
|
|
|
|
|
|
#processes each item |
4537
|
0
|
|
|
|
|
|
my $int=0; |
4538
|
0
|
|
|
|
|
|
my $dir=$self->{b2r}.'/'; |
4539
|
0
|
|
|
|
|
|
while ( defined( $parts[$int] ) ){ |
4540
|
|
|
|
|
|
|
|
4541
|
0
|
0
|
|
|
|
|
if ( $parts[$int] ne '.' ){ |
4542
|
0
|
|
|
|
|
|
$dir=$dir.$parts[$int].'/'; |
4543
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
4544
|
0
|
|
|
|
|
|
$rendered=$rendered.$self->{t}->fill_in( |
4545
|
|
|
|
|
|
|
'locationPart', |
4546
|
|
|
|
|
|
|
{ |
4547
|
|
|
|
|
|
|
url=>$dir, |
4548
|
|
|
|
|
|
|
text=>$parts[$int], |
4549
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4550
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4551
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4552
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4553
|
|
|
|
|
|
|
self=>\$self, |
4554
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4555
|
|
|
|
|
|
|
g=>\$self, |
4556
|
|
|
|
|
|
|
} |
4557
|
|
|
|
|
|
|
); |
4558
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4559
|
0
|
|
|
|
|
|
$self->{error}=10; |
4560
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4561
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4562
|
0
|
|
|
|
|
|
$self->warn; |
4563
|
0
|
|
|
|
|
|
return undef; |
4564
|
|
|
|
|
|
|
} |
4565
|
|
|
|
|
|
|
} |
4566
|
|
|
|
|
|
|
|
4567
|
0
|
|
|
|
|
|
$int++; |
4568
|
|
|
|
|
|
|
} |
4569
|
|
|
|
|
|
|
|
4570
|
|
|
|
|
|
|
#gets the location ID |
4571
|
0
|
0
|
|
|
|
|
if( ! defined( $locationID ) ){ |
4572
|
0
|
|
|
|
|
|
$locationID=$self->{obj}->locationID; |
4573
|
|
|
|
|
|
|
} |
4574
|
|
|
|
|
|
|
|
4575
|
|
|
|
|
|
|
|
4576
|
0
|
|
|
|
|
|
$rendered=$rendered.$self->{t}->fill_in( |
4577
|
|
|
|
|
|
|
'locationEnd', |
4578
|
|
|
|
|
|
|
{ |
4579
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4580
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4581
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4582
|
|
|
|
|
|
|
locationID=>$locationID, |
4583
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4584
|
|
|
|
|
|
|
self=>\$self, |
4585
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4586
|
|
|
|
|
|
|
g=>\$self, |
4587
|
|
|
|
|
|
|
} |
4588
|
|
|
|
|
|
|
); |
4589
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4590
|
0
|
|
|
|
|
|
$self->{error}=10; |
4591
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4592
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4593
|
0
|
|
|
|
|
|
$self->warn; |
4594
|
0
|
|
|
|
|
|
return undef; |
4595
|
|
|
|
|
|
|
} |
4596
|
|
|
|
|
|
|
|
4597
|
0
|
|
|
|
|
|
return $rendered; |
4598
|
|
|
|
|
|
|
} |
4599
|
|
|
|
|
|
|
|
4600
|
|
|
|
|
|
|
=head2 locationSubSet |
4601
|
|
|
|
|
|
|
|
4602
|
|
|
|
|
|
|
This returns what ever has been set for the location sub via |
4603
|
|
|
|
|
|
|
L->locationSubSet. |
4604
|
|
|
|
|
|
|
|
4605
|
|
|
|
|
|
|
[== $g->locationSub ==] |
4606
|
|
|
|
|
|
|
|
4607
|
|
|
|
|
|
|
=cut |
4608
|
|
|
|
|
|
|
|
4609
|
|
|
|
|
|
|
sub locationSub{ |
4610
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4611
|
|
|
|
|
|
|
|
4612
|
|
|
|
|
|
|
#blank any previous errors |
4613
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4614
|
0
|
|
|
|
|
|
return undef; |
4615
|
|
|
|
|
|
|
} |
4616
|
|
|
|
|
|
|
|
4617
|
0
|
|
|
|
|
|
return $self->{locationSub}; |
4618
|
|
|
|
|
|
|
} |
4619
|
|
|
|
|
|
|
|
4620
|
|
|
|
|
|
|
=head2 locationSub |
4621
|
|
|
|
|
|
|
|
4622
|
|
|
|
|
|
|
This sets the location sub. |
4623
|
|
|
|
|
|
|
|
4624
|
|
|
|
|
|
|
One argument is taken and that is what to set it to. |
4625
|
|
|
|
|
|
|
|
4626
|
|
|
|
|
|
|
If not defined, '' is used. |
4627
|
|
|
|
|
|
|
|
4628
|
|
|
|
|
|
|
[== $g->locationSubSet( $whatever ) ==] |
4629
|
|
|
|
|
|
|
|
4630
|
|
|
|
|
|
|
=cut |
4631
|
|
|
|
|
|
|
|
4632
|
|
|
|
|
|
|
sub locationSubSet{ |
4633
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4634
|
0
|
|
|
|
|
|
my $locationSub=$_[1]; |
4635
|
|
|
|
|
|
|
|
4636
|
|
|
|
|
|
|
#blank any previous errors |
4637
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4638
|
0
|
|
|
|
|
|
return undef; |
4639
|
|
|
|
|
|
|
} |
4640
|
|
|
|
|
|
|
|
4641
|
0
|
0
|
|
|
|
|
if ( ! defined( $locationSub ) ){ |
4642
|
0
|
|
|
|
|
|
$locationSub=''; |
4643
|
|
|
|
|
|
|
} |
4644
|
|
|
|
|
|
|
|
4645
|
0
|
|
|
|
|
|
$self->{locationSub}=$locationSub; |
4646
|
|
|
|
|
|
|
|
4647
|
0
|
|
|
|
|
|
return 1; |
4648
|
|
|
|
|
|
|
} |
4649
|
|
|
|
|
|
|
|
4650
|
|
|
|
|
|
|
=head2 or2r |
4651
|
|
|
|
|
|
|
|
4652
|
|
|
|
|
|
|
This returns the current value to from the root directory |
4653
|
|
|
|
|
|
|
to directory for the object that initialized this instance |
4654
|
|
|
|
|
|
|
of L. |
4655
|
|
|
|
|
|
|
|
4656
|
|
|
|
|
|
|
my $or2r=$g->or2r; |
4657
|
|
|
|
|
|
|
|
4658
|
|
|
|
|
|
|
=cut |
4659
|
|
|
|
|
|
|
|
4660
|
|
|
|
|
|
|
sub or2r{ |
4661
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4662
|
|
|
|
|
|
|
|
4663
|
|
|
|
|
|
|
#blank any previous errors |
4664
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4665
|
0
|
|
|
|
|
|
return undef; |
4666
|
|
|
|
|
|
|
} |
4667
|
|
|
|
|
|
|
|
4668
|
0
|
|
|
|
|
|
return $self->{or2r}; |
4669
|
|
|
|
|
|
|
} |
4670
|
|
|
|
|
|
|
|
4671
|
|
|
|
|
|
|
=head2 pageSummary |
4672
|
|
|
|
|
|
|
|
4673
|
|
|
|
|
|
|
This creates a summary of the pages in the current directory. |
4674
|
|
|
|
|
|
|
|
4675
|
|
|
|
|
|
|
No arguments are taken. |
4676
|
|
|
|
|
|
|
|
4677
|
|
|
|
|
|
|
$g->pageSummary; |
4678
|
|
|
|
|
|
|
|
4679
|
|
|
|
|
|
|
=head3 Templates |
4680
|
|
|
|
|
|
|
|
4681
|
|
|
|
|
|
|
=head4 pageSummaryBegin |
4682
|
|
|
|
|
|
|
|
4683
|
|
|
|
|
|
|
The begins the summary of the pages. |
4684
|
|
|
|
|
|
|
|
4685
|
|
|
|
|
|
|
The template used is 'pageSummaryBegin' and the default is as below. |
4686
|
|
|
|
|
|
|
|
4687
|
|
|
|
|
|
|
4688
|
|
|
|
|
|
|
| Name | Summary |
4689
|
|
|
|
|
|
|
|
4690
|
|
|
|
|
|
|
|
4691
|
|
|
|
|
|
|
The variabled passed are as below. |
4692
|
|
|
|
|
|
|
|
4693
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4694
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4695
|
|
|
|
|
|
|
obj - The Toader::Entry object. |
4696
|
|
|
|
|
|
|
c - The Config::Tiny object containing the Toader config. |
4697
|
|
|
|
|
|
|
self - The Toader::Render::Entry object. |
4698
|
|
|
|
|
|
|
toader - This is a Toader object. |
4699
|
|
|
|
|
|
|
g - This is a Toader::Render::General object. |
4700
|
|
|
|
|
|
|
|
4701
|
|
|
|
|
|
|
=head4 pageSummaryJoin |
4702
|
|
|
|
|
|
|
|
4703
|
|
|
|
|
|
|
This joins the rows. |
4704
|
|
|
|
|
|
|
|
4705
|
|
|
|
|
|
|
The template used is 'pageSummaryJoin' and by default is blank. |
4706
|
|
|
|
|
|
|
|
4707
|
|
|
|
|
|
|
The variabled passed are as below. |
4708
|
|
|
|
|
|
|
|
4709
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4710
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4711
|
|
|
|
|
|
|
obj - The L object. |
4712
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4713
|
|
|
|
|
|
|
self - The L object. |
4714
|
|
|
|
|
|
|
toader - This is a L object. |
4715
|
|
|
|
|
|
|
g - This is a L object. |
4716
|
|
|
|
|
|
|
|
4717
|
|
|
|
|
|
|
=head4 pageSummarySummary |
4718
|
|
|
|
|
|
|
|
4719
|
|
|
|
|
|
|
This is a row in the table of pages. |
4720
|
|
|
|
|
|
|
|
4721
|
|
|
|
|
|
|
The template used is 'pageSummarySummary' and by default is as below. |
4722
|
|
|
|
|
|
|
|
4723
|
|
|
|
|
|
|
|
4724
|
|
|
|
|
|
|
| [== $name ==] |
4725
|
|
|
|
|
|
|
| [== $summary ==] |
4726
|
|
|
|
|
|
|
|
4727
|
|
|
|
|
|
|
|
4728
|
|
|
|
|
|
|
The variabled passed are as below. |
4729
|
|
|
|
|
|
|
|
4730
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4731
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4732
|
|
|
|
|
|
|
obj - The L object. |
4733
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4734
|
|
|
|
|
|
|
self - The L object. |
4735
|
|
|
|
|
|
|
toader - This is a L object. |
4736
|
|
|
|
|
|
|
g - This is a L object. |
4737
|
|
|
|
|
|
|
name - This is the name of the page. |
4738
|
|
|
|
|
|
|
summary - This is a summary of the page. |
4739
|
|
|
|
|
|
|
|
4740
|
|
|
|
|
|
|
=cut |
4741
|
|
|
|
|
|
|
|
4742
|
|
|
|
|
|
|
sub pageSummary{ |
4743
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4744
|
|
|
|
|
|
|
|
4745
|
|
|
|
|
|
|
#blank any previous errors |
4746
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4747
|
0
|
|
|
|
|
|
return undef; |
4748
|
|
|
|
|
|
|
} |
4749
|
|
|
|
|
|
|
|
4750
|
0
|
|
|
|
|
|
my $pm=Toader::Page::Manage->new( $self->{toader} ); |
4751
|
0
|
|
|
|
|
|
$pm->setDir( $self->{odir} ); |
4752
|
0
|
0
|
|
|
|
|
if ( $pm->error ){ |
4753
|
0
|
|
|
|
|
|
$self->{error}=31; |
4754
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to set the directory, "'.$self->{odir}. |
4755
|
|
|
|
|
|
|
'", for Toader::Page::Manage. error="'.$pm->error |
4756
|
|
|
|
|
|
|
.'" errorString="'.$pm->errorString.'"'; |
4757
|
0
|
|
|
|
|
|
$self->warn; |
4758
|
0
|
|
|
|
|
|
return undef; |
4759
|
|
|
|
|
|
|
} |
4760
|
|
|
|
|
|
|
|
4761
|
|
|
|
|
|
|
#lists the entries for the directory |
4762
|
0
|
|
|
|
|
|
my @pages=$pm->published; |
4763
|
0
|
0
|
|
|
|
|
if ( $pm->error ){ |
4764
|
0
|
|
|
|
|
|
$self->{error}=32; |
4765
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to list the pages for "'.$self->{odir}. |
4766
|
|
|
|
|
|
|
'". error="'.$pm->error.'" errorString="'.$pm->errorString.'"'; |
4767
|
0
|
|
|
|
|
|
$self->warn; |
4768
|
0
|
|
|
|
|
|
return undef; |
4769
|
|
|
|
|
|
|
} |
4770
|
|
|
|
|
|
|
|
4771
|
|
|
|
|
|
|
#return '' if there are none |
4772
|
0
|
0
|
|
|
|
|
if ( ! defined( $pages[0] ) ){ |
4773
|
0
|
|
|
|
|
|
return ''; |
4774
|
|
|
|
|
|
|
} |
4775
|
|
|
|
|
|
|
|
4776
|
|
|
|
|
|
|
#sort and order from last to first |
4777
|
0
|
|
|
|
|
|
@pages=sort(@pages); |
4778
|
0
|
|
|
|
|
|
@pages=reverse(@pages); |
4779
|
|
|
|
|
|
|
|
4780
|
|
|
|
|
|
|
#process each one |
4781
|
0
|
|
|
|
|
|
my @tojoin; |
4782
|
0
|
|
|
|
|
|
my $int=0; |
4783
|
0
|
|
|
|
|
|
while ( defined( $pages[$int] ) ){ |
4784
|
0
|
|
|
|
|
|
my $entry=$pm->read( $pages[$int] ); |
4785
|
0
|
0
|
|
|
|
|
if ( $pm->error ){ |
4786
|
0
|
|
|
|
|
|
$self->{error}=33; |
4787
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to read "'.$pages[$int].'" in "' |
4788
|
|
|
|
|
|
|
.$self->{odir}.'". error="'.$pm->error.'" errorstring="' |
4789
|
|
|
|
|
|
|
.$pm->errorString.'"'; |
4790
|
0
|
|
|
|
|
|
$self->warn; |
4791
|
0
|
|
|
|
|
|
return undef; |
4792
|
|
|
|
|
|
|
} |
4793
|
|
|
|
|
|
|
|
4794
|
|
|
|
|
|
|
#renders the row |
4795
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
4796
|
|
|
|
|
|
|
'pageSummaryRow', |
4797
|
|
|
|
|
|
|
{ |
4798
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4799
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4800
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4801
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4802
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4803
|
|
|
|
|
|
|
self=>\$self, |
4804
|
|
|
|
|
|
|
name=>$entry->nameGet, |
4805
|
|
|
|
|
|
|
summary=>$entry->summaryGet, |
4806
|
|
|
|
|
|
|
g=>\$self, |
4807
|
|
|
|
|
|
|
} |
4808
|
|
|
|
|
|
|
); |
4809
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4810
|
0
|
|
|
|
|
|
$self->{error}=10; |
4811
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4812
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4813
|
0
|
|
|
|
|
|
$self->warn; |
4814
|
0
|
|
|
|
|
|
return undef; |
4815
|
|
|
|
|
|
|
} |
4816
|
|
|
|
|
|
|
|
4817
|
0
|
|
|
|
|
|
push( @tojoin, $rendered ); |
4818
|
|
|
|
|
|
|
|
4819
|
0
|
|
|
|
|
|
$int++; |
4820
|
|
|
|
|
|
|
} |
4821
|
|
|
|
|
|
|
|
4822
|
|
|
|
|
|
|
#renders the joiner |
4823
|
0
|
|
|
|
|
|
my $joiner=$self->{t}->fill_in( |
4824
|
|
|
|
|
|
|
'pageSummaryJoin', |
4825
|
|
|
|
|
|
|
{ |
4826
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4827
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4828
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4829
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4830
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4831
|
|
|
|
|
|
|
self=>\$self, |
4832
|
|
|
|
|
|
|
g=>\$self, |
4833
|
|
|
|
|
|
|
} |
4834
|
|
|
|
|
|
|
); |
4835
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4836
|
0
|
|
|
|
|
|
$self->{error}=10; |
4837
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4838
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4839
|
0
|
|
|
|
|
|
$self->warn; |
4840
|
0
|
|
|
|
|
|
return undef; |
4841
|
|
|
|
|
|
|
} |
4842
|
|
|
|
|
|
|
|
4843
|
|
|
|
|
|
|
#renders the end of the dir list |
4844
|
0
|
|
|
|
|
|
my $end=$self->{t}->fill_in( |
4845
|
|
|
|
|
|
|
'pageSummaryEnd', |
4846
|
|
|
|
|
|
|
{ |
4847
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4848
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4849
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4850
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4851
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4852
|
|
|
|
|
|
|
self=>\$self, |
4853
|
|
|
|
|
|
|
g=>\$self, |
4854
|
|
|
|
|
|
|
} |
4855
|
|
|
|
|
|
|
); |
4856
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4857
|
0
|
|
|
|
|
|
$self->{error}=10; |
4858
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4859
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4860
|
0
|
|
|
|
|
|
$self->warn; |
4861
|
0
|
|
|
|
|
|
return undef; |
4862
|
|
|
|
|
|
|
} |
4863
|
|
|
|
|
|
|
|
4864
|
|
|
|
|
|
|
#renders the end of the dir list |
4865
|
0
|
|
|
|
|
|
my $begin=$self->{t}->fill_in( |
4866
|
|
|
|
|
|
|
'pageSummaryBegin', |
4867
|
|
|
|
|
|
|
{ |
4868
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4869
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4870
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4871
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4872
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4873
|
|
|
|
|
|
|
self=>\$self, |
4874
|
|
|
|
|
|
|
g=>\$self, |
4875
|
|
|
|
|
|
|
} |
4876
|
|
|
|
|
|
|
); |
4877
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4878
|
0
|
|
|
|
|
|
$self->{error}=10; |
4879
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4880
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4881
|
0
|
|
|
|
|
|
$self->warn; |
4882
|
0
|
|
|
|
|
|
return undef; |
4883
|
|
|
|
|
|
|
} |
4884
|
|
|
|
|
|
|
|
4885
|
0
|
|
|
|
|
|
return $begin.join( $joiner, @tojoin ).$end; |
4886
|
|
|
|
|
|
|
} |
4887
|
|
|
|
|
|
|
|
4888
|
|
|
|
|
|
|
=head2 pageSummaryLink |
4889
|
|
|
|
|
|
|
|
4890
|
|
|
|
|
|
|
This is a link to summary of the pages for directory of the object. |
4891
|
|
|
|
|
|
|
|
4892
|
|
|
|
|
|
|
On argument is accepted and that is the text to use for the link. If |
4893
|
|
|
|
|
|
|
not specified, it defaults to 'Pages'. |
4894
|
|
|
|
|
|
|
|
4895
|
|
|
|
|
|
|
$g->pageSummaryLink; |
4896
|
|
|
|
|
|
|
|
4897
|
|
|
|
|
|
|
The template used is 'pageSummaryLink' and the default is as below. |
4898
|
|
|
|
|
|
|
|
4899
|
|
|
|
|
|
|
[== $text ==] |
4900
|
|
|
|
|
|
|
|
4901
|
|
|
|
|
|
|
The variables passed are as below. |
4902
|
|
|
|
|
|
|
|
4903
|
|
|
|
|
|
|
url - This is the relative URL for this. |
4904
|
|
|
|
|
|
|
text - This to use for with the link. |
4905
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4906
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4907
|
|
|
|
|
|
|
obj - The L object. |
4908
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4909
|
|
|
|
|
|
|
self - The L object. |
4910
|
|
|
|
|
|
|
toader - This is a L object. |
4911
|
|
|
|
|
|
|
g - This is a L object. |
4912
|
|
|
|
|
|
|
|
4913
|
|
|
|
|
|
|
=cut |
4914
|
|
|
|
|
|
|
|
4915
|
|
|
|
|
|
|
sub pageSummaryLink{ |
4916
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
4917
|
0
|
|
|
|
|
|
my $text=$_[1]; |
4918
|
|
|
|
|
|
|
|
4919
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
4920
|
0
|
|
|
|
|
|
$text='Pages'; |
4921
|
|
|
|
|
|
|
} |
4922
|
|
|
|
|
|
|
|
4923
|
|
|
|
|
|
|
#blank any previous errors |
4924
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
4925
|
0
|
|
|
|
|
|
return undef; |
4926
|
|
|
|
|
|
|
} |
4927
|
|
|
|
|
|
|
|
4928
|
0
|
|
|
|
|
|
my $url; |
4929
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
4930
|
0
|
|
|
|
|
|
$url=$self->{r2r}.'/.pages/summary.html'; |
4931
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
4932
|
0
|
|
|
|
|
|
$url=$self->{url}; |
4933
|
|
|
|
|
|
|
}else{ |
4934
|
0
|
|
|
|
|
|
$url=$self->{toDir}.'/.pages/summary.html'; |
4935
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
4936
|
|
|
|
|
|
|
} |
4937
|
|
|
|
|
|
|
|
4938
|
|
|
|
|
|
|
#render it |
4939
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
4940
|
|
|
|
|
|
|
'pageSummaryLink', |
4941
|
|
|
|
|
|
|
{ |
4942
|
|
|
|
|
|
|
url=>$url, |
4943
|
|
|
|
|
|
|
text=>$text, |
4944
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
4945
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
4946
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
4947
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
4948
|
|
|
|
|
|
|
self=>\$self, |
4949
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
4950
|
|
|
|
|
|
|
g=>\$self, |
4951
|
|
|
|
|
|
|
} |
4952
|
|
|
|
|
|
|
); |
4953
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
4954
|
0
|
|
|
|
|
|
$self->{error}=10; |
4955
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
4956
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
4957
|
0
|
|
|
|
|
|
$self->warn; |
4958
|
0
|
|
|
|
|
|
return undef; |
4959
|
|
|
|
|
|
|
} |
4960
|
|
|
|
|
|
|
|
4961
|
0
|
|
|
|
|
|
return $rendered; |
4962
|
|
|
|
|
|
|
} |
4963
|
|
|
|
|
|
|
|
4964
|
|
|
|
|
|
|
=head2 plink |
4965
|
|
|
|
|
|
|
|
4966
|
|
|
|
|
|
|
This generates a link to a different page object. |
4967
|
|
|
|
|
|
|
|
4968
|
|
|
|
|
|
|
Two arguments are taken. |
4969
|
|
|
|
|
|
|
|
4970
|
|
|
|
|
|
|
The first and required one is the Toader directory containing |
4971
|
|
|
|
|
|
|
the Toader object. |
4972
|
|
|
|
|
|
|
|
4973
|
|
|
|
|
|
|
The second is the page to link to. |
4974
|
|
|
|
|
|
|
|
4975
|
|
|
|
|
|
|
The third is the text, which if not specified will will be the |
4976
|
|
|
|
|
|
|
same the link. |
4977
|
|
|
|
|
|
|
|
4978
|
|
|
|
|
|
|
$g->plink( $dir, $page, "whatever at foo.bar" ); |
4979
|
|
|
|
|
|
|
|
4980
|
|
|
|
|
|
|
The template used is 'linkPage' and it is by default as below. |
4981
|
|
|
|
|
|
|
|
4982
|
|
|
|
|
|
|
[== $text ==] |
4983
|
|
|
|
|
|
|
|
4984
|
|
|
|
|
|
|
The variables passed are as below. |
4985
|
|
|
|
|
|
|
|
4986
|
|
|
|
|
|
|
url - This is the relative URL for this. |
4987
|
|
|
|
|
|
|
text - This to use for with the link. |
4988
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
4989
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
4990
|
|
|
|
|
|
|
obj - The L object. |
4991
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
4992
|
|
|
|
|
|
|
self - The L object. |
4993
|
|
|
|
|
|
|
toader - This is a L object. |
4994
|
|
|
|
|
|
|
g - This is a L object. |
4995
|
|
|
|
|
|
|
|
4996
|
|
|
|
|
|
|
=cut |
4997
|
|
|
|
|
|
|
|
4998
|
|
|
|
|
|
|
sub plink{ |
4999
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
5000
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
5001
|
0
|
|
|
|
|
|
my $page=$_[2]; |
5002
|
0
|
|
|
|
|
|
my $text=$_[3]; |
5003
|
|
|
|
|
|
|
|
5004
|
|
|
|
|
|
|
#blank any previous errors |
5005
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
5006
|
0
|
|
|
|
|
|
return undef; |
5007
|
|
|
|
|
|
|
} |
5008
|
|
|
|
|
|
|
|
5009
|
|
|
|
|
|
|
#make sure we have a link |
5010
|
0
|
0
|
|
|
|
|
if ( ! defined( $dir ) ){ |
5011
|
0
|
|
|
|
|
|
$self->{error}=11; |
5012
|
0
|
|
|
|
|
|
$self->{errorString}='No Toader directory defined'; |
5013
|
0
|
|
|
|
|
|
$self->warn; |
5014
|
0
|
|
|
|
|
|
return undef; |
5015
|
|
|
|
|
|
|
} |
5016
|
|
|
|
|
|
|
|
5017
|
|
|
|
|
|
|
#make sure we have a link |
5018
|
0
|
0
|
|
|
|
|
if ( ! defined( $page ) ){ |
5019
|
0
|
|
|
|
|
|
$self->{error}=15; |
5020
|
0
|
|
|
|
|
|
$self->{errorString}='No Toader page defined'; |
5021
|
0
|
|
|
|
|
|
$self->warn; |
5022
|
0
|
|
|
|
|
|
return undef; |
5023
|
|
|
|
|
|
|
} |
5024
|
|
|
|
|
|
|
|
5025
|
|
|
|
|
|
|
#set the text to the same as the link if no text is defined |
5026
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
5027
|
0
|
|
|
|
|
|
$text=$page; |
5028
|
|
|
|
|
|
|
} |
5029
|
|
|
|
|
|
|
|
5030
|
|
|
|
|
|
|
#handles it if it is a full path |
5031
|
0
|
|
|
|
|
|
my $dirtest; |
5032
|
0
|
0
|
|
|
|
|
if ( $dir =~ /^\// ){ |
5033
|
0
|
|
|
|
|
|
$dir=$self->{toader}->getRootDir.$dir; |
5034
|
0
|
|
|
|
|
|
$dirtest=$dir; |
5035
|
0
|
|
|
|
|
|
$dir=$self->{ph}->relative2root( $dir ); |
5036
|
|
|
|
|
|
|
}else{ |
5037
|
0
|
|
|
|
|
|
$dirtest=$self->{dir}.'/'.$dir; |
5038
|
|
|
|
|
|
|
} |
5039
|
|
|
|
|
|
|
|
5040
|
|
|
|
|
|
|
#make sure it is a Toader directory |
5041
|
0
|
0
|
|
|
|
|
if ( ! $self->{isatd}->isaToaderDir( $dirtest ) ){ |
5042
|
0
|
|
|
|
|
|
$self->{error}=12; |
5043
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$dirtest.'" is not a Toader directory'; |
5044
|
0
|
|
|
|
|
|
$self->warn; |
5045
|
0
|
|
|
|
|
|
return undef; |
5046
|
|
|
|
|
|
|
} |
5047
|
|
|
|
|
|
|
|
5048
|
|
|
|
|
|
|
#make sure entry exists... will also make sure it exists |
5049
|
0
|
|
|
|
|
|
my $ph=Toader::Page::Helper->new( $self->{toader} ); |
5050
|
0
|
|
|
|
|
|
$ph->setDir( $dirtest ); |
5051
|
0
|
0
|
|
|
|
|
if ( ! $ph->pageExists( $page ) ){ |
5052
|
0
|
|
|
|
|
|
$self->{error}=16; |
5053
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader page "'.$page.'" does not exist for the Toader directory "'.$dirtest.'"'; |
5054
|
0
|
|
|
|
|
|
$self->warn; |
5055
|
0
|
|
|
|
|
|
return undef; |
5056
|
|
|
|
|
|
|
} |
5057
|
|
|
|
|
|
|
|
5058
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
5059
|
0
|
|
|
|
|
|
$dir=$dir.'/.pages/'.$page.'/'; |
5060
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
5061
|
0
|
|
|
|
|
|
$dir=$self->{url}.$dir; |
5062
|
|
|
|
|
|
|
}else{ |
5063
|
0
|
|
|
|
|
|
$dir=$self->{toDir}.'/'.$dir.'/.pages/'.$page.'/'; |
5064
|
0
|
|
|
|
|
|
$dir=~s/\/\/*/\//g; |
5065
|
|
|
|
|
|
|
} |
5066
|
|
|
|
|
|
|
|
5067
|
|
|
|
|
|
|
#render it |
5068
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
5069
|
|
|
|
|
|
|
'linkPage', |
5070
|
|
|
|
|
|
|
{ |
5071
|
|
|
|
|
|
|
url=>$dir, |
5072
|
|
|
|
|
|
|
text=>$text, |
5073
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
5074
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
5075
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
5076
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
5077
|
|
|
|
|
|
|
self=>\$self, |
5078
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
5079
|
|
|
|
|
|
|
g=>\$self, |
5080
|
|
|
|
|
|
|
} |
5081
|
|
|
|
|
|
|
); |
5082
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
5083
|
0
|
|
|
|
|
|
$self->{error}=10; |
5084
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
5085
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
5086
|
0
|
|
|
|
|
|
$self->warn; |
5087
|
0
|
|
|
|
|
|
return undef; |
5088
|
|
|
|
|
|
|
} |
5089
|
|
|
|
|
|
|
|
5090
|
0
|
|
|
|
|
|
return $rendered; |
5091
|
|
|
|
|
|
|
} |
5092
|
|
|
|
|
|
|
|
5093
|
|
|
|
|
|
|
=head2 r2r |
5094
|
|
|
|
|
|
|
|
5095
|
|
|
|
|
|
|
This returns the current value to from the root directory |
5096
|
|
|
|
|
|
|
to current directory. |
5097
|
|
|
|
|
|
|
|
5098
|
|
|
|
|
|
|
my $r2r=$g->r2r; |
5099
|
|
|
|
|
|
|
|
5100
|
|
|
|
|
|
|
=cut |
5101
|
|
|
|
|
|
|
|
5102
|
|
|
|
|
|
|
sub r2r{ |
5103
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
5104
|
|
|
|
|
|
|
|
5105
|
|
|
|
|
|
|
#blank any previous errors |
5106
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
5107
|
0
|
|
|
|
|
|
return undef; |
5108
|
|
|
|
|
|
|
} |
5109
|
|
|
|
|
|
|
|
5110
|
0
|
|
|
|
|
|
return $self->{r2r}; |
5111
|
|
|
|
|
|
|
} |
5112
|
|
|
|
|
|
|
|
5113
|
|
|
|
|
|
|
=head2 rlink |
5114
|
|
|
|
|
|
|
|
5115
|
|
|
|
|
|
|
This generates a link to the root directory. |
5116
|
|
|
|
|
|
|
|
5117
|
|
|
|
|
|
|
One option arguement is taken. It is the text part of the link. |
5118
|
|
|
|
|
|
|
If not defined it defaults to the relative path to the root |
5119
|
|
|
|
|
|
|
directory. |
5120
|
|
|
|
|
|
|
|
5121
|
|
|
|
|
|
|
$g->rlink("to root"); |
5122
|
|
|
|
|
|
|
|
5123
|
|
|
|
|
|
|
The template used is 'toRootLink' and is as below. |
5124
|
|
|
|
|
|
|
|
5125
|
|
|
|
|
|
|
[== $text ==] |
5126
|
|
|
|
|
|
|
|
5127
|
|
|
|
|
|
|
The variables are as below. |
5128
|
|
|
|
|
|
|
|
5129
|
|
|
|
|
|
|
url - This is the relative URL for this. |
5130
|
|
|
|
|
|
|
text - This to use for with the link. |
5131
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
5132
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
5133
|
|
|
|
|
|
|
obj - The L object. |
5134
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
5135
|
|
|
|
|
|
|
self - The L object. |
5136
|
|
|
|
|
|
|
toader - This is a L object. |
5137
|
|
|
|
|
|
|
g - This is a L object. |
5138
|
|
|
|
|
|
|
|
5139
|
|
|
|
|
|
|
=cut |
5140
|
|
|
|
|
|
|
|
5141
|
|
|
|
|
|
|
sub rlink{ |
5142
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
5143
|
0
|
|
|
|
|
|
my $text=$_[1]; |
5144
|
|
|
|
|
|
|
|
5145
|
|
|
|
|
|
|
#blank any previous errors |
5146
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
5147
|
0
|
|
|
|
|
|
return undef; |
5148
|
|
|
|
|
|
|
} |
5149
|
|
|
|
|
|
|
|
5150
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
5151
|
0
|
|
|
|
|
|
$text='/'; |
5152
|
|
|
|
|
|
|
} |
5153
|
|
|
|
|
|
|
|
5154
|
|
|
|
|
|
|
#creates the url and cleans it up |
5155
|
0
|
|
|
|
|
|
my $url=''; |
5156
|
0
|
0
|
|
|
|
|
if ( $self->{fullURL} ){ |
5157
|
0
|
|
|
|
|
|
$url=$self->{url}; |
5158
|
|
|
|
|
|
|
}else{ |
5159
|
0
|
|
|
|
|
|
$url=$self->{b2r}; |
5160
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
5161
|
|
|
|
|
|
|
} |
5162
|
|
|
|
|
|
|
|
5163
|
|
|
|
|
|
|
#render it |
5164
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
5165
|
|
|
|
|
|
|
'toRootLink', |
5166
|
|
|
|
|
|
|
{ |
5167
|
|
|
|
|
|
|
url=>$url, |
5168
|
|
|
|
|
|
|
text=>$text, |
5169
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
5170
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
5171
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
5172
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
5173
|
|
|
|
|
|
|
self=>\$self, |
5174
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
5175
|
|
|
|
|
|
|
g=>\$self, |
5176
|
|
|
|
|
|
|
} |
5177
|
|
|
|
|
|
|
); |
5178
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
5179
|
0
|
|
|
|
|
|
$self->{error}=10; |
5180
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
5181
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
5182
|
0
|
|
|
|
|
|
$self->warn; |
5183
|
0
|
|
|
|
|
|
return undef; |
5184
|
|
|
|
|
|
|
} |
5185
|
|
|
|
|
|
|
|
5186
|
0
|
|
|
|
|
|
return $rendered; |
5187
|
|
|
|
|
|
|
} |
5188
|
|
|
|
|
|
|
|
5189
|
|
|
|
|
|
|
=head2 sidebar |
5190
|
|
|
|
|
|
|
|
5191
|
|
|
|
|
|
|
This renders the sidebar for a page. |
5192
|
|
|
|
|
|
|
|
5193
|
|
|
|
|
|
|
The template is 'sidebar' and the default is as below. |
5194
|
|
|
|
|
|
|
|
5195
|
|
|
|
|
|
|
[== |
5196
|
|
|
|
|
|
|
if ( ! $g->hasEntries ){ |
5197
|
|
|
|
|
|
|
return ""; |
5198
|
|
|
|
|
|
|
} |
5199
|
|
|
|
|
|
|
return "Entries\n". |
5200
|
|
|
|
|
|
|
" ".$g->entriesLink." \n". |
5201
|
|
|
|
|
|
|
" ".$g->entriesArchiveLink." \n"; |
5202
|
|
|
|
|
|
|
==] |
5203
|
|
|
|
|
|
|
[== |
5204
|
|
|
|
|
|
|
my $pages=$g->listPages; |
5205
|
|
|
|
|
|
|
if ( ( ! defined( $pages ) ) || ( $pages eq "" ) ){ |
5206
|
|
|
|
|
|
|
return ""; |
5207
|
|
|
|
|
|
|
} |
5208
|
|
|
|
|
|
|
return "
".$g->pageSummaryLink."\n".$pages."\n \n"; |
5209
|
|
|
|
|
|
|
==] |
5210
|
|
|
|
|
|
|
[== |
5211
|
|
|
|
|
|
|
if( $g->hasGallery ){ |
5212
|
|
|
|
|
|
|
return " \n".$g->galleryLink.""; |
5213
|
|
|
|
|
|
|
}else{ |
5214
|
|
|
|
|
|
|
return ""; |
5215
|
|
|
|
|
|
|
} |
5216
|
|
|
|
|
|
|
==] |
5217
|
|
|
|
|
|
|
[== |
5218
|
|
|
|
|
|
|
if( $g->hasAnyDirs ){ |
5219
|
|
|
|
|
|
|
return " \nDirectories"; |
5220
|
|
|
|
|
|
|
}else{ |
5221
|
|
|
|
|
|
|
return ""; |
5222
|
|
|
|
|
|
|
} |
5223
|
|
|
|
|
|
|
==] |
5224
|
|
|
|
|
|
|
[== |
5225
|
|
|
|
|
|
|
if ( $g->atRoot ){ |
5226
|
|
|
|
|
|
|
return ""; |
5227
|
|
|
|
|
|
|
} |
5228
|
|
|
|
|
|
|
return $g->rlink("Go To The Root")." \n ". |
5229
|
|
|
|
|
|
|
$g->upOneDirLink." \n "; |
5230
|
|
|
|
|
|
|
==] |
5231
|
|
|
|
|
|
|
|
5232
|
|
|
|
|
|
|
[== |
5233
|
|
|
|
|
|
|
if ( $g->hasSubDirs ){ |
5234
|
|
|
|
|
|
|
return $g->listDirs; |
5235
|
|
|
|
|
|
|
} |
5236
|
|
|
|
|
|
|
return ""; |
5237
|
|
|
|
|
|
|
==] |
5238
|
|
|
|
|
|
|
[== |
5239
|
|
|
|
|
|
|
if ( $g->hasDocs ){ |
5240
|
|
|
|
|
|
|
return " ".$g->adListLink; |
5241
|
|
|
|
|
|
|
} |
5242
|
|
|
|
|
|
|
return ""; |
5243
|
|
|
|
|
|
|
==] |
5244
|
|
|
|
|
|
|
|
5245
|
|
|
|
|
|
|
The variables are as below. |
5246
|
|
|
|
|
|
|
|
5247
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
5248
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
5249
|
|
|
|
|
|
|
obj - The L object. |
5250
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
5251
|
|
|
|
|
|
|
self - The L object. |
5252
|
|
|
|
|
|
|
toader - This is a L object. |
5253
|
|
|
|
|
|
|
g - This is a L object. |
5254
|
|
|
|
|
|
|
|
5255
|
|
|
|
|
|
|
=cut |
5256
|
|
|
|
|
|
|
|
5257
|
|
|
|
|
|
|
sub sidebar{ |
5258
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
5259
|
|
|
|
|
|
|
|
5260
|
|
|
|
|
|
|
#blank any previous errors |
5261
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
5262
|
0
|
|
|
|
|
|
return undef; |
5263
|
|
|
|
|
|
|
} |
5264
|
|
|
|
|
|
|
|
5265
|
|
|
|
|
|
|
#render it |
5266
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
5267
|
|
|
|
|
|
|
'sidebar', |
5268
|
|
|
|
|
|
|
{ |
5269
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
5270
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
5271
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
5272
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
5273
|
|
|
|
|
|
|
self=>\$self, |
5274
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
5275
|
|
|
|
|
|
|
g=>\$self, |
5276
|
|
|
|
|
|
|
} |
5277
|
|
|
|
|
|
|
); |
5278
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
5279
|
0
|
|
|
|
|
|
$self->{error}=10; |
5280
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
5281
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
5282
|
0
|
|
|
|
|
|
$self->warn; |
5283
|
0
|
|
|
|
|
|
return undef; |
5284
|
|
|
|
|
|
|
} |
5285
|
|
|
|
|
|
|
|
5286
|
0
|
|
|
|
|
|
return $rendered; |
5287
|
|
|
|
|
|
|
} |
5288
|
|
|
|
|
|
|
|
5289
|
|
|
|
|
|
|
=head2 toDir |
5290
|
|
|
|
|
|
|
|
5291
|
|
|
|
|
|
|
This returns the value that was set for toDir. |
5292
|
|
|
|
|
|
|
|
5293
|
|
|
|
|
|
|
my $toDir=>$g->toDir; |
5294
|
|
|
|
|
|
|
|
5295
|
|
|
|
|
|
|
=cut |
5296
|
|
|
|
|
|
|
|
5297
|
|
|
|
|
|
|
sub toDir{ |
5298
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
5299
|
|
|
|
|
|
|
|
5300
|
|
|
|
|
|
|
#blank any previous errors |
5301
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
5302
|
0
|
|
|
|
|
|
return undef; |
5303
|
|
|
|
|
|
|
} |
5304
|
|
|
|
|
|
|
|
5305
|
0
|
|
|
|
|
|
return $self->{toDir}; |
5306
|
|
|
|
|
|
|
} |
5307
|
|
|
|
|
|
|
|
5308
|
|
|
|
|
|
|
=head2 top |
5309
|
|
|
|
|
|
|
|
5310
|
|
|
|
|
|
|
This renders the top include. |
5311
|
|
|
|
|
|
|
|
5312
|
|
|
|
|
|
|
$g->top; |
5313
|
|
|
|
|
|
|
|
5314
|
|
|
|
|
|
|
The template is 'top' and the default is as below. |
5315
|
|
|
|
|
|
|
|
5316
|
|
|
|
|
|
|
[== $c->{_}->{site} ==] |
5317
|
|
|
|
|
|
|
|
5318
|
|
|
|
|
|
|
The variables are as below. |
5319
|
|
|
|
|
|
|
|
5320
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
5321
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
5322
|
|
|
|
|
|
|
obj - The L object. |
5323
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
5324
|
|
|
|
|
|
|
self - The L object. |
5325
|
|
|
|
|
|
|
toader - This is a L object. |
5326
|
|
|
|
|
|
|
g - This is a L object. |
5327
|
|
|
|
|
|
|
|
5328
|
|
|
|
|
|
|
=cut |
5329
|
|
|
|
|
|
|
|
5330
|
|
|
|
|
|
|
sub top{ |
5331
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
5332
|
|
|
|
|
|
|
|
5333
|
|
|
|
|
|
|
#blank any previous errors |
5334
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
5335
|
0
|
|
|
|
|
|
return undef; |
5336
|
|
|
|
|
|
|
} |
5337
|
|
|
|
|
|
|
|
5338
|
0
|
|
|
|
|
|
my $dir=$self->{b2r}; |
5339
|
|
|
|
|
|
|
|
5340
|
|
|
|
|
|
|
#add the toDir to it |
5341
|
0
|
|
|
|
|
|
$dir=$self->{toDir}.$dir; |
5342
|
|
|
|
|
|
|
|
5343
|
|
|
|
|
|
|
#render it |
5344
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
5345
|
|
|
|
|
|
|
'top', |
5346
|
|
|
|
|
|
|
{ |
5347
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
5348
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
5349
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
5350
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
5351
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
5352
|
|
|
|
|
|
|
self=>\$self, |
5353
|
|
|
|
|
|
|
g=>\$self, |
5354
|
|
|
|
|
|
|
} |
5355
|
|
|
|
|
|
|
); |
5356
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
5357
|
0
|
|
|
|
|
|
$self->{error}=10; |
5358
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
5359
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
5360
|
0
|
|
|
|
|
|
$self->warn; |
5361
|
0
|
|
|
|
|
|
return undef; |
5362
|
|
|
|
|
|
|
} |
5363
|
|
|
|
|
|
|
|
5364
|
0
|
|
|
|
|
|
return $rendered; |
5365
|
|
|
|
|
|
|
} |
5366
|
|
|
|
|
|
|
|
5367
|
|
|
|
|
|
|
=head2 upOneDirLink |
5368
|
|
|
|
|
|
|
|
5369
|
|
|
|
|
|
|
This creates a link up to the next directory. |
5370
|
|
|
|
|
|
|
|
5371
|
|
|
|
|
|
|
One argument is taken and that is text to show for the link. If |
5372
|
|
|
|
|
|
|
not specified, it defaults to 'Up One Directory'. |
5373
|
|
|
|
|
|
|
|
5374
|
|
|
|
|
|
|
$g->upOneDirLink; |
5375
|
|
|
|
|
|
|
|
5376
|
|
|
|
|
|
|
The template is 'upOneDirLink' and the default is as below. |
5377
|
|
|
|
|
|
|
|
5378
|
|
|
|
|
|
|
[== $text ==] |
5379
|
|
|
|
|
|
|
|
5380
|
|
|
|
|
|
|
The passed variables are as below. |
5381
|
|
|
|
|
|
|
|
5382
|
|
|
|
|
|
|
url - This is the relative URL for this. |
5383
|
|
|
|
|
|
|
text - This to use for with the link. |
5384
|
|
|
|
|
|
|
toDir - This is the relative back to the directory. |
5385
|
|
|
|
|
|
|
toFiles - This is the relative path to the '.files' directory. |
5386
|
|
|
|
|
|
|
obj - The L object. |
5387
|
|
|
|
|
|
|
c - The L object containing the Toader config. |
5388
|
|
|
|
|
|
|
self - The L object. |
5389
|
|
|
|
|
|
|
toader - This is a L object. |
5390
|
|
|
|
|
|
|
g - This is a L object. |
5391
|
|
|
|
|
|
|
|
5392
|
|
|
|
|
|
|
=cut |
5393
|
|
|
|
|
|
|
|
5394
|
|
|
|
|
|
|
sub upOneDirLink{ |
5395
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
5396
|
0
|
|
|
|
|
|
my $text=$_[1]; |
5397
|
|
|
|
|
|
|
|
5398
|
|
|
|
|
|
|
#blank any previous errors |
5399
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
5400
|
0
|
|
|
|
|
|
return undef; |
5401
|
|
|
|
|
|
|
} |
5402
|
|
|
|
|
|
|
|
5403
|
0
|
0
|
|
|
|
|
if ( ! defined( $text ) ){ |
5404
|
0
|
|
|
|
|
|
$text='Up One Directory'; |
5405
|
|
|
|
|
|
|
} |
5406
|
|
|
|
|
|
|
|
5407
|
|
|
|
|
|
|
#creates the url and cleans it up |
5408
|
0
|
|
|
|
|
|
my $url=$self->{toDir}.'/../'; |
5409
|
0
|
|
|
|
|
|
$url=~s/\/\/*/\//g; |
5410
|
|
|
|
|
|
|
|
5411
|
|
|
|
|
|
|
#render it |
5412
|
0
|
|
|
|
|
|
my $rendered=$self->{t}->fill_in( |
5413
|
|
|
|
|
|
|
'upOneDirLink', |
5414
|
|
|
|
|
|
|
{ |
5415
|
|
|
|
|
|
|
url=>$url, |
5416
|
|
|
|
|
|
|
text=>$text, |
5417
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
5418
|
|
|
|
|
|
|
toFiles=>$self->{toFiles}, |
5419
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
5420
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
5421
|
|
|
|
|
|
|
self=>\$self, |
5422
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
5423
|
|
|
|
|
|
|
g=>\$self, |
5424
|
|
|
|
|
|
|
} |
5425
|
|
|
|
|
|
|
); |
5426
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
5427
|
0
|
|
|
|
|
|
$self->{error}=10; |
5428
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to fill in the template. error="'. |
5429
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
5430
|
0
|
|
|
|
|
|
$self->warn; |
5431
|
0
|
|
|
|
|
|
return undef; |
5432
|
|
|
|
|
|
|
} |
5433
|
|
|
|
|
|
|
|
5434
|
0
|
|
|
|
|
|
return $rendered; |
5435
|
|
|
|
|
|
|
} |
5436
|
|
|
|
|
|
|
|
5437
|
|
|
|
|
|
|
=head1 ERROR CODES |
5438
|
|
|
|
|
|
|
|
5439
|
|
|
|
|
|
|
=head2 1, noToaderObj |
5440
|
|
|
|
|
|
|
|
5441
|
|
|
|
|
|
|
No L object defined. |
5442
|
|
|
|
|
|
|
|
5443
|
|
|
|
|
|
|
=head2 2, notAtoaderObj |
5444
|
|
|
|
|
|
|
|
5445
|
|
|
|
|
|
|
The object specified for the L object is not really a |
5446
|
|
|
|
|
|
|
L object. |
5447
|
|
|
|
|
|
|
|
5448
|
|
|
|
|
|
|
=head2 3, toaderPerror |
5449
|
|
|
|
|
|
|
|
5450
|
|
|
|
|
|
|
The specified L object has a permanent error set. |
5451
|
|
|
|
|
|
|
|
5452
|
|
|
|
|
|
|
=head2 4, noRenderableObj |
5453
|
|
|
|
|
|
|
|
5454
|
|
|
|
|
|
|
No object specified for the renderable object. |
5455
|
|
|
|
|
|
|
|
5456
|
|
|
|
|
|
|
=head2 5, notArenderableObj |
5457
|
|
|
|
|
|
|
|
5458
|
|
|
|
|
|
|
The object specified for the renderable object was not defined. |
5459
|
|
|
|
|
|
|
|
5460
|
|
|
|
|
|
|
=head2 6, objPerror |
5461
|
|
|
|
|
|
|
|
5462
|
|
|
|
|
|
|
The specified renderable object has a permanent error set. |
5463
|
|
|
|
|
|
|
|
5464
|
|
|
|
|
|
|
=head2 7, noDirSet |
5465
|
|
|
|
|
|
|
|
5466
|
|
|
|
|
|
|
The renderable object does not have a directory specified. |
5467
|
|
|
|
|
|
|
|
5468
|
|
|
|
|
|
|
=head2 8, noLinkDefined |
5469
|
|
|
|
|
|
|
|
5470
|
|
|
|
|
|
|
Nothing defined for the link. |
5471
|
|
|
|
|
|
|
|
5472
|
|
|
|
|
|
|
=head2 9, templateFetchErrored |
5473
|
|
|
|
|
|
|
|
5474
|
|
|
|
|
|
|
Failed to fetch the template. |
5475
|
|
|
|
|
|
|
|
5476
|
|
|
|
|
|
|
=head2 11, noToaderDirSpecified |
5477
|
|
|
|
|
|
|
|
5478
|
|
|
|
|
|
|
No Toader directory specified. |
5479
|
|
|
|
|
|
|
|
5480
|
|
|
|
|
|
|
=head2 12, notAtoaderDir |
5481
|
|
|
|
|
|
|
|
5482
|
|
|
|
|
|
|
The specified directory is not a L directory. |
5483
|
|
|
|
|
|
|
|
5484
|
|
|
|
|
|
|
=head2 13, noEntryIDspecified |
5485
|
|
|
|
|
|
|
|
5486
|
|
|
|
|
|
|
No L ID defined. |
5487
|
|
|
|
|
|
|
|
5488
|
|
|
|
|
|
|
=head2 14, entryDoesNotExist |
5489
|
|
|
|
|
|
|
|
5490
|
|
|
|
|
|
|
The entry does not exist. |
5491
|
|
|
|
|
|
|
|
5492
|
|
|
|
|
|
|
=head2 15, noPageSpecified |
5493
|
|
|
|
|
|
|
|
5494
|
|
|
|
|
|
|
No L page is defined. |
5495
|
|
|
|
|
|
|
|
5496
|
|
|
|
|
|
|
=head2 16, pageDoesNotExist |
5497
|
|
|
|
|
|
|
|
5498
|
|
|
|
|
|
|
The page does not exist. |
5499
|
|
|
|
|
|
|
|
5500
|
|
|
|
|
|
|
=head2 17, noFileSpecified |
5501
|
|
|
|
|
|
|
|
5502
|
|
|
|
|
|
|
No file specified. |
5503
|
|
|
|
|
|
|
|
5504
|
|
|
|
|
|
|
=head2 18, templateInitErrored |
5505
|
|
|
|
|
|
|
|
5506
|
|
|
|
|
|
|
Failed to initialize the L object. |
5507
|
|
|
|
|
|
|
|
5508
|
|
|
|
|
|
|
=head2 19, r2rErrored |
5509
|
|
|
|
|
|
|
|
5510
|
|
|
|
|
|
|
Failed to figure out the relative from root path. |
5511
|
|
|
|
|
|
|
|
5512
|
|
|
|
|
|
|
=head2 20, b2rErrored |
5513
|
|
|
|
|
|
|
|
5514
|
|
|
|
|
|
|
Failed to figure out the relative back to root path. |
5515
|
|
|
|
|
|
|
|
5516
|
|
|
|
|
|
|
=head2 21, pathhelperInitErrored |
5517
|
|
|
|
|
|
|
|
5518
|
|
|
|
|
|
|
Failed to initialize the L object. |
5519
|
|
|
|
|
|
|
|
5520
|
|
|
|
|
|
|
=head2 22, subToaderDirListErrored |
5521
|
|
|
|
|
|
|
|
5522
|
|
|
|
|
|
|
Failed to get a list of L sub directories for the |
5523
|
|
|
|
|
|
|
current directory. |
5524
|
|
|
|
|
|
|
|
5525
|
|
|
|
|
|
|
=head2 23, pageManageDirSetErrored |
5526
|
|
|
|
|
|
|
|
5527
|
|
|
|
|
|
|
Failed to set the directory for L. |
5528
|
|
|
|
|
|
|
|
5529
|
|
|
|
|
|
|
=head2 24, listPagesErrored |
5530
|
|
|
|
|
|
|
|
5531
|
|
|
|
|
|
|
Failed to get a list of pages. |
5532
|
|
|
|
|
|
|
|
5533
|
|
|
|
|
|
|
=head2 25, entryManageErrored |
5534
|
|
|
|
|
|
|
|
5535
|
|
|
|
|
|
|
L could not have it's directory set. |
5536
|
|
|
|
|
|
|
|
5537
|
|
|
|
|
|
|
=head2 26, readEntryErrored |
5538
|
|
|
|
|
|
|
|
5539
|
|
|
|
|
|
|
Failed to read a entry. |
5540
|
|
|
|
|
|
|
|
5541
|
|
|
|
|
|
|
=head2 27, renderEntryInitErrored |
5542
|
|
|
|
|
|
|
|
5543
|
|
|
|
|
|
|
Failed to initialize L. |
5544
|
|
|
|
|
|
|
|
5545
|
|
|
|
|
|
|
=head2 28, renderEntryErrored |
5546
|
|
|
|
|
|
|
|
5547
|
|
|
|
|
|
|
Failed to render a entry. |
5548
|
|
|
|
|
|
|
|
5549
|
|
|
|
|
|
|
=head2 29, noAuthorsLineSpecified |
5550
|
|
|
|
|
|
|
|
5551
|
|
|
|
|
|
|
No authors line specified. |
5552
|
|
|
|
|
|
|
|
5553
|
|
|
|
|
|
|
=head2 30, authorsLineParseFailed |
5554
|
|
|
|
|
|
|
|
5555
|
|
|
|
|
|
|
Failed to parse the authors line. |
5556
|
|
|
|
|
|
|
|
5557
|
|
|
|
|
|
|
=head2 31, entryManageDirSetErrored |
5558
|
|
|
|
|
|
|
|
5559
|
|
|
|
|
|
|
L could not have it's directory set. |
5560
|
|
|
|
|
|
|
|
5561
|
|
|
|
|
|
|
=head2 32, pageListErrored |
5562
|
|
|
|
|
|
|
|
5563
|
|
|
|
|
|
|
Failed to list the pages for the directory. |
5564
|
|
|
|
|
|
|
|
5565
|
|
|
|
|
|
|
=head2 33, pageReadErrored |
5566
|
|
|
|
|
|
|
|
5567
|
|
|
|
|
|
|
Failed to read the page. |
5568
|
|
|
|
|
|
|
|
5569
|
|
|
|
|
|
|
=head2 34, autoDocFileDotDotError |
5570
|
|
|
|
|
|
|
|
5571
|
|
|
|
|
|
|
The file specified for the AutoDoc link starts with a "../". |
5572
|
|
|
|
|
|
|
|
5573
|
|
|
|
|
|
|
=head2 35, noURLinConfig |
5574
|
|
|
|
|
|
|
|
5575
|
|
|
|
|
|
|
No URL specified in in the Toader Config. |
5576
|
|
|
|
|
|
|
|
5577
|
|
|
|
|
|
|
=head2 36, noImageURLspecified |
5578
|
|
|
|
|
|
|
|
5579
|
|
|
|
|
|
|
No URL specified for the image. |
5580
|
|
|
|
|
|
|
|
5581
|
|
|
|
|
|
|
=head2 37, noImageFileSpecified |
5582
|
|
|
|
|
|
|
|
5583
|
|
|
|
|
|
|
No image file specified. |
5584
|
|
|
|
|
|
|
|
5585
|
|
|
|
|
|
|
=head2 38, imageDoesNotExist |
5586
|
|
|
|
|
|
|
|
5587
|
|
|
|
|
|
|
The specified image does not exist. |
5588
|
|
|
|
|
|
|
|
5589
|
|
|
|
|
|
|
=head2 39, pathCleanupErrored |
5590
|
|
|
|
|
|
|
|
5591
|
|
|
|
|
|
|
Path cleanup failed. |
5592
|
|
|
|
|
|
|
|
5593
|
|
|
|
|
|
|
=head2 40, galleryInitErrored |
5594
|
|
|
|
|
|
|
|
5595
|
|
|
|
|
|
|
Failed to initialize Toader::Gallery. |
5596
|
|
|
|
|
|
|
|
5597
|
|
|
|
|
|
|
=head2 41, outputURLnotSpecified |
5598
|
|
|
|
|
|
|
|
5599
|
|
|
|
|
|
|
Undefined outputURL for Toader::Gallery. |
5600
|
|
|
|
|
|
|
|
5601
|
|
|
|
|
|
|
=head2 42, noSrcPathSpecified |
5602
|
|
|
|
|
|
|
|
5603
|
|
|
|
|
|
|
No source path specified for Toader::Gallery. |
5604
|
|
|
|
|
|
|
|
5605
|
|
|
|
|
|
|
=head2 43, noURLspecified |
5606
|
|
|
|
|
|
|
|
5607
|
|
|
|
|
|
|
No source URL specified for Toader::Gallery. |
5608
|
|
|
|
|
|
|
|
5609
|
|
|
|
|
|
|
=head2 44, relativeDirContainsAperiod |
5610
|
|
|
|
|
|
|
|
5611
|
|
|
|
|
|
|
The relative gallery directory contains a period. |
5612
|
|
|
|
|
|
|
|
5613
|
|
|
|
|
|
|
=head2 45, noSrcURLspecified |
5614
|
|
|
|
|
|
|
|
5615
|
|
|
|
|
|
|
No source URL specified for L. |
5616
|
|
|
|
|
|
|
|
5617
|
|
|
|
|
|
|
=head2 46, toaderAutoDocInitErrored |
5618
|
|
|
|
|
|
|
|
5619
|
|
|
|
|
|
|
Failed to initialize Toader::AutoDoc. |
5620
|
|
|
|
|
|
|
|
5621
|
|
|
|
|
|
|
=head1 AUTHOR |
5622
|
|
|
|
|
|
|
|
5623
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
5624
|
|
|
|
|
|
|
|
5625
|
|
|
|
|
|
|
=head1 BUGS |
5626
|
|
|
|
|
|
|
|
5627
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
5628
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
5629
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
5630
|
|
|
|
|
|
|
|
5631
|
|
|
|
|
|
|
=head1 SUPPORT |
5632
|
|
|
|
|
|
|
|
5633
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
5634
|
|
|
|
|
|
|
|
5635
|
|
|
|
|
|
|
perldoc Toader::Render::General |
5636
|
|
|
|
|
|
|
|
5637
|
|
|
|
|
|
|
You can also look for information at: |
5638
|
|
|
|
|
|
|
|
5639
|
|
|
|
|
|
|
=over 4 |
5640
|
|
|
|
|
|
|
|
5641
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
5642
|
|
|
|
|
|
|
|
5643
|
|
|
|
|
|
|
L |
5644
|
|
|
|
|
|
|
|
5645
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
5646
|
|
|
|
|
|
|
|
5647
|
|
|
|
|
|
|
L |
5648
|
|
|
|
|
|
|
|
5649
|
|
|
|
|
|
|
=item * CPAN Ratings |
5650
|
|
|
|
|
|
|
|
5651
|
|
|
|
|
|
|
L |
5652
|
|
|
|
|
|
|
|
5653
|
|
|
|
|
|
|
=item * Search CPAN |
5654
|
|
|
|
|
|
|
|
5655
|
|
|
|
|
|
|
L |
5656
|
|
|
|
|
|
|
|
5657
|
|
|
|
|
|
|
=back |
5658
|
|
|
|
|
|
|
|
5659
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
5660
|
|
|
|
|
|
|
|
5661
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
5662
|
|
|
|
|
|
|
|
5663
|
|
|
|
|
|
|
Copyright 2013. Zane C. Bowers-Hadley. |
5664
|
|
|
|
|
|
|
|
5665
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
5666
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
5667
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
5668
|
|
|
|
|
|
|
|
5669
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
5670
|
|
|
|
|
|
|
|
5671
|
|
|
|
|
|
|
|
5672
|
|
|
|
|
|
|
=cut |
5673
|
|
|
|
|
|
|
|
5674
|
|
|
|
|
|
|
1; # End of Toader::Render::General |
|