% }
<& SELF:drawHeader, %ARGS &>
<% $m->call_next %>
<& SELF:drawFooter, %ARGS &>
<%args>
$station_name => undef
$layout => undef
$debug => undef
%args>
<%shared>
## USED WITHIN METHODS BELOW
my $s_station_name;
my $s_layout;
%shared>
<%init>
$s_station_name = $station_name;
$s_layout = "$layout";
my $mylayout = $m->comp('SELF:getLayout');
%init>
<%doc>################################################
method getTitle -- generates HTML page title
###############################################%doc>
<%method getTitle>
Live365 Station Info for <% $s_station_name %>
%method>
<%doc>################################################
method getKeywords -- generates keywords for
HTML META tag
###############################################%doc>
<%method getKeywords>
%method>
<%doc>##############################################################
method getCss -- generates the directory path based on the
request URL, then walks up the path and looks
for 'local.css' in each subdir -- if found,
generates a standard CSS include in the final
generated HTML. ALSO looks in the requested layout
subdir for a stylesheet there (this info isn't
included in the request URL)
##############################################################%doc>
<%method getCss>
<%perl>
#my @path = split('/', $r->uri);
#pop @path; ## get rid of filename
#shift @path;
#shift @path;
my @path = split('/', $m->comp('SELF:getScpPath'));
push(@path, $s_layout); ## ADD LAYOUT SUBDIR TO LIST
my $str = '';
my $root = '/scp/';
%perl>
% foreach my $p (@path){
% $str .= "$p/";
% my $css = $root.$str . 'local.css';
% if ($m->comp_exists($css)) {
% }
% }
%method>
<%method debug>
invoking main autohandler\
%method>
<%doc>##################################################################
method getScpPath -- parses request URL to determine SCP
e.g. "coke" from /scp/coke/station_info.live
or "pro/pepsi" from /scp/pro/pepsi/station_info.live
#################################################################%doc>
<%method getScpPath>
<%perl>
my @path = split('/', $r->uri);
pop @path; ## get rid of filename
@path = reverse @path;
my @scp;
foreach my $p (@path) {
last if ($p eq 'scp');
unshift(@scp, $p);
}
my $path = (join('/', @scp));
$path = 'live365' unless ($path);
return($path);
%perl>
%method>
<%doc>##################################################################
method getImgDir -- parses request URL to determine correct SCP
image directory
#################################################################%doc>
<%method getImgDir>
<%perl>
#my @path = split('/', $r->uri);
#pop @path; ## get rid of filename
my @path = split('/', $m->comp('SELF:getScpPath'));
my $imgdir = join('/', @path) . '/images/';
unless (-d '/u01/apache_live/htdocs/' . $imgdir) {
$imgdir = "/scp/live365/images/";
}
%perl>
<% $imgdir %>\
%method>
<%doc>##################################################################
method getLang -- returns language attribute
#################################################################%doc>
<%method getLang>
<% $m->request_comp->attr('lang') %>
%method>
<%doc>##################################################################
method drawJS -- placeholder method for any Javascript that
needs to be placed within the HTML page header --
this can be overridden in an SCP's autohandler
#################################################################%doc>
<%method drawJS>
%method>
<%doc>##################################################################
method getLayout -- returns layout type as parsed from URL
or specified via querystring parameter
#################################################################%doc>
<%method getLayout>
<%perl>
#my @path = split('/', $r->uri);
#pop @path; ## get rid of filename
my @path = split('/', $m->comp('SELF:getScpPath'));
my $layout = pop @path;
## OVERRIDE PATH-DERIVED LAYOUT IF PARAM PRESENT
$layout = $s_layout if ($s_layout);
return($layout);
%perl>
%method>
<%doc>##################################################################
method drawHeader -- generates HTML page-header using SCP
& LAYOUT parsed from URL and/or querystring; attempts
to include component "/scp/$scp/$layout/header.mc" if
"header.mc" exists in scp/layout directory.
#################################################################%doc>
<%method drawHeader>
<%perl>
my $scp = $m->comp('SELF:getScpPath');
my $layout = $m->comp('SELF:getLayout');
my $comp = "/scp/$scp/$layout/header.mc";
%perl>
% if ($m->comp_exists($comp)) {
<& $comp, ('genre' => $m->comp('SELF:getGenre'), %ARGS) &>
% }
%method>
<%doc>##################################################################
method drawFooter -- generates HTML page-footer using SCP
& LAYOUT parsed from URL and/or querystring; attempts
to include component "/scp/$scp/$layout/footer.mc" if
"footer.mc" exists in scp/layout directory.
#################################################################%doc>
<%method drawFooter>
<%perl>
my $scp = $m->comp('SELF:getScpPath');
my $layout = $m->comp('SELF:getLayout');
my $comp = "/scp/$scp/$layout/footer.mc";
%perl>
% if ($m->comp_exists($comp)) {
<& $comp, %ARGS &>
% }
%method>
<%doc>##################################################################
method getGenre -- placeholder for genre used for ad-targeting
#################################################################%doc>
<%method getGenre>
%method>
<%FLAGS>
inherit => undef
%FLAGS>
<%attr>
pro_skin => 0
lang => 'english'
%attr>