forked from uws-eresearch/OR2014-chalege
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathname_fill_my_list
97 lines (46 loc) · 2.42 KB
/
name_fill_my_list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
use EPrints;
use strict;
my $session = EPrints::Session->new();
# security?
my $content = "text/xml";
$session->send_http_header( content_type=>$content );
my $family = $session->param( "_name_family" );
my $given = $session->param( "_name_given" );
my $id = $session->param( "_id" );
print STDERR "family:$family\n";
print STDERR "given:$given\n";
use LWP::Simple;
my $url = "http://www.fml.adamfield.net/fillmylist?entity_type=person&output=eprints&fname=$family&gname=$given&orcid=$id";
print STDERR "myurl : $url\n";
my $content = get $url;
die "Couldn't get $url" unless defined $content;
binmode(STDOUT,":utf8");
print $content;
exit();
print STDERR "HERE\n";
binmode(STDOUT,":utf8");
print <<END;
<?xml version="1.0"?>
<ul><li><span>Smith, Smith [;alkdfjglkjhdslfkj]</span><ul><li id="for:value:relative:_name_family">Smith</li></ul></li><li><span>Dave, Spalding [foosmithbar]</span><ul><li id="for:value:relative:_name_family">Spalding</li></ul></li><li><span>Laura, Jones [lskdjflskdjflskdjf]</span><ul><li id="for:value:relative:_name_family">Jones</li></ul></li></ul>
END
$session->terminate;
exit();
my $database = $session->get_database;
my $dataset = $session->dataset( "eprint" );
my $name_field = $dataset->get_field( "creators_name" );
my $id_field = $dataset->get_field( "creators_id" );
my @rows;
#$data = [
#]
use Data::Dumper;
my $ul = EPrints::Extras::render_lookup_list( $session, \@rows );
$session->send_http_header( content_type => "text/xml; charset=UTF-8" );
binmode(STDOUT,":utf8");
print <<END;
<?xml version="1.0" encoding="UTF-8" ?>
<ul><li class="ep_first"><span class="person_name">jiadi, yao</span> 030405<small> (author of 1 item(s) in this repository)</small><ul><li id="for:value:relative:_name_family">jiadi</li><li id="for:value:relative:_name_given">yao</li><li id="for:value:relative:_name_honourific"/><li id="for:value:relative:_name_lineage"/><li id="for:value:relative:_id">030405</li></ul></li><li><span class="person_name">john, smith</span> 398045<small> (author of 1 item(s) in this repository)</small><ul><li id="for:value:relative:_name_family">john</li><li id="for:value:relative:_name_given">smith</li><li id="for:value:relative:_name_honourific"/><li id="for:value:relative:_name_lineage"/><li id="for:value:relative:_id">398045</li></ul></li></ul>
END
#print EPrints::XML::to_string( $ul, "utf-8", 1 );
#print $output
EPrints::XML::dispose( $ul );
$session->terminate;