FWS-V2
view release on metacpan or search on metacpan
lib/FWS/V2/Database.pm view on Meta::CPAN
my $pageId = $paramHash{pageGIUD};
my $template;
my $css;
my $js;
my $title;
#
# get the default template Id
#
my ( $defaultGUID ) = @{$self->runSQL( SQL => "select guid from templates where default_template = '1' and site_guid='" . $self->safeSQL( $self->{siteGUID} ) . "'" )};
#
# get the home page template ID
#
my ( $homePageTemplateId ) = @{$self->runSQL( SQL => "select layout from guid_xref where child='" . $self->safeSQL( $self->homeGUID() ) . "'" )};
#
# if this is the home page then set the page id to the actual home page templates ID
#
if ( $pageId eq $self->homeGUID() && !$paramHash{templateGUID} ) { $paramHash{templateGUID} = $homePageTemplateId }
#
# set some sql defaults
#
my $returnFields = 'title, template_devel, css_devel, js_devel, templates.guid';
#
# we have a page id, lets see if we can get the template from it. but if the
# page id was 0 we know that its the home page template id we want not the "0" template id
#
if ( $pageId ) {
( $title, $template, $css, $js, $paramHash{templateGUID} ) = @{$self->runSQL( SQL => "select " . $returnFields . " from templates left join guid_xref on layout=templates.guid where guid_xref.child='" . $self->safeSQL( $pageId ) . "' and guid...
}
#
# we wern't given a page lets grab it from the templateGUID
#
elsif ( !$paramHash{templateGUID} ) {
( $title, $template, $css, $js, $paramHash{templateGUID} ) = @{$self->runSQL( SQL => "select " . $returnFields . " from templates where guid='" . $self->safeSQL( $paramHash{templateGUID} ) . "'" )};
}
#
# man, this sucks, we didn't find one yet lets get the default one
#
if ( !$paramHash{templateGUID} ) {
( $title, $template, $css, $js, $paramHash{templateGUID} ) = @{$self->runSQL( SQL => "select " . $returnFields . " from templates where guid='" . $self->safeSQL( $defaultGUID ) . "'" )};
}
#
# wtf, still didn't get one yet???? lets build out a basic one so the page will render
#
if ( !$paramHash{templateGUID} ) {
$title = "FWS template";
$template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n".
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n" .
"<head>\n" .
"#FWSHead#" .
"</head>\n" .
"<body>\n" .
"#FWSMenu#" .
"<div id=\"loc_wrapper\">" .
"<div id=\"loc\">" .
"<div id=\"loc_1_wrapper\">" .
"<div id=\"loc_1\">" .
"<div id=\"loc_1_1_wrapper\">" .
"<div id=\"loc_1_1\">#FWSShow-header#</div>" .
"</div>" .
"</div>" .
"</div>" .
"<div id=\"loc_2_wrapper\">" .
"<div id=\"loc_2\">" .
"<div id=\"loc_2_1_wrapper\">" .
"<div id=\"loc_2_1\">#FWSShow-main#</div>" .
"</div>" .
"</div>" .
"</div>" .
"<div id=\"loc_3_wrapper\">" .
"<div id=\"loc_3\">" .
"<div id=\"loc_3_1_wrapper\">" .
"<div id=\"loc_3_1\">#FWSShow-footer#</div>" .
"</div>" .
"</div>" .
"</div>" .
"</div>" .
"</div>" .
"<div style=\"clear:both;\"></div>\n" .
"#FWSJavaLoad#" .
"</body>\n" .
"</html>";
}
#
# create the hash and return it
#
my %templateHash;
$templateHash{guid} = $paramHash{templateGUID};
$templateHash{homeGUID} = $homePageTemplateId;
$templateHash{title} = '';
$templateHash{siteGUID} = $self->{siteGUID};
$templateHash{template} = $template;
$templateHash{css} = $css;
$templateHash{js} = $js;
$templateHash{defaultGUID} = $defaultGUID;
return %templateHash;
}
=head2 updateDataCache
Update the cache version of the data record. This is called automatically when saveData is called.
$fws->updateDataCache(%theDataHash);
=cut
sub updateDataCache {
my ( $self, %dataHash ) = @_;
( run in 0.496 second using v1.01-cache-2.11-cpan-39bf76dae61 )