</page>
<!-- topic pages -->
- <page id="10" columns="3" name="Book Series" img="category.png">
- <cell name="Mammals" img="category.png" type="search">su:mammal audience(j)</cell>
- <cell name="Molluscs" img="category.png" type="search">su:mammal audience(j)</cell>
- <cell name="Squids" img="category.png" type="search">su:mammal audience(j)</cell>
- <cell name="Snails" img="category.png" type="search">su:mammal audience(j)</cell>
- <cell name="Jellyfish" img="category.png" type="search">su:mammal audience(j)</cell>
- <cell name="Old Yeller" img="category.png" type="search">su:mammal audience(j)</cell>
- </page>
- <page id="11" columns="1" name="Current Events" img="category.png">
+ <page id="10" columns="3" name="Musical Instruments" img="category.png">
+ <cell name="Piano" img="category.png" type="search">su:piano</cell>
+ <cell name="Guitar" img="category.png" type="search">su:guitar</cell>
+ <cell name="Trumpet" img="category.png" type="search">su:trumpet</cell>
+ <cell name="Drums" img="category.png" type="search">su:drums</cell>
+ <cell name="Bass" img="category.png" type="search">su:bass</cell>
+ <cell name="Clarinet" img="category.png" type="search">su:clarinet</cell>
+ </page>
+ <page id="11" columns="3" name="Current Events" img="category.png">
+ <cell name="Entertainment" img="category.png" type="search">su:entertainment sort('pubdate')#descending</cell>
+ <cell name="Politics" img="category.png" type="search">su:politics sort('pubdate')#descending</cell>
+ <cell name="Economy" img="category.png" type="search">su:economy sort('pubdate')#descending</cell>
</page>
<page id="12" columns="3" name="Programming" img="category.png">
</page>
$self->load_kpac_config;
my $path = $self->apache->path_info;
+ ($self->ctx->{page} = $path) =~ s#.*/(.*)#$1#g;
return $self->load_simple("index") if $path =~ m|kpac/index|;
return $self->load_simple("category") if $path =~ m|kpac/category|;
return $self->load_simple("checkout") if $path =~ m|kpac/checkout|;
return $self->load_simple("checkout_results") if $path =~ m|kpac/checkout_results|;
- return $self->load_simple("detailed") if $path =~ m|kpac/detailed|;
+
+ # note: sets page=rresult
return $self->load_rresults if $path =~ m|kpac/search_results|; # inherited from tpac
+ # note: sets page=record
+ return $self->load_simple("detailed") if $path =~ m|kpac/detailed|;
+
# ----------------------------------------------------------------
# Everything below here requires SSL
# ----------------------------------------------------------------
$ou = $org->parent_ou;
}
- $self->ctx->{kpac_layout} = $kpac_config->{pages}->{page}->{$layout->{page}};
+ $self->ctx->{kpac_layout} = $layout;
$self->ctx->{kpac_config} = $kpac_config;
+ $self->ctx->{kpac_root} = $self->ctx->{base_path} . "/kpac";
}
[% PROCESS "opac/parts/header.tt2";
PROCESS "kpac/parts/grid.tt2";
WRAPPER "kpac/parts/subpage.tt2";
- ctx.page_title = ctx.kpac_layout.name %]
+ page_id = trail_endpoint();
+ page = ctx.kpac_config.pages.page.$page_id;
+ ctx.page_title = page.name %]
-<h2 class="sub_header2">Living Creatures</h2>
+<h2 class="sub_header2">[% page.name | html %]</h2>
<div class="hr"> </div>
<div class="sub_cat_wrapper">
- [% render_kpac_grid(ctx.kpac_config.pages.page.10); # TODO %]
+ [% render_kpac_grid(page_id) %]
</div>
<div class="sub_navigation1">
</div>
<div class="category_wrapper">
<h3 class="c_header_image">Or click on an image to get started:</h3>
- [% render_kpac_grid(ctx.kpac_layout); %]
+ [% render_kpac_grid(ctx.kpac_layout.page) %]
</div>
</td>
</head>
<body>
<div class="main_center">
-
- <!-- TODO -->
- <div class="main_header_wrapper">
- <div class="logo_wrapper">
- <a href="javascript:;">
- <span class="logo_left"> </span>
- <span class="logo_middle"><img src="[% ctx.media_prefix %]/images/kpac/kcls_logo.jpg" alt="kcls" /></span>
- <span class="logo_right"> </span>
- </a>
- </div>
- <div class="header_utils">
- <a href="javascript:;" class="text_size_btn"><span>Text size</span> <img
- alt="text size" src="[% ctx.media_prefix %]/images/kpac/text_size_btn.png" /></a>
- <a href="javascript:;" class="print_btn"><span>Print</span> <img
- alt="print" src="[% ctx.media_prefix %]/images/kpac/print_btn.png" /></a>
- </div>
- <div class="header_menu">
- <!-- menu rendered in reverse order -->
- <a href="javascript:;">Login</a>
- <a href="javascript:;">Get a Library Card</a>
- <a href="javascript:;">Help</a>
- </div>
- <div class="clear"> </div>
- </div>
-
+ [% INCLUDE 'kpac/parts/header.tt2' %]
<div class="main_wrapper"> [% content %] </div>
-
- <!-- TODO -->
- <div class="footer_wrapper">
- <a href="javascript:;">Contact Us</a>
- <a href="javascript:;">Site Help</a>
- <a href="javascript:;">Site Map</a>
- <a href="javascript:;">Back to Main KCLS Catalog</a>
- <div class="clear"> </div>
- </div>
-
+ [% INCLUDE 'kpac/parts/footer.tt2' %]
</div>
<script type="text/javascript" src="js/functions.js"></script>
</body>
--- /dev/null
+<div class="breadcrumb">
+
+ <!-- home page -->
+ <a href="[% mkurl(ctx.kpac_root _ '/index', {}, ['trail']) %]"
+ class="bread_home"><img alt="[% l('Home') %]"
+ src="[% ctx.media_prefix %]/images/kpac/home_icon.png" /></a>
+
+ <!-- category trail -->
+ [% trail = CGI.param('trail');
+ trail = trail ? trail.split('/') : [];
+ FOR page_id IN trail;
+ page = ctx.kpac_config.pages.page.$page_id %]
+ <div class="bread_green_mid"> </div>
+ <a href="[% mkurl(ctx.kpac_root _ '/category',
+ {trail = trail_splice(page_id)}) %]">[% page.name | html %]</a>
+ [% END %]
+
+ [% IF ctx.page != 'index' AND ctx.page != 'category' %]
+
+ <!-- search results -->
+ <div class="bread_green_mid"> </div>
+ <a href="[% mkurl(ctx.kpac_root _ '/search_results') %]">[% l('search results') | html %]</a>
+
+ [% IF ctx.page != 'rresult' %]
+
+ <!-- record title -->
+ <div class="bread_green_mid"> </div>
+ <a href="javascript:;">book name</a>
+
+ <!-- Get it -->
+ <div class="bread_green_last"> </div>
+ <span class="bread_last">[% l('Get it') %]</span>
+ <div class="clear"> </div>
+
+ [% END %]
+ [% END %]
+</div>
+
--- /dev/null
+<div class="footer_wrapper">
+ <a href="javascript:;">Contact Us</a>
+ <a href="javascript:;">Site Help</a>
+ <a href="javascript:;">Site Map</a>
+ <a href="javascript:;">Back to Main KCLS Catalog</a>
+ <div class="clear"> </div>
+</div>
+
-
[%
- # Use absolute and fully-qualified image URLs as-is.
- # Otherwise, use the kpac base path.
- MACRO kpac_img_path(img) BLOCK;
- IF img.match('^/') OR img.match('^https?://');
- img;
- ELSE;
- ctx.media_prefix _ '/images/kpac/' _ img;
- END;
- END;
-%]
-
-[%
- MACRO render_kpac_grid(page) BLOCK;
- ncols = page.columns;
- name = page.name;
- idx = 0 %]
+PROCESS 'kpac/parts/util.tt2';
+
+# Renders a single 'page' grid
+
+MACRO render_kpac_grid(page_id) BLOCK;
+ page = ctx.kpac_config.pages.page.$page_id;
+ ncols = page.columns || 3; # avoid divide-by-zero
+ name = page.name;
+ idx = 0 %]
<table cellpadding="0" cellspacing="0" border="0" class="main_category_table">
- <tr>
- [%
+ <tr> [%
width = 100 / ncols;
FOR cell IN page.cell;
IF idx == ncols;
idx = idx + 1;
IF cell.type == 'topic';
- page_id = cell.content;
- topic_page = ctx.kpac_config.pages.page.$page_id %]
+ tpage_id = cell.content;
+ topic_page = ctx.kpac_config.pages.page.$tpage_id %]
- <td width="[% width %]%"><a href="javascript:;"><img
+ <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/category', {trail => trail_append(tpage_id)}) %]"><img
src="[% kpac_img_path(topic_page.img) %]" alt="" /><span>[% topic_page.name %]</span></a></td>
[% ELSIF cell.type == 'search'; %]
- <td width="[% width %]%"><a href="[% mkurl('search_results') %]"><img
+ <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/search_results', {query => cell.content}) %]"><img
src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
[% ELSIF cell.type == 'link'; %]
- <td width="[% width %]%"><a href="[% mkurl(cell.content) %]"><img
+ <td width="[% width %]%"><a href="[% cell.content | html %]"><img
src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
[% END %]
--- /dev/null
+<div class="main_header_wrapper">
+ <div class="logo_wrapper">
+ <a href="javascript:;">
+ <span class="logo_left"> </span>
+ <span class="logo_middle"><img src="[% ctx.media_prefix %]/images/kpac/kcls_logo.jpg" alt="kcls" /></span>
+ <span class="logo_right"> </span>
+ </a>
+ </div>
+ <div class="header_utils">
+ <a href="javascript:;" class="text_size_btn"><span>Text size</span> <img
+ alt="text size" src="[% ctx.media_prefix %]/images/kpac/text_size_btn.png" /></a>
+ <a href="javascript:;" class="print_btn"><span>Print</span> <img
+ alt="print" src="[% ctx.media_prefix %]/images/kpac/print_btn.png" /></a>
+ </div>
+ <div class="header_menu">
+ <!-- menu rendered in reverse order -->
+ <a href="javascript:;">Login</a>
+ <a href="javascript:;">Get a Library Card</a>
+ <a href="javascript:;">Help</a>
+ </div>
+ <div class="clear"> </div>
+</div>
+
--- /dev/null
+[% # paging, weeee
+ page = CGI.param('page');
+ page = page.match('^\d+$') ? page : 0; # verify page is a sane value
+ page_count = ctx.page_size == 0 ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size);
+ ctx.result_start = 1 + ctx.page_size * page;
+ ctx.result_stop = ctx.page_size * (page + 1);
+ IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
+ result_count = ctx.result_start;
+%]
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr>
+ <!-- Next -->
+ <td>
+ [% class = '';
+ href = '#';
+ IF page > 0;
+ href = mkurl('', {page => page - 1});
+ ELSE; class = class _ ' invisible'; END %]
+ <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_last.png" /></a>
+ </td>
+
+ <!-- page X of Y -->
+ <td width="100%" class="nav_mid_bg">
+ <table cellpadding="0" cellspacing="0" border="0" align="center">
+ <tr>
+ [% |l(page + 1, page_count) %]
+ <td>Page </td><td class="current_page">[_1]</td><td> of </td><td class="total_pages">[_2]</td>
+ [% END %]
+ </tr>
+ </table>
+ </td>
+
+ <!-- Prev -->
+ <td class="to_top_btn">
+ [% class = '';
+ href = '#';
+ IF (page + 1) < page_count;
+ href = mkurl('', {page => page + 1});
+ ELSE; class = class _ ' invisible'; END;
+ %]
+ <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_next.png" /></a>
+ </td>
+
+ <!-- Top of page -->
+ [% IF showtop; href = mmkurl('').replace('#.*', '') %]
+ <td class="to_top_btn"><a href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png" /></a></td>
+ [% END %]
+ </tr>
+</table>
-[% WRAPPER "kpac/parts/base.tt2" %]
+[% PROCESS 'kpac/parts/util.tt2'; WRAPPER "kpac/parts/base.tt2" %]
+
+<!--
+subpage is the main wrapper page for everything except 'index'
+-->
<div class="main_top_shadow_sub">
<div class="main_mid_top_sub">
- [%# TODO BREADCRUMBS %]
- <div class="breadcrumb">
- <a class="bread_home"><img alt="home" src="[% ctx.media_prefix %]/images/kpac/home_icon.png" /></a>
- <div class="bread_green_mid"> </div>
- <a href="javascript:;">Animals, insects, & birds</a>
- <div class="bread_green_mid"> </div>
- <a href="javascript:;">search results</a>
- <div class="bread_green_mid"> </div>
- <a href="javascript:;">book name</a>
- <div class="bread_green_last"> </div>
- <span class="bread_last">got it</span>
- <div class="clear"> </div>
- </div>
+ [% INCLUDE 'kpac/parts/breadcrumb.tt2' %]
</div>
</div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
--- /dev/null
+[%
+
+ # -----------------------------------------------------------------
+ # Category trail/path utilities
+ # page trail looks like trail=id/id/id
+
+ # adds an ID, esults in the full trail as a string
+ MACRO trail_append(node_id) BLOCK;
+ trail = CGI.param('trail');
+ trail ? trail _ '/' _ node_id : node_id;
+ END;
+
+ # last trail component/id as a string
+ MACRO trail_endpoint BLOCK;
+ trail = CGI.param('trail');
+ list = trail ? trail.split('/') : [];
+ list().last;
+ END;
+
+ MACRO trail_splice(page_id) BLOCK;
+ trail = CGI.param('trail');
+ list = trail ? trail.split('/') : [];
+ path = '';
+ FOR id IN list;
+ path = path ? path _ '/' _ id : id;
+ IF id == page_id; LAST; END;
+ END;
+ path;
+ END;
+
+ # -----------------------------------------------------------------
+ # Determines the full path to image URLs
+ # Use absolute and fully-qualified image URLs as-is.
+ # For all others, use the kpac base path.
+ MACRO kpac_img_path(img) BLOCK;
+ IF img.match('^/') OR img.match('^https?://');
+ img;
+ ELSE;
+ ctx.media_prefix _ '/images/kpac/' _ img;
+ END;
+ END;
+%]
+
+
PROCESS "opac/parts/misc_util.tt2"; # MARC
PROCESS "kpac/parts/grid.tt2";
WRAPPER "kpac/parts/subpage.tt2";
-
- ctx.page_title = l('Search Results')
- ctx.result_start = 1 + ctx.page_size * page;
- ctx.result_stop = ctx.page_size * (page + 1);
- IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
- result_count = ctx.result_start;
-%]
+ ctx.page_title = l('Search Results') %]
<h2 class="sub_header2">Search Results</h2>
<div class="sub_navigation2">
- <table cellpadding="0" cellspacing="0" border="0" width="100%">
- <tr>
- <td><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/arrow_last.png" /></a></td>
- <td width="100%" class="nav_mid_bg">
- <table cellpadding="0" cellspacing="0" border="0" align="center">
- <tr>
- <td>Page </td>
- <td class="current_page">3</td>
- <td> of </td>
- <td class="total_pages">12</td>
- </tr>
- </table>
- </td>
- <td class="to_top_btn"><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/arrow_next.png" /></a></td>
- </tr>
- </table>
+ [% INCLUDE 'kpac/parts/paginate.tt2' %]
</div>
<div id="search_results_parent">
<div class="item_detail_name"><a href="[% mkurl('detailed/' _ rec.id) %]">[% attrs.title %]</a></div>
<div class="item_detail_author">[% l('by [_1]', attrs.author) %]</div>
<div class="item_detail_callnumber">[% attrs.holdings.0.label | html %]</div>
- <div class="item_detail_extra_info">[% l('[_1], [_2]', attrs.publisher, attrs.pubdate) | html %] <!-- TODO fix and add Size --></div>
+ <div class="item_detail_extra_info">
+ [% l('[_1], [_2]', attrs.publisher, attrs.pubdate) | html %] <!-- TODO fix commas, etc. -->
+ [% IF attrs.phys_desc %]<br/>[% attrs.phys_desc | html; END %]
+ </div>
<div class="item_detail_actions">
- <div class="button"><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/more_info_btn.png" alt="more info" /></a></div>
- <div class="button"><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/get_it_btn_sm.png" alt="get it" /></a></div>
+ <div class="button"><a href="[% mkurl(ctx.kpac_root _ '/detailed/' _ rec.id) %]"><img
+ src="[% ctx.media_prefix %]/images/kpac/more_info_btn.png" alt="more info" /></a></div>
+ <div class="button"><a href="javascript:;"><img
+ src="[% ctx.media_prefix %]/images/kpac/get_it_btn_sm.png" alt="get it" /></a></div>
<div class="clear"> </div>
</div>
</div>
</div>
<div class="sub_navigation3">
- <table cellpadding="0" cellspacing="0" border="0" width="100%">
- <tr>
- <td><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/arrow_last.png" /></a></td>
- <td width="100%" class="nav_mid_bg">
- <table cellpadding="0" cellspacing="0" border="0" align="center">
- <tr>
- <td>Page </td>
- <td class="current_page">3</td>
- <td> of </td><td class="total_pages">12</td>
- </tr>
- </table>
- </td>
- <td><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/arrow_next.png" /></a></td>
- <td class="to_top_btn"><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png" /></a></td>
- </tr>
- </table>
+ [% INCLUDE 'kpac/parts/paginate.tt2' showtop=1 %]
</div>
[% END %]
background:url('/images/kpac/popup_br.png') no-repeat;\r
}\r
\r
-\r
+.invisible {\r
+ visibility : hidden;\r
+}\r
\r
\r
\r