| 1 | package Toader::Templates::Defaults; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 6 | ▶ | use base 'Error::Helper'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | Toader::Templates::Defaults - This provides the default templates for Toader. | ||||||||||
| 10 | |||||||||||
| 11 | =head1 VERSION | ||||||||||
| 12 | |||||||||||
| 13 | Version 0.3.0 | ||||||||||
| 14 | |||||||||||
| 15 | =cut | ||||||||||
| 16 | |||||||||||
| 17 | 6 | our $VERSION = '0.3.0'; | |||||||||
| 18 | |||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||
| 20 | |||||||||||
| 21 | use Toader::Templates::Defaults; | ||||||||||
| 22 | |||||||||||
| 23 | #initiates the object | ||||||||||
| 24 | my $foo = Toader::Templates::Defaults->new; | ||||||||||
| 25 | |||||||||||
| 26 | #fetches the css template | ||||||||||
| 27 | my $template=$foo->getPage('css'); | ||||||||||
| 28 | if ( $foo->error ){ | ||||||||||
| 29 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | =head1 METHODS | ||||||||||
| 33 | |||||||||||
| 34 | =head2 new | ||||||||||
| 35 | |||||||||||
| 36 | This initiates the object. | ||||||||||
| 37 | |||||||||||
| 38 | This method does not error. | ||||||||||
| 39 | |||||||||||
| 40 | my $foo=Toader::Template::Defaults->new; | ||||||||||
| 41 | |||||||||||
| 42 | =cut | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub new{ | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 45 | 0 | my %args; | |||||||||
| 46 | 0 | ▶ | if(defined($_[1])){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | %args= %{$_[1]}; | |||||||||
| 48 | }; | ||||||||||
| 49 | |||||||||||
| 50 | 0 | my $self={ | |||||||||
| 51 | error=>undef, | ||||||||||
| 52 | errorString=>'', | ||||||||||
| 53 | templates=>{}, | ||||||||||
| 54 | errorExtra=>{ | ||||||||||
| 55 | flags=>{ | ||||||||||
| 56 | 1=>'noTemplateNameSpecified', | ||||||||||
| 57 | 2=>'noSuchTemplate', | ||||||||||
| 58 | }, | ||||||||||
| 59 | }, | ||||||||||
| 60 | }; | ||||||||||
| 61 | 0 | bless $self; | |||||||||
| 62 | |||||||||||
| 63 | 0 | $self->{templates}{'link'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 64 | 0 | $self->{templates}{'linkDirectory'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 65 | 0 | $self->{templates}{'linkEntry'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 66 | 0 | $self->{templates}{'linkPage'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 67 | 0 | $self->{templates}{'linkFile'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 68 | 0 | $self->{templates}{'linkDirectoryFile'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 69 | 0 | $self->{templates}{'linkEntryFile'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 70 | 0 | $self->{templates}{'linkPageFile'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 71 | 0 | $self->{templates}{'entriesLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 72 | 0 | $self->{templates}{'entriesArchiveLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 73 | 0 | $self->{templates}{'upOneDirLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 74 | 0 | $self->{templates}{'dirListLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 75 | 0 | $self->{templates}{'pageListLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 76 | 0 | $self->{templates}{'authorLink'}='<a href="mailto:[== $address ==]">[== $name ==]</a>'; | |||||||||
| 77 | 0 | $self->{templates}{'pageSummaryLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 78 | 0 | $self->{templates}{'toRootLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 79 | 0 | $self->{templates}{'autodocLink'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 80 | 0 | $self->{templates}{'linkAutoDocList'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 81 | 0 | $self->{templates}{'linkGallery'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 82 | |||||||||||
| 83 | 0 | $self->{templates}{'dirListBegin'}=''; | |||||||||
| 84 | 0 | $self->{templates}{'dirListEnd'}=''; | |||||||||
| 85 | 0 | $self->{templates}{'dirListJoin'}='<br>'."\n"; | |||||||||
| 86 | 0 | $self->{templates}{'dirListEnd'}='<br>'."\n"; | |||||||||
| 87 | |||||||||||
| 88 | 0 | $self->{templates}{'pageListBegin'}=''; | |||||||||
| 89 | 0 | $self->{templates}{'pageListJoin'}='<br>'."\n"; | |||||||||
| 90 | 0 | $self->{templates}{'pageListEnd'}='<br>'."\n"; | |||||||||
| 91 | |||||||||||
| 92 | 0 | $self->{templates}{'entryListBegin'}=''; | |||||||||
| 93 | 0 | $self->{templates}{'entryListJoin'}='<br>'."\n"; | |||||||||
| 94 | 0 | $self->{templates}{'entryListEnd'}='<br>'."\n"; | |||||||||
| 95 | |||||||||||
| 96 | 0 | $self->{templates}{'authorBegin'}=''; | |||||||||
| 97 | 0 | $self->{templates}{'authorEnd'}=''; | |||||||||
| 98 | 0 | $self->{templates}{'authorJoin'}=", \n"; | |||||||||
| 99 | 0 | $self->{templates}{'authorEnd'}="\n"; | |||||||||
| 100 | |||||||||||
| 101 | 0 | $self->{templates}{'cssInclude'}=''; | |||||||||
| 102 | 0 | $self->{templates}{'css'}='div{ | |||||||||
| 103 | border: 0px solid; | ||||||||||
| 104 | padding: 2px; | ||||||||||
| 105 | width: 100%; | ||||||||||
| 106 | } | ||||||||||
| 107 | div#sidebar{ | ||||||||||
| 108 | width: auto; | ||||||||||
| 109 | float: left; | ||||||||||
| 110 | border: 1px solid; | ||||||||||
| 111 | } | ||||||||||
| 112 | div#content{ | ||||||||||
| 113 | width: auto; | ||||||||||
| 114 | float: none; | ||||||||||
| 115 | } | ||||||||||
| 116 | div#location{ | ||||||||||
| 117 | width: 100%; | ||||||||||
| 118 | border: 1px solid; | ||||||||||
| 119 | } | ||||||||||
| 120 | div#header{ | ||||||||||
| 121 | width: 100%; | ||||||||||
| 122 | border: 1px solid; | ||||||||||
| 123 | } | ||||||||||
| 124 | div#content{ | ||||||||||
| 125 | width: 100%; | ||||||||||
| 126 | border: 1px solid; | ||||||||||
| 127 | } | ||||||||||
| 128 | div#imageDiv{ | ||||||||||
| 129 | border: 1px solid; | ||||||||||
| 130 | float: left; | ||||||||||
| 131 | } | ||||||||||
| 132 | div#copyright{ | ||||||||||
| 133 | width: auto; | ||||||||||
| 134 | text-align: center; | ||||||||||
| 135 | clear: left; | ||||||||||
| 136 | } | ||||||||||
| 137 | body{ | ||||||||||
| 138 | background: black; | ||||||||||
| 139 | color: white; | ||||||||||
| 140 | } | ||||||||||
| 141 | a:link{ | ||||||||||
| 142 | color: grey; | ||||||||||
| 143 | } | ||||||||||
| 144 | a:visited{ | ||||||||||
| 145 | color: lightgreen; | ||||||||||
| 146 | } | ||||||||||
| 147 | a:hover{ | ||||||||||
| 148 | color: green; | ||||||||||
| 149 | } | ||||||||||
| 150 | table#entryArchive{ | ||||||||||
| 151 | border: 1px solid; | ||||||||||
| 152 | } | ||||||||||
| 153 | td#entryArchive{ | ||||||||||
| 154 | border: 1px solid; | ||||||||||
| 155 | } | ||||||||||
| 156 | table#pageSummary{ | ||||||||||
| 157 | border: 1px solid; | ||||||||||
| 158 | } | ||||||||||
| 159 | td#pageSummary{ | ||||||||||
| 160 | border: 1px solid; | ||||||||||
| 161 | } | ||||||||||
| 162 | table#hashToTable{ | ||||||||||
| 163 | border: 1px solid; | ||||||||||
| 164 | } | ||||||||||
| 165 | td#hashToTable{ | ||||||||||
| 166 | border: 1px solid; | ||||||||||
| 167 | } | ||||||||||
| 168 | tr#hashToTable{ | ||||||||||
| 169 | border: 1px solid; | ||||||||||
| 170 | } | ||||||||||
| 171 | '; | ||||||||||
| 172 | |||||||||||
| 173 | 0 | $self->{templates}{'page'}='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |||||||||
| 174 | <html> | ||||||||||
| 175 | |||||||||||
| 176 | <head> | ||||||||||
| 177 | <title> [== $c->{_}->{siteTitle} ==] </title> | ||||||||||
| 178 | <LINK href="[== $g->cssLocation ==]" rel="stylesheet" type="text/css"> | ||||||||||
| 179 | </head> | ||||||||||
| 180 | |||||||||||
| 181 | <body> | ||||||||||
| 182 | |||||||||||
| 183 | <div id="header" > | ||||||||||
| 184 | [== $g->top ==] | ||||||||||
| 185 | </div> | ||||||||||
| 186 | |||||||||||
| 187 | <div id="location" > | ||||||||||
| 188 | [== $g->locationbar( $locationID ) ==] | ||||||||||
| 189 | [== $g->locationSub ==] | ||||||||||
| 190 | </div> | ||||||||||
| 191 | |||||||||||
| 192 | <div> | ||||||||||
| 193 | |||||||||||
| 194 | <div id="sidebar" > | ||||||||||
| 195 | [== $g->sidebar; ==] | ||||||||||
| 196 | </div> | ||||||||||
| 197 | |||||||||||
| 198 | <div id="maincontent" > | ||||||||||
| 199 | [== $content ==] | ||||||||||
| 200 | </div> | ||||||||||
| 201 | |||||||||||
| 202 | </div> | ||||||||||
| 203 | |||||||||||
| 204 | <br><br><br> | ||||||||||
| 205 | |||||||||||
| 206 | [== $g->copyright ==] | ||||||||||
| 207 | |||||||||||
| 208 | </body> | ||||||||||
| 209 | </html> | ||||||||||
| 210 | |||||||||||
| 211 | '; | ||||||||||
| 212 | |||||||||||
| 213 | 0 | $self->{templates}{'copyright'}='<div id="copyright"> | |||||||||
| 214 | [== | ||||||||||
| 215 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); | ||||||||||
| 216 | $year=$year+1900; | ||||||||||
| 217 | return "Copyright ".$year." ".$c->{_}->{owner}; | ||||||||||
| 218 | ==] | ||||||||||
| 219 | </div> | ||||||||||
| 220 | '; | ||||||||||
| 221 | |||||||||||
| 222 | 0 | $self->{templates}{'sidebar'}='[== | |||||||||
| 223 | if ( ! $g->hasEntries ){ | ||||||||||
| 224 | return ""; | ||||||||||
| 225 | } | ||||||||||
| 226 | return "<h3>Entries</h3>\n". | ||||||||||
| 227 | " ".$g->entriesLink." <br>\n". | ||||||||||
| 228 | " ".$g->entriesArchiveLink." <br>\n"; | ||||||||||
| 229 | ==] | ||||||||||
| 230 | [== | ||||||||||
| 231 | my $pages=$g->listPages; | ||||||||||
| 232 | if ( ( ! defined( $pages ) ) || ( $pages eq "" ) ){ | ||||||||||
| 233 | return ""; | ||||||||||
| 234 | } | ||||||||||
| 235 | return " <hr><h3>".$g->pageSummaryLink."</h3>\n".$pages."\n <hr>\n"; | ||||||||||
| 236 | ==] | ||||||||||
| 237 | [== | ||||||||||
| 238 | if( $g->hasGallery ){ | ||||||||||
| 239 | return "<hr>\n<h3>".$g->galleryLink."</h3>"; | ||||||||||
| 240 | }else{ | ||||||||||
| 241 | return ""; | ||||||||||
| 242 | } | ||||||||||
| 243 | ==] | ||||||||||
| 244 | [== | ||||||||||
| 245 | if( $g->hasAnyDirs ){ | ||||||||||
| 246 | return "<hr>\n<h3>Directories</h3>"; | ||||||||||
| 247 | }else{ | ||||||||||
| 248 | return ""; | ||||||||||
| 249 | } | ||||||||||
| 250 | ==] | ||||||||||
| 251 | [== | ||||||||||
| 252 | if ( $g->atRoot ){ | ||||||||||
| 253 | return ""; | ||||||||||
| 254 | } | ||||||||||
| 255 | return $g->rlink("Go To The Root")." <br>\n ". | ||||||||||
| 256 | $g->upOneDirLink." <br>\n <br>"; | ||||||||||
| 257 | ==] | ||||||||||
| 258 | |||||||||||
| 259 | [== | ||||||||||
| 260 | if ( $g->hasSubDirs ){ | ||||||||||
| 261 | return $g->listDirs; | ||||||||||
| 262 | } | ||||||||||
| 263 | return ""; | ||||||||||
| 264 | ==] | ||||||||||
| 265 | [== | ||||||||||
| 266 | if ( $g->hasDocs ){ | ||||||||||
| 267 | return "<hr>".$g->adListLink; | ||||||||||
| 268 | } | ||||||||||
| 269 | return ""; | ||||||||||
| 270 | ==] | ||||||||||
| 271 | '; | ||||||||||
| 272 | |||||||||||
| 273 | 0 | $self->{templates}{'pageGallery'}='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |||||||||
| 274 | <html> | ||||||||||
| 275 | |||||||||||
| 276 | <head> | ||||||||||
| 277 | <title> [== $c->{_}->{siteTitle} ==] </title> | ||||||||||
| 278 | <LINK href="[== $g->cssLocation ==]" rel="stylesheet" type="text/css"> | ||||||||||
| 279 | </head> | ||||||||||
| 280 | |||||||||||
| 281 | <body> | ||||||||||
| 282 | |||||||||||
| 283 | <div id="header" > | ||||||||||
| 284 | [== $g->top ==] | ||||||||||
| 285 | </div> | ||||||||||
| 286 | |||||||||||
| 287 | <div id="location" > | ||||||||||
| 288 | [== $g->locationbar( $locationID ) ==] | ||||||||||
| 289 | [== $g->locationSub ==] | ||||||||||
| 290 | </div> | ||||||||||
| 291 | |||||||||||
| 292 | <div> | ||||||||||
| 293 | |||||||||||
| 294 | <div id="content" > | ||||||||||
| 295 | [== $content ==] | ||||||||||
| 296 | </div> | ||||||||||
| 297 | |||||||||||
| 298 | <br><br><br> | ||||||||||
| 299 | |||||||||||
| 300 | <div id="copyright"> | ||||||||||
| 301 | [== | ||||||||||
| 302 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); | ||||||||||
| 303 | $year=$year+1900; | ||||||||||
| 304 | return "Copyright ".$year." ".$c->{_}->{owner}; | ||||||||||
| 305 | ==] | ||||||||||
| 306 | </div> | ||||||||||
| 307 | |||||||||||
| 308 | </body> | ||||||||||
| 309 | </html> | ||||||||||
| 310 | |||||||||||
| 311 | '; | ||||||||||
| 312 | |||||||||||
| 313 | 0 | $self->{templates}{'dirContent'}='[== $body ==]'; | |||||||||
| 314 | |||||||||||
| 315 | |||||||||||
| 316 | 0 | $self->{templates}{'pageContent'}='[== $body ==]'; | |||||||||
| 317 | |||||||||||
| 318 | 0 | $self->{templates}{'entryContent'}='<div id="content"> | |||||||||
| 319 | <h4>[== $g->elink( $g->or2r, $date, $title ) ==]</h4> | ||||||||||
| 320 | Date: [== $year.$month.$day."-".$hour.":".$min ==] <br> | ||||||||||
| 321 | Author: [== $g->authorsLink( $from ) ==]<br> | ||||||||||
| 322 | <div id="content"> | ||||||||||
| 323 | [== $body ==] | ||||||||||
| 324 | </div> | ||||||||||
| 325 | </div> | ||||||||||
| 326 | '; | ||||||||||
| 327 | |||||||||||
| 328 | 0 | $self->{templates}{'entryIndex'}='[== $g->lastEntries( $c->{_}->{last} ) ==]'; | |||||||||
| 329 | |||||||||||
| 330 | 0 | $self->{templates}{'entryArchive'}='[== $g->entryArchive ==]'; | |||||||||
| 331 | 0 | $self->{templates}{'entryArchiveBegin'}='<table id="entryArchive"> | |||||||||
| 332 | <tr> <td>Date</td> <td>Title</td> <td>Summary</td> </tr> | ||||||||||
| 333 | '; | ||||||||||
| 334 | 0 | $self->{templates}{'entryArchiveRow'}=' <tr id="entryArchive"> | |||||||||
| 335 | <td id="entryArchive">[== $g->elink( "./", $date, $date ) ==]</td> | ||||||||||
| 336 | <td id="entryArchive">[== $title ==]</td> | ||||||||||
| 337 | <td id="entryArchive">[== $summary ==]</td> | ||||||||||
| 338 | </tr> | ||||||||||
| 339 | '; | ||||||||||
| 340 | 0 | $self->{templates}{'entryArchiveJoin'}=''; | |||||||||
| 341 | 0 | $self->{templates}{'entryArchiveEnd'}='</table>'; | |||||||||
| 342 | |||||||||||
| 343 | 0 | $self->{templates}{'pageSummary'}='[== $g->pageSummary ==]'; | |||||||||
| 344 | |||||||||||
| 345 | 0 | $self->{templates}{'pageSummaryBegin'}='<table id="pageSummary"> | |||||||||
| 346 | <tr> <td>Name</td> <td>Summary</td> </tr> | ||||||||||
| 347 | '; | ||||||||||
| 348 | 0 | $self->{templates}{'pageSummaryRow'}=' <tr id="pageSummary"> | |||||||||
| 349 | <td id="pageSummary"><a href="./[== $name ==]/">[== $name ==]</a></td> | ||||||||||
| 350 | <td id="pageSummary">[== $summary ==]</td> | ||||||||||
| 351 | </tr> | ||||||||||
| 352 | '; | ||||||||||
| 353 | 0 | $self->{templates}{'pageSummaryJoin'}=''; | |||||||||
| 354 | 0 | $self->{templates}{'pageSummaryEnd'}='</table>'; | |||||||||
| 355 | |||||||||||
| 356 | 0 | $self->{templates}{'locationStart'}='<h2>Location: '; | |||||||||
| 357 | 0 | $self->{templates}{'locationPart'}='<a href="[== $url ==]">[== $text ==]</a> / '; | |||||||||
| 358 | 0 | $self->{templates}{'locationEnd'}='[== $locationID ==]</h2> | |||||||||
| 359 | '; | ||||||||||
| 360 | |||||||||||
| 361 | 0 | $self->{templates}{'top'}='<h1>[== $c->{_}->{site} ==]</h1><br>'; | |||||||||
| 362 | |||||||||||
| 363 | 0 | $self->{templates}{'autodocContent'}='[== $g->autodocList ==]'; | |||||||||
| 364 | 0 | $self->{templates}{'autodocListBegin'}='<table id="autodocList"> | |||||||||
| 365 | <tr> <td>File</td> </tr> | ||||||||||
| 366 | '; | ||||||||||
| 367 | 0 | $self->{templates}{'autodocListRow'}=' <tr id="autodocList"> | |||||||||
| 368 | <td id="autodocList">[== $g->adlink( $dir, $file ) ==]</td> | ||||||||||
| 369 | </tr> | ||||||||||
| 370 | '; | ||||||||||
| 371 | 0 | $self->{templates}{'autodocListJoin'}=''; | |||||||||
| 372 | 0 | $self->{templates}{'autodocListEnd'}='</table>'; | |||||||||
| 373 | |||||||||||
| 374 | 0 | $self->{templates}{'hashToTableBegin'}='<table id="[== $cssID ==]"> | |||||||||
| 375 | '; | ||||||||||
| 376 | 0 | $self->{templates}{'hashToTableTitle'}=' <tr id="[== $cssID ==]"> | |||||||||
| 377 | <td id="[== $cssID ==]"><bold>[== $keyTitle ==]</td> | ||||||||||
| 378 | <td id="[== $cssID ==]"><bold>[== $valueTitle ==]</bold></td> | ||||||||||
| 379 | </tr> | ||||||||||
| 380 | '; | ||||||||||
| 381 | 0 | $self->{templates}{'hashToTableRow'}=' <tr id="[== $cssID ==]"> | |||||||||
| 382 | <td id="[== $cssID ==]">[== $key ==]</td> | ||||||||||
| 383 | <td id="[== $cssID ==]">[== $value ==]</td> | ||||||||||
| 384 | </tr> | ||||||||||
| 385 | '; | ||||||||||
| 386 | |||||||||||
| 387 | 0 | $self->{templates}{'hashToTableJoin'}=''; | |||||||||
| 388 | 0 | $self->{templates}{'hashToTableEnd'}='</table>'; | |||||||||
| 389 | |||||||||||
| 390 | 0 | $self->{templates}{'imageDiv'}='<div id=\'[== $cssID ==]\'> | |||||||||
| 391 | [== $above ==] | ||||||||||
| 392 | [== if ( defined( $link ) ){ return \'<a href="\'.$link.\'">\' }else{ return \'\' } ==] | ||||||||||
| 393 | <img src="[== $image ==]" alt="[== $alt ==]"/> | ||||||||||
| 394 | [== if ( defined( $link ) ){ return \'</a>\' }else{ return \'\' } ==]<br> | ||||||||||
| 395 | [== $below ==] | ||||||||||
| 396 | </div> | ||||||||||
| 397 | '; | ||||||||||
| 398 | |||||||||||
| 399 | 0 | $self->{templates}{'gallerySmallImageBegin'}=''; | |||||||||
| 400 | 0 | $self->{templates}{'gallerySmallImage'}='[== $g->galleryImageSmall( $dir, $gdir, $image ); ==]'; | |||||||||
| 401 | 0 | $self->{templates}{'galleryDir'}='<div id="imageDiv" > [== $link ==] </div>'; | |||||||||
| 402 | 0 | $self->{templates}{'gallerySmallImageJoin'}="\n"; | |||||||||
| 403 | 0 | $self->{templates}{'gallerySmallImageEnd'}=''; | |||||||||
| 404 | |||||||||||
| 405 | 0 | $self->{templates}{'galleryLocationStart'}='<h3>Gallery Location: '; | |||||||||
| 406 | 0 | $self->{templates}{'galleryLocationPart'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 407 | 0 | $self->{templates}{'galleryLocationJoin'}=' / '; | |||||||||
| 408 | 0 | $self->{templates}{'galleryLocationEnd'}='</h3> | |||||||||
| 409 | '; | ||||||||||
| 410 | 0 | $self->{templates}{'galleryLocationImage'}='<h3>Image: <a href="[== $url ==]">[== $image ==]</a></h3> | |||||||||
| 411 | '; | ||||||||||
| 412 | |||||||||||
| 413 | |||||||||||
| 414 | 0 | $self->{templates}{'imageExifTablesGroup'}='<br /> | |||||||||
| 415 | <b>EXIF Tag Group: [== $group ==]</b> | ||||||||||
| 416 | [== $table ==] | ||||||||||
| 417 | <br /> | ||||||||||
| 418 | '; | ||||||||||
| 419 | 0 | $self->{templates}{'imageExifTablesJoin'}=''; | |||||||||
| 420 | 0 | $self->{templates}{'imageExifTablesBegin'}=''; | |||||||||
| 421 | 0 | $self->{templates}{'imageExifTablesEnd'}=''; | |||||||||
| 422 | 0 | $self->{templates}{'imageExifTables'}='<b>Image: </b> [== $filename ==] <br/> | |||||||||
| 423 | [== $tables ==] | ||||||||||
| 424 | '; | ||||||||||
| 425 | |||||||||||
| 426 | 0 | return $self; | |||||||||
| 427 | } | ||||||||||
| 428 | |||||||||||
| 429 | =head2 exists | ||||||||||
| 430 | |||||||||||
| 431 | This checks if the specified template exists as a default template. | ||||||||||
| 432 | |||||||||||
| 433 | One argument is required and that is the template name to check for. | ||||||||||
| 434 | This method will only throw a error if it is left undefined. | ||||||||||
| 435 | |||||||||||
| 436 | The return value is a Perl boolean value. | ||||||||||
| 437 | |||||||||||
| 438 | my $exists=$foo->exists($template); | ||||||||||
| 439 | |||||||||||
| 440 | =cut | ||||||||||
| 441 | |||||||||||
| 442 | 0 | ▶ | sub exists{ | ||||||||
|
Subroutine
exists: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 443 | 0 | my $self=$_[0]; | |||||||||
| 444 | 0 | my $name=$_[1]; | |||||||||
| 445 | |||||||||||
| 446 | 0 | ▶ | if ( ! $self->errorblank ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 447 | 0 | $self->{error}=1; | |||||||||
| 448 | 0 | $self->{errorString}='No template specified'; | |||||||||
| 449 | 0 | $self->warn; | |||||||||
| 450 | 0 | return undef; | |||||||||
| 451 | } | ||||||||||
| 452 | |||||||||||
| 453 | 0 | ▶ | if ( defined( $self->{templates}{$name} ) ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 454 | 0 | return 1; | |||||||||
| 455 | } | ||||||||||
| 456 | |||||||||||
| 457 | 0 | return 0; | |||||||||
| 458 | } | ||||||||||
| 459 | |||||||||||
| 460 | =head2 getTemplate | ||||||||||
| 461 | |||||||||||
| 462 | This returns a default template. | ||||||||||
| 463 | |||||||||||
| 464 | One argument is required and it is the template name. | ||||||||||
| 465 | |||||||||||
| 466 | There is no need to do error checking, if one is certian | ||||||||||
| 467 | the template exists. | ||||||||||
| 468 | |||||||||||
| 469 | my $template=$foo->getTemplate( $name ); | ||||||||||
| 470 | if ( $foo->error ){ | ||||||||||
| 471 | warn( 'Error:'.$foo->error.': '.$foo->errorString ); | ||||||||||
| 472 | } | ||||||||||
| 473 | |||||||||||
| 474 | =cut | ||||||||||
| 475 | |||||||||||
| 476 | 0 | ▶ | sub getTemplate{ | ||||||||
|
Subroutine
getTemplate: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 477 | 0 | my $self=$_[0]; | |||||||||
| 478 | 0 | my $name=$_[1]; | |||||||||
| 479 | |||||||||||
| 480 | 0 | ▶ | if ( ! $self->errorblank ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 481 | 0 | return undef; | |||||||||
| 482 | } | ||||||||||
| 483 | |||||||||||
| 484 | 0 | ▶ | if ( ! defined( $name ) ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 485 | 0 | $self->{error}=1; | |||||||||
| 486 | 0 | $self->{errorString}='No template specified'; | |||||||||
| 487 | 0 | $self->warn; | |||||||||
| 488 | 0 | return undef; | |||||||||
| 489 | } | ||||||||||
| 490 | |||||||||||
| 491 | 0 | ▶ | if ( ! defined( $self->{templates}{$name} ) ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 492 | 0 | $self->{error}=2; | |||||||||
| 493 | 0 | $self->{errorString}='"'.$name.'" is not a default template'; | |||||||||
| 494 | 0 | $self->warn; | |||||||||
| 495 | 0 | return undef; | |||||||||
| 496 | } | ||||||||||
| 497 | |||||||||||
| 498 | 0 | return $self->{templates}{$name}; | |||||||||
| 499 | } | ||||||||||
| 500 | |||||||||||
| 501 | =head2 listTemplates | ||||||||||
| 502 | |||||||||||
| 503 | This returns a list of default templates. | ||||||||||
| 504 | |||||||||||
| 505 | No arguments are taken. | ||||||||||
| 506 | |||||||||||
| 507 | my @defTemplates=$foo->listTemplates; | ||||||||||
| 508 | |||||||||||
| 509 | =cut | ||||||||||
| 510 | |||||||||||
| 511 | 0 | ▶ | sub listTemplates{ | ||||||||
|
Subroutine
listTemplates: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 512 | 0 | my $self=$_[0]; | |||||||||
| 513 | |||||||||||
| 514 | 0 | ▶ | if ( ! $self->errorblank ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 515 | 0 | return undef; | |||||||||
| 516 | } | ||||||||||
| 517 | |||||||||||
| 518 | 0 | return keys( %{ $self->{templates} } ); | |||||||||
| 519 | } | ||||||||||
| 520 | |||||||||||
| 521 | =head1 ERROR CODES/FLAGS | ||||||||||
| 522 | |||||||||||
| 523 | =head2 1, noTemplateNameSpecified | ||||||||||
| 524 | |||||||||||
| 525 | No template name specified. | ||||||||||
| 526 | |||||||||||
| 527 | =head2 2, noSuchTemplate | ||||||||||
| 528 | |||||||||||
| 529 | No such template. | ||||||||||
| 530 | |||||||||||
| 531 | =head1 AUTHOR | ||||||||||
| 532 | |||||||||||
| 533 | Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >> | ||||||||||
| 534 | |||||||||||
| 535 | =head1 BUGS | ||||||||||
| 536 | |||||||||||
| 537 | Please report any bugs or feature requests to C<bug-toader at rt.cpan.org>, or through | ||||||||||
| 538 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Toader>. I will be notified, and then you'll | ||||||||||
| 539 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 540 | |||||||||||
| 541 | =head1 SUPPORT | ||||||||||
| 542 | |||||||||||
| 543 | You can find documentation for this module with the perldoc command. | ||||||||||
| 544 | |||||||||||
| 545 | perldoc Toader::Templates::Defaults | ||||||||||
| 546 | |||||||||||
| 547 | |||||||||||
| 548 | You can also look for information at: | ||||||||||
| 549 | |||||||||||
| 550 | =over 4 | ||||||||||
| 551 | |||||||||||
| 552 | =item * RT: CPAN's request tracker | ||||||||||
| 553 | |||||||||||
| 554 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Toader> | ||||||||||
| 555 | |||||||||||
| 556 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 557 | |||||||||||
| 558 | L<http://annocpan.org/dist/Toader> | ||||||||||
| 559 | |||||||||||
| 560 | =item * CPAN Ratings | ||||||||||
| 561 | |||||||||||
| 562 | L<http://cpanratings.perl.org/d/Toader> | ||||||||||
| 563 | |||||||||||
| 564 | =item * Search CPAN | ||||||||||
| 565 | |||||||||||
| 566 | L<http://search.cpan.org/dist/Toader/> | ||||||||||
| 567 | |||||||||||
| 568 | =back | ||||||||||
| 569 | |||||||||||
| 570 | |||||||||||
| 571 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 572 | |||||||||||
| 573 | |||||||||||
| 574 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 575 | |||||||||||
| 576 | Copyright 2013 Zane C. Bowers-Hadley. | ||||||||||
| 577 | |||||||||||
| 578 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 579 | under the terms of either: the GNU General Public License as published | ||||||||||
| 580 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 581 | |||||||||||
| 582 | See http://dev.perl.org/licenses/ for more information. | ||||||||||
| 583 | |||||||||||
| 584 | |||||||||||
| 585 | =cut | ||||||||||
| 586 | |||||||||||
| 587 | 6 | 1; # End of Toader | |||||||||