<?php
require_once ('login/user.inc.php');
//$user->MembersOnly(); // this will check if user can access page, and bounce them if not
include ('phpbib/phpbib.inc.php');
?><?php include ('header.inc.php'); ?>
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
</title>
</head>
-->
<body>
<?php $user->MembersOnly(); // Check if user can access this page, and bounce them if not ?>
<?php include ('top.inc.php'); ?>
<?php
if ( ereg ( "MSIE" , $_SERVER['HTTP_USER_AGENT'] ))
{
echo "<script language=\"JavaScript1.2\">\n";
}
else
{
echo "<script language=\"JavaScript1.2\" type=\"application/x-javascript\">\n";
}
?>
function isRefer (text)
{
var referPattern = /^%[A-Z0-9] /;
return referPattern.test(text);
}
function isRIS (text)
{
var risPattern = /^TY - /;
return risPattern.test(text);
}
function isXML (text)
{
var xmlPattern = /^<\?xml /;
return xmlPattern.test(text);
}
function validatePasteForm(form)
{
if (form.reference.value == "")
{
alert("Please paste a reference into the text box.");
form.reference.focus();
return false;
} else
{
var result = true;
// Check that format looks appropriate
switch (form.format.value)
{
case "refer":
if (!isRefer (form.reference.value))
{
alert("This does not look like an EndNote reference.\nThis format starts with \"%[A-z0-9] \".");
form.reference.focus();
return false;
}
break;
case "ris":
if (!isRIS (form.reference.value))
{
alert("This does not look like a ReferenceManager reference.\nThis format starts with \"TY - \".");
form.reference.focus();
return false;
}
break;
case "ISI":
break;
case "endnote_xml":
if (!isXML (form.reference.value))
{
alert("This does not look like an XML reference.\nThis format must start with an \"xml\" tag.");
form.reference.focus();
return false;
}
break;
}
return result;
}
}
</script>
<div id="content">
<p>Paste in a single reference from the Clipboard</p>
<form name="form1" method="get" action="bib_import_action.php"
onsubmit="return validatePasteForm(this)">
<table cellpadding="4" border="0" cellspacing="0" width="100%">
<tr>
<td>
<label>Format:</label>
<select name="format" id="format">
<option value="refer"
selected="selected">EndNote™ Export</option>
<option value="ris">RefMan (RIS) Export</option>
<option value="ISI">ISI Export (Web of Science)</option>
<option value="endnote_xml">EndNote™ 7 XML</option>
<option value="bibtex">BibTeX</option>
</select>
</td>
</tr>
<tr>
<td>
<textarea name="reference" cols="50" rows="10" wrap="OFF" id="reference"></textarea><br/>
<input type="reset" name="Submit2" value="Clear"/>
<input type="submit" name="Submit" value="Go"/>
</td>
</tr>
</table>
</form>
</div>
<?php include ('footer.inc.php'); ?>
</body>
</html>