files have the following filename extension -->
<default_template_extension>tt2</default_template_extension>
- <!-- media_prefix can be a remote server.
- E.g. <media_prefix>http://static.example.com/media</media_prefix> -->
+ <!-- Media Prefix. Allows static files to be served from an alternate domain/server
+
+ Examples:
+
+ # local URL path
+ <media_prefix>/media</media_prefix>
+
+ # server w/ path.
+ <media_prefix>static.example.com/media</media_prefix>
+
+ ===
+ In the first 2 examples, the request protocol (http vs https) will
+ match the protocol of the current page
+ ===
+
+ # full-qualified with static protocol
+ <media_prefix>http://static.example.com/media</media_prefix>
+ -->
<media_prefix/>
<!-- If set to true, all output will be parsed as XML before delivery to the client.
-cookie => $cgi->cookie(
-name => 'ses',
-path => '/',
+ -secure => 1,
-value => $response->{payload}->{authtoken},
-expires => CORE::time + $response->{payload}->{authtime}
)
parse_accept_lang($r->headers_in->get('Accept-Language')) || 'en-US';
$r->log->debug('skin = ' . $ctx->{skin} . ' : theme = ' .
$ctx->{theme} . ' : locale = ' . $ctx->{locale});
+
+ my $mprefix = $ctx->{media_prefix};
+ if($mprefix !~ /^http/ and $mprefix !~ /^\//) {
+ # if a hostname is provided /w no protocol, match the protocol to the current page
+ $ctx->{media_prefix} = ($cgi->https) ? "https://$mprefix" : "http://$mprefix";
+ }
+
+
return $ctx;
}
<table id='record_table' style='width:auto'>
<tr>
<td rowspan='10' style='width:55px; vertical-align:top; padding-right:4px;'>
- <img width='50' height='70' src='/opac/extras/ac/jacket/small/[% attrs.isbn_clean || attrs.upc %]'/>
+ [% IF attrs.isbn_clean || attrs.upc %]
+ <img width='50' height='70' src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% attrs.isbn_clean || attrs.upc %]'/>
+ [% END %]
</td>
</tr>
[% IF attrs.title %]<tr><td>Title</td><td>[% attrs.title %]</td></tr>[% END %]
<tr>
<td style='width:52px;height:72px'>
[% IF attrs.isbn %]
- <img width='50' height='70' src='/opac/extras/ac/jacket/small/[% attrs.isbn_clean || attrs.upc %]'/>
+ <img width='50' height='70' src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% attrs.isbn_clean || attrs.upc %]'/>
[% END %]
</td>
<td width='auto'>