New
authorMike Taylor <mike@indexdata.com>
Fri, 15 Sep 2006 16:51:50 +0000 (16:51 +0000)
committerMike Taylor <mike@indexdata.com>
Fri, 15 Sep 2006 16:51:50 +0000 (16:51 +0000)
web/htdocs/all.html [new file with mode: 0644]
web/htdocs/details/all.mc [new file with mode: 0644]
web/htdocs/details/find.mc [new file with mode: 0644]
web/htdocs/details/found.mc [new file with mode: 0644]
web/htdocs/find.html [new file with mode: 0644]
web/htdocs/valid-xhtml10.png [new file with mode: 0644]
web/htdocs/vcss.png [new file with mode: 0644]

diff --git a/web/htdocs/all.html b/web/htdocs/all.html
new file mode 100644 (file)
index 0000000..b510693
--- /dev/null
@@ -0,0 +1,3 @@
+%# $Id: all.html,v 1.1 2006-09-15 16:51:50 mike Exp $
+<& /chrome/layout.mc, %ARGS, title => "Test all databases",
+    component => "/details/all.mc" &>
diff --git a/web/htdocs/details/all.mc b/web/htdocs/details/all.mc
new file mode 100644 (file)
index 0000000..4ec2d82
--- /dev/null
@@ -0,0 +1,17 @@
+%# $Id: all.mc,v 1.1 2006-09-15 16:51:51 mike Exp $
+<%perl>
+print "IRSpy version $ZOOM::IRSpy::VERSION<br/>\n";
+my $spy = new ZOOM::IRSpy("localhost:1313/IR-Explain---1");
+if (1) {
+    # Testing all databases would take much too long for testing
+    my @targets = qw(bagel.indexdata.dk/gils z3950.loc.gov:7090/Voyager);
+    $spy->targets(join(" ", @targets));
+}
+$spy->initialise();
+my $res = $spy->check();
+if ($res == 0) {
+    print "All tests were run\n";
+} else {
+    print "Some tests were skipped\n";
+}
+</%perl>
diff --git a/web/htdocs/details/find.mc b/web/htdocs/details/find.mc
new file mode 100644 (file)
index 0000000..56b8310
--- /dev/null
@@ -0,0 +1,78 @@
+%# $Id: find.mc,v 1.1 2006-09-15 16:51:51 mike Exp $
+% if ($r->param("_search")) {
+%     $m->comp("found.mc");
+% } else {
+     <p>
+      Choose one or more critera by which to search for registered
+      databases, then press the <b>Search</b> button.
+     </p>
+     <form>
+      <table class="searchform">
+       <tr>
+        <th>(Anywhere)</th>
+       <td><input type="text" name="cql.anywhere" size="40"/></td>
+       </tr>
+       <tr><td colspan="2">&nbsp;</td></tr>
+       <tr>
+        <th>Protocol</th>
+       <td>
+         <select name="net.protocol" size="1">
+         <option value="">[No preference]</option>
+         <option value="z39.50">Z39.50</option>
+         <option value="sru">SRU</option>
+         <option value="srw">SRW</option>
+        </select>
+        </td>
+       </tr>
+       <tr>
+        <th>Version</th>
+       <td><input type="text" name="net.version" size="5"/></td>
+       </tr>
+       <tr>
+        <th>Method</th>
+       <td>
+         <select name="net.method" size="1">
+         <option value="">[No preference]</option>
+         <option value="get">GET</option>
+         <option value="post">POST</option>
+        </select>
+        </td>
+       </tr>
+       <tr><td colspan="2">&nbsp;</td></tr>
+       <tr>
+        <th>Host</th>
+       <td><input type="text" name="net.host" size="40"/></td>
+       </tr>
+       <tr>
+        <th>Port</th>
+       <td><input type="text" name="net.port" size="5"/></td>
+       </tr>
+       <tr>
+        <th>Database</th>
+       <td><input type="text" name="net.path" size="20"/></td>
+       </tr>
+       <tr><td colspan="2">&nbsp;</td></tr>
+       <tr>
+        <th>Title</th>
+       <td><input type="text" name="dc.title" size="40"/></td>
+       </tr>
+       <tr>
+        <th>Creator</th>
+       <td><input type="text" name="dc.creator" size="40"/></td>
+       </tr>
+       <tr><td colspan="2">&nbsp;</td></tr>
+       <tr>
+        <th/>
+        <th><input type="submit" name="_search" value="Search"/></th>
+       </tr>
+      </table>
+      <p>
+       <small>
+       Show
+       <input type="text" name="_count" size="4" value="10"/>
+       records, skipping the first
+       <input type="text" name="_skip" size="4" value="0"/>
+       </small>
+      </p>
+     </form>
+% }
diff --git a/web/htdocs/details/found.mc b/web/htdocs/details/found.mc
new file mode 100644 (file)
index 0000000..2d690a9
--- /dev/null
@@ -0,0 +1,72 @@
+%# $Id: found.mc,v 1.1 2006-09-15 16:51:51 mike Exp $
+<%once>
+use XML::LibXML;
+use XML::LibXML::XPathContext;
+</%once>
+<%perl>
+my $query = "";
+foreach my $key ($r->param()) {
+    next if $key =~ /^_/;
+    my $val = $r->param($key);
+    next if $val eq "";
+    $query .= " and " if $query ne "";
+    $query .= "$key = ($val)";
+}
+
+### We can think about keeping the Connection object open to re-use
+# for multiple requests, but that may not get us much.  Same applies
+# for the XML parser.
+my $conn = new ZOOM::Connection("localhost:1313/IR-Explain---1");
+$conn->option(elementSetName => "zeerex");
+my $parser = new XML::LibXML();
+
+my $rs = $conn->search(new ZOOM::Query::CQL($query));
+my $n = $rs->size();
+
+my $skip = $r->param("_skip") || 0;
+my $count = $r->param("_count") || 10;
+
+my $first = $skip+1;
+my $last = $first+$count-1;
+$last = $n if $last > $n;
+</%perl>
+     <p>
+      <b><% $query %></b>
+      <br/>
+% if ($n == 0) {
+      No matches
+% } elsif ($first > $n) {
+      Past end of <% $n %> records
+% } else {
+      Records <% $first %> to <% $last %> of <% $n %>
+% }
+     </p>
+% if ($n > 0 && $first <= $n) {
+     <table width="100%">
+      <tr class="thleft">
+       <th>#</th>
+       <th>Host</th>
+       <th>Port</th>
+       <th>DB</th>
+      </tr>
+% foreach my $i ($first .. $last) {
+<%perl>
+my $rec = $rs->record($i-1);
+my $xml = $rec->render();
+my $doc = $parser->parse_string($xml);
+my $root = $doc->getDocumentElement();
+my $xc = XML::LibXML::XPathContext->new($root);
+$xc->registerNs(e => 'http://explain.z3950.org/dtd/2.0/');
+my $host = $xc->find("e:serverInfo/e:host");
+my $port = $xc->find("e:serverInfo/e:port");
+my $db = $xc->find("e:serverInfo/e:database");
+</%perl>
+      <tr style="background: <% ($i % 2) ? '#ffffc0' : 'white' %>">
+       <td><% $i %></td>
+       <td><% $host %></td>
+       <td><% $port %></td>
+       <td><% $db %></td>
+      </tr>
+%}
+     </table>
+% }
diff --git a/web/htdocs/find.html b/web/htdocs/find.html
new file mode 100644 (file)
index 0000000..e8e940a
--- /dev/null
@@ -0,0 +1,3 @@
+%# $Id: find.html,v 1.1 2006-09-15 16:51:50 mike Exp $
+<& /chrome/layout.mc, %ARGS, title => "Find a database",
+    component => "/details/find.mc" &>
diff --git a/web/htdocs/valid-xhtml10.png b/web/htdocs/valid-xhtml10.png
new file mode 100644 (file)
index 0000000..2275ee6
Binary files /dev/null and b/web/htdocs/valid-xhtml10.png differ
diff --git a/web/htdocs/vcss.png b/web/htdocs/vcss.png
new file mode 100644 (file)
index 0000000..fb0576f
Binary files /dev/null and b/web/htdocs/vcss.png differ