kpac : wire up home search; auth timeout redirect fixes
authorBill Erickson <berick@esilibrary.com>
Thu, 5 Apr 2012 19:31:49 +0000 (15:31 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 30 Jul 2012 19:03:21 +0000 (15:03 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm
Open-ILS/src/templates/kpac/home.tt2

index 01e2b35..1aab231 100644 (file)
@@ -171,6 +171,7 @@ sub load_getit_results {
 
 sub load_kpac_config {
     my $self = shift;
+    my $ctx = $self->ctx;
 
     if (!$kpac_config) {
         my $path = $self->apache->dir_config('KPacConfigFile');
@@ -188,19 +189,20 @@ sub load_kpac_config {
         );
     }
 
-    my $ou = $self->ctx->{physical_loc} || $self->_get_search_lib;
+    my $ou = $ctx->{physical_loc} || $self->_get_search_lib;
     my $layout;
 
     # Search up the org tree to find the nearest config for the context org unit
-    while (my $org = $self->ctx->{get_aou}->($ou)) {
+    while (my $org = $ctx->{get_aou}->($ou)) {
         ($layout) = grep {$_->{owner} eq $org->id} @{$kpac_config->{layout}};
         last if $layout;
         $ou = $org->parent_ou;
     }
 
-    $self->ctx->{kpac_layout} = $layout;
-    $self->ctx->{kpac_config} = $kpac_config;
-    $self->ctx->{kpac_root} = $self->ctx->{base_path} . "/kpac"; 
+    $ctx->{kpac_layout} = $layout;
+    $ctx->{kpac_config} = $kpac_config;
+    $ctx->{kpac_root} = $ctx->{base_path} . "/kpac"; 
+    $ctx->{home_page} = 'http://' . $self->apache->hostname . $ctx->{kpac_root} . "/home";
 }
 
 
index 500e336..513d8fe 100644 (file)
             <div class="search_wrapper">
                 <h1>Search your Library</h1>
                 <h3>for books, movies, music, magazines, and more!</h3>
-                <table cellpadding="0" cellspacing="0" border="0" align="center" class="search_box_wrapper">
-                    <tr>
-                        <td class="st_radio_btn"><input type="radio" name="search_type" checked="checked" id="st_word" class="st_word" /></td>
-                        <td class="st_label"><label for="st_word">[% l('Word') %]</label></td>
-                        <td class="st_radio_btn"><input type="radio" name="search_type" id="st_title" class="st_title" /></td>
-                        <td class="st_label"><label for="st_title">[% l('Title') %]</label></td>
-                        <td class="st_radio_btn"><input type="radio" name="search_type" id="st_author" class="st_author" /></td>
-                        <td class="st_label st_author_box"><label for="st_author">[% l('Author') %]</label></td>
-                        <td><input type="text" class="search_box" /></td>
-                        <td><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/search_btn.png" alt="search" /></a></td>
-                    </tr>
-                </table>
+                <form action="[% ctx.kpac_root _ '/results' %]">
+                    [% qtype = CGI.param('qtype') %]
+                    <table cellpadding="0" cellspacing="0" border="0" align="center" class="search_box_wrapper">
+                        <tr>
+                            <td class="st_radio_btn"><input type="radio" name="qtype" value="keyword" id="st_word" class="st_word" 
+                                [% IF !qtype OR qtype == 'keyword' %]checked="checked"[% END %]/></td>
+                            <td class="st_label"><label for="st_word">[% l('Word') %]</label></td>
+
+                            <td class="st_radio_btn"><input type="radio" name="qtype" value="title" id="st_title" class="st_title" 
+                                [% IF qtype == 'title' %]checked="checked"[% END %]/></td>
+                            <td class="st_label"><label for="st_title">[% l('Title') %]</label></td>
+
+                            <td class="st_radio_btn"><input type="radio" name="qtype" value="author" id="st_author" class="st_author"
+                                [% IF qtype == 'author' %]checked="checked"[% END %]/></td>
+                            <td class="st_label st_author_box"><label for="st_author">[% l('Author') %]</label></td>
+
+                            <td><input type="text" class="search_box" name="query" value="[% CGI.param('query') | html %]"/></td>
+                            <td><input type="image" src="[% ctx.media_prefix %]/images/kpac/search_btn.png" alt="search" /></td>
+                        </tr>
+                    </table>
+                </form>
             </div>
             <div class="category_wrapper">
                 <h3 class="c_header_image">Or click on an image to get started:</h3>