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