adding sources and a reasonable timeout
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Jun 2005 15:30:53 +0000 (15:30 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Jun 2005 15:30:53 +0000 (15:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@813 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/opensearch.pm
Open-ILS/src/extras/opensearch.xml
Open-ILS/src/extras/opensearchportal.html

index 0ec38ab..c0b8f58 100644 (file)
@@ -26,7 +26,15 @@ sub handler {
        
        if (my $fetch = $cgi->param('fetch')) {
 
-               print LWP::UserAgent->new->get($fetch)->content;
+               try {
+                       alarm(15);
+                       print LWP::UserAgent->new->get($fetch)->content;
+                       alarm(0);
+               } catch Error with {
+                       alarm(0);
+                       print '<arg>';
+               };
+               alarm(0);
 
        } else {
 
index 9f5edff..417656c 100644 (file)
@@ -4,10 +4,10 @@
        xmlns:openIll="http://open-ils.org/xml/openIll/1.0">
   <Url>http://gapines.org/opensearch/?target=mr_result&amp;mr_search_type=keyword&amp;mr_search_query={searchTerms}&amp;page={startPage}&amp;mr_search_depth=0&amp;mr_search_location=1&amp;pagesize={count}&amp;max_rank={relevanceScale}</Url>
   <Format>http://a9.com/-/spec/opensearchrss/1.0/</Format>
-  <ShortName>Pines</ShortName>
-  <LongName>Pines Consortium Catalogue</LongName>
+  <ShortName>Evergreen DEMO</ShortName>
+  <LongName>Pines Consortium DEMO OpenSearch Catalogue</LongName>
   <Description>Search for books in Pines.</Description>
-  <Tags>book library research</Tags>
+  <Tags>book library research Evergreen Open-ILS GPLS</Tags>
   <Image>http://gapines.org/images/small_logo.jpg</Image>
   <SampleSearch>harry potter</SampleSearch>
   <Developer>GPLS</Developer>
index 49153bd..36fb753 100644 (file)
@@ -17,7 +17,8 @@ td {
        vertical-align: top;
 }
 
-.data_table {
+.source_input {
+       border: dotted blue 1px;
 }
 
 caption {
@@ -66,6 +67,7 @@ a:visited {
        border-collapse: collapse;
        /*width: 100%;*/
        max-width: 400px;
+       min-width: 300px;
 }
 
 .res_tr {
@@ -346,7 +348,7 @@ function getElementTextNS(prefix, local, parentElem, index) {
         if (result.childNodes.length > 1) {
             return result.childNodes[1].nodeValue;
         } else {
-            return result.textContent;                 
+            return result.firstChild.nodeValue;                
         }
     } else {
         return '';
@@ -365,19 +367,19 @@ function add_result_row (tab, index, xml, source) {
        }
        
        try {
-               title = xml.getElementsByTagName('title')[0].textContent;
+               title = getElementTextNS('','title',xml,0);
        } catch (e) {
                title = '';
        }
        
        try {
-               tlink = xml.getElementsByTagName('link')[0].textContent;
+               tlink = getElementTextNS('','link',xml,0);
        } catch (e) {
                tlink = '';
        }
 
        try {
-               description = xml.getElementsByTagName('description')[0].textContent;
+               description = getElementTextNS('','description',xml,0);
        } catch (e) {
                description = '';
        }
@@ -417,13 +419,11 @@ function create_search ( s ) {
                <form onsubmit="opensearch(document.getElementById('term').value, true); return false;">
                <table>
                        <tr valign="top">
-                               <td>Keyword Search: </td>
-                               <td align="left">
+                               <td align="left">Keyword Search: 
                                        <input type="text" id="term" value="javascript"/>
                                        <input type="submit" value="Go!"/>
                                </td>
-                               <td>Hits per Source: </td>
-                               <td>
+                               <td align="right">Hits per Source: 
                                        <select onchange="current_count=this.options[this.selectedIndex].value;">
                                                <option value="5" selected>5</option>
                                                <option value="10">10</option>
@@ -432,11 +432,15 @@ function create_search ( s ) {
                                </td>
                        </tr>
                        <tr valign="top">
-                               <td colspan=4>Sources:  
-                                       <input name="source" type="checkbox" value="http://gapines.org/opensearch.xml" checked>GPLS Pines
-                                       <input name="source" type="checkbox" value="http://rsinger.library.gatech.edu/opensearch/osdd-gil.xml" checked>GIL Universal Catalog
-                                       <input name="source" type="checkbox" value="http://search.athenscounty.lib.oh.us/cgi-bin/koha/opensearchdescription">NPL/Koha
-                                       <input name="source" type="checkbox" value="http://www.webdevref.com/blog/opensearchdescription.xml">WebDefRef
+                               <td colspan=2>Sources:  
+                                       <label class="source_input"><input name="source" type="checkbox" value="http://gapines.org/opensearch.xml" checked>GPLS Pines</label>
+                                       <label class="source_input"><input name="source" type="checkbox" value="http://rsinger.library.gatech.edu/opensearch/osdd-gil.xml" checked>GIL Universal Catalog</label>
+                                       <label class="source_input"><input name="source" type="checkbox" value="http://search.athenscounty.lib.oh.us/cgi-bin/koha/opensearchdescription">NPL/Koha</label>
+                                       <label class="source_input"><input name="source" type="checkbox" value="http://www.koders.com/search/KodersSourceCodeSearchDescription.xml">Koders Source Code</label>
+                                       <label class="source_input"><input name="source" type="checkbox" value="http://cnx.rice.edu/content/opensearchdescription">rice.edu Connexions</label>
+                                       <label class="source_input"><input name="source" type="checkbox" value="http://redlightgreen.com/ucwprod/web/opensearchDescription.xml">RedLightGreen</label>
+                                       <label class="source_input"><input name="source" type="checkbox" value="http://www.itpapers.com/itpaperssearchdescription.xml">ITPapers</label>
+                                       <!-- <input name="source" type="checkbox" value="http://www.webdevref.com/blog/opensearchdescription.xml">WebDefRef -->
                                </td>
                        </tr>
                </table>