6497266981fdd40d7906e5472a078d0884b4d911
[irspy-moved-to-github.git] / web / htdocs / details / upload.mc
1 %# $Id: upload.mc,v 1.2 2007-07-17 14:31:54 mike Exp $
2 <%args>
3 $filename => undef
4 </%args>
5 % if (!defined $filename) {
6    <p>
7     Please note that this form expects a
8     <a href="http://explain.z3950.org/"
9         >ZeeRex record</a>
10     only, not an entire
11     <a href="http://www.loc.gov/standards/sru/explain/"
12         >SRU explainResponse</a>.
13    <p>
14    <form method="post" action=""
15             enctype="multipart/form-data">
16     <p>
17      ZeeRex file to upload:
18      <input type="file" name="filename" size="50"/>
19      <br/>
20      <input type="submit" name="_submit" value="Submit"/>
21     </p>
22    </form>
23 % return;
24 % }
25 <%perl>
26 my $fin = $r->upload()->fh();
27 if (!defined $fin) {
28     $m->comp("/details/error.mc", msg => "Upload cancelled");
29     return;
30 }
31
32 my $xml = join("", <$fin>);
33 my $xc = irspy_xpath_context($xml);
34 my $id = irspy_record2identifier($xc);
35 my $conn = new ZOOM::Connection("localhost:8018/IR-Explain---1", 0,
36                                 user => "admin", password => "fruitbat",
37                                 elementSetName => "zeerex");
38 ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
39 </%perl>
40      <p>
41       Upload OK.
42      </p>
43      <p>
44       Proceed to
45       <a href="<% xml_encode("/full.html?id=" . uri_escape($id))
46         %>">the new record</a>.
47      </p>