Using Perl modules to interact with the CONTENTdm

  • Slides: 42
Download presentation
Using Perl modules to interact with the CONTENTdm APIs CODE, EXAMPLES, & THE TINIEST

Using Perl modules to interact with the CONTENTdm APIs CODE, EXAMPLES, & THE TINIEST BIT OF MAGIC ANDREW BULLEN ILLINOIS STATE LIBRARY

Why Perl and not php? � Two very clean and mature tools, REST: :

Why Perl and not php? � Two very clean and mature tools, REST: : Client (http: //search. cpan. org/~mcrawfor/REST-Client 88/lib/REST/Client. pm) and XML: : Lib. XML (http: //search. cpan. org/dist/XML-Lib. XML/), which are easy to use and very flexible. � Large code base of previous Perl code at ISL (me). � PHP Lib. XML: http: //www. php. net/manual/en/book. libxml. php � PHP REST: https: //github. com/educoder/pest

CONTENTdm’s APIs http: //www. contentdm. org/help 6/customize 2 a. asp � Two types. Majority

CONTENTdm’s APIs http: //www. contentdm. org/help 6/customize 2 a. asp � Two types. Majority are dm. Web. Services, such as 1. 2. 3. 4. 5. dm. Get. Collection. List dm. Get. Collection. Parameters dm. Get. Collection. Field. Info dm. Get. Dublin. Core. Field. Info dm. Get. Item. Info, etc. dm. Web. Services is designed to be a simple wrapper around the native API functions, with a few exceptions to improve error handling. � Utils, which are handled by the utils controller on the CONTENTdm Website, consisting of 1. 2. 3. 4. Get. File (formerly Show. File in version 5) Get. Image Get. Thumbnail Get. Stream

Illinois Digital Archives (IDA)

Illinois Digital Archives (IDA)

A simple dm. Web. Services API query https: //server 16614. contentdm. oclc. org/dmwebservices/index. php?

A simple dm. Web. Services API query https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. List/xml <collections> <collection> <alias>/isl 6</alias> <name>Abraham Lincoln - Documents</name> <path>/cdm/sites/16614/data/isl 6</path> <secondary_alias>isl 6</secondary_alias> </collection> <alias>/algonqui 001</alias> <name>Algonquin and Lake in the Hills Local History</name> <path>/cdm/sites/16614/data/algonqui 001</path> <secondary_alias>algonqui 001</secondary_alias> </collection> <alias>/arlingto 001</alias> <name>Arlington Heights History</name> <path>/cdm/sites/16614/data/arlingto 001</path> <secondary_alias>arlingto 001</secondary_alias> </collection> ETC. </collections>

The same dm. Web. Services API query (JSON Format) https: //server 16614. contentdm. oclc.

The same dm. Web. Services API query (JSON Format) https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. List/json [ {"alias“: "/isl 6", “name": "Abraham Lincoln - Documents", "path": "/cdm/sites/16614/data/isl 6", "secondary_alias": "isl 6"}, {"alias": "/algonqui 001", "name": "Algonquin and Lake in the Hills Local History", "path": "/cdm/sites/16614/data/algonqui 001", "secondary_alias": "algonqui 001"}, {"alias": "/arlingto 001", "name": "Arlington Heights History", "path": "/cdm/sites/16614/data/arlingto 001", "secondary_alias": "arlingto 001“} ]

client. Test 2. pl #!/usr/bin/perl -w. T use CGI: : Carp qw(fatals. To. Browser);

client. Test 2. pl #!/usr/bin/perl -w. T use CGI: : Carp qw(fatals. To. Browser); use strict; use REST: : Client; use XML: : Lib. XML; my $client = REST: : Client->new(); $client->GET('https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. List/xml'); print "Content-type: text/htmlnn"; print <<EOF; <head> <title>Test for CDM</title> </head> <body bgcolor="#ffffff"> EOF my $parser = XML: : Lib. XML->new(); my $xmldoc = XML: : Lib. XML->load_xml( string => $client->response. Content() ); for my $sample ($xmldoc->findnodes('/collections/collection')) { for my $property ($sample->findnodes('. /*')) { my $label 1 = $property->node. Name(); print "<strong>", $property->node. Name(), ": </strong> ", $property->text. Content(), " n"; if ($property->node. Name() eq "remoteurl") { print "<p />n" } if ($label 1 eq "alias") { my $url. Str = "<a href="http: //www. idaillinois. org/cdm/landingpage/collection". $property->text. Content(). "">". $label 1. "</a>n"; print $url. Str, " n"; } } print "n"; } print "</body>n</html>n";

Perl Program at http: //www. finditillinois. org/cgi-bin/icftb/client. Test 2. pl alias: /isl 6 alias

Perl Program at http: //www. finditillinois. org/cgi-bin/icftb/client. Test 2. pl alias: /isl 6 alias name: Abraham Lincoln - Documents path: /cdm/sites/16614/data/isl 6 secondary_alias: isl 6 alias: /algonqui 001 alias name: Algonquin and Lake in the Hills Local History path: /cdm/sites/16614/data/algonqui 001 secondary_alias: algonqui 001 alias: /arlingto 001 alias name: Arlington Heights History path: /cdm/sites/16614/data/arlingto 001 secondary_alias: arlingto 001 alias: /arlingto 002 alias name: Arlington Heights Military History path: /cdm/sites/16614/data/arlingto 002 secondary_alias: arlingto 002 ETC.

The dmwebservices Call of dm. Query https: //server 16614. contentdm. oclc. org/ dmwebservices/index. php?

The dmwebservices Call of dm. Query https: //server 16614. contentdm. oclc. org/ dmwebservices/index. php? q=dm. Query/ edi/CISOSEARCHALL^woman^all^and/ title!subjec!descri/CISOSEARCHALL/ 50/0/1/0/0/0/xml

dm. Query http: //Cdm. Server. com: port/dmwebservices/index. php? q=dm. Query/alias/searchstrings/fields/sortby/maxrecs/start/suppress/docptr/suggest/facets/ showunpub/denormalize. Facets/format � alias

dm. Query http: //Cdm. Server. com: port/dmwebservices/index. php? q=dm. Query/alias/searchstrings/fields/sortby/maxrecs/start/suppress/docptr/suggest/facets/ showunpub/denormalize. Facets/format � alias is "all" (for all collections), a single collection alias with no lead-in /, or a !-delimited list of collection aliases with no / � searchstrings is a four-part, ^-delimited group in the order field^string^mode^operator (use "CISOSEARCHALL" for all fields; mode can be "all", "any", "exact", or "none"; operator can be "and", "or"). Multiple words in string need to be separated by "+". Up to six groups can be included, delimted by "!". To browse a collection, specify a single alias and "0" as a searchstrings value. The operator for the last searchstring will be ignored. � fields is a !-delimted list of field nicknames, listing the fields for which metadata should be returned. A maximum of five fields may be specified. A maximum of 100 bytes is returned for each field. � sortby is a !-delimited list of field nicknames, detailing how the result should be sorted, in field order. The field nicknames must appear in the field array. If the last element in the array is specified as "reverse", the sort will be in reverse (descending) order. Use "nosort" to sort the query by relevance. � maxrecs is the maximum number of records to return, from 1 to 1, 024. � start is the starting number of the first item returned in the result. � suppress specifies whether to suppress compound object pages from the search. Use "1" to suppress or "0" to not suppress (i. e. , include pages). � docptr specifies the pointer value of a compound object to restrict the query just to the pages in that compound object. This requires that a single alias be specified. Use “ 0" if not specified. � suggest specifies whether to return a spelling suggestion, if available for the searchstring's string. Use "1" to get suggestions or use "0" to not return a suggestion. � facets is an optional !-delimited list of field nicknames to return as facets. Use "0" if not requesting facets. � showunpub specifies whether to show or not show items from unpublished collections. Use "1" if requesting items from unpublished collections or "0" to hide items from unpublished collections. � denormalize. Facets specifies whether to show capitalization and diacritics in facet fields that have shared Controlled Vocabulary. Use "1" if requesting capitalization and diacritics or "0" to turn off capitalization and diacritics. � format is either "xml" or "json"

for my $sample ($xmldoc->findnodes('/results/record')) { for my $property ($sample->findnodes('. /*')) { my $label 1

for my $sample ($xmldoc->findnodes('/results/record')) { for my $property ($sample->findnodes('. /*')) { my $label 1 = $property->node. Name(); if ($label 1 eq "collection") { $collection = $property->text. Content(); $collection =~ tr////d; $proper. Name = translate. Address ($collection); } elsif ($label 1 eq "pointer") { $pointer = $property->text. Content() } elsif ($label 1 eq "title") { $title = $property->text. Content() } elsif ($label 1 eq "subjec") { $wombat = $property->text. Content(); $subject = &parse. Subject ($wombat); } elsif ($label 1 eq "descri") { $desc = $property->text. Content() } elsif ($label 1 eq "find") { my ($compound. YN, $item. URL); ($junk, $compound. YN) = split (/. /, $property->text. Content()); $item. URL = "http: //www. idaillinois. org/cdm/ref/collection/edi/id/". $pointer;

$count++; print <<EOF 1; <table width="100%" border="0"> <tr> <td width="20%" bgcolor="$current. Color"><center><a href="$item. URL">

$count++; print <<EOF 1; <table width="100%" border="0"> <tr> <td width="20%" bgcolor="$current. Color"><center><a href="$item. URL"> <img src="http: //www. idaillinois. org/utils/getthumbnail/collection/$collection/id/$pointer" /></a></center></td> <td width="80%" bgcolor="$current. Color"><strong>$count. $title</strong></td> </tr> <td width="20%"bgcolor="$current. Color"><strong>Description</subject></td> <td width="80%"bgcolor="$current. Color">$desc</td> </tr> <td width="20%"bgcolor="$current. Color"><strong>Subject(s)</subject></td> <td width="80%"bgcolor="$current. Color">$subject</td> </tr> <td width="20%"bgcolor="$current. Color"><strong>URL</subject></td> <td width="80%"bgcolor="$current. Color">Record no. <a href="$item. URL">$pointer</a> in $proper. Name</a> $parentobject </td> </tr> </table> <p /> EOF 1

j. Query kinda applications

j. Query kinda applications

http: //www. finditillinois. org/cgi-bin/icftb/arthur. pl The Javascript and Galleria libraries in the HTML: <script

http: //www. finditillinois. org/cgi-bin/icftb/arthur. pl The Javascript and Galleria libraries in the HTML: <script language="javascript"> function switch. Menu(obj) { var el = document. get. Element. By. Id(obj); if ( el. style. display != 'none' ) { el. style. display = 'none'; } else { el. style. display = ''; } } </script> <script src="http: //ajax. googleapis. com/ajax/libs/jquery/1/jquery. js"></script> <script src="http: //www. finditillinois. org/ida/includes/galleria-1. 2. 9. min. js"></script> <style> #galleria{ width: 1020 px; height: 500 px; } </style> Galleria is at http: //galleria. io/

Perl code, with supporting HTML and Javascript <div id="page-body" class="root. Box"> <center> <div id="galleria">

Perl code, with supporting HTML and Javascript <div id="page-body" class="root. Box"> <center> <div id="galleria"> EOF my ($collection, $old. Title, $proper. Name, $pointer, $parentobject, $title, $wombat, $subject, $desc); $collection = "apl"; $old. Title = ""; for my $sample ($xmldoc->findnodes('/results/record')) { for my $property ($sample->findnodes('. /*')) { my $label 1 = $property->node. Name(); if ($label 1 eq "pointer") { $pointer = $property->text. Content() } elsif ($label 1 eq "title") { $title = $property->text. Content() } if ($old. Title ne $title) { print <<ITEM; <img src="http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=$collection&CISOPTR=$pointer&action=2&DMSCALE=50&DMWIDTH=5 00&DMHEIGHT=300&DMX=0&DMY=0&DMROTATE=0" data-title="$title" data-link="http: //www. finditillinois. org/cgibin/icftb/individual. Item. pl? collection=$collection&recordno=$pointer"> ITEM $old. Title = $title; } } } print <<EOF 1; </div> </center> <script> Galleria. load. Theme('http: //www. finditillinois. org/ida/includes/themes/classic/galleria. classic. min. js'); Galleria. run('#galleria'); </script> <p />

FULL RECORD http: //www. finditillinois. org/cgi-bin/icftb/individual. Item. pl? collection=apl&recordno=119

FULL RECORD http: //www. finditillinois. org/cgi-bin/icftb/individual. Item. pl? collection=apl&recordno=119

individual. Item. pl (making use of 3 API calls) my $query_string = $ENV{'QUERY_STRING'}; my

individual. Item. pl (making use of 3 API calls) my $query_string = $ENV{'QUERY_STRING'}; my ($collection, $record. No) = split (/&/, $query_string); ($junk, $collection) = split (/=/, $collection); ($junk, $record. No) = split (/=/, $record. No); my $field. Str = "https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. Field. Info/". $collection. "/xml"; my $record. Str = "https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Item. Info/". $collection. "/". $record. No. "/xml"; my $field. List = REST: : Client->new(); my $actual. Record = REST: : Client->new(); $field. List->GET("$field. Str"); $actual. Record->GET("$record. Str"); my $first. Color = "#d 3 d 7 cb"; my $second. Color = "#dcdcdc"; my $current. Color = $first. Color; my $parser = XML: : Lib. XML->new(); my $xmldoc = XML: : Lib. XML->load_xml( string => $field. List->response. Content() ); my ($name. Value, $field. Value); for my $field. Names ($xmldoc->findnodes('/fields/field')) { for my $property ($field. Names->findnodes('. /*')) { my $label 1 = $property->node. Name(); my $value = $property->text. Content(); if ($label 1 eq "name") { $name. Value = $value } if ($label 1 eq "nick") { $field. Value = $value; $FIELDS{$field. Value} = $name. Value; } } }

$actual. Record->GET("$record. Str"); my $xmldoc 1 = XML: : Lib. XML->load_xml( string => $actual.

$actual. Record->GET("$record. Str"); my $xmldoc 1 = XML: : Lib. XML->load_xml( string => $actual. Record->response. Content() ); for my $sample 1 ($xmldoc 1 ->findnodes('/xml')) { for my $record. Data ($sample 1 ->findnodes('. /*')) { my $record. Name = $record. Data->node. Name(); my $record. Content = $record. Data->text. Content(); my $label = $FIELDS{$record. Name}; my $dump. Str = $label. "*". $record. Content; push (@DUMPARRAY, $dump. Str); if ($record. Name eq "find") { $image. Field. Value = $record. Content } } } my $full. Name. Of. Collection = translate. Address ($collection); ################# sub translate. Address { my ($translate. Address) = @_; my ($return. Proper. Name); my $client = REST: : Client->new(); my $address. Str = "https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. Parameters/". $translate. Address. "/xml"; $client->GET("$address. Str"); my $address. XML = XML: : Lib. XML->load_xml( string => $client->response. Content() ); for my $sample ($address. XML->findnodes('/parameters')) { for my $property ($sample->findnodes('. /*')) { my $label 2 = $property->node. Name(); if ($label 2 eq "name") { $return. Proper. Name = $property->text. Content() } } } return ($return. Proper. Name); }

https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. Field. Info/apl/xml dm. Get.

https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. Field. Info/apl/xml dm. Get. Collection. Field. Info <fields> <field> <name><![CDATA[ Title ]]></name> <nick><![CDATA[ title ]]></nick> <type><![CDATA[ TEXT ]]></type> <size><![CDATA[ 0 ]]></size> <find><![CDATA[ a 0 ]]></find> <req><![CDATA[ 1 ]]></req> <search><![CDATA[ 1 ]]></search> <hide><![CDATA[ 0 ]]></hide> <vocdb><![CDATA[ ]]></vocdb> <vocab><![CDATA[ 0 ]]></vocab> <dc><![CDATA[ title ]]></dc> <admin><![CDATA[ 0 ]]></admin> <readonly><![CDATA[ 0 ]]></readonly> </field> <name><![CDATA[ Creator ]]></name> <nick><![CDATA[ creato ]]></nick> ETC.

https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Item. Info/apl/119/xml dm. Get. Intem.

https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Item. Info/apl/119/xml dm. Get. Intem. Info <xml> <title>Airplane in air</title> <creato/> <contri/> <subjec>Airplanes; Curtiss Aeroplane and Motor Corporation</subjec> <subjeb/> <subjea>Transportation & Communication</subjea> <descri> Curtis bi-wing pusher type airplane in flight around 1912. Probably giving rides. A view of the town in background leads us to believe that this photo was taken South of Arthur looking slightly Northeast. Water tower and elevators seem to be in proper location for Arthur. This was at first thought to be a Wright Brothers plane, due to a newpaper item that they were giving rides in Decatur, Illinois. Contact with the Wright Brothers Museum for verification lead to the identification of the plane as a Curtis aircraft. The planes were quite similar in appearance. </descri> <date>circa 1912</date> <date 1>1910; 1911; 1912; 1913; 1914; 1915</date 1> <coverb>1910 s (1910 -1919)</coverb> <formaa>Photograph</formaa> <source/> <relati/> <langua/> <covera>United States--Illinois--Moultrie County--Arthur</covera> <publis>Arthur Public Library</publis> <datedi>2004 -04 -28</datedi> <identi>Neg. No. 5049. 1 [local identifier]</identi> <type>Image</type> <digita>JPEG</digita> <format> 320 dpi, Grayscale, tif, Epson Expression 836 XL, Silverfast 4. 2. 1 </format> <rights> Materials in this collection are made available by the Arthur Public Library. To order reproductions, or inquire about permissions, contact: Arthur Public Library District, 225 South Walnut, Arthur, IL 61911, (217) 543 -2037. Please cite the item title and collection name. </rights> <fullrs/> <find>201. jpg</find> <dmaccess/> <dmimage/> <dmcreated>2006 -01 -24</dmcreated> <dmmodified>2010 -01 -12</dmmodified> <dmoclcno>821712881</dmoclcno> <dmrecord>119</dmrecord> <restriction. Code>1</restriction. Code> <cdmfilesize>316836</cdmfilesize> <cdmfilesizeformatted>0. 30 MB</cdmfilesizeformatted> <cdmprintpdf>0</cdmprintpdf> <cdmhasocr>0</cdmhasocr> <cdmisnewspaper>0</cdmisnewspaper> </xml>

https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. Parameters/apl/xml dm. Get. Collection.

https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Get. Collection. Parameters/apl/xml dm. Get. Collection. Parameters <parameters> <rc>0</rc> <name> Arthur, Once Upon a Time - Local History Images of Arthur </name> <path>/cdm/sites/16614/data/apl</path> </parameters>

Get. Image gets an image http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=apl& CISOPTR=119& action=2& DMSCALE=100& DMWIDTH=3000&

Get. Image gets an image http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=apl& CISOPTR=119& action=2& DMSCALE=100& DMWIDTH=3000& DMHEIGHT=3000& DMX=0& DMY=0

http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=apl&CISOPTR=119&action=2&DMSC ALE=100&DMWIDTH=3000&DMHEIGHT=3000&DMX=0&DMY=0

http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=apl&CISOPTR=119&action=2&DMSC ALE=100&DMWIDTH=3000&DMHEIGHT=3000&DMX=0&DMY=0

Masonry and “Pinterest”-esque Interfaces

Masonry and “Pinterest”-esque Interfaces

Masonry: http: //masonry. desandro. com/

Masonry: http: //masonry. desandro. com/

http: //tympanus. net/codrops/2013/07/02/loading-effects-for-grid-items-with-css-animations/

http: //tympanus. net/codrops/2013/07/02/loading-effects-for-grid-items-with-css-animations/

http: //www. finditillinois. org/cgi-bin/icftb/masonry. Test 2. pl

http: //www. finditillinois. org/cgi-bin/icftb/masonry. Test 2. pl

#!/usr/bin/perl -w. T use CGI: : Carp qw(fatals. To. Browser); use REST: : Client;

#!/usr/bin/perl -w. T use CGI: : Carp qw(fatals. To. Browser); use REST: : Client; use XML: : Lib. XML; $query_string = $ENV{'QUERY_STRING'}; ($junk, $subject. No. Spaces) = split (/=/, $query_string); $client. Str = "https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Query/apl/title^%20^all^and/title!subjec!descri/titl e/10000/1/0/0/xml"; $subject. No. Spaces =~ s/%20/ /g; $client = REST: : Client->new(); $client->GET("$client. Str"); my $parser = XML: : Lib. XML->new(); my $xmldoc = XML: : Lib. XML->load_xml( string => $client->response. Content() ); print "Content-type: text/htmlnn"; print <<EOF;

<!DOCTYPE html> <html lang="en" class="no-js"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> <meta

<!DOCTYPE html> <html lang="en" class="no-js"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1. 0"> <title>Demo for Arthur PL to Use Masonry</title> <link rel="stylesheet" type="text/css" href="http: //www. finditillinois. org/ida/includes/default. css" /> <link rel="stylesheet" type="text/css" href="http: //www. finditillinois. org/ida/includes/component. css" /> <script src="http: //www. finditillinois. org/ida/includes/modernizr. custom. js"></script> </head> <body> <div class="container"> <!-- Top Navigation --> <header> <h 1>Arthur, Once Upon a Time<span>from the collection of Noel C. Dicks</span></h 1> <nav class="codrops-demos"> <h 1>Masonry Demonstration</h 1> </nav> </header> <ul class="grid effect-1" id="grid"> EOF my ($collection, $old. Title, $proper. Name, $pointer, $parentobject, $title, $wombat, $subject, $desc); $collection = "apl"; $old. Title = ""; for my $sample ($xmldoc->findnodes('/results/record')) { for my $property ($sample->findnodes('. /*')) { my $label 1 = $property->node. Name(); if ($label 1 eq "pointer") { $pointer = $property->text. Content() } elsif ($label 1 eq "title") { $title = $property->text. Content() } if ($old. Title ne $title) { print "<li><a href="http: //www. finditillinois. org/cgi-bin/icftb/individual. Item. pl? collection=$collection&recordno=$pointer"><img src="http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=$collection&CISOPTR=$pointer&action=2&DMSCALE=25&DMWIDTH=300&DMHEI GHT=300&DMX=0&DMY=0&DMROTATE=0"></a> $title</li>n"; $old. Title = $title; } }

} } } print <<EOF 1; </ul> </div> <script src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="http: //www. finditillinois. org/ida/includes/masonry. pkgd.

} } } print <<EOF 1; </ul> </div> <script src="http: //www. finditillinois. org/ida/includes/masonry. pkgd. min. js"></script> <script src="http: //www. finditillinois. org/ida/includes/imagesloaded. js"></script> <script src="http: //www. finditillinois. org/ida/includes/classie. js"></script> <script src="http: //www. finditillinois. org/ida/includes/Anim. On. Scroll. js"></script> <script> new Anim. On. Scroll( document. get. Element. By. Id( 'grid' ), { min. Duration : 0. 4, max. Duration : 0. 7, viewport. Factor : 0. 2 } ); </script> </body> EOF 1 print "</html>n";

http: //www. finditillinois. org/cgi-bin/icftb/masonry. Test. pl

http: //www. finditillinois. org/cgi-bin/icftb/masonry. Test. pl

Or some more j. Query experiments…

Or some more j. Query experiments…

http: //www. finditillinois. org/cgi-bin/icftb/grid. Test. pl #!/usr/bin/perl -T use CGI: : Carp qw(fatals. To.

http: //www. finditillinois. org/cgi-bin/icftb/grid. Test. pl #!/usr/bin/perl -T use CGI: : Carp qw(fatals. To. Browser); use REST: : Client; use XML: : Lib. XML; $query_string = $ENV{'QUERY_STRING'}; ($junk, $subject. No. Spaces) = split (/=/, $query_string); $client. Str = "https: //server 16614. contentdm. oclc. org/dmwebservices/index. php? q=dm. Query/apl/title^%20^all^and/title!subjec!descri/title/100/1/0/ 0/0/0/xml"; $subject. No. Spaces =~ s/%20/ /g; $client = REST: : Client->new(); $client->GET("$client. Str"); my $parser = XML: : Lib. XML->new(); my $xmldoc = XML: : Lib. XML->load_xml( string => $client->response. Content() ); print "Content-type: text/htmlnn"; print <<EOF; <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1. 0"> <title>Thumbnail Grid with Expanding Preview</title> <meta name="description" content="Thumbnail Grid with Expanding Preview" /> <link rel="stylesheet" type="text/css" href="http: //www. finditillinois. org/ida/includes/default 2. css" /> <link rel="stylesheet" type="text/css" href="http: //www. finditillinois. org/ida/includes/component 2. css" /> <script src="http: //www. finditillinois. org/ida/includes/modernizr. custom 2. js"></script> </head>

<body> <div class="container"> <header class="clearfix"> <h 1>Arthur, Once Upon a Time<span>from the collection of

<body> <div class="container"> <header class="clearfix"> <h 1>Arthur, Once Upon a Time<span>from the collection of Noel C. Dicks</span></h 1> </header> <div class="main"> <ul id="og-grid" class="og-grid"> EOF my $collection = "apl"; my ($pointer, $title, $description, $old. Title); for my $sample ($xmldoc->findnodes('/results/record')) { for my $property ($sample->findnodes('. /*')) { my $label 1 = $property->node. Name(); if ($label 1 eq "pointer") { $pointer = $property->text. Content() } elsif ($label 1 eq "title") { $title = $property->text. Content() } elsif ($label 1 eq "descri") { $description = $property->text. Content() } if (length ($description) > 100) { $description = substr ($description, 0, 99); } if ($old. Title ne $title) { print "<li><a href="http: //www. finditillinois. org/cgibin/icftb/individual. Item. pl? collection=$collection&recordno=$pointer" datalargesrc="http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=$collection&CISOPTR=$pointer&action=2&DMSCALE=2 5&DMWIDTH=300&DMHEIGHT=300&DMX=0&DMY=0&DMROTATE=0" data-title="$title" datadescription="$description"><img src="http: //www. idaillinois. org/utils/ajaxhelper/? CISOROOT=$collection&CISOPTR=$pointer&action=2&DMSCALE=25&D MWIDTH=300&DMHEIGHT=300&DMX=0&DMY=0&DMROTATE=0" /></a></li>n"; } $old. Title = $title; } }

} } print <<EOF 1; </ul> </div><!-- /container --> <script src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="https: //ajax. googleapis. com/ajax/libs/jquery/1.

} } print <<EOF 1; </ul> </div><!-- /container --> <script src="https: //ajax. googleapis. com/ajax/libs/jquery/1. 9. 1/jquery. min. js"></script> <script src="http: //www. finditillinois. org/ida/includes/grid. js"></script> <script> $(function() { Grid. init(); }); </script> </body> EOF 1 print "</html>n"; 1;

http: //www. finditillinois. org/cgi-bin/icftb/samsung. Test. pl

http: //www. finditillinois. org/cgi-bin/icftb/samsung. Test. pl

http: //www. finditillinois. org/cgi-bin/icftb/polaroid. Test. pl

http: //www. finditillinois. org/cgi-bin/icftb/polaroid. Test. pl

Questions? Comments?

Questions? Comments?

I am: Andrew Bullen Illinois State Library abullen@ilsos. net 312 -814 -4386

I am: Andrew Bullen Illinois State Library abullen@ilsos. net 312 -814 -4386