Toader/Render/General.pm

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