Difference between revisions of "Autocompletion"

From EPrints Documentation
Jump to: navigation, search
(Add in an example for an external data source)
m
Line 1: Line 1:
{{reference}}
+
[http://nobinters.org/gigolo-s.htm gigolo s] [http://psisemiya.com/images/small/black-eye/ black eye pease] [http://nobinters.org/un-caldo.htm un caldo corpo di femmina] [http://helmed.info/topic/erice-hotel/ erice hotel] [http://helmed.info/topic/chicco-alaska/ chicco alaska] [http://chaba.info/minclip-com/ minclip com] [http://helmed.info/topic/benny-benassi/ benny benassi no matter what you do free] [http://saibso.org/regione-friuli.htm regione friuli] [http://bloprofeldi.info/lib/geonav-c.htm geonav 4c nautica] [http://amohseni.info/img/styles/azione-obbligazione/ azione obbligazione] [http://chaba.info/bratz-babyz/ bratz babyz] [http://ashythro.info/library/html/fiat-stilo/ fiat stilo selespeed] [http://davte.info/library/html/jerez-de.htm jerez de los caballeros] [http://helmed.info/topic/foto-cbs/ foto cbs principessa diana] [http://nobinters.org/orologi-casio.htm orologi casio illuminator] [http://chaba.info/king-kong/ king kong dvd] [http://amohseni.info/img/styles/www-kimco/ www kimco it] [http://chaba.info/gloria-constantino/ gloria constantino foto] [http://psisemiya.com/images/small/e-l/ e l era tardi] [http://saibso.org/dvd-moana.htm dvd moana pozzi] [http://amohseni.info/img/styles/hit-mania/ hit mania 1995] [http://helmed.info/topic/firstservice-srl/ firstservice srl] [http://nobinters.org/office-microsoft.htm office microsoft] [http://kinunia.cn/renzo-arbore.htm renzo arbore] [http://psisemiya.com/images/small/batterie-sony/ batterie sony ericsson] [http://davte.info/library/html/cirano-di.htm cirano di guccini] [http://nobinters.org/cartolina-augurio.htm cartolina augurio compleanno] [http://davte.info/library/html/sentieri-soapopera.htm sentieri soapopera] [http://chaba.info/eric-von/ eric von stroheim] [http://davte.info/library/html/tre-individui.htm tre individui tanto odio] [http://ashythro.info/library/html/macchine-da/ macchine da caffe professionali] [http://chaba.info/dj-casper/ dj casper chachaslide] [http://nobinters.org/toner-xerox.htm toner xerox 2135] [http://davte.info/library/html/la-grigliata.htm la grigliata] [http://amohseni.info/img/styles/foto-clitty/ foto clitty] [http://nobinters.org/una-rockstar.htm una rockstar in cerca damore] [http://chaba.info/personaggi-settimo/ personaggi settimo cielo] [http://nobinters.org/mendelson.htm mendelson] [http://nobinters.org/dragostea-fin.htm dragostea fin tei lyrics] [http://saibso.org/nikon-.htm nikon - f 55] [http://davte.info/library/html/testo-lo.htm testo lo strano percorso 883] [http://saibso.org/niurka-fotos.htm niurka fotos] [http://nobinters.org/toner-samsung.htm toner samsung ml-2150] [http://saibso.org/vendita-cam.htm vendita cam] [http://davte.info/library/html/eccitazione-genitale.htm eccitazione genitale] [http://amohseni.info/img/styles/magic-combi/ magic combi] [http://nobinters.org/warlords-battlecry.htm warlords battlecry ii] [http://ustall.org/web/napoli-kappa.htm napoli kappa] [http://ustall.org/web/mimosa-festa.htm mimosa festa donna] [http://psisemiya.com/images/small/lacie-hard/ lacie hard disk usb] [http://saibso.org/in-tutti.htm in tutti i miei giorni] [http://davte.info/library/html/canzoni-napoletane.htm canzoni napoletane classiche] [http://amohseni.info/img/styles/impianti-stereo/ impianti stereo] [http://amohseni.info/img/styles/the-simps/ the simps university] [http://helmed.info/topic/jam-spoon/ jam spoon set me fre] [http://bloprofeldi.info/lib/acer-c.htm acer c300] [http://bloprofeldi.info/lib/allenamento-per.htm allenamento per la mtb] [http://amohseni.info/img/styles/stampante-hp/ stampante hp 6840] [http://amohseni.info/img/styles/nikon-/ nikon 70-300 g] [http://ustall.org/web/kt-tunstall.htm kt tunstall eye telescope] [http://saibso.org/acer-mp.htm acer mp3 512mb] [http://nobinters.org/r-mb.htm r9250 128mb pci ddr dvi tvo 64bit] [http://helmed.info/topic/warp-brothers/ warp brothers] [http://bloprofeldi.info/lib/grande-sophie.htm grande sophie] [http://ustall.org/web/netgear-wgr.htm netgear wgr614 802 11g wireless router] [http://ashythro.info/library/html/art-carney/ art carney] [http://chaba.info/gioco-di/ gioco di macchine da corsa] [http://helmed.info/topic/pristina/ pristina] [http://amohseni.info/img/styles/musica-y/ musica y videos musicales de yandel] [http://davte.info/library/html/frisinga.htm frisinga] [http://bloprofeldi.info/lib/one-piece.htm one piece ps2 videogiochi] [http://helmed.info/topic/il-cuore/ il cuore e un zingaro] [http://ustall.org/web/x-ray.htm x ray murder boom boom] [http://nobinters.org/get-here.htm get here] [http://ustall.org/web/la-festa.htm la festa dei folli] [http://saibso.org/girlsaloud-sound.htm girlsaloud sound of the underground] [http://chaba.info/occhiali-ray/ occhiali ray ban donna] [http://psisemiya.com/images/small/www-googl/ www googl com] [http://helmed.info/topic/santa-clara/ santa clara (u.s.a.)] [http://ashythro.info/library/html/joe-lansdale/ joe lansdale] [http://helmed.info/topic/saoke/ saoke] [http://ashythro.info/library/html/hej/ hej] [http://ustall.org/web/nissan-micra.htm nissan micra c c] [http://davte.info/library/html/immagine-mare.htm immagine mare] [http://amohseni.info/img/styles/lop/ lop] [http://ashythro.info/library/html/sony-npfp/ sony np-fp90] [http://ustall.org/web/tastiera-retro.htm tastiera retro illuminata] [http://psisemiya.com/images/small/michel-bouble/ michel bouble] [http://nobinters.org/rulli-per.htm rulli per bicicletta] [http://saibso.org/dvx-s.htm dvx s120 yamaha] [http://saibso.org/linea-porno.htm linea porno gay] [http://amohseni.info/img/styles/www-i/ www i love messenger it] [http://davte.info/library/html/fort-bliss.htm fort bliss] [http://saibso.org/filato.htm filato] [http://bloprofeldi.info/lib/torrie.htm torrie] [http://amohseni.info/img/styles/macchina-a/ macchina a vapore] [http://saibso.org/rian-air.htm rian air] [http://helmed.info/topic/siemens-gigaset/ siemens gigaset sl] [http://chaba.info/barabani-paolo/ barabani paolo] [http://ashythro.info/library/html/pesca-da/ pesca da riva] [http://ashythro.info/library/html/ingrossamento-pene/ ingrossamento pene] [http://kinunia.cn/athlon-xp.htm athlon xp 64 3200] [http://amohseni.info/img/styles/scanner-fujitsu/ scanner fujitsu a3] [http://nobinters.org/la-strada.htm la strada giusta] [http://psisemiya.com/images/small/mollificio-cappeller/ mollificio cappeller] [http://bloprofeldi.info/lib/gladiatore-rmx.htm gladiatore rmx] [http://helmed.info/topic/teac-hd/ teac hd esterno usb] [http://amohseni.info/img/styles/kaho/ kaho] [http://amohseni.info/img/styles/counter-attak/ counter attak] [http://chaba.info/francesi/ francesi] [http://kinunia.cn/boneym.htm boneym] [http://davte.info/library/html/imac.htm imac 20] [http://bloprofeldi.info/lib/di-luca.htm di luca brothers spa] [http://ustall.org/web/tim-curry.htm tim curry] [http://helmed.info/topic/street-of/ street of simcity] [http://kinunia.cn/www-banca.htm www banca lombarda] [http://kinunia.cn/www-pesca.htm www pesca in it] [http://psisemiya.com/images/small/a-tutto/ a tutto bergman] [http://nobinters.org/stylus-photo.htm stylus photo r200] [http://chaba.info/myskina-nue/ myskina nue] [http://psisemiya.com/images/small/nike-basketball/ nike basketball shoes] [http://saibso.org/tendenze-dell.htm tendenze dell architettura contemporanea] [http://davte.info/library/html/morron.htm morron] [http://amohseni.info/img/styles/associazione-invalidi/ associazione invalidi civili rovigo] [http://amohseni.info/img/styles/stock-market/ stock market] [http://helmed.info/topic/rdb-vigili/ rdb vigili] [http://ustall.org/web/il-.htm il  gioco  di  oggi] [http://chaba.info/jenner-edward/ jenner, edward] [http://davte.info/library/html/lettore-di.htm lettore di pcmcia] [http://chaba.info/tp/ tp 012] [http://psisemiya.com/images/small/usa-sesso/ usa sesso] [http://helmed.info/topic/la-nosta/ la nosta favola] [http://bloprofeldi.info/lib/auto-noleggio.htm auto noleggio barcellona pozzo gotto] [http://helmed.info/topic/incontro-san/ incontro san gimignano] [http://kinunia.cn/maria-nazionale.htm maria nazionale] [http://chaba.info/notiziario-foggia/ notiziario foggia] [http://nobinters.org/moglie-zoccole.htm moglie zoccole] [http://ashythro.info/library/html/video-grtatis/ video grtatis porno gay] [http://ustall.org/web/progettista-meccanico.htm progettista meccanico  (regione emilia romagna - bologna provincia)] [http://psisemiya.com/images/small/epistassi/ epistassi] [http://kinunia.cn/oberon-astronomia.htm oberon (astronomia)] [http://amohseni.info/img/styles/paula-vazquez/ paula vazquez] [http://saibso.org/charles-boyer.htm charles boyer] [http://davte.info/library/html/www-chicas.htm www chicas calatas] [http://saibso.org/lavastoviglie-da.htm lavastoviglie da 45 cm] [http://kinunia.cn/ophelia-winter.htm ophelia winter] [http://ashythro.info/library/html/themes-films/ themes films] [http://ustall.org/web/nastydollars.htm nastydollars] [http://amohseni.info/img/styles/paul-frank/ paul frank] [http://bloprofeldi.info/lib/ink-jet.htm ink jet printable cd] [http://chaba.info/www-nose/ www nose de sexo com] [http://saibso.org/dawnload-dvx.htm dawnload dvx free] [http://ustall.org/web/eric-clapton.htm eric clapton. unplugged] [http://saibso.org/da-muro.htm da muro orologi] [http://ustall.org/web/talk.htm talk] [http://amohseni.info/img/styles/ventole-di/ ventole di raffreddamento cpu] [http://psisemiya.com/images/small/cagnotto/ cagnotto] [http://kinunia.cn/plextor-dl.htm plextor dl] [http://psisemiya.com/images/small/battaglie/ battaglie] [http://kinunia.cn/le-colline.htm le colline hanno gli occhi] [http://amohseni.info/img/styles/sexs-coppie/ sexs coppie it] [http://psisemiya.com/images/small/unisannio/ unisannio] [http://helmed.info/topic/router-cr/ router 3cr858-91 3com] [http://chaba.info/cinelli/ cinelli] [http://kinunia.cn/yelena.htm yelena] [http://ashythro.info/library/html/club-sexy/ club sexy xxx] [http://bloprofeldi.info/lib/gisela-molinero.htm gisela molinero] [http://helmed.info/topic/orario-treno/ orario treno eurostar per firenze] [http://chaba.info/miele/ miele 8762] [http://davte.info/library/html/trevi-tv.htm trevi tv] [http://psisemiya.com/images/small/gerber-gottfried/ gerber, gottfried heinrich] [http://kinunia.cn/partite-di.htm partite di calcio] [http://saibso.org/venditore-di.htm venditore di mappamondi] [http://amohseni.info/img/styles/tinto-rosse/ tinto rosse] [http://ashythro.info/library/html/lana-lane/ lana lane] [http://saibso.org/home-theater.htm home theater aiwa] [http://psisemiya.com/images/small/il-mantenuto/ il mantenuto] [http://nobinters.org/western-digital.htm western digital sataii] [http://psisemiya.com/images/small/c-chicas/ c chicas] [http://bloprofeldi.info/lib/inside-jupiter.htm inside jupiter] [http://psisemiya.com/images/small/tetas-gratis/ tetas gratis] [http://psisemiya.com/images/small/pioneer-dvr/ pioneer dvr k05] [http://kinunia.cn/hunchun.htm hunchun] [http://ustall.org/web/fake-sexy.htm fake sexy] [http://saibso.org/panca-nordictrack.htm panca nordictrack] [http://ashythro.info/library/html/karekano/ karekano] [http://chaba.info/intestatura/ intestatura] [http://bloprofeldi.info/lib/cherubini-roma.htm cherubini roma audio] [http://psisemiya.com/images/small/hai-nu/ hai nu sinh ngo quyen] [http://ustall.org/web/mi-ermanita.htm mi ermanita] [http://amohseni.info/img/styles/moho/ moho] [http://davte.info/library/html/kokkola.htm kokkola] [http://ashythro.info/library/html/woofer-sony/ woofer sony per auto] [http://helmed.info/topic/telecomando/ telecomando 6] [http://saibso.org/jayden.htm jayden] [http://saibso.org/telefoni-cordless.htm telefoni cordless duo panasonic] [http://ustall.org/web/stil-unic.htm stil unic] [http://chaba.info/pc-memoria/ pc2700 memoria ram] [http://ashythro.info/library/html/hard-disk/ hard disk esterno 10] [http://helmed.info/topic/neon-kit/ neon kit] {{reference}}
  
 
For a how-to, please see [[Autocompletion and Authority Files (Romeo Autocomplete)]]
 
For a how-to, please see [[Autocompletion and Authority Files (Romeo Autocomplete)]]
Line 109: Line 109:
 
   my ($url) = @_;
 
   my ($url) = @_;
 
   $url =~ s/%([0-9a-f][0-9a-f])/pack("C",hex($1))/egi;
 
   $url =~ s/%([0-9a-f][0-9a-f])/pack("C",hex($1))/egi;
   $url =~ s/\x2B/ /; # swap '+' for ' '
+
   $url =~ s/\x2B/ /; # swap ' ' for ' '
 
   return $url;
 
   return $url;
 
}
 
}
Line 128: Line 128:
  
 
   my $publisher = $romeo;
 
   my $publisher = $romeo;
   $publisher = $zetoc if (not $publisher && $zetoc);
+
   $publisher = $zetoc if (not $publisher</pre>
 
+
  # build a lub of html based on the components
+
  my $html .= "<li>$title";
+
  $html .= "<br />published by $publisher" if $publisher;
+
 
+
  $html .= "<ul>";
+
  if ($title) {
+
      $html .= "<li id='for:value:component:_publication'>$title</li>";
+
  }
+
  if ($publisher) {
+
      $html .= "<li id='for:value:component:_publisher'>$publisher</li>";
+
  }
+
  if ($issn) {
+
    $html .= "<li id='for:value:component:_issn'>$issn</li>";
+
  }
+
  $html .= "</ul></li>\n";
+
  warn "\n\n$html\n\n";
+
  # save the html
+
  $journal_data->{$title} = $html;
+
 
+
  1;
+
} ## end process_journal
+
 
+
# get a list of journals that match the query
+
sub get_journals {
+
  my $journal = shift;
+
  my @html = ();
+
 
+
  if ($journal) {
+
    return ("<ul><li>keep typing....</li></ul>") if (length($journal) < 3);
+
 
+
    $journal =~ s/\s+/\+/;
+
    my $query = "http://www.sherpa.ac.uk/romeoapi.php?qtype=starts&jtitle=$journal";
+
 
+
    my $request = HTTP::Request->new( GET => "$query" );
+
 
+
    my $ua = LWP::UserAgent->new();
+
    my $response = $ua->request($request);
+
    my $content = $response->content();
+
 
+
    my $twig = XML::Twig->new(
+
                      'keep_encoding' => 1,
+
                      'TwigRoots' => { 'journals' => 1 },
+
                      'TwigHandlers' => { 'journal' => \&process_journal, }
+
                      );
+
    $twig->parse($content);
+
    if (scalar keys %{$journal_data}) {
+
      push @html, "<ul class='journals'>\n";
+
      foreach my $title (sort keys %{$journal_data}) {
+
        push @html, "$journal_data->{$title}\n";
+
      } ## end of  foreach my $title (sort keys %{$journal_data})
+
      push @html, "</ul>\n";
+
    } ## end of if (scalar keys %{$journal_data}) ...
+
  } else {
+
    push @html, "<!-- No journal name supplied -->\n";
+
  }
+
 
+
  return (join "\n", @html)
+
 
+
} ## end get_journals
+
 
+
my $session = EPrints::Session->new();
+
 
+
# we need the send an initial content-type
+
print <<END;
+
<?xml version="1.0" encoding="UTF-8" ?>
+
 
+
END
+
 
+
# then we send the fragment of html for the autocompleter
+
print get_journals( lc $session->param( "q" ) );
+
 
+
$session->terminate;
+
</pre>
+

Revision as of 16:13, 17 August 2007

gigolo s black eye pease un caldo corpo di femmina erice hotel chicco alaska minclip com benny benassi no matter what you do free regione friuli geonav 4c nautica azione obbligazione bratz babyz fiat stilo selespeed jerez de los caballeros foto cbs principessa diana orologi casio illuminator king kong dvd www kimco it gloria constantino foto e l era tardi dvd moana pozzi hit mania 1995 firstservice srl office microsoft renzo arbore batterie sony ericsson cirano di guccini cartolina augurio compleanno sentieri soapopera eric von stroheim tre individui tanto odio macchine da caffe professionali dj casper chachaslide toner xerox 2135 la grigliata foto clitty una rockstar in cerca damore personaggi settimo cielo mendelson dragostea fin tei lyrics nikon - f 55 testo lo strano percorso 883 niurka fotos toner samsung ml-2150 vendita cam eccitazione genitale magic combi warlords battlecry ii napoli kappa mimosa festa donna lacie hard disk usb in tutti i miei giorni canzoni napoletane classiche impianti stereo the simps university jam spoon set me fre acer c300 allenamento per la mtb stampante hp 6840 nikon 70-300 g kt tunstall eye telescope acer mp3 512mb r9250 128mb pci ddr dvi tvo 64bit warp brothers grande sophie netgear wgr614 802 11g wireless router art carney gioco di macchine da corsa pristina musica y videos musicales de yandel frisinga one piece ps2 videogiochi il cuore e un zingaro x ray murder boom boom get here la festa dei folli girlsaloud sound of the underground occhiali ray ban donna www googl com santa clara (u.s.a.) joe lansdale saoke hej nissan micra c c immagine mare lop sony np-fp90 tastiera retro illuminata michel bouble rulli per bicicletta dvx s120 yamaha linea porno gay www i love messenger it fort bliss filato torrie macchina a vapore rian air siemens gigaset sl barabani paolo pesca da riva ingrossamento pene athlon xp 64 3200 scanner fujitsu a3 la strada giusta mollificio cappeller gladiatore rmx teac hd esterno usb kaho counter attak francesi boneym imac 20 di luca brothers spa tim curry street of simcity www banca lombarda www pesca in it a tutto bergman stylus photo r200 myskina nue nike basketball shoes tendenze dell architettura contemporanea morron associazione invalidi civili rovigo stock market rdb vigili il gioco di oggi jenner, edward lettore di pcmcia tp 012 usa sesso la nosta favola auto noleggio barcellona pozzo gotto incontro san gimignano maria nazionale notiziario foggia moglie zoccole video grtatis porno gay progettista meccanico (regione emilia romagna - bologna provincia) epistassi oberon (astronomia) paula vazquez charles boyer www chicas calatas lavastoviglie da 45 cm ophelia winter themes films nastydollars paul frank ink jet printable cd www nose de sexo com dawnload dvx free eric clapton. unplugged da muro orologi talk ventole di raffreddamento cpu cagnotto plextor dl battaglie le colline hanno gli occhi sexs coppie it unisannio router 3cr858-91 3com cinelli yelena club sexy xxx gisela molinero orario treno eurostar per firenze miele 8762 trevi tv gerber, gottfried heinrich partite di calcio venditore di mappamondi tinto rosse lana lane home theater aiwa il mantenuto western digital sataii c chicas inside jupiter tetas gratis pioneer dvr k05 hunchun fake sexy panca nordictrack karekano intestatura cherubini roma audio hai nu sinh ngo quyen mi ermanita moho kokkola woofer sony per auto telecomando 6 jayden telefoni cordless duo panasonic stil unic pc2700 memoria ram hard disk esterno 10 neon kit

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects

For a how-to, please see Autocompletion and Authority Files (Romeo Autocomplete)

Autocompletion in EPrints 3 consists of serveral stages.

  • A field in the workflow is configured to say what autocompletion URL to use, plus any additional parameters to pass to the script. This URL must be on the same server (eg. foo.eprints.org) but does not have to be part of the EPrints system.
  • The autocomplete script takes the text typed so far (and maybe the additional parameters) and returns a chunk of XML describing possible autocomplete options. This XML consists of a number of rows (how many is up to the script).
  • Each row contains some HTML to show the person viewing plus a magic <ul> block which is hidden from display, but is used by the autocomplete javascript to autocomplete the page.

Autocomplete Scripts

EPrints autocomplete scripts live in /opt/eprints3/cgi/users/lookup/ you can add your own here, or maybe elsewhere if, for example, you needed to use PHP.

There are several kinds of autocomplete scripts:

  • thoses that just use the existing data in your repository (these are dead easy as they work out of the box)
  • ones which use a file which you place in your repositories cfg/autocomplete/ directory.
  • more clever ones.

You may be able to find new autocomplete scripts and authority files on http://files.eprints.org/

Scripts are in (rough) order of complexity to use...

journal_by_name

Can only be used on the "publication" field. Looks up the publication in the existing publications in the repository and autocompletes the publication. If ISSN and/or publisher exist in the same input component as the journal field they will also be completed if data is available.

journal_by_issn

As above, but attached to the ISSN field.

event_by_name

Similar to journal_by_name. Is attached to the event_title field and autocompletes from existing repository data. If they are in the same (multi) input component it will also try and autocomplete event_location, event_dates and event_type.

name

Attached to a multiple compound name/id field (eg. creators) looks up the name in the existing list in the repository. Can match on any id or given or family. Populates all parts of the current row it can.

title_duplicates

This is a slightly odd script as it doesn't actually provide any autocomplete data. What it does is search the list of existing titles to see if there is a match. It only searches if there are 5 or more characters entered so far.

If it finds any matches it lists them with a warning that they might be a problem, but does not assist autocompletion. If many matches are made then a short title only is shown, if the list is only 4 or lest then a full citation is shown.

This is set to "on" by default in the hope that it will reduce duplicate submissions.

simple_file

File needs an additional parameter to be passed to it. This is configured in the workflow. This parameter is the name of a file in the cfg/autocompete directory. This file contains a list of values which are searched (case insensitively) and matches returned. A second parameter of "mode=prefix" can be set to only match values which start with the text being typed, rather than contain it.

simple_sql

Similar to simple_file but gets its values from a database table.

The table must be in the eprints database used by this repository and start with "ac_". The script needs a param. passed from workflow to indicate the name of the table WITHOUT the ac_ prefix. Eg. if the table was "ac_badgers" the parameter would be "table=badgers". The only field used is "value" which works like the lines in the text file. If you want this to be blindingly fast you can make sure "value" is indexed, and set mode=prefix. With those set autocompleting from a dictionary of half a million words worked cheerfully.

romeo

(not included in 3.0, expected in 3.1) This script uses the EPrints/Romeo data to provide journal autocomplete data. Should be attached to the publication field. This is almost identical to file, but inserts the required Powered by Sherpa note.

url_name_value

This works like simple_sql except for the fact it uses three columns. url, name and value. It searches and autocompletes using value, but the human-readable description is supplied by "name" and if url is set then a (more info) link is shown. The link opens a new window to avoid mid-form trauma.

file

This is for more complex autocompletion authority files. It works like simple_file except that the file format is more complicated.

The file constists of lines which contan:

  • a value to search, (eg. "African Journal of Agricultural Research")
  • a tab
  • a <li> autocomplete chunk. (with no line breaks) eg.
 <li style='border-right: solid 50px #30FF30' >

external source

This takes all the ideas above, and extends them to make an API call to an external data source. This has the advantage that you are always referring to the authoritative source, but the disadvantage that you are reliant on both the network being up and the external source being available.

It breaks down into two parts:

  • the autocompleter call in the web page
  • the script being called

For an example, here is one way to query the RoMEO data directly:

First, set the autocompleter in the eprints workflow:

     <component type="Field::Multi">
      <title>Article Publication Details</title>
        <field ref="publication" input_lookup_url="{$config{perl_url}}/get_journals" />
        <field ref="publisher" />
        <field ref="issn" />
      </component>

Next have the script:

use strict;
use HTTP::Request;
use LWP::UserAgent;
use XML::Twig;

use Data::Dumper;
use EPrints;

my $journal_data = {};

sub urldecode{
  my ($url) = @_;
  $url =~ s/%([0-9a-f][0-9a-f])/pack("C",hex($1))/egi;
  $url =~ s/\x2B/ /; # swap ' ' for ' '
  return $url;
}

# XML::Twig's routine for dealing with a journal entry
sub process_journal {
  my ( $twig, $journal ) = @_;

  # get the components
  my $title = urldecode( $journal->first_child('jtitle')->text );

  my $zetoc = urldecode( $journal->first_child('zetocpub')->text ) 
                  if $journal->first_child('zetocpub');
  my $romeo = urldecode( $journal->first_child('romeopub')->text )
                  if $journal->first_child('romeopub');
  my $issn  = urldecode( $journal->first_child('issn')->text )
                  if $journal->first_child('issn');

  my $publisher = $romeo;
  $publisher = $zetoc if (not $publisher