# Expire the HTML quickly since we're loading dynamic data for each page
ExpiresActive On
ExpiresByType text/html "access plus 5 seconds"
+ PerlSetVar KPacConfigFile "/openils/conf/kpac.xml.example"
# For use with embedded Content Cafe content
#SetEnv OILS_CONTENT_CAFE_USER 123
+++ /dev/null
-<kpac version="1.0" xmlns="http://evergreen-ils.org/spec/OPAC/kpac/v1">
- <pages>
- <!-- top-level layout pages -->
- <page id="1" columns="5" name="Home" img="/images/home.jpg">
- <cell type="topic">10</cell>
- <cell type="topic">11</cell>
- <cell type="topic">12</cell>
- <cell type="topic">13</cell>
- <cell type="topic">14</cell>
- <cell type="topic">15</cell>
- <cell type="topic">16</cell>
- <cell type="topic">17</cell>
- <cell type="topic">18</cell>
- <cell type="topic">19</cell>
- </page>
-
- <!-- sample alternate layout -->
- <page id="23" columns="3" name="ABC Home" img="/images/abc-logo.jpg">
- <cell type="topic">11</cell>
- <cell type="topic">10</cell>
- <cell type="topic">12</cell>
- </page>
-
- <!-- topic pages -->
- <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="link">http://en.wikipedia.org/wiki/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>
- <page id="13" columns="3" name="It's Alive!" img="category.png">
- </page>
- <page id="14" columns="3" name="Book Series" img="category.png">
- </page>
- <page id="15" columns="3" name="Book Series" img="category.png">
- </page>
- <page id="16" columns="3" name="Book Series" img="category.png">
- </page>
- <page id="17" columns="3" name="Book Series" img="category.png">
- </page>
- <page id="18" columns="3" name="Book Series" img="category.png">
- </page>
- <page id="19" columns="3" name="Book Series" img="category.png">
- </page>
- </pages>
-
- <layout owner="1" page="1"/>
- <layout owner="213" page="23"/>
-</kpac>
--- /dev/null
+<kpac version="1.0" xmlns="http://evergreen-ils.org/spec/OPAC/kpac/v1">
+ <pages>
+ <!-- top-level layout pages -->
+ <page id="1" columns="5" name="Home" img="/images/home.jpg">
+ <cell type="topic">10</cell>
+ <cell type="topic">11</cell>
+ <cell type="topic">12</cell>
+ <cell type="topic">13</cell>
+ <cell type="topic">14</cell>
+ <cell type="topic">15</cell>
+ <cell type="topic">16</cell>
+ <cell type="topic">17</cell>
+ <cell type="topic">18</cell>
+ <cell type="topic">19</cell>
+ </page>
+
+ <!-- sample alternate layout -->
+ <page id="23" columns="3" name="ABC Home" img="/images/abc-logo.jpg">
+ <cell type="topic">11</cell>
+ <cell type="topic">10</cell>
+ <cell type="topic">12</cell>
+ </page>
+
+ <!-- topic pages -->
+ <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="link">http://en.wikipedia.org/wiki/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>
+ <page id="13" columns="3" name="It's Alive!" img="category.png">
+ </page>
+ <page id="14" columns="3" name="Book Series" img="category.png">
+ </page>
+ <page id="15" columns="3" name="Book Series" img="category.png">
+ </page>
+ <page id="16" columns="3" name="Book Series" img="category.png">
+ </page>
+ <page id="17" columns="3" name="Book Series" img="category.png">
+ </page>
+ <page id="18" columns="3" name="Book Series" img="category.png">
+ </page>
+ <page id="19" columns="3" name="Book Series" img="category.png">
+ </page>
+ </pages>
+
+ <layout owner="1" page="1"/>
+ <layout owner="213" page="23"/>
+</kpac>
$(examples)/oils_sip.xml.example \
$(examples)/lib_ips.txt.example \
$(examples)/oils_yaz.xml.example \
+ $(examples)/kpac.xml.example \
$(examples)/oils_z3950.xml.example
#----------------------------
sub load {
my $self = shift;
- $self->init_ro_object_cache;
+ $self->init_ro_object_cache;
- my $stat = $self->load_common;
+ my $stat = $self->load_common;
return $stat unless $stat == Apache2::Const::OK;
$self->load_kpac_config;
return $self->load_simple("home") if $path =~ m|kpac/home|;
return $self->load_simple("category") if $path =~ m|kpac/category|;
- return $self->load_rresults if $path =~ m|kpac/results|; # inherited
- return $self->load_record(no_search => 1) if $path =~ m|kpac/record|; # inherited
+ return $self->load_rresults if $path =~ m|kpac/results|;
+ return $self->load_record(no_search => 1) if $path =~ m|kpac/record|;
# ----------------------------------------------------------------
# Everything below here requires SSL
# ----------------------------------------------------------------
return $self->redirect_ssl unless $self->cgi->https;
- # XXX auth vs. no-auth, pending list answers
return $self->load_simple("getit_results") if $path =~ m|kpac/getit_results|;
-
- if ($path =~ m|kpac/getit|) { # after getit_results
- my $stat = $self->load_record(no_search => 1);
- $self->ctx->{page} = 'getit'; # repair the page
- return $stat;
- }
+ return $self->load_getit if $path =~ m|kpac/getit|;
# ----------------------------------------------------------------
# Everything below here requires authentication
return Apache2::Const::OK;
}
+sub load_getit {
+ my $self = shift;
+ my $ctx = $self->ctx;
+
+ # first load the record
+ my $stat = $self->load_record(no_search => 1);
+ return $stat unless $stat == Apache2::Const::OK;
+
+ $self->ctx->{page} = 'getit'; # repair the page
+
+ # if the user is logged in, fetch his bookbags
+ if ($ctx->{user}) {
+ $ctx->{bookbags} = $self->editor->search_container_biblio_record_entry_bucket(
+ [{
+ owner => $ctx->{user}->id,
+ btype => 'bookbag'
+ }, {
+ order_by => {cbreb => 'name'},
+ limit => $self->cgi->param('bbag_limit') || 100,
+ }],
+ {substream => 1}
+ );
+ }
+
+ $self->ctx->{page} = 'getit'; # repair the page
+ return Apache2::Const::OK;
+}
+
sub load_kpac_config {
my $self = shift;
- my $path = '/home/berick/code/Evergreen/Open-ILS/examples/kpac.xml'; # TODO: apache config
- unless ($kpac_config) {
+ if (!$kpac_config) {
+ my $path = $self->apache->dir_config('KPacConfigFile');
+
+ if (!$path) {
+ $self->apache->log->error("KPacConfigFile required!");
+ return;
+ }
+
$kpac_config = XMLin(
$path,
KeyAttr => ['id'],
);
}
- # TODO: make generic "whereami" sub for EGCatLoader.
- my $ou = $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id;
+ my $ou = $self->ctx->{physical_loc} || $self->_get_search_lib;
my $layout;
# Search up the org tree to find the nearest config for the context org unit
</div>
</td>
- <!-- TODO -->
<td valign="top">
<div class="right_brain">
<div class="top_side">
- <h2>save it!</h2>
- <p>If you would like to save this item to a list to be requested later, please choose a location and click<br />Submit below.</p>
+ <h2>[% l('save it!') %]</h2>
+ <p>[% l('If you would like to save this item to a list to be requested later, please choose a location and click <br/>Submit below.') %]</p>
</div>
- <div class="checkout_box">
- <div class="box1_top"> </div>
- <div class="box_inside">
- <p>Choose a Pickup Library:</p>
- <div class="pickup_lib"><select name="library"><option>Fairwood</option></select></div>
- <div class="hr"> </div>
- <div><a href="javascript:;">View all KCLS libraries</a></div>
+ [% IF ctx.user AND ctx.bookbags.size > 0 %]
+ <div class="checkout_box">
+ <div class="box1_top"> </div>
+ <div class="box_inside">
+ <p>[% l('Add to one of your lists?') %]</p>
+ <select name='bookbag'>
+ <option selected='selected'>[% l('-- Select a List --') %]</option>
+ [% FOR bbag IN ctx.bookbags %]
+ <option value="[% bbag.id %]">[% bbag.name | html %]</option>
+ [% END %]
+ </select>
+ </div>
</div>
- </div>
+ [% END %]
<div class="submit_btn">
<a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" alt="submit" /></a>
</div>