updating opensearch output to contain proper unAPI stuff
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Mar 2006 20:21:55 +0000 (20:21 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Mar 2006 20:21:55 +0000 (20:21 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3300 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 783a7fd..73ed6db 100644 (file)
@@ -516,7 +516,7 @@ sub opensearch_feed {
        );
        $feed->root($root);
 
-       $feed->title("$class search results for [$terms] at ".$org_unit->[0]->name);
+       $feed->title("Search results for [$class => $terms] at ".$org_unit->[0]->name);
        $feed->creator($host);
        $feed->update_ts(gmtime_ISO8601());
 
@@ -554,6 +554,12 @@ sub opensearch_feed {
        ) if ($offset);
 
        $feed->link(
+               unapi =>
+               $unapi =>
+               'application/xml'
+       );
+
+       $feed->link(
                self =>
                $base . $path =>
                'application/opensearch+xml'
@@ -611,6 +617,7 @@ sub create_record_feed {
                $node->link(alternate => $feed->unapi . "?uri=$item_tag&format=opac" => 'application/xml');
                $node->link(opac => $feed->unapi . "?uri=$item_tag&format=opac");
                $node->link(unapi => $feed->unapi . "?uri=$item_tag");
+               $node->link('unapi-uri' => $item_tag);
        }
 
        return $feed;
@@ -618,7 +625,7 @@ sub create_record_feed {
 
 sub entityize {
        my $stuff = NFC(shift());
-       $stuff =~ s/&(?!#.{2,4};|amp;)/&amp;/gso;
+       #$stuff =~ s/&(?!#.{2,4};|amp;)/&amp;/gso;
        $stuff =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
        return $stuff;
 }
index 280b21c..f994611 100644 (file)
@@ -181,6 +181,7 @@ sub link {
        my $type = shift;
        my $id = shift;
        my $mime = shift || "application/$type+xml";
+       my $title = shift;
 
        $type = 'self' if ($type eq 'atom');
 
@@ -191,6 +192,7 @@ sub link {
                undef,
                { rel => $type,
                  href => $id,
+                 title => $title,
                  type => $mime,
                }
        );
index 6246b37..d5883c7 100644 (file)
@@ -2,6 +2,11 @@ body {
        font-family: Arial, Helvetica, Sans-serif;
        font-size: 0.9em;
        }
+p.nav {
+       text-align: center;
+       border-top: solid lightgray 1px;
+       border-bottom: solid lightgray 1px;
+}
 h1 {
        font-size: 1.5em;
        }
index 494f0ce..fd6a58b 100644 (file)
@@ -115,6 +115,7 @@ To-do list:
                        <xsl:variable name="totalresults"><xsl:if test="(opensearch:totalResults | opensearchOld:totalResults)&gt;=$endIndex"><xsl:value-of select="(opensearch:totalResults | opensearchOld:totalResults)[1]" /></xsl:if></xsl:variable>
                        <xsl:variable name="navprev"><xsl:if test="atom:link[@rel='previous']/@href and ((opensearch:startIndex&gt;1 or opensearchOld:startIndex&gt;1) or not(opensearch:startIndex or opensearchOld:startIndex))"><xsl:call-template name="resolvelink"><xsl:with-param name="url" select="(atom:link[@rel='previous']/@href)[1]" /></xsl:call-template></xsl:if></xsl:variable>
                        <xsl:variable name="navnext"><xsl:if test="atom:link[@rel='next']/@href and (($totalresults&gt;0 and $totalresults&gt;$endIndex) or (not($totalresults&gt;0)))"><xsl:call-template name="resolvelink"><xsl:with-param name="url" select="atom:link[@rel='next']/@href" /></xsl:call-template></xsl:if></xsl:variable>
+
                        <xsl:variable name="statedStartIndex" select="(opensearch:startIndex | opensearchOld:startIndex)[1]" />
                        <head>
                                <title><xsl:value-of select="$title" /></title>
@@ -127,6 +128,15 @@ To-do list:
                                        <xsl:attribute name="href"><xsl:value-of select="concat($base_dir,'/os.css')"/></xsl:attribute>
                                </link>
                                <!-- rel links -->
+
+                               <xsl:for-each select="atom:link[@rel='unapi' and string-length(@href)&gt;0]">
+                                       <link rel="meta" title="unAPI" type="application/xml">
+                                               <xsl:attribute name='href'>
+                                                       <xsl:value-of select="./@href"/>
+                                               </xsl:attribute>
+                                       </link>
+                               </xsl:for-each>
+
                                <xsl:if test="string-length($navprev)&gt;0"><link rel="previous" href="{$navprev}" title="{$t-prevpage}" /></xsl:if>
                                <xsl:if test="string-length($navnext)&gt;0"><link rel="next" href="{$navnext}" title="{$t-nextpage}" /></xsl:if>
                                <xsl:if test="atom:link[@rel='first']/@href and ($statedStartIndex&gt;1 or string-length($statedStartIndex)=0)">
@@ -174,7 +184,7 @@ To-do list:
                                <xsl:choose>
                                        <xsl:when test="$items">
                                                <!-- display the search numbers -->
-                                               <p>
+                                               <p class="nav">
                                                        <xsl:value-of select="concat($t-results,' ')" />
                                                        <xsl:choose>
                                                                <xsl:when test="$statedStartIndex&gt;0"><xsl:value-of select="$statedStartIndex" /></xsl:when>
@@ -183,10 +193,25 @@ To-do list:
                                                        <xsl:value-of select="concat(' ', $t-resultsto, ' ')" />
                                                        <xsl:value-of select="$endIndex" />
                                                        <xsl:if test="$totalresults&gt;0"><xsl:value-of select="concat(' ', $t-resultsof, ' ')" /><xsl:number value="$totalresults" grouping-size="3" grouping-separator="{$t-numsep}" /></xsl:if>
+                                                       <xsl:if test="string-length($navnext)&gt;0 or string-length($navprev)&gt;0">   |   </xsl:if>
+                                                       <xsl:if test="string-length($navprev)&gt;0">
+                                                               <a class="x-escape" href="{$navprev}" rel="previous"><xsl:value-of select="$t-prevlink" disable-output-escaping="yes" /></a>
+                                                               <xsl:if test="string-length($navnext)&gt;0"> | </xsl:if>
+                                                       </xsl:if>
+                                                       <xsl:if test="string-length($navnext)&gt;0"><a class="x-escape" href="{$navnext}" rel="next"><xsl:value-of select="$t-nextlink" disable-output-escaping="yes" /></a></xsl:if>
                                                </p>
                                                <dl><xsl:apply-templates select="$items" /></dl>
                                                <!-- result navigation -->
-                                               <p id="nav">
+                                               <p class="nav">
+                                                       <xsl:value-of select="concat($t-results,' ')" />
+                                                       <xsl:choose>
+                                                               <xsl:when test="$statedStartIndex&gt;0"><xsl:value-of select="$statedStartIndex" /></xsl:when>
+                                                               <xsl:otherwise>1</xsl:otherwise>
+                                                       </xsl:choose>
+                                                       <xsl:value-of select="concat(' ', $t-resultsto, ' ')" />
+                                                       <xsl:value-of select="$endIndex" />
+                                                       <xsl:if test="$totalresults&gt;0"><xsl:value-of select="concat(' ', $t-resultsof, ' ')" /><xsl:number value="$totalresults" grouping-size="3" grouping-separator="{$t-numsep}" /></xsl:if>
+                                                       <xsl:if test="string-length($navnext)&gt;0 or string-length($navprev)&gt;0">   |   </xsl:if>
                                                        <xsl:if test="string-length($navprev)&gt;0">
                                                                <a class="x-escape" href="{$navprev}" rel="previous"><xsl:value-of select="$t-prevlink" disable-output-escaping="yes" /></a>
                                                                <xsl:if test="string-length($navnext)&gt;0"> | </xsl:if>
@@ -309,10 +334,21 @@ To-do list:
                <!-- item url -->
                <xsl:if test="string-length($url)&gt;0">
                        <dd class="url">
-                               <xsl:choose>
-                                       <xsl:when test="string-length(substring-after($url, 'http://'))&gt;100"><xsl:value-of select="concat(substring(substring-after($url, 'http://'),1,100),'&#8230;')" /></xsl:when>
-                                       <xsl:otherwise><xsl:value-of select="substring-after($url, 'http://')" /></xsl:otherwise>
-                               </xsl:choose>
+                               <span class="unapi-uri">
+                                       <xsl:for-each select="atom:link[@rel='unapi-uri']">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of select="@href" />
+                                               </xsl:attribute>
+                                       </xsl:for-each>
+                                       <xsl:choose>
+                                               <xsl:when test="string-length(substring-after($url, 'http://'))&gt;100">
+                                                       <xsl:value-of select="concat(substring(substring-after($url, 'http://'),1,100),'&#8230;')" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of select="substring-after($url, 'http://')" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </span>
                        </dd>
                </xsl:if>
        </xsl:template>