From e173b36fff57c27628c1b1003777a79e5a3ed5ae Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 20 Oct 2008 10:16:33 +0000 Subject: [PATCH] Closes #1181, Patch for File Download for MODS XML Import Won't be pushed to existing clients until 1.0.8 --- translators/MODS.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/translators/MODS.js b/translators/MODS.js index 0d01ada3f..c3a16ab4c 100644 --- a/translators/MODS.js +++ b/translators/MODS.js @@ -8,7 +8,7 @@ "maxVersion":"", "priority":50, "inRepository":true, - "lastUpdated":"2008-08-20 01:05:28" + "lastUpdated":"2008-10-20 10:10:37" } Zotero.addOption("exportNotes", true); @@ -593,8 +593,25 @@ function doImport() { newItem.callNumber = mods.m::classification.text().toString(); // archiveLocation newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString(); - // url - newItem.url = mods.m::location.m::url.text().toString(); + // attachments and url + for each(var url in mods.m::location.m::url) { + var value = url.text().toString(); + if (url.@access == "raw object") { + var filetitle; + if (url.@displayLabel){ + filetitle = url.@displayLabel; + } else { + filetitle = "Attachment"; + } + if (value.substr(-4,4)==".pdf") { + newItem.attachments.push({url:value, mimeType:"application/pdf", title:filetitle, downloadable:true}); + } else { + newItem.attachments.push({url:value, title:filetitle, downloadable:true}); + } + } else { + newItem.url = value; + } + } // abstract newItem.abstractNote = mods.m::abstract.text().toString();