<%DOC> Live365 Station Page Template System -- Main Autohandler <& SELF:getTitle &> <& SELF:getCss, %ARGS &> <& SELF:drawJS, %ARGS &> % if ($debug) {
Live365 STATION PAGE TEMPLATE SYSTEM
/SCP/AUTOHANDLER:
R->URI: <% $r->uri %>
SCPPATH: <% $m->comp('SELF:getScpPath') %>
LANGUAGE: <& SELF:getLang &>
LAYOUT: param=<% $layout %>, method=<% $mylayout %>
% } <& SELF:drawHeader, %ARGS &> <% $m->call_next %> <& SELF:drawFooter, %ARGS &> <%args> $station_name => undef $layout => undef $debug => undef <%shared> ## USED WITHIN METHODS BELOW my $s_station_name; my $s_layout; <%init> $s_station_name = $station_name; $s_layout = "$layout"; my $mylayout = $m->comp('SELF:getLayout'); <%doc>################################################ method getTitle -- generates HTML page title ############################################### <%method getTitle> Live365 Station Info for <% $s_station_name %> <%doc>################################################ method getKeywords -- generates keywords for HTML META tag ############################################### <%method getKeywords> <%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) ############################################################## <%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/'; % foreach my $p (@path){ % $str .= "$p/"; % my $css = $root.$str . 'local.css'; % if ($m->comp_exists($css)) { % } % } <%method debug> invoking main autohandler\ <%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 ################################################################# <%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); <%doc>################################################################## method getImgDir -- parses request URL to determine correct SCP image directory ################################################################# <%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/"; } <% $imgdir %>\ <%doc>################################################################## method getLang -- returns language attribute ################################################################# <%method getLang> <% $m->request_comp->attr('lang') %> <%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 ################################################################# <%method drawJS> <%doc>################################################################## method getLayout -- returns layout type as parsed from URL or specified via querystring parameter ################################################################# <%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); <%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. ################################################################# <%method drawHeader> <%perl> my $scp = $m->comp('SELF:getScpPath'); my $layout = $m->comp('SELF:getLayout'); my $comp = "/scp/$scp/$layout/header.mc"; % if ($m->comp_exists($comp)) { <& $comp, ('genre' => $m->comp('SELF:getGenre'), %ARGS) &> % } <%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. ################################################################# <%method drawFooter> <%perl> my $scp = $m->comp('SELF:getScpPath'); my $layout = $m->comp('SELF:getLayout'); my $comp = "/scp/$scp/$layout/footer.mc"; % if ($m->comp_exists($comp)) { <& $comp, %ARGS &> % } <%doc>################################################################## method getGenre -- placeholder for genre used for ad-targeting ################################################################# <%method getGenre> <%FLAGS> inherit => undef <%attr> pro_skin => 0 lang => 'english'