Skip to content

Instantly share code, notes, and snippets.

@cboulanger
Created April 28, 2016 21:01
Show Gist options
  • Save cboulanger/409d016baca72565d3b0c661e1fb672e to your computer and use it in GitHub Desktop.
Save cboulanger/409d016baca72565d3b0c661e1fb672e to your computer and use it in GitHub Desktop.
Bookends search page, using an iframe to load the results and some eye candy
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="Christian Boulanger" />
<title>Bookends Database Access with unAPI support</title>
<style type="text/css">
<!--
body { margin:2%; line-height:1.1em }
hr { margin:1em 0em }
ol { margin:1em 0em; padding:0em 0em 0em 2em }
li { margin:1em 0em; padding:0em }
fieldset { border:0px none; margin:1em 0em; padding:0em }
-->
</style>
<link rel="unapi-server" type="application/xml" title="unAPI" href="http://localhost/~cboulanger/unapi.php/unapi.php" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
// Waiting Popup
$(function(){
$( "#uploadDialog" ).dialog({ autoOpen: false, modal: true, closeOnEscape: false } );
});
function startSearch()
{
$("#uploadDialog").dialog("open");
$("#result").empty();
}
function searchCompleted()
{
$("#uploadDialog").dialog("close");
$("#result").append($(frames[0].document.body).html());
var ev = document.createEvent('HTMLEvents');
ev.initEvent('ZoteroItemUpdated', true, true);
document.dispatchEvent(ev);
}
</script>
</head>
<body>
<h2>Search Bookends</h2>
<form method="post" action="http://localhost:2001/BEPost" target="result_iframe" onsubmit="startSearch()">
<!-- static params sent to bookends server -->
<input type="hidden" name="DB" value="cboulanger.bdb" />
<input type="hidden" name="ShowHitNum" value="false" />
<input type="hidden" name="HTMLOutput" value="0" />
<!-- search query params -->
<fieldset>
<p>
<label for="Query">Search in all fields:</label>
<input name="Query" style="width:500px">
<input hidden name="Field" value="allFields">
</p>
<p> OR </p>
<p>
<label for="Field">Provide SQL query:</label>
<input name="SQLQuery" style="width:500px">
</p>
<hr/>
<p>
<label for="Format">Return in format of:</label>
<select id="Format" name="Format" />
<option value="MLA-unAPI" selected="selected">MLA (with unAPI support)</option>
<option value="BibTeX">BibTeX</option>
<option value="RIS">RIS</option>
</select>
</p>
<p><label for="HitLimit">Maximum number of hits to return:</label>
<select id="HitLimit" name="HitLimit">
<option>1</option>
<option>5</option>
<option>10</option>
<option selected="selected">20</option>
<option>Unlimited</option>
</select>
</p>
<p><input type="submit" value="Search..." /></p>
</fieldset>
</form>
<!-- result will go here -->
<div id="result" width="100%">...</div>
<!-- this is the iframe container for the result returned from bookends -->
<iframe name="result_iframe" style="display:none" onload="searchCompleted()"></iframe>
<!-- the popup telling the user to wait for the result -->
<div id="uploadDialog" title="Please Wait"><center>Retrieving Data from Bookends...</center></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment