| 1 | package Toader::Templates::Defaults; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | 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 | 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 | sub new{ | ||||||||||
| 45 | 0 | ▶ | my %args; | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||
| 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 | <div id="copyright"> | ||||||||||
| 207 | [== | ||||||||||
| 208 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); | ||||||||||
| 209 | $year=$year+1900; | ||||||||||
| 210 | return "Copyright ".$year." ".$c->{_}->{owner}; | ||||||||||
| 211 | ==] | ||||||||||
| 212 | </div> | ||||||||||
| 213 | |||||||||||
| 214 | </body> | ||||||||||
| 215 | </html> | ||||||||||
| 216 | |||||||||||
| 217 | '; | ||||||||||
| 218 | |||||||||||
| 219 | 0 | $self->{templates}{'sidebar'}='[== | |||||||||
| 220 | if ( ! $g->hasEntries ){ | ||||||||||
| 221 | return ""; | ||||||||||
| 222 | } | ||||||||||
| 223 | return "<h3>Entries</h3>\n". | ||||||||||
| 224 | " ".$g->entriesLink." <br>\n". | ||||||||||
| 225 | " ".$g->entriesArchiveLink." <br>\n"; | ||||||||||
| 226 | ==] | ||||||||||
| 227 | [== | ||||||||||
| 228 | my $pages=$g->listPages; | ||||||||||
| 229 | if ( ( ! defined( $pages ) ) || ( $pages eq "" ) ){ | ||||||||||
| 230 | return ""; | ||||||||||
| 231 | } | ||||||||||
| 232 | return " <hr><h3>".$g->pageSummaryLink."</h3>\n".$pages."\n <hr>\n"; | ||||||||||
| 233 | ==] | ||||||||||
| 234 | [== | ||||||||||
| 235 | if( $g->hasGallery ){ | ||||||||||
| 236 | return "<hr>\n<h3>".$g->galleryLink."</h3>"; | ||||||||||
| 237 | }else{ | ||||||||||
| 238 | return ""; | ||||||||||
| 239 | } | ||||||||||
| 240 | ==] | ||||||||||
| 241 | [== | ||||||||||
| 242 | if( $g->hasAnyDirs ){ | ||||||||||
| 243 | return "<hr>\n<h3>Directories</h3>"; | ||||||||||
| 244 | }else{ | ||||||||||
| 245 | return ""; | ||||||||||
| 246 | } | ||||||||||
| 247 | ==] | ||||||||||
| 248 | [== | ||||||||||
| 249 | if ( $g->atRoot ){ | ||||||||||
| 250 | return ""; | ||||||||||
| 251 | } | ||||||||||
| 252 | return $g->rlink("Go To The Root")." <br>\n ". | ||||||||||
| 253 | $g->upOneDirLink." <br>\n <br>"; | ||||||||||
| 254 | ==] | ||||||||||
| 255 | |||||||||||
| 256 | [== | ||||||||||
| 257 | if ( $g->hasSubDirs ){ | ||||||||||
| 258 | return $g->listDirs; | ||||||||||
| 259 | } | ||||||||||
| 260 | return ""; | ||||||||||
| 261 | ==] | ||||||||||
| 262 | [== | ||||||||||
| 263 | if ( $g->hasDocs ){ | ||||||||||
| 264 | return "<hr>".$g->adListLink; | ||||||||||
| 265 | } | ||||||||||
| 266 | return ""; | ||||||||||
| 267 | ==] | ||||||||||
| 268 | '; | ||||||||||
| 269 | |||||||||||
| 270 | 0 | $self->{templates}{'pageGallery'}='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |||||||||
| 271 | <html> | ||||||||||
| 272 | |||||||||||
| 273 | <head> | ||||||||||
| 274 | <title> [== $c->{_}->{siteTitle} ==] </title> | ||||||||||
| 275 | <LINK href="[== $g->cssLocation ==]" rel="stylesheet" type="text/css"> | ||||||||||
| 276 | </head> | ||||||||||
| 277 | |||||||||||
| 278 | <body> | ||||||||||
| 279 | |||||||||||
| 280 | <div id="header" > | ||||||||||
| 281 | [== $g->top ==] | ||||||||||
| 282 | </div> | ||||||||||
| 283 | |||||||||||
| 284 | <div id="location" > | ||||||||||
| 285 | [== $g->locationbar( $locationID ) ==] | ||||||||||
| 286 | [== $g->locationSub ==] | ||||||||||
| 287 | </div> | ||||||||||
| 288 | |||||||||||
| 289 | <div> | ||||||||||
| 290 | |||||||||||
| 291 | <div id="content" > | ||||||||||
| 292 | [== $content ==] | ||||||||||
| 293 | </div> | ||||||||||
| 294 | |||||||||||
| 295 | <br><br><br> | ||||||||||
| 296 | |||||||||||
| 297 | <div id="copyright"> | ||||||||||
| 298 | [== | ||||||||||
| 299 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); | ||||||||||
| 300 | $year=$year+1900; | ||||||||||
| 301 | return "Copyright ".$year." ".$c->{_}->{owner}; | ||||||||||
| 302 | ==] | ||||||||||
| 303 | </div> | ||||||||||
| 304 | |||||||||||
| 305 | </body> | ||||||||||
| 306 | </html> | ||||||||||
| 307 | |||||||||||
| 308 | '; | ||||||||||
| 309 | |||||||||||
| 310 | 0 | $self->{templates}{'dirContent'}='[== $body ==]'; | |||||||||
| 311 | |||||||||||
| 312 | |||||||||||
| 313 | 0 | $self->{templates}{'pageContent'}='[== $body ==]'; | |||||||||
| 314 | |||||||||||
| 315 | 0 | $self->{templates}{'entryContent'}='<div id="content"> | |||||||||
| 316 | <h4>[== $g->elink( $g->or2r, $date, $title ) ==]</h4> | ||||||||||
| 317 | Date: [== $year.$month.$day."-".$hour.":".$min ==] <br> | ||||||||||
| 318 | Author: [== $g->authorsLink( $from ) ==]<br> | ||||||||||
| 319 | <div id="content"> | ||||||||||
| 320 | [== $body ==] | ||||||||||
| 321 | </div> | ||||||||||
| 322 | </div> | ||||||||||
| 323 | '; | ||||||||||
| 324 | |||||||||||
| 325 | 0 | $self->{templates}{'entryIndex'}='[== $g->lastEntries( $c->{_}->{last} ) ==]'; | |||||||||
| 326 | |||||||||||
| 327 | 0 | $self->{templates}{'entryArchive'}='[== $g->entryArchive ==]'; | |||||||||
| 328 | 0 | $self->{templates}{'entryArchiveBegin'}='<table id="entryArchive"> | |||||||||
| 329 | <tr> <td>Date</td> <td>Title</td> <td>Summary</td> </tr> | ||||||||||
| 330 | '; | ||||||||||
| 331 | 0 | $self->{templates}{'entryArchiveRow'}=' <tr id="entryArchive"> | |||||||||
| 332 | <td id="entryArchive">[== $g->elink( "./", $date, $date ) ==]</td> | ||||||||||
| 333 | <td id="entryArchive">[== $title ==]</td> | ||||||||||
| 334 | <td id="entryArchive">[== $summary ==]</td> | ||||||||||
| 335 | </tr> | ||||||||||
| 336 | '; | ||||||||||
| 337 | 0 | $self->{templates}{'entryArchiveJoin'}=''; | |||||||||
| 338 | 0 | $self->{templates}{'entryArchiveEnd'}='</table>'; | |||||||||
| 339 | |||||||||||
| 340 | 0 | $self->{templates}{'pageSummary'}='[== $g->pageSummary ==]'; | |||||||||
| 341 | |||||||||||
| 342 | 0 | $self->{templates}{'pageSummaryBegin'}='<table id="pageSummary"> | |||||||||
| 343 | <tr> <td>Name</td> <td>Summary</td> </tr> | ||||||||||
| 344 | '; | ||||||||||
| 345 | 0 | $self->{templates}{'pageSummaryRow'}=' <tr id="pageSummary"> | |||||||||
| 346 | <td id="pageSummary"><a href="./[== $name ==]/">[== $name ==]</a></td> | ||||||||||
| 347 | <td id="pageSummary">[== $summary ==]</td> | ||||||||||
| 348 | </tr> | ||||||||||
| 349 | '; | ||||||||||
| 350 | 0 | $self->{templates}{'pageSummaryJoin'}=''; | |||||||||
| 351 | 0 | $self->{templates}{'pageSummaryEnd'}='</table>'; | |||||||||
| 352 | |||||||||||
| 353 | 0 | $self->{templates}{'locationStart'}='<h2>Location: '; | |||||||||
| 354 | 0 | $self->{templates}{'locationPart'}='<a href="[== $url ==]">[== $text ==]</a> / '; | |||||||||
| 355 | 0 | $self->{templates}{'locationEnd'}='[== $locationID ==]</h2> | |||||||||
| 356 | '; | ||||||||||
| 357 | |||||||||||
| 358 | 0 | $self->{templates}{'top'}='<h1>[== $c->{_}->{site} ==]</h1><br>'; | |||||||||
| 359 | |||||||||||
| 360 | 0 | $self->{templates}{'autodocContent'}='[== $g->autodocList ==]'; | |||||||||
| 361 | 0 | $self->{templates}{'autodocListBegin'}='<table id="autodocList"> | |||||||||
| 362 | <tr> <td>File</td> </tr> | ||||||||||
| 363 | '; | ||||||||||
| 364 | 0 | $self->{templates}{'autodocListRow'}=' <tr id="autodocList"> | |||||||||
| 365 | <td id="autodocList">[== $g->adlink( $dir, $file ) ==]</td> | ||||||||||
| 366 | </tr> | ||||||||||
| 367 | '; | ||||||||||
| 368 | 0 | $self->{templates}{'autodocListJoin'}=''; | |||||||||
| 369 | 0 | $self->{templates}{'autodocListEnd'}='</table>'; | |||||||||
| 370 | |||||||||||
| 371 | 0 | $self->{templates}{'hashToTableBegin'}='<table id="[== $cssID ==]"> | |||||||||
| 372 | '; | ||||||||||
| 373 | 0 | $self->{templates}{'hashToTableTitle'}=' <tr id="[== $cssID ==]"> | |||||||||
| 374 | <td id="[== $cssID ==]"><bold>[== $keyTitle ==]</td> | ||||||||||
| 375 | <td id="[== $cssID ==]"><bold>[== $valueTitle ==]</bold></td> | ||||||||||
| 376 | </tr> | ||||||||||
| 377 | '; | ||||||||||
| 378 | 0 | $self->{templates}{'hashToTableRow'}=' <tr id="[== $cssID ==]"> | |||||||||
| 379 | <td id="[== $cssID ==]">[== $key ==]</td> | ||||||||||
| 380 | <td id="[== $cssID ==]">[== $value ==]</td> | ||||||||||
| 381 | </tr> | ||||||||||
| 382 | '; | ||||||||||
| 383 | |||||||||||
| 384 | 0 | $self->{templates}{'hashToTableJoin'}=''; | |||||||||
| 385 | 0 | $self->{templates}{'hashToTableEnd'}='</table>'; | |||||||||
| 386 | |||||||||||
| 387 | 0 | $self->{templates}{'imageDiv'}='<div id=\'[== $cssID ==]\'> | |||||||||
| 388 | [== $above ==] | ||||||||||
| 389 | [== if ( defined( $link ) ){ return \'<a href="\'.$link.\'">\' }else{ return \'\' } ==] | ||||||||||
| 390 | <img src="[== $image ==]" alt="[== $alt ==]"/> | ||||||||||
| 391 | [== if ( defined( $link ) ){ return \'</a>\' }else{ return \'\' } ==]<br> | ||||||||||
| 392 | [== $below ==] | ||||||||||
| 393 | </div> | ||||||||||
| 394 | '; | ||||||||||
| 395 | |||||||||||
| 396 | 0 | $self->{templates}{'gallerySmallImageBegin'}=''; | |||||||||
| 397 | 0 | $self->{templates}{'gallerySmallImage'}='[== $g->galleryImageSmall( $dir, $gdir, $image ); ==]'; | |||||||||
| 398 | 0 | $self->{templates}{'galleryDir'}='<div id="imageDiv" > [== $link ==] </div>'; | |||||||||
| 399 | 0 | $self->{templates}{'gallerySmallImageJoin'}="\n"; | |||||||||
| 400 | 0 | $self->{templates}{'gallerySmallImageEnd'}=''; | |||||||||
| 401 | |||||||||||
| 402 | 0 | $self->{templates}{'galleryLocationStart'}='<h3>Gallery Location: '; | |||||||||
| 403 | 0 | $self->{templates}{'galleryLocationPart'}='<a href="[== $url ==]">[== $text ==]</a>'; | |||||||||
| 404 | 0 | $self->{templates}{'galleryLocationJoin'}=' / '; | |||||||||
| 405 | 0 | $self->{templates}{'galleryLocationEnd'}='</h3> | |||||||||
| 406 | '; | ||||||||||
| 407 | 0 | $self->{templates}{'galleryLocationImage'}='<h3>Image: <a href="[== $url ==]">[== $image ==]</a></h3> | |||||||||
| 408 | '; | ||||||||||
| 409 | |||||||||||
| 410 | |||||||||||
| 411 | 0 | $self->{templates}{'imageExifTablesGroup'}='<br /> | |||||||||
| 412 | <b>EXIF Tag Group: [== $group ==]</b> | ||||||||||
| 413 | [== $table ==] | ||||||||||
| 414 | <br /> | ||||||||||
| 415 | '; | ||||||||||
| 416 | 0 | $self->{templates}{'imageExifTablesJoin'}=''; | |||||||||
| 417 | 0 | $self->{templates}{'imageExifTablesBegin'}=''; | |||||||||
| 418 | 0 | $self->{templates}{'imageExifTablesEnd'}=''; | |||||||||
| 419 | 0 | $self->{templates}{'imageExifTables'}='<b>Image: </b> [== $filename ==] <br/> | |||||||||
| 420 | [== $tables ==] | ||||||||||
| 421 | '; | ||||||||||
| 422 | |||||||||||
| 423 | 0 | return $self; | |||||||||
| 424 | } | ||||||||||
| 425 | |||||||||||
| 426 | =head2 exists | ||||||||||
| 427 | |||||||||||
| 428 | This checks if the specified template exists as a default template. | ||||||||||
| 429 | |||||||||||
| 430 | One argument is required and that is the template name to check for. | ||||||||||
| 431 | This method will only throw a error if it is left undefined. | ||||||||||
| 432 | |||||||||||
| 433 | The return value is a Perl boolean value. | ||||||||||
| 434 | |||||||||||
| 435 | my $exists=$foo->exists($template); | ||||||||||
| 436 | |||||||||||
| 437 | =cut | ||||||||||
| 438 | |||||||||||
| 439 | sub exists{ | ||||||||||
| 440 | 0 | ▶ | my $self=$_[0]; | ||||||||
|
Subroutine
exists: not called CC=3 SCAR=24.8
| |||||||||||
| 441 | 0 | my $name=$_[1]; | |||||||||
| 442 | |||||||||||
| 443 | 0 | ▶ | if ( ! $self->errorblank ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 444 | 0 | $self->{error}=1; | |||||||||
| 445 | 0 | $self->{errorString}='No template specified'; | |||||||||
| 446 | 0 | $self->warn; | |||||||||
| 447 | 0 | return undef; | |||||||||
| 448 | } | ||||||||||
| 449 | |||||||||||
| 450 | 0 | ▶ | if ( defined( $self->{templates}{$name} ) ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 451 | 0 | return 1; | |||||||||
| 452 | } | ||||||||||
| 453 | |||||||||||
| 454 | 0 | return 0; | |||||||||
| 455 | } | ||||||||||
| 456 | |||||||||||
| 457 | =head2 getTemplate | ||||||||||
| 458 | |||||||||||
| 459 | This returns a default template. | ||||||||||
| 460 | |||||||||||
| 461 | One argument is required and it is the template name. | ||||||||||
| 462 | |||||||||||
| 463 | There is no need to do error checking, if one is certian | ||||||||||
| 464 | the template exists. | ||||||||||
| 465 | |||||||||||
| 466 | my $template=$foo->getTemplate( $name ); | ||||||||||
| 467 | if ( $foo->error ){ | ||||||||||
| 468 | warn( 'Error:'.$foo->error.': '.$foo->errorString ); | ||||||||||
| 469 | } | ||||||||||
| 470 | |||||||||||
| 471 | =cut | ||||||||||
| 472 | |||||||||||
| 473 | sub getTemplate{ | ||||||||||
| 474 | 0 | ▶ | my $self=$_[0]; | ||||||||
|
Subroutine
getTemplate: not called CC=4 SCAR=30.0
| |||||||||||
| 475 | 0 | my $name=$_[1]; | |||||||||
| 476 | |||||||||||
| 477 | 0 | ▶ | if ( ! $self->errorblank ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 478 | 0 | return undef; | |||||||||
| 479 | } | ||||||||||
| 480 | |||||||||||
| 481 | 0 | ▶ | if ( ! defined( $name ) ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 482 | 0 | $self->{error}=1; | |||||||||
| 483 | 0 | $self->{errorString}='No template specified'; | |||||||||
| 484 | 0 | $self->warn; | |||||||||
| 485 | 0 | return undef; | |||||||||
| 486 | } | ||||||||||
| 487 | |||||||||||
| 488 | 0 | ▶ | if ( ! defined( $self->{templates}{$name} ) ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 489 | 0 | $self->{error}=2; | |||||||||
| 490 | 0 | $self->{errorString}='"'.$name.'" is not a default template'; | |||||||||
| 491 | 0 | $self->warn; | |||||||||
| 492 | 0 | return undef; | |||||||||
| 493 | } | ||||||||||
| 494 | |||||||||||
| 495 | 0 | return $self->{templates}{$name}; | |||||||||
| 496 | } | ||||||||||
| 497 | |||||||||||
| 498 | =head2 listTemplates | ||||||||||
| 499 | |||||||||||
| 500 | This returns a list of default templates. | ||||||||||
| 501 | |||||||||||
| 502 | No arguments are taken. | ||||||||||
| 503 | |||||||||||
| 504 | my @defTemplates=$foo->listTemplates; | ||||||||||
| 505 | |||||||||||
| 506 | =cut | ||||||||||
| 507 | |||||||||||
| 508 | sub listTemplates{ | ||||||||||
| 509 | my $self=$_[0]; | ||||||||||
| 510 | |||||||||||
| 511 | if ( ! $self->errorblank ){ | ||||||||||
| 512 | return undef; | ||||||||||
| 513 | } | ||||||||||
| 514 | |||||||||||
| 515 | return keys( $self->{templates} ); | ||||||||||
| 516 | } | ||||||||||
| 517 | |||||||||||
| 518 | =head1 ERROR CODES/FLAGS | ||||||||||
| 519 | |||||||||||
| 520 | =head2 1, noTemplateNameSpecified | ||||||||||
| 521 | |||||||||||
| 522 | No template name specified. | ||||||||||
| 523 | |||||||||||
| 524 | =head2 2, noSuchTemplate | ||||||||||
| 525 | |||||||||||
| 526 | No such template. | ||||||||||
| 527 | |||||||||||
| 528 | =head1 AUTHOR | ||||||||||
| 529 | |||||||||||
| 530 | Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >> | ||||||||||
| 531 | |||||||||||
| 532 | =head1 BUGS | ||||||||||
| 533 | |||||||||||
| 534 | Please report any bugs or feature requests to C<bug-toader at rt.cpan.org>, or through | ||||||||||
| 535 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Toader>. I will be notified, and then you'll | ||||||||||
| 536 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 537 | |||||||||||
| 538 | =head1 SUPPORT | ||||||||||
| 539 | |||||||||||
| 540 | You can find documentation for this module with the perldoc command. | ||||||||||
| 541 | |||||||||||
| 542 | perldoc Toader::Templates::Defaults | ||||||||||
| 543 | |||||||||||
| 544 | |||||||||||
| 545 | You can also look for information at: | ||||||||||
| 546 | |||||||||||
| 547 | =over 4 | ||||||||||
| 548 | |||||||||||
| 549 | =item * RT: CPAN's request tracker | ||||||||||
| 550 | |||||||||||
| 551 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Toader> | ||||||||||
| 552 | |||||||||||
| 553 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 554 | |||||||||||
| 555 | L<http://annocpan.org/dist/Toader> | ||||||||||
| 556 | |||||||||||
| 557 | =item * CPAN Ratings | ||||||||||
| 558 | |||||||||||
| 559 | L<http://cpanratings.perl.org/d/Toader> | ||||||||||
| 560 | |||||||||||
| 561 | =item * Search CPAN | ||||||||||
| 562 | |||||||||||
| 563 | L<http://search.cpan.org/dist/Toader/> | ||||||||||
| 564 | |||||||||||
| 565 | =back | ||||||||||
| 566 | |||||||||||
| 567 | |||||||||||
| 568 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 569 | |||||||||||
| 570 | |||||||||||
| 571 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 572 | |||||||||||
| 573 | Copyright 2013 Zane C. Bowers-Hadley. | ||||||||||
| 574 | |||||||||||
| 575 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 576 | under the terms of either: the GNU General Public License as published | ||||||||||
| 577 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 578 | |||||||||||
| 579 | See http://dev.perl.org/licenses/ for more information. | ||||||||||
| 580 | |||||||||||
| 581 | |||||||||||
| 582 | =cut | ||||||||||
| 583 | |||||||||||
| 584 | 1; # End of Toader | ||||||||||