Adds support for CABI database to ISI Web of Knowledge. Translator now uses retrieveDocument and retrieveSource functions.
This commit is contained in:
parent
bd7ff9c2c6
commit
9bd8c1b1f7
1 changed files with 66 additions and 66 deletions
|
@ -3,16 +3,16 @@
|
|||
"translatorType":4,
|
||||
"label":"ISI Web of Knowledge",
|
||||
"creator":"Michael Berkowitz",
|
||||
"target":"(WOS_GeneralSearch|product=WOS)",
|
||||
"target":"(WOS_GeneralSearch|product=WOS|product=CABI)",
|
||||
"minVersion":"1.0.0b4.r5",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2009-02-25 07:10:00"
|
||||
"lastUpdated":"2010-04-01 22:01:15"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
if (doc.title.indexOf("Web of Science Results") != -1) {
|
||||
if ((doc.title.indexOf("Web of Science Results") != -1) | (doc.title.indexOf("CABI Results") != -1)) {
|
||||
return "multiple";
|
||||
} else if (url.indexOf("full_record.do") != -1) {
|
||||
return "journalArticle";
|
||||
|
@ -42,73 +42,73 @@ function doWeb(doc, url) {
|
|||
for (var i in ids) {
|
||||
ids[i] = host+"/full_record.do?" + ids[i];
|
||||
}
|
||||
Zotero.Utilities.processDocuments(ids, function(newDoc) {
|
||||
var product = url.match("product=([^\&]+)\&")[1];
|
||||
for (var i=0 ; i<ids.length; i++) {
|
||||
newDoc = Zotero.Utilities.retrieveDocument(ids[i]);
|
||||
var url = newDoc.location.href;
|
||||
var sid = newDoc.evaluate('//input[@name="selectedIds"]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext().value;
|
||||
var nid = newDoc.evaluate('//input[@name="SID"]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext().value;
|
||||
var post2 = 'product=WOS&product_sid=' + nid + '&plugin=&product_st_thomas=http://esti.isiknowledge.com:8360/esti/xrpc&export_ref.x=0&export_ref.y=0';
|
||||
var post = 'action=go&mode=quickOutput&product=WOS&SID=' + nid + '&format=ref&fields=BibAbs&mark_id=WOS&count_new_items_marked=0&selectedIds=' + sid + '&qo_fields=bib&endnote.x=95&endnote.y=12&save_options=default';
|
||||
Zotero.Utilities.HTTP.doPost('http://apps.isiknowledge.com/OutboundService.do', post, function() {
|
||||
Zotero.Utilities.HTTP.doPost('http://pcs.isiknowledge.com/uml/uml_view.cgi', post2, function(text) {
|
||||
var lines = text.split("\n");
|
||||
var field = " ";
|
||||
var content = " ";
|
||||
var item = new Zotero.Item("journalArticle");
|
||||
item.url = url;
|
||||
var authors;
|
||||
var fieldRe = /^[A-Z0-9]{2}(?: |$)/;
|
||||
|
||||
for each(var line in lines) {
|
||||
if(line.match(fieldRe)) {
|
||||
field = line.match(fieldRe)[0].substr(0,2);
|
||||
content = line.substr(3);
|
||||
if ((field == "AF" || field == "AU")) {
|
||||
if (!item.creators[0]) {
|
||||
var author = content.split(",");
|
||||
item.creators.push({firstName:author[1], lastName:author[0], creatorType:"author"});
|
||||
} else {
|
||||
field = "";
|
||||
}
|
||||
} else if (field == "TI") {
|
||||
item.title = content;
|
||||
} else if (field == "SO") {
|
||||
item.publicationTitle = content;
|
||||
} else if (field == "SN") {
|
||||
item.ISSN = content;
|
||||
} else if (field == "PD" || field == "PY") {
|
||||
if (item.date) {
|
||||
item.date += " " + content;
|
||||
} else {
|
||||
item.date = content;
|
||||
}
|
||||
} else if (field == "VL") {
|
||||
item.volume = content;
|
||||
} else if (field == "IS") {
|
||||
item.issue = content;
|
||||
} else if (field == "BP") {
|
||||
item.pages = content;
|
||||
} else if (field == "EP") {
|
||||
item.pages += "-" + content;
|
||||
} else if (field == "AB") {
|
||||
item.abstractNote = content;
|
||||
} else if (field == "DI") {
|
||||
item.DOI = content;
|
||||
}
|
||||
var post2 = 'product='+product+'&product_sid=' + nid + '&plugin=&product_st_thomas=http://esti.isiknowledge.com:8360/esti/xrpc&export_ref.x=0&export_ref.y=0';
|
||||
var post = 'action=go&mode=quickOutput&product='+product+'&SID=' + nid + '&format=ref&fields=BibAbs&mark_id='+product+'&count_new_items_marked=0&selectedIds=' + sid + '&qo_fields=bib&endnote.x=95&endnote.y=12&save_options=default';
|
||||
Zotero.Utilities.HTTP.retrieveSource('http://apps.isiknowledge.com/OutboundService.do', post);
|
||||
var text = Zotero.Utilities.HTTP.retrieveSource('http://pcs.isiknowledge.com/uml/uml_view.cgi', post2);
|
||||
var lines = text.split("\n");
|
||||
var field = " ";
|
||||
var content = " ";
|
||||
var item = new Zotero.Item("journalArticle");
|
||||
item.url = url;
|
||||
var authors;
|
||||
var fieldRe = /^[A-Z0-9]{2}(?: |$)/;
|
||||
for each(var line in lines) {
|
||||
if(line.match(fieldRe)) {
|
||||
field = line.match(fieldRe)[0].substr(0,2);
|
||||
content = line.substr(3);
|
||||
if ((field == "AF" || field == "AU")) {
|
||||
if (!item.creators[0]) {
|
||||
var author = content.split(",");
|
||||
item.creators.push({firstName:author[1], lastName:author[0], creatorType:"author"});
|
||||
} else {
|
||||
content = Zotero.Utilities.trimInternal(line);
|
||||
if (field == "AF" || field == "AU") {
|
||||
var author = content.split(",");
|
||||
item.creators.push({firstName:author[1], lastName:author[0], creatorType:"author"});
|
||||
} else if (field == "TI") {
|
||||
item.title += " " + content;
|
||||
} else if (field == "AB") {
|
||||
item.abstractNote += " " + content;
|
||||
}
|
||||
field = "";
|
||||
}
|
||||
} else if (field == "TI") {
|
||||
item.title = content;
|
||||
} else if (field == "SO") {
|
||||
item.publicationTitle = content;
|
||||
} else if (field == "SN") {
|
||||
item.ISSN = content;
|
||||
} else if (field == "PD" || field == "PY") {
|
||||
if (item.date) {
|
||||
item.date += " " + content;
|
||||
} else {
|
||||
item.date = content;
|
||||
}
|
||||
} else if (field == "VL") {
|
||||
item.volume = content;
|
||||
} else if (field == "IS") {
|
||||
item.issue = content;
|
||||
} else if (field == "BP") {
|
||||
item.pages = content;
|
||||
} else if (field == "EP") {
|
||||
item.pages += "-" + content;
|
||||
} else if (field == "AB") {
|
||||
item.abstractNote = content;
|
||||
} else if (field == "DI") {
|
||||
item.DOI = content;
|
||||
}
|
||||
item.attachments = [{url:item.url, title:"ISI Web of Knowledge Snapshot", mimeType:"text/html"}];
|
||||
item.complete();
|
||||
});
|
||||
});
|
||||
}, function() {Zotero.done();});
|
||||
} else {
|
||||
content = Zotero.Utilities.trimInternal(line);
|
||||
if (field == "AF" || field == "AU") {
|
||||
var author = content.split(",");
|
||||
item.creators.push({firstName:author[1], lastName:author[0], creatorType:"author"});
|
||||
} else if (field == "TI") {
|
||||
item.title += " " + content;
|
||||
} else if (field == "AB") {
|
||||
item.abstractNote += " " + content;
|
||||
}
|
||||
}
|
||||
}
|
||||
item.attachments = [{url:item.url, title:"ISI Web of Knowledge Snapshot", mimeType:"text/html"}];
|
||||
item.complete();
|
||||
}
|
||||
function() {Zotero.done();};
|
||||
}
|
Loading…
Reference in a new issue