enhancing search from the html feed output
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Mar 2006 06:33:57 +0000 (06:33 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Mar 2006 06:33:57 +0000 (06:33 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3414 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm
Open-ILS/web/opac/extras/os.css
Open-ILS/xsl/ATOM2XHTML.xsl

index bad6b89..e393b75 100644 (file)
@@ -108,7 +108,7 @@ sub unapi {
 
                        for my $h (@$list) {
                                my ($type) = keys %$h;
-                               $body .= "<format><name>$type</name><type>application/$type+xml</type>";
+                               $body .= "<format><name>$type</name><type>application/xml</type>";
 
                                for my $part ( qw/namespace_uri docs schema_location/ ) {
                                        $body .= "<$part>$$h{$type}{$part}</$part>"
@@ -144,7 +144,7 @@ sub unapi {
 
                        for my $h (@$list) {
                                my ($type) = keys %$h;
-                               print "<format><name>$type</name><type>application/x-$type+xml</type>";
+                               print "<format><name>$type</name><type>application/xml</type>";
 
                                for my $part ( qw/namespace_uri docs schema_location/ ) {
                                        print "<$part>$$h{$type}{$part}</$part>"
@@ -212,7 +212,7 @@ sub supercat {
 
                        for my $h (@$list) {
                                my ($type) = keys %$h;
-                               print "<format><name>$type</name><type>application/$type+xml</type>";
+                               print "<format><name>$type</name><type>application/xml</type>";
 
                                for my $part ( qw/namespace_uri docs schema_location/ ) {
                                        print "<$part>$$h{$type}{$part}</$part>"
@@ -248,7 +248,7 @@ sub supercat {
 
                for my $h (@$list) {
                        my ($type) = keys %$h;
-                       print "<format><name>$type</name><type>application/$type+xml</type>";
+                       print "<format><name>$type</name><type>application/xml</type>";
 
                        for my $part ( qw/namespace_uri docs schema_location/ ) {
                                print "<$part>$$h{$type}{$part}</$part>"
@@ -475,8 +475,10 @@ sub opensearch_feed {
                $type = 'atom';
        }
 
+
        $class = 'keyword' if ($class eq '-');
        $terms =~ s/\+/ /go;
+       $terms =~ s/'//go;
 
        #warn "searching for $class -> [$terms] via OS $version, response type $type";
 
@@ -554,12 +556,12 @@ sub opensearch_feed {
 
        $feed->link( unapi => $unapi);
 
-       $feed->link(
-               alternate =>
-               $root . "../$lang/skin/default/xml/rresult.xml?rt=list&" .
-                       join('&', map { 'rl=' . $_->[0] } @{$recs->{ids}} ),
-               'text/html'
-       );
+#      $feed->link(
+#              alternate =>
+#              $root . "../$lang/skin/default/xml/rresult.xml?rt=list&" .
+#                      join('&', map { 'rl=' . $_->[0] } @{$recs->{ids}} ),
+#              'text/html'
+#      );
 
        $feed->link(
                opac =>
index 043b475..936a04e 100644 (file)
@@ -406,7 +406,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::atom';
 sub new {
        my $class = shift;
        my $self = $class->SUPER::new;
-       $self->{type} = 'text/html';
+       $self->type('text/html');
        return $self;
 }
 
@@ -414,9 +414,9 @@ our ($_parser, $_xslt, $xslt_file);
 
 sub toString {
        my $self = shift;
-       my $base = $self->base;
-       my $root = $self->root;
-       my $search = $self->search;
+       my $base = $self->base || '';
+       my $root = $self->root || '';
+       my $search = $self->search || '';
        my $lib = $self->lib || '-';
 
        $self->composeDoc;
@@ -440,7 +440,7 @@ sub toString {
                searchTerms => "'$search'",
        );
 
-       return $new_doc->toString(1); 
+       return $new_doc->toStringHTML(); 
 }
 
 
index f03ee5a..8771e08 100644 (file)
@@ -18,11 +18,12 @@ input.searchbox {
 
 div#searchdiv {
        z-index:10;
-       position:absolute;
+       position:fixed;
        top: 100;
        right: 0;
        background-color: lightgray;
        border:2px solid lightblue;
+       border-right: 0px;
        filter: alpha(opacity=50);
        -moz-opacity: .5;
 }
index 5a928d9..3364e0a 100644 (file)
@@ -181,23 +181,43 @@ To-do list:
                                        <b>Search:</b>
                                        <form method="GET">
                                                <xsl:attribute name="action"><xsl:value-of select="concat($base_dir, 'opensearch/1.1/', $lib, '/html/keyword')" /></xsl:attribute>
-                                               <input class="searchbox" type="text" name="searchTerms" value="keywords" onfocus="this.value='';"/>
+                                               <input class="searchbox"
+                                                       type="text" name="searchTerms"
+                                                       value="keywords"
+                                                       title="keywords"
+                                                       onfocus="if (this.value=='keywords') this.value='{$searchTerms}';"/>
                                        </form>
                                        <form method="GET">
                                                <xsl:attribute name="action"><xsl:value-of select="concat($base_dir, 'opensearch/1.1/', $lib, '/html/title')" /></xsl:attribute>
-                                               <input class="searchbox" type="text" name="searchTerms" value="titles" onfocus="this.value='';"/>
+                                               <input class="searchbox"
+                                                       type="text" name="searchTerms"
+                                                       value="titles"
+                                                       title="titles"
+                                                       onfocus="if (this.value=='titles') this.value='{$searchTerms}';"/>
                                        </form>
                                        <form method="GET">
                                                <xsl:attribute name="action"><xsl:value-of select="concat($base_dir, 'opensearch/1.1/', $lib, '/html/author')" /></xsl:attribute>
-                                               <input class="searchbox" type="text" name="searchTerms" value="authors" onfocus="this.value='';"/>
+                                               <input class="searchbox"
+                                                       type="text" name="searchTerms"
+                                                       value="authors"
+                                                       title="authors"
+                                                       onfocus="if (this.value=='authors') this.value='{$searchTerms}';"/>
                                        </form>
                                        <form method="GET">
                                                <xsl:attribute name="action"><xsl:value-of select="concat($base_dir, 'opensearch/1.1/', $lib, '/html/subject')" /></xsl:attribute>
-                                               <input class="searchbox" type="text" name="searchTerms" value="subjects" onfocus="this.value='';"/>
+                                               <input class="searchbox"
+                                                       type="text" name="searchTerms"
+                                                       value="subjects"
+                                                       title="subjects"
+                                                       onfocus="if (this.value=='subjects') this.value='{$searchTerms}';"/>
                                        </form>
                                        <form method="GET">
                                                <xsl:attribute name="action"><xsl:value-of select="concat($base_dir, 'opensearch/1.1/', $lib, '/html/series')" /></xsl:attribute>
-                                               <input class="searchbox" type="text" name="searchTerms" value="series" onfocus="this.value='';"/>
+                                               <input class="searchbox"
+                                                       type="text" name="searchTerms"
+                                                       value="series"
+                                                       title="series"
+                                                       onfocus="if (this.value=='series') this.value='{$searchTerms}';"/>
                                        </form>
                                        <br/>
                                </div>
@@ -461,7 +481,14 @@ To-do list:
                <xsl:if test="string-length($showname)&gt;0">
                        <xsl:choose>
                                <xsl:when test="string-length($showlink)&gt;0"><a href="{$showlink}"><xsl:value-of select="$showname" /></a></xsl:when>
-                               <xsl:otherwise><xsl:value-of select="$showname" /></xsl:otherwise>
+                               <xsl:otherwise>
+                                       <a>
+                                               <xsl:attribute name="href">
+                                                       <xsl:value-of select="concat($base_dir, 'opensearch/1.1/', $lib, '/html/author?searchTerms=', $showname)" />
+                                               </xsl:attribute>
+                                               <xsl:value-of select="$showname" />
+                                       </a>
+                               </xsl:otherwise>
                        </xsl:choose>
                        <xsl:text>; </xsl:text>
                </xsl:if>