www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 1cd51be49763099fb62b7dff8f53bca129e779e5
parent ace0d17ccb2f44c7244a9c39ec1e529437aad00c
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon,  2 Oct 2006 23:15:27 +0000

Sorry, it was now or never, and now is better:

Changed "Scholar" to "Zotero", everywhere

Apologies to anyone with working copy changes, but there are probably the fewer at this moment than there will be again.

Hopefully this won't break anything, though existing prefs will be lost. I avoided scholar.google.com--if you know any other legitimate "scholar"s in the code, be sure to fix them once I'm done here.

This is a multi-commit change--there's at least one more coming. *Do not update to this version! It won't work!*



Diffstat:
Mchrome.manifest | 16++++++++--------
Mchrome/chromeFiles/content/scholar/about.xul | 22+++++++++++-----------
Mchrome/chromeFiles/content/scholar/addCitationDialog.js | 10+++++-----
Mchrome/chromeFiles/content/scholar/addCitationDialog.xul | 24++++++++++++------------
Mchrome/chromeFiles/content/scholar/admin/itemTypeManager.js | 124++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/admin/itemTypeManager.xul | 40++++++++++++++++++++--------------------
Mchrome/chromeFiles/content/scholar/bibliography.js | 8++++----
Mchrome/chromeFiles/content/scholar/bibliography.xul | 8++++----
Mchrome/chromeFiles/content/scholar/bindings/noteeditor.xml | 8++++----
Mchrome/chromeFiles/content/scholar/bindings/relatedbox.xml | 16++++++++--------
Mchrome/chromeFiles/content/scholar/bindings/scholarsearch.xml | 14+++++++-------
Mchrome/chromeFiles/content/scholar/bindings/searchtextbox.xml | 10+++++-----
Mchrome/chromeFiles/content/scholar/bindings/tagsbox.xml | 12++++++------
Mchrome/chromeFiles/content/scholar/exportOptions.js | 6+++---
Mchrome/chromeFiles/content/scholar/exportOptions.xul | 12++++++------
Mchrome/chromeFiles/content/scholar/fileInterface.js | 102++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/fileProgress.xul | 4++--
Mchrome/chromeFiles/content/scholar/include.js | 2+-
Mchrome/chromeFiles/content/scholar/ingester/browser.js | 212++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/ingester/browser.xul | 8++++----
Mchrome/chromeFiles/content/scholar/ingester/progress.xul | 12++++++------
Mchrome/chromeFiles/content/scholar/ingester/selectitems.js | 16++++++++--------
Mchrome/chromeFiles/content/scholar/ingester/selectitems.xul | 12++++++------
Mchrome/chromeFiles/content/scholar/integrationDocPrefs.xul | 8++++----
Mchrome/chromeFiles/content/scholar/itemPane.js | 140++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/itemPane.xul | 28++++++++++++++--------------
Mchrome/chromeFiles/content/scholar/note.js | 8++++----
Mchrome/chromeFiles/content/scholar/note.xul | 4++--
Mchrome/chromeFiles/content/scholar/overlay.js | 186++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/overlay.xul | 166++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/preferences.js | 38+++++++++++++++++++-------------------
Mchrome/chromeFiles/content/scholar/preferences.xul | 24++++++++++++------------
Mchrome/chromeFiles/content/scholar/progressWindow.xul | 2+-
Mchrome/chromeFiles/content/scholar/searchDialog.xul | 10+++++-----
Mchrome/chromeFiles/content/scholar/selectItemsDialog.js | 4++--
Mchrome/chromeFiles/content/scholar/selectItemsDialog.xul | 10+++++-----
Mchrome/chromeFiles/content/scholar/test/test.xul | 6+++---
Mchrome/chromeFiles/content/scholar/xpcom/attachments.js | 116++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/cite.js | 202++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/collectionTreeView.js | 180++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/data_access.js | 856++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/db.js | 86++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/file.js | 18+++++++++---------
Mchrome/chromeFiles/content/scholar/xpcom/fulltext.js | 80++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/history.js | 106++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/ingester.js | 76++++++++++++++++++++++++++++++++++++++--------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/integration.js | 104++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/itemTreeView.js | 182++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/mime.js | 22+++++++++++-----------
Mchrome/chromeFiles/content/scholar/xpcom/notifier.js | 20++++++++++----------
Mchrome/chromeFiles/content/scholar/xpcom/progressWindow.js | 4++--
Mchrome/chromeFiles/content/scholar/xpcom/schema.js | 140++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/scholar.js | 110++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/search.js | 102++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/translate.js | 418++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mchrome/chromeFiles/content/scholar/xpcom/utilities.js | 142+++++++++++++++++++++++++++++++++++++++---------------------------------------
Mchrome/chromeFiles/locale/en-US/scholar/about.dtd | 14+++++++-------
Mchrome/chromeFiles/locale/en-US/scholar/preferences.dtd | 24++++++++++++------------
Mchrome/chromeFiles/locale/en-US/scholar/scholar.dtd | 2+-
Mchrome/chromeFiles/locale/en-US/scholar/scholar.properties | 2+-
Mchrome/chromeFiles/locale/en-US/scholar/searchbox.dtd | 8++++----
Mchrome/chromeFiles/skin/default/scholar/addCitationDialog.css | 8++++----
Mchrome/chromeFiles/skin/default/scholar/overlay.css | 64++++++++++++++++++++++++++++++++--------------------------------
Dchrome/chromeFiles/skin/default/scholar/scholar.css | 182-------------------------------------------------------------------------------
Achrome/chromeFiles/skin/default/scholar/zotero.css | 182+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcomponents/chnmIZoteroService.js | 44++++++++++++++++++++++----------------------
Ddefaults/preferences/scholar.js | 12------------
Adefaults/preferences/zotero.js | 12++++++++++++
Minstall.rdf | 6+++---
Mscrapers.sql | 1214++++++++++++++++++++++++++++++++++++++++----------------------------------------
70 files changed, 3035 insertions(+), 3035 deletions(-)

diff --git a/chrome.manifest b/chrome.manifest @@ -1,8 +1,8 @@ -content scholar chrome/chromeFiles/content/scholar/ -locale scholar en-US chrome/chromeFiles/locale/en-US/scholar/ -skin scholar default chrome/chromeFiles/skin/default/scholar/ +content zotero chrome/chromeFiles/content/zotero/ +locale zotero en-US chrome/chromeFiles/locale/en-US/zotero/ +skin zotero default chrome/chromeFiles/skin/default/zotero/ -overlay chrome://browser/content/browser.xul chrome://scholar/content/overlay.xul -overlay chrome://browser/content/browser.xul chrome://scholar/content/ingester/browser.xul -style chrome://browser/content/browser.xul chrome://scholar/skin/scholar.css -style chrome://global/content/customizeToolbar.xul chrome://scholar/skin/scholar.css -\ No newline at end of file +overlay chrome://browser/content/browser.xul chrome://zotero/content/overlay.xul +overlay chrome://browser/content/browser.xul chrome://zotero/content/ingester/browser.xul +style chrome://browser/content/browser.xul chrome://zotero/skin/zotero.css +style chrome://global/content/customizeToolbar.xul chrome://zotero/skin/zotero.css +\ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/about.xul b/chrome/chromeFiles/content/scholar/about.xul @@ -5,12 +5,12 @@ http://chnm.gmu.edu/ --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/about.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/about.dtd"> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/about.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/about.dtd"> <dialog - id="scholar-about" + id="zotero-about" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" orient="vertical" buttons="accept" @@ -32,29 +32,29 @@ <script src="include.js"/> <vbox id="aboutcontent"> - <label id="name" value="&scholar.name;"/> - <label id="version" value="&scholar.version; "/> + <label id="name" value="&zotero.name;"/> + <label id="version" value="&zotero.version; "/> <script> - document.getElementById('version').value += Scholar.version; + document.getElementById('version').value += Zotero.version; </script> - <label class="subhead" value="&scholar.createdby;"/> + <label class="subhead" value="&zotero.createdby;"/> <vbox class="subcontent"> <label class="text-link" href="http://chnm.gmu.edu" value="Center for History and New Media"/> <label value="George Mason University"/> <label value="Fairfax, VA"/> </vbox> - <label class="subhead" value="&scholar.directors;"/> + <label class="subhead" value="&zotero.directors;"/> <vbox class="subcontent"> <label value="Dan Cohen"/> <label value="Josh Greenberg"/> </vbox> - <label class="subhead" value="&scholar.developers;"/> + <label class="subhead" value="&zotero.developers;"/> <vbox class="subcontent"> <label value="Dan Stillman"/> <label value="David Norton"/> <label value="Simon Kornblith"/> </vbox> - <label class="subhead" value="&scholar.thanks;"/> + <label class="subhead" value="&zotero.thanks;"/> <vbox class="subcontent"> <label class="text-link" href="http://www.imls.gov/" value="Institute of Museum and Library Services"/> <label class="text-link" href="http://www.mozilla.org/" value="Mozilla Foundation"/> diff --git a/chrome/chromeFiles/content/scholar/addCitationDialog.js b/chrome/chromeFiles/content/scholar/addCitationDialog.js @@ -4,7 +4,7 @@ http://chnm.gmu.edu/ */ -var Scholar_Citation_Dialog = new function () { +var Zotero_Citation_Dialog = new function () { var _itemLocators = new Object(); var _itemLocatorTypes = new Object(); var _multipleSourcesOn = false; @@ -19,7 +19,7 @@ var Scholar_Citation_Dialog = new function () { this.accept = accept; function load() { - document.getElementById("multiple-sources-button").label = Scholar.getString("citation.multipleSources"); + document.getElementById("multiple-sources-button").label = Zotero.getString("citation.multipleSources"); // load (from selectItemsDialog.js) doLoad(); @@ -29,13 +29,13 @@ var Scholar_Citation_Dialog = new function () { if(_multipleSourcesOn) { document.getElementById("multiple-sources").hidden = true; document.getElementById("add-citation-dialog").width = "600"; - document.getElementById("multiple-sources-button").label = Scholar.getString("citation.multipleSources"); + document.getElementById("multiple-sources-button").label = Zotero.getString("citation.multipleSources"); window.sizeToContent(); window.moveTo((window.screenX+75), window.screenY); } else { document.getElementById("multiple-sources").hidden = undefined; document.getElementById("add-citation-dialog").width = "750"; - document.getElementById("multiple-sources-button").label = Scholar.getString("citation.singleSource"); + document.getElementById("multiple-sources-button").label = Zotero.getString("citation.singleSource"); window.sizeToContent(); window.moveTo((window.screenX-75), window.screenY); } @@ -87,7 +87,7 @@ var Scholar_Citation_Dialog = new function () { itemNode.setAttribute("value", itemID); itemNode.setAttribute("label", item.getField("title")); itemNode.setAttribute("class", "listitem-iconic"); - itemNode.setAttribute("image", "chrome://scholar/skin/treeitem-"+Scholar.ItemTypes.getName(item.getType())+".png"); + itemNode.setAttribute("image", "chrome://zotero/skin/treeitem-"+Zotero.ItemTypes.getName(item.getType())+".png"); document.getElementById("citation-list").appendChild(itemNode); // don't let someone select it again diff --git a/chrome/chromeFiles/content/scholar/addCitationDialog.xul b/chrome/chromeFiles/content/scholar/addCitationDialog.xul @@ -5,19 +5,19 @@ http://chnm.gmu.edu/ --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/overlay.css" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/addCitationDialog.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/addCitationDialog.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <dialog id="add-citation-dialog" orient="vertical" title="Add Citation" width="600" height="450" - onload="Scholar_Citation_Dialog.load();" + onload="Zotero_Citation_Dialog.load();" onunload="doUnload();" - ondialogaccept="Scholar_Citation_Dialog.accept();" + ondialogaccept="Zotero_Citation_Dialog.accept();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" style="padding:2em"> @@ -29,7 +29,7 @@ <vbox flex="1"> <hbox align="center" pack="end"> <label value="&toolbar.search.label;" control="tb-search"/> - <textbox id="tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_scholar_search'); return false; }"> + <textbox id="tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_zotero_search'); return false; }"> <toolbarbutton id="tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> </textbox> </hbox> @@ -50,7 +50,7 @@ <tree id="items-tree" flex="1" hidecolumnpicker="true" seltype="single" - onselect="Scholar_Citation_Dialog.treeItemSelected();"> + onselect="Zotero_Citation_Dialog.treeItemSelected();"> <treecols> <treecol id="title" primary="true" @@ -90,12 +90,12 @@ <hbox hidden="true" id="multiple-sources"> <vbox pack="center"> - <toolbarbutton id="citation-add" oncommand="Scholar_Citation_Dialog.addCitation()" disabled="true"/> - <toolbarbutton id="citation-delete" oncommand="Scholar_Citation_Dialog.deleteCitation()" disabled="true"/> + <toolbarbutton id="citation-add" oncommand="Zotero_Citation_Dialog.addCitation()" disabled="true"/> + <toolbarbutton id="citation-delete" oncommand="Zotero_Citation_Dialog.deleteCitation()" disabled="true"/> </vbox> <vbox> <listbox id="citation-list" flex="1" seltype="single" - onselect="Scholar_Citation_Dialog.listItemSelected();"></listbox> + onselect="Zotero_Citation_Dialog.listItemSelected();"></listbox> <hbox> <menulist id="item-locator-type" disabled="true"> <menupopup id="item-locator-type-popup"> @@ -112,7 +112,7 @@ <hbox> <vbox> - <button id="multiple-sources-button" oncommand="Scholar_Citation_Dialog.toggleMultipleSources()"/> + <button id="multiple-sources-button" oncommand="Zotero_Citation_Dialog.toggleMultipleSources()"/> </vbox> <vbox flex="1" align="end"> <hbox> diff --git a/chrome/chromeFiles/content/scholar/admin/itemTypeManager.js b/chrome/chromeFiles/content/scholar/admin/itemTypeManager.js @@ -1,4 +1,4 @@ -var Scholar_ItemTypeManager = new function(){ +var Zotero_ItemTypeManager = new function(){ this.init = init; this.handleTypeSelect = handleTypeSelect; this.buildTypeContextMenu = buildTypeContextMenu; @@ -22,7 +22,7 @@ var Scholar_ItemTypeManager = new function(){ function init(){ // Populate the listbox with item types _typesList = document.getElementById('item-type-list'); - _typeTemplates = document.getElementById('scholar-type-template-menu'); + _typeTemplates = document.getElementById('zotero-type-template-menu'); _typeFieldsList = document.getElementById('item-type-fields-list'); _fieldsList = document.getElementById('fields-list'); @@ -35,7 +35,7 @@ var Scholar_ItemTypeManager = new function(){ _typesList.selectedIndex = -1; - var types = Scholar.ItemTypes.getTypes(); + var types = Zotero.ItemTypes.getTypes(); while (_typesList.getRowCount()){ _typesList.removeItemAt(0); @@ -57,7 +57,7 @@ var Scholar_ItemTypeManager = new function(){ item.setAttribute('label', types[i]['name']); item.setAttribute('value', types[i]['id']); item.setAttribute('type', 'checkbox'); - item.setAttribute('oncommand', "Scholar_ItemTypeManager.setTemplate(document.popupNode.value, this.value)"); + item.setAttribute('oncommand', "Zotero_ItemTypeManager.setTemplate(document.popupNode.value, this.value)"); _typeTemplates.appendChild(item); } @@ -125,7 +125,7 @@ var Scholar_ItemTypeManager = new function(){ // If currently from a template, clear the template fields if (currentTemplateItemTypeID){ var sql = "SELECT fieldID FROM itemTypeFields WHERE itemTypeID=?"; - var fields = Scholar.DB.columnQuery(sql, currentTemplateItemTypeID); + var fields = Zotero.DB.columnQuery(sql, currentTemplateItemTypeID); for (var i in fields){ _DBUnmapField(itemTypeID, fields[i]); @@ -136,10 +136,10 @@ var Scholar_ItemTypeManager = new function(){ // Add the new template fields var sql = "SELECT fieldID FROM itemTypeFields WHERE itemTypeID=? " + "ORDER BY orderIndex"; - var fields = Scholar.DB.columnQuery(sql, templateItemTypeID); - Scholar.debug('--------'); - Scholar.debug(fields); - Scholar.debug('--------'); + var fields = Zotero.DB.columnQuery(sql, templateItemTypeID); + Zotero.debug('--------'); + Zotero.debug(fields); + Zotero.debug('--------'); for (var i in fields){ _DBMapField(itemTypeID, fields[i]); } @@ -151,7 +151,7 @@ var Scholar_ItemTypeManager = new function(){ var sql = "UPDATE " + typesTable + " SET templateItemTypeID=? WHERE " + "itemTypeID=?"; - return Scholar.DB.query(sql, [templateItemTypeID, itemTypeID]); + return Zotero.DB.query(sql, [templateItemTypeID, itemTypeID]); } @@ -159,7 +159,7 @@ var Scholar_ItemTypeManager = new function(){ var table = itemTypeID>=1000 ? 'userItemTypes' : 'itemTypes'; var sql = "SELECT templateItemTypeID FROM " + table sql += " WHERE itemTypeID=?"; - return Scholar.DB.valueQuery(sql, itemTypeID); + return Zotero.DB.valueQuery(sql, itemTypeID); } @@ -169,7 +169,7 @@ var Scholar_ItemTypeManager = new function(){ * _item_ is a listitem in the _fieldsList listbox **/ function addFieldToType(item){ - Scholar.debug('Adding field ' + item.value + ' to item type ' + Zotero.debug('Adding field ' + item.value + ' to item type ' + _getCurrentTypeID()); _DBMapField(_getCurrentTypeID(), item.value); @@ -186,7 +186,7 @@ var Scholar_ItemTypeManager = new function(){ * _item_ is a listitem in the _typeFieldsList listbox **/ function removeFieldFromType(item){ - Scholar.debug('Removing field ' + item.value + ' from item type ' + Zotero.debug('Removing field ' + item.value + ' from item type ' + _getCurrentTypeID()); _DBUnmapField(_getCurrentTypeID(), item.value); @@ -204,20 +204,20 @@ var Scholar_ItemTypeManager = new function(){ var typeID = _getCurrentTypeID(); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "SELECT fieldID FROM fields WHERE fieldName=?"; - var fieldID = Scholar.DB.valueQuery(sql, [listbox.selectedItem.label]); + var fieldID = Zotero.DB.valueQuery(sql, [listbox.selectedItem.label]); var sql = "SELECT hide FROM itemTypeFields WHERE itemTypeID=? AND " + "fieldID=?"; - var hidden = Scholar.DB.valueQuery(sql, [typeID, fieldID]); + var hidden = Zotero.DB.valueQuery(sql, [typeID, fieldID]); var sql = "UPDATE itemTypeFields SET hide=? WHERE itemTypeID=? AND " + "fieldID=?"; - Scholar.DB.query(sql, [hidden ? null : 1, typeID, fieldID]); + Zotero.DB.query(sql, [hidden ? null : 1, typeID, fieldID]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); listbox.selectedItem.setAttribute('isHidden', !hidden); @@ -280,7 +280,7 @@ var Scholar_ItemTypeManager = new function(){ } var sql = "INSERT INTO " + table + " (" + nameCol + ") VALUES (?)"; - Scholar.DB.query(sql, name); + Zotero.DB.query(sql, name); init(); @@ -303,18 +303,18 @@ var Scholar_ItemTypeManager = new function(){ return true; } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "SELECT itemTypeID FROM itemTypes WHERE typeName=?"; - var id = Scholar.DB.valueQuery(sql, [type]); + var id = Zotero.DB.valueQuery(sql, [type]); var sql = "DELETE FROM itemTypeFields WHERE itemTypeID=?"; - Scholar.DB.query(sql, [id]); + Zotero.DB.query(sql, [id]); var sql = "DELETE FROM itemTypes WHERE itemTypeID=?"; - Scholar.DB.query(sql, [id]); + Zotero.DB.query(sql, [id]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); this.init(); @@ -332,26 +332,26 @@ var Scholar_ItemTypeManager = new function(){ var field = obj.label; if (!_fieldExists(field)){ - Scholar.debug("Field '" + field + "' does not exist", 1); + Zotero.debug("Field '" + field + "' does not exist", 1); return true; } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "SELECT fieldID FROM fields WHERE fieldName=?"; - var id = Scholar.DB.valueQuery(sql, [field]); + var id = Zotero.DB.valueQuery(sql, [field]); var sql = "SELECT itemTypeID FROM itemTypeFields WHERE fieldID=?"; - var types = Scholar.DB.columnQuery(sql, [id]); + var types = Zotero.DB.columnQuery(sql, [id]); for (var i in types){ _DBUnmapField(types[i], id); } var sql = "DELETE FROM fields WHERE fieldID=?"; - Scholar.DB.query(sql, [id]); + Zotero.DB.query(sql, [id]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); this.init(); @@ -361,9 +361,9 @@ var Scholar_ItemTypeManager = new function(){ function createSQLDump(){ - var types = Scholar.DB.query("SELECT * FROM itemTypes ORDER BY itemTypeID"); - var fields = Scholar.DB.query("SELECT * FROM fields ORDER BY fieldID"); - var itemTypeFields = Scholar.DB.query("SELECT * FROM itemTypeFields ORDER BY itemTypeID, orderIndex"); + var types = Zotero.DB.query("SELECT * FROM itemTypes ORDER BY itemTypeID"); + var fields = Zotero.DB.query("SELECT * FROM fields ORDER BY fieldID"); + var itemTypeFields = Zotero.DB.query("SELECT * FROM itemTypeFields ORDER BY itemTypeID, orderIndex"); var prefix = " "; var sql = ''; @@ -411,7 +411,7 @@ var Scholar_ItemTypeManager = new function(){ * Return the field name for a given fieldID **/ function _getFieldName(fieldID){ - return Scholar.DB.valueQuery("SELECT fieldName FROM fields " + return Zotero.DB.valueQuery("SELECT fieldName FROM fields " + "WHERE fieldID=" + fieldID); } @@ -427,7 +427,7 @@ var Scholar_ItemTypeManager = new function(){ + "(SELECT templateItemTypeID FROM itemTypes WHERE itemTypeID=?1))) " + "AS isTemplateField FROM itemTypeFields ITF WHERE itemTypeID=?1 " + "ORDER BY orderIndex"; - var fields = Scholar.DB.query(sql, itemTypeID); + var fields = Zotero.DB.query(sql, itemTypeID); // Clear fields box while (_typeFieldsList.getRowCount()){ @@ -448,7 +448,7 @@ var Scholar_ItemTypeManager = new function(){ else { item.addEventListener('dblclick', new function(){ return function(){ - Scholar_ItemTypeManager.removeFieldFromType(this); + Zotero_ItemTypeManager.removeFieldFromType(this); } }, true); } @@ -463,7 +463,7 @@ var Scholar_ItemTypeManager = new function(){ **/ function _populateFieldsList(itemTypeID){ var sql = "SELECT fieldID, fieldName FROM fields ORDER BY fieldName COLLATE NOCASE"; - var fields = Scholar.DB.query(sql); + var fields = Zotero.DB.query(sql); // Clear fields box while (_fieldsList.getRowCount()){ @@ -475,7 +475,7 @@ var Scholar_ItemTypeManager = new function(){ var item = _fieldsList.appendItem(fields[i]['fieldName'], fields[i]['fieldID']); item.addEventListener('dblclick', new function(){ return function(){ - Scholar_ItemTypeManager.addFieldToType(this); + Zotero_ItemTypeManager.addFieldToType(this); } }, true); } @@ -483,13 +483,13 @@ var Scholar_ItemTypeManager = new function(){ var sql = "SELECT fieldID FROM fields WHERE fieldID NOT IN " + "(SELECT fieldID FROM itemTypeFields WHERE itemTypeID=" + itemTypeID + ")"; - var unusedFields = Scholar.DB.columnQuery(sql); + var unusedFields = Zotero.DB.columnQuery(sql); // Remove fields that are already used for (var i=0; i<_fieldsList.getRowCount(); i++){ // N.B. Some values at the end of list can only be accessed via getAttribute() // in BonEcho, though .value works for all in Minefield - if (!Scholar.inArray(_fieldsList.getItemAtIndex(i).getAttribute('value'), unusedFields)){ + if (!Zotero.inArray(_fieldsList.getItemAtIndex(i).getAttribute('value'), unusedFields)){ _fieldsList.removeItemAt(i); i--; } @@ -501,17 +501,17 @@ var Scholar_ItemTypeManager = new function(){ * Map a field to an item type in the DB */ function _DBMapField(itemTypeID, fieldID){ - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); // Get the next available position var sql = "SELECT IFNULL(MAX(orderIndex)+1,1) FROM itemTypeFields " + "WHERE itemTypeID=?"; - var nextIndex = Scholar.DB.valueQuery(sql, itemTypeID); + var nextIndex = Zotero.DB.valueQuery(sql, itemTypeID); var sql = "INSERT INTO itemTypeFields VALUES (?,?,?,?)"; - Scholar.DB.query(sql, [itemTypeID, fieldID, null, nextIndex]); + Zotero.DB.query(sql, [itemTypeID, fieldID, null, nextIndex]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -519,22 +519,22 @@ var Scholar_ItemTypeManager = new function(){ * Unmap a field from an item type in the DB */ function _DBUnmapField(itemTypeID, fieldID){ - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); // Get the old position var sql = "SELECT orderIndex FROM itemTypeFields WHERE itemTypeID=? " + "AND fieldID=?"; - var orderIndex = Scholar.DB.valueQuery(sql, [itemTypeID, fieldID]); + var orderIndex = Zotero.DB.valueQuery(sql, [itemTypeID, fieldID]); var sql = "DELETE FROM itemTypeFields WHERE itemTypeID=? AND fieldID=?"; - Scholar.DB.query(sql, [itemTypeID, fieldID]); + Zotero.DB.query(sql, [itemTypeID, fieldID]); // Shift other fields down var sql = "UPDATE itemTypeFields SET orderIndex=orderIndex-1 WHERE " + "itemTypeID=? AND orderIndex>?"; - Scholar.DB.query(sql, [itemTypeID, orderIndex]); + Zotero.DB.query(sql, [itemTypeID, orderIndex]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -543,28 +543,28 @@ var Scholar_ItemTypeManager = new function(){ return false; } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "SELECT orderIndex FROM itemTypeFields WHERE itemTypeID=? " + "AND fieldID=?"; - var orderIndex = Scholar.DB.valueQuery(sql, [_getCurrentTypeID(), item.value]); + var orderIndex = Zotero.DB.valueQuery(sql, [_getCurrentTypeID(), item.value]); // Move down field above var sql = "UPDATE itemTypeFields SET orderIndex=orderIndex+1 WHERE " + "itemTypeID=? AND orderIndex=?"; - Scholar.DB.query(sql, [_getCurrentTypeID(), orderIndex-1]); + Zotero.DB.query(sql, [_getCurrentTypeID(), orderIndex-1]); // Move field up var sql = "UPDATE itemTypeFields SET orderIndex=orderIndex-1 WHERE " + "itemTypeID=? AND fieldID=?"; - Scholar.DB.query(sql, [_getCurrentTypeID(), item.value]); + Zotero.DB.query(sql, [_getCurrentTypeID(), item.value]); var index = _typeFieldsList.getIndexOfItem(item); _typeFieldsList.removeItemAt(index); var newItem = _typeFieldsList.insertItemAt(index-1, item.label, item.value); _typeFieldsList.selectItem(newItem); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -573,21 +573,21 @@ var Scholar_ItemTypeManager = new function(){ return false; } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "SELECT orderIndex FROM itemTypeFields WHERE itemTypeID=? " + "AND fieldID=?"; - var orderIndex = Scholar.DB.valueQuery(sql, [_getCurrentTypeID(), item.value]); + var orderIndex = Zotero.DB.valueQuery(sql, [_getCurrentTypeID(), item.value]); // Move up field below var sql = "UPDATE itemTypeFields SET orderIndex=orderIndex-1 WHERE " + "itemTypeID=? AND orderIndex=?"; - Scholar.DB.query(sql, [_getCurrentTypeID(), orderIndex+1]); + Zotero.DB.query(sql, [_getCurrentTypeID(), orderIndex+1]); // Move field down var sql = "UPDATE itemTypeFields SET orderIndex=orderIndex+1 WHERE " + "itemTypeID=? AND fieldID=?"; - Scholar.DB.query(sql, [_getCurrentTypeID(), item.value]); + Zotero.DB.query(sql, [_getCurrentTypeID(), item.value]); var index = _typeFieldsList.getIndexOfItem(item); @@ -600,18 +600,18 @@ var Scholar_ItemTypeManager = new function(){ } _typeFieldsList.selectItem(newItem); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } function _typeExists(type){ - return !!Scholar.DB.valueQuery("SELECT COUNT(*) FROM itemTypes WHERE " + return !!Zotero.DB.valueQuery("SELECT COUNT(*) FROM itemTypes WHERE " + "typeName=?", [type]) } function _fieldExists(field){ - return !!Scholar.DB.valueQuery("SELECT COUNT(*) FROM fields WHERE " + return !!Zotero.DB.valueQuery("SELECT COUNT(*) FROM fields WHERE " + "fieldName=?", [field]) } @@ -622,4 +622,4 @@ var Scholar_ItemTypeManager = new function(){ } } -window.addEventListener('load', Scholar_ItemTypeManager.init, true); +window.addEventListener('load', Zotero_ItemTypeManager.init, true); diff --git a/chrome/chromeFiles/content/scholar/admin/itemTypeManager.xul b/chrome/chromeFiles/content/scholar/admin/itemTypeManager.xul @@ -1,7 +1,7 @@ <?xml version="1.0"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/content/admin/itemTypeManager.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/content/admin/itemTypeManager.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <window id="item-type-manager" @@ -15,46 +15,46 @@ <popupset> - <popup id="scholar-type-menu" - onpopupshowing="Scholar_ItemTypeManager.buildTypeContextMenu()" - onpopuphidden="Scholar_ItemTypeManager.init()"> - <menuitem label="Remove item type" oncommand="Scholar_ItemTypeManager.removeType(document.popupNode)"/> + <popup id="zotero-type-menu" + onpopupshowing="Zotero_ItemTypeManager.buildTypeContextMenu()" + onpopuphidden="Zotero_ItemTypeManager.init()"> + <menuitem label="Remove item type" oncommand="Zotero_ItemTypeManager.removeType(document.popupNode)"/> <menuseparator/> <menu label="Template"> - <menupopup id="scholar-type-template-menu"> - <menuitem type="checkbox" label="None" oncommand="Scholar_ItemTypeManager.setTemplate(document.popupNode.value, this.value)"/> + <menupopup id="zotero-type-template-menu"> + <menuitem type="checkbox" label="None" oncommand="Zotero_ItemTypeManager.setTemplate(document.popupNode.value, this.value)"/> <menuseparator/> </menupopup> </menu> </popup> - <popup id="scholar-remove-field-menu"> - <menuitem label="Remove field" oncommand="Scholar_ItemTypeManager.removeField(document.popupNode)"/> + <popup id="zotero-remove-field-menu"> + <menuitem label="Remove field" oncommand="Zotero_ItemTypeManager.removeField(document.popupNode)"/> </popup> </popupset> <vbox> <hbox style="height:25em"> - <listbox id="item-type-list" seltype="single" context="scholar-type-menu" - onselect="Scholar_ItemTypeManager.handleTypeSelect()"> + <listbox id="item-type-list" seltype="single" context="zotero-type-menu" + onselect="Zotero_ItemTypeManager.handleTypeSelect()"> <listhead> <listheader label="Item Types"/> </listhead> </listbox> - <listbox id="item-type-fields-list" onkeypress="Scholar_ItemTypeManager.handleShowHide(this, event)"> + <listbox id="item-type-fields-list" onkeypress="Zotero_ItemTypeManager.handleShowHide(this, event)"> <listhead> <listheader label="Used Fields"/> </listhead> </listbox> <groupbox> - <button label="Move up" oncommand="Scholar_ItemTypeManager.moveSelectedFieldUp()" /> - <button label="Move down" oncommand="Scholar_ItemTypeManager.moveSelectedFieldDown()" /> + <button label="Move up" oncommand="Zotero_ItemTypeManager.moveSelectedFieldUp()" /> + <button label="Move down" oncommand="Zotero_ItemTypeManager.moveSelectedFieldDown()" /> </groupbox> - <listbox id="fields-list" context="scholar-remove-field-menu"> + <listbox id="fields-list" context="zotero-remove-field-menu"> <listhead> <listheader label="Unused Fields"/> </listhead> @@ -64,12 +64,12 @@ <hbox style="margin:1em 0 0 .2em"> <hbox style="-moz-box-align:baseline"> <label control="add-type" style="width:7em; text-align:right">Add item type:</label> - <textbox id="add-type" onkeypress="return Scholar_ItemTypeManager.handleAddType(this, event)"/> + <textbox id="add-type" onkeypress="return Zotero_ItemTypeManager.handleAddType(this, event)"/> </hbox> <hbox style="-moz-box-align:baseline"> <label control="add-field" style="width:7em; text-align:right">Add field:</label> - <textbox id="add-field" onkeypress="return Scholar_ItemTypeManager.handleAddField(this, event)"/> + <textbox id="add-field" onkeypress="return Zotero_ItemTypeManager.handleAddField(this, event)"/> </hbox> </hbox> @@ -82,7 +82,7 @@ Light blue fields are hidden. Brown fields are template fields and can only be removed by changing the template. </description> - <button label="Generate SQL" oncommand="document.getElementById('sql-dump').value=Scholar_ItemTypeManager.createSQLDump()"/> + <button label="Generate SQL" oncommand="document.getElementById('sql-dump').value=Zotero_ItemTypeManager.createSQLDump()"/> <textbox id="sql-dump" multiline="true" cols="100" rows="6"/> </vbox> </window> diff --git a/chrome/chromeFiles/content/scholar/bibliography.js b/chrome/chromeFiles/content/scholar/bibliography.js @@ -1,12 +1,12 @@ ////////////////////////////////////////////////////////////////////////////// // -// Scholar_File_Interface_Bibliography +// Zotero_File_Interface_Bibliography // ////////////////////////////////////////////////////////////////////////////// // Class to provide options for bibliography -var Scholar_File_Interface_Bibliography = new function() { +var Zotero_File_Interface_Bibliography = new function() { var _io; this.init = init; @@ -21,7 +21,7 @@ var Scholar_File_Interface_Bibliography = new function() { var listbox = document.getElementById("style-popup"); var styleMenu = document.getElementById("style-menu"); - var styles = Scholar.Cite.getStyles(); + var styles = Zotero.Cite.getStyles(); // add styles to list for(i in styles) { @@ -40,7 +40,7 @@ var Scholar_File_Interface_Bibliography = new function() { styleMenu.selectedIndex = 0; } - if(Scholar.isMac && document.getElementById("copy-to-clipboard")) { + if(Zotero.isMac && document.getElementById("copy-to-clipboard")) { document.getElementById("copy-to-clipboard").hidden = "true"; } diff --git a/chrome/chromeFiles/content/scholar/bibliography.xul b/chrome/chromeFiles/content/scholar/bibliography.xul @@ -1,11 +1,11 @@ <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="&bibliography.title;" buttons="cancel,accept" - ondialogaccept="Scholar_File_Interface_Bibliography.acceptSelection()" - id="scholar-bibliography" - onload="Scholar_File_Interface_Bibliography.init()"> + ondialogaccept="Zotero_File_Interface_Bibliography.acceptSelection()" + id="zotero-bibliography" + onload="Zotero_File_Interface_Bibliography.init()"> <script src="include.js"/> <script src="bibliography.js"/> diff --git a/chrome/chromeFiles/content/scholar/bindings/noteeditor.xml b/chrome/chromeFiles/content/scholar/bindings/noteeditor.xml @@ -35,7 +35,7 @@ this.noteRef = val; if(this.note.getSource()) - this.item = Scholar.Items.get(this.note.getSource()); + this.item = Zotero.Items.get(this.note.getSource()); this.id('noteField').value = this.note.getNote(); this.id('links').item = this.note; @@ -58,15 +58,15 @@ else //Create new note { if(this.item) - var noteID = Scholar.Notes.add(noteField.value,this.item.getID()); //attached to an item + var noteID = Zotero.Notes.add(noteField.value,this.item.getID()); //attached to an item else { //independent note - var noteID = Scholar.Notes.add(noteField.value); + var noteID = Zotero.Notes.add(noteField.value); if(this.collection) this.collection.addItem(noteID); } - this.note = Scholar.Items.get(noteID); + this.note = Zotero.Items.get(noteID); } ]]> </body> diff --git a/chrome/chromeFiles/content/scholar/bindings/relatedbox.xml b/chrome/chromeFiles/content/scholar/bindings/relatedbox.xml @@ -28,7 +28,7 @@ var seealso = this.item.getSeeAlso(); if(seealso) { - seealso = Scholar.Items.get(seealso); + seealso = Zotero.Items.get(seealso); for(var i = 0; i < seealso.length; i++) { r = r + seealso[i].getField('title') + ", "; @@ -54,11 +54,11 @@ if(seealso) { - seealso = Scholar.Items.get(seealso); + seealso = Zotero.Items.get(seealso); for(var i = 0; i < seealso.length; i++) { var icon= document.createElement("image"); - icon.setAttribute('src','chrome://scholar/skin/treeitem-'+Scholar.ItemTypes.getName(seealso[i].getType())+'.png'); + icon.setAttribute('src','chrome://zotero/skin/treeitem-'+Zotero.ItemTypes.getName(seealso[i].getType())+'.png'); var label = document.createElement("label"); label.setAttribute('value', seealso[i].getField('title')); @@ -97,7 +97,7 @@ <body> <![CDATA[ var io = {dataIn: null, dataOut: null}; - window.openDialog('chrome://scholar/content/selectItemsDialog.xul','','chrome,modal',io); + window.openDialog('chrome://zotero/content/selectItemsDialog.xul','','chrome,modal',io); if(io.dataOut && this.item) { @@ -130,15 +130,15 @@ if(id) { var p; - if(window.ScholarPane) + if(window.ZoteroPane) { - p = window.ScholarPane; + p = window.ZoteroPane; } else { var win; - if(window.opener && window.opener.ScholarPane) + if(window.opener && window.opener.ZoteroPane) { win = window.opener; } @@ -151,7 +151,7 @@ return; } - p = win.ScholarPane; + p = win.ZoteroPane; } p.selectItem(id); diff --git a/chrome/chromeFiles/content/scholar/bindings/scholarsearch.xml b/chrome/chromeFiles/content/scholar/bindings/scholarsearch.xml @@ -148,11 +148,11 @@ for(var i in operators) { - operatorsList.appendItem(Scholar.getString('searchOperator.'+operators[i]),operators[i]); + operatorsList.appendItem(Zotero.getString('searchOperator.'+operators[i]),operators[i]); } var conditionsList = this.id('conditionsmenu'); - var conditions = Scholar.SearchConditions.getStandardConditions(); + var conditions = Zotero.SearchConditions.getStandardConditions(); for(var i=0, len=conditions.length; i<len; i++) { @@ -174,7 +174,7 @@ this.selectedCondition = conditionsMenu.value; this.selectedOperator = operatorsList.value; - var condition = Scholar.SearchConditions.get(conditionsMenu.value); + var condition = Zotero.SearchConditions.get(conditionsMenu.value); var operators = condition['operators']; // Display appropriate operators for condition @@ -196,13 +196,13 @@ case 'collectionID': var merged = []; - var cols = Scholar.getCollections(false, true); + var cols = Zotero.getCollections(false, true); for (var i in cols) { merged.push([cols[i].getName(), 'C' + cols[i].getID()]); } - var searches = Scholar.Searches.getAll(); + var searches = Zotero.Searches.getAll(); for (var i in searches) { if (searches[i]['id'] != this.parent.search.getID()) @@ -215,10 +215,10 @@ return; case 'itemTypeID': - var types = Scholar.ItemTypes.getTypes(); + var types = Zotero.ItemTypes.getTypes(); for (var i in types) { - types[i][0] = Scholar.getString('itemTypes.' + types[i]['name']); + types[i][0] = Zotero.getString('itemTypes.' + types[i]['name']); types[i][1] = types[i]['id']; delete types[i]['name']; delete types[i]['id']; diff --git a/chrome/chromeFiles/content/scholar/bindings/searchtextbox.xml b/chrome/chromeFiles/content/scholar/bindings/searchtextbox.xml @@ -5,7 +5,7 @@ http://chnm.gmu.edu/ --> -<!DOCTYPE bindings SYSTEM "chrome://scholar/locale/searchbox.dtd"> +<!DOCTYPE bindings SYSTEM "chrome://zotero/locale/searchbox.dtd"> <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" @@ -146,10 +146,10 @@ <xul:textbox xbl:inherits="flex"> <xul:popupset> <xul:menupopup id="textbox-fulltext-menu"> - <xul:menuitem type="radio" checked="true" label="&scholar.search.textModes.phrase;"/> - <xul:menuitem type="radio" label="&scholar.search.textModes.phraseBinary;"/> - <xul:menuitem type="radio" label="&scholar.search.textModes.regexp;"/> - <xul:menuitem type="radio" label="&scholar.search.textModes.regexpCS;"/> + <xul:menuitem type="radio" checked="true" label="&zotero.search.textModes.phrase;"/> + <xul:menuitem type="radio" label="&zotero.search.textModes.phraseBinary;"/> + <xul:menuitem type="radio" label="&zotero.search.textModes.regexp;"/> + <xul:menuitem type="radio" label="&zotero.search.textModes.regexpCS;"/> </xul:menupopup> </xul:popupset> diff --git a/chrome/chromeFiles/content/scholar/bindings/tagsbox.xml b/chrome/chromeFiles/content/scholar/bindings/tagsbox.xml @@ -44,7 +44,7 @@ <method name="reload"> <body> <![CDATA[ - //Scholar.debug('Reloading tags'); + //Zotero.debug('Reloading tags'); var rows = this.id('tagRows'); while(rows.hasChildNodes()) @@ -75,7 +75,7 @@ <parameter name="tabindex"/> <body> <![CDATA[ - var id = tag ? Scholar.Tags.getID(tag) : null; + var id = tag ? Zotero.Tags.getID(tag) : null; tag = tag ? tag : ''; if (!tabindex) @@ -91,11 +91,11 @@ } var icon= document.createElement("image"); - icon.setAttribute('src','chrome://scholar/skin/tag.png'); + icon.setAttribute('src','chrome://zotero/skin/tag.png'); // DEBUG: Why won't just this.nextSibling.blur() work? icon.setAttribute('onclick','if (this.nextSibling.inputField){ this.nextSibling.inputField.blur() }'); - var label = ScholarItemPane.createValueElement(tag, 'tag', tabindex); + var label = ZoteroItemPane.createValueElement(tag, 'tag', tabindex); var remove = document.createElement("label"); remove.setAttribute('value','-'); @@ -152,7 +152,7 @@ <![CDATA[ if(oldTagID && newTag) { - var oldTag = Scholar.Tags.getName(oldTagID); + var oldTag = Zotero.Tags.getName(oldTagID); if (oldTag!=newTag) { return this.item.replaceTag(oldTagID, newTag); @@ -205,7 +205,7 @@ // // We reset the popup manually if it's showing if (this.parentNode.getAttribute('showing')=='true'){ - //Scholar.debug('Fixing popup'); + //Zotero.debug('Fixing popup'); // The target element is 'tagsLabel', so change the // path if the XUL DOM in the note editor XBL changes this.parentNode.showPopup( diff --git a/chrome/chromeFiles/content/scholar/exportOptions.js b/chrome/chromeFiles/content/scholar/exportOptions.js @@ -1,12 +1,12 @@ ////////////////////////////////////////////////////////////////////////////// // -// Scholar_File_Interface_Export +// Zotero_File_Interface_Export // ////////////////////////////////////////////////////////////////////////////// // Class to provide options for export -var Scholar_File_Interface_Export = new function() { +var Zotero_File_Interface_Export = new function() { this.init = init; this.updateOptions = updateOptions; this.accept = accept; @@ -36,7 +36,7 @@ var Scholar_File_Interface_Export = new function() { // presented to the user // get readable name for option try { - var optionLabel = Scholar.getString("exportOptions."+option); + var optionLabel = Zotero.getString("exportOptions."+option); } catch(e) { var optionLabel = option; } diff --git a/chrome/chromeFiles/content/scholar/exportOptions.xul b/chrome/chromeFiles/content/scholar/exportOptions.xul @@ -1,18 +1,18 @@ <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="&exportOptions.title;" buttons="cancel,accept" - ondialogaccept="Scholar_File_Interface_Export.accept()" - ondialogcancel="Scholar_File_Interface_Export.cancel()" - id="scholar-export-options" - onload="Scholar_File_Interface_Export.init()"> + ondialogaccept="Zotero_File_Interface_Export.accept()" + ondialogcancel="Zotero_File_Interface_Export.cancel()" + id="zotero-export-options" + onload="Zotero_File_Interface_Export.init()"> <script src="include.js"/> <script src="exportOptions.js"/> <hbox> <label value="&exportOptions.format.label;" control="format-menu"/> - <menulist id="format-menu" oncommand="Scholar_File_Interface_Export.updateOptions()"> + <menulist id="format-menu" oncommand="Zotero_File_Interface_Export.updateOptions()"> <menupopup id="format-popup"> </menupopup> </menulist> diff --git a/chrome/chromeFiles/content/scholar/fileInterface.js b/chrome/chromeFiles/content/scholar/fileInterface.js @@ -1,4 +1,4 @@ -var Scholar_File_Interface = new function() { +var Zotero_File_Interface = new function() { var _unresponsiveScriptPreference, _importCollection, _notifyItem, _notifyCollection; this.exportFile = exportFile; @@ -9,15 +9,15 @@ var Scholar_File_Interface = new function() { this.bibliographyFromItems = bibliographyFromItems; /* - * Creates Scholar.Translate instance and shows file picker for file export + * Creates Zotero.Translate instance and shows file picker for file export */ function exportFile(name, items) { - var translation = new Scholar.Translate("export"); + var translation = new Zotero.Translate("export"); var translators = translation.getTranslators(); // present options dialog var io = {translators:translators} - window.openDialog("chrome://scholar/content/exportOptions.xul", + window.openDialog("chrome://zotero/content/exportOptions.xul", "_blank", "chrome,modal,centerscreen", io); if(!io.selectedTranslator) { return false; @@ -27,10 +27,10 @@ var Scholar_File_Interface = new function() { var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); - fp.init(window, Scholar.getString("fileInterface.export"), nsIFilePicker.modeSave); + fp.init(window, Zotero.getString("fileInterface.export"), nsIFilePicker.modeSave); // set file name and extension - name = (name ? name : Scholar.getString("pane.collections.library")); + name = (name ? name : Zotero.getString("pane.collections.library")); fp.defaultString = name+"."+io.selectedTranslator.target; fp.appendFilter(io.selectedTranslator.label, "*."+io.selectedTranslator.target); @@ -43,8 +43,8 @@ var Scholar_File_Interface = new function() { translation.setTranslator(io.selectedTranslator); translation.setHandler("done", _exportDone); _disableUnresponsive(); - Scholar_File_Interface.Progress.show( - Scholar.getString("fileInterface.itemsExported"), + Zotero_File_Interface.Progress.show( + Zotero.getString("fileInterface.itemsExported"), function() { translation.translate(); }); @@ -55,19 +55,19 @@ var Scholar_File_Interface = new function() { * exports a collection or saved search */ function exportCollection() { - var collection = ScholarPane.getSelectedCollection(); + var collection = ZoteroPane.getSelectedCollection(); if (collection) { - exportFile(collection.getName(), Scholar.getItems(collection.getID())); + exportFile(collection.getName(), Zotero.getItems(collection.getID())); return; } - var searchRef = ScholarPane.getSelectedSavedSearch(); + var searchRef = ZoteroPane.getSelectedSavedSearch(); if (searchRef) { - var search = new Scholar.Search(); + var search = new Zotero.Search(); search.load(searchRef['id']); - exportFile(search.getName(), Scholar.Items.get(search.search())); + exportFile(search.getName(), Zotero.Items.get(search.search())); return; } @@ -79,35 +79,35 @@ var Scholar_File_Interface = new function() { * exports items */ function exportItems() { - var items = ScholarPane.getSelectedItems(); + var items = ZoteroPane.getSelectedItems(); if(!items || !items.length) throw("no items currently selected"); - exportFile(Scholar.getString("fileInterface.exportedItems"), items); + exportFile(Zotero.getString("fileInterface.exportedItems"), items); } /* * closes items exported indicator */ function _exportDone(obj, worked) { - Scholar_File_Interface.Progress.close(); + Zotero_File_Interface.Progress.close(); _restoreUnresponsive(); if(!worked) { - window.alert(Scholar.getString("fileInterface.exportError")); + window.alert(Zotero.getString("fileInterface.exportError")); } } /* - * Creates Scholar.Translate instance and shows file picker for file import + * Creates Zotero.Translate instance and shows file picker for file import */ function importFile() { - var translation = new Scholar.Translate("import"); + var translation = new Zotero.Translate("import"); var translators = translation.getTranslators(); const nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); - fp.init(window, Scholar.getString("fileInterface.import"), nsIFilePicker.modeOpen); + fp.init(window, Zotero.getString("fileInterface.import"), nsIFilePicker.modeOpen); fp.appendFilters(nsIFilePicker.filterAll); for(var i in translators) { @@ -122,7 +122,7 @@ var Scholar_File_Interface = new function() { if(translators.length) { // create a new collection to take in imported items var date = new Date(); - _importCollection = Scholar.Collections.add(Scholar.getString("fileInterface.imported")+" "+date.toLocaleString()); + _importCollection = Zotero.Collections.add(Zotero.getString("fileInterface.imported")+" "+date.toLocaleString()); // import items translation.setTranslator(translators[0]); @@ -131,30 +131,30 @@ var Scholar_File_Interface = new function() { _disableUnresponsive(); // disable notifier - Scholar.Notifier.disable(); + Zotero.Notifier.disable(); // show progress indicator - Scholar_File_Interface.Progress.show( - Scholar.getString("fileInterface.itemsImported"), + Zotero_File_Interface.Progress.show( + Zotero.getString("fileInterface.itemsImported"), function() { translation.translate(); }); } else { - window.alert(Scholar.getString("fileInterface.fileFormatUnsupported")); + window.alert(Zotero.getString("fileInterface.fileFormatUnsupported")); } } } /* * Saves collections after they've been imported. Input item is of the type - * outputted by Scholar.Collection.toArray(); only receives top-level + * outputted by Zotero.Collection.toArray(); only receives top-level * collections */ function _importCollectionDone(obj, collection) { - Scholar.Notifier.enable(); - Scholar.Notifier.trigger("add", "collection", collection.getID()); + Zotero.Notifier.enable(); + Zotero.Notifier.trigger("add", "collection", collection.getID()); collection.changeParent(_importCollection.getID()); - Scholar.Notifier.disable(); + Zotero.Notifier.disable(); } /* @@ -167,17 +167,17 @@ var Scholar_File_Interface = new function() { } // run notify - Scholar.Notifier.enable(); + Zotero.Notifier.enable(); if(obj.newItems.length) { - Scholar.Notifier.trigger("add", "item", obj.newItems); - Scholar.Notifier.trigger("modify", "collection", _importCollection.getID()); + Zotero.Notifier.trigger("add", "item", obj.newItems); + Zotero.Notifier.trigger("modify", "collection", _importCollection.getID()); } - Scholar_File_Interface.Progress.close(); + Zotero_File_Interface.Progress.close(); _restoreUnresponsive(); if(!worked) { - window.alert(Scholar.getString("fileInterface.importError")); + window.alert(Zotero.getString("fileInterface.importError")); } } @@ -205,19 +205,19 @@ var Scholar_File_Interface = new function() { * Creates a bibliography from a collection or saved search */ function bibliographyFromCollection() { - var collection = ScholarPane.getSelectedCollection(); + var collection = ZoteroPane.getSelectedCollection(); if (collection) { - _doBibliographyOptions(collection.getName(), Scholar.getItems(collection.getID())); + _doBibliographyOptions(collection.getName(), Zotero.getItems(collection.getID())); return; } - var searchRef = ScholarPane.getSelectedSavedSearch(); + var searchRef = ZoteroPane.getSelectedSavedSearch(); if (searchRef) { - var search = new Scholar.Search(); + var search = new Zotero.Search(); search.load(searchRef['id']); - _doBibliographyOptions(search.getName(), Scholar.Items.get(search.search())); + _doBibliographyOptions(search.getName(), Zotero.Items.get(search.search())); return; } @@ -228,10 +228,10 @@ var Scholar_File_Interface = new function() { * Creates a bibliography from a items */ function bibliographyFromItems() { - var items = ScholarPane.getSelectedItems(); + var items = ZoteroPane.getSelectedItems(); if(!items || !items.length) throw("no items currently selected"); - _doBibliographyOptions(Scholar.getString("fileInterface.untitledBibliography"), items); + _doBibliographyOptions(Zotero.getString("fileInterface.untitledBibliography"), items); } /* @@ -241,19 +241,19 @@ var Scholar_File_Interface = new function() { // make sure at least one item is not a standalone note or attachment var haveNonNote = false; for(var i in items) { - var type = Scholar.ItemTypes.getName(items[i].getType()); + var type = Zotero.ItemTypes.getName(items[i].getType()); if(type != "note" && type != "attachment") { haveNonNote = true; break; } } if(!haveNonNote) { - window.alert(Scholar.getString("fileInterface.noReferencesError")); + window.alert(Zotero.getString("fileInterface.noReferencesError")); return; } var io = new Object(); - var newDialog = window.openDialog("chrome://scholar/content/bibliography.xul", + var newDialog = window.openDialog("chrome://zotero/content/bibliography.xul", "_blank","chrome,modal,centerscreen", io); // determine output format @@ -264,18 +264,18 @@ var Scholar_File_Interface = new function() { // generate bibliography try { - var csl = Scholar.Cite.getStyle(io.style); + var csl = Zotero.Cite.getStyle(io.style); csl.preprocessItems(items); var bibliography = csl.createBibliography(items, format); } catch(e) { - window.alert(Scholar.getString("fileInterface.bibliographyGenerationError")); + window.alert(Zotero.getString("fileInterface.bibliographyGenerationError")); throw(e); return; } if(io.output == "print") { // printable bibliography, using a hidden browser - var browser = Scholar.Browser.createHiddenBrowser(window); + var browser = Zotero.Browser.createHiddenBrowser(window); browser.contentDocument.write(bibliography); // this is kinda nasty, but we have to temporarily modify the user's @@ -301,7 +301,7 @@ var Scholar_File_Interface = new function() { prefService.setCharPref(prefsToClear[i], oldPrefs[i]); } - Scholar.Browser.deleteHiddenBrowser(browser); + Zotero.Browser.deleteHiddenBrowser(browser); } else if(io.output == "save-as-html") { var fStream = _saveBibliography(name, "HTML"); @@ -311,7 +311,7 @@ var Scholar_File_Interface = new function() { html +='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n'; html +='<head>\n'; html +='<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n'; - html +='<title>'+Scholar.getString("fileInterface.bibliographyHTMLTitle")+'</title>\n'; + html +='<title>'+Zotero.getString("fileInterface.bibliographyHTMLTitle")+'</title>\n'; html +='</head>\n'; html +='<body>\n'; html += bibliography; @@ -390,7 +390,7 @@ var Scholar_File_Interface = new function() { } // Handles the display of a progress indicator -Scholar_File_Interface.Progress = new function() { +Zotero_File_Interface.Progress = new function() { var _windowLoaded = false; var _windowLoading = false; var _progressWindow; @@ -413,7 +413,7 @@ Scholar_File_Interface.Progress = new function() { _outOf = 0; _callback = callback; - _progressWindow = window.openDialog("chrome://scholar/chrome/fileProgress.xul", "", "chrome,resizable=no,close=no,dependent,dialog,centerscreen"); + _progressWindow = window.openDialog("chrome://zotero/chrome/fileProgress.xul", "", "chrome,resizable=no,close=no,dependent,dialog,centerscreen"); _progressWindow.addEventListener("pageshow", _onWindowLoaded, false); return true; diff --git a/chrome/chromeFiles/content/scholar/fileProgress.xul b/chrome/chromeFiles/content/scholar/fileProgress.xul @@ -1,10 +1,10 @@ <?xml version="1.0" ?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="&progress.title;" width="300" height="30" - id="scholar-progress"> + id="zotero-progress"> <vbox style="padding:10px"> <hbox align="stretch"> <label id="progress-label" flex="1" /> diff --git a/chrome/chromeFiles/content/scholar/include.js b/chrome/chromeFiles/content/scholar/include.js @@ -1,4 +1,4 @@ -var Scholar = Components.classes["@chnm.gmu.edu/Zotero;1"] +var Zotero = Components.classes["@chnm.gmu.edu/Zotero;1"] // Currently uses only nsISupports //.getService(Components.interfaces.chnmIZoteroService). .getService(Components.interfaces.nsISupports) diff --git a/chrome/chromeFiles/content/scholar/ingester/browser.js b/chrome/chromeFiles/content/scholar/ingester/browser.js @@ -1,20 +1,20 @@ -// Scholar for Firefox Ingester Browser Functions +// Zotero for Firefox Ingester Browser Functions // Based on code taken from Greasemonkey and PiggyBank // This code is licensed according to the GPL ////////////////////////////////////////////////////////////////////////////// // -// Scholar_Ingester_Interface +// Zotero_Ingester_Interface // ////////////////////////////////////////////////////////////////////////////// // Class to interface with the browser when ingesting data -var Scholar_Ingester_Interface = function() {} +var Zotero_Ingester_Interface = function() {} ////////////////////////////////////////////////////////////////////////////// // -// Public Scholar_Ingester_Interface methods +// Public Zotero_Ingester_Interface methods // ////////////////////////////////////////////////////////////////////////////// @@ -22,73 +22,73 @@ var Scholar_Ingester_Interface = function() {} * Initialize some variables and prepare event listeners for when chrome is done * loading */ -Scholar_Ingester_Interface.init = function() { - Scholar_Ingester_Interface.browserData = new Object(); - Scholar_Ingester_Interface._scrapePopupShowing = false; - Scholar.Ingester.ProxyMonitor.init(); - Scholar.Ingester.MIMEHandler.init(); - Scholar.Translate.init(); +Zotero_Ingester_Interface.init = function() { + Zotero_Ingester_Interface.browserData = new Object(); + Zotero_Ingester_Interface._scrapePopupShowing = false; + Zotero.Ingester.ProxyMonitor.init(); + Zotero.Ingester.MIMEHandler.init(); + Zotero.Translate.init(); - window.addEventListener("load", Scholar_Ingester_Interface.chromeLoad, false); - window.addEventListener("unload", Scholar_Ingester_Interface.chromeUnload, false); + window.addEventListener("load", Zotero_Ingester_Interface.chromeLoad, false); + window.addEventListener("unload", Zotero_Ingester_Interface.chromeUnload, false); } /* * When chrome loads, register our event handlers with the appropriate interfaces */ -Scholar_Ingester_Interface.chromeLoad = function() { - Scholar_Ingester_Interface.tabBrowser = document.getElementById("content"); - Scholar_Ingester_Interface.appContent = document.getElementById("appcontent"); - Scholar_Ingester_Interface.statusImage = document.getElementById("scholar-status-image"); +Zotero_Ingester_Interface.chromeLoad = function() { + Zotero_Ingester_Interface.tabBrowser = document.getElementById("content"); + Zotero_Ingester_Interface.appContent = document.getElementById("appcontent"); + Zotero_Ingester_Interface.statusImage = document.getElementById("zotero-status-image"); // this gives us onLocationChange, for updating when tabs are switched/created - Scholar_Ingester_Interface.tabBrowser.addEventListener("TabClose", - Scholar_Ingester_Interface.tabClose, false); - Scholar_Ingester_Interface.tabBrowser.addEventListener("TabSelect", - Scholar_Ingester_Interface.tabSelect, false); + Zotero_Ingester_Interface.tabBrowser.addEventListener("TabClose", + Zotero_Ingester_Interface.tabClose, false); + Zotero_Ingester_Interface.tabBrowser.addEventListener("TabSelect", + Zotero_Ingester_Interface.tabSelect, false); // this is for pageshow, for updating the status of the book icon - Scholar_Ingester_Interface.appContent.addEventListener("pageshow", - Scholar_Ingester_Interface.contentLoad, true); + Zotero_Ingester_Interface.appContent.addEventListener("pageshow", + Zotero_Ingester_Interface.contentLoad, true); } /* * When chrome unloads, delete our document objects and remove our listeners */ -Scholar_Ingester_Interface.chromeUnload = function() { - delete Scholar_Ingester_Interface.browserData; +Zotero_Ingester_Interface.chromeUnload = function() { + delete Zotero_Ingester_Interface.browserData; } /* * Scrapes a page (called when the capture icon is clicked); takes a collection * ID as the argument */ -Scholar_Ingester_Interface.scrapeThisPage = function(saveLocation) { - var browser = Scholar_Ingester_Interface.tabBrowser.selectedBrowser; - var data = Scholar_Ingester_Interface._getData(browser); +Zotero_Ingester_Interface.scrapeThisPage = function(saveLocation) { + var browser = Zotero_Ingester_Interface.tabBrowser.selectedBrowser; + var data = Zotero_Ingester_Interface._getData(browser); if(data.translators && data.translators.length) { - Scholar_Ingester_Interface.Progress.show(); + Zotero_Ingester_Interface.Progress.show(); if(saveLocation) { - saveLocation = Scholar.Collections.get(saveLocation); + saveLocation = Zotero.Collections.get(saveLocation); } else { // save to currently selected collection, if a collection is selected try { - saveLocation = ScholarPane.getSelectedCollection(); + saveLocation = ZoteroPane.getSelectedCollection(); } catch(e) {} } - var translate = new Scholar.Translate("web"); + var translate = new Zotero.Translate("web"); translate.setDocument(data.document); // use first translator available translate.setTranslator(data.translators[0]); - translate.setHandler("select", Scholar_Ingester_Interface._selectItems); - translate.setHandler("itemDone", function(obj, item) { Scholar_Ingester_Interface._itemDone(obj, item, saveLocation) }); - translate.setHandler("done", function(obj, item) { Scholar_Ingester_Interface._finishScraping(obj, item, saveLocation) }); + translate.setHandler("select", Zotero_Ingester_Interface._selectItems); + translate.setHandler("itemDone", function(obj, item) { Zotero_Ingester_Interface._itemDone(obj, item, saveLocation) }); + translate.setHandler("done", function(obj, item) { Zotero_Ingester_Interface._finishScraping(obj, item, saveLocation) }); translate.translate(); } } -Scholar_Ingester_Interface.searchFrames = function(rootDoc, searchDoc) { +Zotero_Ingester_Interface.searchFrames = function(rootDoc, searchDoc) { for each(var frame in rootDoc.frames) { if(frame.document == searchDoc || (frame.document.frames && searchFrames(frame, searchDoc))) { @@ -103,7 +103,7 @@ Scholar_Ingester_Interface.searchFrames = function(rootDoc, searchDoc) { * An event handler called when a new document is loaded. Creates a new document * object, and updates the status of the capture icon */ -Scholar_Ingester_Interface.contentLoad = function(event) { +Zotero_Ingester_Interface.contentLoad = function(event) { if(event.originalTarget instanceof HTMLDocument) { var doc = event.originalTarget; var rootDoc = doc; @@ -115,9 +115,9 @@ Scholar_Ingester_Interface.contentLoad = function(event) { // Figure out what browser this contentDocument is associated with var browser; - for(var i=0; i<Scholar_Ingester_Interface.tabBrowser.browsers.length; i++) { - if(rootDoc == Scholar_Ingester_Interface.tabBrowser.browsers[i].contentDocument) { - browser = Scholar_Ingester_Interface.tabBrowser.browsers[i]; + for(var i=0; i<Zotero_Ingester_Interface.tabBrowser.browsers.length; i++) { + if(rootDoc == Zotero_Ingester_Interface.tabBrowser.browsers[i].contentDocument) { + browser = Zotero_Ingester_Interface.tabBrowser.browsers[i]; break; } } @@ -126,12 +126,12 @@ Scholar_Ingester_Interface.contentLoad = function(event) { } // get data object - var data = Scholar_Ingester_Interface._getData(browser); + var data = Zotero_Ingester_Interface._getData(browser); // if there's already a scrapable page in the browser window, and it's // still there, ensure it is actually part of the page, then return if(data.translators && data.translators.length && data.document.location) { - if(Scholar_Ingester_Interface.searchFrames(rootDoc, data.document)) { + if(Zotero_Ingester_Interface.searchFrames(rootDoc, data.document)) { return; } else { data.document = null; @@ -139,12 +139,12 @@ Scholar_Ingester_Interface.contentLoad = function(event) { } // get translators - var translate = new Scholar.Translate("web"); + var translate = new Zotero.Translate("web"); translate.setDocument(doc); data.translators = translate.getTranslators(); // update status - if(Scholar_Ingester_Interface.tabBrowser.selectedBrowser == browser) { - Scholar_Ingester_Interface._updateStatus(data); + if(Zotero_Ingester_Interface.tabBrowser.selectedBrowser == browser) { + Zotero_Ingester_Interface._updateStatus(data); } // add document if(data.translators && data.translators.length) { @@ -156,52 +156,52 @@ Scholar_Ingester_Interface.contentLoad = function(event) { /* * called when a tab is closed */ -Scholar_Ingester_Interface.tabClose = function(event) { +Zotero_Ingester_Interface.tabClose = function(event) { // To execute if document object does not exist - Scholar_Ingester_Interface._deleteData(event.target.linkedBrowser); + Zotero_Ingester_Interface._deleteData(event.target.linkedBrowser); } /* * called when a tab is switched */ -Scholar_Ingester_Interface.tabSelect = function(event) { - var data = Scholar_Ingester_Interface._getData(Scholar_Ingester_Interface.tabBrowser.selectedBrowser); - Scholar_Ingester_Interface._updateStatus(data); +Zotero_Ingester_Interface.tabSelect = function(event) { + var data = Zotero_Ingester_Interface._getData(Zotero_Ingester_Interface.tabBrowser.selectedBrowser); + Zotero_Ingester_Interface._updateStatus(data); } -Scholar_Ingester_Interface.hidePopup = function(collectionID) { - Scholar_Ingester_Interface._scrapePopupShowing = false; +Zotero_Ingester_Interface.hidePopup = function(collectionID) { + Zotero_Ingester_Interface._scrapePopupShowing = false; } -Scholar_Ingester_Interface.showPopup = function(collectionID, parentElement) { - if(Scholar_Ingester_Interface._scrapePopupShowing && parentElement.hasChildNodes()) { +Zotero_Ingester_Interface.showPopup = function(collectionID, parentElement) { + if(Zotero_Ingester_Interface._scrapePopupShowing && parentElement.hasChildNodes()) { return false; // Don't dynamically reload popups that are already showing } - Scholar_Ingester_Interface._scrapePopupShowing = true; + Zotero_Ingester_Interface._scrapePopupShowing = true; parentElement.removeAllItems(); if(collectionID == null) { // show library var newItem = document.createElement("menuitem"); - newItem.setAttribute("label", Scholar.getString("pane.collections.library")); - newItem.setAttribute("class", "menuitem-iconic scholar-scrape-popup-library"); - newItem.setAttribute("oncommand", 'Scholar_Ingester_Interface.scrapeThisPage()'); + newItem.setAttribute("label", Zotero.getString("pane.collections.library")); + newItem.setAttribute("class", "menuitem-iconic zotero-scrape-popup-library"); + newItem.setAttribute("oncommand", 'Zotero_Ingester_Interface.scrapeThisPage()'); parentElement.appendChild(newItem); } - var childrenList = Scholar.getCollections(collectionID); + var childrenList = Zotero.getCollections(collectionID); for(var i = 0; i < childrenList.length; i++) { if(childrenList[i].hasChildCollections()) { var newItem = document.createElement("menu"); var subMenu = document.createElement("menupopup"); - subMenu.setAttribute("onpopupshowing", 'Scholar_Ingester_Interface.showPopup("'+childrenList[i].getID()+'", this)'); - newItem.setAttribute("class", "menu-iconic scholar-scrape-popup-collection"); + subMenu.setAttribute("onpopupshowing", 'Zotero_Ingester_Interface.showPopup("'+childrenList[i].getID()+'", this)'); + newItem.setAttribute("class", "menu-iconic zotero-scrape-popup-collection"); newItem.appendChild(subMenu); } else { var newItem = document.createElement("menuitem"); - newItem.setAttribute("class", "menuitem-iconic scholar-scrape-popup-collection"); + newItem.setAttribute("class", "menuitem-iconic zotero-scrape-popup-collection"); } newItem.setAttribute("label", childrenList[i].getName()); - newItem.setAttribute("oncommand", 'Scholar_Ingester_Interface.scrapeThisPage("'+childrenList[i].getID()+'")'); + newItem.setAttribute("oncommand", 'Zotero_Ingester_Interface.scrapeThisPage("'+childrenList[i].getID()+'")'); parentElement.appendChild(newItem); } @@ -211,7 +211,7 @@ Scholar_Ingester_Interface.showPopup = function(collectionID, parentElement) { ////////////////////////////////////////////////////////////////////////////// // -// Private Scholar_Ingester_Interface methods +// Private Zotero_Ingester_Interface methods // ////////////////////////////////////////////////////////////////////////////// @@ -225,20 +225,20 @@ Scholar_Ingester_Interface.showPopup = function(collectionID, parentElement) { * * Currently, the data object contains only one property: "translators," which * is an array of translators that should work with the given page as returned - * from Scholar.Translate.getTranslator() + * from Zotero.Translate.getTranslator() */ -Scholar_Ingester_Interface._getData = function(browser) { +Zotero_Ingester_Interface._getData = function(browser) { try { - var key = browser.getAttribute("scholar-key"); - if(Scholar_Ingester_Interface.browserData[key]) { - return Scholar_Ingester_Interface.browserData[key]; + var key = browser.getAttribute("zotero-key"); + if(Zotero_Ingester_Interface.browserData[key]) { + return Zotero_Ingester_Interface.browserData[key]; } } finally { if(!key) { var key = (new Date()).getTime(); - browser.setAttribute("scholar-key", key); - Scholar_Ingester_Interface.browserData[key] = new Array(); - return Scholar_Ingester_Interface.browserData[key]; + browser.setAttribute("zotero-key", key); + Zotero_Ingester_Interface.browserData[key] = new Array(); + return Zotero_Ingester_Interface.browserData[key]; } } return false; @@ -247,11 +247,11 @@ Scholar_Ingester_Interface._getData = function(browser) { /* * Deletes the document object associated with a given browser window object */ -Scholar_Ingester_Interface._deleteData = function(browser) { +Zotero_Ingester_Interface._deleteData = function(browser) { try { - var key = browser.getAttribute("scholar-key"); - if(Scholar_Ingester_Interface.browserData[key]) { - delete Scholar_Ingester_Interface.browserData[key]; + var key = browser.getAttribute("zotero-key"); + if(Zotero_Ingester_Interface.browserData[key]) { + delete Zotero_Ingester_Interface.browserData[key]; return true; } } finally {} @@ -262,48 +262,48 @@ Scholar_Ingester_Interface._deleteData = function(browser) { * Updates the status of the capture icon to reflect the scrapability or lack * thereof of the current page */ -Scholar_Ingester_Interface._updateStatus = function(data) { +Zotero_Ingester_Interface._updateStatus = function(data) { if(data.translators && data.translators.length) { var itemType = data.translators[0].itemType; if(itemType == "multiple") { // Use folder icon for multiple types, for now - Scholar_Ingester_Interface.statusImage.src = "chrome://scholar/skin/treesource-collection.png"; + Zotero_Ingester_Interface.statusImage.src = "chrome://zotero/skin/treesource-collection.png"; } else { - Scholar_Ingester_Interface.statusImage.src = "chrome://scholar/skin/treeitem-"+itemType+".png"; + Zotero_Ingester_Interface.statusImage.src = "chrome://zotero/skin/treeitem-"+itemType+".png"; } - Scholar_Ingester_Interface.statusImage.hidden = false; + Zotero_Ingester_Interface.statusImage.hidden = false; } else { - Scholar_Ingester_Interface.statusImage.hidden = true; + Zotero_Ingester_Interface.statusImage.hidden = true; } } /* * Callback to be executed when an item has been finished */ -Scholar_Ingester_Interface._itemDone = function(obj, item, collection) { +Zotero_Ingester_Interface._itemDone = function(obj, item, collection) { var title = item.getField("title"); - var icon = "chrome://scholar/skin/treeitem-"+Scholar.ItemTypes.getName(item.getField("itemTypeID"))+".png" - Scholar_Ingester_Interface.Progress.addLines([title], [icon]); + var icon = "chrome://zotero/skin/treeitem-"+Zotero.ItemTypes.getName(item.getField("itemTypeID"))+".png" + Zotero_Ingester_Interface.Progress.addLines([title], [icon]); // add item to collection, if one was specified if(collection) { - Scholar.Notifier.disable(); + Zotero.Notifier.disable(); collection.addItem(item.getID()); - Scholar.Notifier.enable(); + Zotero.Notifier.enable(); } } /* * called when a user is supposed to select items */ -Scholar_Ingester_Interface._selectItems = function(obj, itemList) { +Zotero_Ingester_Interface._selectItems = function(obj, itemList) { // this is kinda ugly, mozillazine made me do it! honest! var io = { dataIn:itemList, dataOut:null } - var newDialog = window.openDialog("chrome://scholar/content/ingester/selectitems.xul", + var newDialog = window.openDialog("chrome://zotero/content/ingester/selectitems.xul", "_blank","chrome,modal,centerscreen,resizable=yes", io); if(!io.dataOut) { // user selected no items, so kill the progress indicatior - Scholar_Ingester_Interface.Progress.kill(); + Zotero_Ingester_Interface.Progress.kill(); } return io.dataOut; @@ -312,28 +312,28 @@ Scholar_Ingester_Interface._selectItems = function(obj, itemList) { /* * Callback to be executed when scraping is complete */ -Scholar_Ingester_Interface._finishScraping = function(obj, returnValue, collection) { +Zotero_Ingester_Interface._finishScraping = function(obj, returnValue, collection) { if(!returnValue) { - Scholar_Ingester_Interface.Progress.changeHeadline(Scholar.getString("ingester.scrapeError")); - Scholar_Ingester_Interface.Progress.addDescription(Scholar.getString("ingester.scrapeErrorDescription")); + Zotero_Ingester_Interface.Progress.changeHeadline(Zotero.getString("ingester.scrapeError")); + Zotero_Ingester_Interface.Progress.addDescription(Zotero.getString("ingester.scrapeErrorDescription")); } if(collection) { // notify about modified items - Scholar.Notifier.trigger("modify", "collection", collection.getID()); + Zotero.Notifier.trigger("modify", "collection", collection.getID()); } - Scholar_Ingester_Interface.Progress.fade(); + Zotero_Ingester_Interface.Progress.fade(); } ////////////////////////////////////////////////////////////////////////////// // -// Scholar.Ingester.Progress +// Zotero.Ingester.Progress // ////////////////////////////////////////////////////////////////////////////// // Handles the display of a div showing progress in scraping -Scholar_Ingester_Interface.Progress = new function() { +Zotero_Ingester_Interface.Progress = new function() { var _windowLoaded = false; var _windowLoading = false; // keep track of all of these things in case they're called before we're @@ -341,7 +341,7 @@ Scholar_Ingester_Interface.Progress = new function() { var _loadDescription = null; var _loadLines = new Array(); var _loadIcons = new Array(); - var _loadHeadline = Scholar.getString("ingester.scraping"); + var _loadHeadline = Zotero.getString("ingester.scraping"); this.show = show; this.changeHeadline = changeHeadline; @@ -354,7 +354,7 @@ Scholar_Ingester_Interface.Progress = new function() { if(_windowLoading || _windowLoaded) { // already loading or loaded return false; } - _progressWindow = window.openDialog("chrome://scholar/chrome/ingester/progress.xul", + _progressWindow = window.openDialog("chrome://zotero/chrome/ingester/progress.xul", "", "chrome,dialog=no,titlebar=no,popup=yes"); _progressWindow.addEventListener("load", _onWindowLoaded, false); _windowLoading = true; @@ -364,7 +364,7 @@ Scholar_Ingester_Interface.Progress = new function() { function changeHeadline(headline) { if(_windowLoaded) { - _progressWindow.document.getElementById("scholar-progress-text-headline").value = headline; + _progressWindow.document.getElementById("zotero-progress-text-headline").value = headline; } else { _loadHeadline = headline; } @@ -374,21 +374,21 @@ Scholar_Ingester_Interface.Progress = new function() { if(_windowLoaded) { for(i in label) { var newLabel = _progressWindow.document.createElement("label"); - newLabel.setAttribute("class", "scholar-progress-item-label"); + newLabel.setAttribute("class", "zotero-progress-item-label"); newLabel.setAttribute("crop", "end"); newLabel.setAttribute("value", label[i]); var newImage = _progressWindow.document.createElement("image"); - newImage.setAttribute("class", "scholar-progress-item-icon"); + newImage.setAttribute("class", "zotero-progress-item-icon"); newImage.setAttribute("src", icon[i]); var newHB = _progressWindow.document.createElement("hbox"); - newHB.setAttribute("class", "scholar-progress-item-hbox"); + newHB.setAttribute("class", "zotero-progress-item-hbox"); newHB.setAttribute("valign", "center"); newHB.appendChild(newImage); newHB.appendChild(newLabel); - _progressWindow.document.getElementById("scholar-progress-text-box").appendChild(newHB); + _progressWindow.document.getElementById("zotero-progress-text-box").appendChild(newHB); } _move(); @@ -401,14 +401,14 @@ Scholar_Ingester_Interface.Progress = new function() { function addDescription(text) { if(_windowLoaded) { var newHB = _progressWindow.document.createElement("hbox"); - newHB.setAttribute("class", "scholar-progress-item-hbox"); + newHB.setAttribute("class", "zotero-progress-item-hbox"); var newDescription = _progressWindow.document.createElement("description"); - newDescription.setAttribute("class", "scholar-progress-description"); + newDescription.setAttribute("class", "zotero-progress-description"); var newText = _progressWindow.document.createTextNode(text); newDescription.appendChild(newText); newHB.appendChild(newDescription); - _progressWindow.document.getElementById("scholar-progress-text-box").appendChild(newHB); + _progressWindow.document.getElementById("zotero-progress-text-box").appendChild(newHB); _move(); } else { @@ -446,7 +446,7 @@ Scholar_Ingester_Interface.Progress = new function() { _loadDescription = null; _loadLines = new Array(); _loadIcons = new Array(); - _loadHeadline = Scholar.getString("ingester.scraping") + _loadHeadline = Zotero.getString("ingester.scraping") } function _move() { diff --git a/chrome/chromeFiles/content/scholar/ingester/browser.xul b/chrome/chromeFiles/content/scholar/ingester/browser.xul @@ -1,20 +1,20 @@ <?xml version="1.0"?> <!-- Note: Contains Firefox-specific overlay --> -<overlay id="scholar-ingester-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> +<overlay id="zotero-ingester-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="../include.js"/> <script src="browser.js"/> <script type="application/x-javascript"> - Scholar_Ingester_Interface.init(); + Zotero_Ingester_Interface.init(); </script> <hbox id="urlbar-icons"> <popupset> - <popup id="scholar-scrape-popup" onpopupshowing="Scholar_Ingester_Interface.showPopup(null, this)" onpopuphidden="Scholar_Ingester_Interface.hidePopup(null, this)"> + <popup id="zotero-scrape-popup" onpopupshowing="Zotero_Ingester_Interface.showPopup(null, this)" onpopuphidden="Zotero_Ingester_Interface.hidePopup(null, this)"> </popup> </popupset> - <image src="chrome://scholar/skin/treeitem-book.png" id="scholar-status-image" onclick="Scholar_Ingester_Interface.scrapeThisPage()" position="1" hidden="true" context="scholar-scrape-popup" /> + <image src="chrome://zotero/skin/treeitem-book.png" id="zotero-status-image" onclick="Zotero_Ingester_Interface.scrapeThisPage()" position="1" hidden="true" context="zotero-scrape-popup" /> </hbox> </overlay> diff --git a/chrome/chromeFiles/content/scholar/ingester/progress.xul b/chrome/chromeFiles/content/scholar/ingester/progress.xul @@ -1,18 +1,18 @@ <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> -<window id="scholar-progress-window" +<window id="zotero-progress-window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" windowtype="alert:alert" align="start"> - <hbox id="scholar-progress-box"> - <vbox id="scholar-progress-text-box"> - <label id="scholar-progress-text-headline" style="font-weight: bold;" /> + <hbox id="zotero-progress-box"> + <vbox id="zotero-progress-text-box"> + <label id="zotero-progress-text-headline" style="font-weight: bold;" /> </vbox> </hbox> diff --git a/chrome/chromeFiles/content/scholar/ingester/selectitems.js b/chrome/chromeFiles/content/scholar/ingester/selectitems.js @@ -1,16 +1,16 @@ ////////////////////////////////////////////////////////////////////////////// // -// Scholar_Ingester_Interface_SelectItems +// Zotero_Ingester_Interface_SelectItems // ////////////////////////////////////////////////////////////////////////////// // Class to interface with the browser when ingesting data -var Scholar_Ingester_Interface_SelectItems = function() {} +var Zotero_Ingester_Interface_SelectItems = function() {} ////////////////////////////////////////////////////////////////////////////// // -// Public Scholar_Ingester_Interface_SelectItems methods +// Public Zotero_Ingester_Interface_SelectItems methods // ////////////////////////////////////////////////////////////////////////////// @@ -18,10 +18,10 @@ var Scholar_Ingester_Interface_SelectItems = function() {} * Initialize some variables and prepare event listeners for when chrome is done * loading */ -Scholar_Ingester_Interface_SelectItems.init = function() { +Zotero_Ingester_Interface_SelectItems.init = function() { this.io = window.arguments[0]; - this.Scholar_Ingester_Interface = window.arguments[1]; - var listbox = document.getElementById("scholar-selectitems-links"); + this.Zotero_Ingester_Interface = window.arguments[1]; + var listbox = document.getElementById("zotero-selectitems-links"); for(i in this.io.dataIn) { // we could use a tree for this if we wanted to var itemNode = document.createElement("listitem"); @@ -33,8 +33,8 @@ Scholar_Ingester_Interface_SelectItems.init = function() { } } -Scholar_Ingester_Interface_SelectItems.acceptSelection = function() { - var listbox = document.getElementById("scholar-selectitems-links"); +Zotero_Ingester_Interface_SelectItems.acceptSelection = function() { + var listbox = document.getElementById("zotero-selectitems-links"); var returnObject = false; this.io.dataOut = new Object(); diff --git a/chrome/chromeFiles/content/scholar/ingester/selectitems.xul b/chrome/chromeFiles/content/scholar/ingester/selectitems.xul @@ -3,20 +3,20 @@ Borrowed from Linky, originally MPL/GPL/LGPL (now GPL, and modified into oblivion) --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <dialog xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="&selectitems.title;" width="400" height="330" persist="width height screenX screenY" buttons="cancel,accept" - ondialogaccept="Scholar_Ingester_Interface_SelectItems.acceptSelection()" - id="scholar-selectitems" - onload="Scholar_Ingester_Interface_SelectItems.init()"> + ondialogaccept="Zotero_Ingester_Interface_SelectItems.acceptSelection()" + id="zotero-selectitems" + onload="Zotero_Ingester_Interface_SelectItems.init()"> <script src="../include.js"/> <script src="selectitems.js"/> - <caption label="&selectitems.intro.label;" id="scholar-selectitems-intro"/> + <caption label="&selectitems.intro.label;" id="zotero-selectitems-intro"/> <box flex="1"> - <listbox id="scholar-selectitems-links" flex="1" context="scholarSelectContext"></listbox> + <listbox id="zotero-selectitems-links" flex="1" context="zoteroSelectContext"></listbox> </box> </dialog> \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/integrationDocPrefs.xul b/chrome/chromeFiles/content/scholar/integrationDocPrefs.xul @@ -1,11 +1,11 @@ <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="&integration.docPrefs.title;" buttons="accept" - ondialogaccept="Scholar_File_Interface_Bibliography.acceptSelection()" - id="scholar-bibliography" - onload="Scholar_File_Interface_Bibliography.init()"> + ondialogaccept="Zotero_File_Interface_Bibliography.acceptSelection()" + id="zotero-bibliography" + onload="Zotero_File_Interface_Bibliography.init()"> <script src="include.js"/> <script src="bibliography.js"/> diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js @@ -4,7 +4,7 @@ http://chnm.gmu.edu/ */ -var ScholarItemPane = new function() +var ZoteroItemPane = new function() { var _dynamicFields; var _creatorTypeMenu; @@ -29,11 +29,11 @@ var ScholarItemPane = new function() var _tabIndexMaxTagsFields = 0; const _defaultFirstName = - '(' + Scholar.getString('pane.item.defaultFirstName') + ')'; + '(' + Zotero.getString('pane.item.defaultFirstName') + ')'; const _defaultLastName = - '(' + Scholar.getString('pane.item.defaultLastName') + ')'; + '(' + Zotero.getString('pane.item.defaultLastName') + ')'; const _defaultFullName = - '(' + Scholar.getString('pane.item.defaultFullName') + ')'; + '(' + Zotero.getString('pane.item.defaultFullName') + ')'; this.onLoad = onLoad; this.viewItem = viewItem; @@ -60,7 +60,7 @@ var ScholarItemPane = new function() function onLoad() { - _tabs = document.getElementById('scholar-view-tabs'); + _tabs = document.getElementById('zotero-view-tabs'); // Not in item pane, so skip the introductions if (!_tabs) @@ -78,21 +78,21 @@ var ScholarItemPane = new function() _tagsBox = document.getElementById('editpane-tags'); _relatedBox = document.getElementById('editpane-related'); - var creatorTypes = Scholar.CreatorTypes.getTypes(); + var creatorTypes = Zotero.CreatorTypes.getTypes(); for(var i = 0; i < creatorTypes.length; i++) { var menuitem = document.createElement("menuitem"); - menuitem.setAttribute("label",Scholar.getString('creatorTypes.'+creatorTypes[i]['name'])); + menuitem.setAttribute("label",Zotero.getString('creatorTypes.'+creatorTypes[i]['name'])); menuitem.setAttribute("typeid",creatorTypes[i]['id']); if(creatorTypes[i]['id'] == 0) menuitem.setAttribute("selected",true); _creatorTypeMenu.appendChild(menuitem); } - var itemTypes = Scholar.ItemTypes.getTypes(); + var itemTypes = Zotero.ItemTypes.getTypes(); for(var i = 0; i<itemTypes.length; i++) if(itemTypes[i]['name'] != 'note' && itemTypes[i]['name'] != 'attachment') - _itemTypeMenu.appendItem(Scholar.getString("itemTypes."+itemTypes[i]['name']),itemTypes[i]['id']); + _itemTypeMenu.appendItem(Zotero.getString("itemTypes."+itemTypes[i]['name']),itemTypes[i]['id']); return true; } @@ -102,7 +102,7 @@ var ScholarItemPane = new function() */ function viewItem(thisItem) { - //Scholar.debug('Viewing item'); + //Zotero.debug('Viewing item'); // Force blur() when clicking off a textbox to another item in middle // pane, since for some reason it's not being called automatically @@ -136,7 +136,7 @@ var ScholarItemPane = new function() function loadPane(index) { - //Scholar.debug('Loading item pane ' + index); + //Zotero.debug('Loading item pane ' + index); // Clear the tab index when switching panes if (_lastPane!=index) @@ -175,10 +175,10 @@ var ScholarItemPane = new function() switch (_itemBeingEdited.getType()) { // DEBUG: handle descendents of these types as well? - case Scholar.ItemTypes.getID('book'): - case Scholar.ItemTypes.getID('bookSection'): - case Scholar.ItemTypes.getID('journalArticle'): - case Scholar.ItemTypes.getID('thesis'): + case Zotero.ItemTypes.getID('book'): + case Zotero.ItemTypes.getID('bookSection'): + case Zotero.ItemTypes.getID('journalArticle'): + case Zotero.ItemTypes.getID('thesis'): var openURL = true; break; @@ -195,9 +195,9 @@ var ScholarItemPane = new function() _itemTypeMenu.selectedIndex = i; var fieldNames = new Array("title"); - var fields = Scholar.ItemFields.getItemTypeFields(_itemBeingEdited.getField("itemTypeID")); + var fields = Zotero.ItemFields.getItemTypeFields(_itemBeingEdited.getField("itemTypeID")); for(var i = 0; i<fields.length; i++) - fieldNames.push(Scholar.ItemFields.getName(fields[i])); + fieldNames.push(Zotero.ItemFields.getName(fields[i])); fieldNames.push("dateAdded","dateModified"); for(var i = 0; i<fieldNames.length; i++) @@ -209,7 +209,7 @@ var ScholarItemPane = new function() // Convert dates from UTC if (fieldNames[i]=='dateAdded' || fieldNames[i]=='dateModified' || fieldNames[i]=='accessDate'){ - var date = Scholar.Date.sqlToDate(val, true); + var date = Zotero.Date.sqlToDate(val, true); val = date ? date.toLocaleString() : ''; } @@ -223,7 +223,7 @@ var ScholarItemPane = new function() _tabIndexMaxInfoFields = Math.max(_tabIndexMaxInfoFields, tabindex); var label = document.createElement("label"); - label.setAttribute("value",Scholar.getString("itemFields."+fieldNames[i])+":"); + label.setAttribute("value",Zotero.getString("itemFields."+fieldNames[i])+":"); label.setAttribute("onclick","this.nextSibling.blur();"); addDynamicRow(label,valueElement); @@ -256,13 +256,13 @@ var ScholarItemPane = new function() while(_notesList.hasChildNodes()) _notesList.removeChild(_notesList.firstChild); - var notes = Scholar.Items.get(_itemBeingEdited.getNotes()); + var notes = Zotero.Items.get(_itemBeingEdited.getNotes()); if(notes.length) { for(var i = 0; i < notes.length; i++) { var icon = document.createElement('image'); - icon.setAttribute('src','chrome://scholar/skin/treeitem-note.png'); + icon.setAttribute('src','chrome://zotero/skin/treeitem-note.png'); var label = document.createElement('label'); label.setAttribute('value',_noteToTitle(notes[i].getNote())); @@ -270,7 +270,7 @@ var ScholarItemPane = new function() label.setAttribute('crop','end'); var box = document.createElement('box'); - box.setAttribute('onclick',"ScholarPane.selectItem("+notes[i].getID()+");"); + box.setAttribute('onclick',"ZoteroPane.selectItem("+notes[i].getID()+");"); box.setAttribute('class','clicky'); box.appendChild(icon); box.appendChild(label); @@ -278,7 +278,7 @@ var ScholarItemPane = new function() var removeButton = document.createElement('label'); removeButton.setAttribute("value","-"); removeButton.setAttribute("class","clicky"); - removeButton.setAttribute("onclick","ScholarItemPane.removeNote("+notes[i].getID()+")"); + removeButton.setAttribute("onclick","ZoteroItemPane.removeNote("+notes[i].getID()+")"); var row = document.createElement('row'); row.appendChild(box); @@ -297,30 +297,30 @@ var ScholarItemPane = new function() while(_attachmentsList.hasChildNodes()) _attachmentsList.removeChild(_attachmentsList.firstChild); - var attachments = Scholar.Items.get(_itemBeingEdited.getAttachments()); + var attachments = Zotero.Items.get(_itemBeingEdited.getAttachments()); if(attachments.length) { for(var i = 0; i < attachments.length; i++) { var icon = document.createElement('image'); var linkMode = attachments[i].getAttachmentLinkMode(); - if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_FILE) + if(linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) { itemType = "-file"; } - else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_FILE) + else if(linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) { itemType = "-link"; } - else if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL) + else if(linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL) { itemType = "-snapshot"; } - else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_URL) + else if(linkMode == Zotero.Attachments.LINK_MODE_LINKED_URL) { itemType = "-web-link"; } - icon.setAttribute('src','chrome://scholar/skin/treeitem-file'+itemType+'.png'); + icon.setAttribute('src','chrome://zotero/skin/treeitem-file'+itemType+'.png'); var label = document.createElement('label'); label.setAttribute('value',attachments[i].getField('title')); @@ -328,7 +328,7 @@ var ScholarItemPane = new function() label.setAttribute('crop','end'); var box = document.createElement('box'); - box.setAttribute('onclick',"ScholarPane.selectItem('"+attachments[i].getID()+"')"); + box.setAttribute('onclick',"ZoteroPane.selectItem('"+attachments[i].getID()+"')"); box.setAttribute('class','clicky'); box.appendChild(icon); box.appendChild(label); @@ -336,7 +336,7 @@ var ScholarItemPane = new function() var removeButton = document.createElement('label'); removeButton.setAttribute("value","-"); removeButton.setAttribute("class","clicky"); - removeButton.setAttribute("onclick","ScholarItemPane.removeAttachment("+attachments[i].getID()+")"); + removeButton.setAttribute("onclick","ZoteroItemPane.removeAttachment("+attachments[i].getID()+")"); var row = document.createElement('row'); row.appendChild(box); @@ -374,7 +374,7 @@ var ScholarItemPane = new function() function changeTypeTo(id) { - if(id != _itemBeingEdited.getType() && confirm(Scholar.getString('pane.item.changeType'))) + if(id != _itemBeingEdited.getType() && confirm(Zotero.getString('pane.item.changeType'))) { _itemBeingEdited.setType(id); _itemBeingEdited.save(); @@ -389,10 +389,10 @@ var ScholarItemPane = new function() function onOpenURLClick() { - var url = Scholar.OpenURL.resolve(_itemBeingEdited); + var url = Zotero.OpenURL.resolve(_itemBeingEdited); if (url) { - window.loadURI(Scholar.OpenURL.resolve(_itemBeingEdited)); + window.loadURI(Zotero.OpenURL.resolve(_itemBeingEdited)); } } @@ -412,7 +412,7 @@ var ScholarItemPane = new function() // Disable the "+" button on previous rows var elems = _dynamicFields.getElementsByAttribute('value', '+'); if (elems.length){ - ScholarItemPane.disableButton(elems[elems.length-1]); + ZoteroItemPane.disableButton(elems[elems.length-1]); } if (singleField) @@ -435,7 +435,7 @@ var ScholarItemPane = new function() } var label = document.createElement("label"); - label.setAttribute("value",Scholar.getString('creatorTypes.'+Scholar.CreatorTypes.getName(typeID))+":"); + label.setAttribute("value",Zotero.getString('creatorTypes.'+Zotero.CreatorTypes.getName(typeID))+":"); label.setAttribute("popup","creatorTypeMenu"); label.setAttribute("fieldname",'creator-'+_creatorCount+'-typeID'); label.className = 'clicky'; @@ -493,7 +493,7 @@ var ScholarItemPane = new function() } else { removeButton.setAttribute("class","clicky"); - removeButton.setAttribute("onclick","ScholarItemPane.removeCreator("+_creatorCount+", this.parentNode.parentNode)"); + removeButton.setAttribute("onclick","ZoteroItemPane.removeCreator("+_creatorCount+", this.parentNode.parentNode)"); } hbox.appendChild(removeButton); @@ -539,10 +539,10 @@ var ScholarItemPane = new function() // Switch to single-field mode if (singleField) { - button.setAttribute('image', 'chrome://scholar/skin/textfield-dual.png'); + button.setAttribute('image', 'chrome://zotero/skin/textfield-dual.png'); button.setAttribute('tooltiptext', 'Switch to two fields'); lastName.setAttribute('singleField', 'true'); - button.setAttribute('onclick', "ScholarItemPane.switchCreatorMode(this.parentNode.parentNode, false)"); + button.setAttribute('onclick', "ZoteroItemPane.switchCreatorMode(this.parentNode.parentNode, false)"); // Remove firstname field from tabindex var tab = parseInt(firstName.getAttribute('tabindex')); @@ -570,10 +570,10 @@ var ScholarItemPane = new function() // Switch to two-field mode else { - button.setAttribute('image', 'chrome://scholar/skin/textfield-single.png'); + button.setAttribute('image', 'chrome://zotero/skin/textfield-single.png'); button.setAttribute('tooltiptext', 'Switch to single field'); lastName.setAttribute('singleField', 'false'); - button.setAttribute('onclick', "ScholarItemPane.switchCreatorMode(this.parentNode.parentNode, true)"); + button.setAttribute('onclick', "ZoteroItemPane.switchCreatorMode(this.parentNode.parentNode, true)"); // Add firstname field to tabindex var tab = parseInt(lastName.getAttribute('tabindex')); @@ -630,7 +630,7 @@ var ScholarItemPane = new function() { button.setAttribute('disabled', false); button.setAttribute("class","clicky"); - button.setAttribute("onclick","ScholarItemPane.disableButton(this); ScholarItemPane.addCreatorRow('','',1,false,true);"); + button.setAttribute("onclick","ZoteroItemPane.disableButton(this); ZoteroItemPane.addCreatorRow('','',1,false,true);"); } function createValueElement(valueText, fieldName, tabindex) @@ -648,7 +648,7 @@ var ScholarItemPane = new function() { valueElement.setAttribute('fieldname',fieldName); valueElement.setAttribute('tabindex', tabindex); - valueElement.setAttribute('onclick', 'ScholarItemPane.showEditor(this)'); + valueElement.setAttribute('onclick', 'ZoteroItemPane.showEditor(this)'); valueElement.className = 'clicky'; if (fieldName=='tag') @@ -706,7 +706,7 @@ var ScholarItemPane = new function() function showEditor(elem) { - //Scholar.debug('Showing editor'); + //Zotero.debug('Showing editor'); var fieldName = elem.getAttribute('fieldname'); var tabindex = elem.getAttribute('tabindex'); @@ -721,8 +721,8 @@ var ScholarItemPane = new function() else if (fieldName=='tag') { var tagID = elem.parentNode.getAttribute('id').split('-')[1]; - var value = tagID ? Scholar.Tags.getName(tagID) : ''; - var itemID = Scholar.getAncestorByTagName(elem, 'tagsbox').item.getID(); + var value = tagID ? Zotero.Tags.getName(tagID) : ''; + var itemID = Zotero.getAncestorByTagName(elem, 'tagsbox').item.getID(); } else { @@ -779,8 +779,8 @@ var ScholarItemPane = new function() t.select(); - t.setAttribute('onblur',"ScholarItemPane.hideEditor(this, true)"); - t.setAttribute('onkeypress',"return ScholarItemPane.handleKeyPress(event)"); + t.setAttribute('onblur',"ZoteroItemPane.hideEditor(this, true)"); + t.setAttribute('onkeypress',"return ZoteroItemPane.handleKeyPress(event)"); _tabDirection = false; _lastTabIndex = tabindex; @@ -827,10 +827,10 @@ var ScholarItemPane = new function() function hideEditor(t, saveChanges) { - //Scholar.debug('Hiding editor'); - var textbox = Scholar.getAncestorByTagName(t, 'textbox'); + //Zotero.debug('Hiding editor'); + var textbox = Zotero.getAncestorByTagName(t, 'textbox'); if (!textbox){ - Scholar.debug('Textbox not found in hideEditor'); + Zotero.debug('Textbox not found in hideEditor'); return; } var fieldName = textbox.getAttribute('fieldname'); @@ -883,10 +883,10 @@ var ScholarItemPane = new function() // Tags else if (fieldName=='tag') { - var tagsbox = Scholar.getAncestorByTagName(textbox, 'tagsbox'); + var tagsbox = Zotero.getAncestorByTagName(textbox, 'tagsbox'); if (!tagsbox) { - Scholar.debug('Tagsbox not found', 1); + Zotero.debug('Tagsbox not found', 1); return; } @@ -906,7 +906,7 @@ var ScholarItemPane = new function() // (which causes a delete of the row), // clear the tab direction so we don't advance // when the notifier kicks in - var existing = Scholar.Tags.getID(value); + var existing = Zotero.Tags.getID(value); if (existing && id != existing) { _tabDirection = false; @@ -1003,7 +1003,7 @@ var ScholarItemPane = new function() : label1.value, firstName: label2.firstChild ? label2.firstChild.nodeValue : label2.value, - typeID: Scholar.CreatorTypes.getID(type.substr(0, type.length-1).toLowerCase()), + typeID: Zotero.CreatorTypes.getID(type.substr(0, type.length-1).toLowerCase()), singleField: label1.getAttribute('singleField') == 'true' } } @@ -1059,15 +1059,15 @@ var ScholarItemPane = new function() function removeNote(id) { - var note = Scholar.Items.get(id); + var note = Zotero.Items.get(id); if(note) - if(confirm(Scholar.getString('pane.item.notes.delete.confirm'))) + if(confirm(Zotero.getString('pane.item.notes.delete.confirm'))) note.erase(); } function addNote() { - ScholarPane.openNoteWindow(_itemBeingEdited.getID()); + ZoteroPane.openNoteWindow(_itemBeingEdited.getID()); } function _noteToTitle(text) @@ -1083,7 +1083,7 @@ var ScholarItemPane = new function() if(t == "") { - return Scholar.getString('pane.item.notes.untitled'); + return Zotero.getString('pane.item.notes.untitled'); } else { @@ -1095,32 +1095,32 @@ var ScholarItemPane = new function() { var c = _notesList.childNodes.length; - _notesLabel.value = Scholar.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":"; + _notesLabel.value = Zotero.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":"; } function _updateAttachmentCount() { var c = _attachmentsList.childNodes.length; - _attachmentsLabel.value = Scholar.getString('pane.item.attachments.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":"; + _attachmentsLabel.value = Zotero.getString('pane.item.attachments.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":"; } function removeAttachment(id) { - var attachment = Scholar.Items.get(id); + var attachment = Zotero.Items.get(id); if(attachment) - if(confirm(Scholar.getString('pane.item.attachments.delete.confirm'))) + if(confirm(Zotero.getString('pane.item.attachments.delete.confirm'))) attachment.erase(); } function addAttachmentFromDialog(link) { - ScholarPane.addAttachmentFromDialog(link, _itemBeingEdited.getID()); + ZoteroPane.addAttachmentFromDialog(link, _itemBeingEdited.getID()); } function addAttachmentFromPage(link) { - ScholarPane.addAttachmentFromPage(link, _itemBeingEdited.getID()); + ZoteroPane.addAttachmentFromPage(link, _itemBeingEdited.getID()); } @@ -1143,7 +1143,7 @@ var ScholarItemPane = new function() switch (tabindex) { case 1: - //Scholar.debug('At beginning'); + //Zotero.debug('At beginning'); return false; case _tabIndexMinCreators: @@ -1185,7 +1185,7 @@ var ScholarItemPane = new function() break; case _tabIndexMaxInfoFields: - //Scholar.debug('At end'); + //Zotero.debug('At end'); return false; default: @@ -1207,14 +1207,14 @@ var ScholarItemPane = new function() } } - Scholar.debug('Looking for tabindex ' + nextIndex, 4); + Zotero.debug('Looking for tabindex ' + nextIndex, 4); switch (mode) { case 'info': var next = box.getElementsByAttribute('tabindex', nextIndex); if (!next[0]) { - //Scholar.debug("Next field not found"); + //Zotero.debug("Next field not found"); return _focusNextField(mode, box, nextIndex, back); } break; @@ -1234,4 +1234,4 @@ var ScholarItemPane = new function() } } -addEventListener("load", function(e) { ScholarItemPane.onLoad(e); }, false); +addEventListener("load", function(e) { ZoteroItemPane.onLoad(e); }, false); diff --git a/chrome/chromeFiles/content/scholar/itemPane.xul b/chrome/chromeFiles/content/scholar/itemPane.xul @@ -4,29 +4,29 @@ Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA http://chnm.gmu.edu/ --> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="itemPane.js"/> - <deck id="scholar-view-item" flex="1" onselect="if (this.selectedIndex!==''){ ScholarItemPane.loadPane(this.selectedIndex) }"> - <vbox id="scholar-info" flex="1"> + <deck id="zotero-view-item" flex="1" onselect="if (this.selectedIndex!==''){ ZoteroItemPane.loadPane(this.selectedIndex) }"> + <vbox id="zotero-info" flex="1"> <popupset> <popup id="creatorTypeMenu" position="after_start" - oncommand="var otherFields = ScholarItemPane.getCreatorFields(document.popupNode.parentNode); + oncommand="var otherFields = ZoteroItemPane.getCreatorFields(document.popupNode.parentNode); var typeID = event.explicitOriginalTarget.getAttribute('typeid'); document.popupNode.setAttribute('value', - Scholar.getString('creatorTypes.' + Scholar.CreatorTypes.getName(typeID)) + ':'); - ScholarItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1], + Zotero.getString('creatorTypes.' + Zotero.CreatorTypes.getName(typeID)) + ':'); + ZoteroItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1], 'typeID', typeID, otherFields)"/> </popupset> <hbox align="center"> - <button id="tb-go-to-url" label="&toolbar.goToURL.label;" tooltiptext="&toolbar.goToURL.tooltip;" flex="1" oncommand="ScholarItemPane.onGoToURLClick();" disabled="false"/> - <button id="tb-openurl" label="&toolbar.openURL.label;" tooltiptext="&toolbar.openURL.tooltip;" flex="1" oncommand="ScholarItemPane.onOpenURLClick();"/> + <button id="tb-go-to-url" label="&toolbar.goToURL.label;" tooltiptext="&toolbar.goToURL.tooltip;" flex="1" oncommand="ZoteroItemPane.onGoToURLClick();" disabled="false"/> + <button id="tb-openurl" label="&toolbar.openURL.label;" tooltiptext="&toolbar.openURL.tooltip;" flex="1" oncommand="ZoteroItemPane.onOpenURLClick();"/> </hbox> <hbox align="center"> - <menulist id="editpane-type-menu" oncommand="ScholarItemPane.changeTypeTo(this.value)" flex="1"> + <menulist id="editpane-type-menu" oncommand="ZoteroItemPane.changeTypeTo(this.value)" flex="1"> <menupopup/> </menulist> </hbox> @@ -41,7 +41,7 @@ <vbox flex="1"> <hbox align="center"> <label id="editpane-notes-label"/> - <button label="&item.add;" oncommand="ScholarItemPane.addNote();"/> + <button label="&item.add;" oncommand="ZoteroItemPane.addNote();"/> </hbox> <grid flex="1"> <columns> @@ -56,10 +56,10 @@ <label id="editpane-attachments-label"/> <button id="tb-item-attachments-add" type="menu" label="&item.add;"> <menupopup> - <menuitem class="menuitem-iconic" id="tb-item-attachments-link" label="&toolbar.attachment.linked;" oncommand="ScholarItemPane.addAttachmentFromDialog(true);"/> - <menuitem class="menuitem-iconic" id="tb-item-attachments-file" label="&toolbar.attachment.add;" oncommand="ScholarItemPane.addAttachmentFromDialog();"/> - <menuitem class="menuitem-iconic" id="tb-item-attachments-web-link" label="&toolbar.attachment.weblink;" oncommand="ScholarItemPane.addAttachmentFromPage(true);"/> - <menuitem class="menuitem-iconic" id="tb-item-attachments-snapshot" label="&toolbar.attachment.snapshot;" oncommand="ScholarItemPane.addAttachmentFromPage();"/> + <menuitem class="menuitem-iconic" id="tb-item-attachments-link" label="&toolbar.attachment.linked;" oncommand="ZoteroItemPane.addAttachmentFromDialog(true);"/> + <menuitem class="menuitem-iconic" id="tb-item-attachments-file" label="&toolbar.attachment.add;" oncommand="ZoteroItemPane.addAttachmentFromDialog();"/> + <menuitem class="menuitem-iconic" id="tb-item-attachments-web-link" label="&toolbar.attachment.weblink;" oncommand="ZoteroItemPane.addAttachmentFromPage(true);"/> + <menuitem class="menuitem-iconic" id="tb-item-attachments-snapshot" label="&toolbar.attachment.snapshot;" oncommand="ZoteroItemPane.addAttachmentFromPage();"/> </menupopup> </button> </hbox> diff --git a/chrome/chromeFiles/content/scholar/note.js b/chrome/chromeFiles/content/scholar/note.js @@ -25,7 +25,7 @@ function onLoad() if(id && id != '' && id != 'undefined') { - var ref = Scholar.Items.get(id); + var ref = Zotero.Items.get(id); if(ref.isNote()) { noteEditor.note = ref; @@ -41,10 +41,10 @@ function onLoad() { window.title = "Add Note"; if(collectionID && collectionID != '' && collectionID != 'undefined') - noteEditor.collection = Scholar.Collections.get(collectionID); + noteEditor.collection = Zotero.Collections.get(collectionID); } - notifierUnregisterID = Scholar.Notifier.registerItemTree(NotifyCallback); + notifierUnregisterID = Zotero.Notifier.registerItemTree(NotifyCallback); } function onUnload() @@ -52,7 +52,7 @@ function onUnload() if(noteEditor && noteEditor.value) noteEditor.save(); - Scholar.Notifier.unregisterItemTree(notifierUnregisterID); + Zotero.Notifier.unregisterItemTree(notifierUnregisterID); } var NotifyCallback = { diff --git a/chrome/chromeFiles/content/scholar/note.xul b/chrome/chromeFiles/content/scholar/note.xul @@ -5,10 +5,10 @@ http://chnm.gmu.edu/ --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> <window - id="scholar-note-window" + id="zotero-note-window" orient="vertical" width="400" height="250" diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js @@ -7,7 +7,7 @@ /* * This object contains the various functions for the interface */ -var ScholarPane = new function() +var ZoteroPane = new function() { var collectionsView; var itemsView; @@ -48,14 +48,14 @@ var ScholarPane = new function() */ function onLoad() { - if(Scholar.Prefs.get("scholarPaneOnTop")) + if(Zotero.Prefs.get("zoteroPaneOnTop")) { - var oldPane = document.getElementById('scholar-pane'); - var oldSplitter = document.getElementById('scholar-splitter'); + var oldPane = document.getElementById('zotero-pane'); + var oldSplitter = document.getElementById('zotero-splitter'); var appContent = document.getElementById('appcontent'); var newPane = document.createElement('hbox'); - newPane.setAttribute('id','scholar-pane'); + newPane.setAttribute('id','zotero-pane'); newPane.setAttribute('collapsed',true); newPane.setAttribute('flex','1'); newPane.height = oldPane.height; @@ -65,44 +65,44 @@ var ScholarPane = new function() appContent.insertBefore(newPane, document.getElementById('content')); var newSplitter = document.createElement('splitter'); - newSplitter.setAttribute('id','scholar-splitter'); + newSplitter.setAttribute('id','zotero-splitter'); newSplitter.setAttribute('collapsed',true); newSplitter.setAttribute('resizebefore','closest'); newSplitter.setAttribute('resizeafter','closest'); appContent.removeChild(oldSplitter); appContent.insertBefore(newSplitter, document.getElementById('content')); - document.getElementById('tb-fullscreen').setAttribute('scholartop','true'); + document.getElementById('tb-fullscreen').setAttribute('zoterotop','true'); } //Initialize collections view - collectionsView = new Scholar.CollectionTreeView(); + collectionsView = new Zotero.CollectionTreeView(); var collectionsTree = document.getElementById('collections-tree'); collectionsTree.view = collectionsView; - collectionsTree.controllers.appendController(new Scholar.CollectionTreeCommandController(collectionsTree)); + collectionsTree.controllers.appendController(new Zotero.CollectionTreeCommandController(collectionsTree)); var itemsTree = document.getElementById('items-tree'); - itemsTree.controllers.appendController(new Scholar.ItemTreeCommandController(itemsTree)); + itemsTree.controllers.appendController(new Zotero.ItemTreeCommandController(itemsTree)); // Create the New Item (+) menu with each item type var addMenu = document.getElementById('tb-add').firstChild; var separator = document.getElementById('tb-add').firstChild.firstChild; var moreMenu = document.getElementById('tb-add-more'); - var itemTypes = Scholar.ItemTypes.getPrimaryTypes(); + var itemTypes = Zotero.ItemTypes.getPrimaryTypes(); for(var i = 0; i<itemTypes.length; i++) { var menuitem = document.createElement("menuitem"); - menuitem.setAttribute("label", Scholar.getString("itemTypes."+itemTypes[i]['name'])); - menuitem.setAttribute("oncommand","ScholarPane.newItem("+itemTypes[i]['id']+")"); + menuitem.setAttribute("label", Zotero.getString("itemTypes."+itemTypes[i]['name'])); + menuitem.setAttribute("oncommand","ZoteroPane.newItem("+itemTypes[i]['id']+")"); addMenu.insertBefore(menuitem, separator); } // Create submenu for secondary item types - var itemTypes = Scholar.ItemTypes.getSecondaryTypes(); + var itemTypes = Zotero.ItemTypes.getSecondaryTypes(); for(var i = 0; i<itemTypes.length; i++) { var menuitem = document.createElement("menuitem"); - menuitem.setAttribute("label", Scholar.getString("itemTypes."+itemTypes[i]['name'])); - menuitem.setAttribute("oncommand","ScholarPane.newItem("+itemTypes[i]['id']+")"); + menuitem.setAttribute("label", Zotero.getString("itemTypes."+itemTypes[i]['name'])); + menuitem.setAttribute("oncommand","ZoteroPane.newItem("+itemTypes[i]['id']+")"); moreMenu.appendChild(menuitem); } } @@ -118,14 +118,14 @@ var ScholarPane = new function() } /* - * Hides/displays the Scholar interface + * Hides/displays the Zotero interface */ function toggleDisplay() { - var visible = document.getElementById('scholar-pane').getAttribute('collapsed') == 'true'; + var visible = document.getElementById('zotero-pane').getAttribute('collapsed') == 'true'; - document.getElementById('scholar-pane').setAttribute('collapsed',!visible); - document.getElementById('scholar-splitter').setAttribute('collapsed',!visible); + document.getElementById('zotero-pane').setAttribute('collapsed',!visible); + document.getElementById('zotero-splitter').setAttribute('collapsed',!visible); if(!visible) { @@ -138,7 +138,7 @@ var ScholarPane = new function() { var visible = document.getElementById('content').getAttribute('collapsed') == 'true'; document.getElementById('content').setAttribute('collapsed', !visible); - document.getElementById('scholar-splitter').setAttribute('collapsed', !visible); + document.getElementById('zotero-splitter').setAttribute('collapsed', !visible); document.getElementById('tb-fullscreen').setAttribute('fullscreenmode', !visible); } @@ -149,7 +149,7 @@ var ScholarPane = new function() */ function newItem(typeID, data) { - var item = new Scholar.Item(typeID); + var item = new Zotero.Item(typeID); for (var i in data) { @@ -161,7 +161,7 @@ var ScholarPane = new function() itemsView._itemGroup.ref.addItem(item.getID()); //set to Info tab - document.getElementById('scholar-view-item').selectedIndex = 0; + document.getElementById('zotero-view-item').selectedIndex = 0; return item; } @@ -171,13 +171,13 @@ var ScholarPane = new function() var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); - var untitled = Scholar.getString('pane.collections.untitled'); - untitled = Scholar.DB.getNextName('collections', 'collectionName', - Scholar.getString('pane.collections.untitled')); + var untitled = Zotero.getString('pane.collections.untitled'); + untitled = Zotero.DB.getNextName('collections', 'collectionName', + Zotero.getString('pane.collections.untitled')); var newName = { value: untitled }; var result = promptService.prompt(window, "", - Scholar.getString('pane.collections.name'), newName, "", {}); + Zotero.getString('pane.collections.name'), newName, "", {}); if (!result) { @@ -189,19 +189,19 @@ var ScholarPane = new function() newName.value = untitled; } - Scholar.Collections.add(newName.value); + Zotero.Collections.add(newName.value); } function newSearch() { - var s = new Scholar.Search(); + var s = new Zotero.Search(); s.addCondition('title','contains',''); - var untitled = Scholar.getString('pane.collections.untitled'); - untitled = Scholar.DB.getNextName('savedSearches', 'savedSearchName', - Scholar.getString('pane.collections.untitled')); + var untitled = Zotero.getString('pane.collections.untitled'); + untitled = Zotero.DB.getNextName('savedSearches', 'savedSearchName', + Zotero.getString('pane.collections.untitled')); var io = {dataIn: {search: s, name: untitled}, dataOut: null}; - window.openDialog('chrome://scholar/content/searchDialog.xul','','chrome,modal',io); + window.openDialog('chrome://zotero/content/searchDialog.xul','','chrome,modal',io); } function onCollectionSelected() @@ -216,7 +216,7 @@ var ScholarPane = new function() var itemgroup = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); itemgroup.setSearch(''); - itemsView = new Scholar.ItemTreeView(itemgroup); + itemsView = new Zotero.ItemTreeView(itemgroup); document.getElementById('items-tree').view = itemsView; document.getElementById('tb-collection-rename').disabled = itemgroup.isLibrary(); itemsView.selection.clearSelection(); @@ -236,20 +236,20 @@ var ScholarPane = new function() if(item.isNote()) { - var noteEditor = document.getElementById('scholar-note-editor'); + var noteEditor = document.getElementById('zotero-note-editor'); noteEditor.item = null; noteEditor.note = item.ref; - document.getElementById('scholar-view-note-button').setAttribute('noteID',item.ref.getID()); + document.getElementById('zotero-view-note-button').setAttribute('noteID',item.ref.getID()); if(item.ref.getSource() != null) - document.getElementById('scholar-view-note-button').setAttribute('sourceID',item.ref.getSource()); + document.getElementById('zotero-view-note-button').setAttribute('sourceID',item.ref.getSource()); else - document.getElementById('scholar-view-note-button').removeAttribute('sourceID'); + document.getElementById('zotero-view-note-button').removeAttribute('sourceID'); document.getElementById('item-pane').selectedIndex = 2; } else if(item.isAttachment()) { // Wrap title to multiple lines if necessary - var label = document.getElementById('scholar-attachment-label'); + var label = document.getElementById('zotero-attachment-label'); while (label.hasChildNodes()) { label.removeChild(label.firstChild); @@ -269,43 +269,43 @@ var ScholarPane = new function() } // Metadata for URL's - if (item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_LINKED_URL - || item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_IMPORTED_URL) + if (item.ref.getAttachmentLinkMode() == Zotero.Attachments.LINK_MODE_LINKED_URL + || item.ref.getAttachmentLinkMode() == Zotero.Attachments.LINK_MODE_IMPORTED_URL) { // "View Page"/"View Snapshot" label - if (item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_IMPORTED_URL) + if (item.ref.getAttachmentLinkMode() == Zotero.Attachments.LINK_MODE_IMPORTED_URL) { - var str = Scholar.getString('pane.item.attachments.view.snapshot'); + var str = Zotero.getString('pane.item.attachments.view.snapshot'); } else { - var str = Scholar.getString('pane.item.attachments.view.link'); + var str = Zotero.getString('pane.item.attachments.view.link'); } - document.getElementById('scholar-attachment-show').setAttribute('hidden', true); + document.getElementById('zotero-attachment-show').setAttribute('hidden', true); // URL - document.getElementById('scholar-attachment-url').setAttribute('value', item.getField('url')); - document.getElementById('scholar-attachment-url').setAttribute('hidden', false); + document.getElementById('zotero-attachment-url').setAttribute('value', item.getField('url')); + document.getElementById('zotero-attachment-url').setAttribute('hidden', false); // Access date - document.getElementById('scholar-attachment-accessed').setAttribute('value', - Scholar.getString('itemFields.accessDate') + ': ' - + Scholar.Date.sqlToDate(item.getField('accessDate')).toLocaleString()); - document.getElementById('scholar-attachment-accessed').setAttribute('hidden', false); + document.getElementById('zotero-attachment-accessed').setAttribute('value', + Zotero.getString('itemFields.accessDate') + ': ' + + Zotero.Date.sqlToDate(item.getField('accessDate')).toLocaleString()); + document.getElementById('zotero-attachment-accessed').setAttribute('hidden', false); } // Metadata for files else { - var str = Scholar.getString('pane.item.attachments.view.file'); - document.getElementById('scholar-attachment-show').setAttribute('hidden', false); - document.getElementById('scholar-attachment-url').setAttribute('hidden', true); - document.getElementById('scholar-attachment-accessed').setAttribute('hidden', true); + var str = Zotero.getString('pane.item.attachments.view.file'); + document.getElementById('zotero-attachment-show').setAttribute('hidden', false); + document.getElementById('zotero-attachment-url').setAttribute('hidden', true); + document.getElementById('zotero-attachment-accessed').setAttribute('hidden', true); } - document.getElementById('scholar-attachment-view').setAttribute('label', str); + document.getElementById('zotero-attachment-view').setAttribute('label', str); - var noteEditor = document.getElementById('scholar-attachment-note-editor'); + var noteEditor = document.getElementById('zotero-attachment-note-editor'); noteEditor.item = null; noteEditor.note = item.ref; @@ -313,7 +313,7 @@ var ScholarPane = new function() } else { - ScholarItemPane.viewItem(item.ref); + ZoteroItemPane.viewItem(item.ref); document.getElementById('item-pane').selectedIndex = 1; } } @@ -321,12 +321,12 @@ var ScholarPane = new function() { document.getElementById('item-pane').selectedIndex = 0; - var label = document.getElementById('scholar-view-selected-label'); + var label = document.getElementById('zotero-view-selected-label'); if(itemsView && itemsView.selection.count) - label.value = Scholar.getString('pane.item.selected.multiple').replace('%1', itemsView.selection.count); + label.value = Zotero.getString('pane.item.selected.multiple').replace('%1', itemsView.selection.count); else - label.value = Scholar.getString('pane.item.selected.zero'); + label.value = Zotero.getString('pane.item.selected.zero'); } } @@ -371,9 +371,9 @@ var ScholarPane = new function() if (noPrompt || promptService.confirmCheck( window, - Scholar.getString('pane.items.delete.title'), - Scholar.getString('pane.items.delete' + (itemsView.selection.count>1 ? '.multiple' : '')), - hasChildren ? Scholar.getString('pane.items.delete.attached') : '', + Zotero.getString('pane.items.delete.title'), + Zotero.getString('pane.items.delete' + (itemsView.selection.count>1 ? '.multiple' : '')), + hasChildren ? Zotero.getString('pane.items.delete.attached') : '', eraseChildren)) { itemsView.deleteSelection(eraseChildren.value, force); @@ -390,14 +390,14 @@ var ScholarPane = new function() if (row.isCollection()) { - if (confirm(Scholar.getString('pane.collections.delete'))) + if (confirm(Zotero.getString('pane.collections.delete'))) { collectionsView.deleteSelection(); } } else if (row.isSearch()) { - if (confirm(Scholar.getString('pane.collections.deleteSearch'))) + if (confirm(Zotero.getString('pane.collections.deleteSearch'))) { collectionsView.deleteSelection(); } @@ -418,7 +418,7 @@ var ScholarPane = new function() var newName = { value: collection.getName() }; var result = promptService.prompt(window, "", - Scholar.getString('pane.collections.rename'), newName, "", {}); + Zotero.getString('pane.collections.rename'), newName, "", {}); if (result && newName.value) { @@ -427,10 +427,10 @@ var ScholarPane = new function() } else { - var s = new Scholar.Search(); + var s = new Zotero.Search(); s.load(collection.ref['id']); var io = {dataIn: {search: s, name: collection.getName()}, dataOut: null}; - window.openDialog('chrome://scholar/content/searchDialog.xul','','chrome,modal',io); + window.openDialog('chrome://zotero/content/searchDialog.xul','','chrome,modal',io); if(io.dataOut) onCollectionSelected(); //reload itemsView } @@ -467,11 +467,11 @@ var ScholarPane = new function() { //select the Library if the item is not in the current collection - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); var collectionID = itemsView._itemGroup.ref.getID(); if(!item.isRegularItem()) { - if(!Scholar.Items.get(item.getSource()).inCollection(collectionID)) + if(!Zotero.Items.get(item.getSource()).inCollection(collectionID)) collectionsView.selection.select(0); } else if(!item.inCollection(collectionID)) @@ -522,7 +522,7 @@ var ScholarPane = new function() function buildCollectionContextMenu() { - var menu = document.getElementById('scholar-collectionmenu'); + var menu = document.getElementById('zotero-collectionmenu'); // Collection if (collectionsView.selection.count == 1 && @@ -585,7 +585,7 @@ var ScholarPane = new function() function buildItemContextMenu() { - var menu = document.getElementById('scholar-itemmenu'); + var menu = document.getElementById('zotero-itemmenu'); if(itemsView && itemsView.selection.count > 0) { @@ -606,7 +606,7 @@ var ScholarPane = new function() if (itemsView._itemGroup.isCollection()) { - menu.childNodes[2].setAttribute('label', Scholar.getString('pane.items.menu.remove' + multiple)); + menu.childNodes[2].setAttribute('label', Zotero.getString('pane.items.menu.remove' + multiple)); menu.childNodes[2].setAttribute('hidden', false); } else @@ -614,9 +614,9 @@ var ScholarPane = new function() menu.childNodes[2].setAttribute('hidden', true); } - menu.childNodes[3].setAttribute('label', Scholar.getString('pane.items.menu.erase' + multiple)); - menu.childNodes[5].setAttribute('label', Scholar.getString('pane.items.menu.export' + multiple)); - menu.childNodes[6].setAttribute('label', Scholar.getString('pane.items.menu.createBib' + multiple)); + menu.childNodes[3].setAttribute('label', Zotero.getString('pane.items.menu.erase' + multiple)); + menu.childNodes[5].setAttribute('label', Zotero.getString('pane.items.menu.export' + multiple)); + menu.childNodes[6].setAttribute('label', Zotero.getString('pane.items.menu.createBib' + multiple)); } // Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9 @@ -633,7 +633,7 @@ var ScholarPane = new function() var item = getSelectedItems()[0]; if(item && item.isNote()) { - document.getElementById('scholar-view-note-button').doCommand(); + document.getElementById('zotero-view-note-button').doCommand(); } else if(item && item.isAttachment()) { @@ -647,8 +647,8 @@ var ScholarPane = new function() { if (!popup) { - var item = this.newItem(Scholar.ItemTypes.getID('note')); - document.getElementById('scholar-note-editor').focus(); + var item = this.newItem(Zotero.ItemTypes.getID('note')); + document.getElementById('zotero-note-editor').focus(); } else { @@ -666,7 +666,7 @@ var ScholarPane = new function() function openNoteWindow(id, parent) { - window.open('chrome://scholar/content/note.xul?v=1'+(id ? '&id='+id : '')+(parent ? '&coll='+parent : ''),'','chrome,resizable,centerscreen'); + window.open('chrome://zotero/content/note.xul?v=1'+(id ? '&id='+id : '')+(parent ? '&coll='+parent : ''),'','chrome,resizable,centerscreen'); } function addAttachmentFromDialog(link, id) @@ -674,15 +674,15 @@ var ScholarPane = new function() var nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); - fp.init(window, Scholar.getString('pane.item.attachments.select'), nsIFilePicker.modeOpen); + fp.init(window, Zotero.getString('pane.item.attachments.select'), nsIFilePicker.modeOpen); if(fp.show() == nsIFilePicker.returnOK) { var attachmentID; if(link) - attachmentID = Scholar.Attachments.linkFromFile(fp.file, id); + attachmentID = Zotero.Attachments.linkFromFile(fp.file, id); else - attachmentID = Scholar.Attachments.importFromFile(fp.file, id); + attachmentID = Zotero.Attachments.importFromFile(fp.file, id); if(attachmentID && !id) { @@ -702,7 +702,7 @@ var ScholarPane = new function() accessDate: "CURRENT_TIMESTAMP" } - newItem(Scholar.ItemTypes.getID('webpage'), data); + newItem(Zotero.ItemTypes.getID('webpage'), data); } @@ -711,12 +711,12 @@ var ScholarPane = new function() if(link) { var attachmentID = - Scholar.Attachments.linkFromDocument(window.content.document, id); + Zotero.Attachments.linkFromDocument(window.content.document, id); } else { var attachmentID = - Scholar.Attachments.importFromDocument(window.content.document, id); + Zotero.Attachments.importFromDocument(window.content.document, id); } if (attachmentID && itemsView && itemsView._itemGroup.isCollection()) @@ -732,10 +732,10 @@ var ScholarPane = new function() { var attachment = getSelectedItems()[0]; - if(attachment.getAttachmentLinkMode() != Scholar.Attachments.LINK_MODE_LINKED_URL) + if(attachment.getAttachmentLinkMode() != Zotero.Attachments.LINK_MODE_LINKED_URL) { var file = attachment.getFile(); - if (Scholar.MIME.fileHasInternalHandler(file)) + if (Zotero.MIME.fileHasInternalHandler(file)) { window.loadURI(attachment.getLocalFileURL()); } @@ -757,7 +757,7 @@ var ScholarPane = new function() { var attachment = getSelectedItems()[0]; - if (attachment.getAttachmentLinkMode() != Scholar.Attachments.LINK_MODE_LINKED_URL) + if (attachment.getAttachmentLinkMode() != Zotero.Attachments.LINK_MODE_LINKED_URL) { var file = attachment.getFile(); file.reveal(); @@ -766,5 +766,5 @@ var ScholarPane = new function() } } -window.addEventListener("load", function(e) { ScholarPane.onLoad(e); }, false); -window.addEventListener("unload", function(e) { ScholarPane.onUnload(e); }, false); -\ No newline at end of file +window.addEventListener("load", function(e) { ZoteroPane.onLoad(e); }, false); +window.addEventListener("unload", function(e) { ZoteroPane.onUnload(e); }, false); +\ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul @@ -4,10 +4,10 @@ Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA http://chnm.gmu.edu/ --> -<?xml-stylesheet href="chrome://scholar/skin/overlay.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> -<overlay id="scholar" +<overlay id="zotero" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <?xul-overlay href="itemPane.xul" ?> @@ -18,65 +18,65 @@ <script src="fileInterface.js"/> <commandset id="mainCommandSet"> - <command id="cmd_scholar_newItem" oncommand="ScholarPane.newItem(2);"/> - <command id="cmd_scholar_newCollection" oncommand="ScholarPane.newCollection();"/> - <command id="cmd_scholar_search" oncommand="ScholarPane.search();"/> + <command id="cmd_zotero_newItem" oncommand="ZoteroPane.newItem(2);"/> + <command id="cmd_zotero_newCollection" oncommand="ZoteroPane.newCollection();"/> + <command id="cmd_zotero_search" oncommand="ZoteroPane.search();"/> </commandset> <toolbarpalette id="BrowserToolbarPalette"> <toolbarbutton id="zotero-toolbar-button" class="toolbarbutton-1" - label="&scholar.name;" - oncommand="ScholarPane.toggleDisplay();"/> + label="&zotero.name;" + oncommand="ZoteroPane.toggleDisplay();"/> </toolbarpalette> <vbox id="appcontent"> - <!-- Changes to attributes of scholar-splitter and scholar-pane must be mirrored on overlay.js's onLoad() function --> - <splitter id="scholar-splitter" resizebefore="closest" resizeafter="closest" collapsed="true"/> - <hbox id="scholar-pane" persist="height" collapsed="true" flex="1"> + <!-- Changes to attributes of zotero-splitter and zotero-pane must be mirrored on overlay.js's onLoad() function --> + <splitter id="zotero-splitter" resizebefore="closest" resizeafter="closest" collapsed="true"/> + <hbox id="zotero-pane" persist="height" collapsed="true" flex="1"> <popupset> - <popup id="scholar-collectionmenu" onpopupshowing="ScholarPane.buildCollectionContextMenu();"> - <menuitem label="&toolbar.newCollection.label;" command="cmd_scholar_newCollection"/> - <menuitem label="&toolbar.newSavedSearch.label;" oncommand="ScholarPane.newSearch()"/> + <popup id="zotero-collectionmenu" onpopupshowing="ZoteroPane.buildCollectionContextMenu();"> + <menuitem label="&toolbar.newCollection.label;" command="cmd_zotero_newCollection"/> + <menuitem label="&toolbar.newSavedSearch.label;" oncommand="ZoteroPane.newSearch()"/> <menuseparator/> - <menuitem label="&toolbar.renameCollection.label;" oncommand="ScholarPane.editSelectedCollection();"/> - <menuitem label="&toolbar.renameSavedSearch.label;" oncommand="ScholarPane.editSelectedCollection()"/> - <menuitem label="&toolbar.removeCollection.label;" oncommand="ScholarPane.deleteSelectedCollection();"/> - <menuitem label="&toolbar.removeSavedSearch.label;" oncommand="ScholarPane.deleteSelectedCollection()"/> + <menuitem label="&toolbar.renameCollection.label;" oncommand="ZoteroPane.editSelectedCollection();"/> + <menuitem label="&toolbar.renameSavedSearch.label;" oncommand="ZoteroPane.editSelectedCollection()"/> + <menuitem label="&toolbar.removeCollection.label;" oncommand="ZoteroPane.deleteSelectedCollection();"/> + <menuitem label="&toolbar.removeSavedSearch.label;" oncommand="ZoteroPane.deleteSelectedCollection()"/> <menuseparator/> - <menuitem label="&toolbar.exportCollection.label;" oncommand="Scholar_File_Interface.exportCollection();"/> - <menuitem label="&toolbar.exportSavedSearch.label;" oncommand="Scholar_File_Interface.exportCollection()"/> - <menuitem label="&toolbar.createBibCollection.label;" oncommand="Scholar_File_Interface.bibliographyFromCollection();"/> - <menuitem label="&toolbar.createBibSavedSearch.label;" oncommand="Scholar_File_Interface.bibliographyFromCollection()"/> - <menuitem label="&toolbar.export.label;" oncommand="Scholar_File_Interface.exportFile()"/> + <menuitem label="&toolbar.exportCollection.label;" oncommand="Zotero_File_Interface.exportCollection();"/> + <menuitem label="&toolbar.exportSavedSearch.label;" oncommand="Zotero_File_Interface.exportCollection()"/> + <menuitem label="&toolbar.createBibCollection.label;" oncommand="Zotero_File_Interface.bibliographyFromCollection();"/> + <menuitem label="&toolbar.createBibSavedSearch.label;" oncommand="Zotero_File_Interface.bibliographyFromCollection()"/> + <menuitem label="&toolbar.export.label;" oncommand="Zotero_File_Interface.exportFile()"/> </popup> - <popup id="scholar-itemmenu" onpopupshowing="ScholarPane.buildItemContextMenu();"> - <menuitem label="&toolbar.newItem.label;" command="cmd_scholar_newItem"/> + <popup id="zotero-itemmenu" onpopupshowing="ZoteroPane.buildItemContextMenu();"> + <menuitem label="&toolbar.newItem.label;" command="cmd_zotero_newItem"/> <menuseparator/> - <menuitem oncommand="ScholarPane.deleteSelectedItem();"/> - <menuitem oncommand="ScholarPane.deleteSelectedItem(true);"/> + <menuitem oncommand="ZoteroPane.deleteSelectedItem();"/> + <menuitem oncommand="ZoteroPane.deleteSelectedItem(true);"/> <menuseparator/> - <menuitem oncommand="Scholar_File_Interface.exportItems();"/> - <menuitem oncommand="Scholar_File_Interface.bibliographyFromItems();"/> + <menuitem oncommand="Zotero_File_Interface.exportItems();"/> + <menuitem oncommand="Zotero_File_Interface.bibliographyFromItems();"/> </popup> </popupset> <vbox id="collections-pane" persist="width" flex="1"> <toolbar> - <toolbarbutton id="tb-collection-add" tooltiptext="&toolbar.newCollection.label;" command="cmd_scholar_newCollection"/> - <toolbarbutton id="tb-collection-addsearch" tooltiptext="&toolbar.newSavedSearch.label;" oncommand="ScholarPane.newSearch();"/> - <toolbarbutton id="tb-collection-rename" tooltiptext="&toolbar.renameCollection.label;" oncommand="ScholarPane.editSelectedCollection();" disabled="true"/> + <toolbarbutton id="tb-collection-add" tooltiptext="&toolbar.newCollection.label;" command="cmd_zotero_newCollection"/> + <toolbarbutton id="tb-collection-addsearch" tooltiptext="&toolbar.newSavedSearch.label;" oncommand="ZoteroPane.newSearch();"/> + <toolbarbutton id="tb-collection-rename" tooltiptext="&toolbar.renameCollection.label;" oncommand="ZoteroPane.editSelectedCollection();" disabled="true"/> <spacer flex="1"/> <toolbarbutton id="tb-collection-menu" type="menu"> <menupopup> - <menuitem label="&toolbar.import.label;" oncommand="Scholar_File_Interface.importFile();"/> - <menuitem label="&toolbar.export.label;" oncommand="Scholar_File_Interface.exportFile();"/> + <menuitem label="&toolbar.import.label;" oncommand="Zotero_File_Interface.importFile();"/> + <menuitem label="&toolbar.export.label;" oncommand="Zotero_File_Interface.exportFile();"/> <menuseparator/> - <menuitem label="&toolbar.preferences.label;" oncommand="window.openDialog('chrome://scholar/content/preferences.xul','prefs','chrome,modal')"/> + <menuitem label="&toolbar.preferences.label;" oncommand="window.openDialog('chrome://zotero/content/preferences.xul','prefs','chrome,modal')"/> </menupopup> </toolbarbutton> </toolbar> - <tree id="collections-tree" hidecolumnpicker="true" context="scholar-collectionmenu" - onselect="ScholarPane.onCollectionSelected();" seltype="single" - ondragdrop="nsDragAndDrop.drop(event,ScholarPane.getCollectionsView())" - ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ScholarPane.getCollectionsView());" - onkeypress="if (event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ScholarPane.deleteSelectedCollection(); return false; }" + <tree id="collections-tree" hidecolumnpicker="true" context="zotero-collectionmenu" + onselect="ZoteroPane.onCollectionSelected();" seltype="single" + ondragdrop="nsDragAndDrop.drop(event,ZoteroPane.getCollectionsView())" + ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ZoteroPane.getCollectionsView());" + onkeypress="if (event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ZoteroPane.deleteSelectedCollection(); return false; }" flex="1"> <treecols> <treecol @@ -88,41 +88,41 @@ <treechildren/> </tree> </vbox> - <splitter id="scholar-tree-splitter" resizebefore="closest" resizeafter="closest"/> + <splitter id="zotero-tree-splitter" resizebefore="closest" resizeafter="closest"/> <vbox id="items-pane" persist="width" flex="1"> <toolbar align="center"> <toolbarbutton id="tb-add" tooltiptext="&toolbar.newItem.label;" type="menu"> <!-- New Item drop-down built in overlay.js::onLoad() --> <menupopup> <menuseparator/> - <menuitem label="&toolbar.attachment.linked;" oncommand="ScholarPane.addAttachmentFromDialog(true);"/> - <menuitem label="&toolbar.attachment.add;" oncommand="ScholarPane.addAttachmentFromDialog();"/> + <menuitem label="&toolbar.attachment.linked;" oncommand="ZoteroPane.addAttachmentFromDialog(true);"/> + <menuitem label="&toolbar.attachment.add;" oncommand="ZoteroPane.addAttachmentFromDialog();"/> <menuseparator/> <menu label="&toolbar.moreItemTypes.label;"> <menupopup id="tb-add-more"/> </menu> </menupopup> </toolbarbutton> - <toolbarbutton id="tb-item-from-page" tooltiptext="&toolbar.newItemFromPage.label;" oncommand="ScholarPane.addItemFromPage()"/> + <toolbarbutton id="tb-item-from-page" tooltiptext="&toolbar.newItemFromPage.label;" oncommand="ZoteroPane.addItemFromPage()"/> <toolbarseparator/> - <toolbarbutton id="tb-link-page" tooltiptext="&toolbar.attachment.weblink;" oncommand="ScholarPane.addAttachmentFromPage(true)"/> - <toolbarbutton id="tb-snapshot-page" tooltiptext="&toolbar.attachment.snapshot;" oncommand="ScholarPane.addAttachmentFromPage()"/> - <toolbarbutton id="tb-note-add" tooltiptext="&toolbar.note.standalone;" oncommand="ScholarPane.newNote(event.shiftKey);"/> + <toolbarbutton id="tb-link-page" tooltiptext="&toolbar.attachment.weblink;" oncommand="ZoteroPane.addAttachmentFromPage(true)"/> + <toolbarbutton id="tb-snapshot-page" tooltiptext="&toolbar.attachment.snapshot;" oncommand="ZoteroPane.addAttachmentFromPage()"/> + <toolbarbutton id="tb-note-add" tooltiptext="&toolbar.note.standalone;" oncommand="ZoteroPane.newNote(event.shiftKey);"/> <spacer flex="1"/> <label value="&toolbar.search.label;" control="tb-search"/> - <textbox id="tb-search" type="timed" timeout="250" command="cmd_scholar_search" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_scholar_search'); return false; }"> + <textbox id="tb-search" type="timed" timeout="250" command="cmd_zotero_search" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_zotero_search'); return false; }"> <toolbarbutton id="tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> </textbox> </toolbar> <tree - id="items-tree" context="scholar-itemmenu" - ondblclick="ScholarPane.onDoubleClick(event, this);" + id="items-tree" context="zotero-itemmenu" + ondblclick="ZoteroPane.onDoubleClick(event, this);" enableColumnDrag="true" - onkeypress="if (event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ScholarPane.deleteSelectedItem(); return false; }" - onselect="ScholarPane.itemSelected();" - ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ScholarPane.getItemsView());" - ondragover="nsDragAndDrop.dragOver(event,ScholarPane.getItemsView())" - ondragdrop="nsDragAndDrop.drop(event,ScholarPane.getItemsView())" + onkeypress="if (event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ZoteroPane.deleteSelectedItem(); return false; }" + onselect="ZoteroPane.itemSelected();" + ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ZoteroPane.getItemsView());" + ondragover="nsDragAndDrop.dragOver(event,ZoteroPane.getItemsView())" + ondragdrop="nsDragAndDrop.drop(event,ZoteroPane.getItemsView())" flex="1"> <treecols> <treecol @@ -168,15 +168,15 @@ <treechildren/> </tree> </vbox> - <splitter id="scholar-view-splitter" resizebefore="closest" resizeafter="closest"/> + <splitter id="zotero-view-splitter" resizebefore="closest" resizeafter="closest"/> <vbox> <toolbar align="right"> - <toolbarbutton id="tb-fullscreen" tooltiptext="&toolbar.fullscreen.tooltip;" oncommand="ScholarPane.fullScreen();"/> - <toolbarbutton class="tabs-closebutton" oncommand="ScholarPane.toggleDisplay()"/> + <toolbarbutton id="tb-fullscreen" tooltiptext="&toolbar.fullscreen.tooltip;" oncommand="ZoteroPane.fullScreen();"/> + <toolbarbutton class="tabs-closebutton" oncommand="ZoteroPane.toggleDisplay()"/> </toolbar> <groupbox flex="1"> <caption> - <tabs id="scholar-view-tabs" onselect="document.getElementById('scholar-view-item').selectedIndex = this.selectedIndex;" hidden="true"> + <tabs id="zotero-view-tabs" onselect="document.getElementById('zotero-view-item').selectedIndex = this.selectedIndex;" hidden="true"> <tab label="&tabs.info.label;"/> <tab label="&tabs.notes.label;"/> <tab label="&tabs.attachments.label;"/> @@ -184,28 +184,28 @@ <tab label="&tabs.related.label;"/> </tabs> </caption> - <deck id="item-pane" selectedIndex="0" flex="1" onselect="document.getElementById('scholar-view-tabs').setAttribute('hidden',(this.selectedIndex != 1));"> + <deck id="item-pane" selectedIndex="0" flex="1" onselect="document.getElementById('zotero-view-tabs').setAttribute('hidden',(this.selectedIndex != 1));"> <box pack="center" align="center"> - <label id="scholar-view-selected-label"/> + <label id="zotero-view-selected-label"/> </box> - <deck id="scholar-view-item" flex="1"/> + <deck id="zotero-view-item" flex="1"/> <!-- Note info pane --> - <vbox id="scholar-view-note" flex="1"> - <noteeditor id="scholar-note-editor" flex="1"/> - <button id="scholar-view-note-button" label="&notes.separate;" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ScholarPane.selectItem(this.getAttribute('sourceID'));"/> + <vbox id="zotero-view-note" flex="1"> + <noteeditor id="zotero-note-editor" flex="1"/> + <button id="zotero-view-note-button" label="&notes.separate;" oncommand="ZoteroPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ZoteroPane.selectItem(this.getAttribute('sourceID'));"/> </vbox> <!-- Attachment info pane --> - <vbox id="scholar-view-attachment" flex="1"> - <label id="scholar-attachment-label"/> + <vbox id="zotero-view-attachment" flex="1"> + <label id="zotero-attachment-label"/> <hbox> - <button id="scholar-attachment-view" flex="1" oncommand="ScholarPane.viewSelectedAttachment();"/> - <button id="scholar-attachment-show" label="&item.attachment.file.show;" flex="1" oncommand="ScholarPane.showSelectedAttachmentInFilesystem()"/> + <button id="zotero-attachment-view" flex="1" oncommand="ZoteroPane.viewSelectedAttachment();"/> + <button id="zotero-attachment-show" label="&item.attachment.file.show;" flex="1" oncommand="ZoteroPane.showSelectedAttachmentInFilesystem()"/> </hbox> <vbox> - <label id="scholar-attachment-url" class="text-link" crop="end" onclick="window.loadURI(this.value)"/> - <label id="scholar-attachment-accessed"/> + <label id="zotero-attachment-url" class="text-link" crop="end" onclick="window.loadURI(this.value)"/> + <label id="zotero-attachment-accessed"/> </vbox> - <noteeditor id="scholar-attachment-note-editor" notitle="1" flex="1"/> + <noteeditor id="zotero-attachment-note-editor" notitle="1" flex="1"/> </vbox> </deck> </groupbox> @@ -214,31 +214,31 @@ </vbox> <statusbar id="status-bar"> - <statusbarpanel id="scholar-status-bar-icon" - src="chrome://scholar/skin/zotero_logo_18px.png" - class="statusbarpanel-iconic" onclick="ScholarPane.toggleDisplay();" + <statusbarpanel id="zotero-status-bar-icon" + src="chrome://zotero/skin/zotero_logo_18px.png" + class="statusbarpanel-iconic" onclick="ZoteroPane.toggleDisplay();" hidden="true"/> </statusbar> <script> window.addEventListener('load', function(e){ - if (Scholar){ - document.getElementById('scholar-status-bar-icon').setAttribute('hidden', 'false'); + if (Zotero){ + document.getElementById('zotero-status-bar-icon').setAttribute('hidden', 'false'); } }, false); </script> <menupopup id="menu_ToolsPopup"> - <menuseparator id="scholarSeparator" insertbefore="devToolsSeparator"/> - <menuitem id="tools-scholar" insertbefore="devToolsSeparator" - oncommand="ScholarPane.toggleDisplay();" label="&scholar.name;" - key="key_openScholar"/> + <menuseparator id="zoteroSeparator" insertbefore="devToolsSeparator"/> + <menuitem id="tools-zotero" insertbefore="devToolsSeparator" + oncommand="ZoteroPane.toggleDisplay();" label="&zotero.name;" + key="key_openZotero"/> </menupopup> <keyset id="mainKeyset"> - <key id="key_openScholar" + <key id="key_openZotero" key="Z" - oncommand="ScholarPane.toggleDisplay();" + oncommand="ZoteroPane.toggleDisplay();" modifiers="shift accel" /> </keyset> </overlay> \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/preferences.js b/chrome/chromeFiles/content/scholar/preferences.js @@ -11,11 +11,11 @@ var openURLMenu; var openURLResolvers; var openURLServerField; var openURLVersionMenu; -var scholarPaneOnTopInitial; +var zoteroPaneOnTopInitial; /* To add a new preference: - 1) modify defaults/preferences/scholar.js + 1) modify defaults/preferences/zotero.js 2) in this document: a) add var above b) add lines to init() function @@ -23,49 +23,49 @@ var scholarPaneOnTopInitial; 3) add a control to prefs.xul 4) (Optional) To add an observer for a preference change, add an appropriate case in the switch statement - in Scholar.Prefs.observe() + in Zotero.Prefs.observe() */ function init() { autoUpdateBox = document.getElementById('autoUpdateBox'); - autoUpdateBox.checked = scholarPaneOnTopInitial = Scholar.Prefs.get('automaticScraperUpdates'); + autoUpdateBox.checked = zoteroPaneOnTopInitial = Zotero.Prefs.get('automaticScraperUpdates'); positionMenu = document.getElementById('positionMenu'); - positionMenu.selectedIndex = Scholar.Prefs.get('scholarPaneOnTop') ? 0 : 1; + positionMenu.selectedIndex = Zotero.Prefs.get('zoteroPaneOnTop') ? 0 : 1; parseEndnoteBox = document.getElementById('parseEndnoteBox'); - parseEndnoteBox.checked = Scholar.Prefs.get('parseEndNoteMIMETypes'); + parseEndnoteBox.checked = Zotero.Prefs.get('parseEndNoteMIMETypes'); openURLServerField = document.getElementById('openURLServerField'); - openURLServerField.value = Scholar.Prefs.get('openURL.resolver'); + openURLServerField.value = Zotero.Prefs.get('openURL.resolver'); openURLVersionMenu = document.getElementById('openURLVersionMenu'); - openURLVersionMenu.value = Scholar.Prefs.get('openURL.version'); + openURLVersionMenu.value = Zotero.Prefs.get('openURL.version'); openURLMenu = document.getElementById('openURLMenu'); - openURLResolvers = Scholar.OpenURL.discoverResolvers(); + openURLResolvers = Zotero.OpenURL.discoverResolvers(); for(var i in openURLResolvers) { openURLMenu.insertItemAt(i,openURLResolvers[i]['name']); - if(openURLResolvers[i]['url'] == Scholar.Prefs.get('openURL.resolver') && openURLResolvers[i]['version'] == Scholar.Prefs.get('openURL.version')) + if(openURLResolvers[i]['url'] == Zotero.Prefs.get('openURL.resolver') && openURLResolvers[i]['version'] == Zotero.Prefs.get('openURL.version')) openURLMenu.selectedIndex = i; } } function accept() { - Scholar.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked); - Scholar.Prefs.set('scholarPaneOnTop', positionMenu.selectedIndex == 0); + Zotero.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked); + Zotero.Prefs.set('zoteroPaneOnTop', positionMenu.selectedIndex == 0); - if(Scholar.Prefs.get('parseEndNoteMIMETypes') != parseEndnoteBox.checked) + if(Zotero.Prefs.get('parseEndNoteMIMETypes') != parseEndnoteBox.checked) { - Scholar.Prefs.set('parseEndNoteMIMETypes', parseEndnoteBox.checked); - Scholar.Ingester.MIMEHandler.init(); + Zotero.Prefs.set('parseEndNoteMIMETypes', parseEndnoteBox.checked); + Zotero.Ingester.MIMEHandler.init(); } - Scholar.Prefs.set('openURL.resolver', openURLServerField.value); - Scholar.Prefs.set('openURL.version', openURLVersionMenu.value); + Zotero.Prefs.set('openURL.resolver', openURLServerField.value); + Zotero.Prefs.set('openURL.version', openURLVersionMenu.value); } function onOpenURLSelected() @@ -89,9 +89,9 @@ function onOpenURLCustomized() function onPositionChange() { var statusLine = document.getElementById('statusLine'); - if ((positionMenu.selectedIndex == 0) != scholarPaneOnTopInitial) + if ((positionMenu.selectedIndex == 0) != zoteroPaneOnTopInitial) { - statusLine.value = Scholar.getString('scholar.preferences.status.positionChange'); + statusLine.value = Zotero.getString('zotero.preferences.status.positionChange'); } else { diff --git a/chrome/chromeFiles/content/scholar/preferences.xul b/chrome/chromeFiles/content/scholar/preferences.xul @@ -4,36 +4,36 @@ Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA http://chnm.gmu.edu/ --> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/preferences.dtd"> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/preferences.dtd"> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<dialog id="winMain" title="&scholar.preferences.title;" style="min-width:400px;" +<dialog id="winMain" title="&zotero.preferences.title;" style="min-width:400px;" onload="init();" ondialogaccept="accept()" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="preferences.js"/> <script src="include.js"/> -<dialogheader id="header" title="&scholar.name;" description="&scholar.preferences.title;"/> +<dialogheader id="header" title="&zotero.name;" description="&zotero.preferences.title;"/> <hbox align="center"> - <label value="&scholar.preferences.position.label;" control="positionMenu"/> + <label value="&zotero.preferences.position.label;" control="positionMenu"/> <menulist id="positionMenu" oncommand="onPositionChange()"> <menupopup> - <menuitem label="&scholar.preferences.position.above;"/> - <menuitem label="&scholar.preferences.position.below;"/> + <menuitem label="&zotero.preferences.position.above;"/> + <menuitem label="&zotero.preferences.position.below;"/> </menupopup> </menulist> - <label value="&scholar.preferences.position.browser;"/> + <label value="&zotero.preferences.position.browser;"/> </hbox> -<checkbox id="autoUpdateBox" label="&scholar.preferences.autoUpdate.label;"/> +<checkbox id="autoUpdateBox" label="&zotero.preferences.autoUpdate.label;"/> -<checkbox id="parseEndnoteBox" label="&scholar.preferences.parseEndnote.label;"/> +<checkbox id="parseEndnoteBox" label="&zotero.preferences.parseEndnote.label;"/> <groupbox> - <caption label="&scholar.preferences.openurl.caption;"/> + <caption label="&zotero.preferences.openurl.caption;"/> <menulist id="openURLMenu" oncommand="onOpenURLSelected();"> <menupopup> @@ -43,12 +43,12 @@ </menulist> <hbox align="center"> - <label value="&scholar.preferences.openurl.server;"/> + <label value="&zotero.preferences.openurl.server;"/> <textbox id="openURLServerField" flex="1" oninput="onOpenURLCustomized();"/> </hbox> <hbox align="center"> - <label value="&scholar.preferences.openurl.version;"/> + <label value="&zotero.preferences.openurl.version;"/> <menulist id="openURLVersionMenu" oncommand="onOpenURLCustomized();"> <menupopup> <menuitem label="0.1" value="0.1"/> diff --git a/chrome/chromeFiles/content/scholar/progressWindow.xul b/chrome/chromeFiles/content/scholar/progressWindow.xul @@ -1,7 +1,7 @@ <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> <window id="zotero-progress-window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" diff --git a/chrome/chromeFiles/content/scholar/searchDialog.xul b/chrome/chromeFiles/content/scholar/searchDialog.xul @@ -5,12 +5,12 @@ http://chnm.gmu.edu/ --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/overlay.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <dialog - id="scholar-search-dialog" + id="zotero-search-dialog" title="Search" orient="vertical" buttons="cancel,accept" @@ -24,5 +24,5 @@ <script src="searchDialog.js"/> <hbox align="center"><label value="Name:"/><textbox id="search-name" flex="1"/></hbox> - <scholarsearch id="search-box" flex="1"/> + <zoterosearch id="search-box" flex="1"/> </dialog> diff --git a/chrome/chromeFiles/content/scholar/selectItemsDialog.js b/chrome/chromeFiles/content/scholar/selectItemsDialog.js @@ -17,7 +17,7 @@ function doLoad() { io = window.arguments[0]; - collectionsView = new Scholar.CollectionTreeView(); + collectionsView = new Zotero.CollectionTreeView(); document.getElementById('collections-tree').view = collectionsView; // move to center of screen @@ -45,7 +45,7 @@ function onCollectionSelected() var collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); collection.setSearch(''); - itemsView = new Scholar.ItemTreeView(collection, (window.arguments[1] ? true : false)); + itemsView = new Zotero.ItemTreeView(collection, (window.arguments[1] ? true : false)); document.getElementById('items-tree').view = itemsView; } diff --git a/chrome/chromeFiles/content/scholar/selectItemsDialog.xul b/chrome/chromeFiles/content/scholar/selectItemsDialog.xul @@ -5,12 +5,12 @@ http://chnm.gmu.edu/ --> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> -<?xml-stylesheet href="chrome://scholar/skin/overlay.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <dialog - id="scholar-select-items-dialog" + id="zotero-select-items-dialog" title="Select" orient="vertical" width="600" height="450" @@ -26,7 +26,7 @@ <hbox align="center" pack="end"> <label value="&toolbar.search.label;" control="tb-search"/> - <textbox id="tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_scholar_search'); return false; }"> + <textbox id="tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_zotero_search'); return false; }"> <toolbarbutton id="tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> </textbox> </hbox> diff --git a/chrome/chromeFiles/content/scholar/test/test.xul b/chrome/chromeFiles/content/scholar/test/test.xul @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd"> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <window @@ -13,5 +13,5 @@ <script src="../include.js"/> <script src="test.js"/> - <hbox><label>This is only a test...page.</label></hbox> + <hbox><label>This is a test page.</label></hbox> </window> diff --git a/chrome/chromeFiles/content/scholar/xpcom/attachments.js b/chrome/chromeFiles/content/scholar/xpcom/attachments.js @@ -1,4 +1,4 @@ -Scholar.Attachments = new function(){ +Zotero.Attachments = new function(){ this.LINK_MODE_IMPORTED_FILE = 0; this.LINK_MODE_IMPORTED_URL = 1; this.LINK_MODE_LINKED_FILE = 2; @@ -17,17 +17,17 @@ Scholar.Attachments = new function(){ function importFromFile(file, sourceItemID){ var title = file.leafName; - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); try { // Create a new attachment - var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment')); + var attachmentItem = Zotero.Items.getNewItemByType(Zotero.ItemTypes.getID('attachment')); attachmentItem.setField('title', title); attachmentItem.save(); var itemID = attachmentItem.getID(); // Create directory for attachment files within storage directory - var destDir = Scholar.getStorageDirectory(); + var destDir = Zotero.getStorageDirectory(); destDir.append(itemID); destDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644); @@ -39,23 +39,23 @@ Scholar.Attachments = new function(){ newFile.initWithFile(destDir); newFile.append(title); - var mimeType = Scholar.MIME.getMIMETypeFromFile(newFile); + var mimeType = Zotero.MIME.getMIMETypeFromFile(newFile); _addToDB(newFile, null, null, this.LINK_MODE_IMPORTED_FILE, mimeType, null, sourceItemID, itemID); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); // Determine charset and build fulltext index _postProcessFile(itemID, newFile, mimeType); } catch (e){ // hmph - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); // Clean up if (itemID){ - var itemDir = Scholar.getStorageDirectory(); + var itemDir = Zotero.getStorageDirectory(); itemDir.append(itemID); if (itemDir.exists()){ itemDir.remove(true); @@ -69,7 +69,7 @@ Scholar.Attachments = new function(){ function linkFromFile(file, sourceItemID){ var title = file.leafName; - var mimeType = Scholar.MIME.getMIMETypeFromFile(file); + var mimeType = Zotero.MIME.getMIMETypeFromFile(file); var itemID = _addToDB(file, null, title, this.LINK_MODE_LINKED_FILE, mimeType, null, sourceItemID); @@ -82,20 +82,20 @@ Scholar.Attachments = new function(){ function importSnapshotFromFile(file, url, title, mimeType, charset, sourceItemID){ - var charsetID = Scholar.CharacterSets.getID(charset); + var charsetID = Zotero.CharacterSets.getID(charset); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); try { // Create a new attachment - var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment')); + var attachmentItem = Zotero.Items.getNewItemByType(Zotero.ItemTypes.getID('attachment')); attachmentItem.setField('title', title); attachmentItem.setField('url', url); // TODO: access date attachmentItem.save(); var itemID = attachmentItem.getID(); - var storageDir = Scholar.getStorageDirectory(); + var storageDir = Zotero.getStorageDirectory(); file.parent.copyTo(storageDir, itemID); // Point to copied file @@ -107,17 +107,17 @@ Scholar.Attachments = new function(){ _addToDB(newFile, url, null, this.LINK_MODE_IMPORTED_URL, mimeType, charsetID, sourceItemID, itemID); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); // Determine charset and build fulltext index _postProcessFile(itemID, newFile, mimeType); } catch (e){ - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); // Clean up if (itemID){ - var itemDir = Scholar.getStorageDirectory(); + var itemDir = Zotero.getStorageDirectory(); itemDir.append(itemID); if (itemDir.exists()){ itemDir.remove(true); @@ -130,7 +130,7 @@ Scholar.Attachments = new function(){ function importFromURL(url, sourceItemID){ - Scholar.Utilities.HTTP.doHead(url, function(obj){ + Zotero.Utilities.HTTP.doHead(url, function(obj){ var mimeType = obj.channel.contentType; var nsIURL = Components.classes["@mozilla.org/network/standard-url;1"] @@ -140,12 +140,12 @@ Scholar.Attachments = new function(){ // If we can load this internally, use a hidden browser (so we can // get the charset and title) - if (Scholar.MIME.hasInternalHandler(mimeType, ext)){ - var browser = Scholar.Browser.createHiddenBrowser(); + if (Zotero.MIME.hasInternalHandler(mimeType, ext)){ + var browser = Zotero.Browser.createHiddenBrowser(); browser.addEventListener("pageshow", function(){ - Scholar.Attachments.importFromDocument(browser.contentDocument, sourceItemID); + Zotero.Attachments.importFromDocument(browser.contentDocument, sourceItemID); browser.removeEventListener("pageshow", arguments.callee, true); - Scholar.Browser.deleteHiddenBrowser(browser); + Zotero.Browser.deleteHiddenBrowser(browser); }, true); browser.loadURI(url); } @@ -162,11 +162,11 @@ Scholar.Attachments = new function(){ //wbp.persistFlags = nsIWBP.PERSIST_FLAGS...; var encodingFlags = false; - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); try { // Create a new attachment - var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment')); + var attachmentItem = Zotero.Items.getNewItemByType(Zotero.ItemTypes.getID('attachment')); attachmentItem.setField('title', title); attachmentItem.setField('url', url); attachmentItem.setField('accessDate', "CURRENT_TIMESTAMP"); @@ -174,7 +174,7 @@ Scholar.Attachments = new function(){ var itemID = attachmentItem.getID(); // Create a new folder for this item in the storage directory - var destDir = Scholar.getStorageDirectory(); + var destDir = Zotero.getStorageDirectory(); destDir.append(itemID); destDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644); @@ -185,13 +185,13 @@ Scholar.Attachments = new function(){ wbp.saveURI(nsIURL, null, null, null, null, file); - _addToDB(file, url, title, Scholar.Attachments.LINK_MODE_IMPORTED_URL, + _addToDB(file, url, title, Zotero.Attachments.LINK_MODE_IMPORTED_URL, mimeType, null, sourceItemID, itemID); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } catch (e){ - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); throw (e); } } @@ -213,8 +213,8 @@ Scholar.Attachments = new function(){ } // Otherwise do a head request for the mime type - Scholar.Utilities.HTTP.doHead(url, function(obj){ - _addToDB(null, url, title, Scholar.Attachments.LINK_MODE_LINKED_URL, + Zotero.Utilities.HTTP.doHead(url, function(obj){ + _addToDB(null, url, title, Zotero.Attachments.LINK_MODE_LINKED_URL, obj.channel.contentType, null, sourceItemID); }); } @@ -225,7 +225,7 @@ Scholar.Attachments = new function(){ var url = document.location; var title = document.title; // TODO: don't use Mozilla-generated title for images, etc. var mimeType = document.contentType; - var charsetID = Scholar.CharacterSets.getID(document.characterSet); + var charsetID = Zotero.CharacterSets.getID(document.characterSet); var itemID = _addToDB(null, url, title, this.LINK_MODE_LINKED_URL, mimeType, charsetID, sourceItemID); @@ -233,7 +233,7 @@ Scholar.Attachments = new function(){ // Run the fulltext indexer asynchronously (actually, it hangs the UI // thread, but at least it lets the menu close) setTimeout(function(){ - Scholar.Fulltext.indexDocument(document, itemID); + Zotero.Fulltext.indexDocument(document, itemID); }, 50); return itemID; @@ -244,7 +244,7 @@ Scholar.Attachments = new function(){ var url = document.location; var title = document.title; var mimeType = document.contentType; - var charsetID = Scholar.CharacterSets.getID(document.characterSet); + var charsetID = Zotero.CharacterSets.getID(document.characterSet); const nsIWBP = Components.interfaces.nsIWebBrowserPersist; var wbp = Components @@ -253,10 +253,10 @@ Scholar.Attachments = new function(){ //wbp.persistFlags = nsIWBP.PERSIST_FLAGS...; var encodingFlags = false; - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); // Create a new attachment - var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment')); + var attachmentItem = Zotero.Items.getNewItemByType(Zotero.ItemTypes.getID('attachment')); attachmentItem.setField('title', title); attachmentItem.setField('url', url); attachmentItem.setField('accessDate', "CURRENT_TIMESTAMP"); @@ -264,7 +264,7 @@ Scholar.Attachments = new function(){ var itemID = attachmentItem.getID(); // Create a new folder for this item in the storage directory - var destDir = Scholar.getStorageDirectory(); + var destDir = Zotero.getStorageDirectory(); destDir.append(itemID); destDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644); @@ -276,7 +276,7 @@ Scholar.Attachments = new function(){ // This is a hack to make sure the file is opened in the browser when // we use loadURI(), since Firefox's internal detection mechanisms seem // to sometimes get confused - // (see #192, https://chnm.gmu.edu/trac/scholar/ticket/192) + // (see #192, https://chnm.gmu.edu/trac/zotero/ticket/192) if (mimeType=='text/html' && (fileName.substr(fileName.length-5)!='.html' && fileName.substr(fileName.length-4)!='.htm')){ @@ -290,12 +290,12 @@ Scholar.Attachments = new function(){ _addToDB(file, url, title, this.LINK_MODE_IMPORTED_URL, mimeType, charsetID, sourceItemID, itemID); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); // Run the fulltext indexer asynchronously (actually, it hangs the UI // thread, but at least it lets the menu close) setTimeout(function(){ - Scholar.Fulltext.indexDocument(document, itemID); + Zotero.Fulltext.indexDocument(document, itemID); }, 50); return itemID; @@ -333,37 +333,37 @@ Scholar.Attachments = new function(){ **/ function _addToDB(file, url, title, linkMode, mimeType, charsetID, sourceItemID, itemID){ if (file){ - // Path relative to Scholar directory for external files and relative + // Path relative to Zotero directory for external files and relative // to storage directory for imported files var refDir = (linkMode==this.LINK_MODE_LINKED_FILE) - ? Scholar.getScholarDirectory() : Scholar.getStorageDirectory(); + ? Zotero.getZoteroDirectory() : Zotero.getStorageDirectory(); var path = file.getRelativeDescriptor(refDir); } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); if (sourceItemID){ - var sourceItem = Scholar.Items.get(sourceItemID); + var sourceItem = Zotero.Items.get(sourceItemID); if (!sourceItem){ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); throw ("Cannot set attachment source to invalid item " + sourceItemID); } if (sourceItem.isAttachment()){ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); throw ("Cannot set attachment source to another file (" + sourceItemID + ")"); } } // If an itemID is provided, use that if (itemID){ - var attachmentItem = Scholar.Items.get(itemID); + var attachmentItem = Zotero.Items.get(itemID); if (!attachmentItem.isAttachment()){ throw ("Item " + itemID + " is not a valid attachment in _addToDB()"); } } // Otherwise create a new attachment else { - var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment')); + var attachmentItem = Zotero.Items.getNewItemByType(Zotero.ItemTypes.getID('attachment')); attachmentItem.setField('title', title); if (linkMode==self.LINK_MODE_IMPORTED_URL || linkMode==self.LINK_MODE_LINKED_URL){ @@ -383,15 +383,15 @@ Scholar.Attachments = new function(){ (charsetID ? {int:charsetID} : null), (path ? {string:path} : null) ]; - Scholar.DB.query(sql, bindParams); - Scholar.DB.commitTransaction(); + Zotero.DB.query(sql, bindParams); + Zotero.DB.commitTransaction(); if (sourceItemID){ sourceItem.incrementAttachmentCount(); - Scholar.Notifier.trigger('modify', 'item', sourceItemID); + Zotero.Notifier.trigger('modify', 'item', sourceItemID); } - Scholar.Notifier.trigger('add', 'item', attachmentItem.getID()); + Zotero.Notifier.trigger('add', 'item', attachmentItem.getID()); return attachmentItem.getID(); } @@ -404,27 +404,27 @@ Scholar.Attachments = new function(){ * asynchronously after the fact */ function _postProcessFile(itemID, file, mimeType){ - var ext = Scholar.File.getExtension(file); + var ext = Zotero.File.getExtension(file); if (mimeType.substr(0, 5)!='text/' || - !Scholar.MIME.hasInternalHandler(mimeType, ext)){ + !Zotero.MIME.hasInternalHandler(mimeType, ext)){ return false; } - var browser = Scholar.Browser.createHiddenBrowser(); + var browser = Zotero.Browser.createHiddenBrowser(); - Scholar.File.addCharsetListener(browser, new function(){ + Zotero.File.addCharsetListener(browser, new function(){ return function(charset, id){ - var charsetID = Scholar.CharacterSets.getID(charset); + var charsetID = Zotero.CharacterSets.getID(charset); if (charsetID){ var sql = "UPDATE itemAttachments SET charsetID=" + charsetID + " WHERE itemID=" + itemID; - Scholar.DB.query(sql); + Zotero.DB.query(sql); } // Chain fulltext indexer inside the charset callback, // since it's asynchronous and a prerequisite - Scholar.Fulltext.indexDocument(browser.contentDocument, itemID); - Scholar.Browser.deleteHiddenBrowser(browser); + Zotero.Fulltext.indexDocument(browser.contentDocument, itemID); + Zotero.Browser.deleteHiddenBrowser(browser); } }, itemID); diff --git a/chrome/chromeFiles/content/scholar/xpcom/cite.js b/chrome/chromeFiles/content/scholar/xpcom/cite.js @@ -1,11 +1,11 @@ /* - * Scholar.Cite: a class for creating bibliographies from within Scholar + * Zotero.Cite: a class for creating bibliographies from within Zotero * this class handles pulling the CSL file and item data out of the database, * while CSL, below, handles the actual generation of the bibliography */ default xml namespace = "http://purl.org/net/xbiblio/csl"; -Scholar.Cite = new function() { +Zotero.Cite = new function() { var _lastCSL = null; var _lastStyle = null; @@ -18,7 +18,7 @@ Scholar.Cite = new function() { function getStyles() { // get styles var sql = "SELECT cslID, title FROM csl ORDER BY title"; - var styles = Scholar.DB.query(sql); + var styles = Zotero.DB.query(sql); // convert to associative array var stylesObject = new Object(); @@ -33,13 +33,13 @@ Scholar.Cite = new function() { * from the cache */ function getStyle(cslID) { - if(_lastStyle != cslID || Scholar.Prefs.get("cacheTranslatorData") == false) { + if(_lastStyle != cslID || Zotero.Prefs.get("cacheTranslatorData") == false) { // get style var sql = "SELECT csl FROM csl WHERE cslID = ?"; - var style = Scholar.DB.valueQuery(sql, [cslID]); + var style = Zotero.DB.valueQuery(sql, [cslID]); // create a CSL instance - _lastCSL = new Scholar.CSL(style); + _lastCSL = new Zotero.CSL(style); _lastStyle = cslID; } return _lastCSL; @@ -49,25 +49,25 @@ Scholar.Cite = new function() { /* * CSL: a class for creating bibliographies from CSL files * this is abstracted as a separate class for the benefit of anyone who doesn't - * want to use the Scholar data model, but does want to use CSL in JavaScript + * want to use the Zotero data model, but does want to use CSL in JavaScript */ -Scholar.CSL = function(csl) { - this._csl = new XML(Scholar.CSL._cleanXML(csl)); +Zotero.CSL = function(csl) { + this._csl = new XML(Zotero.CSL._cleanXML(csl)); // initialize CSL - Scholar.CSL.init(); + Zotero.CSL.init(); // load localizations - this._terms = Scholar.CSL._parseLocales(this._csl.terms); + this._terms = Zotero.CSL._parseLocales(this._csl.terms); // load class defaults this.class = this._csl["@class"].toString(); - Scholar.debug("CSL: style class is "+this.class); + Zotero.debug("CSL: style class is "+this.class); this._defaults = new Object(); // load class defaults - if(Scholar.CSL._classDefaults[this.class]) { - var classDefaults = Scholar.CSL._classDefaults[this.class]; + if(Zotero.CSL._classDefaults[this.class]) { + var classDefaults = Zotero.CSL._classDefaults[this.class]; for(var i in classDefaults) { this._defaults[i] = classDefaults[i]; } @@ -79,7 +79,7 @@ Scholar.CSL = function(csl) { this._parseCitationOptions(); // if no bibliography exists, parse citation element as bibliography if(!this._bib) { - Scholar.debug("CSL: using citation element for bibliography"); + Zotero.debug("CSL: using citation element for bibliography"); this._bib = this._cit; } } @@ -91,8 +91,8 @@ Scholar.CSL = function(csl) { * must be called prior to generating citations or bibliography with a new set * of items */ -Scholar.CSL.prototype.preprocessItems = function(items) { - Scholar.debug("CSL: preprocessing items"); +Zotero.CSL.prototype.preprocessItems = function(items) { + Zotero.debug("CSL: preprocessing items"); this._ignore = null; @@ -113,7 +113,7 @@ Scholar.CSL.prototype.preprocessItems = function(items) { item._csl.translators = creators[2]; // parse date - item._csl.date = Scholar.CSL.prototype._processDate(item.getField("date")); + item._csl.date = Zotero.CSL.prototype._processDate(item.getField("date")); } // clear disambiguation and subsequent author substitute if(item._csl.disambiguation) item._csl.date.disambiguation = undefined; @@ -122,7 +122,7 @@ Scholar.CSL.prototype.preprocessItems = function(items) { // sort by sort order if(this._bib.sortOrder) { - Scholar.debug("CSL: sorting items"); + Zotero.debug("CSL: sorting items"); var me = this; items.sort(function(a, b) { return me._compareItem(a, b); @@ -187,7 +187,7 @@ Scholar.CSL.prototype.preprocessItems = function(items) { /* * create a citation (in-text or footnote) */ -Scholar.CSL.prototype.createCitation = function(citation, format) { +Zotero.CSL.prototype.createCitation = function(citation, format) { if(citation.citationType == 2) { var string = this._getTerm("ibid"); string = string[0].toUpperCase()+string.substr(1); @@ -214,7 +214,7 @@ Scholar.CSL.prototype.createCitation = function(citation, format) { locator = citation.locators[i]; } - string += this._getCitation(Scholar.Items.get(citation.itemIDs[i]), + string += this._getCitation(Zotero.Items.get(citation.itemIDs[i]), (citation.citationType[i] == 1 ? "first" : "subsequent"), locatorType, locator, format, this._cit); } @@ -238,7 +238,7 @@ Scholar.CSL.prototype.createCitation = function(citation, format) { * create a bibliography * (items is expected to be an array of items) */ -Scholar.CSL.prototype.createBibliography = function(items, format) { +Zotero.CSL.prototype.createBibliography = function(items, format) { // process this._items var output = ""; @@ -278,7 +278,7 @@ Scholar.CSL.prototype.createBibliography = function(items, format) { // add line feeds if(format == "HTML") { - var coins = Scholar.OpenURL.createContextObject(item, "1.0"); + var coins = Zotero.OpenURL.createContextObject(item, "1.0"); if(coins) { string += '<span class="Z3988" title="'+coins.replace("&", "&amp;")+'"></span>'; } @@ -321,7 +321,7 @@ Scholar.CSL.prototype.createBibliography = function(items, format) { } // for elements that inherit defaults from each other -Scholar.CSL._inherit = { +Zotero.CSL._inherit = { author:"contributor", editor:"contributor", translator:"contributor", @@ -333,8 +333,8 @@ Scholar.CSL._inherit = { edition:"version" } // for class definitions -Scholar.CSL._classDefaults = new Object(); -Scholar.CSL._classDefaults["author-date"] = { +Zotero.CSL._classDefaults = new Object(); +Zotero.CSL._classDefaults["author-date"] = { author:{ substitute:[ {name:"editor"}, @@ -347,79 +347,79 @@ Scholar.CSL._classDefaults["author-date"] = { } }; -Scholar.CSL.ns = "http://purl.org/net/xbiblio/csl"; +Zotero.CSL.ns = "http://purl.org/net/xbiblio/csl"; /* * initializes CSL interpreter */ -Scholar.CSL.init = function() { - if(!Scholar.CSL._xmlLang) { +Zotero.CSL.init = function() { + if(!Zotero.CSL._xmlLang) { // get XML lang - Scholar.CSL._xmlLang = Scholar.locale; + Zotero.CSL._xmlLang = Zotero.locale; // read locales.xml from directory var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]. createInstance(); - req.open("GET", "chrome://scholar/locale/locales.xml", false); + req.open("GET", "chrome://zotero/locale/locales.xml", false); req.overrideMimeType("text/plain"); req.send(null); // get default terms - var locales = new XML(Scholar.CSL._cleanXML(req.responseText)); - Scholar.CSL._defaultTerms = Scholar.CSL._parseLocales(locales); + var locales = new XML(Zotero.CSL._cleanXML(req.responseText)); + Zotero.CSL._defaultTerms = Zotero.CSL._parseLocales(locales); } } /* * returns an array of short or long month strings */ -Scholar.CSL.getMonthStrings = function(form) { - Scholar.CSL.init(); - return Scholar.CSL._defaultTerms[form]["_months"]; +Zotero.CSL.getMonthStrings = function(form) { + Zotero.CSL.init(); + return Zotero.CSL._defaultTerms[form]["_months"]; } /* * removes parse instructions from XML */ -Scholar.CSL._cleanXML = function(xml) { +Zotero.CSL._cleanXML = function(xml) { return xml.replace(/<\?[^>]*\?>/g, ""); } /* - * parses locale strings into Scholar.CSL._defaultTerms + * parses locale strings into Zotero.CSL._defaultTerms */ -Scholar.CSL._parseLocales = function(termXML) { +Zotero.CSL._parseLocales = function(termXML) { // return defaults if there are no terms if(!termXML.length()) { - return (Scholar.CSL._defaultTerms ? Scholar.CSL._defaultTerms : {}); + return (Zotero.CSL._defaultTerms ? Zotero.CSL._defaultTerms : {}); } var xml = new Namespace("http://www.w3.org/XML/1998/namespace"); // get proper locale - var locale = termXML.locale.(@xml::lang == Scholar.CSL._xmlLang); + var locale = termXML.locale.(@xml::lang == Zotero.CSL._xmlLang); if(!locale.length()) { - var xmlLang = Scholar.CSL._xmlLang.substr(0, 2); + var xmlLang = Zotero.CSL._xmlLang.substr(0, 2); locale = termXML.locale.(@xml::lang == xmlLang); } if(!locale.length()) { // return defaults if there are no locales - return (Scholar.CSL._defaultTerms ? Scholar.CSL._defaultTerms : {}); + return (Zotero.CSL._defaultTerms ? Zotero.CSL._defaultTerms : {}); } var termArray = new Object(); termArray["default"] = new Object(); - if(Scholar.CSL._defaultTerms) { + if(Zotero.CSL._defaultTerms) { // ugh. copy default array. javascript dumb. - for(var i in Scholar.CSL._defaultTerms) { + for(var i in Zotero.CSL._defaultTerms) { termArray[i] = new Object(); - for(var j in Scholar.CSL._defaultTerms[i]) { - if(typeof(Scholar.CSL._defaultTerms[i]) == "object") { - termArray[i][j] = [Scholar.CSL._defaultTerms[i][j][0], - Scholar.CSL._defaultTerms[i][j][1]]; + for(var j in Zotero.CSL._defaultTerms[i]) { + if(typeof(Zotero.CSL._defaultTerms[i]) == "object") { + termArray[i][j] = [Zotero.CSL._defaultTerms[i][j][0], + Zotero.CSL._defaultTerms[i][j][1]]; } else { - termArray[i][j] = Scholar.CSL._defaultTerms[i][j]; + termArray[i][j] = Zotero.CSL._defaultTerms[i][j]; } } } @@ -480,7 +480,7 @@ Scholar.CSL._parseLocales = function(termXML) { /* * parses attributes and children for a CSL field */ -Scholar.CSL.prototype._parseFieldAttrChildren = function(element, desc, ignoreChildren) { +Zotero.CSL.prototype._parseFieldAttrChildren = function(element, desc, ignoreChildren) { if(!desc) { var desc = new Object(); } @@ -504,7 +504,7 @@ Scholar.CSL.prototype._parseFieldAttrChildren = function(element, desc, ignoreCh // add children to children array for each(var child in children) { - if(child.namespace() == Scholar.CSL.ns) { // ignore elements in other + if(child.namespace() == Zotero.CSL.ns) { // ignore elements in other // namespaces // parse recursively var name = child.localName(); @@ -516,7 +516,7 @@ Scholar.CSL.prototype._parseFieldAttrChildren = function(element, desc, ignoreCh var chooseChildren = child.choose.children(); for each(var choose in chooseChildren) { - if(choose.namespace() == Scholar.CSL.ns) { + if(choose.namespace() == Zotero.CSL.ns) { var option = new Object(); option.name = choose.localName(); this._parseFieldAttrChildren(choose, option); @@ -542,11 +542,11 @@ Scholar.CSL.prototype._parseFieldAttrChildren = function(element, desc, ignoreCh /* * parses a list of fields into a defaults associative array */ -Scholar.CSL.prototype._parseFieldDefaults = function(ref) { +Zotero.CSL.prototype._parseFieldDefaults = function(ref) { for each(var element in ref.children()) { - if(element.namespace() == Scholar.CSL.ns) { // ignore elements in other namespaces + if(element.namespace() == Zotero.CSL.ns) { // ignore elements in other namespaces var name = element.localName(); - Scholar.debug("CSL: parsing field defaults for "+name); + Zotero.debug("CSL: parsing field defaults for "+name); var fieldDesc = this._parseFieldAttrChildren(element); if(this._defaults[name]) { // inherit from existing defaults @@ -562,10 +562,10 @@ Scholar.CSL.prototype._parseFieldDefaults = function(ref) { /* * parses a list of fields into an array of objects */ -Scholar.CSL.prototype._parseFields = function(ref, position, type, bibCitElement, inheritFormat) { +Zotero.CSL.prototype._parseFields = function(ref, position, type, bibCitElement, inheritFormat) { var typeDesc = new Array(); for each(var element in ref) { - if(element.namespace() == Scholar.CSL.ns) { // ignore elements in other namespaces + if(element.namespace() == Zotero.CSL.ns) { // ignore elements in other namespaces var itemDesc = new Object(); itemDesc.name = element.localName(); @@ -610,7 +610,7 @@ Scholar.CSL.prototype._parseFields = function(ref, position, type, bibCitElement /* * parses an et al field */ -Scholar.CSL.prototype._parseEtAl = function(etAl, bibCitElement) { +Zotero.CSL.prototype._parseEtAl = function(etAl, bibCitElement) { if(etAl.length()) { bibCitElement.etAl = new Object(); @@ -638,7 +638,7 @@ Scholar.CSL.prototype._parseEtAl = function(etAl, bibCitElement) { * parses cs-format attributes into just a prefix and a suffix; accepts an * optional array of cs-format */ -Scholar.CSL.prototype._parseBibliographyOptions = function() { +Zotero.CSL.prototype._parseBibliographyOptions = function() { if(!this._csl.bibliography.length()) { return; } @@ -702,7 +702,7 @@ Scholar.CSL.prototype._parseBibliographyOptions = function() { * parses cs-format attributes into just a prefix and a suffix; accepts an * optional array of cs-format */ -Scholar.CSL.prototype._parseCitationOptions = function() { +Zotero.CSL.prototype._parseCitationOptions = function() { var citation = this._csl.citation; this._cit = new Object(); @@ -723,8 +723,8 @@ Scholar.CSL.prototype._parseCitationOptions = function() { * determine available reference types and add their XML objects to the tree * (they will be parsed on the fly when necessary; see _parseReferenceType) */ -Scholar.CSL.prototype._parseTypes = function(itemElements, bibCitElement) { - Scholar.debug("CSL: parsing item elements"); +Zotero.CSL.prototype._parseTypes = function(itemElements, bibCitElement) { + Zotero.debug("CSL: parsing item elements"); bibCitElement._types = new Object(); bibCitElement._serializations = new Object(); @@ -764,7 +764,7 @@ Scholar.CSL.prototype._parseTypes = function(itemElements, bibCitElement) { /* * convert reference types to native structures for speed */ -Scholar.CSL.prototype._getTypeObject = function(position, reftype, bibCitElement) { +Zotero.CSL.prototype._getTypeObject = function(position, reftype, bibCitElement) { if(!bibCitElement._types[position][reftype]) { // no type available return false; @@ -772,20 +772,20 @@ Scholar.CSL.prototype._getTypeObject = function(position, reftype, bibCitElement // parse type if necessary if(typeof(bibCitElement._types[position][reftype]) == "xml") { - Scholar.debug("CSL: parsing XML for "+reftype); + Zotero.debug("CSL: parsing XML for "+reftype); bibCitElement._types[position][reftype] = this._parseFields( bibCitElement._types[position][reftype].children(), position, reftype, bibCitElement, true); } - Scholar.debug("CSL: got object for "+reftype); + Zotero.debug("CSL: got object for "+reftype); return bibCitElement._types[position][reftype]; } /* * merges two elements, letting the second override the first */ -Scholar.CSL.prototype._merge = function(element1, element2) { +Zotero.CSL.prototype._merge = function(element1, element2) { var mergedElement = new Object(); for(var i in element1) { mergedElement[i] = element1[i]; @@ -800,11 +800,11 @@ Scholar.CSL.prototype._merge = function(element1, element2) { * gets defaults for a specific element; handles various inheritance rules * (contributor, locator) */ -Scholar.CSL.prototype._getFieldDefaults = function(elementName) { +Zotero.CSL.prototype._getFieldDefaults = function(elementName) { // first, see if there are specific defaults if(this._defaults[elementName]) { - if(Scholar.CSL._inherit[elementName]) { - var inheritedDefaults = this._getFieldDefaults(Scholar.CSL._inherit[elementName]); + if(Zotero.CSL._inherit[elementName]) { + var inheritedDefaults = this._getFieldDefaults(Zotero.CSL._inherit[elementName]); for(var i in inheritedDefaults) { // will only be called if there // is merging necessary return this._merge(inheritedDefaults, this._defaults[elementName]); @@ -813,8 +813,8 @@ Scholar.CSL.prototype._getFieldDefaults = function(elementName) { return this._defaults[elementName]; } // next, try to get defaults from the item from which this item inherits - if(Scholar.CSL._inherit[elementName]) { - return this._getFieldDefaults(Scholar.CSL._inherit[elementName]); + if(Zotero.CSL._inherit[elementName]) { + return this._getFieldDefaults(Zotero.CSL._inherit[elementName]); } // finally, return an empty object return {}; @@ -823,7 +823,7 @@ Scholar.CSL.prototype._getFieldDefaults = function(elementName) { /* * gets a term, in singular or plural form */ -Scholar.CSL.prototype._getTerm = function(term, plural, form) { +Zotero.CSL.prototype._getTerm = function(term, plural, form) { if(!form) { form = "long"; } @@ -846,7 +846,7 @@ Scholar.CSL.prototype._getTerm = function(term, plural, form) { /* * escapes a string for a given format */ -Scholar.CSL.prototype._escapeString = function(string, format) { +Zotero.CSL.prototype._escapeString = function(string, format) { if(format == "HTML") { // replace HTML entities string = string.replace(/&/g, "&amp;"); @@ -880,7 +880,7 @@ Scholar.CSL.prototype._escapeString = function(string, format) { /* * formats a string according to the cs-format attributes on element */ -Scholar.CSL.prototype._formatString = function(element, string, format, dontEscape) { +Zotero.CSL.prototype._formatString = function(element, string, format, dontEscape) { if(!string) return ""; if(typeof(string) != "string") { string = string.toString(); @@ -958,7 +958,7 @@ Scholar.CSL.prototype._formatString = function(element, string, format, dontEsca * formats a locator (pages, volume, issue) or an identifier (isbn, doi) * note that label should be null for an identifier */ -Scholar.CSL.prototype._formatLocator = function(identifier, element, number, format) { +Zotero.CSL.prototype._formatLocator = function(identifier, element, number, format) { var data = ""; if(number) { @@ -990,7 +990,7 @@ Scholar.CSL.prototype._formatLocator = function(identifier, element, number, for * format the date in format supplied by element from the date object * returned by this._processDate */ -Scholar.CSL.prototype._formatDate = function(element, date, format) { +Zotero.CSL.prototype._formatDate = function(element, date, format) { if(format == "disambiguate") { // for disambiguation, return only the year return date.year; @@ -1047,7 +1047,7 @@ Scholar.CSL.prototype._formatDate = function(element, date, format) { * serializes an element into a string suitable to prevent substitutes from * recurring in the same style */ -Scholar.CSL.prototype._serializeElement = function(name, element) { +Zotero.CSL.prototype._serializeElement = function(name, element) { var string = name; if(element.relation) { string += " relation:"+element.relation; @@ -1061,7 +1061,7 @@ Scholar.CSL.prototype._serializeElement = function(name, element) { /* * pads a number or other string with a given string on the left */ -Scholar.CSL.prototype._lpad = function(string, pad, length) { +Zotero.CSL.prototype._lpad = function(string, pad, length) { while(string.length < length) { string = pad + string; } @@ -1071,7 +1071,7 @@ Scholar.CSL.prototype._lpad = function(string, pad, length) { /* * handles sorting of items */ -Scholar.CSL.prototype._compareItem = function(a, b, opt) { +Zotero.CSL.prototype._compareItem = function(a, b, opt) { for(var i in this._bib.sortOrder) { var sortElement = this._bib.sortOrder[i]; @@ -1094,7 +1094,7 @@ Scholar.CSL.prototype._compareItem = function(a, b, opt) { * process creator objects; if someone had a creator model that handled * non-Western names better than ours, this would be the function to change */ -Scholar.CSL.prototype._processCreators = function(type, element, creators, format, bibCitElement) { +Zotero.CSL.prototype._processCreators = function(type, element, creators, format, bibCitElement) { var maxCreators = creators.length; if(!maxCreators) return; @@ -1201,8 +1201,8 @@ Scholar.CSL.prototype._processCreators = function(type, element, creators, forma /* * get a citation, given an item and bibCitElement */ -Scholar.CSL.prototype._getCitation = function(item, position, locatorType, locator, format, bibCitElement) { - Scholar.debug("CSL: generating citation for item "+item.getID()); +Zotero.CSL.prototype._getCitation = function(item, position, locatorType, locator, format, bibCitElement) { + Zotero.debug("CSL: generating citation for item "+item.getID()); if(!bibCitElement._types[position]) { position = "first"; @@ -1226,7 +1226,7 @@ Scholar.CSL.prototype._getCitation = function(item, position, locatorType, locat if(!type) { return false; } - Scholar.debug("CSL: using CSL type "+typeName); + Zotero.debug("CSL: using CSL type "+typeName); // remove previous ignore entries from list this._ignore = new Array(); @@ -1244,7 +1244,7 @@ Scholar.CSL.prototype._getCitation = function(item, position, locatorType, locat /* * processes an element from a (pre-processed) item into text */ -Scholar.CSL.prototype._getFieldValue = function(name, element, item, format, +Zotero.CSL.prototype._getFieldValue = function(name, element, item, format, bibCitElement, position, locatorType, locator, typeName) { var data = ""; @@ -1404,8 +1404,8 @@ Scholar.CSL.prototype._getFieldValue = function(name, element, item, format, substituteElement); var inheritElement; - if(Scholar.CSL._inherit[substituteElement.name] && Scholar.CSL._inherit[name] - && Scholar.CSL._inherit[substituteElement.name] == Scholar.CSL._inherit[name]) { + if(Zotero.CSL._inherit[substituteElement.name] && Zotero.CSL._inherit[name] + && Zotero.CSL._inherit[substituteElement.name] == Zotero.CSL._inherit[name]) { // if both substituteElement and the parent element inherit from // the same base element, apply styles here inheritElement = element; @@ -1453,10 +1453,10 @@ Scholar.CSL.prototype._getFieldValue = function(name, element, item, format, } /* - * THE FOLLOWING CODE IS SCHOLAR-SPECIFIC + * THE FOLLOWING CODE IS ZOTERO-SPECIFIC * gets a list of possible CSL types, in order of preference, for an item */ - Scholar.CSL._optionalTypeMappings = { + Zotero.CSL._optionalTypeMappings = { journalArticle:"article-journal", magazineArticle:"article-magazine", newspaperArticle:"article-newspaper", @@ -1469,7 +1469,7 @@ Scholar.CSL.prototype._getFieldValue = function(name, element, item, format, webpage:"webpage" }; // TODO: check with Elena/APA/MLA on this -Scholar.CSL._fallbackTypeMappings = { +Zotero.CSL._fallbackTypeMappings = { book:"book", bookSection:"chapter", journalArticle:"article", @@ -1484,25 +1484,25 @@ Scholar.CSL._fallbackTypeMappings = { webpage:"article" }; -Scholar.CSL.prototype._getTypeFromItem = function(item) { - var scholarType = Scholar.ItemTypes.getName(item.getType()); +Zotero.CSL.prototype._getTypeFromItem = function(item) { + var zoteroType = Zotero.ItemTypes.getName(item.getType()); // get type - Scholar.debug("CSL: parsing item of Scholar type "+scholarType); - return [Scholar.CSL._optionalTypeMappings[scholarType], Scholar.CSL._fallbackTypeMappings[scholarType]]; + Zotero.debug("CSL: parsing item of Zotero type "+zoteroType); + return [Zotero.CSL._optionalTypeMappings[zoteroType], Zotero.CSL._fallbackTypeMappings[zoteroType]]; } /* * separate creators object into authors, editors, and translators */ -Scholar.CSL.prototype._separateItemCreators = function(item) { +Zotero.CSL.prototype._separateItemCreators = function(item) { var authors = new Array(); var editors = new Array(); var translators = new Array(); - var authorID = Scholar.CreatorTypes.getID("author"); - var editorID = Scholar.CreatorTypes.getID("editor"); - var translatorID = Scholar.CreatorTypes.getID("translator"); + var authorID = Zotero.CreatorTypes.getID("author"); + var editorID = Zotero.CreatorTypes.getID("editor"); + var translatorID = Zotero.CreatorTypes.getID("translator"); var creators = item.getCreators(); for(var j in creators) { @@ -1524,9 +1524,9 @@ Scholar.CSL.prototype._separateItemCreators = function(item) { /* * return an object containing year, month, and day */ -Scholar.CSL.prototype._processDate = function(string) { - return Scholar.Date.strToDate(string); +Zotero.CSL.prototype._processDate = function(string) { + return Zotero.Date.strToDate(string); } /* - * END SCHOLAR-SPECIFIC CODE + * END ZOTERO-SPECIFIC CODE */ \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/xpcom/collectionTreeView.js b/chrome/chromeFiles/content/scholar/xpcom/collectionTreeView.js @@ -15,18 +15,18 @@ /* * Constructor the the CollectionTreeView object */ -Scholar.CollectionTreeView = function() +Zotero.CollectionTreeView = function() { this._treebox = null; this.refresh(); - this._unregisterID = Scholar.Notifier.registerColumnTree(this); + this._unregisterID = Zotero.Notifier.registerColumnTree(this); } /* * Called by the tree itself */ -Scholar.CollectionTreeView.prototype.setTree = function(treebox) +Zotero.CollectionTreeView.prototype.setTree = function(treebox) { if(this._treebox) return; @@ -39,19 +39,19 @@ Scholar.CollectionTreeView.prototype.setTree = function(treebox) * Reload the rows from the data access methods * (doesn't call the tree.invalidate methods, etc.) */ -Scholar.CollectionTreeView.prototype.refresh = function() +Zotero.CollectionTreeView.prototype.refresh = function() { this._dataItems = new Array(); this.rowCount = 0; - this._showItem(new Scholar.ItemGroup('library',null),0,1); + this._showItem(new Zotero.ItemGroup('library',null),0,1); - var newRows = Scholar.getCollections(); + var newRows = Zotero.getCollections(); for(var i = 0; i < newRows.length; i++) - this._showItem(new Scholar.ItemGroup('collection',newRows[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow + this._showItem(new Zotero.ItemGroup('collection',newRows[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow - var savedSearches = Scholar.Searches.getAll(); + var savedSearches = Zotero.Searches.getAll(); for(var i = 0; i < savedSearches.length; i++) - this._showItem(new Scholar.ItemGroup('search',savedSearches[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow + this._showItem(new Zotero.ItemGroup('search',savedSearches[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow this._refreshHashMap(); } @@ -59,7 +59,7 @@ Scholar.CollectionTreeView.prototype.refresh = function() /* * Redisplay everything */ -Scholar.CollectionTreeView.prototype.reload = function() +Zotero.CollectionTreeView.prototype.reload = function() { var openCollections = new Array(); @@ -83,12 +83,12 @@ Scholar.CollectionTreeView.prototype.reload = function() } /* - * Called by Scholar.Notifier on any changes to collections in the data layer + * Called by Zotero.Notifier on any changes to collections in the data layer */ -Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) +Zotero.CollectionTreeView.prototype.notify = function(action, type, ids) { var madeChanges = false; - var ids = Scholar.flattenArguments(ids); + var ids = Zotero.flattenArguments(ids); if(action == 'remove') { @@ -154,7 +154,7 @@ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) // Search rows aren't mapped to native objects, so we // have to pull the new data manually this._getItemAtRow(this._searchRowMap[ids[i]]).ref = - Scholar.Searches.get(ids[i]); + Zotero.Searches.get(ids[i]); this._treebox.invalidateRow(this._searchRowMap[ids[i]]); } break; @@ -169,13 +169,13 @@ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) switch (type) { case 'collection': - var item = Scholar.Collections.get(ids); - this._showItem(new Scholar.ItemGroup('collection',item), 0, this.rowCount); + var item = Zotero.Collections.get(ids); + this._showItem(new Zotero.ItemGroup('collection',item), 0, this.rowCount); break; case 'search': - var search = Scholar.Searches.get(ids); - this._showItem(new Scholar.ItemGroup('search', search), 0, this.rowCount); + var search = Zotero.Searches.get(ids); + this._showItem(new Zotero.ItemGroup('search', search), 0, this.rowCount); break; } @@ -189,24 +189,24 @@ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) } /* - * Unregisters view from Scholar.Notifier (called on window close) + * Unregisters view from Zotero.Notifier (called on window close) */ -Scholar.CollectionTreeView.prototype.unregister = function() +Zotero.CollectionTreeView.prototype.unregister = function() { - Scholar.Notifier.unregisterColumnTree(this._unregisterID); + Zotero.Notifier.unregisterColumnTree(this._unregisterID); } -Scholar.CollectionTreeView.prototype.isLibrary = function(row) +Zotero.CollectionTreeView.prototype.isLibrary = function(row) { return this._getItemAtRow(row).isLibrary(); } -Scholar.CollectionTreeView.prototype.isCollection = function(row) +Zotero.CollectionTreeView.prototype.isCollection = function(row) { return this._getItemAtRow(row).isCollection(); } -Scholar.CollectionTreeView.prototype.isSearch = function(row) +Zotero.CollectionTreeView.prototype.isSearch = function(row) { return this._getItemAtRow(row).isSearch(); } @@ -219,7 +219,7 @@ Scholar.CollectionTreeView.prototype.isSearch = function(row) /// //////////////////////////////////////////////////////////////////////////////// -Scholar.CollectionTreeView.prototype.getCellText = function(row, column) +Zotero.CollectionTreeView.prototype.getCellText = function(row, column) { var obj = this._getItemAtRow(row); @@ -229,23 +229,23 @@ Scholar.CollectionTreeView.prototype.getCellText = function(row, column) return ""; } -Scholar.CollectionTreeView.prototype.getImageSrc = function(row, col) +Zotero.CollectionTreeView.prototype.getImageSrc = function(row, col) { var collectionType = this._getItemAtRow(row).type; - return "chrome://scholar/skin/treesource-" + collectionType + ".png"; + return "chrome://zotero/skin/treesource-" + collectionType + ".png"; } -Scholar.CollectionTreeView.prototype.isContainer = function(row) +Zotero.CollectionTreeView.prototype.isContainer = function(row) { return this._getItemAtRow(row).isCollection(); } -Scholar.CollectionTreeView.prototype.isContainerOpen = function(row) +Zotero.CollectionTreeView.prototype.isContainerOpen = function(row) { return this._dataItems[row][1]; } -Scholar.CollectionTreeView.prototype.isContainerEmpty = function(row) +Zotero.CollectionTreeView.prototype.isContainerEmpty = function(row) { //NOTE: this returns true if the collection has no child collections @@ -256,12 +256,12 @@ Scholar.CollectionTreeView.prototype.isContainerEmpty = function(row) return true; } -Scholar.CollectionTreeView.prototype.getLevel = function(row) +Zotero.CollectionTreeView.prototype.getLevel = function(row) { return this._dataItems[row][2]; } -Scholar.CollectionTreeView.prototype.getParentIndex = function(row) +Zotero.CollectionTreeView.prototype.getParentIndex = function(row) { var thisLevel = this.getLevel(row); if(thisLevel == 0) return -1; @@ -271,7 +271,7 @@ Scholar.CollectionTreeView.prototype.getParentIndex = function(row) return -1; } -Scholar.CollectionTreeView.prototype.hasNextSibling = function(row, afterIndex) +Zotero.CollectionTreeView.prototype.hasNextSibling = function(row, afterIndex) { var thisLevel = this.getLevel(row); for(var i = afterIndex + 1; i < this.rowCount; i++) @@ -285,7 +285,7 @@ Scholar.CollectionTreeView.prototype.hasNextSibling = function(row, afterIndex) /* * Opens/closes the specified row */ -Scholar.CollectionTreeView.prototype.toggleOpenState = function(row) +Zotero.CollectionTreeView.prototype.toggleOpenState = function(row) { var count = 0; //used to tell the tree how many rows were added/removed var thisLevel = this.getLevel(row); @@ -301,12 +301,12 @@ Scholar.CollectionTreeView.prototype.toggleOpenState = function(row) } else { - var newRows = Scholar.getCollections(this._getItemAtRow(row).ref.getID()); //Get children + var newRows = Zotero.getCollections(this._getItemAtRow(row).ref.getID()); //Get children for(var i = 0; i < newRows.length; i++) { count++; - this._showItem(new Scholar.ItemGroup('collection',newRows[i]), thisLevel+1, row+i+1); //insert new row + this._showItem(new Zotero.ItemGroup('collection',newRows[i]), thisLevel+1, row+i+1); //insert new row } } this._dataItems[row][1] = !this._dataItems[row][1]; //toggle container open value @@ -326,7 +326,7 @@ Scholar.CollectionTreeView.prototype.toggleOpenState = function(row) /* * Delete the selection */ -Scholar.CollectionTreeView.prototype.deleteSelection = function() +Zotero.CollectionTreeView.prototype.deleteSelection = function() { if(this.selection.count == 0) return; @@ -361,7 +361,7 @@ Scholar.CollectionTreeView.prototype.deleteSelection = function() } else if(group.isSearch()) { - Scholar.Searches.erase(group.ref['id']); + Zotero.Searches.erase(group.ref['id']); } } this._treebox.endUpdateBatch(); @@ -379,7 +379,7 @@ Scholar.CollectionTreeView.prototype.deleteSelection = function() * level: the indent level of the row * beforeRow: row index to insert new row before */ -Scholar.CollectionTreeView.prototype._showItem = function(itemGroup, level, beforeRow) +Zotero.CollectionTreeView.prototype._showItem = function(itemGroup, level, beforeRow) { this._dataItems.splice(beforeRow, 0, [itemGroup, false, level]); this.rowCount++; } @@ -387,15 +387,15 @@ Scholar.CollectionTreeView.prototype._showItem = function(itemGroup, level, befo /* * Called by view to hide specified row */ -Scholar.CollectionTreeView.prototype._hideItem = function(row) +Zotero.CollectionTreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; } /* - * Returns a reference to the collection at row (see Scholar.Collection in data_access.js) + * Returns a reference to the collection at row (see Zotero.Collection in data_access.js) */ -Scholar.CollectionTreeView.prototype._getItemAtRow = function(row) +Zotero.CollectionTreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row][0]; } @@ -404,7 +404,7 @@ Scholar.CollectionTreeView.prototype._getItemAtRow = function(row) * Creates hash map of collection and search ids to row indexes * e.g., var rowForID = this._collectionRowMap[] */ -Scholar.CollectionTreeView.prototype._refreshHashMap = function() +Zotero.CollectionTreeView.prototype._refreshHashMap = function() { this._collectionRowMap = []; this._searchRowMap = []; @@ -425,24 +425,24 @@ Scholar.CollectionTreeView.prototype._refreshHashMap = function() /// //////////////////////////////////////////////////////////////////////////////// -Scholar.CollectionTreeCommandController = function(tree) +Zotero.CollectionTreeCommandController = function(tree) { this.tree = tree; } -Scholar.CollectionTreeCommandController.prototype.supportsCommand = function(cmd) +Zotero.CollectionTreeCommandController.prototype.supportsCommand = function(cmd) { } -Scholar.CollectionTreeCommandController.prototype.isCommandEnabled = function(cmd) +Zotero.CollectionTreeCommandController.prototype.isCommandEnabled = function(cmd) { } -Scholar.CollectionTreeCommandController.prototype.doCommand = function(cmd) +Zotero.CollectionTreeCommandController.prototype.doCommand = function(cmd) { } -Scholar.CollectionTreeCommandController.prototype.onEvent = function(evt) +Zotero.CollectionTreeCommandController.prototype.onEvent = function(evt) { } @@ -457,7 +457,7 @@ Scholar.CollectionTreeCommandController.prototype.onEvent = function(evt) /* * Called while a drag is over the tree. */ -Scholar.CollectionTreeView.prototype.canDrop = function(row, orient) +Zotero.CollectionTreeView.prototype.canDrop = function(row, orient) { if(typeof row == 'object') //workaround... two different services call canDrop (nsDragAndDrop, and the tree) return false; @@ -478,7 +478,7 @@ Scholar.CollectionTreeView.prototype.canDrop = function(row, orient) var dataType = data.flavour.contentType; //Highlight the rows correctly on drag: - if(orient == 1 && row == 0 && dataType == 'scholar/collection') //for dropping collections into root level + if(orient == 1 && row == 0 && dataType == 'zotero/collection') //for dropping collections into root level { return true; } @@ -486,12 +486,12 @@ Scholar.CollectionTreeView.prototype.canDrop = function(row, orient) { var rowCollection = this._getItemAtRow(row).ref; //the collection we are dragging over - if(dataType == 'scholar/item' || dataType == "text/x-moz-url") + if(dataType == 'zotero/item' || dataType == "text/x-moz-url") { var ids = data.data.split(','); for each(var id in ids) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); // Can only drag top-level items into collections if (item.isRegularItem() || !item.getSource()) { @@ -505,7 +505,7 @@ Scholar.CollectionTreeView.prototype.canDrop = function(row, orient) } return false; } - else if(dataType='scholar/collection' && data.data != rowCollection.getID() && !Scholar.Collections.get(data.data).hasDescendent('collection',rowCollection.getID()) ) + else if(dataType='zotero/collection' && data.data != rowCollection.getID() && !Zotero.Collections.get(data.data).hasDescendent('collection',rowCollection.getID()) ) return true; //collections cannot be dropped on themselves, nor in their children } return false; @@ -514,20 +514,20 @@ Scholar.CollectionTreeView.prototype.canDrop = function(row, orient) /* * Called when something's been dropped on or next to a row */ -Scholar.CollectionTreeView.prototype.drop = function(row, orient) +Zotero.CollectionTreeView.prototype.drop = function(row, orient) { var dataSet = nsTransferable.get(this.getSupportedFlavours(),nsDragAndDrop.getDragData, true); var data = dataSet.first.first; var dataType = data.flavour.contentType; - if(dataType == 'scholar/collection') + if(dataType == 'zotero/collection') { var oldCount = this.rowCount; var targetCollectionID; if(this._getItemAtRow(row).isCollection()) targetCollectionID = this._getItemAtRow(row).ref.getID(); - var droppedCollection = Scholar.Collections.get(data.data); + var droppedCollection = Zotero.Collections.get(data.data); droppedCollection.changeParent(targetCollectionID); var selectRow = this._collectionRowMap[data.data]; @@ -540,13 +540,13 @@ Scholar.CollectionTreeView.prototype.drop = function(row, orient) this.selection.selectEventsSuppressed = false; } - else if(dataType == 'scholar/item' && this.canDrop(row, orient)) + else if(dataType == 'zotero/item' && this.canDrop(row, orient)) { var ids = data.data.split(','); var targetCollection = this._getItemAtRow(row).ref; for each(var id in ids) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); // Only accept top-level items if (item.isRegularItem() || !item.getSource()) { @@ -559,7 +559,7 @@ Scholar.CollectionTreeView.prototype.drop = function(row, orient) var url = data.data.split("\n")[0]; /* WAITING FOR INGESTER SUPPORT - var newItem = Scholar.Ingester.scrapeURL(url); + var newItem = Zotero.Ingester.scrapeURL(url); if(newItem) this._getItemAtRow(row).ref.addItem(newItem.getID()); @@ -570,30 +570,30 @@ Scholar.CollectionTreeView.prototype.drop = function(row, orient) /* * Begin a drag */ -Scholar.CollectionTreeView.prototype.onDragStart = function(evt,transferData,action) +Zotero.CollectionTreeView.prototype.onDragStart = function(evt,transferData,action) { transferData.data=new TransferData(); //attach ID - transferData.data.addDataForFlavour("scholar/collection",this._getItemAtRow(this.selection.currentIndex).ref.getID()); + transferData.data.addDataForFlavour("zotero/collection",this._getItemAtRow(this.selection.currentIndex).ref.getID()); } /* * Returns the supported drag flavors */ -Scholar.CollectionTreeView.prototype.getSupportedFlavours = function () +Zotero.CollectionTreeView.prototype.getSupportedFlavours = function () { var flavors = new FlavourSet(); flavors.appendFlavour("text/x-moz-url"); - flavors.appendFlavour("scholar/item"); - flavors.appendFlavour("scholar/collection"); + flavors.appendFlavour("zotero/item"); + flavors.appendFlavour("zotero/collection"); return flavors; } /* * Called by nsDragAndDrop.js for any sort of drop on the tree */ -Scholar.CollectionTreeView.prototype.onDrop = function (evt,dropdata,session) { } +Zotero.CollectionTreeView.prototype.onDrop = function (evt,dropdata,session) { } //////////////////////////////////////////////////////////////////////////////// /// @@ -601,62 +601,62 @@ Scholar.CollectionTreeView.prototype.onDrop = function (evt,dropdata,session) { /// //////////////////////////////////////////////////////////////////////////////// -Scholar.CollectionTreeView.prototype.isSorted = function() { return false; } -Scholar.CollectionTreeView.prototype.isSeparator = function(row) { return false; } -Scholar.CollectionTreeView.prototype.isEditable = function(row, idx) { return false; } -Scholar.CollectionTreeView.prototype.getRowProperties = function(row, prop) { } -Scholar.CollectionTreeView.prototype.getColumnProperties = function(col, prop) { } -Scholar.CollectionTreeView.prototype.getCellProperties = function(row, col, prop) { } -Scholar.CollectionTreeView.prototype.performAction = function(action) { } -Scholar.CollectionTreeView.prototype.performActionOnCell = function(action, row, col) { } -Scholar.CollectionTreeView.prototype.getProgressMode = function(row, col) { } -Scholar.CollectionTreeView.prototype.cycleHeader = function(column) { } +Zotero.CollectionTreeView.prototype.isSorted = function() { return false; } +Zotero.CollectionTreeView.prototype.isSeparator = function(row) { return false; } +Zotero.CollectionTreeView.prototype.isEditable = function(row, idx) { return false; } +Zotero.CollectionTreeView.prototype.getRowProperties = function(row, prop) { } +Zotero.CollectionTreeView.prototype.getColumnProperties = function(col, prop) { } +Zotero.CollectionTreeView.prototype.getCellProperties = function(row, col, prop) { } +Zotero.CollectionTreeView.prototype.performAction = function(action) { } +Zotero.CollectionTreeView.prototype.performActionOnCell = function(action, row, col) { } +Zotero.CollectionTreeView.prototype.getProgressMode = function(row, col) { } +Zotero.CollectionTreeView.prototype.cycleHeader = function(column) { } //////////////////////////////////////////////////////////////////////////////// /// -/// Scholar ItemGroup -- a sort of "super class" for collection, library, +/// Zotero ItemGroup -- a sort of "super class" for collection, library, /// and saved search /// //////////////////////////////////////////////////////////////////////////////// -Scholar.ItemGroup = function(type, ref) +Zotero.ItemGroup = function(type, ref) { this.type = type; this.ref = ref; } -Scholar.ItemGroup.prototype.isLibrary = function() +Zotero.ItemGroup.prototype.isLibrary = function() { return this.type == 'library'; } -Scholar.ItemGroup.prototype.isCollection = function() +Zotero.ItemGroup.prototype.isCollection = function() { return this.type == 'collection'; } -Scholar.ItemGroup.prototype.isSearch = function() +Zotero.ItemGroup.prototype.isSearch = function() { return this.type == 'search'; } -Scholar.ItemGroup.prototype.getName = function() +Zotero.ItemGroup.prototype.getName = function() { if(this.isCollection()) return this.ref.getName(); else if(this.isLibrary()) - return Scholar.getString('pane.collections.library'); + return Zotero.getString('pane.collections.library'); else if(this.isSearch()) return this.ref['name']; else return ""; } -Scholar.ItemGroup.prototype.getChildItems = function() +Zotero.ItemGroup.prototype.getChildItems = function() { if(this.searchText) { - var s = new Scholar.Search(); + var s = new Zotero.Search(); if (this.isCollection()) { s.addCondition('collectionID', 'is', this.ref.getID(), true); @@ -666,26 +666,26 @@ Scholar.ItemGroup.prototype.getChildItems = function() s.addCondition('savedSearchID', 'is', this.ref['id'], true); } s.addCondition('quicksearch', 'contains', this.searchText); - return Scholar.Items.get(s.search()); + return Zotero.Items.get(s.search()); } else { if(this.isCollection()) - return Scholar.getItems(this.ref.getID()); + return Zotero.getItems(this.ref.getID()); else if(this.isLibrary()) - return Scholar.getItems(); + return Zotero.getItems(); else if(this.isSearch()) { - var s = new Scholar.Search(); + var s = new Zotero.Search(); s.load(this.ref['id']); - return Scholar.Items.get(s.search()); + return Zotero.Items.get(s.search()); } else return null; } } -Scholar.ItemGroup.prototype.setSearch = function(searchText) +Zotero.ItemGroup.prototype.setSearch = function(searchText) { this.searchText = searchText; } \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -1,9 +1,9 @@ /* * Constructor for Item object * - * Generally should be called through Scholar.Items rather than directly + * Generally should be called through Zotero.Items rather than directly */ -Scholar.Item = function(){ +Zotero.Item = function(){ this._init(); // Accept itemTypeID in constructor @@ -12,20 +12,20 @@ Scholar.Item = function(){ } } -Scholar.Item.prototype._init = function(){ +Zotero.Item.prototype._init = function(){ // // Public members for access by public methods -- do not access directly // this._data = new Array(); - this._creators = new Scholar.Hash(); + this._creators = new Zotero.Hash(); this._itemData = new Array(); this._creatorsLoaded = false; this._itemDataLoaded = false; - this._changed = new Scholar.Hash(); - this._changedCreators = new Scholar.Hash(); - this._changedItemData = new Scholar.Hash(); + this._changed = new Zotero.Hash(); + this._changedCreators = new Zotero.Hash(); + this._changedItemData = new Zotero.Hash(); this._noteData = null; this._noteDataAccessTime = null; @@ -36,43 +36,43 @@ Scholar.Item.prototype._init = function(){ ////////////////////////////////////////////////////////////////////////////// // -// Public Scholar.Item methods +// Public Zotero.Item methods // ////////////////////////////////////////////////////////////////////////////// /* * Check if the specified field is a primary field from the items table */ -Scholar.Item.prototype.isPrimaryField = function(field){ +Zotero.Item.prototype.isPrimaryField = function(field){ // Create primaryFields hash array if not yet created - if (!Scholar.Item.primaryFields){ - Scholar.Item.primaryFields = Scholar.DB.getColumnHash('items'); - Scholar.Item.primaryFields['firstCreator'] = true; - Scholar.Item.primaryFields['numChildren'] = true; - Scholar.Item.primaryFields['numNotes'] = true; - Scholar.Item.primaryFields['numAttachments'] = true; + if (!Zotero.Item.primaryFields){ + Zotero.Item.primaryFields = Zotero.DB.getColumnHash('items'); + Zotero.Item.primaryFields['firstCreator'] = true; + Zotero.Item.primaryFields['numChildren'] = true; + Zotero.Item.primaryFields['numNotes'] = true; + Zotero.Item.primaryFields['numAttachments'] = true; } - return !!Scholar.Item.primaryFields[field]; + return !!Zotero.Item.primaryFields[field]; } -Scholar.Item.editableFields = { +Zotero.Item.editableFields = { title: true }; /* * Check if the specified primary field can be changed with setField() */ -Scholar.Item.prototype.isEditableField = function(field){ - return !!Scholar.Item.editableFields[field]; +Zotero.Item.prototype.isEditableField = function(field){ + return !!Zotero.Item.editableFields[field]; } /* * Build object from database */ -Scholar.Item.prototype.loadFromID = function(id){ - // Should be the same as query in Scholar.Items.loadFromID, just +Zotero.Item.prototype.loadFromID = function(id){ + // Should be the same as query in Zotero.Items.loadFromID, just // without itemID clause var sql = 'SELECT I.*, lastName || ' + 'CASE ((SELECT COUNT(*) FROM itemCreators WHERE itemID=' + id + ')>1) ' @@ -84,7 +84,7 @@ Scholar.Item.prototype.loadFromID = function(id){ + 'LEFT JOIN creators C ON (IC.creatorID=C.creatorID) ' + 'WHERE itemID=' + id + ' AND (IC.orderIndex=0 OR IC.orderIndex IS NULL)'; // first creator - var row = Scholar.DB.rowQuery(sql); + var row = Zotero.DB.rowQuery(sql); this.loadFromRow(row); } @@ -92,7 +92,7 @@ Scholar.Item.prototype.loadFromID = function(id){ /* * Populate basic item data from a database row */ -Scholar.Item.prototype.loadFromRow = function(row){ +Zotero.Item.prototype.loadFromRow = function(row){ this._init(); for (col in row){ // Only accept primary field data through loadFromRow() @@ -105,7 +105,7 @@ Scholar.Item.prototype.loadFromRow = function(row){ this._data[col] = row[col]; } else { - Scholar.debug(col + ' is not a valid primary field'); + Zotero.debug(col + ' is not a valid primary field'); } } return true; @@ -115,18 +115,18 @@ Scholar.Item.prototype.loadFromRow = function(row){ /* * Check if any data fields have changed since last save */ -Scholar.Item.prototype.hasChanged = function(){ +Zotero.Item.prototype.hasChanged = function(){ return (this._changed.length || this._changedCreators.length || this._changedItemData.length); } -Scholar.Item.prototype.getID = function(){ +Zotero.Item.prototype.getID = function(){ return this._data['itemID'] ? this._data['itemID'] : false; } -Scholar.Item.prototype.getType = function(){ +Zotero.Item.prototype.getType = function(){ return this._data['itemTypeID'] ? this._data['itemTypeID'] : false; } @@ -134,7 +134,7 @@ Scholar.Item.prototype.getType = function(){ /* * Set or change the item's type */ -Scholar.Item.prototype.setType = function(itemTypeID){ +Zotero.Item.prototype.setType = function(itemTypeID){ if (itemTypeID==this.getType()){ return true; } @@ -145,7 +145,7 @@ Scholar.Item.prototype.setType = function(itemTypeID){ + 'WHERE itemTypeID=' + this.getType() + ' AND fieldID NOT IN ' + '(SELECT fieldID FROM itemTypeFields WHERE itemTypeID=' + itemTypeID + ')'; - var obsoleteFields = Scholar.DB.columnQuery(sql); + var obsoleteFields = Zotero.DB.columnQuery(sql); if (obsoleteFields){ for (var i=0; i<obsoleteFields.length; i++){ @@ -163,8 +163,8 @@ Scholar.Item.prototype.setType = function(itemTypeID){ /** * Return an array of collectionIDs for all collections the item belongs to **/ -Scholar.Item.prototype.getCollections = function(){ - return Scholar.DB.columnQuery("SELECT collectionID FROM collectionItems " +Zotero.Item.prototype.getCollections = function(){ + return Zotero.DB.columnQuery("SELECT collectionID FROM collectionItems " + "WHERE itemID=" + this.getID()); } @@ -172,8 +172,8 @@ Scholar.Item.prototype.getCollections = function(){ /** * Determine whether the item belongs to a given collectionID **/ -Scholar.Item.prototype.inCollection = function(collectionID){ - return !!parseInt(Scholar.DB.valueQuery("SELECT COUNT(*) collectionID " +Zotero.Item.prototype.inCollection = function(collectionID){ + return !!parseInt(Zotero.DB.valueQuery("SELECT COUNT(*) collectionID " + "FROM collectionItems WHERE collectionID=" + collectionID + " AND " + "itemID=" + this.getID())); } @@ -182,7 +182,7 @@ Scholar.Item.prototype.inCollection = function(collectionID){ /* * Returns the number of creators for this item */ -Scholar.Item.prototype.numCreators = function(){ +Zotero.Item.prototype.numCreators = function(){ if (this.getID() && !this._creatorsLoaded){ this._loadCreators(); } @@ -190,7 +190,7 @@ Scholar.Item.prototype.numCreators = function(){ } -Scholar.Item.prototype.hasCreatorAt = function(pos){ +Zotero.Item.prototype.hasCreatorAt = function(pos){ if (this.getID() && !this._creatorsLoaded){ this._loadCreators(); } @@ -204,7 +204,7 @@ Scholar.Item.prototype.hasCreatorAt = function(pos){ * * Note: Creator data array is returned by reference */ -Scholar.Item.prototype.getCreator = function(pos){ +Zotero.Item.prototype.getCreator = function(pos){ if (this.getID() && !this._creatorsLoaded){ this._loadCreators(); } @@ -221,7 +221,7 @@ Scholar.Item.prototype.getCreator = function(pos){ * * Note: Creator data array is returned by reference */ -Scholar.Item.prototype.getCreators = function(){ +Zotero.Item.prototype.getCreators = function(){ var creators = []; for (var i=0, len=this.numCreators(); i<len; i++){ creators.push(this.getCreator(i)); @@ -233,7 +233,7 @@ Scholar.Item.prototype.getCreators = function(){ /* * Set or update the creator at the specified position */ -Scholar.Item.prototype.setCreator = function(orderIndex, firstName, lastName, creatorTypeID, isInstitution){ +Zotero.Item.prototype.setCreator = function(orderIndex, firstName, lastName, creatorTypeID, isInstitution){ if (this.getID() && !this._creatorsLoaded){ this._loadCreators(); } @@ -276,7 +276,7 @@ Scholar.Item.prototype.setCreator = function(orderIndex, firstName, lastName, cr /* * Remove a creator and shift others down */ -Scholar.Item.prototype.removeCreator = function(orderIndex){ +Zotero.Item.prototype.removeCreator = function(orderIndex){ if (this.getID() && !this._creatorsLoaded){ this._loadCreators(); } @@ -298,7 +298,7 @@ Scholar.Item.prototype.removeCreator = function(orderIndex){ // Currently unused -Scholar.Item.prototype.creatorExists = function(firstName, lastName, creatorTypeID, isInstitution, skipIndex){ +Zotero.Item.prototype.creatorExists = function(firstName, lastName, creatorTypeID, isInstitution, skipIndex){ if (isInstitution || !firstName){ firstName = ''; } @@ -332,8 +332,8 @@ Scholar.Item.prototype.creatorExists = function(firstName, lastName, creatorType * * Field can be passed as fieldID or fieldName */ -Scholar.Item.prototype.getField = function(field){ - //Scholar.debug('Requesting field ' + field + ' for item ' + this.getID(), 4); +Zotero.Item.prototype.getField = function(field){ + //Zotero.debug('Requesting field ' + field + ' for item ' + this.getID(), 4); if (this.isPrimaryField(field)){ return this._data[field] ? this._data[field] : ''; } @@ -342,7 +342,7 @@ Scholar.Item.prototype.getField = function(field){ this._loadItemData(); } - var fieldID = Scholar.ItemFields.getID(field); + var fieldID = Zotero.ItemFields.getID(field); return this._itemData[fieldID] ? this._itemData[fieldID] : ''; } @@ -354,7 +354,7 @@ Scholar.Item.prototype.getField = function(field){ * * Field can be passed as fieldID or fieldName */ -Scholar.Item.prototype.setField = function(field, value, loadIn){ +Zotero.Item.prototype.setField = function(field, value, loadIn){ if (!field){ throw ("Field not specified in Item.setField()"); } @@ -387,13 +387,13 @@ Scholar.Item.prototype.setField = function(field, value, loadIn){ this._loadItemData(); } - var fieldID = Scholar.ItemFields.getID(field); + var fieldID = Zotero.ItemFields.getID(field); if (!fieldID){ throw (field + ' is not a valid itemData field.'); } - if (!Scholar.ItemFields.isValidForType(fieldID, this.getType())){ + if (!Zotero.ItemFields.isValidForType(fieldID, this.getType())){ throw (field + ' is not a valid field for this type.'); } @@ -418,9 +418,9 @@ Scholar.Item.prototype.setField = function(field, value, loadIn){ * * Returns true on item update or itemID of new item */ -Scholar.Item.prototype.save = function(){ +Zotero.Item.prototype.save = function(){ if (!this.hasChanged()){ - Scholar.debug('Item ' + this.getID() + ' has not changed', 4); + Zotero.debug('Item ' + this.getID() + ' has not changed', 4); return !!this.getID(); } @@ -428,20 +428,20 @@ Scholar.Item.prototype.save = function(){ // Existing item, update // if (this.getID()){ - Scholar.debug('Updating database with new item data', 4); + Zotero.debug('Updating database with new item data', 4); var itemID = this.getID(); try { - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); // Begin history transaction - Scholar.History.begin('modify-item', this.getID()); + Zotero.History.begin('modify-item', this.getID()); // // Primary fields // - Scholar.History.modify('items', 'itemID', this.getID()); + Zotero.History.modify('items', 'itemID', this.getID()); var sql = "UPDATE items SET "; var sql2; @@ -461,25 +461,25 @@ Scholar.Item.prototype.save = function(){ sql += "WHERE itemID=?"; sqlValues.push({'int':this.getID()}); - Scholar.DB.query(sql, sqlValues); + Zotero.DB.query(sql, sqlValues); // // Creators // if (this._changedCreators.length){ for (orderIndex in this._changedCreators.items){ - Scholar.debug('Creator ' + orderIndex + ' has changed', 4); + Zotero.debug('Creator ' + orderIndex + ' has changed', 4); var creator = this.getCreator(orderIndex); // Delete at position - Scholar.History.remove('itemCreators', 'itemID-orderIndex', + Zotero.History.remove('itemCreators', 'itemID-orderIndex', [this.getID(), orderIndex]); sql2 = 'DELETE FROM itemCreators' + ' WHERE itemID=' + this.getID() + ' AND orderIndex=' + orderIndex; - Scholar.DB.query(sql2); + Zotero.DB.query(sql2); // If empty, move on if (typeof creator['firstName'] == 'undefined' @@ -488,7 +488,7 @@ Scholar.Item.prototype.save = function(){ } // See if this is an existing creator - var creatorID = Scholar.Creators.getID( + var creatorID = Zotero.Creators.getID( creator['firstName'], creator['lastName'], creator['isInstitution'] @@ -496,12 +496,12 @@ Scholar.Item.prototype.save = function(){ // If not, add it if (!creatorID){ - creatorID = Scholar.Creators.add( + creatorID = Zotero.Creators.add( creator['firstName'], creator['lastName'], creator['isInstitution'] ); - Scholar.History.add('creators', 'creatorID', creatorID); + Zotero.History.add('creators', 'creatorID', creatorID); } @@ -519,19 +519,19 @@ Scholar.Item.prototype.save = function(){ {'int':orderIndex} ]; - Scholar.DB.query(sql, sqlValues); + Zotero.DB.query(sql, sqlValues); - Scholar.History.add('itemCreators', + Zotero.History.add('itemCreators', 'itemID-creatorID-creatorTypeID', [this.getID(), creatorID, creator['creatorTypeID']]); } // Delete obsolete creators var deleted; - if (deleted = Scholar.Creators.purge()){ + if (deleted = Zotero.Creators.purge()){ for (var i in deleted){ // Add purged creators to history - Scholar.History.remove('creators', 'creatorID', i); + Zotero.History.remove('creators', 'creatorID', i); } } } @@ -544,13 +544,13 @@ Scholar.Item.prototype.save = function(){ var del = new Array(); sql = "SELECT COUNT(*) FROM itemData WHERE itemID=? AND fieldID=?"; - var countStatement = Scholar.DB.getStatement(sql); + var countStatement = Zotero.DB.getStatement(sql); sql = "UPDATE itemData SET value=? WHERE itemID=? AND fieldID=?"; - var updateStatement = Scholar.DB.getStatement(sql); + var updateStatement = Zotero.DB.getStatement(sql); sql = "INSERT INTO itemData VALUES (?,?,?)"; - var insertStatement = Scholar.DB.getStatement(sql); + var insertStatement = Zotero.DB.getStatement(sql); for (fieldID in this._changedItemData.items){ if (this.getField(fieldID)){ @@ -565,21 +565,21 @@ Scholar.Item.prototype.save = function(){ if (exists){ updateStatement.bindInt32Parameter(1, this.getID()); - Scholar.History.modify('itemData', 'itemID-fieldID', + Zotero.History.modify('itemData', 'itemID-fieldID', [this.getID(), fieldID]); // Don't bind CURRENT_TIMESTAMP as string - if (Scholar.ItemFields.getID('accessDate')==fieldID + if (Zotero.ItemFields.getID('accessDate')==fieldID && this.getField(fieldID)=='CURRENT_TIMESTAMP') { sql = "UPDATE itemData SET value=CURRENT_TIMESTAMP" + " WHERE itemID=? AND fieldID=?"; - Scholar.DB.query(sql, + Zotero.DB.query(sql, [{int:this.getID()}, {int:fieldID}]); } else { // Take advantage of SQLite's manifest typing - if (Scholar.ItemFields.isInteger(fieldID)){ + if (Zotero.ItemFields.isInteger(fieldID)){ updateStatement.bindInt32Parameter(0, this.getField(fieldID)); } @@ -594,23 +594,23 @@ Scholar.Item.prototype.save = function(){ // Insert else { - Scholar.History.add('itemData', 'itemID-fieldID', + Zotero.History.add('itemData', 'itemID-fieldID', [this.getID(), fieldID]); insertStatement.bindInt32Parameter(0, this.getID()); insertStatement.bindInt32Parameter(1, fieldID); - if (Scholar.ItemFields.getID('accessDate')==fieldID + if (Zotero.ItemFields.getID('accessDate')==fieldID && this.getField(fieldID)=='CURRENT_TIMESTAMP') { sql = "INSERT INTO itemData VALUES " + "(?,?,CURRENT_TIMESTAMP)"; - Scholar.DB.query(sql, + Zotero.DB.query(sql, [{int:this.getID()}, {int:fieldID}]); } else { - if (Scholar.ItemFields.isInteger(fieldID)){ + if (Zotero.ItemFields.isInteger(fieldID)){ insertStatement.bindInt32Parameter(2, this.getField(fieldID)); } @@ -638,23 +638,23 @@ Scholar.Item.prototype.save = function(){ if (del.length){ // Add to history for (var i in del){ - Scholar.History.remove('itemData', 'itemID-fieldID', + Zotero.History.remove('itemData', 'itemID-fieldID', [this.getID(), del[i]]); } sql = 'DELETE from itemData ' + 'WHERE itemID=' + this.getID() + ' ' + 'AND fieldID IN (' + del.join() + ")"; - Scholar.DB.query(sql); + Zotero.DB.query(sql); } } - Scholar.History.commit(); - Scholar.DB.commitTransaction(); + Zotero.History.commit(); + Zotero.DB.commitTransaction(); } catch (e){ - Scholar.History.cancel(); - Scholar.DB.rollbackTransaction(); + Zotero.History.cancel(); + Zotero.DB.rollbackTransaction(); throw(e); } } @@ -663,7 +663,7 @@ Scholar.Item.prototype.save = function(){ // New item, insert and return id // else { - Scholar.debug('Saving data for new item to database'); + Zotero.debug('Saving data for new item to database'); var isNew = true; var sqlColumns = new Array(); @@ -673,7 +673,7 @@ Scholar.Item.prototype.save = function(){ // Primary fields // sqlColumns.push('itemID'); - var itemID = Scholar.getRandomID('items', 'itemID'); + var itemID = Zotero.getRandomID('items', 'itemID'); sqlValues.push(itemID); sqlColumns.push('itemTypeID'); @@ -685,11 +685,11 @@ Scholar.Item.prototype.save = function(){ } try { - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); // Begin history transaction // No associated id yet, so we use false - Scholar.History.begin('add-item', false); + Zotero.History.begin('add-item', false); // // Primary fields @@ -703,11 +703,11 @@ Scholar.Item.prototype.save = function(){ sql = sql.substring(0,sql.length-1) + ")"; // Save basic data to items table - Scholar.DB.query(sql, sqlValues); + Zotero.DB.query(sql, sqlValues); this._data['itemID'] = itemID; - Scholar.History.setAssociatedID(itemID); - Scholar.History.add('items', 'itemID', itemID); + Zotero.History.setAssociatedID(itemID); + Zotero.History.add('items', 'itemID', itemID); // // ItemData @@ -715,7 +715,7 @@ Scholar.Item.prototype.save = function(){ if (this._changedItemData.length){ // Use manual bound parameters to speed things up var statement = - Scholar.DB.getStatement("INSERT INTO itemData VALUES (?,?,?)"); + Zotero.DB.getStatement("INSERT INTO itemData VALUES (?,?,?)"); for (fieldID in this._changedItemData.items){ if (!this.getField(fieldID)){ @@ -725,14 +725,14 @@ Scholar.Item.prototype.save = function(){ statement.bindInt32Parameter(0, this.getID()); statement.bindInt32Parameter(1, fieldID); - if (Scholar.ItemFields.getID('accessDate')==fieldID + if (Zotero.ItemFields.getID('accessDate')==fieldID && this.getField(fieldID)=='CURRENT_TIMESTAMP') { sql = "INSERT INTO itemData VALUES (?,?,CURRENT_TIMESTAMP)"; - Scholar.DB.query(sql, [{int:this.getID()}, {int:fieldID}]) + Zotero.DB.query(sql, [{int:this.getID()}, {int:fieldID}]) } else { - if (Scholar.ItemFields.isInteger(fieldID)){ + if (Zotero.ItemFields.isInteger(fieldID)){ statement.bindInt32Parameter(2, this.getField(fieldID)); } else { @@ -741,7 +741,7 @@ Scholar.Item.prototype.save = function(){ statement.execute(); } - Scholar.History.add('itemData', 'itemID-fieldID', + Zotero.History.add('itemData', 'itemID-fieldID', [itemID, fieldID]); } @@ -761,7 +761,7 @@ Scholar.Item.prototype.save = function(){ } // See if this is an existing creator - var creatorID = Scholar.Creators.getID( + var creatorID = Zotero.Creators.getID( creator['firstName'], creator['lastName'], creator['isInstitution'] @@ -769,72 +769,72 @@ Scholar.Item.prototype.save = function(){ // If not, add it if (!creatorID){ - creatorID = Scholar.Creators.add( + creatorID = Zotero.Creators.add( creator['firstName'], creator['lastName'], creator['isInstitution'] ); - Scholar.History.add('creators', 'creatorID', creatorID); + Zotero.History.add('creators', 'creatorID', creatorID); } sql = 'INSERT INTO itemCreators VALUES (' + itemID + ',' + creatorID + ',' + creator['creatorTypeID'] + ', ' + orderIndex + ")"; - Scholar.DB.query(sql); + Zotero.DB.query(sql); - Scholar.History.add('itemCreators', + Zotero.History.add('itemCreators', 'itemID-creatorID-creatorTypeID', [this.getID(), creatorID, creator['creatorTypeID']]); } } - Scholar.History.commit(); - Scholar.DB.commitTransaction(); + Zotero.History.commit(); + Zotero.DB.commitTransaction(); // Reload collection to update isEmpty, // in case this was the first item in a collection - Scholar.Collections.reloadAll(); + Zotero.Collections.reloadAll(); } catch (e){ - Scholar.History.cancel(); - Scholar.DB.rollbackTransaction(); + Zotero.History.cancel(); + Zotero.DB.rollbackTransaction(); throw(e); } } - Scholar.Items.reload(this.getID()); + Zotero.Items.reload(this.getID()); if (isNew){ - if (!Scholar.DB.transactionInProgress()){ - Scholar.Notifier.trigger('add', 'item', this.getID()); + if (!Zotero.DB.transactionInProgress()){ + Zotero.Notifier.trigger('add', 'item', this.getID()); } return this.getID(); } else { - if (!Scholar.DB.transactionInProgress()){ - Scholar.Notifier.trigger('modify', 'item', this.getID()); + if (!Zotero.DB.transactionInProgress()){ + Zotero.Notifier.trigger('modify', 'item', this.getID()); } return true; } } -Scholar.Item.prototype.updateDateModified = function(){ - Scholar.DB.query("UPDATE items SET dateModified=CURRENT_TIMESTAMP " +Zotero.Item.prototype.updateDateModified = function(){ + Zotero.DB.query("UPDATE items SET dateModified=CURRENT_TIMESTAMP " + "WHERE itemID=" + this.getID()); - var date = Scholar.DB.valueQuery("SELECT dateModified FROM items " + var date = Zotero.DB.valueQuery("SELECT dateModified FROM items " + "WHERE itemID=" + this.getID()); this._data['dateModified'] = date; } -Scholar.Item.prototype.isRegularItem = function(){ +Zotero.Item.prototype.isRegularItem = function(){ return !(this.isNote() || this.isAttachment()); } -Scholar.Item.prototype.numChildren = function(){ +Zotero.Item.prototype.numChildren = function(){ return this.numNotes() + this.numAttachments(); } @@ -846,12 +846,12 @@ Scholar.Item.prototype.numChildren = function(){ // save() is not required for note functions // //////////////////////////////////////////////////////// -Scholar.Item.prototype.incrementNoteCount = function(){ +Zotero.Item.prototype.incrementNoteCount = function(){ this._data['numNotes']++; } -Scholar.Item.prototype.decrementNoteCount = function(){ +Zotero.Item.prototype.decrementNoteCount = function(){ this._data['numNotes']--; } @@ -859,8 +859,8 @@ Scholar.Item.prototype.decrementNoteCount = function(){ /** * Determine if an item is a note **/ -Scholar.Item.prototype.isNote = function(){ - return Scholar.ItemTypes.getName(this.getType())=='note'; +Zotero.Item.prototype.isNote = function(){ + return Zotero.ItemTypes.getName(this.getType())=='note'; } @@ -869,7 +869,7 @@ Scholar.Item.prototype.isNote = function(){ * * Note: This can only be called on note items. **/ -Scholar.Item.prototype.updateNote = function(text){ +Zotero.Item.prototype.updateNote = function(text){ if (!this.isNote() && !this.isAttachment()){ throw ("updateNote() can only be called on items of type 'note'"); } @@ -878,7 +878,7 @@ Scholar.Item.prototype.updateNote = function(text){ throw ("Cannot call updateNote() on unsaved note"); } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); if (this.isNote()){ var sql = "UPDATE itemNotes SET note=? WHERE itemID=?"; @@ -887,21 +887,21 @@ Scholar.Item.prototype.updateNote = function(text){ var sql = "REPLACE INTO itemNotes (note, itemID) VALUES (?,?)"; } var bindParams = [{string:text}, this.getID()]; - var updated = Scholar.DB.query(sql, bindParams); + var updated = Zotero.DB.query(sql, bindParams); if (updated){ this.updateDateModified(); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); this.updateNoteCache(text); - Scholar.Notifier.trigger('modify', 'item', this.getID()); + Zotero.Notifier.trigger('modify', 'item', this.getID()); } else { - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } } -Scholar.Item.prototype.updateNoteCache = function(text){ +Zotero.Item.prototype.updateNoteCache = function(text){ // Update cached values this._noteData = text ? text : ''; if (this.isNote()){ @@ -910,7 +910,7 @@ Scholar.Item.prototype.updateNoteCache = function(text){ } -Scholar.Item.prototype.setSource = function(sourceItemID){ +Zotero.Item.prototype.setSource = function(sourceItemID){ if (this.isNote()){ var type = 'note'; var Type = 'Note'; @@ -927,26 +927,26 @@ Scholar.Item.prototype.setSource = function(sourceItemID){ throw ("Cannot call setSource() on unsaved " + type); } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); - var newItem = Scholar.Items.get(sourceItemID); + var newItem = Zotero.Items.get(sourceItemID); // FK check if (sourceItemID && !newItem){ - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); throw ("Cannot set " + type + " source to invalid item " + sourceItemID); } var oldSourceItemID = this.getSource(); if (oldSourceItemID==sourceItemID){ - Scholar.debug(Type + " source hasn't changed", 4); - Scholar.DB.commitTransaction(); + Zotero.debug(Type + " source hasn't changed", 4); + Zotero.DB.commitTransaction(); return false; } - var oldItem = Scholar.Items.get(oldSourceItemID); + var oldItem = Zotero.Items.get(oldSourceItemID); if (oldSourceItemID && !oldItem){ - Scholar.debug("Old source item " + oldSourceItemID + Zotero.debug("Old source item " + oldSourceItemID + "didn't exist in setSource()", 2); } @@ -954,27 +954,27 @@ Scholar.Item.prototype.setSource = function(sourceItemID){ // existed previously and add source instead if there is one if (!oldSourceItemID){ var sql = "SELECT collectionID FROM collectionItems WHERE itemID=?"; - var changedCollections = Scholar.DB.columnQuery(sql, this.getID()); + var changedCollections = Zotero.DB.columnQuery(sql, this.getID()); if (changedCollections){ if (sourceItemID){ var sql = "UPDATE OR REPLACE collectionItems " + "SET itemID=? WHERE itemID=?"; - Scholar.DB.query(sql, [sourceItemID, this.getID()]); + Zotero.DB.query(sql, [sourceItemID, this.getID()]); } else { var sql = "DELETE FROM collectionItems WHERE itemID=?"; - Scholar.DB.query(sql, this.getID()); + Zotero.DB.query(sql, this.getID()); } } } var sql = "UPDATE item" + Type + "s SET sourceItemID=? WHERE itemID=?"; var bindParams = [sourceItemID ? {int:sourceItemID} : null, this.getID()]; - Scholar.DB.query(sql, bindParams); + Zotero.DB.query(sql, bindParams); this.updateDateModified(); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); - Scholar.Notifier.trigger('modify', 'item', this.getID()); + Zotero.Notifier.trigger('modify', 'item', this.getID()); // Update the counts of the previous and new sources if (oldItem){ @@ -986,7 +986,7 @@ Scholar.Item.prototype.setSource = function(sourceItemID){ oldItem.decrementAttachmentCount(); break; } - Scholar.Notifier.trigger('modify', 'item', oldSourceItemID); + Zotero.Notifier.trigger('modify', 'item', oldSourceItemID); } if (newItem){ switch (type){ @@ -997,7 +997,7 @@ Scholar.Item.prototype.setSource = function(sourceItemID){ newItem.incrementAttachmentCount(); break; } - Scholar.Notifier.trigger('modify', 'item', sourceItemID); + Zotero.Notifier.trigger('modify', 'item', sourceItemID); } return true; @@ -1007,7 +1007,7 @@ Scholar.Item.prototype.setSource = function(sourceItemID){ /** * Returns number of notes in item **/ -Scholar.Item.prototype.numNotes = function(){ +Zotero.Item.prototype.numNotes = function(){ if (this.isNote()){ throw ("numNotes() cannot be called on items of type 'note'"); } @@ -1023,7 +1023,7 @@ Scholar.Item.prototype.numNotes = function(){ /** * Get the text of an item note **/ -Scholar.Item.prototype.getNote = function(){ +Zotero.Item.prototype.getNote = function(){ if (!this.isNote() && !this.isAttachment()){ throw ("getNote() can only be called on notes and attachments"); } @@ -1035,7 +1035,7 @@ Scholar.Item.prototype.getNote = function(){ } var sql = "SELECT note FROM itemNotes WHERE itemID=" + this.getID(); - var note = Scholar.DB.valueQuery(sql); + var note = Zotero.DB.valueQuery(sql); this._noteData = note ? note : ''; @@ -1046,7 +1046,7 @@ Scholar.Item.prototype.getNote = function(){ /** * Get the itemID of the source item for a note or file **/ -Scholar.Item.prototype.getSource = function(){ +Zotero.Item.prototype.getSource = function(){ if (this.isNote()){ var Type = 'Note'; } @@ -1058,14 +1058,14 @@ Scholar.Item.prototype.getSource = function(){ } var sql = "SELECT sourceItemID FROM item" + Type + "s WHERE itemID=" + this.getID(); - return Scholar.DB.valueQuery(sql); + return Zotero.DB.valueQuery(sql); } /** * Returns an array of note itemIDs for this item **/ -Scholar.Item.prototype.getNotes = function(){ +Zotero.Item.prototype.getNotes = function(){ if (this.isNote()){ throw ("getNotes() cannot be called on items of type 'note'"); } @@ -1076,7 +1076,7 @@ Scholar.Item.prototype.getNotes = function(){ var sql = "SELECT itemID FROM itemNotes NATURAL JOIN items " + "WHERE sourceItemID=" + this.getID() + " ORDER BY dateAdded"; - return Scholar.DB.columnQuery(sql); + return Zotero.DB.columnQuery(sql); } @@ -1088,12 +1088,12 @@ Scholar.Item.prototype.getNotes = function(){ // save() is not required for attachment functions // /////////////////////////////////////////////////////// -Scholar.Item.prototype.incrementAttachmentCount = function(){ +Zotero.Item.prototype.incrementAttachmentCount = function(){ this._data['numAttachments']++; } -Scholar.Item.prototype.decrementAttachmentCount = function(){ +Zotero.Item.prototype.decrementAttachmentCount = function(){ this._data['numAttachments']--; } @@ -1101,15 +1101,15 @@ Scholar.Item.prototype.decrementAttachmentCount = function(){ /** * Determine if an item is an attachment **/ -Scholar.Item.prototype.isAttachment = function(){ - return Scholar.ItemTypes.getName(this.getType())=='attachment'; +Zotero.Item.prototype.isAttachment = function(){ + return Zotero.ItemTypes.getName(this.getType())=='attachment'; } /** * Returns number of files in item **/ -Scholar.Item.prototype.numAttachments = function(){ +Zotero.Item.prototype.numAttachments = function(){ if (this.isAttachment()){ throw ("numAttachments() cannot be called on items of type 'attachment'"); } @@ -1131,7 +1131,7 @@ Scholar.Item.prototype.numAttachments = function(){ * Note: Always returns false for items with LINK_MODE_LINKED_URL, * since they have no files -- use getField('url') instead **/ -Scholar.Item.prototype.getFile = function(row){ +Zotero.Item.prototype.getFile = function(row){ if (!this.isAttachment()){ throw ("getFile() can only be called on items of type 'attachment'"); } @@ -1139,7 +1139,7 @@ Scholar.Item.prototype.getFile = function(row){ if (!row){ var sql = "SELECT linkMode, path FROM itemAttachments WHERE itemID=" + this.getID(); - var row = Scholar.DB.rowQuery(sql); + var row = Zotero.DB.rowQuery(sql); } if (!row){ @@ -1148,7 +1148,7 @@ Scholar.Item.prototype.getFile = function(row){ } // No associated files for linked URLs - if (row['linkMode']==Scholar.Attachments.LINK_MODE_LINKED_URL){ + if (row['linkMode']==Zotero.Attachments.LINK_MODE_LINKED_URL){ return false; } @@ -1156,7 +1156,7 @@ Scholar.Item.prototype.getFile = function(row){ createInstance(Components.interfaces.nsILocalFile); var refDir = (row['linkMode']==this.LINK_MODE_LINKED_FILE) - ? Scholar.getScholarDirectory() : Scholar.getStorageDirectory(); + ? Zotero.getZoteroDirectory() : Zotero.getStorageDirectory(); file.setRelativeDescriptor(refDir, row['path']); if (!file.exists()){ @@ -1170,7 +1170,7 @@ Scholar.Item.prototype.getFile = function(row){ /* * Return a file:/// URL path to files and snapshots */ -Scholar.Item.prototype.getLocalFileURL = function(){ +Zotero.Item.prototype.getLocalFileURL = function(){ if (!this.isAttachment){ throw ("getLocalFileURL() can only be called on items of type 'attachment'"); } @@ -1187,10 +1187,10 @@ Scholar.Item.prototype.getLocalFileURL = function(){ /** * Get the link mode of an attachment * -* Possible return values specified as constants in Scholar.Attachments -* (e.g. Scholar.Attachments.LINK_MODE_LINKED_FILE) +* Possible return values specified as constants in Zotero.Attachments +* (e.g. Zotero.Attachments.LINK_MODE_LINKED_FILE) **/ -Scholar.Item.prototype.getAttachmentLinkMode = function(){ +Zotero.Item.prototype.getAttachmentLinkMode = function(){ if (!this.isAttachment()){ throw ("getAttachmentLinkMode() can only be called on items of type 'attachment'"); } @@ -1200,7 +1200,7 @@ Scholar.Item.prototype.getAttachmentLinkMode = function(){ } var sql = "SELECT linkMode FROM itemAttachments WHERE itemID=" + this.getID(); - this._fileLinkMode = Scholar.DB.valueQuery(sql); + this._fileLinkMode = Zotero.DB.valueQuery(sql); return this._fileLinkMode; } @@ -1208,33 +1208,33 @@ Scholar.Item.prototype.getAttachmentLinkMode = function(){ /** * Get the mime type of an attachment (e.g. text/plain) **/ -Scholar.Item.prototype.getAttachmentMimeType = function(){ +Zotero.Item.prototype.getAttachmentMimeType = function(){ if (!this.isAttachment()){ throw ("getAttachmentMIMEType() can only be called on items of type 'attachment'"); } var sql = "SELECT mimeType FROM itemAttachments WHERE itemID=" + this.getID(); - return Scholar.DB.valueQuery(sql); + return Zotero.DB.valueQuery(sql); } /** * Get the character set id of an attachment **/ -Scholar.Item.prototype.getAttachmentCharset = function(){ +Zotero.Item.prototype.getAttachmentCharset = function(){ if (!this.isAttachment()){ throw ("getAttachmentCharset() can only be called on items of type 'attachment'"); } var sql = "SELECT charsetID FROM itemAttachments WHERE itemID=" + this.getID(); - return Scholar.DB.valueQuery(sql); + return Zotero.DB.valueQuery(sql); } /** * Returns an array of attachment itemIDs that have this item as a source **/ -Scholar.Item.prototype.getAttachments = function(){ +Zotero.Item.prototype.getAttachments = function(){ if (this.isAttachment()){ throw ("getAttachments() cannot be called on items of type 'attachment'"); } @@ -1245,7 +1245,7 @@ Scholar.Item.prototype.getAttachments = function(){ var sql = "SELECT itemID FROM itemAttachments NATURAL JOIN items " + "WHERE sourceItemID=" + this.getID() + " ORDER BY dateAdded"; - return Scholar.DB.columnQuery(sql); + return Zotero.DB.columnQuery(sql); } @@ -1255,92 +1255,92 @@ Scholar.Item.prototype.getAttachments = function(){ // // save() is not required for tag functions // -Scholar.Item.prototype.addTag = function(tag){ +Zotero.Item.prototype.addTag = function(tag){ if (!this.getID()){ this.save(); } if (!tag){ - Scholar.debug('Not saving empty tag', 2); + Zotero.debug('Not saving empty tag', 2); return false; } - Scholar.DB.beginTransaction(); - var tagID = Scholar.Tags.getID(tag); + Zotero.DB.beginTransaction(); + var tagID = Zotero.Tags.getID(tag); if (!tagID){ - var tagID = Scholar.Tags.add(tag); + var tagID = Zotero.Tags.add(tag); } // If INSERT OR IGNORE gave us affected rows, we wouldn't need this... var sql = "SELECT COUNT(*) FROM itemTags WHERE itemID=? AND tagID=?"; - var exists = Scholar.DB.valueQuery(sql, [this.getID(), tagID]); + var exists = Zotero.DB.valueQuery(sql, [this.getID(), tagID]); if (exists){ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); return false; } var sql = "INSERT INTO itemTags VALUES (?,?)"; - Scholar.DB.query(sql, [this.getID(), tagID]); + Zotero.DB.query(sql, [this.getID(), tagID]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); - if (!Scholar.DB.transactionInProgress()){ - Scholar.Notifier.trigger('modify', 'item', this.getID()); + if (!Zotero.DB.transactionInProgress()){ + Zotero.Notifier.trigger('modify', 'item', this.getID()); } return tagID; } -Scholar.Item.prototype.getTags = function(){ +Zotero.Item.prototype.getTags = function(){ var sql = "SELECT tag FROM tags WHERE tagID IN " + "(SELECT tagID FROM itemTags WHERE itemID=" + this.getID() + ") " + "ORDER BY tag COLLATE NOCASE"; - return Scholar.DB.columnQuery(sql); + return Zotero.DB.columnQuery(sql); } -Scholar.Item.prototype.getTagIDs = function(){ +Zotero.Item.prototype.getTagIDs = function(){ var sql = "SELECT tagID FROM itemTags WHERE itemID=" + this.getID(); - return Scholar.DB.columnQuery(sql); + return Zotero.DB.columnQuery(sql); } -Scholar.Item.prototype.replaceTag = function(oldTagID, newTag){ +Zotero.Item.prototype.replaceTag = function(oldTagID, newTag){ if (!this.getID()){ throw ('Cannot replace tag on unsaved item'); } if (!newTag){ - Scholar.debug('Not replacing with empty tag', 2); + Zotero.debug('Not replacing with empty tag', 2); return false; } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); - var oldTag = Scholar.Tags.getName(oldTagID); + var oldTag = Zotero.Tags.getName(oldTagID); if (oldTag==newTag){ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); return false; } this.removeTag(oldTagID); var id = this.addTag(newTag); - Scholar.DB.commitTransaction(); - Scholar.Notifier.trigger('modify', 'item', this.getID()); + Zotero.DB.commitTransaction(); + Zotero.Notifier.trigger('modify', 'item', this.getID()); return id; } -Scholar.Item.prototype.removeTag = function(tagID){ +Zotero.Item.prototype.removeTag = function(tagID){ if (!this.getID()){ throw ('Cannot remove tag on unsaved item'); } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "DELETE FROM itemTags WHERE itemID=? AND tagID=?"; - Scholar.DB.query(sql, [this.getID(), tagID]); - Scholar.Tags.purge(); - Scholar.DB.commitTransaction(); + Zotero.DB.query(sql, [this.getID(), tagID]); + Zotero.Tags.purge(); + Zotero.DB.commitTransaction(); - if (!Scholar.DB.transactionInProgress()){ - Scholar.Notifier.trigger('modify', 'item', this.getID()); + if (!Zotero.DB.transactionInProgress()){ + Zotero.Notifier.trigger('modify', 'item', this.getID()); } } @@ -1350,16 +1350,16 @@ Scholar.Item.prototype.removeTag = function(tagID){ // // save() is not required for See Also functions // -Scholar.Item.prototype.addSeeAlso = function(itemID){ +Zotero.Item.prototype.addSeeAlso = function(itemID){ if (itemID==this.getID()){ - Scholar.debug('Cannot add item as See Also of itself', 2); + Zotero.debug('Cannot add item as See Also of itself', 2); return false; } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); - if (!Scholar.Items.get(itemID)){ - Scholar.DB.commitTransaction(); + if (!Zotero.Items.get(itemID)){ + Zotero.DB.commitTransaction(); throw ("Cannot add invalid item " + itemID + " as See Also"); return false; } @@ -1368,56 +1368,56 @@ Scholar.Item.prototype.addSeeAlso = function(itemID){ var sql = "SELECT (SELECT COUNT(*) FROM itemSeeAlso WHERE itemID=?1 AND " + "linkedItemID=?2) + (SELECT COUNT(*) FROM itemSeeAlso WHERE " + "linkedItemID=?1 AND itemID=?2)"; - if (Scholar.DB.valueQuery(sql, [this.getID(), itemID])){ - Scholar.DB.commitTransaction(); - Scholar.debug("Item " + itemID + " already linked", 2); + if (Zotero.DB.valueQuery(sql, [this.getID(), itemID])){ + Zotero.DB.commitTransaction(); + Zotero.debug("Item " + itemID + " already linked", 2); return false; } var sql = "INSERT INTO itemSeeAlso VALUES (?,?)"; - Scholar.DB.query(sql, [this.getID(), {int:itemID}]); - Scholar.DB.commitTransaction(); - Scholar.Notifier.trigger('modify', 'item', [this.getID(), itemID]); + Zotero.DB.query(sql, [this.getID(), {int:itemID}]); + Zotero.DB.commitTransaction(); + Zotero.Notifier.trigger('modify', 'item', [this.getID(), itemID]); return true; } -Scholar.Item.prototype.removeSeeAlso = function(itemID){ - Scholar.DB.beginTransaction(); +Zotero.Item.prototype.removeSeeAlso = function(itemID){ + Zotero.DB.beginTransaction(); var sql = "DELETE FROM itemSeeAlso WHERE itemID=? AND linkedItemID=?"; - Scholar.DB.query(sql, [this.getID(), itemID]); + Zotero.DB.query(sql, [this.getID(), itemID]); var sql = "DELETE FROM itemSeeAlso WHERE itemID=? AND linkedItemID=?"; - Scholar.DB.query(sql, [itemID, this.getID()]); - Scholar.DB.commitTransaction(); - Scholar.Notifier.trigger('modify', 'item', [this.getID(), itemID]); + Zotero.DB.query(sql, [itemID, this.getID()]); + Zotero.DB.commitTransaction(); + Zotero.Notifier.trigger('modify', 'item', [this.getID(), itemID]); } -Scholar.Item.prototype.getSeeAlso = function(){ +Zotero.Item.prototype.getSeeAlso = function(){ // Check both ways, using a UNION to take advantage of indexes var sql ="SELECT linkedItemID FROM itemSeeAlso WHERE itemID=?1 UNION " + "SELECT itemID FROM itemSeeAlso WHERE linkedItemID=?1"; - return Scholar.DB.columnQuery(sql, this.getID()); + return Zotero.DB.columnQuery(sql, this.getID()); } /** -* Delete item from database and clear from Scholar.Items internal array +* Delete item from database and clear from Zotero.Items internal array **/ -Scholar.Item.prototype.erase = function(deleteChildren){ +Zotero.Item.prototype.erase = function(deleteChildren){ if (!this.getID()){ return false; } - Scholar.debug('Deleting item ' + this.getID()); + Zotero.debug('Deleting item ' + this.getID()); var changedItems = []; - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); // Remove item from parent collections var parentCollectionIDs = this.getCollections(); if (parentCollectionIDs){ for (var i=0; i<parentCollectionIDs.length; i++){ - Scholar.Collections.get(parentCollectionIDs[i]).removeItem(this.getID()); + Zotero.Collections.get(parentCollectionIDs[i]).removeItem(this.getID()); } } @@ -1425,9 +1425,9 @@ Scholar.Item.prototype.erase = function(deleteChildren){ if (this.isNote()){ // Decrement note count of source items var sql = "SELECT sourceItemID FROM itemNotes WHERE itemID=" + this.getID(); - var sourceItemID = Scholar.DB.valueQuery(sql); + var sourceItemID = Zotero.DB.valueQuery(sql); if (sourceItemID){ - var sourceItem = Scholar.Items.get(sourceItemID); + var sourceItem = Zotero.Items.get(sourceItemID); sourceItem.decrementNoteCount(); changedItems.push(sourceItemID); } @@ -1436,9 +1436,9 @@ Scholar.Item.prototype.erase = function(deleteChildren){ else if (this.isAttachment()){ // Decrement file count of source items var sql = "SELECT sourceItemID FROM itemAttachments WHERE itemID=" + this.getID(); - var sourceItemID = Scholar.DB.valueQuery(sql); + var sourceItemID = Zotero.DB.valueQuery(sql); if (sourceItemID){ - var sourceItem = Scholar.Items.get(sourceItemID); + var sourceItem = Zotero.Items.get(sourceItemID); sourceItem.decrementAttachmentCount(); changedItems.push(sourceItemID); } @@ -1446,12 +1446,12 @@ Scholar.Item.prototype.erase = function(deleteChildren){ // Delete associated files var linkMode = this.getAttachmentLinkMode(); switch (linkMode){ - case Scholar.Attachments.LINK_MODE_LINKED_FILE: - case Scholar.Attachments.LINK_MODE_LINKED_URL: + case Zotero.Attachments.LINK_MODE_LINKED_FILE: + case Zotero.Attachments.LINK_MODE_LINKED_URL: // Links only -- nothing to delete break; default: - var file = Scholar.getStorageDirectory(); + var file = Zotero.getStorageDirectory(); file.append(this.getID()); if (file.exists()){ file.remove(true); @@ -1465,11 +1465,11 @@ Scholar.Item.prototype.erase = function(deleteChildren){ else if (deleteChildren){ var sql = "SELECT itemID FROM itemNotes WHERE sourceItemID=?1 UNION " + "SELECT itemID FROM itemAttachments WHERE sourceItemID=?1"; - var toDelete = Scholar.DB.columnQuery(sql, [this.getID()]); + var toDelete = Zotero.DB.columnQuery(sql, [this.getID()]); if (toDelete){ for (var i in toDelete){ - var obj = Scholar.Items.get(toDelete[i]); + var obj = Zotero.Items.get(toDelete[i]); obj.erase(true); } } @@ -1479,23 +1479,23 @@ Scholar.Item.prototype.erase = function(deleteChildren){ else { // Notes var sql = "SELECT itemID FROM itemNotes WHERE sourceItemID=" + this.getID(); - var childNotes = Scholar.DB.columnQuery(sql); + var childNotes = Zotero.DB.columnQuery(sql); if (childNotes){ changedItems.push(childNotes); } var sql = "UPDATE itemNotes SET sourceItemID=NULL WHERE sourceItemID=" + this.getID(); - Scholar.DB.query(sql); + Zotero.DB.query(sql); // Attachments var sql = "SELECT itemID FROM itemAttachments WHERE sourceItemID=" + this.getID(); - var childAttachments = Scholar.DB.columnQuery(sql); + var childAttachments = Zotero.DB.columnQuery(sql); if (childAttachments){ changedItems.push(childAttachments); } var sql = "UPDATE itemAttachments SET sourceItemID=NULL WHERE sourceItemID=" + this.getID(); - Scholar.DB.query(sql); + Zotero.DB.query(sql); } // Flag See Also links for notification @@ -1505,9 +1505,9 @@ Scholar.Item.prototype.erase = function(deleteChildren){ } // Clear fulltext cache - Scholar.Fulltext.clearItemWords(this.getID()); - //Scholar.Fulltext.clearItemContent(this.getID()); - Scholar.Fulltext.purgeUnusedWords(); + Zotero.Fulltext.clearItemWords(this.getID()); + //Zotero.Fulltext.clearItemContent(this.getID()); + Zotero.Fulltext.purgeUnusedWords(); sql = 'DELETE FROM itemCreators WHERE itemID=' + this.getID() + ";\n"; sql += 'DELETE FROM itemNotes WHERE itemID=' + this.getID() + ";\n"; @@ -1518,11 +1518,11 @@ Scholar.Item.prototype.erase = function(deleteChildren){ sql += 'DELETE FROM itemData WHERE itemID=' + this.getID() + ";\n"; sql += 'DELETE FROM items WHERE itemID=' + this.getID() + ";\n"; - Scholar.DB.query(sql); - Scholar.Creators.purge(); + Zotero.DB.query(sql); + Zotero.Creators.purge(); try { - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } catch (e){ // On failure, reset count of source items @@ -1534,25 +1534,25 @@ Scholar.Item.prototype.erase = function(deleteChildren){ sourceItem.incrementAttachmentCount(); } } - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); throw (e); } - Scholar.Items.unload(this.getID()); + Zotero.Items.unload(this.getID()); // Send notification of changed items if (changedItems.length){ - Scholar.Notifier.trigger('modify', 'item', changedItems); + Zotero.Notifier.trigger('modify', 'item', changedItems); } // If we're not in the middle of a larger commit, trigger the notifier now - if (!Scholar.DB.transactionInProgress()){ - Scholar.Notifier.trigger('delete', 'item', this.getID()); + if (!Zotero.DB.transactionInProgress()){ + Zotero.Notifier.trigger('delete', 'item', this.getID()); } } -Scholar.Item.prototype.isCollection = function(){ +Zotero.Item.prototype.isCollection = function(){ return false; } @@ -1561,7 +1561,7 @@ Scholar.Item.prototype.isCollection = function(){ * Convert the item data into a multidimensional associative array * for use by the export functions **/ -Scholar.Item.prototype.toArray = function(){ +Zotero.Item.prototype.toArray = function(){ if (this.getID() && !this._itemDataLoaded){ this._loadItemData(); } @@ -1572,7 +1572,7 @@ Scholar.Item.prototype.toArray = function(){ for (var i in this._data){ switch (i){ case 'itemTypeID': - arr['itemType'] = Scholar.ItemTypes.getName(this._data[i]); + arr['itemType'] = Zotero.ItemTypes.getName(this._data[i]); break; // Skip certain fields @@ -1589,7 +1589,7 @@ Scholar.Item.prototype.toArray = function(){ // Item metadata for (var i in this._itemData){ - arr[Scholar.ItemFields.getName(i)] = this._itemData[i]; + arr[Zotero.ItemFields.getName(i)] = this._itemData[i]; } if (!this.isNote() && !this.isAttachment()){ @@ -1603,7 +1603,7 @@ Scholar.Item.prototype.toArray = function(){ arr['creators'][i]['isInstitution'] = creators[i]['isInstitution']; // Convert creatorTypeIDs to text arr['creators'][i]['creatorType'] = - Scholar.CreatorTypes.getName(creators[i]['creatorTypeID']); + Zotero.CreatorTypes.getName(creators[i]['creatorTypeID']); } } @@ -1621,7 +1621,7 @@ Scholar.Item.prototype.toArray = function(){ arr['notes'] = []; var notes = this.getNotes(); for (var i in notes){ - var note = Scholar.Items.get(notes[i]); + var note = Zotero.Items.get(notes[i]); arr['notes'].push({ itemID: note.getID(), note: note.getNote(), @@ -1645,7 +1645,7 @@ Scholar.Item.prototype.toArray = function(){ arr['attachments'] = []; var files = this.getAttachments(); for (var i in files){ - var file = Scholar.Items.get(files[i]); + var file = Zotero.Items.get(files[i]); arr['attachments'].push({ itemID: file.getID(), // TODO @@ -1666,14 +1666,14 @@ Scholar.Item.prototype.toArray = function(){ ////////////////////////////////////////////////////////////////////////////// // -// Private Scholar.Item methods +// Private Zotero.Item methods // ////////////////////////////////////////////////////////////////////////////// /* * Load in the creators from the database */ -Scholar.Item.prototype._loadCreators = function(){ +Zotero.Item.prototype._loadCreators = function(){ if (!this.getID()){ throw ('ItemID not set for item before attempting to load creators'); } @@ -1682,7 +1682,7 @@ Scholar.Item.prototype._loadCreators = function(){ + 'FROM itemCreators IC ' + 'LEFT JOIN creators C USING (creatorID) ' + 'WHERE itemID=' + this.getID() + ' ORDER BY orderIndex'; - var creators = Scholar.DB.query(sql); + var creators = Zotero.DB.query(sql); this._creatorsLoaded = true; @@ -1690,7 +1690,7 @@ Scholar.Item.prototype._loadCreators = function(){ return true; } - this._creators = new Scholar.Hash(); + this._creators = new Zotero.Hash(); for (var i=0; i<creators.length; i++){ var creator = new Array(); creator['firstName'] = creators[i]['firstName']; @@ -1708,7 +1708,7 @@ Scholar.Item.prototype._loadCreators = function(){ /* * Load in the field data from the database */ -Scholar.Item.prototype._loadItemData = function(){ +Zotero.Item.prototype._loadItemData = function(){ if (!this.getID()){ throw ('ItemID not set for object before attempting to load data'); } @@ -1718,7 +1718,7 @@ Scholar.Item.prototype._loadItemData = function(){ + 'items WHERE itemID=?1) AND ITF.fieldID=ID.fieldID) ' + 'WHERE itemID=?1 ORDER BY orderIndex'; - var result = Scholar.DB.query(sql,[{'int':this._data['itemID']}]); + var result = Zotero.DB.query(sql,[{'int':this._data['itemID']}]); this._itemDataLoaded = true; @@ -1737,7 +1737,7 @@ Scholar.Item.prototype._loadItemData = function(){ /** * Return first line (or first MAX_LENGTH characters) of note content **/ -Scholar.Item.prototype._noteToTitle = function(){ +Zotero.Item.prototype._noteToTitle = function(){ var MAX_LENGTH = 80; var t = this.getNote().substring(0, MAX_LENGTH); @@ -1752,9 +1752,9 @@ Scholar.Item.prototype._noteToTitle = function(){ /* - * Primary interface for accessing Scholar items + * Primary interface for accessing Zotero items */ -Scholar.Items = new function(){ +Zotero.Items = new function(){ // Private members var _items = new Array(); @@ -1781,11 +1781,11 @@ Scholar.Items = new function(){ var loaded = new Array(); if (!arguments[0]){ - Scholar.debug('No arguments provided to Items.get()'); + Zotero.debug('No arguments provided to Items.get()'); return false; } - var ids = Scholar.flattenArguments(arguments); + var ids = Zotero.flattenArguments(arguments); for (var i=0; i<ids.length; i++){ // Check if already loaded @@ -1808,7 +1808,7 @@ Scholar.Items = new function(){ // Otherwise, build return array for (i=0; i<ids.length; i++){ if (!_items[ids[i]]){ - Scholar.debug("Item " + ids[i] + " not loaded -- this shouldn't happen", 2); + Zotero.debug("Item " + ids[i] + " not loaded -- this shouldn't happen", 2); } loaded.push(_items[ids[i]]); } @@ -1824,7 +1824,7 @@ Scholar.Items = new function(){ var sql = 'SELECT itemID FROM items'; // DEBUG: default order? - var ids = Scholar.DB.columnQuery(sql); + var ids = Zotero.DB.columnQuery(sql); return this.get(ids); } @@ -1839,8 +1839,8 @@ Scholar.Items = new function(){ return false; } - var ids = Scholar.flattenArguments(arguments); - Scholar.debug('Reloading ' + ids); + var ids = Zotero.flattenArguments(arguments); + Zotero.debug('Reloading ' + ids); _load(ids); return true; @@ -1857,14 +1857,14 @@ Scholar.Items = new function(){ function getNewItemByType(itemTypeID){ - return new Scholar.Item(itemTypeID); + return new Zotero.Item(itemTypeID); } function add(data, itemTypeID){ var insert = new Array(); - var obj = new Scholar.Item(itemTypeID); + var obj = new Zotero.Item(itemTypeID); for (field in data){ obj.setField(data[field]); @@ -1903,7 +1903,7 @@ Scholar.Items = new function(){ sqlParams.push({'int':parentCollectionID}); } - return Scholar.DB.columnQuery(sql, sqlParams); + return Zotero.DB.columnQuery(sql, sqlParams); } @@ -1918,7 +1918,7 @@ Scholar.Items = new function(){ /** - * Clear item from internal array (used by Scholar.Item.erase()) + * Clear item from internal array (used by Zotero.Item.erase()) **/ function unload(id){ delete _items[id]; @@ -1926,7 +1926,7 @@ Scholar.Items = new function(){ function _load(){ - // Should be the same as query in Scholar.Item.loadFromID, just + // Should be the same as query in Zotero.Item.loadFromID, just // without itemID clause var sql = 'SELECT I.*, lastName || ' + 'CASE ((SELECT COUNT(*) FROM itemCreators WHERE itemID=I.itemID)>1) ' @@ -1939,16 +1939,16 @@ Scholar.Items = new function(){ + 'WHERE (IC.orderIndex=0 OR IC.orderIndex IS NULL)'; if (arguments[0]){ - sql += ' AND I.itemID IN (' + Scholar.join(arguments,',') + ')'; + sql += ' AND I.itemID IN (' + Zotero.join(arguments,',') + ')'; } - var result = Scholar.DB.query(sql); + var result = Zotero.DB.query(sql); if (result){ for (var i=0,len=result.length; i<len; i++){ // Item doesn't exist -- create new object and stuff in array if (!_items[result[i]['itemID']]){ - var obj = new Scholar.Item(); + var obj = new Zotero.Item(); obj.loadFromRow(result[i]); _items[result[i]['itemID']] = obj; } @@ -1965,7 +1965,7 @@ Scholar.Items = new function(){ -Scholar.Notes = new function(){ +Zotero.Notes = new function(){ this.add = add; /** @@ -1974,21 +1974,21 @@ Scholar.Notes = new function(){ * Returns the itemID of the new note item **/ function add(text, sourceItemID){ - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); if (sourceItemID){ - var sourceItem = Scholar.Items.get(sourceItemID); + var sourceItem = Zotero.Items.get(sourceItemID); if (!sourceItem){ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); throw ("Cannot set note source to invalid item " + sourceItemID); } if (sourceItem.isNote()){ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); throw ("Cannot set note source to another note (" + sourceItemID + ")"); } } - var note = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('note')); + var note = Zotero.Items.getNewItemByType(Zotero.ItemTypes.getID('note')); note.save(); var sql = "INSERT INTO itemNotes VALUES (?,?,?)"; @@ -1997,19 +1997,19 @@ Scholar.Notes = new function(){ (sourceItemID ? {int:sourceItemID} : null), {string:text} ]; - Scholar.DB.query(sql, bindParams); - Scholar.DB.commitTransaction(); + Zotero.DB.query(sql, bindParams); + Zotero.DB.commitTransaction(); - // Switch to Scholar.Items version - var note = Scholar.Items.get(note.getID()); + // Switch to Zotero.Items version + var note = Zotero.Items.get(note.getID()); note.updateNoteCache(text); if (sourceItemID){ sourceItem.incrementNoteCount(); - Scholar.Notifier.trigger('modify', 'item', sourceItemID); + Zotero.Notifier.trigger('modify', 'item', sourceItemID); } - Scholar.Notifier.trigger('add', 'item', note.getID()); + Zotero.Notifier.trigger('add', 'item', note.getID()); return note.getID(); } @@ -2021,13 +2021,13 @@ Scholar.Notes = new function(){ /* * Constructor for Collection object * - * Generally should be called from Scholar.Collection rather than directly + * Generally should be called from Zotero.Collection rather than directly */ -Scholar.Collection = function(){ +Zotero.Collection = function(){ this._init(); } -Scholar.Collection.prototype._init = function(){ +Zotero.Collection.prototype._init = function(){ // // Public members for access by public methods -- do not access directly // @@ -2036,15 +2036,15 @@ Scholar.Collection.prototype._init = function(){ this._parent = null; this._hasChildCollections = false; this._hasChildItems = false; - this._childItems = new Scholar.Hash(); + this._childItems = new Zotero.Hash(); this._childItemsLoaded = false; } /* * Build collection from database */ -Scholar.Collection.prototype.loadFromID = function(id){ - // Should be same as query in Scholar.Collections, just with collectionID +Zotero.Collection.prototype.loadFromID = function(id){ + // Should be same as query in Zotero.Collections, just with collectionID var sql = "SELECT collectionID, collectionName, parentCollectionID, " + "(SELECT COUNT(*) FROM collections WHERE " + "parentCollectionID=C.collectionID)!=0 AS hasChildCollections, " @@ -2053,7 +2053,7 @@ Scholar.Collection.prototype.loadFromID = function(id){ + "FROM collections C " + "WHERE collectionID=" + id; - var row = Scholar.DB.rowQuery(sql); + var row = Zotero.DB.rowQuery(sql); this.loadFromRow(row); } @@ -2061,7 +2061,7 @@ Scholar.Collection.prototype.loadFromID = function(id){ /* * Populate collection data from a database row */ -Scholar.Collection.prototype.loadFromRow = function(row){ +Zotero.Collection.prototype.loadFromRow = function(row){ this._init(); this._id = row['collectionID']; this._name = row['collectionName']; @@ -2072,31 +2072,31 @@ Scholar.Collection.prototype.loadFromRow = function(row){ } -Scholar.Collection.prototype.getID = function(){ +Zotero.Collection.prototype.getID = function(){ return this._id; } -Scholar.Collection.prototype.getName = function(){ +Zotero.Collection.prototype.getName = function(){ return this._name; } /** * Returns collectionID of the parent collection **/ -Scholar.Collection.prototype.getParent = function(){ +Zotero.Collection.prototype.getParent = function(){ return this._parent; } -Scholar.Collection.prototype.isEmpty = function(){ +Zotero.Collection.prototype.isEmpty = function(){ return !(parseInt(this._hasChildCollections)) && !(parseInt(this._hasChildItems)); } -Scholar.Collection.prototype.hasChildCollections = function(){ +Zotero.Collection.prototype.hasChildCollections = function(){ return !!(parseInt(this._hasChildCollections)); } -Scholar.Collection.prototype.hasChildItems = function(){ +Zotero.Collection.prototype.hasChildItems = function(){ return !!(parseInt(this._hasChildItems)); } @@ -2107,17 +2107,17 @@ Scholar.Collection.prototype.hasChildItems = function(){ * * Returns true on success, or false on error **/ -Scholar.Collection.prototype.rename = function(name){ +Zotero.Collection.prototype.rename = function(name){ if (!name){ return false; } var sql = "UPDATE collections SET collectionName=? " + "WHERE collectionID=?"; - Scholar.DB.query(sql, [{'string':name},{'int':this.getID()}]); + Zotero.DB.query(sql, [{'string':name},{'int':this.getID()}]); this._name = name; - Scholar.Notifier.trigger('modify', 'collection', this.getID()); + Zotero.Notifier.trigger('modify', 'collection', this.getID()); return true; } @@ -2127,7 +2127,7 @@ Scholar.Collection.prototype.rename = function(name){ * * Returns TRUE on success, FALSE on error **/ -Scholar.Collection.prototype.changeParent = function(parent){ +Zotero.Collection.prototype.changeParent = function(parent){ if (!parent){ parent = null; } @@ -2135,23 +2135,23 @@ Scholar.Collection.prototype.changeParent = function(parent){ var previousParent = this.getParent(); if (parent==previousParent){ - Scholar.debug('Collection ' + this.getID() + ' is already in ' + Zotero.debug('Collection ' + this.getID() + ' is already in ' + (parent ? 'collection ' + parent : 'root collection'), 2); return false; } - if (parent && !Scholar.Collections.get(parent)){ + if (parent && !Zotero.Collections.get(parent)){ throw('Invalid parentCollectionID ' + parent + ' in changeParent()'); } if (parent && parent==this.getID()){ - Scholar.debug('Cannot move collection into itself!', 2); + Zotero.debug('Cannot move collection into itself!', 2); return false; } if (parent){ if (this.hasDescendent('collection', parent)){ - Scholar.debug('Cannot move collection into one of its own ' + Zotero.debug('Cannot move collection into one of its own ' + 'descendents!', 2); return false; } @@ -2162,7 +2162,7 @@ Scholar.Collection.prototype.changeParent = function(parent){ var sql = "UPDATE collections SET parentCollectionID=? " + "WHERE collectionID=?"; - Scholar.DB.query(sql, [parentParam, {'int':this.getID()}]); + Zotero.DB.query(sql, [parentParam, {'int':this.getID()}]); this._parent = parent; var notifyIDs = [ @@ -2172,8 +2172,8 @@ Scholar.Collection.prototype.changeParent = function(parent){ ]; // TODO: only reload the necessary ones - Scholar.Collections.reloadAll(); - Scholar.Notifier.trigger('move', 'collection', notifyIDs); + Zotero.Collections.reloadAll(); + Zotero.Notifier.trigger('move', 'collection', notifyIDs); return true; } @@ -2181,22 +2181,22 @@ Scholar.Collection.prototype.changeParent = function(parent){ /** * Add an item to the collection **/ -Scholar.Collection.prototype.addItem = function(itemID){ - Scholar.DB.beginTransaction(); +Zotero.Collection.prototype.addItem = function(itemID){ + Zotero.DB.beginTransaction(); - if (!Scholar.Items.get(itemID)){ - Scholar.DB.rollbackTransaction(); + if (!Zotero.Items.get(itemID)){ + Zotero.DB.rollbackTransaction(); throw(itemID + ' is not a valid item id'); } - var nextOrderIndex = Scholar.DB.valueQuery("SELECT IFNULL(MAX(orderIndex)+1, 0) " + var nextOrderIndex = Zotero.DB.valueQuery("SELECT IFNULL(MAX(orderIndex)+1, 0) " + "FROM collectionItems WHERE collectionID=" + this._id); var sql = "INSERT OR IGNORE INTO collectionItems VALUES " + "(" + this._id + ", " + itemID + ", " + nextOrderIndex + ")"; - Scholar.DB.query(sql); - Scholar.DB.commitTransaction(); + Zotero.DB.query(sql); + Zotero.DB.commitTransaction(); this._childItems.set(itemID); @@ -2204,58 +2204,58 @@ Scholar.Collection.prototype.addItem = function(itemID){ if (!this._hasChildItems){ this._hasChildItems = true; // DEBUG: is this necessary? - Scholar.Notifier.trigger('modify', 'collection', this.getID()); + Zotero.Notifier.trigger('modify', 'collection', this.getID()); } - Scholar.Notifier.trigger('add', 'item', itemID); + Zotero.Notifier.trigger('add', 'item', itemID); } /** * Remove an item from the collection (does not delete item from library) **/ -Scholar.Collection.prototype.removeItem = function(itemID){ - Scholar.DB.beginTransaction(); +Zotero.Collection.prototype.removeItem = function(itemID){ + Zotero.DB.beginTransaction(); var sql = "SELECT orderIndex FROM collectionItems " + "WHERE collectionID=" + this._id + " AND itemID=" + itemID; - var orderIndex = Scholar.DB.valueQuery(sql); + var orderIndex = Zotero.DB.valueQuery(sql); if (orderIndex===false){ - Scholar.debug('Item ' + itemID + ' is not a child of collection ' + Zotero.debug('Item ' + itemID + ' is not a child of collection ' + this._id); - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); return false; } var sql = "DELETE FROM collectionItems WHERE collectionID=" + this._id + " AND itemID=" + itemID; - Scholar.DB.query(sql); + Zotero.DB.query(sql); // Move down items above deleted item in collection sql = 'UPDATE collectionItems SET orderIndex=orderIndex-1 ' + 'WHERE collectionID=' + this._id + ' AND orderIndex>' + orderIndex; - Scholar.DB.query(sql); + Zotero.DB.query(sql); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); this._childItems.remove(itemID); // If this was the last item, set collection to empty if (!this._childItems.length){ this._hasChildItems = false; // DEBUG: is this necessary? - Scholar.Notifier.trigger('modify', 'collection', this.getID()); + Zotero.Notifier.trigger('modify', 'collection', this.getID()); } - Scholar.Notifier.trigger('remove', 'item', itemID); + Zotero.Notifier.trigger('remove', 'item', itemID); } /** * Check if an item belongs to the collection **/ -Scholar.Collection.prototype.hasItem = function(itemID){ +Zotero.Collection.prototype.hasItem = function(itemID){ if (!this._childItemsLoaded){ this._loadChildItems(); } @@ -2263,7 +2263,7 @@ Scholar.Collection.prototype.hasItem = function(itemID){ } -Scholar.Collection.prototype.hasDescendent = function(type, id){ +Zotero.Collection.prototype.hasDescendent = function(type, id){ var descendents = this.getDescendents(); for (var i=0, len=descendents.length; i<len; i++){ if (descendents[i]['type']==type && descendents[i]['id']==id){ @@ -2277,8 +2277,8 @@ Scholar.Collection.prototype.hasDescendent = function(type, id){ /** * Deletes collection and all descendent collections and items **/ -Scholar.Collection.prototype.erase = function(deleteItems){ - Scholar.DB.beginTransaction(); +Zotero.Collection.prototype.erase = function(deleteItems){ + Zotero.DB.beginTransaction(); var descendents = this.getDescendents(); var collections = [this.getID()], items = []; @@ -2292,47 +2292,47 @@ Scholar.Collection.prototype.erase = function(deleteItems){ else { if (deleteItems){ // Delete items from DB - Scholar.Items.get(descendents[i]['id']).erase(); + Zotero.Items.get(descendents[i]['id']).erase(); items.push(descendents[i]['id']); } } } // Remove item associations for all descendent collections - Scholar.DB.query('DELETE FROM collectionItems WHERE collectionID IN (' + Zotero.DB.query('DELETE FROM collectionItems WHERE collectionID IN (' + collections.join() + ')'); // And delete all descendent collections - Scholar.DB.query('DELETE FROM collections WHERE collectionID IN (' + Zotero.DB.query('DELETE FROM collections WHERE collectionID IN (' + collections.join() + ')'); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); // Clear deleted collection from internal memory - Scholar.Collections.unload(collections); + Zotero.Collections.unload(collections); - Scholar.Notifier.trigger('remove', 'collection', collections); + Zotero.Notifier.trigger('remove', 'collection', collections); if (items.length){ - Scholar.Notifier.trigger('delete', 'item', items); + Zotero.Notifier.trigger('delete', 'item', items); } } -Scholar.Collection.prototype.isCollection = function(){ +Zotero.Collection.prototype.isCollection = function(){ return true; } -Scholar.Collection.prototype.toArray = function(){ +Zotero.Collection.prototype.toArray = function(){ return this.getDescendents(true); } -Scholar.Collection.prototype._loadChildItems = function(){ - this._childItems = new Scholar.Hash(); +Zotero.Collection.prototype._loadChildItems = function(){ + this._childItems = new Zotero.Hash(); var sql = "SELECT itemID FROM collectionItems WHERE collectionID=" + this._id; - var itemIDs = Scholar.DB.columnQuery(sql); + var itemIDs = Zotero.DB.columnQuery(sql); if (itemIDs){ for (var i=0; i<itemIDs.length; i++){ @@ -2340,7 +2340,7 @@ Scholar.Collection.prototype._loadChildItems = function(){ } } else { - Scholar.debug('Collection ' + this._id + ' has no child items'); + Zotero.debug('Collection ' + this._id + ' has no child items'); } this._childItemsLoaded = true; @@ -2353,12 +2353,12 @@ Scholar.Collection.prototype._loadChildItems = function(){ * * nested: Return multidimensional array with 'children' nodes instead of flat array **/ -Scholar.Collection.prototype.getDescendents = function(nested, type){ +Zotero.Collection.prototype.getDescendents = function(nested, type){ var toReturn = new Array(); // 0 == collection // 1 == item - var children = Scholar.DB.query('SELECT collectionID AS id, ' + var children = Zotero.DB.query('SELECT collectionID AS id, ' + "0 AS type, collectionName AS collectionName " + 'FROM collections WHERE parentCollectionID=' + this._id + ' UNION SELECT itemID AS id, 1 AS type, NULL AS collectionName ' @@ -2390,7 +2390,7 @@ Scholar.Collection.prototype.getDescendents = function(nested, type){ } var descendents = - Scholar.Collections.get(children[i]['id']).getDescendents(nested, type); + Zotero.Collections.get(children[i]['id']).getDescendents(nested, type); if (nested){ toReturn[toReturn.length-1]['children'] = descendents; @@ -2420,9 +2420,9 @@ Scholar.Collection.prototype.getDescendents = function(nested, type){ /* - * Primary interface for accessing Scholar collection + * Primary interface for accessing Zotero collection */ -Scholar.Collections = new function(){ +Zotero.Collections = new function(){ var _collections = new Array(); var _collectionsLoaded = false; @@ -2432,7 +2432,7 @@ Scholar.Collections = new function(){ this.unload = unload; /* - * Returns a Scholar.Collection object for a collectionID + * Returns a Zotero.Collection object for a collectionID */ function get(id){ if (!_collectionsLoaded){ @@ -2455,25 +2455,25 @@ Scholar.Collections = new function(){ return false; } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); if (parent && !this.get(parent)){ - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); throw('Cannot add collection to invalid parent ' + parent); } var parentParam = parent ? {'int':parent} : {'null':true}; - var rnd = Scholar.getRandomID('collections', 'collectionID'); + var rnd = Zotero.getRandomID('collections', 'collectionID'); var sql = "INSERT INTO collections VALUES (?,?,?)"; var sqlValues = [ {'int':rnd}, {'string':name}, parentParam ]; - Scholar.DB.query(sql, sqlValues); + Zotero.DB.query(sql, sqlValues); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); _load(rnd); - Scholar.Notifier.trigger('add', 'collection', rnd); + Zotero.Notifier.trigger('add', 'collection', rnd); return this.get(rnd); } @@ -2489,12 +2489,12 @@ Scholar.Collections = new function(){ /** - * Clear collection from internal cache (used by Scholar.Collection.erase()) + * Clear collection from internal cache (used by Zotero.Collection.erase()) * * Can be passed ids as individual parameters or as an array of ids, or both **/ function unload(){ - var ids = Scholar.flattenArguments(arguments); + var ids = Zotero.flattenArguments(arguments); for(var i=0; i<ids.length; i++){ delete _collections[ids[i]]; @@ -2506,7 +2506,7 @@ Scholar.Collections = new function(){ * Loads collection data from DB and adds to internal cache **/ function _load(){ - // This should be the same as the query in Scholar.Collection.loadFromID, + // This should be the same as the query in Zotero.Collection.loadFromID, // just without a specific collectionID var sql = "SELECT collectionID, collectionName, parentCollectionID, " + "(SELECT COUNT(*) FROM collections WHERE " @@ -2515,19 +2515,19 @@ Scholar.Collections = new function(){ + "collectionID=C.collectionID)!=0 AS hasChildItems " + "FROM collections C"; - var ids = Scholar.flattenArguments(arguments) + var ids = Zotero.flattenArguments(arguments) if (ids.length){ sql += " WHERE collectionID IN (" + ids.join() + ")"; } - var result = Scholar.DB.query(sql); + var result = Zotero.DB.query(sql); for (var i=0; i<result.length; i++){ var collectionID = result[i]['collectionID']; // If collection doesn't exist, create new object and stuff in array if (!_collections[collectionID]){ - var collection = new Scholar.Collection(); + var collection = new Zotero.Collection(); collection.loadFromRow(result[i]); _collections[collectionID] = collection; } @@ -2543,9 +2543,9 @@ Scholar.Collections = new function(){ /* - * Same structure as Scholar.Tags -- make changes in both places if possible + * Same structure as Zotero.Tags -- make changes in both places if possible */ -Scholar.Creators = new function(){ +Zotero.Creators = new function(){ var _creators = new Array; // indexed by first%%%last%%%isInstitution hash var _creatorsByID = new Array; // indexed by creatorID @@ -2565,7 +2565,7 @@ Scholar.Creators = new function(){ } var sql = 'SELECT * FROM creators WHERE creatorID=' + creatorID; - var result = Scholar.DB.rowQuery(sql); + var result = Zotero.DB.rowQuery(sql); if (!result){ return false; @@ -2604,7 +2604,7 @@ Scholar.Creators = new function(){ var sql = 'SELECT creatorID FROM creators ' + 'WHERE firstName=? AND lastName=? AND isInstitution=?'; var params = [{string: firstName}, {string: lastName}, isInstitution]; - var creatorID = Scholar.DB.valueQuery(sql, params); + var creatorID = Zotero.DB.valueQuery(sql, params); if (creatorID){ _creators[hash] = creatorID; @@ -2620,19 +2620,19 @@ Scholar.Creators = new function(){ * Returns new creatorID */ function add(firstName, lastName, isInstitution){ - Scholar.debug('Adding new creator', 4); + Zotero.debug('Adding new creator', 4); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = 'INSERT INTO creators VALUES (?,?,?,?)'; - var rnd = Scholar.getRandomID('creators', 'creatorID'); + var rnd = Zotero.getRandomID('creators', 'creatorID'); var params = [ rnd, isInstitution ? '' : {string: firstName}, {string: lastName}, isInstitution ? 1 : 0 ]; - Scholar.DB.query(sql, params); + Zotero.DB.query(sql, params); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); return rnd; } @@ -2645,7 +2645,7 @@ Scholar.Creators = new function(){ function purge(){ var sql = 'SELECT creatorID FROM creators WHERE creatorID NOT IN ' + '(SELECT creatorID FROM itemCreators);'; - var toDelete = Scholar.DB.columnQuery(sql); + var toDelete = Zotero.DB.columnQuery(sql); if (!toDelete){ return false; @@ -2660,7 +2660,7 @@ Scholar.Creators = new function(){ sql = 'DELETE FROM creators WHERE creatorID NOT IN ' + '(SELECT creatorID FROM itemCreators);'; - var result = Scholar.DB.query(sql); + var result = Zotero.DB.query(sql); return toDelete; } @@ -2678,9 +2678,9 @@ Scholar.Creators = new function(){ /* - * Same structure as Scholar.Creators -- make changes in both places if possible + * Same structure as Zotero.Creators -- make changes in both places if possible */ -Scholar.Tags = new function(){ +Zotero.Tags = new function(){ var _tags = new Array; // indexed by tag text var _tagsByID = new Array; // indexed by tagID @@ -2698,7 +2698,7 @@ Scholar.Tags = new function(){ } var sql = 'SELECT tag FROM tags WHERE tagID=' + tagID; - var result = Scholar.DB.valueQuery(sql); + var result = Zotero.DB.valueQuery(sql); if (!result){ return false; @@ -2718,7 +2718,7 @@ Scholar.Tags = new function(){ } var sql = 'SELECT tagID FROM tags WHERE tag=?'; - var tagID = Scholar.DB.valueQuery(sql, [{string:tag}]); + var tagID = Zotero.DB.valueQuery(sql, [{string:tag}]); if (tagID){ _tags[tag] = tagID; @@ -2734,15 +2734,15 @@ Scholar.Tags = new function(){ * Returns new tagID */ function add(tag){ - Scholar.debug('Adding new tag', 4); + Zotero.debug('Adding new tag', 4); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = 'INSERT INTO tags VALUES (?,?)'; - var rnd = Scholar.getRandomID('tags', 'tagID'); - Scholar.DB.query(sql, [{int: rnd}, {string: tag}]); + var rnd = Zotero.getRandomID('tags', 'tagID'); + Zotero.DB.query(sql, [{int: rnd}, {string: tag}]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); return rnd; } @@ -2755,7 +2755,7 @@ Scholar.Tags = new function(){ function purge(){ var sql = 'SELECT tagID FROM tags WHERE tagID NOT IN ' + '(SELECT tagID FROM itemTags);'; - var toDelete = Scholar.DB.columnQuery(sql); + var toDelete = Zotero.DB.columnQuery(sql); if (!toDelete){ return false; @@ -2770,7 +2770,7 @@ Scholar.Tags = new function(){ sql = 'DELETE FROM tags WHERE tagID NOT IN ' + '(SELECT tagID FROM itemTags);'; - var result = Scholar.DB.query(sql); + var result = Zotero.DB.query(sql); return toDelete; } @@ -2785,8 +2785,8 @@ Scholar.Tags = new function(){ * * Extend using the following code within a child constructor: * - * Scholar.CachedTypes.apply(this, arguments); - * this.constructor.prototype = new Scholar.CachedTypes(); + * Zotero.CachedTypes.apply(this, arguments); + * this.constructor.prototype = new Zotero.CachedTypes(); * * And the following properties: * @@ -2797,7 +2797,7 @@ Scholar.Tags = new function(){ * this._ignoreCase = false; * */ -Scholar.CachedTypes = function(){ +Zotero.CachedTypes = function(){ var _types = new Array(); var _typesLoaded; var self = this; @@ -2824,7 +2824,7 @@ Scholar.CachedTypes = function(){ } if (!_types[idOrName]){ - Scholar.debug('Invalid ' + this._typeDesc + ' ' + idOrName, 1); + Zotero.debug('Invalid ' + this._typeDesc + ' ' + idOrName, 1); return ''; } @@ -2843,7 +2843,7 @@ Scholar.CachedTypes = function(){ } if (!_types[idOrName]){ - Scholar.debug('Invalid ' + this._typeDesc + ' ' + idOrName, 1); + Zotero.debug('Invalid ' + this._typeDesc + ' ' + idOrName, 1); return false; } @@ -2852,7 +2852,7 @@ Scholar.CachedTypes = function(){ function getTypes(where){ - return Scholar.DB.query('SELECT ' + this._idCol + ' AS id, ' + return Zotero.DB.query('SELECT ' + this._idCol + ' AS id, ' + this._nameCol + ' AS name FROM ' + this._table + (where ? ' ' + where : '') + ' ORDER BY ' + this._nameCol); } @@ -2881,9 +2881,9 @@ Scholar.CachedTypes = function(){ } -Scholar.CreatorTypes = new function(){ - Scholar.CachedTypes.apply(this, arguments); - this.constructor.prototype = new Scholar.CachedTypes(); +Zotero.CreatorTypes = new function(){ + Zotero.CachedTypes.apply(this, arguments); + this.constructor.prototype = new Zotero.CachedTypes(); this._typeDesc = 'creator type'; this._idCol = 'creatorTypeID'; @@ -2892,9 +2892,9 @@ Scholar.CreatorTypes = new function(){ } -Scholar.ItemTypes = new function(){ - Scholar.CachedTypes.apply(this, arguments); - this.constructor.prototype = new Scholar.CachedTypes(); +Zotero.ItemTypes = new function(){ + Zotero.CachedTypes.apply(this, arguments); + this.constructor.prototype = new Zotero.CachedTypes(); this.getPrimaryTypes = getPrimaryTypes; this.getSecondaryTypes = getSecondaryTypes; @@ -2919,9 +2919,9 @@ Scholar.ItemTypes = new function(){ } -Scholar.FileTypes = new function(){ - Scholar.CachedTypes.apply(this, arguments); - this.constructor.prototype = new Scholar.CachedTypes(); +Zotero.FileTypes = new function(){ + Zotero.CachedTypes.apply(this, arguments); + this.constructor.prototype = new Zotero.CachedTypes(); this._typeDesc = 'file type'; this._idCol = 'fileTypeID'; @@ -2934,14 +2934,14 @@ Scholar.FileTypes = new function(){ var sql = "SELECT fileTypeID FROM fileTypeMIMETypes " + "WHERE ? LIKE mimeType || '%'"; - return Scholar.DB.valueQuery(sql, [mimeType]); + return Zotero.DB.valueQuery(sql, [mimeType]); } } -Scholar.CharacterSets = new function(){ - Scholar.CachedTypes.apply(this, arguments); - this.constructor.prototype = new Scholar.CachedTypes(); +Zotero.CharacterSets = new function(){ + Zotero.CachedTypes.apply(this, arguments); + this.constructor.prototype = new Zotero.CachedTypes(); this._typeDesc = 'character sets'; this._idCol = 'charsetID'; @@ -2959,7 +2959,7 @@ Scholar.CharacterSets = new function(){ -Scholar.ItemFields = new function(){ +Zotero.ItemFields = new function(){ // Private members var _fields = new Array(); var _fieldFormats = new Array(); @@ -3030,7 +3030,7 @@ Scholar.ItemFields = new function(){ } if (!itemTypeID){ - Scholar.debug("Invalid item type id '" + itemTypeID + Zotero.debug("Invalid item type id '" + itemTypeID + "' provided to getItemTypeFields()", 1); return []; } @@ -3038,7 +3038,7 @@ Scholar.ItemFields = new function(){ var sql = 'SELECT fieldID FROM itemTypeFields ' + 'WHERE itemTypeID=' + itemTypeID + ' ORDER BY orderIndex'; - _itemTypeFields[itemTypeID] = Scholar.DB.columnQuery(sql); + _itemTypeFields[itemTypeID] = Zotero.DB.columnQuery(sql); return _itemTypeFields[itemTypeID]; } @@ -3063,7 +3063,7 @@ Scholar.ItemFields = new function(){ function _getFieldItemTypes(){ var sql = 'SELECT fieldID, itemTypeID FROM itemTypeFields'; - var results = Scholar.DB.query(sql); + var results = Zotero.DB.query(sql); if (!results){ throw ('No fields in itemTypeFields!'); @@ -3085,7 +3085,7 @@ Scholar.ItemFields = new function(){ function _loadFields(){ var i,len; - var result = Scholar.DB.query('SELECT * FROM fieldFormats'); + var result = Zotero.DB.query('SELECT * FROM fieldFormats'); for (i=0; i<result.length; i++){ _fieldFormats[result[i]['fieldFormatID']] = { @@ -3094,7 +3094,7 @@ Scholar.ItemFields = new function(){ }; } - result = Scholar.DB.query('SELECT * FROM fields'); + result = Zotero.DB.query('SELECT * FROM fields'); if (!result.length){ throw ('No fields in database!'); @@ -3121,15 +3121,15 @@ Scholar.ItemFields = new function(){ /* - * Scholar.getCollections(parent) + * Zotero.getCollections(parent) * * Returns an array of all collections are children of a collection - * as Scholar.Collection instances + * as Zotero.Collection instances * * Takes parent collectionID as optional parameter; * by default, returns root collections */ -Scholar.getCollections = function(parent, recursive){ +Zotero.getCollections = function(parent, recursive){ var toReturn = new Array(); if (!parent){ @@ -3141,15 +3141,15 @@ Scholar.getCollections = function(parent, recursive){ sql += ' ORDER BY collectionName'; - var children = Scholar.DB.columnQuery(sql); + var children = Zotero.DB.columnQuery(sql); if (!children){ - Scholar.debug('No child collections of collection ' + parent, 5); + Zotero.debug('No child collections of collection ' + parent, 5); return toReturn; } for (var i=0, len=children.length; i<len; i++){ - var obj = Scholar.Collections.get(children[i]); + var obj = Zotero.Collections.get(children[i]); if (!obj){ throw ('Collection ' + children[i] + ' not found'); } @@ -3160,7 +3160,7 @@ Scholar.getCollections = function(parent, recursive){ if (recursive){ var desc = obj.getDescendents(false, 'collection'); for (var j in desc){ - var obj2 = Scholar.Collections.get(desc[j]['id']); + var obj2 = Zotero.Collections.get(desc[j]['id']); if (!obj2){ throw ('Collection ' + desc[j] + ' not found'); } @@ -3175,12 +3175,12 @@ Scholar.getCollections = function(parent, recursive){ /* - * Scholar.getItems(parent) + * Zotero.getItems(parent) * * Returns an array of all items that are children of a collection--or all - * items if no parent provided--as Scholar.Item instances + * items if no parent provided--as Zotero.Item instances */ -Scholar.getItems = function(parent){ +Zotero.getItems = function(parent){ var toReturn = new Array(); if (!parent){ @@ -3194,28 +3194,28 @@ Scholar.getItems = function(parent){ + 'WHERE collectionID=' + parent; } - var children = Scholar.DB.columnQuery(sql); + var children = Zotero.DB.columnQuery(sql); if (!children){ if (!parent){ - Scholar.debug('No items in library', 5); + Zotero.debug('No items in library', 5); } else { - Scholar.debug('No child items of collection ' + parent, 5); + Zotero.debug('No child items of collection ' + parent, 5); } return toReturn; } - return Scholar.Items.get(children); + return Zotero.Items.get(children); } -Scholar.getAttachments = function(){ +Zotero.getAttachments = function(){ var toReturn = []; var sql = "SELECT A.itemID FROM items A JOIN itemAttachments B ON " + "(B.itemID=A.itemID) WHERE B.sourceItemID IS NULL"; - var items = Scholar.DB.query(itemAttachments); + var items = Zotero.DB.query(itemAttachments); - return Scholar.Items.get(items); + return Zotero.Items.get(items); } diff --git a/chrome/chromeFiles/content/scholar/xpcom/db.js b/chrome/chromeFiles/content/scholar/xpcom/db.js @@ -1,7 +1,7 @@ /* * DB connection and schema management class */ -Scholar.DB = new function(){ +Zotero.DB = new function(){ // Private members var _connection; var _transactionRollback; @@ -78,7 +78,7 @@ Scholar.DB = new function(){ statement.execute(); } else { - Scholar.debug(sql,5); + Zotero.debug(sql,5); db.executeSimpleSQL(sql); } @@ -160,7 +160,7 @@ Scholar.DB = new function(){ var db = _getDBConnection(); try { - Scholar.debug(sql,5); + Zotero.debug(sql,5); var statement = db.createStatement(sql); } catch (e){ @@ -207,7 +207,7 @@ Scholar.DB = new function(){ } else { throw('Invalid bound parameter ' + params[i] + - ' in ' + Scholar.varDump(params)); + ' in ' + Zotero.varDump(params)); } } var value = params[i]; @@ -216,19 +216,19 @@ Scholar.DB = new function(){ // Bind the parameter as the correct type switch (type){ case 'int': - Scholar.debug('Binding parameter ' + (i+1) + Zotero.debug('Binding parameter ' + (i+1) + ' of type int: ' + value, 5); statement.bindInt32Parameter(i, value); break; case 'string': - Scholar.debug('Binding parameter ' + (i+1) + Zotero.debug('Binding parameter ' + (i+1) + ' of type string: "' + value + '"', 5); statement.bindUTF8StringParameter(i, value); break; case 'null': - Scholar.debug('Binding parameter ' + (i+1) + Zotero.debug('Binding parameter ' + (i+1) + ' of type NULL', 5); statement.bindNullParameter(i); break; @@ -262,11 +262,11 @@ Scholar.DB = new function(){ if (db.transactionInProgress){ _transactionNestingLevel++; - Scholar.debug('Transaction in progress -- increasing level to ' + Zotero.debug('Transaction in progress -- increasing level to ' + _transactionNestingLevel, 5); } else { - Scholar.debug('Beginning DB transaction', 5); + Zotero.debug('Beginning DB transaction', 5); db.beginTransaction(); } } @@ -277,14 +277,14 @@ Scholar.DB = new function(){ if (_transactionNestingLevel){ _transactionNestingLevel--; - Scholar.debug('Decreasing transaction level to ' + _transactionNestingLevel, 5); + Zotero.debug('Decreasing transaction level to ' + _transactionNestingLevel, 5); } else if (_transactionRollback){ - Scholar.debug('Rolling back previously flagged transaction', 5); + Zotero.debug('Rolling back previously flagged transaction', 5); db.rollbackTransaction(); } else { - Scholar.debug('Committing transaction',5); + Zotero.debug('Committing transaction',5); try { db.commitTransaction(); } @@ -301,11 +301,11 @@ Scholar.DB = new function(){ var db = _getDBConnection(); if (_transactionNestingLevel){ - Scholar.debug('Flagging nested transaction for rollback', 5); + Zotero.debug('Flagging nested transaction for rollback', 5); _transactionRollback = true; } else { - Scholar.debug('Rolling back transaction', 5); + Zotero.debug('Rolling back transaction', 5); _transactionRollback = false; try { db.rollbackTransaction(); @@ -344,7 +344,7 @@ Scholar.DB = new function(){ return cols; } catch (e){ - Scholar.debug(e,1); + Zotero.debug(e,1); return false; } } @@ -370,7 +370,7 @@ Scholar.DB = new function(){ **/ function getNextID(table, column){ var sql = 'SELECT ' + column + ' FROM ' + table + ' ORDER BY ' + column; - var vals = Scholar.DB.columnQuery(sql); + var vals = Zotero.DB.columnQuery(sql); if (!vals){ return 1; @@ -402,7 +402,7 @@ Scholar.DB = new function(){ { var sql = "SELECT " + field + " FROM " + table + " WHERE " + field + " LIKE ? ORDER BY " + field; - var untitleds = Scholar.DB.columnQuery(sql, name + '%'); + var untitleds = Zotero.DB.columnQuery(sql, name + '%'); if (!untitleds || untitleds[0]!=name){ return name; @@ -412,7 +412,7 @@ Scholar.DB = new function(){ var num = 2; while (untitleds[i] && untitleds[i]==(name + ' ' + num)){ while (untitleds[i+1] && untitleds[i]==untitleds[i+1]){ - Scholar.debug('Next ' + i + ' is ' + untitleds[i]); + Zotero.debug('Next ' + i + ' is ' + untitleds[i]); i++; } @@ -443,10 +443,10 @@ Scholar.DB = new function(){ var store = Components.classes["@mozilla.org/storage/service;1"]. getService(Components.interfaces.mozIStorageService); - var file = Scholar.getScholarDatabase(); - var backupFile = Scholar.getScholarDatabase('bak'); + var file = Zotero.getZoteroDatabase(); + var backupFile = Zotero.getZoteroDatabase('bak'); - if (SCHOLAR_CONFIG['DB_REBUILD']){ + if (ZOTERO_CONFIG['DB_REBUILD']){ if (confirm('Erase all user data and recreate database from schema?')){ // Delete existing Zotero database if (file.exists()){ @@ -454,7 +454,7 @@ Scholar.DB = new function(){ } // Delete existing storage folder - var dir = Scholar.getStorageDirectory(); + var dir = Zotero.getStorageDirectory(); if (dir.exists()){ dir.remove(true); } @@ -468,7 +468,7 @@ Scholar.DB = new function(){ _connection = store.openDatabase(backupFile); } catch (e){ - Scholar.debug('Backup file was corrupt', 1); + Zotero.debug('Backup file was corrupt', 1); } _connection = undefined; } @@ -478,29 +478,29 @@ Scholar.DB = new function(){ } catch (e){ if (e.name=='NS_ERROR_FILE_CORRUPTED'){ - Scholar.debug('Database file corrupted', 1); + Zotero.debug('Database file corrupted', 1); // No backup file! Eek! if (!backupFile.exists()){ - Scholar.debug('No backup file exists', 1); + Zotero.debug('No backup file exists', 1); // Save damaged filed - Scholar.debug('Saving damaged DB file with .damaged extension', 1); - var damagedFile = Scholar.getScholarDatabase('damaged'); - Scholar.moveToUnique(file, damagedFile); + Zotero.debug('Saving damaged DB file with .damaged extension', 1); + var damagedFile = Zotero.getZoteroDatabase('damaged'); + Zotero.moveToUnique(file, damagedFile); // Create new main database - var file = Scholar.getScholarDatabase(); + var file = Zotero.getZoteroDatabase(); _connection = store.openDatabase(file); - alert(Scholar.getString('db.dbCorruptedNoBackup')); + alert(Zotero.getString('db.dbCorruptedNoBackup')); break catchBlock; } // Save damaged file - Scholar.debug('Saving damaged DB file with .damaged extension', 1); - var damagedFile = Scholar.getScholarDatabase('damaged'); - Scholar.moveToUnique(file, damagedFile); + Zotero.debug('Saving damaged DB file with .damaged extension', 1); + var damagedFile = Zotero.getZoteroDatabase('damaged'); + Zotero.moveToUnique(file, damagedFile); // Test the backup file try { @@ -509,19 +509,19 @@ Scholar.DB = new function(){ // Can't open backup either catch (e){ // Create new main database - var file = Scholar.getScholarDatabase(); + var file = Zotero.getZoteroDatabase(); _connection = store.openDatabase(file); - alert(Scholar.getString('db.dbRestoreFailed')); + alert(Zotero.getString('db.dbRestoreFailed')); break catchBlock; } _connection = undefined; // Copy backup file to main DB file - Scholar.debug('Restoring main database from backup file', 1); + Zotero.debug('Restoring main database from backup file', 1); try { - backupFile.copyTo(backupFile.parent, SCHOLAR_CONFIG['DB_FILE']); + backupFile.copyTo(backupFile.parent, ZOTERO_CONFIG['DB_FILE']); } catch (e){ // TODO: deal with low disk space @@ -529,13 +529,13 @@ Scholar.DB = new function(){ } // Open restored database - var file = Scholar.getScholarDirectory(); - file.append(SCHOLAR_CONFIG['DB_FILE']); + var file = Zotero.getZoteroDirectory(); + file.append(ZOTERO_CONFIG['DB_FILE']); _connection = store.openDatabase(file); - Scholar.debug('Database restored', 1); - var msg = Scholar.getString('db.dbRestored'); - msg = msg.replace('%1', Scholar.Date.getFileDateString(backupFile)) - msg = msg.replace('%2', Scholar.Date.getFileTimeString(backupFile)) + Zotero.debug('Database restored', 1); + var msg = Zotero.getString('db.dbRestored'); + msg = msg.replace('%1', Zotero.Date.getFileDateString(backupFile)) + msg = msg.replace('%2', Zotero.Date.getFileTimeString(backupFile)) alert(msg); break catchBlock; diff --git a/chrome/chromeFiles/content/scholar/xpcom/file.js b/chrome/chromeFiles/content/scholar/xpcom/file.js @@ -1,4 +1,4 @@ -Scholar.File = new function(){ +Zotero.File = new function(){ this.getExtension = getExtension; this.getSample = getSample; this.getContents = getContents; @@ -39,7 +39,7 @@ Scholar.File = new function(){ fis.init(file, false, false, false); if (charset){ - charset = Scholar.CharacterSets.getName(charset); + charset = Zotero.CharacterSets.getName(charset); } if (!charset){ @@ -88,11 +88,11 @@ Scholar.File = new function(){ } if (mimeType.substr(0, 5)!='text/' || - !Scholar.MIME.hasInternalHandler(mimeType, this.getExtension(file))){ + !Zotero.MIME.hasInternalHandler(mimeType, this.getExtension(file))){ return false; } - var browser = Scholar.Browser.createHiddenBrowser(); + var browser = Zotero.Browser.createHiddenBrowser(); var url = Components.classes["@mozilla.org/network/protocol;1?name=file"] .getService(Components.interfaces.nsIFileProtocolHandler) @@ -118,23 +118,23 @@ Scholar.File = new function(){ .getService(Components.interfaces.nsIPrefBranch); var oldPref = prefService.getCharPref('intl.charset.detector'); var newPref = 'universal_charset_detector'; - //Scholar.debug("Default character detector is " + (oldPref ? oldPref : '(none)')); + //Zotero.debug("Default character detector is " + (oldPref ? oldPref : '(none)')); if (oldPref != newPref){ - //Scholar.debug('Setting character detector to universal_charset_detector'); + //Zotero.debug('Setting character detector to universal_charset_detector'); prefService.setCharPref('intl.charset.detector', 'universal_charset_detector'); } browser.addEventListener("pageshow", function(){ var charset = browser.contentDocument.characterSet; - Scholar.debug("Detected character set '" + charset + "'"); + Zotero.debug("Detected character set '" + charset + "'"); - //Scholar.debug('Resetting character detector to ' + (oldPref ? oldPref : '(none)')); + //Zotero.debug('Resetting character detector to ' + (oldPref ? oldPref : '(none)')); prefService.setCharPref('intl.charset.detector', oldPref); callback(charset, args); - Scholar.Browser.deleteHiddenBrowser(browser); + Zotero.Browser.deleteHiddenBrowser(browser); }, false); } } diff --git a/chrome/chromeFiles/content/scholar/xpcom/fulltext.js b/chrome/chromeFiles/content/scholar/xpcom/fulltext.js @@ -1,4 +1,4 @@ -Scholar.Fulltext = new function(){ +Zotero.Fulltext = new function(){ this.indexWord = indexWord; this.indexWords = indexWords; this.indexDocument = indexDocument; @@ -20,21 +20,21 @@ Scholar.Fulltext = new function(){ function cacheIsOutdated(){ var sql = "SELECT version FROM version WHERE schema='fulltext'"; - return Scholar.DB.valueQuery(sql) < FULLTEXT_VERSION; + return Zotero.DB.valueQuery(sql) < FULLTEXT_VERSION; } function rebuildCache(){ - Scholar.DB.beginTransaction(); - Scholar.DB.query("DELETE FROM fulltextWords"); - Scholar.DB.query("DELETE FROM fulltextItems"); - //Scholar.DB.query("DELETE FROM fulltextContent"); + Zotero.DB.beginTransaction(); + Zotero.DB.query("DELETE FROM fulltextWords"); + Zotero.DB.query("DELETE FROM fulltextItems"); + //Zotero.DB.query("DELETE FROM fulltextContent"); var sql = "SELECT itemID FROM itemAttachments"; - var items = Scholar.DB.columnQuery(sql); + var items = Zotero.DB.columnQuery(sql); indexItems(items); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -42,20 +42,20 @@ Scholar.Fulltext = new function(){ * Index a single word */ function indexWord(itemID, word){ - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "SELECT wordID FROM fulltextWords WHERE word=?"; - var wordID = Scholar.DB.valueQuery(sql, {string:word}); + var wordID = Zotero.DB.valueQuery(sql, {string:word}); if (!wordID){ var sql = "INSERT INTO fulltextWords (word) VALUES (?)"; - var wordID = Scholar.DB.query(sql, {string:word}); + var wordID = Zotero.DB.query(sql, {string:word}); } var sql = "INSERT OR IGNORE INTO fulltextItems VALUES (?,?)"; - Scholar.DB.query(sql, [wordID, itemID]); + Zotero.DB.query(sql, [wordID, itemID]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -75,11 +75,11 @@ Scholar.Fulltext = new function(){ sqlParams.push({string:word}); } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "SELECT word, wordID from fulltextWords WHERE word IN (" sql += sqlQues.join() + ")"; - var wordIDs = Scholar.DB.query(sql, sqlParams); + var wordIDs = Zotero.DB.query(sql, sqlParams); var existing = []; for (var i in wordIDs){ @@ -88,8 +88,8 @@ Scholar.Fulltext = new function(){ } // Handle bound parameters manually for optimal speed - var statement1 = Scholar.DB.getStatement("INSERT INTO fulltextWords (word) VALUES (?)"); - var statement2 = Scholar.DB.getStatement("INSERT OR IGNORE INTO fulltextItems VALUES (?,?)"); + var statement1 = Zotero.DB.getStatement("INSERT INTO fulltextWords (word) VALUES (?)"); + var statement2 = Zotero.DB.getStatement("INSERT OR IGNORE INTO fulltextItems VALUES (?,?)"); for each(var word in words){ if (existing['_' + word]){ @@ -98,7 +98,7 @@ Scholar.Fulltext = new function(){ else { statement1.bindUTF8StringParameter(0, word); statement1.execute() - var wordID = Scholar.DB.getLastInsertID(); + var wordID = Zotero.DB.getLastInsertID(); } statement2.bindInt32Parameter(0, wordID); @@ -109,24 +109,24 @@ Scholar.Fulltext = new function(){ statement1.reset(); statement2.reset(); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } function indexString(text, charset, itemID){ var words = semanticSplitter(text, charset); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); clearItemWords(itemID); indexWords(itemID, words); /* var sql = "REPLACE INTO fulltextContent (itemID, textContent) VALUES (?,?)"; - Scholar.DB.query(sql, [itemID, {string:text}]); + Zotero.DB.query(sql, [itemID, {string:text}]); */ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -135,7 +135,7 @@ Scholar.Fulltext = new function(){ throw ('Item ID not provided to indexDocument()'); } - Scholar.debug("Indexing document '" + document.title + "'"); + Zotero.debug("Indexing document '" + document.title + "'"); var text = document.body.innerHTML.replace(/(>)/g, '$1 '); text = HTMLToText(text); @@ -145,7 +145,7 @@ Scholar.Fulltext = new function(){ function indexFile(file, mimeType, charset, itemID){ if (!file.exists()){ - Scholar.debug('File not found in indexFile()', 2); + Zotero.debug('File not found in indexFile()', 2); return false; } @@ -153,13 +153,13 @@ Scholar.Fulltext = new function(){ if (!mimeType){ throw ('MIME type not provided to indexFile()'); } if (mimeType.substr(0, 5)!='text/'){ - Scholar.debug('File is not text in indexFile()', 2); + Zotero.debug('File is not text in indexFile()', 2); return false; } if (!charset){ throw ('Charset not provided to indexFile()'); } - var text = Scholar.File.getContents(file, charset); + var text = Zotero.File.getContents(file, charset); // Split elements to avoid word concatentation text = text.replace(/(>)/g, '$1 '); text = HTMLToText(text); @@ -168,10 +168,10 @@ Scholar.Fulltext = new function(){ function indexItems(items){ - var items = Scholar.Items.get(items); + var items = Zotero.Items.get(items); var found = []; - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); for each(var i in items){ if (!i.isAttachment()){ @@ -188,9 +188,9 @@ Scholar.Fulltext = new function(){ } var sql = "REPLACE INTO version (schema,version) VALUES (?,?)"; - Scholar.DB.query(sql, ['fulltext', FULLTEXT_VERSION]); + Zotero.DB.query(sql, ['fulltext', FULLTEXT_VERSION]); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -206,9 +206,9 @@ Scholar.Fulltext = new function(){ * - Slashes in regex are optional */ function findTextInFile(file, charset, searchText, mode){ - Scholar.debug("Searching for text '" + searchText + "' in " + file.path); + Zotero.debug("Searching for text '" + searchText + "' in " + file.path); - var str = Scholar.File.getContents(file, charset); + var str = Zotero.File.getContents(file, charset); // If not binary mode, convert HTML to text if (!mode || mode.indexOf('Binary')==-1){ @@ -240,7 +240,7 @@ Scholar.Fulltext = new function(){ var re = new RegExp(searchText, flags); var matches = re(str); if (matches){ - Scholar.debug("Text found"); + Zotero.debug("Text found"); return str.substr(matches.index, 50); } @@ -253,7 +253,7 @@ Scholar.Fulltext = new function(){ var pos = str.indexOf(searchText); if (pos!=-1){ - Scholar.debug('Text found'); + Zotero.debug('Text found'); return str.substr(pos, 50); } } @@ -280,7 +280,7 @@ Scholar.Fulltext = new function(){ return []; } - var items = Scholar.Items.get(items); + var items = Zotero.Items.get(items); var found = []; for each(var i in items){ @@ -314,13 +314,13 @@ Scholar.Fulltext = new function(){ function clearItemWords(itemID){ - Scholar.DB.query("DELETE FROM fulltextItems WHERE itemID=" + itemID); + Zotero.DB.query("DELETE FROM fulltextItems WHERE itemID=" + itemID); } /* function clearItemContent(itemID){ - Scholar.DB.query("DELETE FROM fulltextContent WHERE itemID=" + itemID); + Zotero.DB.query("DELETE FROM fulltextContent WHERE itemID=" + itemID); } */ @@ -328,7 +328,7 @@ Scholar.Fulltext = new function(){ function purgeUnusedWords(){ var sql = "DELETE FROM fulltextWords WHERE wordID NOT IN " + "(SELECT wordID FROM fulltextItems)"; - Scholar.DB.query(sql); + Zotero.DB.query(sql); } @@ -347,7 +347,7 @@ Scholar.Fulltext = new function(){ return to.toString(); } catch(e){ - Scholar.debug(e, 1); + Zotero.debug(e, 1); return text; } } @@ -355,7 +355,7 @@ Scholar.Fulltext = new function(){ function semanticSplitter(text, charset){ if (!text){ - Scholar.debug('No text to index'); + Zotero.debug('No text to index'); return; } diff --git a/chrome/chromeFiles/content/scholar/xpcom/history.js b/chrome/chromeFiles/content/scholar/xpcom/history.js @@ -1,4 +1,4 @@ -Scholar.History = new function(){ +Zotero.History = new function(){ this.begin = begin; this.setAssociatedID = setAssociatedID; this.add = add; @@ -27,7 +27,7 @@ Scholar.History = new function(){ * 'collection-modify', 'collection-delete'... * * id: An id or array of ids that will be passed to - * Scholar.Notifier.trigger() on an undo or redo + * Zotero.Notifier.trigger() on an undo or redo **/ function begin(event, id){ if (_activeID){ @@ -41,7 +41,7 @@ Scholar.History = new function(){ this.clearAfter(); } - Scholar.debug('Beginning history transaction set ' + event); + Zotero.debug('Beginning history transaction set ' + event); var sql = "INSERT INTO transactionSets (event, id) VALUES " + "('" + event + "', "; if (!id){ @@ -56,8 +56,8 @@ Scholar.History = new function(){ } sql += ")"; - Scholar.DB.beginTransaction(); - _activeID = Scholar.DB.query(sql); + Zotero.DB.beginTransaction(); + _activeID = Zotero.DB.query(sql); _activeEvent = event; } @@ -67,7 +67,7 @@ Scholar.History = new function(){ * for use if the ids weren't available at when begin() was called * * id: An id or array of ids that will be passed to - * Scholar.Notifier.trigger() on an undo or redo + * Zotero.Notifier.trigger() on an undo or redo **/ function setAssociatedID(id){ if (!_activeID){ @@ -86,7 +86,7 @@ Scholar.History = new function(){ sql += id; } sql += " WHERE transactionSetID=" + _activeID; - Scholar.DB.query(sql); + Zotero.DB.query(sql); } @@ -144,8 +144,8 @@ Scholar.History = new function(){ * Commit the current transaction set **/ function commit(){ - Scholar.debug('Committing history transaction set ' + _activeEvent); - Scholar.DB.commitTransaction(); + Zotero.debug('Committing history transaction set ' + _activeEvent); + Zotero.DB.commitTransaction(); _currentID = _activeID; _maxID = _activeID; _activeID = null; @@ -157,8 +157,8 @@ Scholar.History = new function(){ * Cancel the current transaction set **/ function cancel(){ - Scholar.debug('Cancelling history transaction set ' + _activeEvent); - Scholar.DB.rollbackTransaction(); + Zotero.debug('Cancelling history transaction set ' + _activeEvent); + Zotero.DB.rollbackTransaction(); _activeID = null; _activeEvent = null; } @@ -174,7 +174,7 @@ Scholar.History = new function(){ var sql = "SELECT event FROM transactionSets WHERE transactionSetID=" + _currentID; - return Scholar.DB.valueQuery(sql); + return Zotero.DB.valueQuery(sql); } @@ -184,7 +184,7 @@ Scholar.History = new function(){ function getNextEvent(){ var sql = "SELECT event FROM transactionSets WHERE transactionSetID=" + (_currentID + 1); - return Scholar.DB.valueQuery(sql); + return Zotero.DB.valueQuery(sql); } @@ -198,11 +198,11 @@ Scholar.History = new function(){ } var id = _currentID; - Scholar.debug('Undoing transaction set ' + id); - Scholar.DB.beginTransaction(); + Zotero.debug('Undoing transaction set ' + id); + Zotero.DB.beginTransaction(); var undone = _do('undo'); _currentID--; - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); _reloadAndNotify(id); return true; } @@ -213,11 +213,11 @@ Scholar.History = new function(){ **/ function redo(){ var id = _currentID + 1; - Scholar.debug('Redoing transaction set ' + id); - Scholar.DB.beginTransaction(); + Zotero.debug('Redoing transaction set ' + id); + Zotero.DB.beginTransaction(); var redone = _do('redo'); _currentID++; - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); _reloadAndNotify(id, true); return redone; } @@ -227,15 +227,15 @@ Scholar.History = new function(){ * Clear the entire history **/ function clear(){ - Scholar.DB.beginTransaction(); - Scholar.DB.query("DELETE FROM transactionSets"); - Scholar.DB.query("DELETE FROM transactions"); - Scholar.DB.query("DELETE FROM transactionLog"); + Zotero.DB.beginTransaction(); + Zotero.DB.query("DELETE FROM transactionSets"); + Zotero.DB.query("DELETE FROM transactions"); + Zotero.DB.query("DELETE FROM transactionLog"); _currentID = null; _activeID = null; _activeEvent = null; _maxID = null; - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } @@ -243,25 +243,25 @@ Scholar.History = new function(){ * Clear all transactions in history after the current one **/ function clearAfter(){ - Scholar.DB.beginTransaction(); - var min = Scholar.DB.valueQuery("SELECT MIN(transactionID) FROM " + Zotero.DB.beginTransaction(); + var min = Zotero.DB.valueQuery("SELECT MIN(transactionID) FROM " + "transactions WHERE transactionSetID=" + (_currentID + 1)); if (!min){ - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); return; } - Scholar.DB.query("DELETE FROM transactionLog " + Zotero.DB.query("DELETE FROM transactionLog " + "WHERE transactionID>=" + min); - Scholar.DB.query("DELETE FROM transactions " + Zotero.DB.query("DELETE FROM transactions " + "WHERE transactionID>=" + min); - Scholar.DB.query("DELETE FROM transactionSets " + Zotero.DB.query("DELETE FROM transactionSets " + "WHERE transactionSetID>" + _currentID); _maxID = _currentID; _activeID = null; - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); return; } @@ -287,7 +287,7 @@ Scholar.History = new function(){ + "VALUES (" + _activeID + ", '" + contextString + "', '" + action + "')"; - var transactionID = Scholar.DB.query(sql); + var transactionID = Zotero.DB.query(sql); switch (action){ case 'add': @@ -299,24 +299,24 @@ Scholar.History = new function(){ if (field){ var sql = "INSERT INTO transactionLog SELECT " + transactionID + ", '" + field + "', " + field + fromClause; - Scholar.DB.query(sql); + Zotero.DB.query(sql); break; } // Fall through if no field specified and save all case 'remove': - var cols = Scholar.DB.getColumns(table); + var cols = Zotero.DB.getColumns(table); for (var i in cols){ // If column is not part of the key, log it - if (!Scholar.inArray(cols[i], context['keys'])){ + if (!Zotero.inArray(cols[i], context['keys'])){ var sql = "INSERT INTO transactionLog " + "SELECT " + transactionID + ", '" + cols[i] + "', " + cols[i] + fromClause; - Scholar.DB.query(sql); + Zotero.DB.query(sql); } } break; default: - Scholar.DB.rollbackTransaction(); + Zotero.DB.rollbackTransaction(); throw("Invalid history action '" + action + "'"); } } @@ -334,7 +334,7 @@ Scholar.History = new function(){ var sql = "SELECT transactionID, context, action FROM transactions " + "WHERE transactionSetID=" + id; - var transactions = Scholar.DB.query(sql); + var transactions = Zotero.DB.query(sql); if (!transactions){ throw('Transaction set not found for ' @@ -362,31 +362,31 @@ Scholar.History = new function(){ var fromClause = _contextToSQLFrom(context); // First, store the row we're about to delete for later redo - var cols = Scholar.DB.getColumns(context['table']); + var cols = Zotero.DB.getColumns(context['table']); for (var i in cols){ // If column is not part of the key, log it - if (!Scholar.inArray(cols[i], context['keys'])){ + if (!Zotero.inArray(cols[i], context['keys'])){ var sql = "INSERT INTO transactionLog " + "SELECT " + transactionID + ", '" + cols[i] + "', " + cols[i] + fromClause; - Scholar.DB.query(sql); + Zotero.DB.query(sql); } } // And delete the row var sql = "DELETE" + fromClause; - Scholar.DB.query(sql); + Zotero.DB.query(sql); break; case 'modify': // Retrieve old values var sql = "SELECT field, value FROM transactionLog " + "WHERE transactionID=" + transactionID; - var oldFieldValues = Scholar.DB.query(sql); + var oldFieldValues = Zotero.DB.query(sql); // Retrieve new values var sql = "SELECT *" + _contextToSQLFrom(context); - var newValues = Scholar.DB.rowQuery(sql); + var newValues = Zotero.DB.rowQuery(sql); // Update row with old values var sql = "UPDATE " + context['table'] + " SET "; @@ -396,14 +396,14 @@ Scholar.History = new function(){ values.push(oldFieldValues[i]['value']); } sql = sql.substr(0, sql.length-2) + _contextToSQLWhere(context); - Scholar.DB.query(sql, values); + Zotero.DB.query(sql, values); // Update log with new values for later redo for (var i in newValues){ - if (!Scholar.inArray(i, context['keys'])){ + if (!Zotero.inArray(i, context['keys'])){ var sql = "UPDATE transactionLog SET " + "value=? WHERE transactionID=? AND field=?"; - Scholar.DB.query(sql, [i, newValues[i], transactionID]); + Zotero.DB.query(sql, [i, newValues[i], transactionID]); } } break; @@ -412,7 +412,7 @@ Scholar.History = new function(){ // Retrieve old values var sql = "SELECT field, value FROM transactionLog " + "WHERE transactionID=" + transactionID; - var oldFieldValues = Scholar.DB.query(sql); + var oldFieldValues = Zotero.DB.query(sql); // Add key to parameters var fields = [], values = [], marks = []; @@ -432,12 +432,12 @@ Scholar.History = new function(){ // Insert old values into table var sql = "INSERT INTO " + context['table'] + "(" + fields.join() + ") VALUES (" + marks.join() + ")"; - Scholar.DB.query(sql, values); + Zotero.DB.query(sql, values); // Delete restored data from transactionLog var sql = "DELETE FROM transactionLog WHERE transactionID=" + transactionID; - Scholar.DB.query(sql); + Zotero.DB.query(sql); break; } } @@ -481,7 +481,7 @@ Scholar.History = new function(){ function _getSetData(transactionSetID){ var sql = "SELECT event, id FROM transactionSets WHERE transactionSetID=" + transactionSetID; - return Scholar.DB.rowQuery(sql); + return Zotero.DB.rowQuery(sql); } @@ -500,10 +500,10 @@ Scholar.History = new function(){ } switch (eventParts[1]){ case 'item': - Scholar.Items.reload(data['id']); + Zotero.Items.reload(data['id']); break; } - Scholar.Notifier.trigger(eventParts[0], eventParts[1], data['id']); + Zotero.Notifier.trigger(eventParts[0], eventParts[1], data['id']); } } diff --git a/chrome/chromeFiles/content/scholar/xpcom/ingester.js b/chrome/chromeFiles/content/scholar/xpcom/ingester.js @@ -1,12 +1,12 @@ -// Scholar for Firefox Ingester +// Zotero for Firefox Ingester // Utilities based on code taken from Piggy Bank 2.1.1 (BSD-licensed) // This code is licensed according to the GPL -Scholar.Ingester = new Object(); +Zotero.Ingester = new Object(); ///////////////////////////////////////////////////////////////// // -// Scholar.Ingester.ProxyMonitor +// Zotero.Ingester.ProxyMonitor // ///////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ Scholar.Ingester = new Object(); /* * Precompile proxy regexps */ -Scholar.Ingester.ProxyMonitor = new function() { +Zotero.Ingester.ProxyMonitor = new function() { var _ezProxyRe = new RegExp(); _ezProxyRe.compile("\\?(?:.+&)?(url|qurl)=([^&]+)", "i"); /*var _hostRe = new RegExp(); @@ -48,7 +48,7 @@ Scholar.Ingester.ProxyMonitor = new function() { try { // remove content-disposition headers for endnote, etc. var contentType = channel.getResponseHeader("Content-Type").toLowerCase(); - for each(var desiredContentType in Scholar.Ingester.MIMEHandler.URIContentListener.desiredContentTypes) { + for each(var desiredContentType in Zotero.Ingester.MIMEHandler.URIContentListener.desiredContentTypes) { if(contentType.length < desiredContentType.length) { break; } else { @@ -100,7 +100,7 @@ Scholar.Ingester.ProxyMonitor = new function() { newURI.hostPort.substr(newURI.hostPort.length-channel.URI.hostPort.length) == channel.URI.hostPort)) { // Different ports but the same server means EZproxy active - Scholar.debug("EZProxy: host "+newURI.hostPort+" is really "+properURI.hostPort); + Zotero.debug("EZProxy: host "+newURI.hostPort+" is really "+properURI.hostPort); // Initialize variables here so people who never use EZProxies // don't get the (very very minor) speed hit if(!_mapFromProxy) { @@ -124,7 +124,7 @@ Scholar.Ingester.ProxyMonitor = new function() { var uri = _parseURL(url); if(uri && _mapFromProxy[uri.hostPort]) { url = url.replace(uri.hostPort, _mapFromProxy[uri.hostPort]); - Scholar.debug("EZProxy: proper url is "+url); + Zotero.debug("EZProxy: proper url is "+url); } } @@ -142,7 +142,7 @@ Scholar.Ingester.ProxyMonitor = new function() { if(uri && _mapToProxy[uri.hostPort]) { // Actually need to map url = url.replace(uri.hostPort, _mapToProxy[uri.hostPort]); - Scholar.debug("EZProxy: proxied url is "+url); + Zotero.debug("EZProxy: proxied url is "+url); } } @@ -160,7 +160,7 @@ Scholar.Ingester.ProxyMonitor = new function() { } } -Scholar.OpenURL = new function() { +Zotero.OpenURL = new function() { this.resolve = resolve; this.discoverResolvers = discoverResolvers; this.createContextObject = createContextObject; @@ -170,9 +170,9 @@ Scholar.OpenURL = new function() { * Returns a URL to look up an item in the OpenURL resolver */ function resolve(itemObject) { - var co = createContextObject(itemObject, Scholar.Prefs.get("openURL.version")); + var co = createContextObject(itemObject, Zotero.Prefs.get("openURL.version")); if(co) { - return Scholar.Prefs.get("openURL.resolver")+"?"+co; + return Zotero.Prefs.get("openURL.resolver")+"?"+co; } return false; } @@ -342,7 +342,7 @@ Scholar.OpenURL = new function() { item.itemType = "journalArticle"; break; } else if(format == "info:ofi/fmt:kev:mtx:book") { - if(Scholar.inArray("rft.genre=bookitem", coParts)) { + if(Zotero.inArray("rft.genre=bookitem", coParts)) { item.itemType = "bookSection"; } else { item.itemType = "book"; @@ -447,7 +447,7 @@ Scholar.OpenURL = new function() { item.creators.push({firstName:value}); } } else if(key == "rft.au") { - item.creators.push(Scholar.Utilities.prototype.cleanAuthor(value, "author", true)); + item.creators.push(Zotero.Utilities.prototype.cleanAuthor(value, "author", true)); } else if(key == "rft.aucorp") { item.creators.push({lastName:value, isInstitution:true}); } else if(key == "rft.isbn" && !item.ISBN) { @@ -488,7 +488,7 @@ Scholar.OpenURL = new function() { } } -Scholar.Ingester.MIMEHandler = new function() { +Zotero.Ingester.MIMEHandler = new function() { var on = false; this.init = init; @@ -497,26 +497,26 @@ Scholar.Ingester.MIMEHandler = new function() { * registers URIContentListener to handle MIME types */ function init() { - var prefStatus = Scholar.Prefs.get("parseEndNoteMIMETypes"); + var prefStatus = Zotero.Prefs.get("parseEndNoteMIMETypes"); if(!on && prefStatus) { var uriLoader = Components.classes["@mozilla.org/uriloader;1"]. getService(Components.interfaces.nsIURILoader); - uriLoader.registerContentListener(Scholar.Ingester.MIMEHandler.URIContentListener); + uriLoader.registerContentListener(Zotero.Ingester.MIMEHandler.URIContentListener); on = true; } else if(on && !prefStatus) { var uriLoader = Components.classes["@mozilla.org/uriloader;1"]. getService(Components.interfaces.nsIURILoader); - uriLoader.unRegisterContentListener(Scholar.Ingester.MIMEHandler.URIContentListener); + uriLoader.unRegisterContentListener(Zotero.Ingester.MIMEHandler.URIContentListener); on = false; } } } /* - * Scholar.Ingester.MIMEHandler.URIContentListener: implements + * Zotero.Ingester.MIMEHandler.URIContentListener: implements * nsIURIContentListener interface to grab MIME types */ -Scholar.Ingester.MIMEHandler.URIContentListener = new function() { +Zotero.Ingester.MIMEHandler.URIContentListener = new function() { // list of content types to capture // NOTE: must be from shortest to longest length this.desiredContentTypes = ["application/x-endnote-refer", @@ -538,20 +538,20 @@ Scholar.Ingester.MIMEHandler.URIContentListener = new function() { } function canHandleContent(contentType, isContentPreferred, desiredContentType) { - if(Scholar.inArray(contentType, this.desiredContentTypes)) { + if(Zotero.inArray(contentType, this.desiredContentTypes)) { return true; } return false; } function doContent(contentType, isContentPreferred, request, contentHandler) { - Scholar.debug("doing content for "+request.name); - contentHandler.value = new Scholar.Ingester.MIMEHandler.StreamListener(request, contentType); + Zotero.debug("doing content for "+request.name); + contentHandler.value = new Zotero.Ingester.MIMEHandler.StreamListener(request, contentType); return false; } function isPreferred(contentType, desiredContentType) { - if(Scholar.inArray(contentType, this.desiredContentTypes)) { + if(Zotero.inArray(contentType, this.desiredContentTypes)) { return true; } return false; @@ -563,10 +563,10 @@ Scholar.Ingester.MIMEHandler.URIContentListener = new function() { } /* - * Scholar.Ingester.MIMEHandler.StreamListener: implements nsIStreamListener and + * Zotero.Ingester.MIMEHandler.StreamListener: implements nsIStreamListener and * nsIRequestObserver interfaces to download MIME types we've grabbed */ -Scholar.Ingester.MIMEHandler.StreamListener = function(request, contentType) { +Zotero.Ingester.MIMEHandler.StreamListener = function(request, contentType) { this._request = request; this._contentType = contentType this._readString = ""; @@ -577,12 +577,12 @@ Scholar.Ingester.MIMEHandler.StreamListener = function(request, contentType) { var windowWatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]. getService(Components.interfaces.nsIWindowWatcher); this._frontWindow = windowWatcher.activeWindow; - this._frontWindow.Scholar_Ingester_Interface.Progress.show(); + this._frontWindow.Zotero_Ingester_Interface.Progress.show(); - Scholar.debug("EndNote prepared to grab content type "+contentType); + Zotero.debug("EndNote prepared to grab content type "+contentType); } -Scholar.Ingester.MIMEHandler.StreamListener.prototype.QueryInterface = function(iid) { +Zotero.Ingester.MIMEHandler.StreamListener.prototype.QueryInterface = function(iid) { if(iid.equals(Components.interfaces.nsISupports) || iid.equals(Components.interfaces.nsIRequestObserver) || iid.equals(Components.interfaces.nsIStreamListener)) { @@ -591,13 +591,13 @@ Scholar.Ingester.MIMEHandler.StreamListener.prototype.QueryInterface = function( throw Components.results.NS_ERROR_NO_INTERFACE; } -Scholar.Ingester.MIMEHandler.StreamListener.prototype.onStartRequest = function(channel, context) {} +Zotero.Ingester.MIMEHandler.StreamListener.prototype.onStartRequest = function(channel, context) {} /* * called when there's data available; basicallly, we just want to collect this data */ -Scholar.Ingester.MIMEHandler.StreamListener.prototype.onDataAvailable = function(request, context, inputStream, offset, count) { - Scholar.debug(count+" bytes available"); +Zotero.Ingester.MIMEHandler.StreamListener.prototype.onDataAvailable = function(request, context, inputStream, offset, count) { + Zotero.debug(count+" bytes available"); if(inputStream != this._scriptableStreamInput) { // get storage stream // if there's not one @@ -612,24 +612,24 @@ Scholar.Ingester.MIMEHandler.StreamListener.prototype.onDataAvailable = function /* * called when the request is done */ -Scholar.Ingester.MIMEHandler.StreamListener.prototype.onStopRequest = function(channel, context, status) { - Scholar.debug("request finished"); +Zotero.Ingester.MIMEHandler.StreamListener.prototype.onStopRequest = function(channel, context, status) { + Zotero.debug("request finished"); var externalHelperAppService = Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]. getService(Components.interfaces.nsIExternalHelperAppService); - // attempt to import through Scholar.Translate - var translation = new Scholar.Translate("import"); + // attempt to import through Zotero.Translate + var translation = new Zotero.Translate("import"); translation.setLocation(this._request.name); translation.setString(this._readString); - translation.setHandler("itemDone", this._frontWindow.Scholar_Ingester_Interface._itemDone); - translation.setHandler("done", this._frontWindow.Scholar_Ingester_Interface._finishScraping); + translation.setHandler("itemDone", this._frontWindow.Zotero_Ingester_Interface._itemDone); + translation.setHandler("done", this._frontWindow.Zotero_Ingester_Interface._finishScraping); // attempt to retrieve translators var translators = translation.getTranslators(); if(!translators.length) { // we lied. we can't really translate this file. call // nsIExternalHelperAppService with the data - this._frontWindow.Scholar_Ingester_Interface.Progress.kill(); + this._frontWindow.Zotero_Ingester_Interface.Progress.kill(); var streamListener; if(streamListener = externalHelperAppService.doContent(this._contentType, this._request, this._frontWindow)) { diff --git a/chrome/chromeFiles/content/scholar/xpcom/integration.js b/chrome/chromeFiles/content/scholar/xpcom/integration.js @@ -1,4 +1,4 @@ -Scholar.Integration = new function() { +Zotero.Integration = new function() { var _contentLengthRe = /[\r\n]Content-Length: *([0-9]+)/i; var _XMLRe = /<\?[^>]+\?>/; this.ns = "http://www.zotero.org/namespaces/SOAP"; @@ -18,9 +18,9 @@ Scholar.Integration = new function() { // bind to a random port on loopback only serv.init(50001, true, -1); - serv.asyncListen(Scholar.Integration.SocketListener); + serv.asyncListen(Zotero.Integration.SocketListener); - Scholar.debug("Integration HTTP server listening on 127.0.0.1:"+serv.port); + Zotero.debug("Integration HTTP server listening on 127.0.0.1:"+serv.port); } /* @@ -51,17 +51,17 @@ Scholar.Integration = new function() { * handles a SOAP envelope */ function handleEnvelope(envelope, encoding) { - Scholar.debug("Integration: SOAP Request\n"+envelope); + Zotero.debug("Integration: SOAP Request\n"+envelope); envelope = envelope.replace(_XMLRe, ""); var env = new Namespace("http://schemas.xmlsoap.org/soap/envelope/"); var xml = new XML(envelope); var request = xml.env::Body.children()[0]; if(request.namespace() != this.ns) { - Scholar.debug("Integration: SOAP method not supported: invalid namespace"); + Zotero.debug("Integration: SOAP method not supported: invalid namespace"); } else { var name = request.localName(); - if(Scholar.Integration.SOAP[name]) { + if(Zotero.Integration.SOAP[name]) { if(request.input.length()) { // split apart passed parameters (same colon-escaped format // as we pass) @@ -89,7 +89,7 @@ Scholar.Integration = new function() { } // execute request - var output = Scholar.Integration.SOAP[name](vars); + var output = Zotero.Integration.SOAP[name](vars); // ugh: we can't use real SOAP, since AppleScript VBA can't pass // objects, so implode arrays @@ -116,13 +116,13 @@ Scholar.Integration = new function() { </SOAP-ENV:Envelope>; var response = '<?xml version="1.0" encoding="'+encoding+'"?>\n'+responseEnvelope.toXMLString(); - Scholar.debug("Integration: SOAP Response\n"+response); + Zotero.debug("Integration: SOAP Response\n"+response); // return OK return _generateResponse("200 OK", 'text/xml; charset="'+encoding+'"', response); } else { - Scholar.debug("Integration: SOAP method not supported"); + Zotero.debug("Integration: SOAP method not supported"); } } } @@ -146,7 +146,7 @@ Scholar.Integration = new function() { } } -Scholar.Integration.SocketListener = new function() { +Zotero.Integration.SocketListener = new function() { this.onSocketAccepted = onSocketAccepted; /* @@ -157,7 +157,7 @@ Scholar.Integration.SocketListener = new function() { var iStream = transport.openInputStream(0, 0, 0); var oStream = transport.openOutputStream(0, 0, 0); - var dataListener = new Scholar.Integration.DataListener(iStream, oStream); + var dataListener = new Zotero.Integration.DataListener(iStream, oStream); var pump = Components.classes["@mozilla.org/network/input-stream-pump;1"] .createInstance(Components.interfaces.nsIInputStreamPump); pump.init(iStream, -1, -1, 0, 0, false); @@ -168,7 +168,7 @@ Scholar.Integration.SocketListener = new function() { /* * handles the actual acquisition of data */ -Scholar.Integration.DataListener = function(iStream, oStream) { +Zotero.Integration.DataListener = function(iStream, oStream) { this.header = ""; this.headerFinished = false; @@ -188,12 +188,12 @@ Scholar.Integration.DataListener = function(iStream, oStream) { * called when a request begins (although the request should have begun before * the DataListener was generated) */ -Scholar.Integration.DataListener.prototype.onStartRequest = function(request, context) {} +Zotero.Integration.DataListener.prototype.onStartRequest = function(request, context) {} /* * called when a request stops */ -Scholar.Integration.DataListener.prototype.onStopRequest = function(request, context, status) { +Zotero.Integration.DataListener.prototype.onStopRequest = function(request, context, status) { this.iStream.close(); this.oStream.close(); } @@ -201,7 +201,7 @@ Scholar.Integration.DataListener.prototype.onStopRequest = function(request, con /* * called when new data is available */ -Scholar.Integration.DataListener.prototype.onDataAvailable = function(request, context, +Zotero.Integration.DataListener.prototype.onDataAvailable = function(request, context, inputStream, offset, count) { var readData = this.sStream.read(count); @@ -251,9 +251,9 @@ Scholar.Integration.DataListener.prototype.onDataAvailable = function(request, c /* * processes an HTTP header and decides what to do */ -Scholar.Integration.DataListener.prototype._headerFinished = function() { +Zotero.Integration.DataListener.prototype._headerFinished = function() { this.headerFinished = true; - var output = Scholar.Integration.handleHeader(this.header); + var output = Zotero.Integration.handleHeader(this.header); if(typeof(output) == "number") { this.bodyLength = output; @@ -268,7 +268,7 @@ Scholar.Integration.DataListener.prototype._headerFinished = function() { * checks to see if Content-Length bytes of body have been read and, if they * have, processes the body */ -Scholar.Integration.DataListener.prototype._bodyData = function() { +Zotero.Integration.DataListener.prototype._bodyData = function() { if(this.body.length >= this.bodyLength) { if(this.body.length > this.bodyLength) { // truncate @@ -277,7 +277,7 @@ Scholar.Integration.DataListener.prototype._bodyData = function() { // UTF-8 crashes AppleScript var encoding = (this.header.indexOf("\nUser-Agent: Mac OS X") !== -1 ? "macintosh" : "UTF-8"); - var output = Scholar.Integration.handleEnvelope(this.body, encoding); + var output = Zotero.Integration.handleEnvelope(this.body, encoding); this._requestFinished(output, encoding); } } @@ -285,7 +285,7 @@ Scholar.Integration.DataListener.prototype._bodyData = function() { /* * returns HTTP data from a request */ -Scholar.Integration.DataListener.prototype._requestFinished = function(response, encoding) { +Zotero.Integration.DataListener.prototype._requestFinished = function(response, encoding) { // close input stream this.iStream.close(); @@ -328,7 +328,7 @@ Scholar.Integration.DataListener.prototype._requestFinished = function(response, this.oStream.close(); } -Scholar.Integration.SOAP = new function() { +Zotero.Integration.SOAP = new function() { this.init = init; this.update = update; this.restoreSession = restoreSession; @@ -358,7 +358,7 @@ Scholar.Integration.SOAP = new function() { var citationMode = vars[2]; var regenerateAll = (citationMode == "all"); - var citationSet = new Scholar.Integration.CitationSet(session.style); + var citationSet = new Zotero.Integration.CitationSet(session.style); var updatedCitations = new Object(); var citation, update; @@ -366,10 +366,10 @@ Scholar.Integration.SOAP = new function() { if(vars[i+1] == "X") { // get a new citation for a field with an X var io = new Object(); - window.openDialog('chrome://scholar/content/addCitationDialog.xul','', + window.openDialog('chrome://zotero/content/addCitationDialog.xul','', 'chrome,popup,modal', io, true); - citation = new Scholar.Integration.Citation(vars[i], "!"); + citation = new Zotero.Integration.Citation(vars[i], "!"); updatedCitations[citation.index] = true; if(io.items) { // cancel was not pressed @@ -382,7 +382,7 @@ Scholar.Integration.SOAP = new function() { } } else { // load an existing citation - citation = new Scholar.Integration.Citation(vars[i], vars[i+1]); + citation = new Zotero.Integration.Citation(vars[i], vars[i+1]); } var isDuplicate = citationSet.addCitation(citation); @@ -428,7 +428,7 @@ Scholar.Integration.SOAP = new function() { var itemsChanged = session.citationFactory.updateItems(citationSet, session, updatedCitations); if(itemsChanged || bibliographyMode == "true") { - Scholar.debug("Integration: Regenerating bibliography"); + Zotero.debug("Integration: Regenerating bibliography"); // EBNF: bibliography-data if(bibliographyMode != "false") { output.push(session.style.createBibliography(session.citationFactory.items, "Integration")); @@ -477,15 +477,15 @@ Scholar.Integration.SOAP = new function() { * RETURNS: sessionID */ function restoreSession(vars) { - var sessionID = Scholar.randomString(); - var session = _sessions[sessionID] = new Scholar.Integration.Session(vars[0]); + var sessionID = Zotero.randomString(); + var session = _sessions[sessionID] = new Zotero.Integration.Session(vars[0]); var encounteredItem = new Object(); var newField = new Object(); var regenerate = new Object(); for(var i=1; i<vars.length; i+=2) { - var citation = new Scholar.Integration.Citation(vars[i], vars[i+1]); + var citation = new Zotero.Integration.Citation(vars[i], vars[i+1]); session.citationSet.addCitation(citation); // add to see when refresh is necessary } @@ -509,8 +509,8 @@ Scholar.Integration.SOAP = new function() { if(!vars || !vars[0] || vars[0] == "!") { // no session ID; generate a new one - var sessionID = Scholar.randomString(); - var session = _sessions[sessionID] = new Scholar.Integration.Session(); + var sessionID = Zotero.randomString(); + var session = _sessions[sessionID] = new Zotero.Integration.Session(); } else { // session ID exists var sessionID = vars[0]; @@ -522,7 +522,7 @@ Scholar.Integration.SOAP = new function() { io.style = originalStyle; } - window.openDialog('chrome://scholar/content/integrationDocPrefs.xul','', + window.openDialog('chrome://zotero/content/integrationDocPrefs.xul','', 'chrome,popup,modal',io); session.setStyle(io.style); @@ -530,26 +530,26 @@ Scholar.Integration.SOAP = new function() { } } -Scholar.Integration.Session = function(styleID) { +Zotero.Integration.Session = function(styleID) { if(styleID) { this.styleID = styleID; - this.style = Scholar.Cite.getStyle(this.styleID); + this.style = Zotero.Cite.getStyle(this.styleID); } - this.citationSet = new Scholar.Integration.CitationSet(this.style); - this.citationFactory = new Scholar.Integration.CitationFactory(this.style); + this.citationSet = new Zotero.Integration.CitationSet(this.style); + this.citationFactory = new Zotero.Integration.CitationFactory(this.style); } -Scholar.Integration.Session.prototype.setStyle = function(styleID) { +Zotero.Integration.Session.prototype.setStyle = function(styleID) { this.styleID = styleID; - this.citationSet.style = this.citationFactory.style = this.style = Scholar.Cite.getStyle(styleID); + this.citationSet.style = this.citationFactory.style = this.style = Zotero.Cite.getStyle(styleID); this.citationFactory.clearCache(); } /* * a class to keep track of citation objects in a document */ -Scholar.Integration.Citation = function(index, field) { +Zotero.Integration.Citation = function(index, field) { this.index = index; this.field = field; if(field != "!") { @@ -571,14 +571,14 @@ Scholar.Integration.Citation = function(index, field) { /* * generates a new field name based on available information */ -Scholar.Integration.Citation.prototype.regenerateFieldName = function() { - this.field = this.itemIDString+"_"+this.locatorString+"_"+Scholar.randomString(); +Zotero.Integration.Citation.prototype.regenerateFieldName = function() { + this.field = this.itemIDString+"_"+this.locatorString+"_"+Zotero.randomString(); } /* * updates itemIDString and locatorString based on data */ -Scholar.Integration.Citation.prototype.setData = function(itemIDs, locators, locatorTypes) { +Zotero.Integration.Citation.prototype.setData = function(itemIDs, locators, locatorTypes) { this.itemIDs = itemIDs; this.itemIDString = itemIDs.join("|"); @@ -596,7 +596,7 @@ Scholar.Integration.Citation.prototype.setData = function(itemIDs, locators, loc /* * loads locators from locatorString, if not already loaded */ -Scholar.Integration.Citation.prototype.loadLocators = function() { +Zotero.Integration.Citation.prototype.loadLocators = function() { if(this.locators) return; this.locators = new Array(); @@ -610,10 +610,10 @@ Scholar.Integration.Citation.prototype.loadLocators = function() { } /* - * a class to complement Scholar.Integration.Citation, to keep track of the + * a class to complement Zotero.Integration.Citation, to keep track of the * order of citations */ -Scholar.Integration.CitationSet = function(style) { +Zotero.Integration.CitationSet = function(style) { this.citationsByID = new Object(); this.citationsByField = new Object(); this.citationsByIndex = new Object(); @@ -626,7 +626,7 @@ Scholar.Integration.CitationSet = function(style) { * adds a citation. returns true if this citation duplicates another that has * already been added. */ -Scholar.Integration.CitationSet.prototype.addCitation = function(citation) { +Zotero.Integration.CitationSet.prototype.addCitation = function(citation) { var isDuplicate = false; var itemID; @@ -671,14 +671,14 @@ Scholar.Integration.CitationSet.prototype.addCitation = function(citation) { /* * a class to generate and cache citations */ -Scholar.Integration.CitationFactory = function(style) { +Zotero.Integration.CitationFactory = function(style) { if(style) this.style = style; this.cache = new Object(); this.dateModified = new Object(); this.items = new Array(); } -Scholar.Integration.CitationFactory.prototype.updateItems = function(citationSet, session, updateCitations) { +Zotero.Integration.CitationFactory.prototype.updateItems = function(citationSet, session, updateCitations) { if(session) { // check to see if an update is really necessary var regenerateItemList = false; @@ -715,7 +715,7 @@ Scholar.Integration.CitationFactory.prototype.updateItems = function(citationSet var disambiguation = new Array(); for(var i in citationSet.citationsByID) { - var item = Scholar.Items.get(i); + var item = Zotero.Items.get(i); this.items.push(item); if(this.dateModified[i] && this.dateModified[i] != item.getField("dateModified")) { @@ -729,7 +729,7 @@ Scholar.Integration.CitationFactory.prototype.updateItems = function(citationSet } } - Scholar.debug(disambiguation); + Zotero.debug(disambiguation); this.style.preprocessItems(this.items); var tempCache = new Object(); @@ -764,7 +764,7 @@ Scholar.Integration.CitationFactory.prototype.updateItems = function(citationSet return true; } -Scholar.Integration.CitationFactory.prototype.getCitation = function(citation, usingCache) { +Zotero.Integration.CitationFactory.prototype.getCitation = function(citation, usingCache) { if(!usingCache) usingCache = this.cache; if(usingCache[citation.serializedType] && usingCache[citation.serializedType][citation.serialization]) { @@ -782,7 +782,7 @@ Scholar.Integration.CitationFactory.prototype.getCitation = function(citation, u return citationText; } -Scholar.Integration.CitationFactory.prototype.clearCache = function() { +Zotero.Integration.CitationFactory.prototype.clearCache = function() { this.cache = new Object(); this.dateModified = new Object(); } \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/xpcom/itemTreeView.js b/chrome/chromeFiles/content/scholar/xpcom/itemTreeView.js @@ -15,7 +15,7 @@ /* * Constructor the the ItemTreeView object */ -Scholar.ItemTreeView = function(itemGroup, sourcesOnly) +Zotero.ItemTreeView = function(itemGroup, sourcesOnly) { this._itemGroup = itemGroup; this._sourcesOnly = sourcesOnly; @@ -23,13 +23,13 @@ Scholar.ItemTreeView = function(itemGroup, sourcesOnly) this._treebox = null; this.refresh(); - this._unregisterID = Scholar.Notifier.registerItemTree(this); + this._unregisterID = Zotero.Notifier.registerItemTree(this); } /* * Called by the tree itself */ -Scholar.ItemTreeView.prototype.setTree = function(treebox) +Zotero.ItemTreeView.prototype.setTree = function(treebox) { if(this._treebox) return; @@ -49,7 +49,7 @@ Scholar.ItemTreeView.prototype.setTree = function(treebox) * Reload the rows from the data access methods * (doesn't call the tree.invalidate methods, etc.) */ -Scholar.ItemTreeView.prototype.refresh = function() +Zotero.ItemTreeView.prototype.refresh = function() { this._dataItems = new Array(); this.rowCount = 0; @@ -62,7 +62,7 @@ Scholar.ItemTreeView.prototype.refresh = function() if(newRows[i] && (!this._sourcesOnly || (!newRows[i].isAttachment() && !newRows[i].isNote()))) { - this._showItem(new Scholar.ItemTreeView.TreeRow(newRows[i],0,false), i+1); //item ref, before row + this._showItem(new Zotero.ItemTreeView.TreeRow(newRows[i],0,false), i+1); //item ref, before row } } } @@ -71,15 +71,15 @@ Scholar.ItemTreeView.prototype.refresh = function() } /* - * Called by Scholar.Notifier on any changes to items in the data layer + * Called by Zotero.Notifier on any changes to items in the data layer */ -Scholar.ItemTreeView.prototype.notify = function(action, type, ids) +Zotero.ItemTreeView.prototype.notify = function(action, type, ids) { var madeChanges = false; this.selection.selectEventsSuppressed = true; var savedSelection = this.saveSelection(); - ids = Scholar.flattenArguments(ids); + ids = Zotero.flattenArguments(ids); // See if we're in the active window var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] @@ -140,7 +140,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) else if (!this.isContainer(row) && this.getParentIndex(row)==-1 && this._getItemAtRow(row).ref.getSource()) { - Scholar.debug('row is here2'); + Zotero.debug('row is here2'); this._hideItem(row); this._treebox.rowCountChanged(row+1, -1) } @@ -148,13 +148,13 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) else if (!this.isContainer(row) && this.getParentIndex(row)!=-1 && !this._getItemAtRow(row).ref.getSource()) { - var item = Scholar.Items.get(ids[i]); - this._showItem(new Scholar.ItemTreeView.TreeRow(item, 0, false), this.rowCount); + var item = Zotero.Items.get(ids[i]); + this._showItem(new Zotero.ItemTreeView.TreeRow(item, 0, false), this.rowCount); this._treebox.rowCountChanged(this.rowCount-1, 1); } else { - Scholar.debug('row is here3'); + Zotero.debug('row is here3'); this._treebox.invalidateRow(row); } madeChanges = true; @@ -163,12 +163,12 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) //else if(this._itemGroup.isLibrary() || this._itemGroup.ref.hasItem(ids[i])) else { - var item = Scholar.Items.get(ids[i]); + var item = Zotero.Items.get(ids[i]); if(item.isRegularItem() || !item.getSource()) { //most likely, the note or attachment's parent was removed. - this._showItem(new Scholar.ItemTreeView.TreeRow(item,0,false),this.rowCount); + this._showItem(new Zotero.ItemTreeView.TreeRow(item,0,false),this.rowCount); this._treebox.rowCountChanged(this.rowCount-1,1); madeChanges = true; } @@ -188,7 +188,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) // If no quicksearch, process new items manually if (quicksearch.value == '') { - var items = Scholar.Items.get(ids); + var items = Zotero.Items.get(ids); for (var i in items) { @@ -199,7 +199,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) // Regular item or standalone note/attachment && (items[i].isRegularItem() || !items[i].getSource())) { - this._showItem(new Scholar.ItemTreeView.TreeRow(items[i],0,false),this.rowCount); + this._showItem(new Zotero.ItemTreeView.TreeRow(items[i],0,false),this.rowCount); this._treebox.rowCountChanged(this.rowCount-1,1); madeChanges = true; @@ -237,7 +237,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) { // Reset to Info tab this._treebox.treeBody.ownerDocument. - getElementById('scholar-view-tabs').selectedIndex = 0; + getElementById('zotero-view-tabs').selectedIndex = 0; this.selectItem(ids[0]); } @@ -250,11 +250,11 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) } /* - * Unregisters view from Scholar.Notifier (called on window close) + * Unregisters view from Zotero.Notifier (called on window close) */ -Scholar.ItemTreeView.prototype.unregister = function() +Zotero.ItemTreeView.prototype.unregister = function() { - Scholar.Notifier.unregisterItemTree(this._unregisterID); + Zotero.Notifier.unregisterItemTree(this._unregisterID); } //////////////////////////////////////////////////////////////////////////////// @@ -264,7 +264,7 @@ Scholar.ItemTreeView.prototype.unregister = function() /// //////////////////////////////////////////////////////////////////////////////// -Scholar.ItemTreeView.prototype.getCellText = function(row, column) +Zotero.ItemTreeView.prototype.getCellText = function(row, column) { var obj = this._getItemAtRow(row); var val; @@ -277,7 +277,7 @@ Scholar.ItemTreeView.prototype.getCellText = function(row, column) } else if(column.id == "typeIcon") { - val = Scholar.getString('itemTypes.'+Scholar.ItemTypes.getName(obj.getType())); + val = Zotero.getString('itemTypes.'+Zotero.ItemTypes.getName(obj.getType())); } else { @@ -292,48 +292,48 @@ Scholar.ItemTreeView.prototype.getCellText = function(row, column) return val; } -Scholar.ItemTreeView.prototype.getImageSrc = function(row, col) +Zotero.ItemTreeView.prototype.getImageSrc = function(row, col) { if(col.id == 'title') { var item = this._getItemAtRow(row); - var itemType = Scholar.ItemTypes.getName(item.getType()); + var itemType = Zotero.ItemTypes.getName(item.getType()); if(itemType == 'attachment') { var linkMode = item.ref.getAttachmentLinkMode(); - if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_FILE) + if(linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) { itemType = itemType + "-file"; } - else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_FILE) + else if(linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) { itemType = itemType + "-link"; } - else if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL) + else if(linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL) { itemType = itemType + "-snapshot"; } - else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_URL) + else if(linkMode == Zotero.Attachments.LINK_MODE_LINKED_URL) { itemType = itemType + "-web-link"; } } - return "chrome://scholar/skin/treeitem-"+itemType+".png"; + return "chrome://zotero/skin/treeitem-"+itemType+".png"; } } -Scholar.ItemTreeView.prototype.isContainer = function(row) +Zotero.ItemTreeView.prototype.isContainer = function(row) { return this._getItemAtRow(row).isRegularItem(); } -Scholar.ItemTreeView.prototype.isContainerOpen = function(row) +Zotero.ItemTreeView.prototype.isContainerOpen = function(row) { return this._dataItems[row].isOpen; } -Scholar.ItemTreeView.prototype.isContainerEmpty = function(row) +Zotero.ItemTreeView.prototype.isContainerEmpty = function(row) { if(this._sourcesOnly) { return true; @@ -342,13 +342,13 @@ Scholar.ItemTreeView.prototype.isContainerEmpty = function(row) } } -Scholar.ItemTreeView.prototype.getLevel = function(row) +Zotero.ItemTreeView.prototype.getLevel = function(row) { return this._getItemAtRow(row).level; } // Gets the index of the row's container, or -1 if none (container itself or top-level) -Scholar.ItemTreeView.prototype.getParentIndex = function(row) +Zotero.ItemTreeView.prototype.getParentIndex = function(row) { if (row==-1) { @@ -362,7 +362,7 @@ Scholar.ItemTreeView.prototype.getParentIndex = function(row) return -1; } -Scholar.ItemTreeView.prototype.hasNextSibling = function(row,afterIndex) +Zotero.ItemTreeView.prototype.hasNextSibling = function(row,afterIndex) { var thisLevel = this.getLevel(row); for(var i = afterIndex + 1; i < this.rowCount; i++) @@ -373,7 +373,7 @@ Scholar.ItemTreeView.prototype.hasNextSibling = function(row,afterIndex) } } -Scholar.ItemTreeView.prototype.toggleOpenState = function(row) +Zotero.ItemTreeView.prototype.toggleOpenState = function(row) { var count = 0; //used to tell the tree how many rows were added/removed var thisLevel = this.getLevel(row); @@ -401,12 +401,12 @@ Scholar.ItemTreeView.prototype.toggleOpenState = function(row) else if(notes) newRows = notes; - newRows = Scholar.Items.get(newRows); + newRows = Zotero.Items.get(newRows); for(var i = 0; i < newRows.length; i++) { count++; - this._showItem(new Scholar.ItemTreeView.TreeRow(newRows[i],thisLevel+1,false), row+i+1); //item ref, before row + this._showItem(new Zotero.ItemTreeView.TreeRow(newRows[i],thisLevel+1,false), row+i+1); //item ref, before row } } @@ -419,7 +419,7 @@ Scholar.ItemTreeView.prototype.toggleOpenState = function(row) this._refreshHashMap(); } -Scholar.ItemTreeView.prototype.isSorted = function() +Zotero.ItemTreeView.prototype.isSorted = function() { for(var i=0, len=this._treebox.columns.count; i<len; i++) if(this._treebox.columns.getColumnAt(i).element.getAttribute('sortActive')) @@ -427,7 +427,7 @@ Scholar.ItemTreeView.prototype.isSorted = function() return false; } -Scholar.ItemTreeView.prototype.cycleHeader = function(column) +Zotero.ItemTreeView.prototype.cycleHeader = function(column) { for(var i=0, len=this._treebox.columns.count; i<len; i++) { @@ -456,7 +456,7 @@ Scholar.ItemTreeView.prototype.cycleHeader = function(column) * Sort the items by the currently sorted column. * Simply uses Array.sort() function, and refreshes the hash map. */ -Scholar.ItemTreeView.prototype.sort = function() +Zotero.ItemTreeView.prototype.sort = function() { var column = this._treebox.columns.getSortedColumn() var order = column.element.getAttribute('sortDirection') == 'descending'; @@ -465,8 +465,8 @@ Scholar.ItemTreeView.prototype.sort = function() { function columnSort(a,b) { - var typeA = Scholar.getString('itemTypes.'+Scholar.ItemTypes.getName(a.getType())); - var typeB = Scholar.getString('itemTypes.'+Scholar.ItemTypes.getName(b.getType())); + var typeA = Zotero.getString('itemTypes.'+Zotero.ItemTypes.getName(a.getType())); + var typeB = Zotero.getString('itemTypes.'+Zotero.ItemTypes.getName(b.getType())); return (typeA > typeB) ? -1 : (typeA < typeB) ? 1 : 0; } @@ -545,12 +545,12 @@ Scholar.ItemTreeView.prototype.sort = function() /* * Select an item */ -Scholar.ItemTreeView.prototype.selectItem = function(id) +Zotero.ItemTreeView.prototype.selectItem = function(id) { var row = this._itemRowMap[id]; if(row == null) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); this.toggleOpenState(this._itemRowMap[item.getSource()]); //opens the parent of the item row = this._itemRowMap[id]; } @@ -564,7 +564,7 @@ Scholar.ItemTreeView.prototype.selectItem = function(id) * * _force_ deletes item from DB even if removing from a collection */ -Scholar.ItemTreeView.prototype.deleteSelection = function(eraseChildren, force) +Zotero.ItemTreeView.prototype.deleteSelection = function(eraseChildren, force) { if(this.selection.count == 0) return; @@ -601,7 +601,7 @@ Scholar.ItemTreeView.prototype.deleteSelection = function(eraseChildren, force) /* * Set the search filter on the view */ -Scholar.ItemTreeView.prototype.searchText = function(search) +Zotero.ItemTreeView.prototype.searchText = function(search) { this.selection.selectEventsSuppressed = true; var savedSelection = this.saveSelection(); @@ -624,7 +624,7 @@ Scholar.ItemTreeView.prototype.searchText = function(search) * item: reference to the Item * beforeRow: row index to insert new row before */ -Scholar.ItemTreeView.prototype._showItem = function(item, beforeRow) +Zotero.ItemTreeView.prototype._showItem = function(item, beforeRow) { this._dataItems.splice(beforeRow, 0, item); this.rowCount++; @@ -633,16 +633,16 @@ Scholar.ItemTreeView.prototype._showItem = function(item, beforeRow) /* * Called by view to hide specified row */ -Scholar.ItemTreeView.prototype._hideItem = function(row) +Zotero.ItemTreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; } /* - * Returns a reference to the item at row (see Scholar.Item in data_access.js) + * Returns a reference to the item at row (see Zotero.Item in data_access.js) */ -Scholar.ItemTreeView.prototype._getItemAtRow = function(row) +Zotero.ItemTreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row]; } @@ -650,7 +650,7 @@ Scholar.ItemTreeView.prototype._getItemAtRow = function(row) /* * Create hash map of item ids to row indexes */ -Scholar.ItemTreeView.prototype._refreshHashMap = function() +Zotero.ItemTreeView.prototype._refreshHashMap = function() { this._itemRowMap = new Array(); for(var i=0; i < this.rowCount; i++) @@ -663,7 +663,7 @@ Scholar.ItemTreeView.prototype._refreshHashMap = function() /* * Saves the ids of currently selected items for later */ -Scholar.ItemTreeView.prototype.saveSelection = function() +Zotero.ItemTreeView.prototype.saveSelection = function() { var savedSelection = new Array(); @@ -683,7 +683,7 @@ Scholar.ItemTreeView.prototype.saveSelection = function() /* * Sets the selection based on saved selection ids (see above) */ -Scholar.ItemTreeView.prototype.rememberSelection = function(selection) +Zotero.ItemTreeView.prototype.rememberSelection = function(selection) { this.selection.clearSelection(); for(var i=0; i < selection.length; i++) @@ -700,28 +700,28 @@ Scholar.ItemTreeView.prototype.rememberSelection = function(selection) /// //////////////////////////////////////////////////////////////////////////////// -Scholar.ItemTreeCommandController = function(tree) +Zotero.ItemTreeCommandController = function(tree) { this.tree = tree; } -Scholar.ItemTreeCommandController.prototype.supportsCommand = function(cmd) +Zotero.ItemTreeCommandController.prototype.supportsCommand = function(cmd) { return (cmd == 'cmd_selectAll'); } -Scholar.ItemTreeCommandController.prototype.isCommandEnabled = function(cmd) +Zotero.ItemTreeCommandController.prototype.isCommandEnabled = function(cmd) { return (cmd == 'cmd_selectAll'); } -Scholar.ItemTreeCommandController.prototype.doCommand = function(cmd) +Zotero.ItemTreeCommandController.prototype.doCommand = function(cmd) { if(cmd == 'cmd_selectAll') this.tree.view.selection.selectAll(); } -Scholar.ItemTreeCommandController.prototype.onEvent = function(evt) +Zotero.ItemTreeCommandController.prototype.onEvent = function(evt) { } @@ -736,24 +736,24 @@ Scholar.ItemTreeCommandController.prototype.onEvent = function(evt) /* * Begin a drag */ -Scholar.ItemTreeView.prototype.onDragStart = function (evt,transferData,action) +Zotero.ItemTreeView.prototype.onDragStart = function (evt,transferData,action) { transferData.data=new TransferData(); - transferData.data.addDataForFlavour("scholar/item", this.saveSelection()); + transferData.data.addDataForFlavour("zotero/item", this.saveSelection()); } /* * Called by nsDragAndDrop.js for any sort of drop on the tree */ -Scholar.ItemTreeView.prototype.getSupportedFlavours = function () +Zotero.ItemTreeView.prototype.getSupportedFlavours = function () { var flavors = new FlavourSet(); - flavors.appendFlavour("scholar/item"); + flavors.appendFlavour("zotero/item"); flavors.appendFlavour("text/x-moz-url"); return flavors; } -Scholar.ItemTreeView.prototype.canDrop = function(row, orient) +Zotero.ItemTreeView.prototype.canDrop = function(row, orient) { try { @@ -790,7 +790,7 @@ Scholar.ItemTreeView.prototype.canDrop = function(row, orient) // already exist in target for each(var id in ids) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); // Skip non-top-level items if (!item.isRegularItem() && item.getSource()) @@ -810,20 +810,20 @@ Scholar.ItemTreeView.prototype.canDrop = function(row, orient) return false; } - //Scholar.debug('row is ' + row); - //Scholar.debug('orient is ' + orient); + //Zotero.debug('row is ' + row); + //Zotero.debug('orient is ' + orient); // Highlight the rows correctly on drag var rowItem = this._getItemAtRow(row).ref; //the item we are dragging over - if (dataType == 'scholar/item') + if (dataType == 'zotero/item') { // Directly on a row if (orient == 0) { for each(var id in ids) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); // Only allow dragging of notes and attachments // that aren't already children of the item if (!item.isRegularItem() && item.getSource()!=rowItem.getID()) @@ -839,7 +839,7 @@ Scholar.ItemTreeView.prototype.canDrop = function(row, orient) for each(var id in ids) { // Don't allow drag if any top-level items - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); if (item.isRegularItem() || !item.getSource()) { return false; @@ -863,7 +863,7 @@ Scholar.ItemTreeView.prototype.canDrop = function(row, orient) /* * Called when something's been dropped on or next to a row */ -Scholar.ItemTreeView.prototype.drop = function(row, orient) +Zotero.ItemTreeView.prototype.drop = function(row, orient) { try { @@ -883,7 +883,7 @@ Scholar.ItemTreeView.prototype.drop = function(row, orient) var data = dataSet.first.first; var dataType = data.flavour.contentType; - if (dataType == 'scholar/item' && this.canDrop(row, orient)) + if (dataType == 'zotero/item' && this.canDrop(row, orient)) { var ids = data.data.split(','); // ids of rows we are dragging in @@ -895,7 +895,7 @@ Scholar.ItemTreeView.prototype.drop = function(row, orient) rowItem = this._getItemAtRow(row).ref; // the item we are dragging over for each(var id in ids) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); item.setSource(rowItem.getID()); } } @@ -908,7 +908,7 @@ Scholar.ItemTreeView.prototype.drop = function(row, orient) { for each(var id in ids) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); if (!item.isRegularItem()) { item.setSource(); @@ -920,7 +920,7 @@ Scholar.ItemTreeView.prototype.drop = function(row, orient) { for each(var id in ids) { - var item = Scholar.Items.get(id); + var item = Zotero.Items.get(id); var source = item.isRegularItem() ? false : item.getSource(); // Top-level item @@ -943,7 +943,7 @@ Scholar.ItemTreeView.prototype.drop = function(row, orient) var url = data.data.split("\n")[0]; /* WAITING FOR INGESTER SUPPORT - var newItem = Scholar.Ingester.scrapeURL(url); + var newItem = Zotero.Ingester.scrapeURL(url); if(newItem) this._getItemAtRow(row).ref.addItem(newItem.getID()); @@ -954,9 +954,9 @@ Scholar.ItemTreeView.prototype.drop = function(row, orient) /* * Called by nsDragAndDrop.js for any sort of drop on the tree */ -Scholar.ItemTreeView.prototype.onDrop = function (evt,dropdata,session){ } +Zotero.ItemTreeView.prototype.onDrop = function (evt,dropdata,session){ } -Scholar.ItemTreeView.prototype.onDragOver = function (evt,dropdata,session) { } +Zotero.ItemTreeView.prototype.onDragOver = function (evt,dropdata,session) { } //////////////////////////////////////////////////////////////////////////////// /// @@ -964,44 +964,44 @@ Scholar.ItemTreeView.prototype.onDragOver = function (evt,dropdata,session) { } /// //////////////////////////////////////////////////////////////////////////////// -Scholar.ItemTreeView.prototype.isSeparator = function(row) { return false; } -Scholar.ItemTreeView.prototype.getRowProperties = function(row, prop) { } -Scholar.ItemTreeView.prototype.getColumnProperties = function(col, prop) { } -Scholar.ItemTreeView.prototype.getCellProperties = function(row, col, prop) { } +Zotero.ItemTreeView.prototype.isSeparator = function(row) { return false; } +Zotero.ItemTreeView.prototype.getRowProperties = function(row, prop) { } +Zotero.ItemTreeView.prototype.getColumnProperties = function(col, prop) { } +Zotero.ItemTreeView.prototype.getCellProperties = function(row, col, prop) { } -Scholar.ItemTreeView.TreeRow = function(ref, level, isOpen) +Zotero.ItemTreeView.TreeRow = function(ref, level, isOpen) { this.ref = ref; //the item associated with this this.level = level; this.isOpen = isOpen; } -Scholar.ItemTreeView.TreeRow.prototype.isNote = function() +Zotero.ItemTreeView.TreeRow.prototype.isNote = function() { return this.ref.isNote(); } -Scholar.ItemTreeView.TreeRow.prototype.isAttachment = function() +Zotero.ItemTreeView.TreeRow.prototype.isAttachment = function() { return this.ref.isAttachment(); } -Scholar.ItemTreeView.TreeRow.prototype.isRegularItem = function() +Zotero.ItemTreeView.TreeRow.prototype.isRegularItem = function() { return this.ref.isRegularItem(); } -Scholar.ItemTreeView.TreeRow.prototype.getField = function(field) +Zotero.ItemTreeView.TreeRow.prototype.getField = function(field) { return this.ref.getField(field); } -Scholar.ItemTreeView.TreeRow.prototype.getType = function() +Zotero.ItemTreeView.TreeRow.prototype.getType = function() { return this.ref.getType(); } -Scholar.ItemTreeView.TreeRow.prototype.numChildren = function() +Zotero.ItemTreeView.TreeRow.prototype.numChildren = function() { if(this.isRegularItem()) return this.ref.numChildren(); @@ -1009,7 +1009,7 @@ Scholar.ItemTreeView.TreeRow.prototype.numChildren = function() return 0; } -Scholar.ItemTreeView.TreeRow.prototype.numNotes = function() +Zotero.ItemTreeView.TreeRow.prototype.numNotes = function() { if(this.isRegularItem()) return this.ref.numNotes(); @@ -1017,7 +1017,7 @@ Scholar.ItemTreeView.TreeRow.prototype.numNotes = function() return 0; } -Scholar.ItemTreeView.TreeRow.prototype.numAttachments = function() +Zotero.ItemTreeView.TreeRow.prototype.numAttachments = function() { if(this.isRegularItem()) return this.ref.numAttachments(); diff --git a/chrome/chromeFiles/content/scholar/xpcom/mime.js b/chrome/chromeFiles/content/scholar/xpcom/mime.js @@ -1,4 +1,4 @@ -Scholar.MIME = new function(){ +Zotero.MIME = new function(){ this.isExternalTextExtension = isExternalTextExtension; this.sniffForMIMEType = sniffForMIMEType; this.sniffForBinary = sniffForBinary; @@ -81,19 +81,19 @@ Scholar.MIME = new function(){ function getMIMETypeFromData(str, ext){ var mimeType = this.sniffForMIMEType(str); if (mimeType){ - Scholar.debug('Detected MIME type ' + mimeType); + Zotero.debug('Detected MIME type ' + mimeType); return mimeType; } try { var mimeType = Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"] .getService(Components.interfaces.nsIMIMEService).getTypeFromExtension(ext); - Scholar.debug('Got MIME type ' + mimeType + ' from extension'); + Zotero.debug('Got MIME type ' + mimeType + ' from extension'); return mimeType; } catch (e){ var mimeType = this.sniffForBinary(str); - Scholar.debug('Cannot determine MIME type -- settling for ' + mimeType); + Zotero.debug('Cannot determine MIME type -- settling for ' + mimeType); return mimeType; } } @@ -104,8 +104,8 @@ Scholar.MIME = new function(){ * techniques */ function getMIMETypeFromFile(file){ - var str = Scholar.File.getSample(file); - var ext = Scholar.File.getExtension(file); + var str = Zotero.File.getSample(file); + var ext = Zotero.File.getExtension(file); return this.getMIMETypeFromData(str, ext); } @@ -127,14 +127,14 @@ Scholar.MIME = new function(){ function hasInternalHandler(mimeType, ext){ if (mimeType=='text/plain'){ if (this.isExternalTextExtension(ext)){ - Scholar.debug('text/plain file has extension that should be handled externally'); + Zotero.debug('text/plain file has extension that should be handled externally'); return false; } return true; } if (_nativeMIMETypes[mimeType]){ - Scholar.debug('MIME type ' + mimeType + ' can be handled natively'); + Zotero.debug('MIME type ' + mimeType + ' can be handled natively'); return true; } @@ -145,19 +145,19 @@ Scholar.MIME = new function(){ for (var i in types){ if (types[i].type==mimeType){ - Scholar.debug('MIME type ' + mimeType + ' can be handled by plugins'); + Zotero.debug('MIME type ' + mimeType + ' can be handled by plugins'); return true; } } - Scholar.debug('MIME type ' + mimeType + ' cannot be handled natively'); + Zotero.debug('MIME type ' + mimeType + ' cannot be handled natively'); return false; } function fileHasInternalHandler(file){ var mimeType = this.getMIMETypeFromFile(file); - var ext = Scholar.File.getExtension(file); + var ext = Zotero.File.getExtension(file); return this.hasInternalHandler(mimeType, ext); } diff --git a/chrome/chromeFiles/content/scholar/xpcom/notifier.js b/chrome/chromeFiles/content/scholar/xpcom/notifier.js @@ -1,8 +1,8 @@ -Scholar.Notifier = new function(){ +Zotero.Notifier = new function(){ var _observers = new Array(); var _disabled = false; - _observers['columnTree'] = new Scholar.Hash(); - _observers['itemTree'] = new Scholar.Hash(); + _observers['columnTree'] = new Zotero.Hash(); + _observers['itemTree'] = new Zotero.Hash(); this.registerColumnTree = registerColumnTree; this.registerItemTree = registerItemTree; @@ -51,13 +51,13 @@ Scholar.Notifier = new function(){ throw('Invalid type ' + type + ' in Notifier.trigger()'); } - Scholar.debug("Notifier.trigger('" + event + "', '" + type + "', " + Zotero.debug("Notifier.trigger('" + event + "', '" + type + "', " + (typeof ids=='object' ? '[' + ids.join() + ']' : ids) + ") called " + "[column trees: " + _observers['columnTree'].length + ", item trees: " + _observers['itemTree'].length + "]"); for (i in _observers[treeType].items){ - Scholar.debug("Calling notify() on " + treeType + " with hash '" + Zotero.debug("Calling notify() on " + treeType + " with hash '" + i + "'", 4); _observers[treeType].get(i).notify(event, type, ids); } @@ -67,13 +67,13 @@ Scholar.Notifier = new function(){ function disable(){ - Scholar.debug('Disabling Notifier notifications'); + Zotero.debug('Disabling Notifier notifications'); _disabled = true; } function enable(){ - Scholar.debug('Enabling Notifier notifications'); + Zotero.debug('Enabling Notifier notifications'); _disabled = false; } @@ -93,18 +93,18 @@ Scholar.Notifier = new function(){ tries = 10; } - var hash = Scholar.randomString(len); + var hash = Zotero.randomString(len); tries--; } while (_observers[type].get(hash)); - Scholar.debug('Registering ' + type + " in notifier with hash '" + hash + "'", 4); + Zotero.debug('Registering ' + type + " in notifier with hash '" + hash + "'", 4); _observers[type].set(hash, ref); return hash; } function _unregister(type, hash){ - Scholar.debug("Unregistering " + type + " in notifier with hash '" + hash + "'", 4); + Zotero.debug("Unregistering " + type + " in notifier with hash '" + hash + "'", 4); _observers[type].remove(hash); } } diff --git a/chrome/chromeFiles/content/scholar/xpcom/progressWindow.js b/chrome/chromeFiles/content/scholar/xpcom/progressWindow.js @@ -3,7 +3,7 @@ * * Pass the active window into the constructor */ -Scholar.ProgressWindow = function(_window){ +Zotero.ProgressWindow = function(_window){ if (!_window){ var _window = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]. @@ -33,7 +33,7 @@ Scholar.ProgressWindow = function(_window){ if(_windowLoading || _windowLoaded) { // already loading or loaded return false; } - _progressWindow = _window.openDialog("chrome://scholar/chrome/progressWindow.xul", + _progressWindow = _window.openDialog("chrome://zotero/chrome/progressWindow.xul", "", "chrome,dialog=no,titlebar=no,popup=yes"); _progressWindow.addEventListener("load", _onWindowLoaded, false); _windowLoading = true; diff --git a/chrome/chromeFiles/content/scholar/xpcom/schema.js b/chrome/chromeFiles/content/scholar/xpcom/schema.js @@ -1,4 +1,4 @@ -Scholar.Schema = new function(){ +Zotero.Schema = new function(){ var _dbVersions = []; var _schemaVersions = []; var _repositoryTimer; @@ -15,7 +15,7 @@ Scholar.Schema = new function(){ // 'schema' check is for old (<= 1.0b1) schema system if (!dbVersion && !_getDBVersion('schema')){ - Scholar.debug('Database does not exist -- creating\n'); + Zotero.debug('Database does not exist -- creating\n'); _initializeSchema(); return; } @@ -27,7 +27,7 @@ Scholar.Schema = new function(){ var schemaVersion = _getSchemaSQLVersion('user'); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); try { _migrateUserSchema(dbVersion); @@ -35,14 +35,14 @@ Scholar.Schema = new function(){ _updateSchema('scrapers'); // Rebuild fulltext cache if necessary - if (Scholar.Fulltext.cacheIsOutdated()){ - Scholar.Fulltext.rebuildCache(); + if (Zotero.Fulltext.cacheIsOutdated()){ + Zotero.Fulltext.rebuildCache(); } - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } catch(e){ - Scholar.debug(e); - Scholar.DB.rollbackTransaction(); + Zotero.debug(e); + Zotero.DB.rollbackTransaction(); throw(e); } return; @@ -58,20 +58,20 @@ Scholar.Schema = new function(){ function updateScrapersRemote(force){ if (!force){ // Check user preference for automatic updates - if (!Scholar.Prefs.get('automaticScraperUpdates')){ - Scholar.debug('Automatic scraper updating disabled -- not checking repository', 4); + if (!Zotero.Prefs.get('automaticScraperUpdates')){ + Zotero.debug('Automatic scraper updating disabled -- not checking repository', 4); return false; } // Determine the earliest local time that we'd query the repository again var nextCheck = new Date(); nextCheck.setTime((parseInt(_getDBVersion('lastcheck')) - + SCHOLAR_CONFIG['REPOSITORY_CHECK_INTERVAL']) * 1000); // JS uses ms + + ZOTERO_CONFIG['REPOSITORY_CHECK_INTERVAL']) * 1000); // JS uses ms var now = new Date(); // If enough time hasn't passed, don't update if (now < nextCheck){ - Scholar.debug('Not enough time since last update -- not checking repository', 4); + Zotero.debug('Not enough time since last update -- not checking repository', 4); // Set the repository timer to the remaining time _setRepositoryTimer(Math.round((nextCheck.getTime() - now.getTime()) / 1000)); return false; @@ -79,8 +79,8 @@ Scholar.Schema = new function(){ } // If transaction already in progress, delay by a few seconds - if (Scholar.DB.transactionInProgress()){ - Scholar.debug('Transaction in progress -- delaying repository check', 4) + if (Zotero.DB.transactionInProgress()){ + Zotero.debug('Transaction in progress -- delaying repository check', 4) _setRepositoryTimer(30); return false; } @@ -88,24 +88,24 @@ Scholar.Schema = new function(){ // Get the last timestamp we got from the server var lastUpdated = _getDBVersion('repository'); - var url = SCHOLAR_CONFIG['REPOSITORY_URL'] + '/updated?' + var url = ZOTERO_CONFIG['REPOSITORY_URL'] + '/updated?' + (lastUpdated ? 'last=' + lastUpdated + '&' : '') - + 'version=' + Scholar.version; + + 'version=' + Zotero.version; - Scholar.debug('Checking repository for updates (' + url + ')'); - var get = Scholar.Utilities.HTTP.doGet(url, _updateScrapersRemoteCallback); + Zotero.debug('Checking repository for updates (' + url + ')'); + var get = Zotero.Utilities.HTTP.doGet(url, _updateScrapersRemoteCallback); // TODO: instead, add an observer to start and stop timer on online state change if (!get){ - Scholar.debug('Browser is offline -- skipping check'); - _setRepositoryTimer(SCHOLAR_CONFIG['REPOSITORY_RETRY_INTERVAL']); + Zotero.debug('Browser is offline -- skipping check'); + _setRepositoryTimer(ZOTERO_CONFIG['REPOSITORY_RETRY_INTERVAL']); } } function stopRepositoryTimer(){ if (_repositoryTimer){ - Scholar.debug('Stopping repository check timer'); + Zotero.debug('Stopping repository check timer'); _repositoryTimer.cancel(); } } @@ -131,8 +131,8 @@ Scholar.Schema = new function(){ return _dbVersions[schema]; } - if (Scholar.DB.tableExists('version')){ - var dbVersion = Scholar.DB.valueQuery("SELECT version FROM " + if (Zotero.DB.tableExists('version')){ + var dbVersion = Zotero.DB.valueQuery("SELECT version FROM " + "version WHERE schema='" + schema + "'"); _dbVersions[schema] = dbVersion; return dbVersion; @@ -157,8 +157,8 @@ Scholar.Schema = new function(){ var file = Components.classes["@mozilla.org/extensions/manager;1"] .getService(Components.interfaces.nsIExtensionManager) - .getInstallLocation(SCHOLAR_CONFIG['GUID']) - .getItemLocation(SCHOLAR_CONFIG['GUID']); + .getInstallLocation(ZOTERO_CONFIG['GUID']) + .getItemLocation(ZOTERO_CONFIG['GUID']); file.append(schemaFile); // Open an input stream from file @@ -195,8 +195,8 @@ Scholar.Schema = new function(){ // it when necessary var file = Components.classes["@mozilla.org/extensions/manager;1"] .getService(Components.interfaces.nsIExtensionManager) - .getInstallLocation(SCHOLAR_CONFIG['GUID']) - .getItemLocation(SCHOLAR_CONFIG['GUID']); + .getInstallLocation(ZOTERO_CONFIG['GUID']) + .getItemLocation(ZOTERO_CONFIG['GUID']); file.append(schemaFile); // Open an input stream from file @@ -241,8 +241,8 @@ Scholar.Schema = new function(){ // it when necessary var file = Components.classes["@mozilla.org/extensions/manager;1"] .getService(Components.interfaces.nsIExtensionManager) - .getInstallLocation(SCHOLAR_CONFIG['GUID']) - .getItemLocation(SCHOLAR_CONFIG['GUID']); + .getInstallLocation(ZOTERO_CONFIG['GUID']) + .getItemLocation(ZOTERO_CONFIG['GUID']); file.append(schemaFile); // Open an input stream from file @@ -275,31 +275,31 @@ Scholar.Schema = new function(){ * Create new DB schema */ function _initializeSchema(){ - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); try { - Scholar.DB.query(_getSchemaSQL('user')); + Zotero.DB.query(_getSchemaSQL('user')); _updateDBVersion('user', _getSchemaSQLVersion('user')); - Scholar.DB.query(_getSchemaSQL('system')); + Zotero.DB.query(_getSchemaSQL('system')); _updateDBVersion('system', _getSchemaSQLVersion('system')); - Scholar.DB.query(_getSchemaSQL('scrapers')); + Zotero.DB.query(_getSchemaSQL('scrapers')); _updateDBVersion('scrapers', _getSchemaSQLVersion('scrapers')); var sql = "INSERT INTO items VALUES(1233, 14, " + "'Zotero - Quick Start Guide', '2006-08-31 20:00:00', " + "'2006-08-31 20:00:00')"; - Scholar.DB.query(sql); + Zotero.DB.query(sql); var sql = "INSERT INTO itemAttachments VALUES(1233, NULL, 3, " + "'text/html', 25, " + "'http://www.zotero.org/docs/quick_start_guide.php', NULL)"; - Scholar.DB.query(sql); + Zotero.DB.query(sql); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } catch(e){ - Scholar.debug(e, 1); - Scholar.DB.rollbackTransaction(); + Zotero.debug(e, 1); + Zotero.DB.rollbackTransaction(); alert('Error initializing Zotero database'); // TODO: localize throw(e); } @@ -312,7 +312,7 @@ Scholar.Schema = new function(){ function _updateDBVersion(schema, version){ _dbVersions[schema] = version; var sql = "REPLACE INTO version (schema,version) VALUES (?,?)"; - return Scholar.DB.query(sql, [{'string':schema},{'int':version}]); + return Zotero.DB.query(sql, [{'string':schema},{'int':version}]); } @@ -324,15 +324,15 @@ Scholar.Schema = new function(){ return; } else if (dbVersion < schemaVersion){ - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); try { - Scholar.DB.query(_getSchemaSQL(schema)); + Zotero.DB.query(_getSchemaSQL(schema)); _updateDBVersion(schema, schemaVersion); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } catch (e){ - Scholar.debug(e, 1); - Scholar.DB.rollbackTransaction(); + Zotero.debug(e, 1); + Zotero.DB.rollbackTransaction(); alert('Error updating Zotero database'); // TODO: localize throw(e); } @@ -350,12 +350,12 @@ Scholar.Schema = new function(){ function _updateScrapersRemoteCallback(xmlhttp){ if (!xmlhttp.responseXML){ if (xmlhttp.status>1000){ - Scholar.debug('No network connection', 2); + Zotero.debug('No network connection', 2); } else { - Scholar.debug('Invalid response from repository', 2); + Zotero.debug('Invalid response from repository', 2); } - _setRepositoryTimer(SCHOLAR_CONFIG['REPOSITORY_RETRY_INTERVAL']); + _setRepositoryTimer(ZOTERO_CONFIG['REPOSITORY_RETRY_INTERVAL']); return false; } @@ -363,7 +363,7 @@ Scholar.Schema = new function(){ getElementsByTagName('currentTime')[0].firstChild.nodeValue; var updates = xmlhttp.responseXML.getElementsByTagName('translator'); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); // Store the timestamp provided by the server _updateDBVersion('repository', currentTime); @@ -373,9 +373,9 @@ Scholar.Schema = new function(){ _updateDBVersion('lastcheck', Math.round(d.getTime()/1000)); // JS uses ms if (!updates.length){ - Scholar.debug('All scrapers are up-to-date'); - Scholar.DB.commitTransaction(); - _setRepositoryTimer(SCHOLAR_CONFIG['REPOSITORY_CHECK_INTERVAL']); + Zotero.debug('All scrapers are up-to-date'); + Zotero.DB.commitTransaction(); + _setRepositoryTimer(ZOTERO_CONFIG['REPOSITORY_CHECK_INTERVAL']); return false; } @@ -384,16 +384,16 @@ Scholar.Schema = new function(){ _scraperXMLToDBQuery(updates[i]); } catch (e) { - Scholar.debug(e, 1); - Scholar.DB.rollbackTransaction(); + Zotero.debug(e, 1); + Zotero.DB.rollbackTransaction(); var breakout = true; break; } } if (!breakout){ - Scholar.DB.commitTransaction(); - _setRepositoryTimer(SCHOLAR_CONFIG['REPOSITORY_CHECK_INTERVAL']); + Zotero.DB.commitTransaction(); + _setRepositoryTimer(ZOTERO_CONFIG['REPOSITORY_CHECK_INTERVAL']); } } @@ -405,7 +405,7 @@ Scholar.Schema = new function(){ **/ function _setRepositoryTimer(interval){ if (!interval){ - interval = SCHOLAR_CONFIG['REPOSITORY_CHECK_INTERVAL']; + interval = ZOTERO_CONFIG['REPOSITORY_CHECK_INTERVAL']; } var fudge = 2; // two seconds @@ -413,13 +413,13 @@ Scholar.Schema = new function(){ var interval = (interval + fudge) * 1000; // convert to ms if (!_repositoryTimer || _repositoryTimer.delay!=interval){ - Scholar.debug('Setting repository check interval to ' + displayInterval + ' seconds'); + Zotero.debug('Setting repository check interval to ' + displayInterval + ' seconds'); _repositoryTimer = Components.classes["@mozilla.org/timer;1"]. createInstance(Components.interfaces.nsITimer); _repositoryTimer.initWithCallback({ // implements nsITimerCallback notify: function(timer){ - Scholar.Schema.updateScrapersRemote(); + Zotero.Schema.updateScrapersRemote(); } }, interval, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK); } @@ -451,7 +451,7 @@ Scholar.Schema = new function(){ ] var sql = "REPLACE INTO translators VALUES (?,?,?,?,?,?,?,?)"; - return Scholar.DB.query(sql, sqlValues); + return Zotero.DB.query(sql, sqlValues); } @@ -469,9 +469,9 @@ Scholar.Schema = new function(){ throw("Zotero user DB version is newer than SQL file"); } - Scholar.debug('Updating user tables from version ' + fromVersion + ' to ' + toVersion); + Zotero.debug('Updating user tables from version ' + fromVersion + ' to ' + toVersion); - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); try { // Step through version changes until we reach the current version @@ -480,24 +480,24 @@ Scholar.Schema = new function(){ // previous revision to that one. for (var i=fromVersion + 1; i<=toVersion; i++){ if (i==1){ - Scholar.DB.query("DELETE FROM version WHERE schema='schema'"); + Zotero.DB.query("DELETE FROM version WHERE schema='schema'"); } if (i==5){ - Scholar.DB.query("REPLACE INTO itemData SELECT itemID, 1, originalPath FROM itemAttachments WHERE linkMode=1"); - Scholar.DB.query("REPLACE INTO itemData SELECT itemID, 1, path FROM itemAttachments WHERE linkMode=3"); - Scholar.DB.query("REPLACE INTO itemData SELECT itemID, 27, dateAdded FROM items NATURAL JOIN itemAttachments WHERE linkMode IN (1,3)"); - Scholar.DB.query("UPDATE itemAttachments SET originalPath=NULL WHERE linkMode=1"); - Scholar.DB.query("UPDATE itemAttachments SET path=NULL WHERE linkMode=3"); - try { Scholar.DB.query("DELETE FROM fulltextItems WHERE itemID IS NULL"); } catch(e){} + Zotero.DB.query("REPLACE INTO itemData SELECT itemID, 1, originalPath FROM itemAttachments WHERE linkMode=1"); + Zotero.DB.query("REPLACE INTO itemData SELECT itemID, 1, path FROM itemAttachments WHERE linkMode=3"); + Zotero.DB.query("REPLACE INTO itemData SELECT itemID, 27, dateAdded FROM items NATURAL JOIN itemAttachments WHERE linkMode IN (1,3)"); + Zotero.DB.query("UPDATE itemAttachments SET originalPath=NULL WHERE linkMode=1"); + Zotero.DB.query("UPDATE itemAttachments SET path=NULL WHERE linkMode=3"); + try { Zotero.DB.query("DELETE FROM fulltextItems WHERE itemID IS NULL"); } catch(e){} } } _updateSchema('user'); - Scholar.DB.commitTransaction(); + Zotero.DB.commitTransaction(); } catch(e){ - Scholar.debug(e); + Zotero.debug(e); alert('Error migrating Zotero database'); throw(e); } diff --git a/chrome/chromeFiles/content/scholar/xpcom/scholar.js b/chrome/chromeFiles/content/scholar/xpcom/scholar.js @@ -1,4 +1,4 @@ -const SCHOLAR_CONFIG = { +const ZOTERO_CONFIG = { GUID: 'zotero@chnm.gmu.edu', DB_FILE: 'zotero.sqlite', DB_REBUILD: false, // erase DB and recreate from schema @@ -12,7 +12,7 @@ const SCHOLAR_CONFIG = { /* * Core functions */ -var Scholar = new function(){ +var Zotero = new function(){ var _initialized = false; var _shutdown = false; var _localizedStringBundle; @@ -21,9 +21,9 @@ var Scholar = new function(){ this.init = init; this.shutdown = shutdown; this.getProfileDirectory = getProfileDirectory; - this.getScholarDirectory = getScholarDirectory; + this.getZoteroDirectory = getZoteroDirectory; this.getStorageDirectory = getStorageDirectory; - this.getScholarDatabase = getScholarDatabase; + this.getZoteroDatabase = getZoteroDatabase; this.backupDatabase = backupDatabase; this.debug = debug; this.varDump = varDump; @@ -52,17 +52,17 @@ var Scholar = new function(){ return false; } - // Register shutdown handler to call Scholar.shutdown() + // Register shutdown handler to call Zotero.shutdown() var observerService = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); observerService.addObserver({ observe: function(subject, topic, data){ - Scholar.shutdown(subject, topic, data) + Zotero.shutdown(subject, topic, data) } }, "xpcom-shutdown", false); // Load in the preferences branch for the extension - Scholar.Prefs.init(); + Zotero.Prefs.init(); // Load in the extension version from the extension manager var nsIUpdateItem = Components.interfaces.nsIUpdateItem; @@ -71,7 +71,7 @@ var Scholar = new function(){ .getService(Components.interfaces.nsIExtensionManager); var itemType = nsIUpdateItem.TYPE_EXTENSION; this.version - = gExtensionManager.getItemForID(SCHOLAR_CONFIG['GUID']).version; + = gExtensionManager.getItemForID(ZOTERO_CONFIG['GUID']).version; // OS platform var win = Components.classes["@mozilla.org/appshell/appShellService;1"] @@ -86,7 +86,7 @@ var Scholar = new function(){ this.locale = localeService.getLocaleComponentForUserAgent(); // Load in the localization stringbundle for use by getString(name) - var src = 'chrome://scholar/locale/scholar.properties'; + var src = 'chrome://zotero/locale/zotero.properties'; var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"] .getService(Components.interfaces.nsILocaleService); @@ -97,12 +97,12 @@ var Scholar = new function(){ _localizedStringBundle = stringBundleService.createBundle(src, appLocale); // Trigger updating of schema and scrapers - Scholar.Schema.updateSchema(); - Scholar.Schema.updateScrapersRemote(); + Zotero.Schema.updateSchema(); + Zotero.Schema.updateScrapersRemote(); // Initialize integration web server - Scholar.Integration.SOAP.init(); - Scholar.Integration.init(); + Zotero.Integration.SOAP.init(); + Zotero.Integration.init(); _initialized = true; return true; @@ -117,7 +117,7 @@ var Scholar = new function(){ _shutdown = true; - Scholar.backupDatabase(); + Zotero.backupDatabase(); return true; } @@ -130,8 +130,8 @@ var Scholar = new function(){ } - function getScholarDirectory(){ - var file = Scholar.getProfileDirectory(); + function getZoteroDirectory(){ + var file = Zotero.getProfileDirectory(); file.append('zotero'); // If it doesn't exist, create @@ -143,7 +143,7 @@ var Scholar = new function(){ function getStorageDirectory(){ - var file = Scholar.getScholarDirectory(); + var file = Zotero.getZoteroDirectory(); file.append('storage'); // If it doesn't exist, create @@ -153,11 +153,11 @@ var Scholar = new function(){ return file; } - function getScholarDatabase(ext){ + function getZoteroDatabase(ext){ ext = ext ? '.' + ext : ''; - var file = Scholar.getScholarDirectory(); - file.append(SCHOLAR_CONFIG['DB_FILE'] + ext); + var file = Zotero.getZoteroDirectory(); + file.append(ZOTERO_CONFIG['DB_FILE'] + ext); return file; } @@ -169,19 +169,19 @@ var Scholar = new function(){ * haven't been flushed to disk -- proceed with caution */ function backupDatabase(){ - if (Scholar.DB.transactionInProgress()){ - Scholar.debug('Transaction in progress--skipping DB backup', 2); + if (Zotero.DB.transactionInProgress()){ + Zotero.debug('Transaction in progress--skipping DB backup', 2); return false; } - Scholar.debug('Backing up database'); + Zotero.debug('Backing up database'); - var file = Scholar.getScholarDatabase(); - var backupFile = Scholar.getScholarDatabase('bak'); + var file = Zotero.getZoteroDatabase(); + var backupFile = Zotero.getZoteroDatabase('bak'); // Copy via a temporary file so we don't run into disk space issues // after deleting the old backup file - var tmpFile = Scholar.getScholarDatabase('tmp'); + var tmpFile = Zotero.getZoteroDatabase('tmp'); if (tmpFile.exists()){ tmpFile.remove(null); } @@ -215,19 +215,19 @@ var Scholar = new function(){ * Defaults to log level 3 if level not provided */ function debug(message, level) { - if (!SCHOLAR_CONFIG['DEBUG_LOGGING']){ + if (!ZOTERO_CONFIG['DEBUG_LOGGING']){ return false; } if (typeof message!='string'){ - message = Scholar.varDump(message); + message = Zotero.varDump(message); } if (!level){ level = 3; } - if (!SCHOLAR_CONFIG['DEBUG_TO_CONSOLE']){ + if (!ZOTERO_CONFIG['DEBUG_TO_CONSOLE']){ try { var logManager = Components.classes["@mozmonkey.com/debuglogger/manager;1"] @@ -437,7 +437,7 @@ var Scholar = new function(){ max = max * 128; } var rnd = Math.floor(Math.random()*max); - var exists = Scholar.DB.valueQuery(sql + rnd); + var exists = Zotero.DB.valueQuery(sql + rnd); tries--; } while (exists); @@ -459,7 +459,7 @@ var Scholar = new function(){ -Scholar.Prefs = new function(){ +Zotero.Prefs = new function(){ // Privileged methods this.init = init; this.get = get; @@ -470,12 +470,12 @@ Scholar.Prefs = new function(){ this.observe = observe; // Public properties - this.prefBranch; // set in Scholar.init() + this.prefBranch; // set in Zotero.init() function init(){ var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); - this.prefBranch = prefs.getBranch("extensions.scholar."); + this.prefBranch = prefs.getBranch("extensions.zotero."); // Register observer to handle pref changes this.register(); @@ -546,10 +546,10 @@ Scholar.Prefs = new function(){ switch (data){ case "automaticScraperUpdates": if (this.get('automaticScraperUpdates')){ - Scholar.Schema.updateScrapersRemote(); + Zotero.Schema.updateScrapersRemote(); } else { - Scholar.Schema.stopRepositoryTimer(); + Zotero.Schema.stopRepositoryTimer(); } break; } @@ -563,7 +563,7 @@ Scholar.Prefs = new function(){ * * Hashes can be created in the constructor by alternating key and val: * -* var hasharray = new Scholar.Hash('foo','foovalue','bar','barvalue'); +* var hasharray = new Zotero.Hash('foo','foovalue','bar','barvalue'); * * Or using hasharray.set(key, val) * @@ -580,7 +580,7 @@ Scholar.Prefs = new function(){ * (c) Mojavelinux, Inc. * License: Creative Commons **/ -Scholar.Hash = function(){ +Zotero.Hash = function(){ this.length = 0; this.items = new Array(); @@ -594,11 +594,11 @@ Scholar.Hash = function(){ } } -Scholar.Hash.prototype.get = function(in_key){ +Zotero.Hash.prototype.get = function(in_key){ return this.items[in_key] ? this.items[in_key] : false; } -Scholar.Hash.prototype.set = function(in_key, in_value){ +Zotero.Hash.prototype.set = function(in_key, in_value){ // Default to a boolean hash if value not provided if (typeof(in_value) == 'undefined'){ in_value = true; @@ -613,7 +613,7 @@ Scholar.Hash.prototype.set = function(in_key, in_value){ return in_value; } -Scholar.Hash.prototype.remove = function(in_key){ +Zotero.Hash.prototype.remove = function(in_key){ var tmp_value; if (typeof(this.items[in_key]) != 'undefined') { this.length--; @@ -624,13 +624,13 @@ Scholar.Hash.prototype.remove = function(in_key){ return tmp_value; } -Scholar.Hash.prototype.has = function(in_key){ +Zotero.Hash.prototype.has = function(in_key){ return typeof(this.items[in_key]) != 'undefined'; } -Scholar.Date = new function(){ +Zotero.Date = new function(){ this.sqlToDate = sqlToDate; this.strToDate = strToDate; this.formatDate = formatDate; @@ -667,7 +667,7 @@ Scholar.Date = new function(){ timeparts[0], timeparts[1], timeparts[2]); } catch (e){ - Scholar.debug(sqldate + ' is not a valid SQL date', 2) + Zotero.debug(sqldate + ' is not a valid SQL date', 2) return false; } } @@ -706,7 +706,7 @@ Scholar.Date = new function(){ } else { // local style date (middle or little endian) date.year = m[5]; - var country = Scholar.locale.substr(3); + var country = Zotero.locale.substr(3); if(country == "US" || // The United States country == "FM" || // The Federated States of Micronesia country == "PW" || // Palau @@ -748,7 +748,7 @@ Scholar.Date = new function(){ } date.month--; // subtract one for JS style - Scholar.debug("DATE: retrieved with algorithms: "+date.toSource()); + Zotero.debug("DATE: retrieved with algorithms: "+date.toSource()); return date; } } @@ -759,11 +759,11 @@ Scholar.Date = new function(){ if(m) { date.year = m[2]; date.part = m[1]+m[3]; - Scholar.debug("DATE: got year ("+date.year+", "+date.part+")"); + Zotero.debug("DATE: got year ("+date.year+", "+date.part+")"); // get short month strings from CSL interpreter if(!months) { - var months = Scholar.CSL.getMonthStrings("short"); + var months = Zotero.CSL.getMonthStrings("short"); } if(!_monthRe) { // then, see if have anything resembling a month anywhere @@ -774,11 +774,11 @@ Scholar.Date = new function(){ if(m) { date.month = months.indexOf(m[2][0].toUpperCase()+m[2].substr(1).toLowerCase()); date.part = m[1]+m[3]; - Scholar.debug("DATE: got month ("+date.month+", "+date.part+")"); + Zotero.debug("DATE: got month ("+date.month+", "+date.part+")"); // then, see if there's a day if(!_dayRe) { - var daySuffixes = Scholar.getString("date.daySuffixes").replace(/, ?/g, "|"); + var daySuffixes = Zotero.getString("date.daySuffixes").replace(/, ?/g, "|"); _dayRe = new RegExp("\\b([0-9]{1,2})(?:"+daySuffixes+")?\\b(.*)", "i"); } var m = _dayRe.exec(date.part); @@ -794,7 +794,7 @@ Scholar.Date = new function(){ date.part = m[2]; } - Scholar.debug("DATE: got day ("+date.day+", "+date.part+")"); + Zotero.debug("DATE: got day ("+date.day+", "+date.part+")"); } } } @@ -820,11 +820,11 @@ Scholar.Date = new function(){ } if(!months) { - var months = Scholar.CSL.getMonthStrings("short"); + var months = Zotero.CSL.getMonthStrings("short"); } if(date.month != undefined && months[date.month]) { // get short month strings from CSL interpreter - var months = Scholar.CSL.getMonthStrings("long"); + var months = Zotero.CSL.getMonthStrings("long"); string += months[date.month]; if(date.day) { string += " "+date.day+", "; @@ -854,7 +854,7 @@ Scholar.Date = new function(){ } } -Scholar.Browser = new function() { +Zotero.Browser = new function() { this.createHiddenBrowser = createHiddenBrowser; this.deleteHiddenBrowser = deleteHiddenBrowser; @@ -868,7 +868,7 @@ Scholar.Browser = new function() { // Create a hidden browser var newHiddenBrowser = myWindow.document.createElement("browser"); myWindow.document.documentElement.appendChild(newHiddenBrowser); - Scholar.debug("created hidden browser (" + Zotero.debug("created hidden browser (" + myWindow.document.getElementsByTagName('browser').length + ")"); return newHiddenBrowser; } @@ -877,6 +877,6 @@ Scholar.Browser = new function() { // Delete a hidden browser myBrowser.parentNode.removeChild(myBrowser); delete myBrowser; - Scholar.debug("deleted hidden browser"); + Zotero.debug("deleted hidden browser"); } } \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/xpcom/search.js b/chrome/chromeFiles/content/scholar/xpcom/search.js @@ -1,4 +1,4 @@ -Scholar.Search = function(){ +Zotero.Search = function(){ this._sql = null; this._sqlParams = null; this._maxSearchConditionID = 0; @@ -13,7 +13,7 @@ Scholar.Search = function(){ * * Must be called before save() for new searches */ -Scholar.Search.prototype.setName = function(name){ +Zotero.Search.prototype.setName = function(name){ if (!name){ throw("Invalid saved search name '" + name + '"'); } @@ -25,12 +25,12 @@ Scholar.Search.prototype.setName = function(name){ /* * Load a saved search from the DB */ -Scholar.Search.prototype.load = function(savedSearchID){ +Zotero.Search.prototype.load = function(savedSearchID){ var sql = "SELECT savedSearchName, MAX(searchConditionID) AS maxID " + "FROM savedSearches LEFT JOIN savedSearchConditions " + "USING (savedSearchID) WHERE savedSearchID=" + savedSearchID + " GROUP BY savedSearchID"; - var row = Scholar.DB.rowQuery(sql); + var row = Zotero.DB.rowQuery(sql); if (!row){ throw('Saved search ' + savedSearchID + ' does not exist'); @@ -43,16 +43,16 @@ Scholar.Search.prototype.load = function(savedSearchID){ this._savedSearchID = savedSearchID; this._savedSearchName = row['savedSearchName']; - var conditions = Scholar.DB.query("SELECT * FROM savedSearchConditions " + var conditions = Zotero.DB.query("SELECT * FROM savedSearchConditions " + "WHERE savedSearchID=" + savedSearchID + " ORDER BY searchConditionID"); for (var i in conditions){ // Parse "condition[/mode]" var [condition, mode] = - Scholar.SearchConditions.parseCondition(conditions[i]['condition']); + Zotero.SearchConditions.parseCondition(conditions[i]['condition']); - if (!Scholar.SearchConditions.get(condition)){ - Scholar.debug("Invalid saved search condition '" + if (!Zotero.SearchConditions.get(condition)){ + Zotero.debug("Invalid saved search condition '" + condition + "' -- skipping", 2); continue; } @@ -69,12 +69,12 @@ Scholar.Search.prototype.load = function(savedSearchID){ } -Scholar.Search.prototype.getID = function(){ +Zotero.Search.prototype.getID = function(){ return this._savedSearchID; } -Scholar.Search.prototype.getName = function(){ +Zotero.Search.prototype.getName = function(){ return this._savedSearchName; } @@ -84,29 +84,29 @@ Scholar.Search.prototype.getName = function(){ * * For new searches, setName() must be called before saving */ -Scholar.Search.prototype.save = function(){ +Zotero.Search.prototype.save = function(){ if (!this._savedSearchName){ throw('Name not provided for saved search'); } - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); if (this._savedSearchID){ var sql = "UPDATE savedSearches SET savedSearchName=? WHERE savedSearchID=?"; - Scholar.DB.query(sql, [this._savedSearchName, this._savedSearchID]); + Zotero.DB.query(sql, [this._savedSearchName, this._savedSearchID]); - Scholar.DB.query("DELETE FROM savedSearchConditions " + Zotero.DB.query("DELETE FROM savedSearchConditions " + "WHERE savedSearchID=" + this._savedSearchID); } else { var isNew = true; this._savedSearchID - = Scholar.getRandomID('savedSearches', 'savedSearchID'); + = Zotero.getRandomID('savedSearches', 'savedSearchID'); var sql = "INSERT INTO savedSearches (savedSearchID, savedSearchName) " + "VALUES (?,?)"; - Scholar.DB.query(sql, + Zotero.DB.query(sql, [this._savedSearchID, {string: this._savedSearchName}]); } @@ -130,19 +130,19 @@ Scholar.Search.prototype.save = function(){ this._conditions[i]['required'] ? 1 : null ]; - Scholar.DB.query(sql, sqlParams); + Zotero.DB.query(sql, sqlParams); } - Scholar.DB.commitTransaction(); - Scholar.Notifier.trigger( + Zotero.DB.commitTransaction(); + Zotero.Notifier.trigger( (isNew ? 'add' : 'modify'), 'search', this._savedSearchID ); return this._savedSearchID; } -Scholar.Search.prototype.addCondition = function(condition, operator, value, required){ - if (!Scholar.SearchConditions.hasOperator(condition, operator)){ +Zotero.Search.prototype.addCondition = function(condition, operator, value, required){ + if (!Zotero.SearchConditions.hasOperator(condition, operator)){ throw ("Invalid operator '" + operator + "' for condition " + condition); } @@ -151,7 +151,7 @@ Scholar.Search.prototype.addCondition = function(condition, operator, value, req this.addCondition('joinMode', 'any'); // Quicksearch words don't need to be phrases - var words = Scholar.Fulltext.semanticSplitter(value); + var words = Zotero.Fulltext.semanticSplitter(value); for each(var i in words){ this.addCondition('blockStart'); this.addCondition('title', operator, i, false); @@ -168,7 +168,7 @@ Scholar.Search.prototype.addCondition = function(condition, operator, value, req var searchConditionID = ++this._maxSearchConditionID; - var [condition, mode] = Scholar.SearchConditions.parseCondition(condition); + var [condition, mode] = Zotero.SearchConditions.parseCondition(condition); this._conditions[searchConditionID] = { id: searchConditionID, @@ -185,12 +185,12 @@ Scholar.Search.prototype.addCondition = function(condition, operator, value, req } -Scholar.Search.prototype.updateCondition = function(searchConditionID, condition, operator, value, required){ +Zotero.Search.prototype.updateCondition = function(searchConditionID, condition, operator, value, required){ if (typeof this._conditions[searchConditionID] == 'undefined'){ throw ('Invalid searchConditionID ' + searchConditionID + ' in updateCondition()'); } - if (!Scholar.SearchConditions.hasOperator(condition, operator)){ + if (!Zotero.SearchConditions.hasOperator(condition, operator)){ throw ("Invalid operator '" + operator + "' for condition " + condition); } @@ -207,7 +207,7 @@ Scholar.Search.prototype.updateCondition = function(searchConditionID, condition } -Scholar.Search.prototype.removeCondition = function(searchConditionID){ +Zotero.Search.prototype.removeCondition = function(searchConditionID){ if (typeof this._conditions[searchConditionID] == 'undefined'){ throw ('Invalid searchConditionID ' + searchConditionID + ' in removeCondition()'); } @@ -220,7 +220,7 @@ Scholar.Search.prototype.removeCondition = function(searchConditionID){ * Returns an array with 'condition', 'operator', 'value', 'required' * for the given searchConditionID */ -Scholar.Search.prototype.getSearchCondition = function(searchConditionID){ +Zotero.Search.prototype.getSearchCondition = function(searchConditionID){ return this._conditions[searchConditionID]; } @@ -229,7 +229,7 @@ Scholar.Search.prototype.getSearchCondition = function(searchConditionID){ * Returns a multidimensional array of conditions/operator/value sets * used in the search, indexed by searchConditionID */ -Scholar.Search.prototype.getSearchConditions = function(){ +Zotero.Search.prototype.getSearchConditions = function(){ // TODO: make copy return this._conditions; } @@ -238,12 +238,12 @@ Scholar.Search.prototype.getSearchConditions = function(){ /* * Run the search and return an array of item ids for results */ -Scholar.Search.prototype.search = function(){ +Zotero.Search.prototype.search = function(){ if (!this._sql){ this._buildQuery(); } - var ids = Scholar.DB.columnQuery(this._sql, this._sqlParams); + var ids = Zotero.DB.columnQuery(this._sql, this._sqlParams); if (!ids){ return false; @@ -252,7 +252,7 @@ Scholar.Search.prototype.search = function(){ // Filter results with fulltext search for each(var condition in this._conditions){ if (condition['condition']=='fulltextContent'){ - var fulltextIDs = Scholar.Fulltext.findTextInItems(ids, + var fulltextIDs = Zotero.Fulltext.findTextInItems(ids, condition['value'], condition['mode']); var hash = {}; @@ -288,7 +288,7 @@ Scholar.Search.prototype.search = function(){ /* * Get the SQL string for the search */ -Scholar.Search.prototype.getSQL = function(){ +Zotero.Search.prototype.getSQL = function(){ if (!this._sql){ this._buildQuery(); } @@ -296,7 +296,7 @@ Scholar.Search.prototype.getSQL = function(){ } -Scholar.Search.prototype.getSQLParams = function(){ +Zotero.Search.prototype.getSQLParams = function(){ if (!this._sql){ this._buildQuery(); } @@ -307,7 +307,7 @@ Scholar.Search.prototype.getSQLParams = function(){ /* * Build the SQL query for the search */ -Scholar.Search.prototype._buildQuery = function(){ +Zotero.Search.prototype._buildQuery = function(){ var sql = 'SELECT itemID FROM items'; var sqlParams = []; // Separate ANY conditions for 'required' condition support @@ -317,7 +317,7 @@ Scholar.Search.prototype._buildQuery = function(){ var conditions = []; for (var i in this._conditions){ - var data = Scholar.SearchConditions.get(this._conditions[i]['condition']); + var data = Zotero.SearchConditions.get(this._conditions[i]['condition']); if (data['table']){ conditions.push({ @@ -405,7 +405,7 @@ Scholar.Search.prototype._buildQuery = function(){ } condSQL += 'fieldID=? AND '; condSQLParams.push( - Scholar.ItemFields.getID(condition['alias']) + Zotero.ItemFields.getID(condition['alias']) ); break; @@ -415,7 +415,7 @@ Scholar.Search.prototype._buildQuery = function(){ // And descendents if recursive search if (recursive){ - var col = Scholar.Collections.get(condition['value']); + var col = Zotero.Collections.get(condition['value']); var descendents = col.getDescendents(false, 'collection'); if (descendents){ for (var k in descendents){ @@ -437,7 +437,7 @@ Scholar.Search.prototype._buildQuery = function(){ condSQL += "NOT "; } condSQL += "IN ("; - var search = new Scholar.Search(); + var search = new Zotero.Search(); search.load(condition['value']); // Check if there are any post-search filters @@ -585,7 +585,7 @@ Scholar.Search.prototype._buildQuery = function(){ } -Scholar.Searches = new function(){ +Zotero.Searches = new function(){ this.get = get; this.getAll = getAll; this.erase = erase; @@ -594,7 +594,7 @@ Scholar.Searches = new function(){ function get(id){ var sql = "SELECT savedSearchID AS id, savedSearchName AS name " + "FROM savedSearches WHERE savedSearchID=?"; - return Scholar.DB.rowQuery(sql, [id]); + return Zotero.DB.rowQuery(sql, [id]); } @@ -604,7 +604,7 @@ Scholar.Searches = new function(){ function getAll(){ var sql = "SELECT savedSearchID AS id, savedSearchName AS name " + "FROM savedSearches ORDER BY name"; - return Scholar.DB.query(sql); + return Zotero.DB.query(sql); } @@ -612,22 +612,22 @@ Scholar.Searches = new function(){ * Delete a given saved search from the DB */ function erase(savedSearchID){ - Scholar.DB.beginTransaction(); + Zotero.DB.beginTransaction(); var sql = "DELETE FROM savedSearchConditions WHERE savedSearchID=" + savedSearchID; - Scholar.DB.query(sql); + Zotero.DB.query(sql); var sql = "DELETE FROM savedSearches WHERE savedSearchID=" + savedSearchID; - Scholar.DB.query(sql); - Scholar.DB.commitTransaction(); + Zotero.DB.query(sql); + Zotero.DB.commitTransaction(); - Scholar.Notifier.trigger('remove', 'search', savedSearchID); + Zotero.Notifier.trigger('remove', 'search', savedSearchID); } } -Scholar.SearchConditions = new function(){ +Zotero.SearchConditions = new function(){ this.get = get; this.getStandardConditions = getStandardConditions; this.hasOperator = hasOperator; @@ -641,7 +641,7 @@ Scholar.SearchConditions = new function(){ * Define the advanced search operators */ var _operators = { - // Standard -- these need to match those in scholarsearch.xml + // Standard -- these need to match those in zoterosearch.xml is: true, isNot: true, contains: true, @@ -831,7 +831,7 @@ Scholar.SearchConditions = new function(){ }, table: 'itemData', field: 'value', - aliases: Scholar.DB.columnQuery("SELECT fieldName FROM fields " + + aliases: Zotero.DB.columnQuery("SELECT fieldName FROM fields " + "WHERE fieldName NOT IN ('accessDate', 'date', 'pages', " + "'section','accessionNumber','seriesNumber','issue')"), template: true // mark for special handling @@ -918,10 +918,10 @@ Scholar.SearchConditions = new function(){ } try { - var localized = Scholar.getString('searchConditions.' + i) + var localized = Zotero.getString('searchConditions.' + i) } catch (e){ - var localized = Scholar.getString('itemFields.' + i); + var localized = Zotero.getString('itemFields.' + i); } sortKeys.push(localized); diff --git a/chrome/chromeFiles/content/scholar/xpcom/translate.js b/chrome/chromeFiles/content/scholar/xpcom/translate.js @@ -1,10 +1,10 @@ -// Scholar for Firefox Translate Engine +// Zotero for Firefox Translate Engine /* - * Scholar.Translate: a class for translation of Scholar metadata from and to + * Zotero.Translate: a class for translation of Zotero metadata from and to * other formats * - * eventually, Scholar.Ingester may be rolled in here (i.e., after we get rid + * eventually, Zotero.Ingester may be rolled in here (i.e., after we get rid * of RDF) * * type can be: @@ -14,7 +14,7 @@ * search * * a typical export process: - * var translatorObj = new Scholar.Translate(); + * var translatorObj = new Zotero.Translate(); * var possibleTranslators = translatorObj.getTranslators(); * // do something involving nsIFilePicker; remember, each possibleTranslator * // object has properties translatorID, label, and targetID @@ -36,8 +36,8 @@ * for web - this is a URL * search - item (in toArray() format) to extrapolate data for (read-only; set * with setSearch). - * items - items (in Scholar.Item format) to be exported. if this is empty, - * Scholar will export all items in the library (read-only; set with + * items - items (in Zotero.Item format) to be exported. if this is empty, + * Zotero will export all items in the library (read-only; set with * setItems). setting items disables export of collections. * path - the path to the target; for web, this is the same as location * string - the string content to be used as a file. @@ -51,13 +51,13 @@ * _numericTypes - possible numeric types as a comma-delimited string * _handlers - handlers for various events (see setHandler) * _configOptions - options set by translator modifying behavior of - * Scholar.Translate + * Zotero.Translate * _displayOptions - options available to user for this specific translator * _waitForCompletion - whether to wait for asynchronous completion, or return * immediately when script has finished executing * _sandbox - sandbox in which translators will be executed * _streams - streams that need to be closed when execution is complete - * _IDMap - a map from IDs as specified in Scholar.Item() to IDs of actual items + * _IDMap - a map from IDs as specified in Zotero.Item() to IDs of actual items * _parentTranslator - set when a translator is called from another translator. * among other things, disables passing of the translate * object to handlers and modifies complete() function on @@ -75,7 +75,7 @@ * preferences */ -Scholar.Translate = function(type, saveItem) { +Zotero.Translate = function(type, saveItem) { this.type = type; // import = 0001 = 1 @@ -120,22 +120,22 @@ Scholar.Translate = function(type, saveItem) { * (singleton) initializes scrapers, loading from the database and separating * into types */ -Scholar.Translate.init = function() { - if(!Scholar.Translate.cache) { - var cachePref = Scholar.Prefs.get("cacheTranslatorData"); +Zotero.Translate.init = function() { + if(!Zotero.Translate.cache) { + var cachePref = Zotero.Prefs.get("cacheTranslatorData"); if(cachePref) { // fetch translator list - var translators = Scholar.DB.query("SELECT translatorID, translatorType, label, "+ + var translators = Zotero.DB.query("SELECT translatorID, translatorType, label, "+ "target, detectCode IS NULL as noDetectCode FROM translators "+ "ORDER BY target IS NULL, priority, label"); - var detectCodes = Scholar.DB.query("SELECT translatorID, detectCode FROM translators WHERE target IS NULL"); + var detectCodes = Zotero.DB.query("SELECT translatorID, detectCode FROM translators WHERE target IS NULL"); - Scholar.Translate.cache = new Object(); - Scholar.Translate.cache["import"] = new Array(); - Scholar.Translate.cache["export"] = new Array(); - Scholar.Translate.cache["web"] = new Array(); - Scholar.Translate.cache["search"] = new Array(); + Zotero.Translate.cache = new Object(); + Zotero.Translate.cache["import"] = new Array(); + Zotero.Translate.cache["export"] = new Array(); + Zotero.Translate.cache["web"] = new Array(); + Zotero.Translate.cache["search"] = new Array(); for each(translator in translators) { var type = translator.translatorType; @@ -155,13 +155,13 @@ Scholar.Translate.init = function() { var regexp = new RegExp(); regexp.compile("\."+translator.target+"$", "i"); wrappedTranslator.importRegexp = regexp; - Scholar.Translate.cache["import"].push(wrappedTranslator); + Zotero.Translate.cache["import"].push(wrappedTranslator); type -= mod; } // search translator var mod = type % 4; if(mod) { - Scholar.Translate.cache["export"].push(wrappedTranslator); + Zotero.Translate.cache["export"].push(wrappedTranslator); type -= mod; } // web translator @@ -170,7 +170,7 @@ Scholar.Translate.init = function() { var regexp = new RegExp(); regexp.compile(translator.target, "i"); wrappedTranslator.webRegexp = regexp; - Scholar.Translate.cache["web"].push(wrappedTranslator); + Zotero.Translate.cache["web"].push(wrappedTranslator); if(!translator.target) { for each(var detectCode in detectCodes) { @@ -184,7 +184,7 @@ Scholar.Translate.init = function() { // search translator var mod = type % 16; if(mod) { - Scholar.Translate.cache["search"].push(wrappedTranslator); + Zotero.Translate.cache["search"].push(wrappedTranslator); type -= mod; } } @@ -196,7 +196,7 @@ Scholar.Translate.init = function() { /* * sets the browser to be used for web translation; also sets the location */ -Scholar.Translate.prototype.setDocument = function(doc) { +Zotero.Translate.prototype.setDocument = function(doc) { this.document = doc; this.setLocation(doc.location.href); } @@ -204,14 +204,14 @@ Scholar.Translate.prototype.setDocument = function(doc) { /* * sets the item to be used for searching */ -Scholar.Translate.prototype.setSearch = function(search) { +Zotero.Translate.prototype.setSearch = function(search) { this.search = search; } /* * sets the item to be used for export */ -Scholar.Translate.prototype.setItems = function(items) { +Zotero.Translate.prototype.setItems = function(items) { this.items = items; } @@ -219,10 +219,10 @@ Scholar.Translate.prototype.setItems = function(items) { * sets the location to operate upon (file should be an nsILocalFile object or * web address) */ -Scholar.Translate.prototype.setLocation = function(location) { +Zotero.Translate.prototype.setLocation = function(location) { if(this.type == "web") { // account for proxies - this.location = Scholar.Ingester.ProxyMonitor.proxyToProper(location); + this.location = Zotero.Ingester.ProxyMonitor.proxyToProper(location); if(this.location != location) { // figure out if this URL is being proxies this.locationIsProxied = true; @@ -241,7 +241,7 @@ Scholar.Translate.prototype.setLocation = function(location) { /* * sets the string to be used as a file */ -Scholar.Translate.prototype.setString = function(string) { +Zotero.Translate.prototype.setString = function(string) { this._storage = string; this._storageLength = string.length; this._storagePointer = 0; @@ -251,7 +251,7 @@ Scholar.Translate.prototype.setString = function(string) { * sets translator display options. you can also pass a translator (not ID) to * setTranslator that includes a displayOptions argument */ -Scholar.Translate.prototype.setDisplayOptions = function(displayOptions) { +Zotero.Translate.prototype.setDisplayOptions = function(displayOptions) { this._setDisplayOptions = displayOptions; } @@ -260,7 +260,7 @@ Scholar.Translate.prototype.setDisplayOptions = function(displayOptions) { * * accepts either the object from getTranslators() or an ID */ -Scholar.Translate.prototype.setTranslator = function(translator) { +Zotero.Translate.prototype.setTranslator = function(translator) { if(!translator) { throw("cannot set translator: invalid value"); } @@ -305,7 +305,7 @@ Scholar.Translate.prototype.setTranslator = function(translator) { where = where.substr(4); var sql = "SELECT * FROM translators WHERE "+where+" AND translatorType IN ("+this._numericTypes+")"; - this.translator = Scholar.DB.query(sql, translator); + this.translator = Zotero.DB.query(sql, translator); if(!this.translator) { return false; } @@ -335,14 +335,14 @@ Scholar.Translate.prototype.setTranslator = function(translator) { * itemDone * valid: import, web, search * called: when an item has been processed; may be called asynchronously - * passed: an item object (see Scholar.Item) + * passed: an item object (see Zotero.Item) * returns: N/A * * collectionDone * valid: import * called: when a collection has been processed, after all items have been * added; may be called asynchronously - * passed: a collection object (see Scholar.Collection) + * passed: a collection object (see Zotero.Collection) * returns: N/A * * done @@ -351,7 +351,7 @@ Scholar.Translate.prototype.setTranslator = function(translator) { * passed: true if successful, false if an error occurred * returns: N/A */ -Scholar.Translate.prototype.setHandler = function(type, handler) { +Zotero.Translate.prototype.setHandler = function(type, handler) { if(!this._handlers[type]) { this._handlers[type] = new Array(); } @@ -371,24 +371,24 @@ Scholar.Translate.prototype.setHandler = function(type, handler) { * label - the name of the translator * itemType - the type of item this scraper says it will scrape */ -Scholar.Translate.prototype.getTranslators = function() { +Zotero.Translate.prototype.getTranslators = function() { // clear BOM this._hasBOM = null; - if(Scholar.Translate.cache) { - var translators = Scholar.Translate.cache[this.type]; + if(Zotero.Translate.cache) { + var translators = Zotero.Translate.cache[this.type]; } else { var sql = "SELECT translatorID, label, target, detectCode IS NULL as "+ "noDetectCode FROM translators WHERE translatorType IN ("+this._numericTypes+") "+ "ORDER BY target IS NULL, priority, label"; - var translators = Scholar.DB.query(sql); + var translators = Zotero.DB.query(sql); } // create a new sandbox this._generateSandbox(); var possibleTranslators = new Array(); - Scholar.debug("searching for translators for "+(this.path ? this.path : "an undisclosed location")); + Zotero.debug("searching for translators for "+(this.path ? this.path : "an undisclosed location")); // see which translators can translate var possibleTranslators = this._findTranslators(translators); @@ -403,11 +403,11 @@ Scholar.Translate.prototype.getTranslators = function() { * extension-based exclusion is inverted, so that only detectCode is used to * determine if a translator can be run. */ -Scholar.Translate.prototype._findTranslators = function(translators, ignoreExtensions) { +Zotero.Translate.prototype._findTranslators = function(translators, ignoreExtensions) { var possibleTranslators = new Array(); for(var i in translators) { if(this._canTranslate(translators[i], ignoreExtensions)) { - Scholar.debug("found translator "+translators[i].label); + Zotero.debug("found translator "+translators[i].label); // for some reason, and i'm not quite sure what this reason is, // we HAVE to do this to get things to work right; we can't @@ -424,7 +424,7 @@ Scholar.Translate.prototype._findTranslators = function(translators, ignoreExten } } if(!possibleTranslators.length && this.type == "import" && !ignoreExtensions) { - Scholar.debug("looking a second time"); + Zotero.debug("looking a second time"); // try search again, ignoring file extensions return this._findTranslators(translators, true); } @@ -434,7 +434,7 @@ Scholar.Translate.prototype._findTranslators = function(translators, ignoreExten /* * loads a translator into a sandbox */ -Scholar.Translate.prototype._loadTranslator = function() { +Zotero.Translate.prototype._loadTranslator = function() { if(!this._sandbox || this.type == "search") { // create a new sandbox if none exists, or for searching (so that it's // bound to the correct url) @@ -444,7 +444,7 @@ Scholar.Translate.prototype._loadTranslator = function() { // parse detect code for the translator this._parseDetectCode(this.translator[0]); - Scholar.debug("parsing code for "+this.translator[0].label); + Zotero.debug("parsing code for "+this.translator[0].label); try { Components.utils.evalInSandbox(this.translator[0].code, this._sandbox); @@ -452,7 +452,7 @@ Scholar.Translate.prototype._loadTranslator = function() { if(this._parentTranslator) { throw(e); } else { - Scholar.debug(e+' in parsing code for '+this.translator[0].label); + Zotero.debug(e+' in parsing code for '+this.translator[0].label); this._translationComplete(false, e); return false; } @@ -464,8 +464,8 @@ Scholar.Translate.prototype._loadTranslator = function() { /* * does the actual translation */ -Scholar.Translate.prototype.translate = function() { - Scholar.debug("translate called"); +Zotero.Translate.prototype.translate = function() { + Zotero.debug("translate called"); /* * initialize properties @@ -520,9 +520,9 @@ Scholar.Translate.prototype.translate = function() { /* * generates a sandbox for scraping/scraper detection */ -Scholar.Translate._searchSandboxRegexp = new RegExp(); -Scholar.Translate._searchSandboxRegexp.compile("^http://[\\w.]+/"); -Scholar.Translate.prototype._generateSandbox = function() { +Zotero.Translate._searchSandboxRegexp = new RegExp(); +Zotero.Translate._searchSandboxRegexp.compile("^http://[\\w.]+/"); +Zotero.Translate.prototype._generateSandbox = function() { var me = this; if(this.type == "web" || this.type == "search") { @@ -537,45 +537,45 @@ Scholar.Translate.prototype._generateSandbox = function() { if(this.translator && this.translator[0] && this.translator[0].target) { // so that web translators work too var tempURL = this.translator[0].target.replace(/\\/g, "").replace(/\^/g, ""); - var m = Scholar.Translate._searchSandboxRegexp.exec(tempURL); + var m = Zotero.Translate._searchSandboxRegexp.exec(tempURL); if(m) { sandboxURL = m[0]; } } } - Scholar.debug("binding sandbox to "+sandboxURL); + Zotero.debug("binding sandbox to "+sandboxURL); this._sandbox = new Components.utils.Sandbox(sandboxURL); - this._sandbox.Scholar = new Object(); + this._sandbox.Zotero = new Object(); // add ingester utilities - this._sandbox.Scholar.Utilities = new Scholar.Utilities.Ingester(this); - this._sandbox.Scholar.Utilities.HTTP = new Scholar.Utilities.Ingester.HTTP(this); + this._sandbox.Zotero.Utilities = new Zotero.Utilities.Ingester(this); + this._sandbox.Zotero.Utilities.HTTP = new Zotero.Utilities.Ingester.HTTP(this); // set up selectItems handler - this._sandbox.Scholar.selectItems = function(options) { return me._selectItems(options) }; + this._sandbox.Zotero.selectItems = function(options) { return me._selectItems(options) }; } else { // use null URL to create sandbox this._sandbox = new Components.utils.Sandbox(""); - this._sandbox.Scholar = new Object(); + this._sandbox.Zotero = new Object(); - this._sandbox.Scholar.Utilities = new Scholar.Utilities(); + this._sandbox.Zotero.Utilities = new Zotero.Utilities(); } if(this.type == "export") { // add routines to retrieve items and collections - this._sandbox.Scholar.nextItem = function() { return me._exportGetItem() }; - this._sandbox.Scholar.nextCollection = function() { return me._exportGetCollection() } + this._sandbox.Zotero.nextItem = function() { return me._exportGetItem() }; + this._sandbox.Zotero.nextCollection = function() { return me._exportGetCollection() } } else { // copy routines to add new items - this._sandbox.Scholar.Item = Scholar.Translate.GenerateScholarItemClass(); - this._sandbox.Scholar.Item.prototype.complete = function() {me._itemDone(this)}; + this._sandbox.Zotero.Item = Zotero.Translate.GenerateZoteroItemClass(); + this._sandbox.Zotero.Item.prototype.complete = function() {me._itemDone(this)}; if(this.type == "import") { // add routines to add new collections - this._sandbox.Scholar.Collection = Scholar.Translate.GenerateScholarItemClass(); + this._sandbox.Zotero.Collection = Zotero.Translate.GenerateZoteroItemClass(); // attach the function to be run when a collection is done - this._sandbox.Scholar.Collection.prototype.complete = function() {me._collectionDone(this)}; + this._sandbox.Zotero.Collection.prototype.complete = function() {me._collectionDone(this)}; } } @@ -583,17 +583,17 @@ Scholar.Translate.prototype._generateSandbox = function() { // for asynchronous operation, use wait() // done() is implemented after wait() is called - this._sandbox.Scholar.wait = function() { me._enableAsynchronous() }; + this._sandbox.Zotero.wait = function() { me._enableAsynchronous() }; // for adding configuration options - this._sandbox.Scholar.configure = function(option, value) {me._configure(option, value) }; + this._sandbox.Zotero.configure = function(option, value) {me._configure(option, value) }; // for adding displayed options - this._sandbox.Scholar.addOption = function(option, value) {me._addOption(option, value) }; + this._sandbox.Zotero.addOption = function(option, value) {me._addOption(option, value) }; // for getting the value of displayed options - this._sandbox.Scholar.getOption = function(option) { return me._getOption(option) }; + this._sandbox.Zotero.getOption = function(option) { return me._getOption(option) }; // for loading other translators and accessing their methods - this._sandbox.Scholar.loadTranslator = function(type) { - var translation = new Scholar.Translate(type, false); + this._sandbox.Zotero.loadTranslator = function(type) { + var translation = new Zotero.Translate(type, false); translation._parentTranslator = me; if(type == "export" && (this.type == "web" || this.type == "search")) { @@ -657,7 +657,7 @@ Scholar.Translate.prototype._generateSandbox = function() { /* * Check to see if _scraper_ can scrape this document */ -Scholar.Translate.prototype._canTranslate = function(translator, ignoreExtensions) { +Zotero.Translate.prototype._canTranslate = function(translator, ignoreExtensions) { if((this.type == "import" || this.type == "web") && !this.location) { // if no location yet (e.g., getting list of possible web translators), // just return true @@ -710,7 +710,7 @@ Scholar.Translate.prototype._canTranslate = function(translator, ignoreExtension try { this._importConfigureIO(); // so it can read } catch(e) { - Scholar.debug(e+' in opening IO for '+translator.label); + Zotero.debug(e+' in opening IO for '+translator.label); return false; } } @@ -732,11 +732,11 @@ Scholar.Translate.prototype._canTranslate = function(translator, ignoreExtension returnValue = this._sandbox.detectExport(); } } catch(e) { - Scholar.debug(e+' in executing detectCode for '+translator.label); + Zotero.debug(e+' in executing detectCode for '+translator.label); return false; } - Scholar.debug("executed detectCode for "+translator.label); + Zotero.debug("executed detectCode for "+translator.label); // detectCode returns text type if(returnValue) { @@ -757,7 +757,7 @@ Scholar.Translate.prototype._canTranslate = function(translator, ignoreExtension /* * parses translator detect code */ -Scholar.Translate.prototype._parseDetectCode = function(translator) { +Zotero.Translate.prototype._parseDetectCode = function(translator) { this._configOptions = new Array(); this._displayOptions = new Array(); @@ -765,7 +765,7 @@ Scholar.Translate.prototype._parseDetectCode = function(translator) { var detectCode = translator.detectCode; } else if(!translator.noDetectCode) { // get detect code from database - var detectCode = Scholar.DB.valueQuery("SELECT detectCode FROM translators WHERE translatorID = ?", + var detectCode = Zotero.DB.valueQuery("SELECT detectCode FROM translators WHERE translatorID = ?", [translator.translatorID]); } @@ -773,7 +773,7 @@ Scholar.Translate.prototype._parseDetectCode = function(translator) { try { Components.utils.evalInSandbox(detectCode, this._sandbox); } catch(e) { - Scholar.debug(e+' in parsing detectCode for '+translator.label); + Zotero.debug(e+' in parsing detectCode for '+translator.label); return; } } @@ -799,9 +799,9 @@ Scholar.Translate.prototype._parseDetectCode = function(translator) { * collections and children in addition to the array of items and * children */ -Scholar.Translate.prototype._configure = function(option, value) { +Zotero.Translate.prototype._configure = function(option, value) { this._configOptions[option] = value; - Scholar.debug("setting configure option "+option+" to "+value); + Zotero.debug("setting configure option "+option+" to "+value); } /* @@ -811,9 +811,9 @@ Scholar.Translate.prototype._configure = function(option, value) { * * current options are exportNotes and exportFileData */ -Scholar.Translate.prototype._addOption = function(option, value) { +Zotero.Translate.prototype._addOption = function(option, value) { this._displayOptions[option] = value; - Scholar.debug("setting display option "+option+" to "+value); + Zotero.debug("setting display option "+option+" to "+value); } /* @@ -822,7 +822,7 @@ Scholar.Translate.prototype._addOption = function(option, value) { * called as getOption() in detect code * */ -Scholar.Translate.prototype._getOption = function(option) { +Zotero.Translate.prototype._getOption = function(option) { return this._displayOptions[option]; } @@ -832,10 +832,10 @@ Scholar.Translate.prototype._getOption = function(option) { * * called as wait() in translator code */ -Scholar.Translate.prototype._enableAsynchronous = function() { +Zotero.Translate.prototype._enableAsynchronous = function() { var me = this; this._waitForCompletion = true; - this._sandbox.Scholar.done = function() { me._translationComplete(true) }; + this._sandbox.Zotero.done = function() { me._translationComplete(true) }; } /* @@ -843,7 +843,7 @@ Scholar.Translate.prototype._enableAsynchronous = function() { * * called as selectItems() in translator code */ -Scholar.Translate.prototype._selectItems = function(options) { +Zotero.Translate.prototype._selectItems = function(options) { // hack to see if there are options var haveOptions = false; for(var i in options) { @@ -868,7 +868,7 @@ Scholar.Translate.prototype._selectItems = function(options) { * * finishes things up and calls callback function(s) */ -Scholar.Translate.prototype._translationComplete = function(returnValue, error) { +Zotero.Translate.prototype._translationComplete = function(returnValue, error) { // to make sure this isn't called twice if(!this._complete) { this._complete = true; @@ -876,7 +876,7 @@ Scholar.Translate.prototype._translationComplete = function(returnValue, error) if(this.type == "search" && !this._itemsFound && this.translator.length > 1) { // if we're performing a search and didn't get any results, go on // to the next translator - Scholar.debug("could not find a result using "+this.translator[0].label+": \n" + Zotero.debug("could not find a result using "+this.translator[0].label+": \n" +this._generateErrorString(error)); this.translator.shift(); this.translate(); @@ -884,14 +884,14 @@ Scholar.Translate.prototype._translationComplete = function(returnValue, error) // close open streams this._closeStreams(); - if(Scholar.Notifier.isEnabled()) { + if(Zotero.Notifier.isEnabled()) { // notify itemTreeView about updates if(this.newItems.length) { - Scholar.Notifier.trigger("add", "item", this.newItems); + Zotero.Notifier.trigger("add", "item", this.newItems); } // notify collectionTreeView about updates if(this.newCollections && this.newCollections.length) { - Scholar.Notifier.trigger("add", "collection", this.newCollections); + Zotero.Notifier.trigger("add", "collection", this.newCollections); } } @@ -900,14 +900,14 @@ Scholar.Translate.prototype._translationComplete = function(returnValue, error) if(!returnValue) { var errorString = this._generateErrorString(error); - Scholar.debug("translation using "+this.translator[0].label+" failed: \n"+errorString); + Zotero.debug("translation using "+this.translator[0].label+" failed: \n"+errorString); if(this.type == "web") { // report translation error for webpages this._reportTranslationFailure(errorString); } } else { - Scholar.debug("translation successful"); + Zotero.debug("translation successful"); } } } @@ -916,7 +916,7 @@ Scholar.Translate.prototype._translationComplete = function(returnValue, error) /* * generates a useful error string, for submitting and debugging purposes */ -Scholar.Translate.prototype._generateErrorString = function(error) { +Zotero.Translate.prototype._generateErrorString = function(error) { var errorString = ""; if(typeof(error) == "string") { errorString = "\nthrown exception => "+error; @@ -929,27 +929,27 @@ Scholar.Translate.prototype._generateErrorString = function(error) { } errorString += "\nurl => "+this.path - + "\nextensions.zotero.cacheTranslatorData => "+Scholar.Prefs.get("cacheTranslatorData") - + "\nextensions.zotero.downloadAssociatedFiles => "+Scholar.Prefs.get("downloadAssociatedFiles"); + + "\nextensions.zotero.cacheTranslatorData => "+Zotero.Prefs.get("cacheTranslatorData") + + "\nextensions.zotero.downloadAssociatedFiles => "+Zotero.Prefs.get("downloadAssociatedFiles"); return errorString.substr(1); } /* * runs an HTTP request to report a translation error */ -Scholar.Translate.prototype._reportTranslationFailure = function(errorData) { - if(this.translator[0].inRepository && Scholar.Prefs.get("reportTranslationFailure")) { +Zotero.Translate.prototype._reportTranslationFailure = function(errorData) { + if(this.translator[0].inRepository && Zotero.Prefs.get("reportTranslationFailure")) { var postBody = "ids[]="+escape(this.translator[0].translatorID)+ "&lastUpdated="+escape(this.translator[0].lastUpdated)+ "&errorData="+escape(errorData); - Scholar.Utilities.HTTP.doPost("http://www.zotero.org/repo/report", postBody); + Zotero.Utilities.HTTP.doPost("http://www.zotero.org/repo/report", postBody); } } /* * closes open file streams, if any exist */ -Scholar.Translate.prototype._closeStreams = function() { +Zotero.Translate.prototype._closeStreams = function() { // serialize RDF and unregister dataSource if(this._rdf) { if(this._rdf.serializer) { @@ -996,16 +996,16 @@ Scholar.Translate.prototype._closeStreams = function() { /* * imports an attachment from the disk */ -Scholar.Translate.prototype._itemImportAttachment = function(attachment, sourceID) { +Zotero.Translate.prototype._itemImportAttachment = function(attachment, sourceID) { if(!attachment.path) { // create from URL if(attachment.url) { - var attachmentID = Scholar.Attachments.linkFromURL(attachment.url, sourceID, + var attachmentID = Zotero.Attachments.linkFromURL(attachment.url, sourceID, (attachment.mimeType ? attachment.mimeType : undefined), (attachment.title ? attachment.title : undefined)); - var attachmentItem = Scholar.Items.get(attachmentID); + var attachmentItem = Zotero.Items.get(attachmentID); } else { - Scholar.debug("not adding attachment: no path or url specified"); + Zotero.debug("not adding attachment: no path or url specified"); return false; } } else { @@ -1017,15 +1017,15 @@ Scholar.Translate.prototype._itemImportAttachment = function(attachment, sourceI if(attachment.url) { // import from nsIFile - var attachmentID = Scholar.Attachments.importSnapshotFromFile(file, + var attachmentID = Zotero.Attachments.importSnapshotFromFile(file, attachment.url, attachment.title, attachment.mimeType, (attachment.charset ? attachment.charset : null), sourceID); - var attachmentItem = Scholar.Items.get(attachmentID); + var attachmentItem = Zotero.Items.get(attachmentID); } else { // import from nsIFile - var attachmentID = Scholar.Attachments.importFromFile(file, sourceID); + var attachmentID = Zotero.Attachments.importFromFile(file, sourceID); // get attachment item - var attachmentItem = Scholar.Items.get(attachmentID); + var attachmentItem = Zotero.Items.get(attachmentID); if(attachment.title) { // set title attachmentItem.setField("title", attachment.title); @@ -1039,8 +1039,8 @@ Scholar.Translate.prototype._itemImportAttachment = function(attachment, sourceI /* * handles tags and see also data for notes and attachments */ -Scholar.Translate.prototype._itemTagsAndSeeAlso = function(item, newItem) { - Scholar.debug("handling notes and see also"); +Zotero.Translate.prototype._itemTagsAndSeeAlso = function(item, newItem) { + Zotero.debug("handling notes and see also"); // add to ID map if(item.itemID) { this._IDMap[item.itemID] = newItem.getID(); @@ -1060,7 +1060,7 @@ Scholar.Translate.prototype._itemTagsAndSeeAlso = function(item, newItem) { /* * executed when an item is done and ready to be loaded into the database */ -Scholar.Translate.prototype._itemDone = function(item) { +Zotero.Translate.prototype._itemDone = function(item) { if(!this.saveItem) { // if we're not supposed to save the item, just // return the item array @@ -1068,16 +1068,16 @@ Scholar.Translate.prototype._itemDone = function(item) { if(this._parentTranslator) { var pt = this._parentTranslator; item.complete = function() { pt._itemDone(this) }; - Scholar.debug("done from parent sandbox"); + Zotero.debug("done from parent sandbox"); } this._runHandler("itemDone", item); return; } - var notifierStatus = Scholar.Notifier.isEnabled(); + var notifierStatus = Zotero.Notifier.isEnabled(); if(notifierStatus) { - Scholar.Notifier.disable(); + Zotero.Notifier.disable(); } try { // make sure notifier gets turned back on when done @@ -1085,15 +1085,15 @@ Scholar.Translate.prototype._itemDone = function(item) { var type = (item.itemType ? item.itemType : "webpage"); if(type == "note") { // handle notes differently - var myID = Scholar.Notes.add(item.note); + var myID = Zotero.Notes.add(item.note); // re-retrieve the item - var newItem = Scholar.Items.get(myID); + var newItem = Zotero.Items.get(myID); } else if(type == "attachment") { if(this.type == "import") { var newItem = this._itemImportAttachment(item, null); var myID = newItem.getID(); } else { - Scholar.debug("discarding standalone attachment"); + Zotero.debug("discarding standalone attachment"); return false; } } else { @@ -1102,8 +1102,8 @@ Scholar.Translate.prototype._itemDone = function(item) { } // create new item - var typeID = Scholar.ItemTypes.getID(type); - var newItem = Scholar.Items.getNewItemByType(typeID); + var typeID = Zotero.ItemTypes.getID(type); + var newItem = Zotero.Items.getNewItemByType(typeID); // makes looping through easier item.itemType = item.complete = undefined; @@ -1125,9 +1125,9 @@ Scholar.Translate.prototype._itemDone = function(item) { // try to assign correct creator type if(data[j].creatorType) { try { - var creatorType = Scholar.CreatorTypes.getID(data[j].creatorType); + var creatorType = Zotero.CreatorTypes.getID(data[j].creatorType); } catch(e) { - Scholar.debug("invalid creator type "+data[j].creatorType+" for creator index "+j); + Zotero.debug("invalid creator type "+data[j].creatorType+" for creator index "+j); } } @@ -1139,17 +1139,17 @@ Scholar.Translate.prototype._itemDone = function(item) { newItem.translateSeeAlso = data; } else if(i != "note" && i != "notes" && i != "itemID" && i != "attachments" && i != "tags" && - (fieldID = Scholar.ItemFields.getID(i))) { + (fieldID = Zotero.ItemFields.getID(i))) { // if field is in db - if(Scholar.ItemFields.isValidForType(fieldID, typeID)) { + if(Zotero.ItemFields.isValidForType(fieldID, typeID)) { // if field is valid for this type // add field newItem.setField(i, data); } else { - Scholar.debug("discarded field "+i+" for item: field not valid for type "+type); + Zotero.debug("discarded field "+i+" for item: field not valid for type "+type); } } else { - Scholar.debug("discarded field "+i+" for item: field does not exist"); + Zotero.debug("discarded field "+i+" for item: field does not exist"); } } } @@ -1163,10 +1163,10 @@ Scholar.Translate.prototype._itemDone = function(item) { // handle notes if(item.notes) { for each(var note in item.notes) { - var noteID = Scholar.Notes.add(note.note, myID); + var noteID = Zotero.Notes.add(note.note, myID); // handle see also - var myNote = Scholar.Items.get(noteID); + var myNote = Zotero.Items.get(noteID); this._itemTagsAndSeeAlso(note, myNote); } } @@ -1176,33 +1176,33 @@ Scholar.Translate.prototype._itemDone = function(item) { for each(var attachment in item.attachments) { if(this.type == "web") { if(!attachment.url && !attachment.document) { - Scholar.debug("not adding attachment: no URL specified"); + Zotero.debug("not adding attachment: no URL specified"); } else if(attachment.downloadable && this._downloadAssociatedFiles) { if(attachment.document) { - attachmentID = Scholar.Attachments.importFromDocument(attachment.document, myID); + attachmentID = Zotero.Attachments.importFromDocument(attachment.document, myID); // change title, if a different one was specified if(attachment.title && (!attachment.document.title || attachment.title != attachment.document.title)) { - var attachmentItem = Scholar.Items.get(attachmentID); + var attachmentItem = Zotero.Items.get(attachmentID); attachmentItem.setField("title", attachment.title); } } else { - Scholar.Attachments.importFromURL(attachment.url, myID, + Zotero.Attachments.importFromURL(attachment.url, myID, (attachment.mimeType ? attachment.mimeType : attachment.document.contentType), (attachment.title ? attachment.title : attachment.document.title)); } } else { if(attachment.document) { - attachmentID = Scholar.Attachments.linkFromURL(attachment.document.location.href, myID, + attachmentID = Zotero.Attachments.linkFromURL(attachment.document.location.href, myID, (attachment.mimeType ? attachment.mimeType : attachment.document.contentType), (attachment.title ? attachment.title : attachment.document.title)); } else { if(!attachment.mimeType || attachment.title) { - Scholar.debug("notice: either mimeType or title is missing; attaching file will be slower"); + Zotero.debug("notice: either mimeType or title is missing; attaching file will be slower"); } - attachmentID = Scholar.Attachments.linkFromURL(attachment.url, myID, + attachmentID = Zotero.Attachments.linkFromURL(attachment.url, myID, (attachment.mimeType ? attachment.mimeType : undefined), (attachment.title ? attachment.title : undefined)); } @@ -1240,14 +1240,14 @@ Scholar.Translate.prototype._itemDone = function(item) { delete item; } catch(e) { if(notifierStatus) { - Scholar.Notifier.enable(); + Zotero.Notifier.enable(); } throw(e); } // only re-enable if notifier was enabled at the beginning of scraping if(notifierStatus) { - Scholar.Notifier.enable(); + Zotero.Notifier.enable(); } this._runHandler("itemDone", newItem); } @@ -1255,7 +1255,7 @@ Scholar.Translate.prototype._itemDone = function(item) { /* * executed when a collection is done and ready to be loaded into the database */ -Scholar.Translate.prototype._collectionDone = function(collection) { +Zotero.Translate.prototype._collectionDone = function(collection) { var newCollection = this._processCollection(collection, null); this._runHandler("collectionDone", newCollection); @@ -1264,8 +1264,8 @@ Scholar.Translate.prototype._collectionDone = function(collection) { /* * recursively processes collections */ -Scholar.Translate.prototype._processCollection = function(collection, parentID) { - var newCollection = Scholar.Collections.add(collection.name, parentID); +Zotero.Translate.prototype._processCollection = function(collection, parentID) { + var newCollection = Zotero.Collections.add(collection.name, parentID); var myID = newCollection.getID(); this.newCollections.push(myID); @@ -1277,10 +1277,10 @@ Scholar.Translate.prototype._processCollection = function(collection, parentID) } else { // add mapped items to collection if(this._IDMap[child.id]) { - Scholar.debug("adding "+this._IDMap[child.id]); + Zotero.debug("adding "+this._IDMap[child.id]); newCollection.addItem(this._IDMap[child.id]); } else { - Scholar.debug("could not map "+child.id+" to an imported item"); + Zotero.debug("could not map "+child.id+" to an imported item"); } } } @@ -1291,11 +1291,11 @@ Scholar.Translate.prototype._processCollection = function(collection, parentID) /* * calls a handler (see setHandler above) */ -Scholar.Translate.prototype._runHandler = function(type, argument) { +Zotero.Translate.prototype._runHandler = function(type, argument) { var returnValue; if(this._handlers[type]) { for(var i in this._handlers[type]) { - Scholar.debug("running handler "+i+" for "+type); + Zotero.debug("running handler "+i+" for "+type); try { if(this._parentTranslator) { returnValue = this._handlers[type][i](null, argument); @@ -1311,7 +1311,7 @@ Scholar.Translate.prototype._runHandler = function(type, argument) { } else { // otherwise, fail silently, so as not to interfere with // interface cleanup - Scholar.debug(e+' in handler '+i+' for '+type); + Zotero.debug(e+' in handler '+i+' for '+type); } } } @@ -1322,8 +1322,8 @@ Scholar.Translate.prototype._runHandler = function(type, argument) { /* * does the actual web translation */ -Scholar.Translate.prototype._web = function() { - this._downloadAssociatedFiles = Scholar.Prefs.get("downloadAssociatedFiles"); +Zotero.Translate.prototype._web = function() { + this._downloadAssociatedFiles = Zotero.Prefs.get("downloadAssociatedFiles"); try { this._sandbox.doWeb(this.document, this.location); @@ -1342,7 +1342,7 @@ Scholar.Translate.prototype._web = function() { /* * does the actual search translation */ -Scholar.Translate.prototype._search = function() { +Zotero.Translate.prototype._search = function() { try { this._sandbox.doSearch(this.search); } catch(e) { @@ -1356,7 +1356,7 @@ Scholar.Translate.prototype._search = function() { /* * does the actual import translation */ -Scholar.Translate.prototype._import = function() { +Zotero.Translate.prototype._import = function() { this._importConfigureIO(); try { @@ -1376,7 +1376,7 @@ Scholar.Translate.prototype._import = function() { /* * sets up import for IO */ -Scholar.Translate.prototype._importConfigureIO = function() { +Zotero.Translate.prototype._importConfigureIO = function() { if(this._storage) { if(this._configOptions.dataMode == "rdf") { this._rdf = new Object(); @@ -1394,7 +1394,7 @@ Scholar.Translate.prototype._importConfigureIO = function() { parser.parseString(this._rdf.dataSource, baseURI, this._storage); // make an instance of the RDF handler - this._sandbox.Scholar.RDF = new Scholar.Translate.RDF(this._rdf.dataSource); + this._sandbox.Zotero.RDF = new Zotero.Translate.RDF(this._rdf.dataSource); } else { this._storageFunctions(true); this._storagePointer = 0; @@ -1417,7 +1417,7 @@ Scholar.Translate.prototype._importConfigureIO = function() { this._rdf.dataSource = RDFService.GetDataSourceBlocking(URL); // make an instance of the RDF handler - this._sandbox.Scholar.RDF = new Scholar.Translate.RDF(this._rdf.dataSource); + this._sandbox.Zotero.RDF = new Zotero.Translate.RDF(this._rdf.dataSource); } } else { // open file and set read methods @@ -1437,10 +1437,10 @@ Scholar.Translate.prototype._importConfigureIO = function() { if(intlStream) { // found a UTF BOM at the beginning of the file; don't allow // translator to set the character set - this._sandbox.Scholar.setCharacterSet = function() {} + this._sandbox.Zotero.setCharacterSet = function() {} } else { // allow translator to set charset - this._sandbox.Scholar.setCharacterSet = function(charset) { + this._sandbox.Zotero.setCharacterSet = function(charset) { // seek if(filePosition != 0) { me._inputStream.QueryInterface(Components.interfaces.nsISeekableStream) @@ -1464,9 +1464,9 @@ Scholar.Translate.prototype._importConfigureIO = function() { if(this._configOptions.dataMode == "line") { // line by line reading this._inputStream.QueryInterface(Components.interfaces.nsILineInputStream); - this._sandbox.Scholar.read = function() { + this._sandbox.Zotero.read = function() { if(intlStream && intlStream instanceof Components.interfaces.nsIUnicharLineInputStream) { - Scholar.debug("using intlStream"); + Zotero.debug("using intlStream"); var amountRead = intlStream.readLine(str); } else { var amountRead = me._inputStream.readLine(str); @@ -1481,7 +1481,7 @@ Scholar.Translate.prototype._importConfigureIO = function() { } else { // block reading var sStream; - this._sandbox.Scholar.read = function(amount) { + this._sandbox.Zotero.read = function(amount) { if(intlStream) { // read from international stream, if one is available var amountRead = intlStream.readString(amount, str); @@ -1520,7 +1520,7 @@ Scholar.Translate.prototype._importConfigureIO = function() { * _hasBOM to the UTF type. if one is not found, returns false, and sets * _hasBOM to false to prevent further checking. */ -Scholar.Translate.prototype._importDefuseBOM = function() { +Zotero.Translate.prototype._importDefuseBOM = function() { // if already found not to have a BOM, skip if(this._hasBOM === false) { return; @@ -1596,13 +1596,13 @@ Scholar.Translate.prototype._importDefuseBOM = function() { /* * does the actual export, after code has been loaded and parsed */ -Scholar.Translate.prototype._export = function() { +Zotero.Translate.prototype._export = function() { // get items if(this.items) { this._itemsLeft = this.items; } else { - this._itemsLeft = Scholar.getItems(); + this._itemsLeft = Zotero.getItems(); } // run handler for items available @@ -1610,10 +1610,10 @@ Scholar.Translate.prototype._export = function() { // get collections, if requested if(this._configOptions.getCollections && !this.items) { - this._collectionsLeft = Scholar.getCollections(); + this._collectionsLeft = Zotero.getCollections(); } - Scholar.debug(this._displayOptions); + Zotero.debug(this._displayOptions); // export file data, if requested if(this._displayOptions["exportFileData"]) { @@ -1665,7 +1665,7 @@ Scholar.Translate.prototype._export = function() { /* * configures IO for export */ -Scholar.Translate.prototype._exportConfigureIO = function() { +Zotero.Translate.prototype._exportConfigureIO = function() { // open file var fStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance(Components.interfaces.nsIFileOutputStream); @@ -1686,19 +1686,19 @@ Scholar.Translate.prototype._exportConfigureIO = function() { this._rdf.serializer.QueryInterface(Components.interfaces.nsIRDFXMLSource); // make an instance of the RDF handler - this._sandbox.Scholar.RDF = new Scholar.Translate.RDF(this._rdf.dataSource, this._rdf.serializer); + this._sandbox.Zotero.RDF = new Zotero.Translate.RDF(this._rdf.dataSource, this._rdf.serializer); } else { // regular io; write just writes to file var intlStream = null; // allow setting of character sets - this._sandbox.Scholar.setCharacterSet = function(charset) { + this._sandbox.Zotero.setCharacterSet = function(charset) { intlStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); intlStream.init(fStream, charset, 1024, "?".charCodeAt(0)); }; - this._sandbox.Scholar.write = function(data) { + this._sandbox.Zotero.write = function(data) { if(intlStream) { intlStream.writeString(data); } else { @@ -1711,15 +1711,15 @@ Scholar.Translate.prototype._exportConfigureIO = function() { /* * copies attachment and returns data, given an attachment object */ -Scholar.Translate.prototype._exportGetAttachment = function(attachment) { +Zotero.Translate.prototype._exportGetAttachment = function(attachment) { var attachmentArray = new Object(); var attachmentID = attachment.getID(); var linkMode = attachment.getAttachmentLinkMode(); // get URL and accessDate if they exist - if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_URL || - linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL) { + if(linkMode == Zotero.Attachments.LINK_MODE_LINKED_URL || + linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL) { attachmentArray.url = attachment.getField('url'); attachmentArray.accessDate = attachment.getField('accessDate'); } else if(!this._displayOptions["exportFileData"]) { @@ -1739,13 +1739,13 @@ Scholar.Translate.prototype._exportGetAttachment = function(attachment) { // get tags attachmentArray.tags = attachment.getTags(); - if(linkMode != Scholar.Attachments.LINK_MODE_LINKED_URL && + if(linkMode != Zotero.Attachments.LINK_MODE_LINKED_URL && this._displayOptions["exportFileData"]) { // add path and filename if not an internet link var file = attachment.getFile(); attachmentArray.path = "files/"+attachmentID+"/"+file.leafName; - if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_FILE) { + if(linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) { // create a new directory var directory = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); @@ -1755,22 +1755,22 @@ Scholar.Translate.prototype._exportGetAttachment = function(attachment) { // copy file file.copyTo(directory, attachmentArray.filename); } else { - // copy imported files from the Scholar directory - var directory = Scholar.getStorageDirectory(); + // copy imported files from the Zotero directory + var directory = Zotero.getStorageDirectory(); directory.append(attachmentID); directory.copyTo(this._exportFileDirectory, attachmentID); } } - Scholar.debug(attachmentArray); + Zotero.debug(attachmentArray); return attachmentArray; } /* - * gets the next item to process (called as Scholar.nextItem() from code) + * gets the next item to process (called as Zotero.nextItem() from code) */ -Scholar.Translate.prototype._exportGetItem = function() { +Zotero.Translate.prototype._exportGetItem = function() { if(this._itemsLeft.length != 0) { var returnItem = this._itemsLeft.shift(); @@ -1793,7 +1793,7 @@ Scholar.Translate.prototype._exportGetItem = function() { returnItemArray.attachments = new Array(); var attachments = returnItem.getAttachments(); for each(attachmentID in attachments) { - var attachment = Scholar.Items.get(attachmentID); + var attachment = Zotero.Items.get(attachmentID); var attachmentInfo = this._exportGetAttachment(attachment); if(attachmentInfo) { @@ -1811,9 +1811,9 @@ Scholar.Translate.prototype._exportGetItem = function() { } /* - * gets the next item to collection (called as Scholar.nextCollection() from code) + * gets the next item to collection (called as Zotero.nextCollection() from code) */ -Scholar.Translate.prototype._exportGetCollection = function() { +Zotero.Translate.prototype._exportGetCollection = function() { if(!this._configOptions.getCollections) { throw("getCollections configure option not set; cannot retrieve collection"); } @@ -1834,7 +1834,7 @@ Scholar.Translate.prototype._exportGetCollection = function() { * sets up internal IO in such a way that both reading and writing are possible * (for inter-scraper communications) */ -Scholar.Translate.prototype._initializeInternalIO = function() { +Zotero.Translate.prototype._initializeInternalIO = function() { if(this.type == "import" || this.type == "export") { if(this._configOptions.dataMode == "rdf") { this._rdf = new Object(); @@ -1843,7 +1843,7 @@ Scholar.Translate.prototype._initializeInternalIO = function() { createInstance(Components.interfaces.nsIRDFDataSource); // make an instance of the RDF handler - this._sandbox.Scholar.RDF = new Scholar.Translate.RDF(this._rdf.dataSource); + this._sandbox.Zotero.RDF = new Zotero.Translate.RDF(this._rdf.dataSource); } else { this._storage = ""; this._storageLength = 0; @@ -1856,15 +1856,15 @@ Scholar.Translate.prototype._initializeInternalIO = function() { /* * sets up functions for reading/writing to a storage stream */ -Scholar.Translate.prototype._storageFunctions = function(read, write) { +Zotero.Translate.prototype._storageFunctions = function(read, write) { var me = this; // add setCharacterSet method that does nothing - this._sandbox.Scholar.setCharacterSet = function() {} + this._sandbox.Zotero.setCharacterSet = function() {} if(write) { // set up write() method - this._sandbox.Scholar.write = function(data) { + this._sandbox.Zotero.write = function(data) { me._storage += data; me._storageLength += data.length; }; @@ -1875,7 +1875,7 @@ Scholar.Translate.prototype._storageFunctions = function(read, write) { if(this._configOptions.dataMode == "line") { // line by line reading var lastCharacter; - this._sandbox.Scholar.read = function() { + this._sandbox.Zotero.read = function() { if(me._storagePointer >= me._storageLength) { return false; } @@ -1902,7 +1902,7 @@ Scholar.Translate.prototype._storageFunctions = function(read, write) { return me._storage; } } else { // block reading - this._sandbox.Scholar.read = function(amount) { + this._sandbox.Zotero.read = function(amount) { if(me._storagePointer >= me._storageLength) { return false; } @@ -1921,12 +1921,12 @@ Scholar.Translate.prototype._storageFunctions = function(read, write) { } } -/* Scholar.Translate.ScholarItem: a class for generating a new item from +/* Zotero.Translate.ZoteroItem: a class for generating a new item from * inside scraper code */ -Scholar.Translate.GenerateScholarItemClass = function() { - var ScholarItem = function(itemType) { +Zotero.Translate.GenerateZoteroItemClass = function() { + var ZoteroItem = function(itemType) { // assign item type this.itemType = itemType; // generate creators array @@ -1941,20 +1941,20 @@ Scholar.Translate.GenerateScholarItemClass = function() { this.attachments = new Array(); }; - return ScholarItem; + return ZoteroItem; } -/* Scholar.Translate.Collection: a class for generating a new top-level +/* Zotero.Translate.Collection: a class for generating a new top-level * collection from inside scraper code */ -Scholar.Translate.GenerateScholarCollectionClass = function() { - var ScholarCollection = Scholar.Translate.ScholarCollection = function() {}; +Zotero.Translate.GenerateZoteroCollectionClass = function() { + var ZoteroCollection = Zotero.Translate.ZoteroCollection = function() {}; - return ScholarCollection; + return ZoteroCollection; } -/* Scholar.Translate.RDF: a class for handling RDF IO +/* Zotero.Translate.RDF: a class for handling RDF IO * * If an import/export translator specifies dataMode RDF, this is the interface, * accessible from model. @@ -1965,7 +1965,7 @@ Scholar.Translate.GenerateScholarCollectionClass = function() { * convert) */ -Scholar.Translate.RDF = function(dataSource, serializer) { +Zotero.Translate.RDF = function(dataSource, serializer) { this._RDFService = Components.classes['@mozilla.org/rdf/rdf-service;1'] .getService(Components.interfaces.nsIRDFService); this._AtomService = Components.classes["@mozilla.org/atom-service;1"] @@ -1978,7 +1978,7 @@ Scholar.Translate.RDF = function(dataSource, serializer) { } // turn an nsISimpleEnumerator into an array -Scholar.Translate.RDF.prototype._deEnumerate = function(enumerator) { +Zotero.Translate.RDF.prototype._deEnumerate = function(enumerator) { if(!(enumerator instanceof Components.interfaces.nsISimpleEnumerator)) { return false; } @@ -2004,7 +2004,7 @@ Scholar.Translate.RDF.prototype._deEnumerate = function(enumerator) { } // get a resource as an nsIRDFResource, instead of a string -Scholar.Translate.RDF.prototype._getResource = function(about) { +Zotero.Translate.RDF.prototype._getResource = function(about) { try { if(!(about instanceof Components.interfaces.nsIRDFResource)) { about = this._RDFService.GetResource(about); @@ -2018,7 +2018,7 @@ Scholar.Translate.RDF.prototype._getResource = function(about) { // USED FOR OUTPUT // writes an RDF triple -Scholar.Translate.RDF.prototype.addStatement = function(about, relation, value, literal) { +Zotero.Translate.RDF.prototype.addStatement = function(about, relation, value, literal) { about = this._getResource(about); if(!(value instanceof Components.interfaces.nsIRDFResource)) { @@ -2033,12 +2033,12 @@ Scholar.Translate.RDF.prototype.addStatement = function(about, relation, value, } // creates an anonymous resource -Scholar.Translate.RDF.prototype.newResource = function() { +Zotero.Translate.RDF.prototype.newResource = function() { return this._RDFService.GetAnonymousResource() }; // creates a new container -Scholar.Translate.RDF.prototype.newContainer = function(type, about) { +Zotero.Translate.RDF.prototype.newContainer = function(type, about) { about = this._getResource(about); type = type.toLowerCase(); @@ -2054,7 +2054,7 @@ Scholar.Translate.RDF.prototype.newContainer = function(type, about) { } // adds a new container element (index optional) -Scholar.Translate.RDF.prototype.addContainerElement = function(about, element, literal, index) { +Zotero.Translate.RDF.prototype.addContainerElement = function(about, element, literal, index) { if(!(about instanceof Components.interfaces.nsIRDFContainer)) { about = this._getResource(about); var container = Components.classes["@mozilla.org/rdf/container;1"]. @@ -2078,7 +2078,7 @@ Scholar.Translate.RDF.prototype.addContainerElement = function(about, element, l } // gets container elements as an array -Scholar.Translate.RDF.prototype.getContainerElements = function(about) { +Zotero.Translate.RDF.prototype.getContainerElements = function(about) { if(!(about instanceof Components.interfaces.nsIRDFContainer)) { about = this._getResource(about); var container = Components.classes["@mozilla.org/rdf/container;1"]. @@ -2091,7 +2091,7 @@ Scholar.Translate.RDF.prototype.getContainerElements = function(about) { } // sets a namespace -Scholar.Translate.RDF.prototype.addNamespace = function(prefix, uri) { +Zotero.Translate.RDF.prototype.addNamespace = function(prefix, uri) { if(this._serializer) { // silently fail, in case the reason the scraper // is failing is that we're using internal IO this._serializer.addNameSpace(this._AtomService.getAtom(prefix), uri); @@ -2099,7 +2099,7 @@ Scholar.Translate.RDF.prototype.addNamespace = function(prefix, uri) { } // gets a resource's URI -Scholar.Translate.RDF.prototype.getResourceURI = function(resource) { +Zotero.Translate.RDF.prototype.getResourceURI = function(resource) { if(typeof(resource) == "string") { return resource; } @@ -2111,13 +2111,13 @@ Scholar.Translate.RDF.prototype.getResourceURI = function(resource) { // USED FOR INPUT // gets all RDF resources -Scholar.Translate.RDF.prototype.getAllResources = function() { +Zotero.Translate.RDF.prototype.getAllResources = function() { var resourceEnumerator = this._dataSource.GetAllResources(); return this._deEnumerate(resourceEnumerator); } // gets arcs going in -Scholar.Translate.RDF.prototype.getArcsIn = function(resource) { +Zotero.Translate.RDF.prototype.getArcsIn = function(resource) { resource = this._getResource(resource); var arcEnumerator = this._dataSource.ArcLabelsIn(resource); @@ -2125,7 +2125,7 @@ Scholar.Translate.RDF.prototype.getArcsIn = function(resource) { } // gets arcs going out -Scholar.Translate.RDF.prototype.getArcsOut = function(resource) { +Zotero.Translate.RDF.prototype.getArcsOut = function(resource) { resource = this._getResource(resource); var arcEnumerator = this._dataSource.ArcLabelsOut(resource); @@ -2133,7 +2133,7 @@ Scholar.Translate.RDF.prototype.getArcsOut = function(resource) { } // gets source resources -Scholar.Translate.RDF.prototype.getSources = function(resource, property) { +Zotero.Translate.RDF.prototype.getSources = function(resource, property) { property = this._getResource(property); resource = this._getResource(resource); @@ -2142,7 +2142,7 @@ Scholar.Translate.RDF.prototype.getSources = function(resource, property) { } // gets target resources -Scholar.Translate.RDF.prototype.getTargets = function(resource, property) { +Zotero.Translate.RDF.prototype.getTargets = function(resource, property) { property = this._getResource(property); resource = this._getResource(resource); diff --git a/chrome/chromeFiles/content/scholar/xpcom/utilities.js b/chrome/chromeFiles/content/scholar/xpcom/utilities.js @@ -1,31 +1,31 @@ -// Scholar for Firefox Utilities +// Zotero for Firefox Utilities ///////////////////////////////////////////////////////////////// // -// Scholar.Utilities +// Zotero.Utilities // ///////////////////////////////////////////////////////////////// -Scholar.Utilities = function () {} +Zotero.Utilities = function () {} -Scholar.Utilities.prototype.debug = function(msg) { - Scholar.debug(msg, 4); +Zotero.Utilities.prototype.debug = function(msg) { + Zotero.debug(msg, 4); } /* - * See Scholar.Date + * See Zotero.Date */ -Scholar.Utilities.prototype.formatDate = function(date) { - return Scholar.Date.formatDate(date); +Zotero.Utilities.prototype.formatDate = function(date) { + return Zotero.Date.formatDate(date); } -Scholar.Utilities.prototype.strToDate = function(date) { - return Scholar.Date.strToDate(date); +Zotero.Utilities.prototype.strToDate = function(date) { + return Zotero.Date.strToDate(date); } /* * Cleans extraneous punctuation off an author name */ -Scholar.Utilities.prototype.cleanAuthor = function(author, type, useComma) { +Zotero.Utilities.prototype.cleanAuthor = function(author, type, useComma) { if(typeof(author) != "string") { throw "cleanAuthor: author must be a string"; } @@ -57,7 +57,7 @@ Scholar.Utilities.prototype.cleanAuthor = function(author, type, useComma) { /* * Cleans whitespace off a string and replaces multiple spaces with one */ -Scholar.Utilities.prototype.cleanString = function(s) { +Zotero.Utilities.prototype.cleanString = function(s) { if(typeof(s) != "string") { throw "cleanString: argument must be a string"; } @@ -70,7 +70,7 @@ Scholar.Utilities.prototype.cleanString = function(s) { /* * Cleans any non-word non-parenthesis characters off the ends of a string */ -Scholar.Utilities.prototype.superCleanString = function(x) { +Zotero.Utilities.prototype.superCleanString = function(x) { if(typeof(x) != "string") { throw "superCleanString: argument must be a string"; } @@ -82,7 +82,7 @@ Scholar.Utilities.prototype.superCleanString = function(x) { /* * Eliminates HTML tags, replacing <br>s with /ns */ -Scholar.Utilities.prototype.cleanTags = function(x) { +Zotero.Utilities.prototype.cleanTags = function(x) { if(typeof(x) != "string") { throw "cleanTags: argument must be a string"; } @@ -94,7 +94,7 @@ Scholar.Utilities.prototype.cleanTags = function(x) { /* * Test if a string is an integer */ -Scholar.Utilities.prototype.isInt = function(x) { +Zotero.Utilities.prototype.isInt = function(x) { if(parseInt(x) == x) { return true; } @@ -102,17 +102,17 @@ Scholar.Utilities.prototype.isInt = function(x) { } /* - * Get current scholar version + * Get current zotero version */ -Scholar.Utilities.prototype.getVersion = function() { - return Scholar.version; +Zotero.Utilities.prototype.getVersion = function() { + return Zotero.version; } /* * Get a page range, given a user-entered set of pages */ -Scholar.Utilities.prototype._pageRangeRegexp = /^\s*([0-9]+)-([0-9]+)\s*$/; -Scholar.Utilities.prototype.getPageRange = function(pages) { +Zotero.Utilities.prototype._pageRangeRegexp = /^\s*([0-9]+)-([0-9]+)\s*$/; +Zotero.Utilities.prototype.getPageRange = function(pages) { var pageNumbers; var m = this._pageRangeRegexp.exec(pages); if(m) { @@ -128,12 +128,12 @@ Scholar.Utilities.prototype.getPageRange = function(pages) { /* * provide inArray function */ -Scholar.Utilities.prototype.inArray = Scholar.inArray; +Zotero.Utilities.prototype.inArray = Zotero.inArray; /* * pads a number or other string with a given string on the left */ -Scholar.Utilities.prototype.lpad = function(string, pad, length) { +Zotero.Utilities.prototype.lpad = function(string, pad, length) { while(string.length < length) { string = pad + string; } @@ -143,8 +143,8 @@ Scholar.Utilities.prototype.lpad = function(string, pad, length) { /* * returns true if an item type exists, false if it does not */ -Scholar.Utilities.prototype.itemTypeExists = function(type) { - if(Scholar.ItemTypes.getID(type)) { +Zotero.Utilities.prototype.itemTypeExists = function(type) { + if(Zotero.ItemTypes.getID(type)) { return true; } else { return false; @@ -154,10 +154,10 @@ Scholar.Utilities.prototype.itemTypeExists = function(type) { /* * Cleans a title, capitalizing the proper words and replacing " :" with ":" */ -Scholar.Utilities.capitalizeSkipWords = ["but", "or", "yet", "so", "for", "and", +Zotero.Utilities.capitalizeSkipWords = ["but", "or", "yet", "so", "for", "and", "nor", "a", "an", "the", "at", "by", "from", "in", "into", "of", "on", "to", "with", "up", "down"]; -Scholar.Utilities.prototype.capitalizeTitle = function(title) { +Zotero.Utilities.prototype.capitalizeTitle = function(title) { title = this.cleanString(title); title = title.replace(/ : /g, ": "); var words = title.split(" "); @@ -172,7 +172,7 @@ Scholar.Utilities.prototype.capitalizeTitle = function(title) { if(words.length > 2) { for(var i=1; i<lastWordIndex; i++) { // if not a skip word - if(Scholar.Utilities.capitalizeSkipWords.indexOf(words[i].toLowerCase()) == -1 || + if(Zotero.Utilities.capitalizeSkipWords.indexOf(words[i].toLowerCase()) == -1 || (words[i-1].length && words[i-1][words[i-1].length-1] == ":")) { words[i] = words[i][0].toUpperCase() + words[i].substr(1); } else { @@ -186,25 +186,25 @@ Scholar.Utilities.prototype.capitalizeTitle = function(title) { } /* - * END SCHOLAR FOR FIREFOX EXTENSIONS + * END ZOTERO FOR FIREFOX EXTENSIONS */ ///////////////////////////////////////////////////////////////// // -// Scholar.Utilities.Ingester +// Zotero.Utilities.Ingester // ///////////////////////////////////////////////////////////////// -// Scholar.Utilities.Ingester extends Scholar.Utilities, offering additional +// Zotero.Utilities.Ingester extends Zotero.Utilities, offering additional // classes relating to data extraction specifically from HTML documents. -Scholar.Utilities.Ingester = function(translate, proxiedURL) { +Zotero.Utilities.Ingester = function(translate, proxiedURL) { this.translate = translate; } -Scholar.Utilities.Ingester.prototype = new Scholar.Utilities(); +Zotero.Utilities.Ingester.prototype = new Zotero.Utilities(); // Takes an XPath query and returns the results -Scholar.Utilities.Ingester.prototype.gatherElementsOnXPath = function(doc, parentNode, xpath, nsResolver) { +Zotero.Utilities.Ingester.prototype.gatherElementsOnXPath = function(doc, parentNode, xpath, nsResolver) { var elmts = []; var iterator = doc.evaluate(xpath, parentNode, nsResolver, Components.interfaces.nsIDOMXPathResult.ANY_TYPE,null); @@ -220,7 +220,7 @@ Scholar.Utilities.Ingester.prototype.gatherElementsOnXPath = function(doc, paren /* * Gets a given node as a string containing all child nodes */ -Scholar.Utilities.Ingester.prototype.getNodeString = function(doc, contextNode, xpath, nsResolver) { +Zotero.Utilities.Ingester.prototype.getNodeString = function(doc, contextNode, xpath, nsResolver) { var elmts = this.gatherElementsOnXPath(doc, contextNode, xpath, nsResolver); var returnVar = ""; for(var i=0; i<elmts.length; i++) { @@ -232,7 +232,7 @@ Scholar.Utilities.Ingester.prototype.getNodeString = function(doc, contextNode, /* * Grabs items based on URLs */ -Scholar.Utilities.Ingester.prototype.getItemArray = function(doc, inHere, urlRe, rejectRe) { +Zotero.Utilities.Ingester.prototype.getItemArray = function(doc, inHere, urlRe, rejectRe) { var availableItems = new Object(); // Technically, associative arrays are objects // Require link to match this @@ -282,30 +282,30 @@ Scholar.Utilities.Ingester.prototype.getItemArray = function(doc, inHere, urlRe, return availableItems; } -Scholar.Utilities.Ingester.prototype.lookupContextObject = function(co, done, error) { - return Scholar.OpenURL.lookupContextObject(co, done, error); +Zotero.Utilities.Ingester.prototype.lookupContextObject = function(co, done, error) { + return Zotero.OpenURL.lookupContextObject(co, done, error); } -Scholar.Utilities.Ingester.prototype.parseContextObject = function(co, item) { - return Scholar.OpenURL.parseContextObject(co, item); +Zotero.Utilities.Ingester.prototype.parseContextObject = function(co, item) { + return Zotero.OpenURL.parseContextObject(co, item); } -// Ingester adapters for Scholar.Utilities.HTTP to handle proxies +// Ingester adapters for Zotero.Utilities.HTTP to handle proxies -Scholar.Utilities.Ingester.prototype.loadDocument = function(url, succeeded, failed) { +Zotero.Utilities.Ingester.prototype.loadDocument = function(url, succeeded, failed) { this.processDocuments([ url ], succeeded, null, failed); } -Scholar.Utilities.Ingester._protocolRe = new RegExp(); -Scholar.Utilities.Ingester._protocolRe.compile("^(?:(?:http|https|ftp):|[^:]*/)", "i"); -Scholar.Utilities.Ingester.prototype.processDocuments = function(urls, processor, done, exception) { +Zotero.Utilities.Ingester._protocolRe = new RegExp(); +Zotero.Utilities.Ingester._protocolRe.compile("^(?:(?:http|https|ftp):|[^:]*/)", "i"); +Zotero.Utilities.Ingester.prototype.processDocuments = function(urls, processor, done, exception) { if(this.translate.locationIsProxied) { for(var i in urls) { if(this.translate.locationIsProxied) { - urls[i] = Scholar.Ingester.ProxyMonitor.properToProxy(urls[i]); + urls[i] = Zotero.Ingester.ProxyMonitor.properToProxy(urls[i]); } // check for a protocol colon - if(!Scholar.Utilities.Ingester._protocolRe.test(urls[i])) { + if(!Zotero.Utilities.Ingester._protocolRe.test(urls[i])) { throw("invalid URL in processDocuments"); } } @@ -320,23 +320,23 @@ Scholar.Utilities.Ingester.prototype.processDocuments = function(urls, processor } } - Scholar.Utilities.HTTP.processDocuments(null, urls, processor, done, exception); + Zotero.Utilities.HTTP.processDocuments(null, urls, processor, done, exception); } -Scholar.Utilities.Ingester.HTTP = function(translate) { +Zotero.Utilities.Ingester.HTTP = function(translate) { this.translate = translate; } -Scholar.Utilities.Ingester.HTTP.prototype.doGet = function(url, onDone) { +Zotero.Utilities.Ingester.HTTP.prototype.doGet = function(url, onDone) { if(this.translate.locationIsProxied) { - url = Scholar.Ingester.ProxyMonitor.properToProxy(url); + url = Zotero.Ingester.ProxyMonitor.properToProxy(url); } - if(!Scholar.Utilities.Ingester._protocolRe.test(url)) { + if(!Zotero.Utilities.Ingester._protocolRe.test(url)) { throw("invalid URL in processDocuments"); } var translate = this.translate; - Scholar.Utilities.HTTP.doGet(url, function(xmlhttp) { + Zotero.Utilities.HTTP.doGet(url, function(xmlhttp) { try { onDone(xmlhttp.responseText, xmlhttp); } catch(e) { @@ -345,16 +345,16 @@ Scholar.Utilities.Ingester.HTTP.prototype.doGet = function(url, onDone) { }) } -Scholar.Utilities.Ingester.HTTP.prototype.doPost = function(url, body, onDone) { +Zotero.Utilities.Ingester.HTTP.prototype.doPost = function(url, body, onDone) { if(this.translate.locationIsProxied) { - url = Scholar.Ingester.ProxyMonitor.properToProxy(url); + url = Zotero.Ingester.ProxyMonitor.properToProxy(url); } - if(!Scholar.Utilities.Ingester._protocolRe.test(url)) { + if(!Zotero.Utilities.Ingester._protocolRe.test(url)) { throw("invalid URL in processDocuments"); } var translate = this.translate; - Scholar.Utilities.HTTP.doPost(url, body, function(xmlhttp) { + Zotero.Utilities.HTTP.doPost(url, body, function(xmlhttp) { try { onDone(xmlhttp.responseText, xmlhttp); } catch(e) { @@ -366,7 +366,7 @@ Scholar.Utilities.Ingester.HTTP.prototype.doPost = function(url, body, onDone) { // These are front ends for XMLHttpRequest. XMLHttpRequest can't actually be // accessed outside the sandbox, and even if it could, it wouldn't let scripts // access across domains, so everything's replicated here. -Scholar.Utilities.HTTP = new function() { +Zotero.Utilities.HTTP = new function() { this.doGet = doGet; this.doPost = doPost; this.doHead = doHead; @@ -380,10 +380,10 @@ Scholar.Utilities.HTTP = new function() { * Returns false if browser is offline * * doGet can be called as: - * Scholar.Utilities.HTTP.doGet(url, onDone) + * Zotero.Utilities.HTTP.doGet(url, onDone) **/ function doGet(url, onDone, onError) { - Scholar.debug("HTTP GET "+url); + Zotero.debug("HTTP GET "+url); if (this.browserIsOffline()){ return false; } @@ -409,10 +409,10 @@ Scholar.Utilities.HTTP = new function() { * Returns false if browser is offline * * doPost can be called as: - * Scholar.Utilities.HTTP.doPost(url, body, onDone) + * Zotero.Utilities.HTTP.doPost(url, body, onDone) **/ function doPost(url, body, onDone) { - Scholar.debug("HTTP POST "+body+" to "+url); + Zotero.debug("HTTP POST "+body+" to "+url); if (this.browserIsOffline()){ return false; } @@ -434,7 +434,7 @@ Scholar.Utilities.HTTP = new function() { function doHead(url, onDone) { - Scholar.debug("HTTP HEAD "+url); + Zotero.debug("HTTP HEAD "+url); if (this.browserIsOffline()){ return false; } @@ -458,13 +458,13 @@ Scholar.Utilities.HTTP = new function() { * Send an HTTP OPTIONS request via XMLHTTPRequest * * doOptions can be called as: - * Scholar.Utilities.HTTP.doOptions(url, body, onDone) + * Zotero.Utilities.HTTP.doOptions(url, body, onDone) * * The status handler, which doesn't really serve a very noticeable purpose * in our code, is required for compatiblity with the Piggy Bank project **/ function doOptions(url, body, onDone) { - Scholar.debug("HTTP OPTIONS "+url); + Zotero.debug("HTTP OPTIONS "+url); if (this.browserIsOffline()){ return false; } @@ -519,11 +519,11 @@ Scholar.Utilities.HTTP = new function() { // processor - a function to execute to process each document // done - a function to execute when all document processing is complete // exception - a function to execute if an exception occurs (exceptions are -// also logged in the Scholar for Firefox log) +// also logged in the Zotero for Firefox log) // saveBrowser - whether to save the hidden browser object; usually, you don't // want to do this, because it makes it easier to leak memory -Scholar.Utilities.HTTP.processDocuments = function(firstDoc, urls, processor, done, exception, saveBrowser) { - var hiddenBrowser = Scholar.Browser.createHiddenBrowser(); +Zotero.Utilities.HTTP.processDocuments = function(firstDoc, urls, processor, done, exception, saveBrowser) { + var hiddenBrowser = Zotero.Browser.createHiddenBrowser(); hiddenBrowser.docShell.allowImages = false; var prevUrl, url; @@ -540,7 +540,7 @@ Scholar.Utilities.HTTP.processDocuments = function(firstDoc, urls, processor, do var removeListeners = function() { hiddenBrowser.removeEventListener("load", onLoad, true); if(!saveBrowser) { - Scholar.Browser.deleteHiddenBrowser(hiddenBrowser); + Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); } } var doLoad = function() { @@ -548,7 +548,7 @@ Scholar.Utilities.HTTP.processDocuments = function(firstDoc, urls, processor, do if (urlIndex < urls.length) { url = urls[urlIndex]; try { - Scholar.debug("loading "+url); + Zotero.debug("loading "+url); hiddenBrowser.loadURI(url); } catch (e) { removeListeners(); @@ -567,7 +567,7 @@ Scholar.Utilities.HTTP.processDocuments = function(firstDoc, urls, processor, do } }; var onLoad = function() { - Scholar.debug(hiddenBrowser.contentDocument.location.href+" has been loaded"); + Zotero.debug(hiddenBrowser.contentDocument.location.href+" has been loaded"); if(hiddenBrowser.contentDocument.location.href != prevUrl) { // Just in case it fires too many times prevUrl = hiddenBrowser.contentDocument.location.href; try { @@ -601,7 +601,7 @@ Scholar.Utilities.HTTP.processDocuments = function(firstDoc, urls, processor, do /* * This would probably be better as a separate XPCOM service */ -Scholar.Utilities.AutoComplete = new function(){ +Zotero.Utilities.AutoComplete = new function(){ this.getResultComment = getResultComment; function getResultComment(textbox){ diff --git a/chrome/chromeFiles/locale/en-US/scholar/about.dtd b/chrome/chromeFiles/locale/en-US/scholar/about.dtd @@ -1,6 +1,6 @@ -<!ENTITY scholar.name "Zotero"> -<!ENTITY scholar.version "version"> -<!ENTITY scholar.createdby "Created by:"> -<!ENTITY scholar.directors "Directors:"> -<!ENTITY scholar.developers "Developers:"> -<!ENTITY scholar.thanks "Special thanks:"> -\ No newline at end of file +<!ENTITY zotero.name "Zotero"> +<!ENTITY zotero.version "version"> +<!ENTITY zotero.createdby "Created by:"> +<!ENTITY zotero.directors "Directors:"> +<!ENTITY zotero.developers "Developers:"> +<!ENTITY zotero.thanks "Special thanks:"> +\ No newline at end of file diff --git a/chrome/chromeFiles/locale/en-US/scholar/preferences.dtd b/chrome/chromeFiles/locale/en-US/scholar/preferences.dtd @@ -1,11 +1,11 @@ -<!ENTITY scholar.name "Zotero"> -<!ENTITY scholar.preferences.title "Zotero Preferences"> -<!ENTITY scholar.preferences.autoUpdate.label "Automatically check for updated scrapers"> -<!ENTITY scholar.preferences.position.label "Display Zotero"> -<!ENTITY scholar.preferences.position.above "above"> -<!ENTITY scholar.preferences.position.below "below"> -<!ENTITY scholar.preferences.position.browser "browser content"> -<!ENTITY scholar.preferences.parseEndnote.label "Use Zotero for downloaded EndNote files"> -<!ENTITY scholar.preferences.openurl.caption "OpenURL"> -<!ENTITY scholar.preferences.openurl.server "Resolver:"> -<!ENTITY scholar.preferences.openurl.version "Version:"> -\ No newline at end of file +<!ENTITY zotero.name "Zotero"> +<!ENTITY zotero.preferences.title "Zotero Preferences"> +<!ENTITY zotero.preferences.autoUpdate.label "Automatically check for updated scrapers"> +<!ENTITY zotero.preferences.position.label "Display Zotero"> +<!ENTITY zotero.preferences.position.above "above"> +<!ENTITY zotero.preferences.position.below "below"> +<!ENTITY zotero.preferences.position.browser "browser content"> +<!ENTITY zotero.preferences.parseEndnote.label "Use Zotero for downloaded EndNote files"> +<!ENTITY zotero.preferences.openurl.caption "OpenURL"> +<!ENTITY zotero.preferences.openurl.server "Resolver:"> +<!ENTITY zotero.preferences.openurl.version "Version:"> +\ No newline at end of file diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd @@ -1,4 +1,4 @@ -<!ENTITY scholar.name "Zotero"> +<!ENTITY zotero.name "Zotero"> <!ENTITY tabs.info.label "Info"> <!ENTITY tabs.notes.label "Notes"> diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties @@ -99,7 +99,7 @@ db.dbCorruptedNoBackup = The Zotero database appears to have become corrupted, db.dbRestored = The Zotero database appears to have become corrupted.\n\nYour data was restored from the last automatic backup made on %1 at %2. The damaged file was saved in your Zotero directory. db.dbRestoreFailed = The Zotero database appears to have become corrupted, and an attempt to restore from the last automatic backup failed.\n\nA new database file has been created. The damaged file was saved in your Zotero directory. -scholar.preferences.status.positionChange = Position change will take effect in new windows only +zotero.preferences.status.positionChange = Position change will take effect in new windows only fileInterface.itemsImported = Importing items... fileInterface.itemsExported = Exporting items... diff --git a/chrome/chromeFiles/locale/en-US/scholar/searchbox.dtd b/chrome/chromeFiles/locale/en-US/scholar/searchbox.dtd @@ -1,4 +1,4 @@ -<!ENTITY scholar.search.textModes.phrase "Phrase"> -<!ENTITY scholar.search.textModes.phraseBinary "Phrase (incl. binary files)"> -<!ENTITY scholar.search.textModes.regexp "Regexp"> -<!ENTITY scholar.search.textModes.regexpCS "Regexp (case-sensitive)"> +<!ENTITY zotero.search.textModes.phrase "Phrase"> +<!ENTITY zotero.search.textModes.phraseBinary "Phrase (incl. binary files)"> +<!ENTITY zotero.search.textModes.regexp "Regexp"> +<!ENTITY zotero.search.textModes.regexpCS "Regexp (case-sensitive)"> diff --git a/chrome/chromeFiles/skin/default/scholar/addCitationDialog.css b/chrome/chromeFiles/skin/default/scholar/addCitationDialog.css @@ -1,15 +1,15 @@ #citation-add { - list-style-image: url('chrome://scholar/skin/citation-add.png'); + list-style-image: url('chrome://zotero/skin/citation-add.png'); } #citation-add[disabled="true"] { - list-style-image: url('chrome://scholar/skin/citation-add-gray.png'); + list-style-image: url('chrome://zotero/skin/citation-add-gray.png'); } #citation-delete { - list-style-image: url('chrome://scholar/skin/citation-delete.png'); + list-style-image: url('chrome://zotero/skin/citation-delete.png'); } #citation-delete[disabled="true"] { - list-style-image: url('chrome://scholar/skin/citation-delete-gray.png'); + list-style-image: url('chrome://zotero/skin/citation-delete-gray.png'); } #item-locator { diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css @@ -1,11 +1,11 @@ -#scholar-status-bar-icon +#zotero-status-bar-icon { width: 49px; margin:0 0 -1px; padding:0 5px 1px; } -#scholar-pane +#zotero-pane { background: #f5f5f5; min-height: 170px; @@ -23,7 +23,7 @@ margin-right: 5px; } -#scholar-pane splitter +#zotero-pane splitter { background: #f5f5f5; border:0; @@ -45,49 +45,49 @@ min-width: 300px; } -#scholar-pane toolbar +#zotero-pane toolbar { border-bottom: none; background: #f5f5f5; height: 24px; } -#scholar-pane toolbarseparator { +#zotero-pane toolbarseparator { height:24px; } -#scholar-pane toolbar .toggler +#zotero-pane toolbar .toggler { margin: 4px; } -#scholar-toolbar-name +#zotero-toolbar-name { font-size: larger; } #tb-collection-add { - list-style-image: url('chrome://scholar/skin/toolbar-collection-add.png'); + list-style-image: url('chrome://zotero/skin/toolbar-collection-add.png'); } #tb-collection-rename { - list-style-image: url('chrome://scholar/skin/toolbar-collection-edit.png'); + list-style-image: url('chrome://zotero/skin/toolbar-collection-edit.png'); } #tb-collection-rename[disabled="true"] { - list-style-image: url('chrome://scholar/skin/toolbar-collection-edit-gray.png'); + list-style-image: url('chrome://zotero/skin/toolbar-collection-edit-gray.png'); } /* These fix a rendering bug in Fx2.0b2 */ -#scholar-pane toolbarbutton .toolbarbutton-text +#zotero-pane toolbarbutton .toolbarbutton-text { margin:0 2px; } -#scholar-pane .toolbarbutton-menu-dropmarker +#zotero-pane .toolbarbutton-menu-dropmarker { margin-right:4px; } @@ -99,62 +99,62 @@ #tb-collection-menu { - list-style-image: url('chrome://scholar/skin/cog.png'); + list-style-image: url('chrome://zotero/skin/cog.png'); } #tb-add { - list-style-image: url('chrome://scholar/skin/toolbar-item-add.png'); + list-style-image: url('chrome://zotero/skin/toolbar-item-add.png'); } #tb-item-from-page { - list-style-image: url('chrome://scholar/skin/toolbar-item-from-page.png'); + list-style-image: url('chrome://zotero/skin/toolbar-item-from-page.png'); } #tb-link-page { - list-style-image: url('chrome://scholar/skin/toolbar-link-add.png'); + list-style-image: url('chrome://zotero/skin/toolbar-link-add.png'); } #tb-snapshot-page { - list-style-image: url('chrome://scholar/skin/toolbar-snapshot-add.png'); + list-style-image: url('chrome://zotero/skin/toolbar-snapshot-add.png'); } #tb-note-add { - list-style-image: url('chrome://scholar/skin/toolbar-note-add.png'); + list-style-image: url('chrome://zotero/skin/toolbar-note-add.png'); } #tb-item-attachments-file { - list-style-image: url('chrome://scholar/skin/treeitem-attachment-file.png'); + list-style-image: url('chrome://zotero/skin/treeitem-attachment-file.png'); } #tb-item-attachments-link { - list-style-image: url('chrome://scholar/skin/treeitem-attachment-link.png'); + list-style-image: url('chrome://zotero/skin/treeitem-attachment-link.png'); } #tb-item-attachments-snapshot { - list-style-image: url('chrome://scholar/skin/treeitem-attachment-snapshot.png'); + list-style-image: url('chrome://zotero/skin/treeitem-attachment-snapshot.png'); } #tb-item-attachments-web-link { - list-style-image: url('chrome://scholar/skin/treeitem-attachment-web-link.png'); + list-style-image: url('chrome://zotero/skin/treeitem-attachment-web-link.png'); } #tb-fullscreen { - list-style-image: url('chrome://scholar/skin/toolbar-fullscreen-bottom.png'); + list-style-image: url('chrome://zotero/skin/toolbar-fullscreen-bottom.png'); } -#tb-fullscreen[scholartop="true"] +#tb-fullscreen[zoterotop="true"] { - list-style-image: url('chrome://scholar/skin/toolbar-fullscreen-top.png'); + list-style-image: url('chrome://zotero/skin/toolbar-fullscreen-top.png'); } #tb-fullscreen[fullscreenmode="true"] @@ -170,7 +170,7 @@ #tb-collection-addsearch { - list-style-image: url('chrome://scholar/skin/treesource-search.png'); + list-style-image: url('chrome://zotero/skin/treesource-search.png'); margin-bottom:-5px; } @@ -179,26 +179,26 @@ margin: 0px; padding: 0px; cursor: default; - list-style-image: url('chrome://scholar/skin/search-cancel.png'); + list-style-image: url('chrome://zotero/skin/search-cancel.png'); } #tb-search-cancel:hover:active { - list-style-image: url('chrome://scholar/skin/search-cancel-active.png'); + list-style-image: url('chrome://zotero/skin/search-cancel-active.png'); } #tb-go-to-url, #tb-openurl { - list-style-image: url('chrome://scholar/skin/toolbar-go-arrow.png'); + list-style-image: url('chrome://zotero/skin/toolbar-go-arrow.png'); -moz-box-direction: reverse; } #tb-go-to-url[disabled=true], #tb-openurl[disabled=true] { - list-style-image: url('chrome://scholar/skin/toolbar-go-arrow-disabled.png'); + list-style-image: url('chrome://zotero/skin/toolbar-go-arrow-disabled.png'); } -#scholar-view-item > vbox +#zotero-view-item > vbox { overflow: auto; margin-left: 5px; @@ -227,7 +227,7 @@ margin-left:0; } -#scholar-splitter +#zotero-splitter { border-top: none; border-bottom: 1px solid #A3A3A3; diff --git a/chrome/chromeFiles/skin/default/scholar/scholar.css b/chrome/chromeFiles/skin/default/scholar/scholar.css @@ -1,181 +0,0 @@ -#zotero-toolbar-button -{ - list-style-image: url('chrome://scholar/skin/zotero-z-24px.png'); -} - -#zotero-toolbar-button:hover -{ - list-style-image: url('chrome://scholar/skin/zotero-z-24px-hover.png'); -} - -#zotero-toolbar-button:active -{ - list-style-image: url('chrome://scholar/skin/zotero-z-24px-active.png'); -} - -toolbar[iconsize="small"] #zotero-toolbar-button -{ - list-style-image: url('chrome://scholar/skin/zotero-z-16px.png'); -} - -toolbar[iconsize="small"] #zotero-toolbar-button:hover -{ - list-style-image: url('chrome://scholar/skin/zotero-z-16px-hover.png'); -} - -toolbar[iconsize="small"] #zotero-toolbar-button:active -{ - list-style-image: url('chrome://scholar/skin/zotero-z-16px-active.png'); -} - -textbox[multiline="true"][type="timed"] -{ - -moz-binding: url('chrome://scholar/content/bindings/timedtextarea.xml#timed-textarea'); -} - -noteeditor -{ - -moz-binding: url('chrome://scholar/content/bindings/noteeditor.xml#note-editor'); -} - -linksbox -{ - -moz-binding: url('chrome://scholar/content/bindings/noteeditor.xml#links-box'); -} - -tagsbox -{ - -moz-binding: url('chrome://scholar/content/bindings/tagsbox.xml#tags-box'); -} - -tagsbox row -{ - -moz-box-align:center; -} - -seealsobox -{ - -moz-binding: url('chrome://scholar/content/bindings/relatedbox.xml#seealso-box'); -} - -scholarsearch -{ - -moz-binding: url('chrome://scholar/content/bindings/scholarsearch.xml#search-box'); - width:60em; -} - -searchcondition -{ - -moz-binding: url('chrome://scholar/content/bindings/scholarsearch.xml#search-condition'); -} - -searchcondition menulist[id="operatorsmenu"] -{ - width:15em; -} - -zoterosearchtextbox -{ - -moz-binding: url('chrome://scholar/content/bindings/searchtextbox.xml#zotero-search-textbox'); -} - -zoterosearchtextbox toolbarbutton -{ - padding:0; - cursor:default; -} - -zoterosearchtextbox:not([hasOptions=true]) toolbarbutton -{ - display:none; -} - -zoterosearchtextbox .toolbarbutton-text -{ - margin:0; - padding:0; -} - -zoterosearchtextbox .toolbarbutton-menu-dropmarker -{ - padding:0 2px; -} - -#editpane-dynamic-fields row, tagsbox row -{ - margin:0 0 1px; -} - -#editpane-dynamic-fields textbox, tagsbox textbox -{ - margin-top:0; - margin-bottom:-1px; -} - -/* DEBUG: this doesn't seem to work, unfortunately -#editpane-dynamic-fields label[singleField=false]:after -{ - content:","; -} -*/ - -.clicky, .unclicky -{ - -moz-border-radius: 6px; -} - -.clicky[value="-"], .clicky[value="+"], -.unclicky[value="-"], .unclicky[value="+"] -{ - margin: 0px; - padding-left: 4px; - padding-right: 4px; -} - -.clicky:hover -{ - color: white; - background: #666666; -} - -#zotero-progress-box, #scholar-progress-box -{ - border: 2px solid #7a0000; - margin: 0; - min-height: 50px; - width: 250px; - padding-bottom: 3px; -} - -.zotero-progress-item-icon, .scholar-progress-item-icon -{ - width: 16px; - height: 16px; -} - -.zotero-progress-item-hbox, .scholar-progress-item-hbox -{ - padding-left: 5px; - margin-top: 3px; - margin-bottom: 3px; -} - -.scholar-progress-item-label -{ - width: 210px; -} - -.scholar-progress-description -{ - width: 220px; -} - -.scholar-scrape-popup-library -{ - list-style-image: url('chrome://scholar/skin/treesource-library.png'); -} - -.scholar-scrape-popup-collection -{ - list-style-image: url('chrome://scholar/skin/treesource-collection.png'); -} -\ No newline at end of file diff --git a/chrome/chromeFiles/skin/default/scholar/zotero.css b/chrome/chromeFiles/skin/default/scholar/zotero.css @@ -0,0 +1,181 @@ +#zotero-toolbar-button +{ + list-style-image: url('chrome://zotero/skin/zotero-z-24px.png'); +} + +#zotero-toolbar-button:hover +{ + list-style-image: url('chrome://zotero/skin/zotero-z-24px-hover.png'); +} + +#zotero-toolbar-button:active +{ + list-style-image: url('chrome://zotero/skin/zotero-z-24px-active.png'); +} + +toolbar[iconsize="small"] #zotero-toolbar-button +{ + list-style-image: url('chrome://zotero/skin/zotero-z-16px.png'); +} + +toolbar[iconsize="small"] #zotero-toolbar-button:hover +{ + list-style-image: url('chrome://zotero/skin/zotero-z-16px-hover.png'); +} + +toolbar[iconsize="small"] #zotero-toolbar-button:active +{ + list-style-image: url('chrome://zotero/skin/zotero-z-16px-active.png'); +} + +textbox[multiline="true"][type="timed"] +{ + -moz-binding: url('chrome://zotero/content/bindings/timedtextarea.xml#timed-textarea'); +} + +noteeditor +{ + -moz-binding: url('chrome://zotero/content/bindings/noteeditor.xml#note-editor'); +} + +linksbox +{ + -moz-binding: url('chrome://zotero/content/bindings/noteeditor.xml#links-box'); +} + +tagsbox +{ + -moz-binding: url('chrome://zotero/content/bindings/tagsbox.xml#tags-box'); +} + +tagsbox row +{ + -moz-box-align:center; +} + +seealsobox +{ + -moz-binding: url('chrome://zotero/content/bindings/relatedbox.xml#seealso-box'); +} + +zoterosearch +{ + -moz-binding: url('chrome://zotero/content/bindings/zoterosearch.xml#search-box'); + width:60em; +} + +searchcondition +{ + -moz-binding: url('chrome://zotero/content/bindings/zoterosearch.xml#search-condition'); +} + +searchcondition menulist[id="operatorsmenu"] +{ + width:15em; +} + +zoterosearchtextbox +{ + -moz-binding: url('chrome://zotero/content/bindings/searchtextbox.xml#zotero-search-textbox'); +} + +zoterosearchtextbox toolbarbutton +{ + padding:0; + cursor:default; +} + +zoterosearchtextbox:not([hasOptions=true]) toolbarbutton +{ + display:none; +} + +zoterosearchtextbox .toolbarbutton-text +{ + margin:0; + padding:0; +} + +zoterosearchtextbox .toolbarbutton-menu-dropmarker +{ + padding:0 2px; +} + +#editpane-dynamic-fields row, tagsbox row +{ + margin:0 0 1px; +} + +#editpane-dynamic-fields textbox, tagsbox textbox +{ + margin-top:0; + margin-bottom:-1px; +} + +/* DEBUG: this doesn't seem to work, unfortunately +#editpane-dynamic-fields label[singleField=false]:after +{ + content:","; +} +*/ + +.clicky, .unclicky +{ + -moz-border-radius: 6px; +} + +.clicky[value="-"], .clicky[value="+"], +.unclicky[value="-"], .unclicky[value="+"] +{ + margin: 0px; + padding-left: 4px; + padding-right: 4px; +} + +.clicky:hover +{ + color: white; + background: #666666; +} + +#zotero-progress-box, #zotero-progress-box +{ + border: 2px solid #7a0000; + margin: 0; + min-height: 50px; + width: 250px; + padding-bottom: 3px; +} + +.zotero-progress-item-icon, .zotero-progress-item-icon +{ + width: 16px; + height: 16px; +} + +.zotero-progress-item-hbox, .zotero-progress-item-hbox +{ + padding-left: 5px; + margin-top: 3px; + margin-bottom: 3px; +} + +.zotero-progress-item-label +{ + width: 210px; +} + +.zotero-progress-description +{ + width: 220px; +} + +.zotero-scrape-popup-library +{ + list-style-image: url('chrome://zotero/skin/treesource-library.png'); +} + +.zotero-scrape-popup-collection +{ + list-style-image: url('chrome://zotero/skin/treesource-collection.png'); +} +\ No newline at end of file diff --git a/components/chnmIZoteroService.js b/components/chnmIZoteroService.js @@ -1,13 +1,13 @@ -const SCHOLAR_CONTRACTID = '@chnm.gmu.edu/Zotero;1'; -const SCHOLAR_CLASSNAME = 'Zotero'; -const SCHOLAR_CID = Components.ID('{e4c61080-ec2d-11da-8ad9-0800200c9a66}'); -const SCHOLAR_IID = Components.interfaces.chnmIZoteroService; +const ZOTERO_CONTRACTID = '@chnm.gmu.edu/Zotero;1'; +const ZOTERO_CLASSNAME = 'Zotero'; +const ZOTERO_CID = Components.ID('{e4c61080-ec2d-11da-8ad9-0800200c9a66}'); +const ZOTERO_IID = Components.interfaces.chnmIZoteroService; const Cc = Components.classes; const Ci = Components.interfaces; // Assign the global scope to a variable to passed via wrappedJSObject -var ScholarWrapped = this; +var ZoteroWrapped = this; /******************************************************************** @@ -101,17 +101,17 @@ Cc["@mozilla.org/moz/jssubscript-loader;1"] /********************************************************************/ -// Initialize the Scholar service +// Initialize the Zotero service // -// This runs when ScholarService is first requested. +// This runs when ZoteroService is first requested. // Calls to other XPCOM components must be in here rather than in top-level // code, as other components may not have yet been initialized. function setupService(){ - Scholar.init(); + Zotero.init(); } -function ScholarService(){ - this.wrappedJSObject = ScholarWrapped.Scholar; +function ZoteroService(){ + this.wrappedJSObject = ZoteroWrapped.Zotero; setupService(); } @@ -150,10 +150,10 @@ function setTimeout(func, ms){ // // XPCOM goop // -ScholarService.prototype = { +ZoteroService.prototype = { QueryInterface: function(iid){ if (!iid.equals(Components.interfaces.nsISupports) && - !iid.equals(SCHOLAR_IID)){ + !iid.equals(ZOTERO_IID)){ throw Components.results.NS_ERROR_NO_INTERFACE; } return this; @@ -161,17 +161,17 @@ ScholarService.prototype = { }; -var ScholarFactory = { +var ZoteroFactory = { createInstance: function(outer, iid){ if (outer != null){ throw Components.results.NS_ERROR_NO_AGGREGATION; } - return new ScholarService().QueryInterface(iid); + return new ZoteroService().QueryInterface(iid); } }; -var ScholarModule = { +var ZoteroModule = { _firstTime: true, registerSelf: function(compMgr, fileSpec, location, type){ @@ -183,9 +183,9 @@ var ScholarModule = { compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); - compMgr.registerFactoryLocation(SCHOLAR_CID, - SCHOLAR_CLASSNAME, - SCHOLAR_CONTRACTID, + compMgr.registerFactoryLocation(ZOTERO_CID, + ZOTERO_CLASSNAME, + ZOTERO_CONTRACTID, fileSpec, location, type); @@ -194,20 +194,20 @@ var ScholarModule = { unregisterSelf: function(compMgr, location, type){ compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); - compMgr.unregisterFactoryLocation(SCHOLAR_CID, location); + compMgr.unregisterFactoryLocation(ZOTERO_CID, location); }, getClassObject: function(compMgr, cid, iid){ - if (!cid.equals(SCHOLAR_CID)){ + if (!cid.equals(ZOTERO_CID)){ throw Components.results.NS_ERROR_NO_INTERFACE; } if (!iid.equals(Components.interfaces.nsIFactory)){ throw Components.results.NS_ERROR_NOT_IMPLEMENTED; } - return ScholarFactory; + return ZoteroFactory; }, canUnload: function(compMgr){ return true; } }; -function NSGetModule(comMgr, fileSpec){ return ScholarModule; } +function NSGetModule(comMgr, fileSpec){ return ZoteroModule; } diff --git a/defaults/preferences/scholar.js b/defaults/preferences/scholar.js @@ -1,11 +0,0 @@ -// These are DEFAULT prefs for the INSTALL. You will have to reinstall the extension to see differences! - -// Display internal shortcut -pref("extensions.scholar.automaticScraperUpdates",true); -pref("extensions.scholar.cacheTranslatorData",true); -pref("extensions.scholar.scholarPaneOnTop",false); -pref("extensions.scholar.openURL.resolver","http://athene.gmu.edu:8888/lfp/LinkFinderPlus/Display"); -pref("extensions.scholar.openURL.version","0.1"); -pref("extensions.scholar.parseEndNoteMIMETypes",true); -pref("extensions.scholar.downloadAssociatedFiles",false); -pref("extensions.scholar.reportTranslationFailure",true); -\ No newline at end of file diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js @@ -0,0 +1,11 @@ +// These are DEFAULT prefs for the INSTALL. You will have to reinstall the extension to see differences! + +// Display internal shortcut +pref("extensions.zotero.automaticScraperUpdates",true); +pref("extensions.zotero.cacheTranslatorData",true); +pref("extensions.zotero.zoteroPaneOnTop",false); +pref("extensions.zotero.openURL.resolver","http://athene.gmu.edu:8888/lfp/LinkFinderPlus/Display"); +pref("extensions.zotero.openURL.version","0.1"); +pref("extensions.zotero.parseEndNoteMIMETypes",true); +pref("extensions.zotero.downloadAssociatedFiles",false); +pref("extensions.zotero.reportTranslationFailure",true); +\ No newline at end of file diff --git a/install.rdf b/install.rdf @@ -15,9 +15,9 @@ <em:developer>David Norton</em:developer> <em:developer>Dan Stillman</em:developer> <em:homepageURL>http://www.zotero.org</em:homepageURL> - <em:optionsURL>chrome://scholar/content/preferences.xul</em:optionsURL> - <em:aboutURL>chrome://scholar/content/about.xul</em:aboutURL> - <em:iconURL>chrome://scholar/skin/zotero_z_32px.png</em:iconURL> + <em:optionsURL>chrome://zotero/content/preferences.xul</em:optionsURL> + <em:aboutURL>chrome://zotero/content/about.xul</em:aboutURL> + <em:iconURL>chrome://zotero/skin/zotero_z_32px.png</em:iconURL> <em:updateURL>http://www.zotero.org/download/update-svn.rdf</em:updateURL> <em:type>2</em:type> <!-- type=extension --> diff --git a/scrapers.sql b/scrapers.sql @@ -1,4 +1,4 @@ --- 94 +-- 95 DROP TABLE IF EXISTS translators; CREATE TABLE translators ( @@ -27,9 +27,9 @@ CREATE TABLE csl ( -- Set the following timestamp to the most recent scraper update date -REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-10-01 17:00:00')); +REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-10-02 17:00:00')); -REPLACE INTO "translators" VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '2006-08-11 11:18:00', 1, 100, 4, 'Amazon.com', 'Simon Kornblith', '^http://www\.amazon\.com/', +REPLACE INTO "translators" VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '2006-10-02 17:00:00', 1, 100, 4, 'Amazon.com', 'Simon Kornblith', '^http://www\.amazon\.com/', 'function detectWeb(doc, url) { var searchRe = new RegExp(''^http://(?:www\.)?amazon\.com/(gp/search/|exec/obidos/search-handle-url/|s/)''); if(searchRe.test(doc.location.href)) { @@ -53,7 +53,7 @@ REPLACE INTO "translators" VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '2006 if (prefix == ''x'') return namespace; else return null; } : null; - var newItem = new Scholar.Item("book"); + var newItem = new Zotero.Item("book"); // Retrieve authors try { @@ -61,9 +61,9 @@ REPLACE INTO "translators" VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '2006 var elmts = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null); var elmt; while(elmt = elmts.iterateNext()) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(elmt.nodeValue, "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(elmt.nodeValue, "author")); } - } catch(ex) {Scholar.Utilities.debug(ex);} + } catch(ex) {Zotero.Utilities.debug(ex);} // Retrieve data from "Product Details" box var xpath = ''/html/body/table/tbody/tr/td[2]/table/tbody/tr/td[@class="bucket"]/div[@class="content"]/ul/li''; @@ -73,10 +73,10 @@ REPLACE INTO "translators" VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '2006 newItem.extra = ""; while(elmt = elmts.iterateNext()) { try { - var attribute = Scholar.Utilities.cleanString(doc.evaluate(''./B[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); - var value = Scholar.Utilities.getNodeString(doc, elmt, ''./descendant-or-self::*[name() != "B"]/text()'', nsResolver); + var attribute = Zotero.Utilities.cleanString(doc.evaluate(''./B[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); + var value = Zotero.Utilities.getNodeString(doc, elmt, ''./descendant-or-self::*[name() != "B"]/text()'', nsResolver); if(value) { - value = Scholar.Utilities.cleanString(value); + value = Zotero.Utilities.cleanString(value); if(attribute == "Publisher:") { if(value.lastIndexOf("(") != -1) { @@ -115,7 +115,7 @@ REPLACE INTO "translators" VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '2006 var xpath = ''/html/body/table/tbody/tr/td[2]/form/div[@class="buying"]/b[@class="sans"]/text()[1]''; var title = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; - title = Scholar.Utilities.cleanString(title); + title = Zotero.Utilities.cleanString(title); if(title.lastIndexOf("(") != -1 && title.lastIndexOf(")") == title.length-1) { title = title.substring(0, title.lastIndexOf("(")-1); } @@ -141,9 +141,9 @@ function doWeb(doc, url) { xpath = ''//table[@class="searchresults"]''; } - var searchresults = Scholar.Utilities.gatherElementsOnXPath(doc, doc, xpath, nsResolver); - var items = Scholar.Utilities.getItemArray(doc, searchresults, ''^http://www\.amazon\.com/(gp/product/|exec/obidos/tg/detail/|[^/]+/dp/)'', ''^(Buy new|Hardcover|Paperback|Digital)$''); - items = Scholar.selectItems(items); + var searchresults = Zotero.Utilities.gatherElementsOnXPath(doc, doc, xpath, nsResolver); + var items = Zotero.Utilities.getItemArray(doc, searchresults, ''^http://www\.amazon\.com/(gp/product/|exec/obidos/tg/detail/|[^/]+/dp/)'', ''^(Buy new|Hardcover|Paperback|Digital)$''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -154,16 +154,16 @@ function doWeb(doc, url) { uris.push(i); } - Scholar.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, - function() { Scholar.done(); }, null); + Zotero.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, + function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); } else { scrape(doc); } }'); -REPLACE INTO "translators" VALUES ('838d8849-4ffb-9f44-3d0d-aa8a0a079afe', '2006-06-26 16:01:00', 1, 100, 4, 'WorldCat', 'Simon Kornblith', '^http://(?:new)?firstsearch\.oclc\.org/WebZ/', +REPLACE INTO "translators" VALUES ('838d8849-4ffb-9f44-3d0d-aa8a0a079afe', '2006-10-02 17:00:00', 1, 100, 4, 'WorldCat', 'Simon Kornblith', '^http://(?:new)?firstsearch\.oclc\.org/WebZ/', 'function detectWeb(doc, url) { var detailRe = /FirstSearch: [\w ]+ Detailed Record/; var searchRe = /FirstSearch: [\w ]+ List of Records/; @@ -176,18 +176,18 @@ REPLACE INTO "translators" VALUES ('838d8849-4ffb-9f44-3d0d-aa8a0a079afe', '2006 }', 'function processURLs(urls) { if(!urls.length) { // last url - Scholar.done(); + Zotero.done(); return; } var newUrl = urls.shift(); - Scholar.Utilities.HTTP.doPost(newUrl, + Zotero.Utilities.HTTP.doPost(newUrl, ''exportselect=record&exporttype=plaintext'', function(text) { var lineRegexp = new RegExp(); lineRegexp.compile("^([\\w() ]+): *(.*)$"); - var newItem = new Scholar.Item("book"); + var newItem = new Zotero.Item("book"); newItem.extra = ""; var lines = text.split(''\n''); @@ -211,7 +211,7 @@ REPLACE INTO "translators" VALUES ('838d8849-4ffb-9f44-3d0d-aa8a0a079afe', '2006 if(title.substring(title.length-2) == " /") { title = title.substring(0, title.length-2); } - newItem.title = Scholar.Utilities.capitalizeTitle(title); + newItem.title = Zotero.Utilities.capitalizeTitle(title); } else if(match[1] == "Series") { newItem.series = match[2]; } else if(match[1] == "Description") { @@ -225,7 +225,7 @@ REPLACE INTO "translators" VALUES ('838d8849-4ffb-9f44-3d0d-aa8a0a079afe', '2006 var authors = match[2].split('';''); if(authors) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(authors[0], "author", true)); + newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[0], "author", true)); for(var j=1; j<authors.length; j+=2) { if(authors[j-1].substring(0, 1) != ''('' && !yearRegexp.test(authors[j])) { // ignore places where there are parentheses @@ -233,10 +233,10 @@ REPLACE INTO "translators" VALUES ('838d8849-4ffb-9f44-3d0d-aa8a0a079afe', '2006 } } } else { - newItem.creators.push(Scholar.Utilities.cleanString(match[2])); + newItem.creators.push(Zotero.Utilities.cleanString(match[2])); } } else if(match[1] == ''Publication'') { - match[2] = Scholar.Utilities.cleanString(match[2]); + match[2] = Zotero.Utilities.cleanString(match[2]); if(match[2].substring(match[2].length-1) == '','') { match[2] = match[2].substring(0, match[2].length-1); } @@ -265,10 +265,10 @@ REPLACE INTO "translators" VALUES ('838d8849-4ffb-9f44-3d0d-aa8a0a079afe', '2006 var tags = match[2].split("--"); for(var j in tags) { - newItem.tags.push(Scholar.Utilities.cleanString(tags[j])); + newItem.tags.push(Zotero.Utilities.cleanString(tags[j])); } } else if(match[1] == "Accession No") { - newItem.accessionNumber = Scholar.Utilities.superCleanString(match[2]); + newItem.accessionNumber = Zotero.Utilities.superCleanString(match[2]); } else if(match[1] == "Degree") { newItem.itemType = "thesis"; newItem.thesisType = match[2]; @@ -334,8 +334,8 @@ function doWeb(doc, url) { urls = [''http://''+host+''/WebZ/DirectExport?numrecs=10:smartpage=directexport:entityexportnumrecs=10:entityexportresultset='' + resultset + '':entityexportrecno='' + number + '':sessionid='' + sessionid + '':entitypagenum=35:0'']; } else { - var items = Scholar.Utilities.getItemArray(doc, doc, ''/WebZ/FSFETCH\\?fetchtype=fullrecord'', ''^(See more details for locating this item|Detailed Record)$''); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, ''/WebZ/FSFETCH\\?fetchtype=fullrecord'', ''^(See more details for locating this item|Detailed Record)$''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -355,10 +355,10 @@ function doWeb(doc, url) { } processURLs(urls); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('88915634-1af6-c134-0171-56fd198235ed', '2006-06-26 21:40:00', 1, 100, 4, 'LOC/Voyager WebVoyage', 'Simon Kornblith', 'Pwebrecon\.cgi', +REPLACE INTO "translators" VALUES ('88915634-1af6-c134-0171-56fd198235ed', '2006-10-02 17:00:00', 1, 100, 4, 'LOC/Voyager WebVoyage', 'Simon Kornblith', 'Pwebrecon\.cgi', 'function detectWeb(doc, url) { var export_options = doc.forms.namedItem(''frm'').elements.namedItem(''RD'').options; for(var i in export_options) { @@ -415,9 +415,9 @@ REPLACE INTO "translators" VALUES ('88915634-1af6-c134-0171-56fd198235ed', '2006 // Go through links for(var j=0; j<links.length; j++) { if(tagRegexp.test(links[j].href)) { - var text = Scholar.Utilities.getNodeString(doc, links[j], ".//text()", null); + var text = Zotero.Utilities.getNodeString(doc, links[j], ".//text()", null); if(text) { - text = Scholar.Utilities.cleanString(text); + text = Zotero.Utilities.cleanString(text); if(!rejectRegexp.test(text)) { if(availableItems[i]) { availableItems[i] += " "+text; @@ -430,7 +430,7 @@ REPLACE INTO "translators" VALUES ('88915634-1af6-c134-0171-56fd198235ed', '2006 } } - var items = Scholar.selectItems(availableItems); + var items = Zotero.selectItems(availableItems); if(!items) { return true; } @@ -475,19 +475,19 @@ REPLACE INTO "translators" VALUES ('88915634-1af6-c134-0171-56fd198235ed', '2006 postString += ''RD=''+rd+''&MAILADDY=&SAVE=Press+to+SAVE+or+PRINT''; // No idea why this doesn''t work as post - Scholar.Utilities.HTTP.doGet(newUri+''?''+postString, function(text) { + Zotero.Utilities.HTTP.doGet(newUri+''?''+postString, function(text) { // load translator for MARC - var marc = Scholar.loadTranslator("import"); + var marc = Zotero.loadTranslator("import"); marc.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); marc.setString(text); marc.translate(); - Scholar.done(); + Zotero.done(); }) - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('d921155f-0186-1684-615c-ca57682ced9b', '2006-06-26 16:01:00', 1, 100, 4, 'JSTOR', 'Simon Kornblith', '^http://www\.jstor\.org/(?:view|browse|search/)', +REPLACE INTO "translators" VALUES ('d921155f-0186-1684-615c-ca57682ced9b', '2006-10-02 17:00:00', 1, 100, 4, 'JSTOR', 'Simon Kornblith', '^http://www\.jstor\.org/(?:view|browse|search/)', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -508,7 +508,7 @@ REPLACE INTO "translators" VALUES ('d921155f-0186-1684-615c-ca57682ced9b', '2006 }', 'function getList(urls, each, done) { var url = urls.shift(); - Scholar.Utilities.HTTP.doGet(url, function(text) { + Zotero.Utilities.HTTP.doGet(url, function(text) { if(each) { each(text); } @@ -583,7 +583,7 @@ function doWeb(doc, url) { var text = doc.evaluate(''.//strong/text()'', tableRow, null, XPathResult.ANY_TYPE, null).iterateNext(); if(text && text.nodeValue) { - text = Scholar.Utilities.cleanString(text.nodeValue); + text = Zotero.Utilities.cleanString(text.nodeValue); if(availableItems[i]) { availableItems[i] += " "+text; } else { @@ -594,7 +594,7 @@ function doWeb(doc, url) { } } - var items = Scholar.selectItems(availableItems); + var items = Zotero.selectItems(availableItems); if(!items) { return true; } @@ -618,17 +618,17 @@ function doWeb(doc, url) { } } - Scholar.Utilities.HTTP.doGet(''http://www.jstor.org/browse?citationAction=removeAll&confirmRemAll=on&viewCitations=1'', function() { // clear marked + Zotero.Utilities.HTTP.doGet(''http://www.jstor.org/browse?citationAction=removeAll&confirmRemAll=on&viewCitations=1'', function() { // clear marked // Mark all our citations getList(saveCitations, null, function() { // mark this - Scholar.Utilities.HTTP.doGet(''http://www.jstor.org/browse/citations.txt?exportAction=Save+as+Text+File&exportFormat=cm&viewCitations=1'', function(text) { + Zotero.Utilities.HTTP.doGet(''http://www.jstor.org/browse/citations.txt?exportAction=Save+as+Text+File&exportFormat=cm&viewCitations=1'', function(text) { // get marked var k = 0; var lines = text.split("\n"); var haveStarted = false; var newItemRe = /^<[0-9]+>/; - var newItem = new Scholar.Item("journalArticle"); + var newItem = new Zotero.Item("journalArticle"); newItem.attachments.push(getJSTORAttachment(viewPages[k])); for(var i in lines) { @@ -638,11 +638,11 @@ function doWeb(doc, url) { itemComplete(newItem, url); k++; - newItem = new Scholar.Item("journalArticle"); + newItem = new Zotero.Item("journalArticle"); newItem.attachments.push(getJSTORAttachment(viewPages[k])); } else if(lines[i].substring(2, 5) == " : " && haveStarted) { var fieldCode = lines[i].substring(0, 2); - var fieldContent = Scholar.Utilities.cleanString(lines[i].substring(5)) + var fieldContent = Zotero.Utilities.cleanString(lines[i].substring(5)) if(fieldCode == "TI") { if(fieldContent) { @@ -654,7 +654,7 @@ function doWeb(doc, url) { var authors = fieldContent.split(";"); for(j in authors) { if(authors[j]) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(authors[j], "author", true)); + newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[j], "author", true)); } } } else if(fieldCode == "SO") { @@ -684,15 +684,15 @@ function doWeb(doc, url) { itemComplete(newItem, url); } - Scholar.done(); + Zotero.done(); }); }); }); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('e85a3134-8c1a-8644-6926-584c8565f23e', '2006-06-26 16:01:00', 1, 100, 4, 'History Cooperative', 'Simon Kornblith', '^http://www\.historycooperative\.org/(?:journals/.+/.+/.+\.s?html$|cgi-bin/search.cgi)', +REPLACE INTO "translators" VALUES ('e85a3134-8c1a-8644-6926-584c8565f23e', '2006-10-02 17:00:00', 1, 100, 4, 'History Cooperative', 'Simon Kornblith', '^http://www\.historycooperative\.org/(?:journals/.+/.+/.+\.s?html$|cgi-bin/search.cgi)', 'function detectWeb(doc, url) { if(doc.title == "History Cooperative: Search Results") { return "multiple"; @@ -700,15 +700,15 @@ REPLACE INTO "translators" VALUES ('e85a3134-8c1a-8644-6926-584c8565f23e', '2006 return "journalArticle"; } }', -'function associateMeta(newItem, metaTags, field, scholarField) { +'function associateMeta(newItem, metaTags, field, zoteroField) { var field = metaTags.namedItem(field); if(field) { - newItem[scholarField] = field.getAttribute("content"); + newItem[zoteroField] = field.getAttribute("content"); } } function scrape(doc) { - var newItem = new Scholar.Item("journalArticle"); + var newItem = new Zotero.Item("journalArticle"); newItem.url = doc.location.href; var month, year; @@ -722,7 +722,7 @@ function scrape(doc) { if(author) { var authors = author.getAttribute("content").split(" and "); for(j in authors) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(authors[j], "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[j], "author")); } } @@ -740,8 +740,8 @@ function scrape(doc) { function doWeb(doc, url) { if(doc.title == "History Cooperative: Search Results") { - var items = Scholar.Utilities.getItemArray(doc, doc, ''^http://[^/]+/journals/.+/.+/.+\.html$''); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, ''^http://[^/]+/journals/.+/.+/.+\.html$''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -752,16 +752,16 @@ function doWeb(doc, url) { uris.push(i); } - Scholar.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, - function() { Scholar.done(); }, null); + Zotero.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, + function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); } else { scrape(doc); } }'); -REPLACE INTO "translators" VALUES ('4fd6b89b-2316-2dc4-fd87-61a97dd941e8', '2006-08-06 21:45:00', 1, 100, 4, 'InnoPAC', 'Simon Kornblith', '^http://[^/]+/(?:search/|record=)', +REPLACE INTO "translators" VALUES ('4fd6b89b-2316-2dc4-fd87-61a97dd941e8', '2006-10-02 17:00:00', 1, 100, 4, 'InnoPAC', 'Simon Kornblith', '^http://[^/]+/(?:search/|record=)', 'function detectWeb(doc, url) { // First, check to see if the URL alone reveals InnoPAC, since some sites don''t reveal the MARC button var matchRegexp = new RegExp(''^(http://[^/]+/search/[^/]+/[^/]+/1\%2C[^/]+/)frameset(.+)$''); @@ -799,7 +799,7 @@ REPLACE INTO "translators" VALUES ('4fd6b89b-2316-2dc4-fd87-61a97dd941e8', '2006 var text = newDoc.evaluate(xpath, newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); var record = new marc.record(); var linee = text.split("\n"); @@ -850,16 +850,16 @@ REPLACE INTO "translators" VALUES ('4fd6b89b-2316-2dc4-fd87-61a97dd941e8', '2006 } function pageByPage(marc, urls) { - Scholar.Utilities.processDocuments(urls, function(newDoc) { + Zotero.Utilities.processDocuments(urls, function(newDoc) { scrape(marc.getTranslatorObject(), newDoc); - }, function() { Scholar.done() }); + }, function() { Zotero.done() }); } function doWeb(doc, url) { var uri = doc.location.href; var newUri; // load translator for MARC - var marc = Scholar.loadTranslator("import"); + var marc = Zotero.loadTranslator("import"); marc.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var matchRegexp = new RegExp(''^(http://[^/]+/search/[^/]+/[^/]+/1\%2C[^/]+/)frameset(.+)$''); @@ -932,10 +932,10 @@ function doWeb(doc, url) { if(tagRegexp.test(link.href)) { if(!firstURL) firstURL = link.href; - var text = Scholar.Utilities.getNodeString(doc, link, + var text = Zotero.Utilities.getNodeString(doc, link, ".//text()", null); if(text) { - text = Scholar.Utilities.cleanString(text); + text = Zotero.Utilities.cleanString(text); if(availableItems[link.href]) { availableItems[link.href] += " "+text; } else { @@ -949,10 +949,10 @@ function doWeb(doc, url) { } }; - Scholar.Utilities.debug(urls); - Scholar.Utilities.debug(availableItems); - var items = Scholar.selectItems(availableItems); - Scholar.Utilities.debug(items); + Zotero.Utilities.debug(urls); + Zotero.Utilities.debug(availableItems); + var items = Zotero.selectItems(availableItems); + Zotero.Utilities.debug(items); if(!items) { return true; @@ -986,15 +986,15 @@ function doWeb(doc, url) { postString += "save_func=save_marked"; - Scholar.Utilities.HTTP.doGet(clearUrl, function() { - Scholar.Utilities.HTTP.doPost(postUrl, postString, function() { - Scholar.Utilities.HTTP.doPost(exportUrl, "ex_format=50&ex_device=45&SUBMIT=Submit", function(text) { + Zotero.Utilities.HTTP.doGet(clearUrl, function() { + Zotero.Utilities.HTTP.doPost(postUrl, postString, function() { + Zotero.Utilities.HTTP.doPost(exportUrl, "ex_format=50&ex_device=45&SUBMIT=Submit", function(text) { var notSpace = /[^\s]/ if(notSpace.test(text)) { marc.setString(text); marc.translate(); - Scholar.done(); + Zotero.done(); } else { pageByPage(marc, newUrls); } @@ -1006,10 +1006,10 @@ function doWeb(doc, url) { } } - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('add7c71c-21f3-ee14-d188-caf9da12728b', '2006-06-26 16:01:00', 1, 100, 4, 'SIRSI 2003+', 'Simon Kornblith', '/uhtbin/cgisirsi', +REPLACE INTO "translators" VALUES ('add7c71c-21f3-ee14-d188-caf9da12728b', '2006-10-02 17:00:00', 1, 100, 4, 'SIRSI 2003+', 'Simon Kornblith', '/uhtbin/cgisirsi', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -1038,7 +1038,7 @@ REPLACE INTO "translators" VALUES ('add7c71c-21f3-ee14-d188-caf9da12728b', '2006 return false; } - var newItem = new Scholar.Item("book"); + var newItem = new Zotero.Item("book"); newItem.extra = ""; while(elmt) { @@ -1049,9 +1049,9 @@ REPLACE INTO "translators" VALUES ('add7c71c-21f3-ee14-d188-caf9da12728b', '2006 } if(node) { - var casedField = Scholar.Utilities.superCleanString(doc.evaluate(''./TH[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); + var casedField = Zotero.Utilities.superCleanString(doc.evaluate(''./TH[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); field = casedField.toLowerCase(); - var value = Scholar.Utilities.superCleanString(node.nodeValue); + var value = Zotero.Utilities.superCleanString(node.nodeValue); if(field == "publisher") { newItem.publisher = value; } else if(field == "pub date") { @@ -1064,14 +1064,14 @@ REPLACE INTO "translators" VALUES ('add7c71c-21f3-ee14-d188-caf9da12728b', '2006 newItem.ISBN = m[0]; } else if(field == "title") { var titleParts = value.split(" / "); - newItem.title = Scholar.Utilities.capitalizeTitle(titleParts[0]); + newItem.title = Zotero.Utilities.capitalizeTitle(titleParts[0]); } else if(field == "publication info") { var pubParts = value.split(" : "); newItem.place = pubParts[0]; } else if(field == "personal author") { - newItem.creators.push(Scholar.Utilities.cleanAuthor(value, "author", true)); + newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "author", true)); } else if(field == "added author") { - newItem.creators.push(Scholar.Utilities.cleanAuthor(value, "contributor", true)); + newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "contributor", true)); } else if(field == "corporate author") { newItem.creators.push({lastName:author}); } else if(field == "subject term" || field == "corporate subject" || field == "geographic term") { @@ -1118,13 +1118,13 @@ function doWeb(doc, url) { // Go through table rows while(tableRow = tableRows.iterateNext()) { var input = doc.evaluate(''.//input[@value="Details"]'', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); - var text = Scholar.Utilities.getNodeString(doc, tableRow, ''.//label/strong//text()'', nsResolver); + var text = Zotero.Utilities.getNodeString(doc, tableRow, ''.//label/strong//text()'', nsResolver); if(text) { availableItems[input.name] = text; } } - var items = Scholar.selectItems(availableItems); + var items = Zotero.selectItems(availableItems); if(!items) { return true; @@ -1140,14 +1140,14 @@ function doWeb(doc, url) { uris.push(baseUrl+"&"+i+"=Details"); } - Scholar.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, - function() { Scholar.done() }, null); + Zotero.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, + function() { Zotero.done() }, null); - Scholar.wait(); + Zotero.wait(); } }'); -REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006-06-26 16:01:00', 1, 100, 4, 'ProQuest', 'Simon Kornblith', '^http://[^/]+/pqdweb\?((?:.*\&)?did=.*&Fmt=[0-9]|(?:.*\&)Fmt=[0-9].*&did=|(?:.*\&)searchInterface=)', +REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006-10-02 17:00:00', 1, 100, 4, 'ProQuest', 'Simon Kornblith', '^http://[^/]+/pqdweb\?((?:.*\&)?did=.*&Fmt=[0-9]|(?:.*\&)Fmt=[0-9].*&did=|(?:.*\&)searchInterface=)', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -1169,21 +1169,21 @@ REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006 if (prefix == ''x'') return namespace; else return null; } : null; - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); var elmt; // Title var xpath = ''/html/body/span[@class="textMedium"]/table/tbody/tr/td[@class="headerBlack"]/strong//text()''; - newItem.title = Scholar.Utilities.getNodeString(doc, doc, xpath, nsResolver); + newItem.title = Zotero.Utilities.getNodeString(doc, doc, xpath, nsResolver); // Authors var xpath = ''/html/body/span[@class="textMedium"]/table/tbody/tr/td[@class="textMedium"]/a/em''; var elmts = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null); while(elmt = elmts.iterateNext()) { // there are sometimes additional tags representing higlighting - var author = Scholar.Utilities.getNodeString(doc, elmt, ''.//text()'', nsResolver); + var author = Zotero.Utilities.getNodeString(doc, elmt, ''.//text()'', nsResolver); if(author) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(author, "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } @@ -1191,16 +1191,16 @@ REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006 var xpath = ''/html/body/span[@class="textMedium"]/font/table/tbody/tr''; var elmts = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null); while(elmt = elmts.iterateNext()) { - var field = Scholar.Utilities.superCleanString(doc.evaluate(''./TD[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue).toLowerCase(); + var field = Zotero.Utilities.superCleanString(doc.evaluate(''./TD[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue).toLowerCase(); if(field == "publication title") { var publication = doc.evaluate(''./TD[2]/A[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(publication.nodeValue) { - newItem.publicationTitle = Scholar.Utilities.superCleanString(publication.nodeValue); + newItem.publicationTitle = Zotero.Utilities.superCleanString(publication.nodeValue); } var place = doc.evaluate(''./TD[2]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(place.nodeValue) { - newItem.place = Scholar.Utilities.superCleanString(place.nodeValue); + newItem.place = Zotero.Utilities.superCleanString(place.nodeValue); } var date = doc.evaluate(''./TD[2]/A[2]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); @@ -1210,7 +1210,7 @@ REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006 var moreInfo = doc.evaluate(''./TD[2]/text()[2]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(moreInfo.nodeValue) { - moreInfo = Scholar.Utilities.superCleanString(moreInfo.nodeValue); + moreInfo = Zotero.Utilities.superCleanString(moreInfo.nodeValue); var parts = moreInfo.split(";\xA0"); var issueRegexp = /^(\w+)\.(?: |\xA0)?(.+)$/ @@ -1220,13 +1220,13 @@ REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006 if(m) { var info = m[1].toLowerCase(); if(info == "vol") { - newItem.volume = Scholar.Utilities.superCleanString(m[2]); + newItem.volume = Zotero.Utilities.superCleanString(m[2]); } else if(info == "iss" || info == "no") { - newItem.issue = Scholar.Utilities.superCleanString(m[2]); + newItem.issue = Zotero.Utilities.superCleanString(m[2]); } } } - if(parts[1] && Scholar.Utilities.superCleanString(parts[1]).substring(0, 3).toLowerCase() == "pg.") { + if(parts[1] && Zotero.Utilities.superCleanString(parts[1]).substring(0, 3).toLowerCase() == "pg.") { var re = /[0-9\-]+/; var m = re.exec(parts[1]); @@ -1238,7 +1238,7 @@ REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006 } else if(field == "source type") { var value = doc.evaluate(''./TD[2]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(value.nodeValue) { - value = Scholar.Utilities.superCleanString(value.nodeValue).toLowerCase(); + value = Zotero.Utilities.superCleanString(value.nodeValue).toLowerCase(); if(value.indexOf("periodical") >= 0) { newItem.itemType = "magazineArticle"; @@ -1252,7 +1252,7 @@ REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006 var value = doc.evaluate(''./TD[2]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(value) { var type; - value = Scholar.Utilities.superCleanString(value.nodeValue); + value = Zotero.Utilities.superCleanString(value.nodeValue); if(value.length == 10 || value.length == 13) { newItem.ISBN = value; } else if(value.length == 8) { @@ -1262,19 +1262,19 @@ REPLACE INTO "translators" VALUES ('a77690cf-c5d1-8fc4-110f-d1fc765dcf88', '2006 } else if(field == "document url") { var value = doc.evaluate(''./TD[2]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(value) { - newItem.url = Scholar.Utilities.cleanString(value.nodeValue); + newItem.url = Zotero.Utilities.cleanString(value.nodeValue); } } else if(field == "proquest document id") { var value = doc.evaluate(''./TD[2]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(value) { - newItem.accessionNumber = Scholar.Utilities.cleanString(value.nodeValue); + newItem.accessionNumber = Zotero.Utilities.cleanString(value.nodeValue); } } else if(field == "subjects" || field == "people" || field == "locations") { var subjects = doc.evaluate(".//a", elmt, nsResolver, XPathResult.ANY_TYPE, null); var currentSubject; while(currentSubject = subjects.iterateNext()) { - var subjectValue = Scholar.Utilities.getNodeString(doc, currentSubject, ".//text()", nsResolver); - subjectValue = Scholar.Utilities.superCleanString(subjectValue); + var subjectValue = Zotero.Utilities.getNodeString(doc, currentSubject, ".//text()", nsResolver); + subjectValue = Zotero.Utilities.superCleanString(subjectValue); if(subjectValue) { newItem.tags.push(subjectValue); } @@ -1338,14 +1338,14 @@ function doWeb(doc, url) { if(tagRegexp.test(links[j].href)) { var text = doc.evaluate(''.//a[@class="bold"]/text()'', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(text && text.nodeValue) { - text = Scholar.Utilities.cleanString(text.nodeValue); + text = Zotero.Utilities.cleanString(text.nodeValue); items[links[j].href] = text; } break; } } } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; @@ -1356,10 +1356,10 @@ function doWeb(doc, url) { urls.push(i); } - Scholar.Utilities.processDocuments(urls, function(doc) { scrape(doc) }, - function() { Scholar.done(); }, null); + Zotero.Utilities.processDocuments(urls, function(doc) { scrape(doc) }, + function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); } else { if(doc.evaluate(''/html/body/span[@class="textMedium"]/table/tbody/tr/td[@class="headerBlack"]/strong//text()'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { @@ -1367,13 +1367,13 @@ function doWeb(doc, url) { } else { var newURL = doc.location.href.replace(/RQT=[0-9]+/i, "RQT=309"); newURL = newURL.replace(/Fmt=[0-9]+/i, "Fmt=1"); - Scholar.Utilities.loadDocument(newURL, function(doc) { scrape(doc); Scholar.done(); }, null); - Scholar.wait(); + Zotero.Utilities.loadDocument(newURL, function(doc) { scrape(doc); Zotero.done(); }, null); + Zotero.wait(); } } }'); -REPLACE INTO "translators" VALUES ('6773a9af-5375-3224-d148-d32793884dec', '2006-06-26 16:01:00', 1, 100, 4, 'InfoTrac College Edition', 'Simon Kornblith', '^http://infotrac-college\.thomsonlearning\.com/itw/infomark/', +REPLACE INTO "translators" VALUES ('6773a9af-5375-3224-d148-d32793884dec', '2006-10-02 17:00:00', 1, 100, 4, 'InfoTrac College Edition', 'Simon Kornblith', '^http://infotrac-college\.thomsonlearning\.com/itw/infomark/', 'function detectWeb(doc, url) { if(doc.title.substring(0, 8) == "Article ") { return "magazineArticle"; @@ -1382,18 +1382,18 @@ REPLACE INTO "translators" VALUES ('6773a9af-5375-3224-d148-d32793884dec', '2006 } }', 'function extractCitation(url, elmts, title, doc) { - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); newItem.url = url; if(title) { - newItem.title = Scholar.Utilities.superCleanString(title); + newItem.title = Zotero.Utilities.superCleanString(title); } while(elmt = elmts.iterateNext()) { var colon = elmt.nodeValue.indexOf(":"); var field = elmt.nodeValue.substring(1, colon).toLowerCase(); var value = elmt.nodeValue.substring(colon+1, elmt.nodeValue.length-1); if(field == "title") { - newItem.title = Scholar.Utilities.superCleanString(value); + newItem.title = Zotero.Utilities.superCleanString(value); } else if(field == "journal") { newItem.publicationTitle = value; } else if(field == "pi") { @@ -1451,7 +1451,7 @@ REPLACE INTO "translators" VALUES ('6773a9af-5375-3224-d148-d32793884dec', '2006 newItem.date = date.substring(1); } } else if(field == "author") { - newItem.creators.push(Scholar.Utilities.cleanAuthor(value, "author", true)); + newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "author", true)); } } @@ -1504,7 +1504,7 @@ function doWeb(doc, url) { i++; } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; @@ -1516,7 +1516,7 @@ function doWeb(doc, url) { } }'); -REPLACE INTO "translators" VALUES ('63c25c45-6257-4985-9169-35b785a2995e', '2006-08-24 14:11:00', 1, 100, 4, 'InfoTrac OneFile', 'Simon Kornblith', '^https?://[^/]+/itx/(?:[a-z]+Search|retrieve|paginate|tab)\.do', +REPLACE INTO "translators" VALUES ('63c25c45-6257-4985-9169-35b785a2995e', '2006-10-02 17:00:00', 1, 100, 4, 'InfoTrac OneFile', 'Simon Kornblith', '^https?://[^/]+/itx/(?:[a-z]+Search|retrieve|paginate|tab)\.do', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -1535,7 +1535,7 @@ REPLACE INTO "translators" VALUES ('63c25c45-6257-4985-9169-35b785a2995e', '2006 }', 'function infoTracRIS(text) { // load translator for RIS - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setString(text); translator.setHandler("itemDone", function(obj, item) { @@ -1564,11 +1564,11 @@ REPLACE INTO "translators" VALUES ('63c25c45-6257-4985-9169-35b785a2995e', '2006 } //item.attachments = newAttachments.shift(); - //Scholar.Utilities.debug(item.attachments); + //Zotero.Utilities.debug(item.attachments); item.complete(); }); translator.translate(); - Scholar.done(); + Zotero.done(); } function readEncoded(url) { @@ -1596,8 +1596,8 @@ function doWeb(doc, url) { if(doc.evaluate(''//table[@class="resultstable"][tbody/tr[@class="unselectedRow"]]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { - var items = Scholar.Utilities.getItemArray(doc, doc, ''^http://[^/]+/itx/retrieve\\.do\\?.*docId=''); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, ''^http://[^/]+/itx/retrieve\\.do\\?.*docId=''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -1613,11 +1613,11 @@ function doWeb(doc, url) { } var postData = "inPS=true&ts="+time+"&prodId="+postVal.prodId+"&actionCmd=UPDATE_MARK_LIST&userGroupName="+postVal.userGroupName+"&markedString="+markedString+"&a="+time; - Scholar.Utilities.HTTP.doGet(host+"itx/marklist.do?inPS=true&ts="+time+"&prodId="+postVal.prodId+"&actionCmd=CLEAR_MARK_LIST&userGroupName="+postVal.userGroupName, + Zotero.Utilities.HTTP.doGet(host+"itx/marklist.do?inPS=true&ts="+time+"&prodId="+postVal.prodId+"&actionCmd=CLEAR_MARK_LIST&userGroupName="+postVal.userGroupName, function(text) { // clear marked - Scholar.Utilities.HTTP.doPost(host+"itx/marklist.do", postData, + Zotero.Utilities.HTTP.doPost(host+"itx/marklist.do", postData, function(text) { // mark - Scholar.Utilities.HTTP.doGet(host+"itx/generateCitation.do?contentSet="+postVal.contentSet+"&inPS=true&tabID=T-ALL&prodId="+postVal.prodId+"&docId=&actionString=FormatCitation&userGroupName="+postVal.userGroupName+"&citationFormat=ENDNOTE", + Zotero.Utilities.HTTP.doGet(host+"itx/generateCitation.do?contentSet="+postVal.contentSet+"&inPS=true&tabID=T-ALL&prodId="+postVal.prodId+"&docId=&actionString=FormatCitation&userGroupName="+postVal.userGroupName+"&citationFormat=ENDNOTE", function(text) { // get marked infoTracRIS(text); }); @@ -1626,16 +1626,16 @@ function doWeb(doc, url) { } else { // just extract from single page var postVal = readEncoded(url); - Scholar.Utilities.HTTP.doGet(host+"itx/generateCitation.do?contentSet="+postVal.contentSet+"&inPS=true&tabID="+postVal.tabID+"&prodId="+postVal.prodId+"&docId="+postVal.docId+"&actionString=FormatCitation&citationFormat=ENDNOTE", + Zotero.Utilities.HTTP.doGet(host+"itx/generateCitation.do?contentSet="+postVal.contentSet+"&inPS=true&tabID="+postVal.tabID+"&prodId="+postVal.prodId+"&docId="+postVal.docId+"&actionString=FormatCitation&citationFormat=ENDNOTE", function(text) { infoTracRIS(text); }); } - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('b047a13c-fe5c-6604-c997-bef15e502b09', '2006-06-26 16:01:00', 1, 100, 4, 'LexisNexis', 'Simon Kornblith', '^http://web\.lexis-?nexis\.com/universe/(?:document|doclist)', +REPLACE INTO "translators" VALUES ('b047a13c-fe5c-6604-c997-bef15e502b09', '2006-10-02 17:00:00', 1, 100, 4, 'LexisNexis', 'Simon Kornblith', '^http://web\.lexis-?nexis\.com/universe/(?:document|doclist)', 'function detectWeb(doc, url) { var detailRe = new RegExp("^http://[^/]+/universe/document"); if(detailRe.test(doc.location.href)) { @@ -1645,7 +1645,7 @@ REPLACE INTO "translators" VALUES ('b047a13c-fe5c-6604-c997-bef15e502b09', '2006 } }', 'function scrape(doc) { - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); newItem.attachments.push({document:doc, title:"LexisNexis Full Text", downloadable:true}); @@ -1681,12 +1681,12 @@ REPLACE INTO "translators" VALUES ('b047a13c-fe5c-6604-c997-bef15e502b09', '2006 citationData = citationDataDiv.innerHTML; } - citationData = Scholar.Utilities.cleanTags(citationData); + citationData = Zotero.Utilities.cleanTags(citationData); var headlineRegexp = /\n(?:HEADLINE|TITLE|ARTICLE): ([^\n]+)\n/; var m = headlineRegexp.exec(citationData); if(m) { - newItem.title = Scholar.Utilities.cleanTags(m[1]); + newItem.title = Zotero.Utilities.cleanTags(m[1]); } var bylineRegexp = /\nBYLINE: *(\w[\w\- ]+)/; @@ -1695,7 +1695,7 @@ REPLACE INTO "translators" VALUES ('b047a13c-fe5c-6604-c997-bef15e502b09', '2006 if(m[1].substring(0, 3).toLowerCase() == "by ") { m[1] = m[1].substring(3); } - newItem.creators.push(Scholar.Utilities.cleanAuthor(m[1], "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(m[1], "author")); newItem.itemType = "newspaperArticle"; } else { // no byline; must be a journal @@ -1708,7 +1708,7 @@ REPLACE INTO "translators" VALUES ('b047a13c-fe5c-6604-c997-bef15e502b09', '2006 if(m) { var authors = m[1].split(/, (?:and )?/); for(var i in authors) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(authors[i].replace(" *", ""), "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[i].replace(" *", ""), "author")); } } @@ -1720,8 +1720,8 @@ function doWeb(doc, url) { if(detailRe.test(doc.location.href)) { scrape(doc); } else { - var items = Scholar.Utilities.getItemArray(doc, doc, "^http://[^/]+/universe/document"); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, "^http://[^/]+/universe/document"); + items = Zotero.selectItems(items); if(!items) { return true; @@ -1732,14 +1732,14 @@ function doWeb(doc, url) { uris.push(i); } - Scholar.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, - function() { Scholar.done(); }, null); + Zotero.Utilities.processDocuments(uris, function(doc) { scrape(doc) }, + function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); } }'); -REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006-06-26 16:01:00', 1, 100, 4, 'Aleph', 'Simon Kornblith', '^http://[^/]+/F(?:/[A-Z0-9\-]+(?:\?.*)?$|\?func=find|\?func=scan)', +REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006-10-02 17:00:00', 1, 100, 4, 'Aleph', 'Simon Kornblith', '^http://[^/]+/F(?:/[A-Z0-9\-]+(?:\?.*)?$|\?func=find|\?func=scan)', 'function detectWeb(doc, url) { var singleRe = new RegExp("^http://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=[0-9]{3}|func=direct)"); @@ -1763,7 +1763,7 @@ REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006 newUris.push(uri.replace(/\&format=[0-9]{3}/, "&format=001")) } else { var itemRegexp = ''^http://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=999|func=direct)'' - var items = Scholar.Utilities.getItemArray(doc, doc, itemRegexp, ''^[0-9]+$''); + var items = Zotero.Utilities.getItemArray(doc, doc, itemRegexp, ''^[0-9]+$''); // ugly hack to see if we have any items var haveItems = false; @@ -1774,10 +1774,10 @@ REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006 // If we don''t have any items otherwise, let us use the numbers if(!haveItems) { - var items = Scholar.Utilities.getItemArray(doc, doc, itemRegexp); + var items = Zotero.Utilities.getItemArray(doc, doc, itemRegexp); } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; @@ -1792,10 +1792,10 @@ REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006 } } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var marc = translator.getTranslatorObject(); - Scholar.Utilities.processDocuments(newUris, function(newDoc) { + Zotero.Utilities.processDocuments(newUris, function(newDoc) { var uri = newDoc.location.href; var namespace = newDoc.documentElement.namespaceURI; @@ -1809,8 +1809,8 @@ REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006 var record = new marc.record(); while(elmt = elmts.iterateNext()) { - var field = Scholar.Utilities.superCleanString(doc.evaluate(''./TD[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); - var value = Scholar.Utilities.getNodeString(doc, elmt, ''./TD[2]//text()'', nsResolver); + var field = Zotero.Utilities.superCleanString(doc.evaluate(''./TD[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); + var value = Zotero.Utilities.getNodeString(doc, elmt, ''./TD[2]//text()'', nsResolver); if(field == "LDR") { record.leader = value; @@ -1830,15 +1830,15 @@ REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006 } } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); record.translate(newItem); newItem.complete(); - }, function() { Scholar.done(); }, null); + }, function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('774d7dc2-3474-2684-392c-f787789ec63d', '2006-06-26 16:01:00', 1, 100, 4, 'Dynix', 'Simon Kornblith', 'ipac\.jsp\?.*(?:uri=full=[0-9]|menu=search)', +REPLACE INTO "translators" VALUES ('774d7dc2-3474-2684-392c-f787789ec63d', '2006-10-02 17:00:00', 1, 100, 4, 'Dynix', 'Simon Kornblith', 'ipac\.jsp\?.*(?:uri=full=[0-9]|menu=search)', 'function detectWeb(doc, url) { var detailsRe = new RegExp(''ipac\.jsp\?.*uri=full=[0-9]''); if(detailsRe.test(doc.location.href)) { @@ -1860,8 +1860,8 @@ REPLACE INTO "translators" VALUES ('774d7dc2-3474-2684-392c-f787789ec63d', '2006 if(detailsRe.test(uri)) { uris.push(uri+''&fullmarc=true''); } else { - var items = Scholar.Utilities.getItemArray(doc, doc, "ipac\.jsp\?.*uri=full=[0-9]|^javascript:buildNewList\\(''.*uri%3Dfull%3D[0-9]"); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, "ipac\.jsp\?.*uri=full=[0-9]|^javascript:buildNewList\\(''.*uri%3Dfull%3D[0-9]"); + items = Zotero.selectItems(items); if(!items) { return true; @@ -1880,11 +1880,11 @@ REPLACE INTO "translators" VALUES ('774d7dc2-3474-2684-392c-f787789ec63d', '2006 } } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var marc = translator.getTranslatorObject(); - Scholar.Utilities.processDocuments(uris, function(newDoc) { + Zotero.Utilities.processDocuments(uris, function(newDoc) { var uri = newDoc.location.href; var namespace = newDoc.documentElement.namespaceURI; @@ -1898,8 +1898,8 @@ REPLACE INTO "translators" VALUES ('774d7dc2-3474-2684-392c-f787789ec63d', '2006 var record = new marc.record(); while(elmt = elmts.iterateNext()) { - var field = Scholar.Utilities.superCleanString(newDoc.evaluate(''./TD[1]/A[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); - var value = Scholar.Utilities.getNodeString(newDoc, elmt, ''./TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/A[1]//text()'', nsResolver); + var field = Zotero.Utilities.superCleanString(newDoc.evaluate(''./TD[1]/A[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); + var value = Zotero.Utilities.getNodeString(newDoc, elmt, ''./TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/A[1]//text()'', nsResolver); if(field == "LDR") { record.leader = value; @@ -1919,15 +1919,15 @@ REPLACE INTO "translators" VALUES ('774d7dc2-3474-2684-392c-f787789ec63d', '2006 } } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); record.translate(newItem); newItem.complete(); - }, function() { Scholar.done() }, null); + }, function() { Zotero.done() }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('63a0a351-3131-18f4-21aa-f46b9ac51d87', '2006-06-26 16:01:00', 1, 100, 4, 'VTLS', 'Simon Kornblith', '/chameleon(?:\?|$)', +REPLACE INTO "translators" VALUES ('63a0a351-3131-18f4-21aa-f46b9ac51d87', '2006-10-02 17:00:00', 1, 100, 4, 'VTLS', 'Simon Kornblith', '/chameleon(?:\?|$)', 'function detectWeb(doc, url) { var node = doc.evaluate(''//tr[@class="intrRow"]/td/table/tbody/tr[th]'', doc, null, XPathResult.ANY_TYPE, null).iterateNext(); if(node) { @@ -1983,32 +1983,32 @@ REPLACE INTO "translators" VALUES ('63a0a351-3131-18f4-21aa-f46b9ac51d87', '2006 var header = doc.evaluate(''./th/text()'', fields[j], nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(header.nodeValue == "Title") { - var value = Scholar.Utilities.getNodeString(doc, fields[j], ''./td//text()'', nsResolver); + var value = Zotero.Utilities.getNodeString(doc, fields[j], ''./td//text()'', nsResolver); if(value) { - items[url] = Scholar.Utilities.cleanString(value); + items[url] = Zotero.Utilities.cleanString(value); } } } } } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; } for(var i in items) { - Scholar.Utilities.debug(i.replace(/function=[A-Z]{7}/, "function=MARCSCR")); + Zotero.Utilities.debug(i.replace(/function=[A-Z]{7}/, "function=MARCSCR")); newUris.push(i.replace(/function=[A-Z]{7}/, "function=MARCSCR")); } } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var marc = translator.getTranslatorObject(); - Scholar.Utilities.processDocuments(newUris, function(newDoc) { + Zotero.Utilities.processDocuments(newUris, function(newDoc) { var uri = newDoc.location.href var namespace = newDoc.documentElement.namespaceURI; @@ -2032,15 +2032,15 @@ REPLACE INTO "translators" VALUES ('63a0a351-3131-18f4-21aa-f46b9ac51d87', '2006 record.addField(field, ind1+ind2, value); } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); record.translate(newItem); newItem.complete(); - }, function(){ Scholar.done(); }, null); + }, function(){ Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('fb12ae9e-f473-cab4-0546-27ab88c64101', '2006-06-26 16:01:00', 1, 100, 4, 'DRA', 'Simon Kornblith', '/web2/tramp2\.exe/(?:see\_record/|authority\_hits/|goto/.*\?.*screen=Record\.html)', +REPLACE INTO "translators" VALUES ('fb12ae9e-f473-cab4-0546-27ab88c64101', '2006-10-02 17:00:00', 1, 100, 4, 'DRA', 'Simon Kornblith', '/web2/tramp2\.exe/(?:see\_record/|authority\_hits/|goto/.*\?.*screen=Record\.html)', 'function detectWeb(doc, url) { if(doc.location.href.indexOf("/authority_hits") > 0) { return "multiple"; @@ -2057,12 +2057,12 @@ REPLACE INTO "translators" VALUES ('fb12ae9e-f473-cab4-0546-27ab88c64101', '2006 if (prefix == ''x'') return namespace; else return null; } : null; - checkItems = Scholar.Utilities.gatherElementsOnXPath(doc, doc, "/html/body//ol/li", nsResolver); + checkItems = Zotero.Utilities.gatherElementsOnXPath(doc, doc, "/html/body//ol/li", nsResolver); } if(checkItems && checkItems.length) { - var items = Scholar.Utilities.getItemArray(doc, checkItems, ''https?://.*/web2/tramp2\.exe/see_record''); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, checkItems, ''https?://.*/web2/tramp2\.exe/see_record''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -2089,23 +2089,23 @@ REPLACE INTO "translators" VALUES ('fb12ae9e-f473-cab4-0546-27ab88c64101', '2006 // Keep track of how many requests have been completed var j = 0; - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); - Scholar.Utilities.HTTP.doGet(newUri, function(text) { + Zotero.Utilities.HTTP.doGet(newUri, function(text) { translator.setString(text); translator.translate(); j++; if(j == uris.length) { - Scholar.done(); + Zotero.done(); } }); } - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('c0e6fda6-0ecd-e4f4-39ca-37a4de436e15', '2006-06-26 16:01:00', 1, 100, 4, 'GEAC', 'Simon Kornblith', '/(?:GeacQUERY|GeacFETCH[\:\?].*[&:]next=html/(?:record\.html|geacnffull\.html))', +REPLACE INTO "translators" VALUES ('c0e6fda6-0ecd-e4f4-39ca-37a4de436e15', '2006-10-02 17:00:00', 1, 100, 4, 'GEAC', 'Simon Kornblith', '/(?:GeacQUERY|GeacFETCH[\:\?].*[&:]next=html/(?:record\.html|geacnffull\.html))', 'function detectWeb(doc, url) { if(doc.location.href.indexOf("/GeacQUERY") > 0) { return "multiple"; @@ -2119,8 +2119,8 @@ REPLACE INTO "translators" VALUES ('c0e6fda6-0ecd-e4f4-39ca-37a4de436e15', '2006 var uris = new Array(); if(uri.indexOf("/GeacQUERY") > 0) { - var items = Scholar.Utilities.getItemArray(doc, doc, "(?:Geac)?FETCH[\:\?].*[&:]next=html/(?:record\.html|geacnffull\.html)"); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, "(?:Geac)?FETCH[\:\?].*[&:]next=html/(?:record\.html|geacnffull\.html)"); + items = Zotero.selectItems(items); if(!items) { return true; @@ -2138,11 +2138,11 @@ REPLACE INTO "translators" VALUES ('c0e6fda6-0ecd-e4f4-39ca-37a4de436e15', '2006 uris.push(newUri); } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var marc = translator.getTranslatorObject(); - Scholar.Utilities.processDocuments(uris, function(newDoc) { + Zotero.Utilities.processDocuments(uris, function(newDoc) { var uri = newDoc.location.href; var namespace = newDoc.documentElement.namespaceURI; @@ -2186,15 +2186,15 @@ REPLACE INTO "translators" VALUES ('c0e6fda6-0ecd-e4f4-39ca-37a4de436e15', '2006 } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); record.translate(newItem); newItem.complete(); - }, function() { Scholar.done(); }, null); + }, function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('5287d20c-8a13-6004-4dcb-5bb2b66a9cc9', '2006-06-26 16:01:00', 1, 100, 4, 'SIRSI -2003', 'Simon Kornblith', '/uhtbin/cgisirsi', +REPLACE INTO "translators" VALUES ('5287d20c-8a13-6004-4dcb-5bb2b66a9cc9', '2006-10-02 17:00:00', 1, 100, 4, 'SIRSI -2003', 'Simon Kornblith', '/uhtbin/cgisirsi', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -2205,7 +2205,7 @@ REPLACE INTO "translators" VALUES ('5287d20c-8a13-6004-4dcb-5bb2b66a9cc9', '2006 XPathResult.ANY_TYPE, null); var elmt; while(elmt = elmts.iterateNext()) { - if(Scholar.Utilities.superCleanString(elmt.nodeValue) == "Viewing record") { + if(Zotero.Utilities.superCleanString(elmt.nodeValue) == "Viewing record") { return "book"; } } @@ -2243,15 +2243,15 @@ REPLACE INTO "translators" VALUES ('5287d20c-8a13-6004-4dcb-5bb2b66a9cc9', '2006 var checkbox = doc.evaluate(''.//input[@type="checkbox"]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); // Collect title - var title = Scholar.Utilities.getNodeString(doc, elmt, "./td[2]/text()", nsResolver); + var title = Zotero.Utilities.getNodeString(doc, elmt, "./td[2]/text()", nsResolver); if(checkbox && title) { - items[checkbox.name] = Scholar.Utilities.cleanString(title); + items[checkbox.name] = Zotero.Utilities.cleanString(title); } } while(elmt = elmts.iterateNext()); - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; @@ -2269,18 +2269,18 @@ REPLACE INTO "translators" VALUES ('5287d20c-8a13-6004-4dcb-5bb2b66a9cc9', '2006 XPathResult.ANY_TYPE, null); while(elmt = elmts.iterateNext()) { var initialText = doc.evaluate(''./text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); - if(initialText && initialText.nodeValue && Scholar.Utilities.superCleanString(initialText.nodeValue) == "Viewing record") { + if(initialText && initialText.nodeValue && Zotero.Utilities.superCleanString(initialText.nodeValue) == "Viewing record") { recNumbers.push(doc.evaluate(''./b[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); break; } } } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var marc = translator.getTranslatorObject(); - Scholar.Utilities.loadDocument(newUri+''?marks=''+recNumbers.join(",")+''&shadow=NO&format=FLAT+ASCII&sort=TITLE&vopt_elst=ALL&library=ALL&display_rule=ASCENDING&duedate_code=l&holdcount_code=t&DOWNLOAD_x=22&DOWNLOAD_y=12&address=&form_type='', function(doc) { + Zotero.Utilities.loadDocument(newUri+''?marks=''+recNumbers.join(",")+''&shadow=NO&format=FLAT+ASCII&sort=TITLE&vopt_elst=ALL&library=ALL&display_rule=ASCENDING&duedate_code=l&holdcount_code=t&DOWNLOAD_x=22&DOWNLOAD_y=12&address=&form_type='', function(doc) { var pre = doc.getElementsByTagName("pre"); var text = pre[0].textContent; @@ -2316,22 +2316,22 @@ REPLACE INTO "translators" VALUES ('5287d20c-8a13-6004-4dcb-5bb2b66a9cc9', '2006 if(tag == "000") { tag = undefined; record.leader = "00000"+content; - Scholar.Utilities.debug("the leader is: "+record.leader); + Zotero.Utilities.debug("the leader is: "+record.leader); } } } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); record.translate(newItem); newItem.complete(); } - Scholar.done(); + Zotero.done(); }); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('0f9fc2fc-306e-5204-1117-25bca009dffc', '2006-06-26 16:01:00', 1, 100, 4, 'TLC/YouSeeMore', 'Simon Kornblith', 'TLCScripts/interpac\.dll\?(?:.*LabelDisplay.*RecordNumber=[0-9]|Search|ItemTitles)', +REPLACE INTO "translators" VALUES ('0f9fc2fc-306e-5204-1117-25bca009dffc', '2006-10-02 17:00:00', 1, 100, 4, 'TLC/YouSeeMore', 'Simon Kornblith', 'TLCScripts/interpac\.dll\?(?:.*LabelDisplay.*RecordNumber=[0-9]|Search|ItemTitles)', 'function detectWeb(doc, url) { var detailRe = new RegExp("TLCScripts/interpac\.dll\?.*LabelDisplay.*RecordNumber=[0-9]"); if(detailRe.test(doc.location.href)) { @@ -2353,8 +2353,8 @@ REPLACE INTO "translators" VALUES ('0f9fc2fc-306e-5204-1117-25bca009dffc', '2006 if(detailRe.test(uri)) { newUris.push(uri.replace("LabelDisplay", "MARCDisplay")); } else { - var items = Scholar.Utilities.getItemArray(doc, doc, ''TLCScripts/interpac\.dll\?.*LabelDisplay.*RecordNumber=[0-9]''); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, ''TLCScripts/interpac\.dll\?.*LabelDisplay.*RecordNumber=[0-9]''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -2365,11 +2365,11 @@ REPLACE INTO "translators" VALUES ('0f9fc2fc-306e-5204-1117-25bca009dffc', '2006 } } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var marc = translator.getTranslatorObject(); - Scholar.Utilities.processDocuments(newUris, function(newDoc) { + Zotero.Utilities.processDocuments(newUris, function(newDoc) { var uri = newDoc.location.href; var namespace = newDoc.documentElement.namespaceURI; @@ -2413,15 +2413,15 @@ REPLACE INTO "translators" VALUES ('0f9fc2fc-306e-5204-1117-25bca009dffc', '2006 } } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); record.translate(newItem); newItem.complete(); - }, function() {Scholar.done(); }, null); + }, function() {Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('c54d1932-73ce-dfd4-a943-109380e06574', '2006-06-26 16:01:00', 1, 100, 4, 'Project MUSE', 'Simon Kornblith', '^http://muse\.jhu\.edu/(?:journals/[^/]+/[^/]+/[^/]+\.html|search/pia.cgi)', +REPLACE INTO "translators" VALUES ('c54d1932-73ce-dfd4-a943-109380e06574', '2006-10-02 17:00:00', 1, 100, 4, 'Project MUSE', 'Simon Kornblith', '^http://muse\.jhu\.edu/(?:journals/[^/]+/[^/]+/[^/]+\.html|search/pia.cgi)', 'function detectWeb(doc, url) { var searchRe = new RegExp("^http://[^/]+/search/pia\.cgi"); if(searchRe.test(url)) { @@ -2474,7 +2474,7 @@ REPLACE INTO "translators" VALUES ('c54d1932-73ce-dfd4-a943-109380e06574', '2006 } } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; } @@ -2492,33 +2492,33 @@ REPLACE INTO "translators" VALUES ('c54d1932-73ce-dfd4-a943-109380e06574', '2006 } var savePostString = "actiontype=save&search_id="+search_id+articleString; - Scholar.Utilities.HTTP.doGet("http://muse.jhu.edu/search/save.cgi?"+savePostString, function() { - Scholar.Utilities.HTTP.doGet("http://muse.jhu.edu/search/export.cgi?exporttype=endnote"+articleString, function(text) { - Scholar.Utilities.debug(text); + Zotero.Utilities.HTTP.doGet("http://muse.jhu.edu/search/save.cgi?"+savePostString, function() { + Zotero.Utilities.HTTP.doGet("http://muse.jhu.edu/search/export.cgi?exporttype=endnote"+articleString, function(text) { + Zotero.Utilities.debug(text); // load translator for RIS - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setString(text); translator.setHandler("itemDone", function(obj, item) { if(item.notes && item.notes[0]) { - Scholar.Utilities.debug(item.notes); + Zotero.Utilities.debug(item.notes); item.extra = item.notes[0].note; delete item.notes; item.notes = undefined; } item.attachments = newAttachments.shift(); - Scholar.Utilities.debug(item.attachments); + Zotero.Utilities.debug(item.attachments); item.complete(); }); translator.translate(); - Scholar.done(); + Zotero.done(); }, function() {}); }, function() {}); - Scholar.wait(); + Zotero.wait(); } else { - var newItem = new Scholar.Item("journalArticle"); + var newItem = new Zotero.Item("journalArticle"); newItem.url = url; newItem.attachments.push({title:"Project MUSE Full Text (HTML)", mimeType:"text/html", url:url, downloadable:true}); @@ -2577,7 +2577,7 @@ REPLACE INTO "translators" VALUES ('c54d1932-73ce-dfd4-a943-109380e06574', '2006 } }'); -REPLACE INTO "translators" VALUES ('fcf41bed-0cbc-3704-85c7-8062a0068a7a', '2006-08-07 21:55:00', 1, 100, 12, 'PubMed', 'Simon Kornblith', '^http://www\.ncbi\.nlm\.nih\.gov/entrez/query\.fcgi\?(?:.*db=PubMed.*list_uids=[0-9]|.*list_uids=[0-9].*db=PubMed|.*db=PubMed.*CMD=search|.*CMD=search.*db=PubMed)', +REPLACE INTO "translators" VALUES ('fcf41bed-0cbc-3704-85c7-8062a0068a7a', '2006-10-02 17:00:00', 1, 100, 12, 'PubMed', 'Simon Kornblith', '^http://www\.ncbi\.nlm\.nih\.gov/entrez/query\.fcgi\?(?:.*db=PubMed.*list_uids=[0-9]|.*list_uids=[0-9].*db=PubMed|.*db=PubMed.*CMD=search|.*CMD=search.*db=PubMed)', 'function detectWeb(doc, url) { if(doc.location.href.indexOf("list_uids=") >= 0) { return "journalArticle"; @@ -2607,17 +2607,17 @@ function detectSearch(item) { return false; }', 'function lookupPMIDs(ids, doc) { - Scholar.wait(); + Zotero.wait(); var newUri = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=PubMed&retmode=xml&rettype=citation&id="+ids.join(","); - Scholar.Utilities.HTTP.doGet(newUri, function(text) { + Zotero.Utilities.HTTP.doGet(newUri, function(text) { // Remove xml parse instruction and doctype text = text.replace(/<!DOCTYPE[^>]*>/, "").replace(/<\?xml[^>]*\?>/, ""); var xml = new XML(text); for(var i=0; i<xml.PubmedArticle.length(); i++) { - var newItem = new Scholar.Item("journalArticle"); + var newItem = new Zotero.Item("journalArticle"); var citation = xml.PubmedArticle[i].MedlineCitation; @@ -2649,9 +2649,9 @@ function detectSearch(item) { newItem.ISSN = issn.replace(/[^0-9]/g, ""); } - newItem.journalAbbreviation = Scholar.Utilities.superCleanString(citation.MedlineJournalInfo.MedlineTA.text().toString()); + newItem.journalAbbreviation = Zotero.Utilities.superCleanString(citation.MedlineJournalInfo.MedlineTA.text().toString()); if(article.Journal.Title.length()) { - newItem.publicationTitle = Scholar.Utilities.superCleanString(article.Journal.Title.text().toString()); + newItem.publicationTitle = Zotero.Utilities.superCleanString(article.Journal.Title.text().toString()); } else if(citation.MedlineJournalInfo.MedlineTA.length()) { newItem.publicationTitle = newItem.journalAbbreviation; } @@ -2688,7 +2688,7 @@ function detectSearch(item) { newItem.complete(); } - Scholar.done(); + Zotero.done(); }); } @@ -2719,7 +2719,7 @@ function doWeb(doc, url) { items[link.href] = article.nodeValue; } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; @@ -2739,7 +2739,7 @@ function doSearch(item) { lookupPMIDs([getPMID(item.contextObject)]); }'); -REPLACE INTO "translators" VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '2006-10-01 17:00:00', 1, 100, 4, 'Embedded RDF', 'Simon Kornblith', NULL, +REPLACE INTO "translators" VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '2006-10-02 17:00:00', 1, 100, 4, 'Embedded RDF', 'Simon Kornblith', NULL, 'function detectWeb(doc, url) { var metaTags = doc.getElementsByTagName("meta"); @@ -2756,7 +2756,7 @@ REPLACE INTO "translators" VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '2006 var dc = "http://purl.org/dc/elements/1.1/"; // load RDF translator - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("5e3ad958-ac79-463d-812b-a86a9235c28f"); translator.setHandler("itemDone", function(obj, newItem) { // use document title if none given in dublin core @@ -2780,18 +2780,18 @@ REPLACE INTO "translators" VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '2006 if(tag == "dc.title") { foundTitle = true; } - rdf.Scholar.RDF.addStatement(url, dc + tag.substr(3).toLowerCase(), value, true); + rdf.Zotero.RDF.addStatement(url, dc + tag.substr(3).toLowerCase(), value, true); } else if(tag && value && (tag == "author" || tag == "author-personal")) { - rdf.Scholar.RDF.addStatement(url, dc + "creator", value, true); + rdf.Zotero.RDF.addStatement(url, dc + "creator", value, true); } else if(tag && value && tag == "author-corporate") { - rdf.Scholar.RDF.addStatement(url, dc + "creator", value, true); + rdf.Zotero.RDF.addStatement(url, dc + "creator", value, true); } } rdf.doImport(); }'); -REPLACE INTO "translators" VALUES ('05d07af9-105a-4572-99f6-a8e231c0daef', '2006-08-07 01:09:00', 1, 100, 4, 'COinS', 'Simon Kornblith', NULL, +REPLACE INTO "translators" VALUES ('05d07af9-105a-4572-99f6-a8e231c0daef', '2006-10-02 17:00:00', 1, 100, 4, 'COinS', 'Simon Kornblith', NULL, 'function detectWeb(doc, url) { var spanTags = doc.getElementsByTagName("span"); @@ -2801,12 +2801,12 @@ REPLACE INTO "translators" VALUES ('05d07af9-105a-4572-99f6-a8e231c0daef', '2006 var spanClass = spanTags[i].getAttribute("class"); if(spanClass) { var spanClasses = spanClass.split(" "); - if(Scholar.Utilities.inArray("Z3988", spanClasses)) { + if(Zotero.Utilities.inArray("Z3988", spanClasses)) { var spanTitle = spanTags[i].getAttribute("title"); // determine if it''s a valid type - var item = new Scholar.Item; - var success = Scholar.Utilities.parseContextObject(spanTitle, item); + var item = new Zotero.Item; + var success = Zotero.Utilities.parseContextObject(spanTitle, item); if(item.itemType) { if(encounteredType) { @@ -2827,8 +2827,8 @@ function retrieveNextCOinS(needFullItems, newItems, couldUseFullItems, doc) { if(needFullItems.length) { var item = needFullItems.shift(); - Scholar.Utilities.debug("looking up contextObject"); - var search = Scholar.loadTranslator("search"); + Zotero.Utilities.debug("looking up contextObject"); + var search = Zotero.loadTranslator("search"); search.setHandler("itemDone", function(obj, item) { newItems.push(item); }); @@ -2847,7 +2847,7 @@ function retrieveNextCOinS(needFullItems, newItems, couldUseFullItems, doc) { } } else { completeCOinS(newItems, couldUseFullItems, doc); - Scholar.done(true); + Zotero.done(true); } } @@ -2859,7 +2859,7 @@ function completeCOinS(newItems, couldUseFullItems, doc) { for(var i in newItems) { selectArray[i] = newItems[i].title; } - selectArray = Scholar.selectItems(selectArray); + selectArray = Zotero.selectItems(selectArray); var useIndices = new Array(); for(var i in selectArray) { @@ -2879,8 +2879,8 @@ function completeItems(newItems, useIndices, couldUseFullItems, doc) { // grab full item if requested if(couldUseFullItems[i]) { - Scholar.Utilities.debug("looking up contextObject"); - var search = Scholar.loadTranslator("search"); + Zotero.Utilities.debug("looking up contextObject"); + var search = Zotero.loadTranslator("search"); var firstItem = false; search.setHandler("itemDone", function(obj, newItem) { @@ -2928,10 +2928,10 @@ function doWeb(doc, url) { var spanClass = spanTags[i].getAttribute("class"); if(spanClass) { var spanClasses = spanClass.split(" "); - if(Scholar.Utilities.inArray("Z3988", spanClasses)) { + if(Zotero.Utilities.inArray("Z3988", spanClasses)) { var spanTitle = spanTags[i].getAttribute("title"); - var newItem = new Scholar.Item(); - if(Scholar.Utilities.parseContextObject(spanTitle, newItem)) { + var newItem = new Zotero.Item(); + if(Zotero.Utilities.parseContextObject(spanTitle, newItem)) { if(newItem.title) { if(!newItem.creators.length) { // if we have a title but little other identifying @@ -2951,17 +2951,17 @@ function doWeb(doc, url) { } } - Scholar.Utilities.debug(needFullItems); + Zotero.Utilities.debug(needFullItems); if(needFullItems.length) { // retrieve full items asynchronously - Scholar.wait(); + Zotero.wait(); retrieveNextCOinS(needFullItems, newItems, couldUseFullItems, doc); } else { completeCOinS(newItems, couldUseFullItems, doc); } }'); -REPLACE INTO "translators" VALUES ('3e684d82-73a3-9a34-095f-19b112d88bbf', '2006-06-26 16:01:00', 1, 100, 4, 'Google Books', 'Simon Kornblith', '^http://books\.google\.com/books\?(.*vid=.*\&id=.*|.*q=.*)', +REPLACE INTO "translators" VALUES ('3e684d82-73a3-9a34-095f-19b112d88bbf', '2006-10-02 17:00:00', 1, 100, 4, 'Google Books', 'Simon Kornblith', '^http://books\.google\.com/books\?(.*vid=.*\&id=.*|.*q=.*)', 'function detectWeb(doc, url) { var re = new RegExp(''^http://books\\.google\\.com/books\\?vid=([^&]+).*\\&id=([^&]+)'', ''i''); if(re.test(doc.location.href)) { @@ -2979,13 +2979,13 @@ REPLACE INTO "translators" VALUES ('3e684d82-73a3-9a34-095f-19b112d88bbf', '2006 if(m) { newUris.push(''http://books.google.com/books?vid=''+m[1]+''&id=''+m[2]); } else { - var items = Scholar.Utilities.getItemArray(doc, doc, ''http://books\\.google\\.com/books\\?vid=([^&]+).*\\&id=([^&]+)'', ''^(?:All matching pages|About this Book|Table of Contents|Index)''); + var items = Zotero.Utilities.getItemArray(doc, doc, ''http://books\\.google\\.com/books\\?vid=([^&]+).*\\&id=([^&]+)'', ''^(?:All matching pages|About this Book|Table of Contents|Index)''); // Drop " - Page" thing for(var i in items) { items[i] = items[i].replace(/- Page [0-9]+\s*$/, ""); } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; @@ -2997,8 +2997,8 @@ REPLACE INTO "translators" VALUES ('3e684d82-73a3-9a34-095f-19b112d88bbf', '2006 } } - Scholar.Utilities.processDocuments(newUris, function(newDoc) { - var newItem = new Scholar.Item("book"); + Zotero.Utilities.processDocuments(newUris, function(newDoc) { + var newItem = new Zotero.Item("book"); newItem.extra = ""; newItem.attachments.push({title:"Google Books Information Page", document:newDoc}); @@ -3016,19 +3016,19 @@ REPLACE INTO "translators" VALUES ('3e684d82-73a3-9a34-095f-19b112d88bbf', '2006 var value = newDoc.evaluate(''./td[2]//text()'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(field && value) { - field = Scholar.Utilities.superCleanString(field.nodeValue); - value = Scholar.Utilities.cleanString(value.nodeValue); + field = Zotero.Utilities.superCleanString(field.nodeValue); + value = Zotero.Utilities.cleanString(value.nodeValue); if(field == "Title") { newItem.title = value; } else if(field == "Author(s)") { var authors = value.split(", "); for(j in authors) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(authors[j], "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[j], "author")); } } else if(field == "Editor(s)") { var authors = value.split(", "); for(j in authors) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(authors[j], "editor")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[j], "editor")); } } else if(field == "Publisher") { newItem.publisher = value; @@ -3049,18 +3049,18 @@ REPLACE INTO "translators" VALUES ('3e684d82-73a3-9a34-095f-19b112d88bbf', '2006 } newItem.complete(); - }, function() { Scholar.done(); }, null); + }, function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('57a00950-f0d1-4b41-b6ba-44ff0fc30289', '2006-08-26 1:10:00', 1, 100, 4, 'Google Scholar', 'Simon Kornblith', '^http://scholar\.google\.com/scholar', +REPLACE INTO "translators" VALUES ('57a00950-f0d1-4b41-b6ba-44ff0fc30289', '2006-08-26 1:10:00', 1, 100, 4, 'Google Zotero', 'Simon Kornblith', '^http://scholar\.google\.com/scholar', 'function detectWeb(doc, url) { return "multiple"; }', 'function getList(urls, each, done) { var url = urls.shift(); - Scholar.Utilities.HTTP.doGet(url, function(text) { + Zotero.Utilities.HTTP.doGet(url, function(text) { if(each) { each(text); } @@ -3101,9 +3101,9 @@ function doWeb(doc, url) { if(relatedLink) { relatedLinks[i] = relatedLink.href; if(isCitation && isCitation.nodeValue == "[CITATION]") { - items[i] = Scholar.Utilities.getNodeString(doc, elmt, ''./text()|./b/text()'', nsResolver); + items[i] = Zotero.Utilities.getNodeString(doc, elmt, ''./text()|./b/text()'', nsResolver); } else if(isCitation && isCitation.nodeValue == "[BOOK]") { - items[i] = Scholar.Utilities.getNodeString(doc, elmt, ''./text()|./b/text()'', nsResolver); + items[i] = Zotero.Utilities.getNodeString(doc, elmt, ''./text()|./b/text()'', nsResolver); types[i] = "book"; } else { var link = doc.evaluate(''.//span[@class="w"]/a'', elmt, nsResolver, @@ -3120,7 +3120,7 @@ function doWeb(doc, url) { } } - items = Scholar.selectItems(items); + items = Zotero.selectItems(items); if(!items) { return true; } @@ -3132,7 +3132,7 @@ function doWeb(doc, url) { var m = relatedMatch.exec(relatedLinks[i]); urls.push("http://scholar.google.com/scholar.ris?hl=en&lr=&q=info:"+m[1]+"&oe=UTF-8&output=citation&oi=citation"); if(links[i]) { - attachments.push([{title:"Google Scholar Linked Page", type:"text/html", + attachments.push([{title:"Google Zotero Linked Page", type:"text/html", url:links[i]}]); } else { attachments.push([]); @@ -3145,7 +3145,7 @@ function doWeb(doc, url) { } } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setHandler("itemDone", function(obj, item) { var itemType = itemTypes.shift(); @@ -3160,12 +3160,12 @@ function doWeb(doc, url) { getList(urls, function(text) { translator.setString(text); translator.translate(); - }, function() { Scholar.done() }); + }, function() { Zotero.done() }); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('9c335444-a562-4f88-b291-607e8f46a9bb', '2006-08-15 15:42:00', 1, 100, 4, 'Berkeley Library', 'Simon Kornblith', '^http://[^/]*berkeley.edu[^/]*/WebZ/(?:html/results.html|FETCH)\?.*sessionid=', +REPLACE INTO "translators" VALUES ('9c335444-a562-4f88-b291-607e8f46a9bb', '2006-10-02 17:00:00', 1, 100, 4, 'Berkeley Library', 'Simon Kornblith', '^http://[^/]*berkeley.edu[^/]*/WebZ/(?:html/results.html|FETCH)\?.*sessionid=', 'function detectWeb(doc, url) { var resultsRegexp = /\/WebZ\/html\/results.html/i if(resultsRegexp.test(url)) { @@ -3182,8 +3182,8 @@ function doWeb(doc, url) { var resultsRegexp = /\/WebZ\/html\/results.html/i if(resultsRegexp.test(url)) { - var items = Scholar.Utilities.getItemArray(doc, doc, "/WebZ/FETCH", "^[0-9]*$"); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, "/WebZ/FETCH", "^[0-9]*$"); + items = Zotero.selectItems(items); if(!items) { return true; @@ -3197,11 +3197,11 @@ function doWeb(doc, url) { var urls = [reformURL(url)]; } - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); var marc = translator.getTranslatorObject(); - Scholar.Utilities.processDocuments(urls, function(newDoc) { + Zotero.Utilities.processDocuments(urls, function(newDoc) { var uri = newDoc.location.href; var namespace = newDoc.documentElement.namespaceURI; @@ -3214,7 +3214,7 @@ function doWeb(doc, url) { var record = new marc.record(); while(elmt = elmts.iterateNext()) { - var field = Scholar.Utilities.superCleanString(doc.evaluate(''./TD[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); + var field = Zotero.Utilities.superCleanString(doc.evaluate(''./TD[1]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); var value = doc.evaluate(''./TD[2]/text()[1]'', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; // remove spacing @@ -3225,7 +3225,7 @@ function doWeb(doc, url) { record.leader = "00000"+value; } else { var ind = value[3]+value[5]; - value = Scholar.Utilities.cleanString(value.substr(5)). + value = Zotero.Utilities.cleanString(value.substr(5)). replace(/\$([a-z0-9]) /g, marc.subfieldDelimiter+"$1"); if(value[0] != marc.subfieldDelimiter) { value = marc.subfieldDelimiter+"a"+value; @@ -3234,15 +3234,15 @@ function doWeb(doc, url) { } } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); record.translate(newItem); newItem.complete(); - }, function() { Scholar.done(); }, null); + }, function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('d0b1914a-11f1-4dd7-8557-b32fe8a3dd47', '2006-08-18 18:03:00', 1, 100, 4, 'EBSCOhost', 'Simon Kornblith', '^http://[^/]+/ehost/(?:results|detail)', +REPLACE INTO "translators" VALUES ('d0b1914a-11f1-4dd7-8557-b32fe8a3dd47', '2006-10-02 17:00:00', 1, 100, 4, 'EBSCOhost', 'Simon Kornblith', '^http://[^/]+/ehost/(?:results|detail)', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -3306,7 +3306,7 @@ function doWeb(doc, url) { } } - var items = Scholar.selectItems(items); + var items = Zotero.selectItems(items); if(!items) { return true; } @@ -3336,8 +3336,8 @@ function doWeb(doc, url) { var viewStateMatch = /<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="([^"]+)" \/>/ var eventValidationMatch = /<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="([^"]+)" \/>/ - Scholar.Utilities.HTTP.doPost(url, saveString, function() { // mark records - Scholar.Utilities.HTTP.doPost(url, folderString, function(text) { + Zotero.Utilities.HTTP.doPost(url, saveString, function() { // mark records + Zotero.Utilities.HTTP.doPost(url, folderString, function(text) { var postLocation = /<form name="aspnetForm" method="post" action="([^"]+)"/ var m = postLocation.exec(text); var folderURL = m[1].replace(/&amp;/g, "&"); @@ -3350,7 +3350,7 @@ function doWeb(doc, url) { folderBase += "&__EVENTVALIDATION="+fullEscape(folderEventValidation); var deliverString = "__EVENTTARGET=ctl00%24ctl00%24MainContentArea%24MainContentArea%24btnDelivery%24lnkSave&"+folderBase - Scholar.Utilities.HTTP.doPost("http://"+host+"/ehost/"+folderURL, + Zotero.Utilities.HTTP.doPost("http://"+host+"/ehost/"+folderURL, deliverString, function(text) { var postLocation = /<form name="aspnetForm" method="post" action="([^"]+)"/ var m = postLocation.exec(text); @@ -3359,9 +3359,9 @@ function doWeb(doc, url) { var m = viewStateMatch.exec(text); var downloadString = "__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE="+fullEscape(m[1])+"&ctl00%24ctl00%24MainContentArea%24MainContentArea%24ctl01%24chkRemoveFromFolder=on&ctl00%24ctl00%24MainContentArea%24MainContentArea%24ctl01%24btnSubmit=Save&ctl00%24ctl00%24MainContentArea%24MainContentArea%24ctl01%24BibFormat=1"; - Scholar.Utilities.HTTP.doPost("http://"+host+"/ehost/"+deliveryURL, + Zotero.Utilities.HTTP.doPost("http://"+host+"/ehost/"+deliveryURL, getString, function(text) { - Scholar.Utilities.HTTP.doPost("http://"+host+"/ehost/"+deliveryURL, + Zotero.Utilities.HTTP.doPost("http://"+host+"/ehost/"+deliveryURL, downloadString, function(text) { // get marked var form = doc.createElement("form"); form.setAttribute("method", "post"); @@ -3384,7 +3384,7 @@ function doWeb(doc, url) { form.submit(); // load translator for RIS - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setString(text); translator.setHandler("itemDone", function(obj, item) { @@ -3398,17 +3398,17 @@ function doWeb(doc, url) { }); translator.translate(); - Scholar.done(); + Zotero.done(); }); }); }); }); }); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('ce7a3727-d184-407f-ac12-52837f3361ff', '2006-08-31 22:44:00', 1, 100, 4, 'New York Times', 'Simon Kornblith', '^http://(?:query\.nytimes\.com/search/query|www\.nytimes\.com/.+)', +REPLACE INTO "translators" VALUES ('ce7a3727-d184-407f-ac12-52837f3361ff', '2006-10-02 17:00:00', 1, 100, 4, 'New York Times', 'Simon Kornblith', '^http://(?:query\.nytimes\.com/search/query|www\.nytimes\.com/.+)', 'function detectWeb(doc, url) { if(doc.title.substr(0, 30) == "The New York Times: Search for") { var namespace = doc.documentElement.namespaceURI; @@ -3430,7 +3430,7 @@ REPLACE INTO "translators" VALUES ('ce7a3727-d184-407f-ac12-52837f3361ff', '2006 }', 'function getList(urls, each, done) { var url = urls.shift(); - Scholar.Utilities.HTTP.doGet(url, function(text) { + Zotero.Utilities.HTTP.doGet(url, function(text) { if(each) { each(text, url); } @@ -3443,14 +3443,14 @@ REPLACE INTO "translators" VALUES ('ce7a3727-d184-407f-ac12-52837f3361ff', '2006 }); } -function associateMeta(newItem, metaTags, field, scholarField) { +function associateMeta(newItem, metaTags, field, zoteroField) { if(metaTags[field]) { - newItem[scholarField] = metaTags[field]; + newItem[zoteroField] = metaTags[field]; } } function scrape(doc, url) { - var newItem = new Scholar.Item("newspaperArticle"); + var newItem = new Zotero.Item("newspaperArticle"); newItem.publicationTitle = "The New York Times"; newItem.ISSN = "0362-4331"; @@ -3501,7 +3501,7 @@ function scrape(doc, url) { associateMeta(newItem, metaTags, "articleid", "accessionNumber"); if(metaTags["byl"]) { - var author = Scholar.Utilities.cleanString(metaTags["byl"]); + var author = Zotero.Utilities.cleanString(metaTags["byl"]); if(author.substr(0, 3).toLowerCase() == "by ") { author = author.substr(3); } @@ -3518,7 +3518,7 @@ function scrape(doc, url) { if(words[0] == "The") { newItem.creators.push({lastName:author, creatorType:"author"}); } else { - newItem.creators.push(Scholar.Utilities.cleanAuthor(author, "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } } @@ -3543,8 +3543,8 @@ function doWeb(doc, url) { var result = doc.evaluate(''//div[@id="srchContent"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); - var items = Scholar.Utilities.getItemArray(doc, result, ''^http://www.nytimes.com/.*\.html$''); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, result, ''^http://www.nytimes.com/.*\.html$''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -3555,15 +3555,15 @@ function doWeb(doc, url) { urls.push(i); } - getList(urls, scrape, function() { Scholar.done(); }, null); + getList(urls, scrape, function() { Zotero.done(); }, null); - Scholar.wait(); + Zotero.wait(); } else { scrape(doc); } }'); -REPLACE INTO "translators" VALUES ('1e6d1529-246f-4429-84e2-1f1b180b250d', '2006-10-01 17:00:00', 1, 100, 4, 'Chronicle of Higher Education', 'Simon Kornblith', '^http://chronicle\.com/', +REPLACE INTO "translators" VALUES ('1e6d1529-246f-4429-84e2-1f1b180b250d', '2006-10-02 17:00:00', 1, 100, 4, 'Chronicle of Higher Education', 'Simon Kornblith', '^http://chronicle\.com/', 'function detectWeb(doc, url) { var articleRegexp = /^http:\/\/chronicle\.com\/(?:daily|weekly)\/[^/]+\// if(articleRegexp.test(url)) { @@ -3581,15 +3581,15 @@ REPLACE INTO "translators" VALUES ('1e6d1529-246f-4429-84e2-1f1b180b250d', '2006 } } }', -'function associateMeta(newItem, metaTags, field, scholarField) { +'function associateMeta(newItem, metaTags, field, zoteroField) { if(metaTags.namedItem(field)) { - newItem[scholarField] = Scholar.Utilities.cleanString(metaTags.namedItem(field).getAttribute("content")); + newItem[zoteroField] = Zotero.Utilities.cleanString(metaTags.namedItem(field).getAttribute("content")); } } function scrape(doc) { if(doc.location.href.indexOf("weekly") != -1) { - var newItem = new Scholar.Item("magazineArticle"); + var newItem = new Zotero.Item("magazineArticle"); var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -3607,7 +3607,7 @@ function scrape(doc) { } } } else { - var newItem = new Scholar.Item("webpage"); + var newItem = new Zotero.Item("webpage"); } newItem.publicationTitle = "The Chronicle of Higher Education"; newItem.ISSN = "0009-5982"; @@ -3625,7 +3625,7 @@ function scrape(doc) { associateMeta(newItem, metaTags, "issue", "issue"); if(metaTags.namedItem("byline")) { - var author = Scholar.Utilities.cleanString(metaTags.namedItem("byline").getAttribute("content")); + var author = Zotero.Utilities.cleanString(metaTags.namedItem("byline").getAttribute("content")); if(author.substr(0, 3).toLowerCase() == "by ") { author = author.substr(3); } @@ -3642,7 +3642,7 @@ function scrape(doc) { if(words[0] == "The") { newItem.creators.push({lastName:author, creatorType:"author"}); } else { - newItem.creators.push(Scholar.Utilities.cleanAuthor(author, "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } } @@ -3655,8 +3655,8 @@ function doWeb(doc, url) { if(articleRegexp.test(url)) { scrape(doc); } else { - var items = Scholar.Utilities.getItemArray(doc, doc, ''^http://chronicle\\.com/(?:daily|weekly)/[^/]+/''); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, ''^http://chronicle\\.com/(?:daily|weekly)/[^/]+/''); + items = Zotero.selectItems(items); if(!items) { return true; @@ -3667,12 +3667,12 @@ function doWeb(doc, url) { urls.push(i); } - Scholar.Utilities.processDocuments(urls, scrape, function() { Scholar.done(); }); - Scholar.wait(); + Zotero.Utilities.processDocuments(urls, scrape, function() { Zotero.done(); }); + Zotero.wait(); } }'); -REPLACE INTO "translators" VALUES ('4c164cc8-be7b-4d02-bfbf-37a5622dfd56', '2006-09-06 18:54:00', 1, 100, 4, 'New York Review of Books', 'Simon Kornblith', '^http://www\.nybooks\.com/', +REPLACE INTO "translators" VALUES ('4c164cc8-be7b-4d02-bfbf-37a5622dfd56', '2006-10-02 17:00:00', 1, 100, 4, 'New York Review of Books', 'Simon Kornblith', '^http://www\.nybooks\.com/', 'function detectWeb(doc, url) { var articleRegexp = /^http:\/\/www\.nybooks\.com\/articles\/[0-9]+/ if(articleRegexp.test(url)) { @@ -3686,14 +3686,14 @@ REPLACE INTO "translators" VALUES ('4c164cc8-be7b-4d02-bfbf-37a5622dfd56', '2006 } } }', -'function associateMeta(newItem, metaTags, field, scholarField) { +'function associateMeta(newItem, metaTags, field, zoteroField) { if(metaTags.namedItem(field)) { - newItem[scholarField] = Scholar.Utilities.cleanString(metaTags.namedItem(field).getAttribute("content")); + newItem[zoteroField] = Zotero.Utilities.cleanString(metaTags.namedItem(field).getAttribute("content")); } } function scrape(doc) { - var newItem = new Scholar.Item("journalArticle"); + var newItem = new Zotero.Item("journalArticle"); newItem.publicationTitle = "The New York Review of Books"; newItem.ISSN = "0028-7504"; @@ -3721,7 +3721,7 @@ function scrape(doc) { newItem.date = newItem.date.textContent; } - info = Scholar.Utilities.cleanString(info.textContent); + info = Zotero.Utilities.cleanString(info.textContent); // get volume and issue var infoRe = /Volume ([0-9]+), Number ([0-9]+)/; @@ -3739,7 +3739,7 @@ function scrape(doc) { var author; while(author = authors.iterateNext()) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(author.textContent, "author", false)); + newItem.creators.push(Zotero.Utilities.cleanAuthor(author.textContent, "author", false)); } newItem.complete(); @@ -3750,8 +3750,8 @@ function doWeb(doc, url) { if(articleRegexp.test(url)) { scrape(doc); } else { - var items = Scholar.Utilities.getItemArray(doc, doc, "^http://www\\.nybooks\\.com/articles/[0-9]+/"); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, "^http://www\\.nybooks\\.com/articles/[0-9]+/"); + items = Zotero.selectItems(items); if(!items) { return true; @@ -3762,12 +3762,12 @@ function doWeb(doc, url) { urls.push(i); } - Scholar.Utilities.processDocuments(urls, scrape, function() { Scholar.done(); }); - Scholar.wait(); + Zotero.Utilities.processDocuments(urls, scrape, function() { Zotero.done(); }); + Zotero.wait(); } }'); -REPLACE INTO "translators" VALUES ('d1bf1c29-4432-4ada-8893-2e29fc88fd9e', '2006-09-06 23:27:00', 1, 100, 4, 'Washington Post', 'Simon Kornblith', '^http://www\.washingtonpost\.com/', +REPLACE INTO "translators" VALUES ('d1bf1c29-4432-4ada-8893-2e29fc88fd9e', '2006-10-02 17:00:00', 1, 100, 4, 'Washington Post', 'Simon Kornblith', '^http://www\.washingtonpost\.com/', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -3799,7 +3799,7 @@ REPLACE INTO "translators" VALUES ('d1bf1c29-4432-4ada-8893-2e29fc88fd9e', '2006 if (prefix == ''x'') return namespace; else return null; } : null; - var newItem = new Scholar.Item("newspaperArticle"); + var newItem = new Zotero.Item("newspaperArticle"); newItem.publicationTitle = "The Washington Post"; newItem.ISSN = "0740-5421"; @@ -3818,7 +3818,7 @@ REPLACE INTO "translators" VALUES ('d1bf1c29-4432-4ada-8893-2e29fc88fd9e', '2006 if(byline) { var authors = byline.textContent.substr(3).split(" and "); for each(var author in authors) { - newItem.creators.push(Scholar.Utilities.cleanAuthor(author, "author")); + newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } @@ -3828,7 +3828,7 @@ REPLACE INTO "translators" VALUES ('d1bf1c29-4432-4ada-8893-2e29fc88fd9e', '2006 while(font = fonts.iterateNext()) { var pageRe = /([^;]+);(?:[\xA0 ]+Pages?[\xA0 ]+([A-Z0-9\-]+))?/ // grab pages and date - Scholar.Utilities.debug(Scholar.Utilities.cleanString(font.nodeValue)); + Zotero.Utilities.debug(Zotero.Utilities.cleanString(font.nodeValue)); var m = pageRe.exec(font.nodeValue); if(m) { newItem.date = m[1]; @@ -3857,8 +3857,8 @@ function doWeb(doc, url) { if(articleRegexp.test(url)) { scrape(doc); } else { - var items = Scholar.Utilities.getItemArray(doc, doc, articleRegexp); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, articleRegexp); + items = Zotero.selectItems(items); if(!items) { return true; @@ -3869,12 +3869,12 @@ function doWeb(doc, url) { urls.push(i); } - Scholar.Utilities.processDocuments(urls, scrape, function() { Scholar.done(); }); - Scholar.wait(); + Zotero.Utilities.processDocuments(urls, scrape, function() { Zotero.done(); }); + Zotero.wait(); } }'); -REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006-08-26 16:14:00', 1, 100, 4, 'ABC-CLIO', 'Simon Kornblith', '^http://serials\.abc-clio\.com/active/go/ABC-Clio-Serials_v4.1$', +REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006-10-02 17:00:00', 1, 100, 4, 'ABC-CLIO', 'Simon Kornblith', '^http://serials\.abc-clio\.com/active/go/ABC-Clio-Serials_v4.1$', 'function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -3906,7 +3906,7 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(title, checkbox) { checkbox = checkbox.name; - availableItems[checkbox] = Scholar.Utilities.cleanString(title.textContent).substr(6); + availableItems[checkbox] = Zotero.Utilities.cleanString(title.textContent).substr(6); var links = doc.evaluate(''./tbody/tr/td[b/text() = "Fulltext: ["]/a'', elmt, nsResolver, XPathResult.ANY_TYPE, null); @@ -3914,14 +3914,14 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 var attach = new Array(); while(link = links.iterateNext()) { - attach.push({url:link.href, title:Scholar.Utilities.cleanString(link.textContent)+" Full Text", + attach.push({url:link.href, title:Zotero.Utilities.cleanString(link.textContent)+" Full Text", mimeType:"text/html"}); } availableAttachments[checkbox] = attach; } } - var items = Scholar.selectItems(availableItems); + var items = Zotero.selectItems(availableItems); if(!items) { return true; @@ -3936,8 +3936,8 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 } } - Scholar.Utilities.HTTP.doPost(url, postString, function(text) { - Scholar.Utilities.HTTP.doPost(url, "_appname=serials&_defaultoperation=Download+Documents&_formname=download&download_format=citation&download_which=tagged&download_where=ris&mailto=&mailreplyto=&mailsubject=&mailmessage=", + Zotero.Utilities.HTTP.doPost(url, postString, function(text) { + Zotero.Utilities.HTTP.doPost(url, "_appname=serials&_defaultoperation=Download+Documents&_formname=download&download_format=citation&download_which=tagged&download_where=ris&mailto=&mailreplyto=&mailsubject=&mailmessage=", function(text) { // get link var linkRe = /<a\s+class="button"\s+href="([^"]+)"\s+id="resource_link"/i; @@ -3945,9 +3945,9 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 if(!m) { throw("regular expression failed!"); } - Scholar.Utilities.HTTP.doGet(m[1], function(text) { + Zotero.Utilities.HTTP.doGet(m[1], function(text) { // load translator for RIS - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setString(text); translator.setHandler("itemDone", function(obj, item) { @@ -3987,7 +3987,7 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 } // fix title - item.title = Scholar.Utilities.superCleanString(item.title); + item.title = Zotero.Utilities.superCleanString(item.title); // add attachments item.attachments = attachments.shift(); @@ -3995,15 +3995,15 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 item.complete(); }); translator.translate(); - Scholar.done(); + Zotero.done(); }); }); }); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('fa396dd4-7d04-4f99-95e1-93d6f355441d', '2006-09-07 18:30:00', 1, 100, 4, 'CiteSeer', 'Simon Kornblith', '^http://(?:citeseer\.ist\.psu\.edu/|citeseer\.csail\.mit\.edu/|citeseer\.ifi\.unizh\.ch/|citeseer\.comp\.nus\.edu\.sg/)', +REPLACE INTO "translators" VALUES ('fa396dd4-7d04-4f99-95e1-93d6f355441d', '2006-10-02 17:00:00', 1, 100, 4, 'CiteSeer', 'Simon Kornblith', '^http://(?:citeseer\.ist\.psu\.edu/|citeseer\.csail\.mit\.edu/|citeseer\.ifi\.unizh\.ch/|citeseer\.comp\.nus\.edu\.sg/)', 'function detectWeb(doc, url) { var searchRe = /http:\/\/[^\/]+\/ci?s/; if(searchRe.test(url)) { @@ -4050,7 +4050,7 @@ REPLACE INTO "translators" VALUES ('fa396dd4-7d04-4f99-95e1-93d6f355441d', '2006 var bibtex = doc.evaluate(''/html/body/span[@class="m"]/pre/text()'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(bibtex) { - var translator = Scholar.loadTranslator("import"); + var translator = Zotero.loadTranslator("import"); translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); translator.setString(bibtex.nodeValue.toString()); translator.setHandler("itemDone", function(obj, item) { @@ -4078,8 +4078,8 @@ function doWeb(doc, url) { if (prefix == ''x'') return namespace; else return null; } : null; - var items = Scholar.Utilities.getItemArray(doc, doc, "^http://"+m[1]+"/[^/]+.html"); - items = Scholar.selectItems(items); + var items = Zotero.Utilities.getItemArray(doc, doc, "^http://"+m[1]+"/[^/]+.html"); + items = Zotero.selectItems(items); if(!items) { return true; @@ -4090,14 +4090,14 @@ function doWeb(doc, url) { urls.push(i); } - Scholar.Utilities.processDocuments(urls, scrape, function() { Scholar.done(); }); - Scholar.wait(); + Zotero.Utilities.processDocuments(urls, scrape, function() { Zotero.done(); }); + Zotero.wait(); } else { scrape(doc); } }'); -REPLACE INTO "translators" VALUES ('e07e9b8c-0e98-4915-bb5a-32a08cb2f365', '2006-08-07 11:36:00', 1, 100, 8, 'Open WorldCat', 'Simon Kornblith', 'http://partneraccess.oclc.org/', +REPLACE INTO "translators" VALUES ('e07e9b8c-0e98-4915-bb5a-32a08cb2f365', '2006-10-02 17:00:00', 1, 100, 8, 'Open WorldCat', 'Simon Kornblith', 'http://partneraccess.oclc.org/', 'function detectSearch(item) { if(item.itemType == "book" || item.itemType == "bookSection") { return true; @@ -4111,11 +4111,11 @@ function processOWC(doc) { var spanClass = spanTags[i].getAttribute("class"); if(spanClass) { var spanClasses = spanClass.split(" "); - if(Scholar.Utilities.inArray("Z3988", spanClasses)) { + if(Zotero.Utilities.inArray("Z3988", spanClasses)) { var spanTitle = spanTags[i].getAttribute("title"); - var item = new Scholar.Item(); - if(Scholar.Utilities.parseContextObject(spanTitle, item)) { - item.title = Scholar.Utilities.capitalizeTitle(item.title); + var item = new Zotero.Item(); + if(Zotero.Utilities.parseContextObject(spanTitle, item)) { + item.title = Zotero.Utilities.capitalizeTitle(item.title); item.complete(); return true; } else { @@ -4132,13 +4132,13 @@ function doSearch(item) { if(item.contextObject) { var co = item.contextObject; } else { - var co = Scholar.Utilities.createContextObject(item); + var co = Zotero.Utilities.createContextObject(item); } - Scholar.Utilities.loadDocument("http://partneraccess.oclc.org/wcpa/servlet/OpenUrl?"+co, function(doc) { + Zotero.Utilities.loadDocument("http://partneraccess.oclc.org/wcpa/servlet/OpenUrl?"+co, function(doc) { // find new COinS in the Open WorldCat page if(processOWC(doc)) { // we got a single item page - Scholar.done(); + Zotero.done(); } else { // assume we have a search results page var items = new Array(); @@ -4160,19 +4160,19 @@ function doSearch(item) { urlsToProcess.push(elmt.href); } while(elmt = elmts.iterateNext()); - Scholar.Utilities.processDocuments(urlsToProcess, function(doc) { + Zotero.Utilities.processDocuments(urlsToProcess, function(doc) { // per URL processOWC(doc); }, function() { // done - Scholar.done(); + Zotero.done(); }); } }, null); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('11645bd1-0420-45c1-badb-53fb41eeb753', '2006-08-07 18:17:00', 1, 100, 8, 'CrossRef', 'Simon Kornblith', 'http://partneraccess.oclc.org/', +REPLACE INTO "translators" VALUES ('11645bd1-0420-45c1-badb-53fb41eeb753', '2006-10-02 17:00:00', 1, 100, 8, 'CrossRef', 'Simon Kornblith', 'http://partneraccess.oclc.org/', 'function detectSearch(item) { if(item.itemType == "journal") { return true; @@ -4197,7 +4197,7 @@ REPLACE INTO "translators" VALUES ('11645bd1-0420-45c1-badb-53fb41eeb753', '2006 } var query = xml.qr::query_result.qr::body.qr::query; - var item = new Scholar.Item("journalArticle"); + var item = new Zotero.Item("journalArticle"); // try to get a DOI item.DOI = query.qr::doi.(@type=="journal_article").text().toString(); @@ -4215,7 +4215,7 @@ REPLACE INTO "translators" VALUES ('11645bd1-0420-45c1-badb-53fb41eeb753', '2006 // get publicationTitle item.publicationTitle = query.qr::journal_title.text().toString(); // get author - item.creators.push(Scholar.Utilities.cleanAuthor(query.qr::author.text().toString(), "author", true)); + item.creators.push(Zotero.Utilities.cleanAuthor(query.qr::author.text().toString(), "author", true)); // get volume item.volume = query.qr::volume.text().toString(); // get issue @@ -4237,22 +4237,22 @@ function doSearch(item) { co = "url_ver=Z39.88-2004"+co; } } else { - var co = Scholar.Utilities.createContextObject(item); + var co = Zotero.Utilities.createContextObject(item); } - Scholar.Utilities.HTTP.doGet("http://www.crossref.org/openurl/?"+co+"&noredirect=true", function(responseText) { + Zotero.Utilities.HTTP.doGet("http://www.crossref.org/openurl/?"+co+"&noredirect=true", function(responseText) { processCrossRef(responseText); - Scholar.done(); + Zotero.done(); }); - Scholar.wait(); + Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('0e2235e7-babf-413c-9acf-f27cce5f059c', '2006-10-01 17:00:00', 1, 50, 3, 'MODS', 'Simon Kornblith', 'xml', -'Scholar.addOption("exportNotes", true); +REPLACE INTO "translators" VALUES ('0e2235e7-babf-413c-9acf-f27cce5f059c', '2006-10-02 17:00:00', 1, 50, 3, 'MODS', 'Simon Kornblith', 'xml', +'Zotero.addOption("exportNotes", true); function detectImport() { - var read = Scholar.read(512); + var read = Zotero.read(512); var modsTagRegexp = /<mods[^>]+>/ if(modsTagRegexp.test(read)) { return true; @@ -4261,12 +4261,12 @@ function detectImport() { 'var partialItemTypes = ["bookSection", "journalArticle", "magazineArticle", "newspaperArticle"]; function doExport() { - Scholar.setCharacterSet("utf-8"); + Zotero.setCharacterSet("utf-8"); var modsCollection = <modsCollection xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd" />; var item; - while(item = Scholar.nextItem()) { - var isPartialItem = Scholar.Utilities.inArray(item.itemType, partialItemTypes); + while(item = Zotero.nextItem()) { + var isPartialItem = Zotero.Utilities.inArray(item.itemType, partialItemTypes); var mods = <mods />; @@ -4346,7 +4346,7 @@ function doExport() { } // XML tag recordInfo.recordOrigin; used to store our generator note - //mods.recordInfo.recordOrigin = "Scholar for Firefox "+Scholar.Utilities.getVersion(); + //mods.recordInfo.recordOrigin = "Zotero for Firefox "+Zotero.Utilities.getVersion(); /** FIELDS ON NEARLY EVERYTHING BUT NOT A PART OF THE CORE **/ @@ -4385,7 +4385,7 @@ function doExport() { // XML tag detail; object field volume if(item.volume) { - if(Scholar.Utilities.isInt(item.volume)) { + if(Zotero.Utilities.isInt(item.volume)) { part += <detail type="volume"><number>{item.volume}</number></detail>; } else { part += <detail type="volume"><text>{item.volume}</text></detail>; @@ -4394,7 +4394,7 @@ function doExport() { // XML tag detail; object field number if(item.issue) { - if(Scholar.Utilities.isInt(item.issue)) { + if(Zotero.Utilities.isInt(item.issue)) { part += <detail type="issue"><number>{item.issue}</number></detail>; } else { part += <detail type="issue"><text>{item.issue}</text></detail>; @@ -4403,7 +4403,7 @@ function doExport() { // XML tag detail; object field section if(item.section) { - if(Scholar.Utilities.isInt(item.section)) { + if(Zotero.Utilities.isInt(item.section)) { part += <detail type="section"><number>{item.section}</number></detail>; } else { part += <detail type="section"><text>{item.section}</text></detail>; @@ -4412,7 +4412,7 @@ function doExport() { // XML tag detail; object field pages if(item.pages) { - var range = Scholar.Utilities.getPageRange(item.pages); + var range = Zotero.Utilities.getPageRange(item.pages); part += <extent unit="pages"><start>{range[0]}</start><end>{range[1]}</end></extent>; } @@ -4440,10 +4440,10 @@ function doExport() { originInfo += <publisher>{item.distributor}</publisher>; } if(item.date) { - if(Scholar.Utilities.inArray(item.itemType, ["book", "bookSection"])) { + if(Zotero.Utilities.inArray(item.itemType, ["book", "bookSection"])) { // Assume year is copyright date var dateType = "copyrightDate"; - } else if(Scholar.Utilities.inArray(item.itemType, ["journalArticle", "magazineArticle", "newspaperArticle"])) { + } else if(Zotero.Utilities.inArray(item.itemType, ["journalArticle", "magazineArticle", "newspaperArticle"])) { // Assume date is date issued var dateType = "dateIssued"; } else { @@ -4512,7 +4512,7 @@ function doExport() { /** NOTES **/ - if(Scholar.getOption("exportNotes")) { + if(Zotero.getOption("exportNotes")) { for(var j in item.notes) { // Add note tag var note = <note type="content">{item.notes[j].note}</note>; @@ -4529,8 +4529,8 @@ function doExport() { modsCollection.mods += mods; } - Scholar.write(''<?xml version="1.0"?>''+"\n"); - Scholar.write(modsCollection.toXMLString()); + Zotero.write(''<?xml version="1.0"?>''+"\n"); + Zotero.write(modsCollection.toXMLString()); } function doImport() { @@ -4540,35 +4540,35 @@ function doImport() { // read until we see if the file begins with a parse instruction read = " "; while(read == " " || read == "\n" || read == "\r") { - read = Scholar.read(1); + read = Zotero.read(1); } - var firstPart = read + Scholar.read(4); + var firstPart = read + Zotero.read(4); if(firstPart == "<?xml") { // got a parse instruction, read until it ends read = true; while((read !== false) && (read !== ">")) { - read = Scholar.read(1); + read = Zotero.read(1); firstPart += read; } var encodingRe = /encoding=[''"]([^''"]+)[''"]/; var m = encodingRe.exec(firstPart); // set character set try { - Scholar.setCharacterSet(m[1]); + Zotero.setCharacterSet(m[1]); } catch(e) { - Scholar.setCharacterSet("utf-8"); + Zotero.setCharacterSet("utf-8"); } } else { - Scholar.setCharacterSet("utf-8"); + Zotero.setCharacterSet("utf-8"); text += firstPart; } // read in 16384 byte increments - while(read = Scholar.read(16384)) { + while(read = Zotero.read(16384)) { text += read; } - Scholar.Utilities.debug("read in"); + Zotero.Utilities.debug("read in"); // parse with E4X var m = new Namespace("http://www.loc.gov/mods/v3"); @@ -4577,19 +4577,19 @@ function doImport() { var xml = new XML(text); for each(var mods in xml.m::mods) { - Scholar.Utilities.debug("item is: "); + Zotero.Utilities.debug("item is: "); for(var i in mods) { - Scholar.Utilities.debug(i+" = "+mods[i].toString()); + Zotero.Utilities.debug(i+" = "+mods[i].toString()); } - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); // title newItem.title = mods.m::titleInfo.(m::title.@type!="abbreviated").m::title; // try to get genre from local genre var localGenre = mods.m::genre.(@authority=="local").text().toString(); - if(localGenre && Scholar.Utilities.itemTypeExists(localGenre)) { + if(localGenre && Zotero.Utilities.itemTypeExists(localGenre)) { newItem.itemType = localGenre; } else { // otherwise, look at the marc genre @@ -4621,7 +4621,7 @@ function doImport() { } } - var isPartialItem = Scholar.Utilities.inArray(newItem.itemType, partialItemTypes); + var isPartialItem = Zotero.Utilities.inArray(newItem.itemType, partialItemTypes); // TODO: thesisType, type @@ -4749,68 +4749,68 @@ function doImport() { } }'); -REPLACE INTO "translators" VALUES ('14763d24-8ba0-45df-8f52-b8d1108e7ac9', '2006-10-01 17:00:00', 1, 25, 2, 'Zotero RDF', 'Simon Kornblith', 'rdf', -'Scholar.configure("getCollections", true); -Scholar.configure("dataMode", "rdf"); -Scholar.addOption("exportNotes", true); -Scholar.addOption("exportFileData", false);', +REPLACE INTO "translators" VALUES ('14763d24-8ba0-45df-8f52-b8d1108e7ac9', '2006-10-02 17:00:00', 1, 25, 2, 'Zotero RDF', 'Simon Kornblith', 'rdf', +'Zotero.configure("getCollections", true); +Zotero.configure("dataMode", "rdf"); +Zotero.addOption("exportNotes", true); +Zotero.addOption("exportFileData", false);', 'function generateSeeAlso(resource, seeAlso) { for(var i in seeAlso) { if(itemResources[seeAlso[i]]) { - Scholar.RDF.addStatement(resource, n.dc+"relation", itemResources[seeAlso[i]], false); + Zotero.RDF.addStatement(resource, n.dc+"relation", itemResources[seeAlso[i]], false); } } } function generateTags(resource, tags) { for(var j in tags) { - Scholar.RDF.addStatement(resource, n.dc+"subject", tags[j], true); + Zotero.RDF.addStatement(resource, n.dc+"subject", tags[j], true); } } function generateCollection(collection) { var collectionResource = "#collection:"+collection.id; - Scholar.RDF.addStatement(collectionResource, rdf+"type", n.bib+"Collection", false); - Scholar.RDF.addStatement(collectionResource, n.dc+"title", collection.name, true); + Zotero.RDF.addStatement(collectionResource, rdf+"type", n.bib+"Collection", false); + Zotero.RDF.addStatement(collectionResource, n.dc+"title", collection.name, true); for each(var child in collection.children) { // add child list items if(child.type == "collection") { - Scholar.RDF.addStatement(collectionResource, n.dcterms+"hasPart", "#collection:"+child.id, false); + Zotero.RDF.addStatement(collectionResource, n.dcterms+"hasPart", "#collection:"+child.id, false); // do recursive processing of collections generateCollection(child); } else if(itemResources[child.id]) { - Scholar.RDF.addStatement(collectionResource, n.dcterms+"hasPart", itemResources[child.id], false); + Zotero.RDF.addStatement(collectionResource, n.dcterms+"hasPart", itemResources[child.id], false); } } } function handleAttachment(attachmentResource, attachment) { - Scholar.RDF.addStatement(attachmentResource, rdf+"type", n.fs+"Attachment", false); + Zotero.RDF.addStatement(attachmentResource, rdf+"type", n.fs+"Attachment", false); if(attachment.path) { - Scholar.RDF.addStatement(attachmentResource, rdf+"resource", attachment.path, false); + Zotero.RDF.addStatement(attachmentResource, rdf+"resource", attachment.path, false); } if(attachment.url) { // add url as identifier - var term = Scholar.RDF.newResource(); + var term = Zotero.RDF.newResource(); // set term type - Scholar.RDF.addStatement(term, rdf+"type", n.dcterms+"URI", false); + Zotero.RDF.addStatement(term, rdf+"type", n.dcterms+"URI", false); // set url value - Scholar.RDF.addStatement(term, rdf+"value", attachment.url, true); + Zotero.RDF.addStatement(term, rdf+"value", attachment.url, true); // add relationship to resource - Scholar.RDF.addStatement(attachmentResource, n.dc+"identifier", term, false); + Zotero.RDF.addStatement(attachmentResource, n.dc+"identifier", term, false); } // set mime type value - Scholar.RDF.addStatement(attachmentResource, n.link+"type", attachment.mimeType, true); + Zotero.RDF.addStatement(attachmentResource, n.link+"type", attachment.mimeType, true); // set charset value if(attachment.charset) { - Scholar.RDF.addStatement(attachmentResource, n.link+"charset", attachment.charset, true); + Zotero.RDF.addStatement(attachmentResource, n.link+"charset", attachment.charset, true); } // add title - Scholar.RDF.addStatement(attachmentResource, n.dc+"title", attachment.title, true); + Zotero.RDF.addStatement(attachmentResource, n.dc+"title", attachment.title, true); // Add see also info to RDF generateSeeAlso(attachmentResource, attachment.seeAlso); generateTags(attachmentResource, attachment.tags); @@ -4832,7 +4832,7 @@ function doExport() { // add namespaces for(var i in n) { - Scholar.RDF.addNamespace(i, n[i]); + Zotero.RDF.addNamespace(i, n[i]); } // leave as global @@ -4845,7 +4845,7 @@ function doExport() { var items = new Array(); // first, map each ID to a resource - while(item = Scholar.nextItem()) { + while(item = Zotero.nextItem()) { items.push(item); if(item.ISBN && !usedResources["urn:isbn:"+item.ISBN]) { @@ -4881,7 +4881,7 @@ function doExport() { // title if(item.title) { - Scholar.RDF.addStatement(resource, n.dc+"title", item.title, true); + Zotero.RDF.addStatement(resource, n.dc+"title", item.title, true); } // type @@ -4916,7 +4916,7 @@ function doExport() { type = "Document"; } else if(item.itemType == "note") { type = "Memo"; - if(!Scholar.getOption("exportNotes")) { + if(!Zotero.getOption("exportNotes")) { continue; } } else if(item.itemType == "attachment") { @@ -4924,18 +4924,18 @@ function doExport() { continue; } if(type) { - Scholar.RDF.addStatement(resource, rdf+"type", n.bib+type, false); + Zotero.RDF.addStatement(resource, rdf+"type", n.bib+type, false); } // authors/editors/contributors var creatorContainers = new Object(); for(var j in item.creators) { - var creator = Scholar.RDF.newResource(); - Scholar.RDF.addStatement(creator, rdf+"type", n.foaf+"Person", false); + var creator = Zotero.RDF.newResource(); + Zotero.RDF.addStatement(creator, rdf+"type", n.foaf+"Person", false); // gee. an entire vocabulary for describing people, and these aren''t even // standardized in it. oh well. using them anyway. - Scholar.RDF.addStatement(creator, n.foaf+"surname", item.creators[j].lastName, true); - Scholar.RDF.addStatement(creator, n.foaf+"givenname", item.creators[j].firstName, true); + Zotero.RDF.addStatement(creator, n.foaf+"surname", item.creators[j].lastName, true); + Zotero.RDF.addStatement(creator, n.foaf+"givenname", item.creators[j].firstName, true); // in addition, these tags are not yet in Biblio, but Bruce D''Arcus // says they will be. @@ -4948,197 +4948,197 @@ function doExport() { } if(!creatorContainers[cTag]) { - var creatorResource = Scholar.RDF.newResource(); + var creatorResource = Zotero.RDF.newResource(); // create new seq for author type - creatorContainers[cTag] = Scholar.RDF.newContainer("seq", creatorResource); + creatorContainers[cTag] = Zotero.RDF.newContainer("seq", creatorResource); // attach container to resource - Scholar.RDF.addStatement(resource, n.bib+cTag, creatorResource, false); + Zotero.RDF.addStatement(resource, n.bib+cTag, creatorResource, false); } - Scholar.RDF.addContainerElement(creatorContainers[cTag], creator, false); + Zotero.RDF.addContainerElement(creatorContainers[cTag], creator, false); } /** FIELDS ON NEARLY EVERYTHING BUT NOT A PART OF THE CORE **/ // source if(item.source) { - Scholar.RDF.addStatement(resource, n.dc+"source", item.source, true); + Zotero.RDF.addStatement(resource, n.dc+"source", item.source, true); } // url if(item.url) { // add url as identifier - var term = Scholar.RDF.newResource(); + var term = Zotero.RDF.newResource(); // set term type - Scholar.RDF.addStatement(term, rdf+"type", n.dcterms+"URI", false); + Zotero.RDF.addStatement(term, rdf+"type", n.dcterms+"URI", false); // set url value - Scholar.RDF.addStatement(term, rdf+"value", attachment.url, true); + Zotero.RDF.addStatement(term, rdf+"value", attachment.url, true); // add relationship to resource - Scholar.RDF.addStatement(resource, n.dc+"identifier", term, false); + Zotero.RDF.addStatement(resource, n.dc+"identifier", term, false); } // accessionNumber as generic ID if(item.accessionNumber) { - Scholar.RDF.addStatement(resource, n.dc+"identifier", item.accessionNumber, true); + Zotero.RDF.addStatement(resource, n.dc+"identifier", item.accessionNumber, true); } // rights if(item.rights) { - Scholar.RDF.addStatement(resource, n.dc+"rights", item.rights, true); + Zotero.RDF.addStatement(resource, n.dc+"rights", item.rights, true); } /** SUPPLEMENTAL FIELDS **/ // use section to set up another container element if(item.section) { - section = Scholar.RDF.newResource(); // leave as global + section = Zotero.RDF.newResource(); // leave as global // set section type - Scholar.RDF.addStatement(section, rdf+"type", n.bib+"Part", false); + Zotero.RDF.addStatement(section, rdf+"type", n.bib+"Part", false); // set section title - Scholar.RDF.addStatement(section, n.dc+"title", item.section, true); + Zotero.RDF.addStatement(section, n.dc+"title", item.section, true); // add relationship to resource - Scholar.RDF.addStatement(resource, n.dc+"isPartOf", section, false); + Zotero.RDF.addStatement(resource, n.dc+"isPartOf", section, false); } // generate container if(container) { - if(item.ISSN && !Scholar.RDF.getArcsIn("urn:issn:"+item.ISSN)) { + if(item.ISSN && !Zotero.RDF.getArcsIn("urn:issn:"+item.ISSN)) { // use ISSN as container URI if no other item is containerElement = "urn:issn:"+item.ISSN } else { - containerElement = Scholar.RDF.newResource(); + containerElement = Zotero.RDF.newResource(); } // attach container to section (if exists) or resource - Scholar.RDF.addStatement((section ? section : resource), n.dcterms+"isPartOf", containerElement, false); + Zotero.RDF.addStatement((section ? section : resource), n.dcterms+"isPartOf", containerElement, false); // add container type - Scholar.RDF.addStatement(containerElement, rdf+"type", n.bib+container, false); + Zotero.RDF.addStatement(containerElement, rdf+"type", n.bib+container, false); } // ISSN if(item.ISSN) { - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"identifier", "ISSN "+item.ISSN, true); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"identifier", "ISSN "+item.ISSN, true); } // ISBN if(item.ISBN) { - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"identifier", "ISBN "+item.ISBN, true); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"identifier", "ISBN "+item.ISBN, true); } // DOI if(item.DOI) { - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"identifier", "DOI "+item.DOI, true); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"identifier", "DOI "+item.DOI, true); } // publication gets linked to container via isPartOf if(item.publicationTitle) { - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"title", item.publicationTitle, true); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.dc+"title", item.publicationTitle, true); } // series also linked in if(item.seriesTitle) { - var series = Scholar.RDF.newResource(); + var series = Zotero.RDF.newResource(); // set series type - Scholar.RDF.addStatement(series, rdf+"type", n.bib+"Series", false); + Zotero.RDF.addStatement(series, rdf+"type", n.bib+"Series", false); // set series title - Scholar.RDF.addStatement(series, n.dc+"title", item.seriesTitle, true); + Zotero.RDF.addStatement(series, n.dc+"title", item.seriesTitle, true); // add relationship to resource - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.dcterms+"isPartOf", series, false); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.dcterms+"isPartOf", series, false); } // volume if(item.volume) { - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.prism+"volume", item.volume, true); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.prism+"volume", item.volume, true); } // number if(item.issue) { - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.prism+"number", item.issue, true); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.prism+"number", item.issue, true); } // edition if(item.edition) { - Scholar.RDF.addStatement(resource, n.prism+"edition", item.edition, true); + Zotero.RDF.addStatement(resource, n.prism+"edition", item.edition, true); } // publisher/distributor and place if(item.publisher || item.distributor || item.place) { - var organization = Scholar.RDF.newResource(); + var organization = Zotero.RDF.newResource(); // set organization type - Scholar.RDF.addStatement(organization, rdf+"type", n.foaf+"Organization", false); + Zotero.RDF.addStatement(organization, rdf+"type", n.foaf+"Organization", false); // add relationship to resource - Scholar.RDF.addStatement(resource, n.dc+"publisher", organization, false); + Zotero.RDF.addStatement(resource, n.dc+"publisher", organization, false); // add publisher/distributor if(item.publisher) { - Scholar.RDF.addStatement(organization, n.foaf+"name", item.publisher, true); + Zotero.RDF.addStatement(organization, n.foaf+"name", item.publisher, true); } else if(item.distributor) { - Scholar.RDF.addStatement(organization, n.foaf+"name", item.distributor, true); + Zotero.RDF.addStatement(organization, n.foaf+"name", item.distributor, true); } // add place if(item.place) { - var address = Scholar.RDF.newResource(); + var address = Zotero.RDF.newResource(); // set address type - Scholar.RDF.addStatement(address, rdf+"type", n.vcard+"Address", false); + Zotero.RDF.addStatement(address, rdf+"type", n.vcard+"Address", false); // set address locality - Scholar.RDF.addStatement(address, n.vcard+"locality", item.place, true); + Zotero.RDF.addStatement(address, n.vcard+"locality", item.place, true); // add relationship to organization - Scholar.RDF.addStatement(organization, n.vcard+"adr", address, false); + Zotero.RDF.addStatement(organization, n.vcard+"adr", address, false); } } // date/year if(item.date) { - Scholar.RDF.addStatement(resource, n.dc+"date", item.date, true); + Zotero.RDF.addStatement(resource, n.dc+"date", item.date, true); } if(item.accessDate) { // use date submitted for access date? - Scholar.RDF.addStatement(resource, n.dcterms+"dateSubmitted", item.accessDate, true); + Zotero.RDF.addStatement(resource, n.dcterms+"dateSubmitted", item.accessDate, true); } // callNumber if(item.callNumber) { - var term = Scholar.RDF.newResource(); + var term = Zotero.RDF.newResource(); // set term type - Scholar.RDF.addStatement(term, rdf+"type", n.dcterms+"LCC", false); + Zotero.RDF.addStatement(term, rdf+"type", n.dcterms+"LCC", false); // set callNumber value - Scholar.RDF.addStatement(term, rdf+"value", item.callNumber, true); + Zotero.RDF.addStatement(term, rdf+"value", item.callNumber, true); // add relationship to resource - Scholar.RDF.addStatement(resource, n.dc+"subject", term, false); + Zotero.RDF.addStatement(resource, n.dc+"subject", term, false); } // archiveLocation if(item.archiveLocation) { - Scholar.RDF.addStatement(resource, n.dc+"coverage", item.archiveLocation, true); + Zotero.RDF.addStatement(resource, n.dc+"coverage", item.archiveLocation, true); } // type (not itemType) if(item.type) { - Scholar.RDF.addStatement(resource, n.dc+"type", item.type, true); + Zotero.RDF.addStatement(resource, n.dc+"type", item.type, true); } else if(item.thesisType) { - Scholar.RDF.addStatement(resource, n.dc+"type", item.thesisType, true); + Zotero.RDF.addStatement(resource, n.dc+"type", item.thesisType, true); } // THIS IS NOT YET IN THE BIBLIO NAMESPACE, BUT BRUCE D''ARCUS HAS SAID // IT WILL BE SOON if(item.pages) { - Scholar.RDF.addStatement(resource, n.bib+"pages", item.pages, true); + Zotero.RDF.addStatement(resource, n.bib+"pages", item.pages, true); } // journalAbbreviation if(item.journalAbbreviation) { - Scholar.RDF.addStatement((containerElement ? containerElement : resource), n.dcterms+"alternative", item.journalAbbreviation, true); + Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.dcterms+"alternative", item.journalAbbreviation, true); } // extra if(item.extra) { - Scholar.RDF.addStatement(resource, n.dc+"description", item.extra, true); + Zotero.RDF.addStatement(resource, n.dc+"description", item.extra, true); } /** NOTES **/ - if(Scholar.getOption("exportNotes")) { + if(Zotero.getOption("exportNotes")) { for(var j in item.notes) { var noteResource = itemResources[item.notes[j].itemID]; // add note tag - Scholar.RDF.addStatement(noteResource, rdf+"type", n.bib+"Memo", false); + Zotero.RDF.addStatement(noteResource, rdf+"type", n.bib+"Memo", false); // add note value - Scholar.RDF.addStatement(noteResource, rdf+"value", item.notes[j].note, true); + Zotero.RDF.addStatement(noteResource, rdf+"value", item.notes[j].note, true); // add relationship between resource and note - Scholar.RDF.addStatement(resource, n.dcterms+"isReferencedBy", noteResource, false); + Zotero.RDF.addStatement(resource, n.dcterms+"isReferencedBy", noteResource, false); // Add see also info to RDF generateSeeAlso(noteResource, item.notes[j].seeAlso); @@ -5146,7 +5146,7 @@ function doExport() { } if(item.note) { - Scholar.RDF.addStatement(resource, rdf+"value", item.note, true); + Zotero.RDF.addStatement(resource, rdf+"value", item.note, true); } } @@ -5154,7 +5154,7 @@ function doExport() { for each(var attachment in item.attachments) { var attachmentResource = itemResources[attachment.itemID]; - Scholar.RDF.addStatement(resource, n.link+"link", attachmentResource, false); + Zotero.RDF.addStatement(resource, n.link+"link", attachmentResource, false); handleAttachment(attachmentResource, attachment); } @@ -5166,19 +5166,19 @@ function doExport() { /** RDF COLLECTION STRUCTURE **/ var collection; - while(collection = Scholar.nextCollection()) { + while(collection = Zotero.nextCollection()) { generateCollection(collection); } }'); -REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006-07-05 23:40:00', 1, 100, 2, 'Unqualified Dublin Core RDF', 'Simon Kornblith', 'rdf', -'Scholar.configure("dataMode", "rdf");', +REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006-10-02 17:00:00', 1, 100, 2, 'Unqualified Dublin Core RDF', 'Simon Kornblith', 'rdf', +'Zotero.configure("dataMode", "rdf");', 'function doExport() { var dc = "http://purl.org/dc/elements/1.1/"; - Scholar.RDF.addNamespace("dc", dc); + Zotero.RDF.addNamespace("dc", dc); var item; - while(item = Scholar.nextItem()) { + while(item = Zotero.nextItem()) { if(item.itemType == "note" || item.itemType == "attachment") { continue; } @@ -5190,18 +5190,18 @@ REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006 resource = item.url; } else { // just specify a node ID - resource = Scholar.RDF.newResource(); + resource = Zotero.RDF.newResource(); } /** CORE FIELDS **/ // title if(item.title) { - Scholar.RDF.addStatement(resource, dc+"title", item.title, true); + Zotero.RDF.addStatement(resource, dc+"title", item.title, true); } // type - Scholar.RDF.addStatement(resource, dc+"type", item.itemType, true); + Zotero.RDF.addStatement(resource, dc+"type", item.itemType, true); // creators for(var j in item.creators) { @@ -5212,9 +5212,9 @@ REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006 } if(item.creators[j].creatorType == "author") { - Scholar.RDF.addStatement(resource, dc+"creator", creator, true); + Zotero.RDF.addStatement(resource, dc+"creator", creator, true); } else { - Scholar.RDF.addStatement(resource, dc+"contributor", creator, true); + Zotero.RDF.addStatement(resource, dc+"contributor", creator, true); } } @@ -5222,17 +5222,17 @@ REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006 // source if(item.source) { - Scholar.RDF.addStatement(resource, dc+"source", item.source, true); + Zotero.RDF.addStatement(resource, dc+"source", item.source, true); } // accessionNumber as generic ID if(item.accessionNumber) { - Scholar.RDF.addStatement(resource, dc+"identifier", item.accessionNumber, true); + Zotero.RDF.addStatement(resource, dc+"identifier", item.accessionNumber, true); } // rights if(item.rights) { - Scholar.RDF.addStatement(resource, dc+"rights", item.rights, true); + Zotero.RDF.addStatement(resource, dc+"rights", item.rights, true); } /** SUPPLEMENTAL FIELDS **/ @@ -5241,46 +5241,46 @@ REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006 // publisher/distributor if(item.publisher) { - Scholar.RDF.addStatement(resource, dc+"publisher", item.publisher, true); + Zotero.RDF.addStatement(resource, dc+"publisher", item.publisher, true); } else if(item.distributor) { - Scholar.RDF.addStatement(resource, dc+"publisher", item.distributor, true); + Zotero.RDF.addStatement(resource, dc+"publisher", item.distributor, true); } // date/year if(item.date) { - Scholar.RDF.addStatement(resource, dc+"date", item.date, true); + Zotero.RDF.addStatement(resource, dc+"date", item.date, true); } // ISBN/ISSN/DOI if(item.ISBN) { - Scholar.RDF.addStatement(resource, dc+"identifier", "ISBN "+item.ISBN, true); + Zotero.RDF.addStatement(resource, dc+"identifier", "ISBN "+item.ISBN, true); } if(item.ISSN) { - Scholar.RDF.addStatement(resource, dc+"identifier", "ISSN "+item.ISSN, true); + Zotero.RDF.addStatement(resource, dc+"identifier", "ISSN "+item.ISSN, true); } if(item.DOI) { - Scholar.RDF.addStatement(resource, dc+"identifier", "DOI "+item.DOI, true); + Zotero.RDF.addStatement(resource, dc+"identifier", "DOI "+item.DOI, true); } // callNumber if(item.callNumber) { - Scholar.RDF.addStatement(resource, dc+"identifier", item.callNumber, true); + Zotero.RDF.addStatement(resource, dc+"identifier", item.callNumber, true); } // archiveLocation if(item.archiveLocation) { - Scholar.RDF.addStatement(resource, dc+"coverage", item.archiveLocation, true); + Zotero.RDF.addStatement(resource, dc+"coverage", item.archiveLocation, true); } } }'); -REPLACE INTO "translators" VALUES ('5e3ad958-ac79-463d-812b-a86a9235c28f', '2006-10-01 17:00:00', 1, 100, 1, 'RDF', 'Simon Kornblith', 'rdf', -'Scholar.configure("dataMode", "rdf"); +REPLACE INTO "translators" VALUES ('5e3ad958-ac79-463d-812b-a86a9235c28f', '2006-10-02 17:00:00', 1, 100, 1, 'RDF', 'Simon Kornblith', 'rdf', +'Zotero.configure("dataMode", "rdf"); function detectImport() { // unfortunately, Mozilla will let you create a data source from any type // of XML, so we need to make sure there are actually nodes - var nodes = Scholar.RDF.getAllResources(); + var nodes = Zotero.RDF.getAllResources(); if(nodes) { return true; } @@ -5289,7 +5289,7 @@ function detectImport() { // ontologies function getFirstResults(node, properties, onlyOneString) { for(var i=0; i<properties.length; i++) { - var result = Scholar.RDF.getTargets(node, properties[i]); + var result = Zotero.RDF.getTargets(node, properties[i]); if(result) { if(onlyOneString) { // onlyOneString means we won''t return nsIRDFResources, only @@ -5313,21 +5313,21 @@ function handleCreators(newItem, creators, creatorType) { if(typeof(creators[0]) != "string") { // see if creators are in a container try { - var creators = Scholar.RDF.getContainerElements(creators[0]); + var creators = Zotero.RDF.getContainerElements(creators[0]); } catch(e) {} } if(typeof(creators[0]) == "string") { // support creators encoded as strings for(var i in creators) { if(typeof(creators[i]) != "object") { - newItem.creators.push(Scholar.Utilities.cleanAuthor(creators[i], creatorType, true)); + newItem.creators.push(Zotero.Utilities.cleanAuthor(creators[i], creatorType, true)); } } } else { // also support foaf for(var i in creators) { - var type = Scholar.RDF.getTargets(creators[i], rdf+"type"); + var type = Zotero.RDF.getTargets(creators[i], rdf+"type"); if(type) { - type = Scholar.RDF.getResourceURI(type[0]); + type = Zotero.RDF.getResourceURI(type[0]); if(type == n.foaf+"Person") { // author is FOAF type person var creator = new Array(); creator.lastName = getFirstResults(creators[i], @@ -5351,7 +5351,7 @@ function handleAttachment(node, attachment) { attachment.title = getFirstResults(node, [n.dc+"title"], true); var path = getFirstResults(node, [rdf+"resource"]); if(path) { - attachment.path = Scholar.RDF.getResourceURI(path[0]); + attachment.path = Zotero.RDF.getResourceURI(path[0]); } attachment.charset = getFirstResults(node, [n.link+"charset"], true); attachment.mimeType = getFirstResults(node, [n.link+"type"], true); @@ -5359,9 +5359,9 @@ function handleAttachment(node, attachment) { var identifiers = getFirstResults(node, [n.dc+"identifier"]); for each(var identifier in identifiers) { if(typeof(identifier) != "string") { - var identifierType = Scholar.RDF.getTargets(identifier, rdf+"type"); + var identifierType = Zotero.RDF.getTargets(identifier, rdf+"type"); if(identifierType) { - identifierType = Scholar.RDF.getResourceURI(identifierType[0]); + identifierType = Zotero.RDF.getResourceURI(identifierType[0]); if(identifierType == n.dcterms+"URI") { // uri is url attachment.url = getFirstResults(identifier, [rdf+"value"], true); @@ -5389,9 +5389,9 @@ function processCollection(node, collection) { // check for children var children = getFirstResults(node, [n.dcterms+"hasPart"]); for each(var child in children) { - var type = Scholar.RDF.getTargets(child, rdf+"type"); + var type = Zotero.RDF.getTargets(child, rdf+"type"); if(type) { - type = Scholar.RDF.getResourceURI(type[0]); + type = Zotero.RDF.getResourceURI(type[0]); } if(type == n.bib+"Collection") { @@ -5399,7 +5399,7 @@ function processCollection(node, collection) { collection.children.push(processCollection(child)); } else { // all other items are added by ID - collection.children.push({id:Scholar.RDF.getResourceURI(child), type:"item"}); + collection.children.push({id:Zotero.RDF.getResourceURI(child), type:"item"}); } } @@ -5408,11 +5408,11 @@ function processCollection(node, collection) { function processSeeAlso(node, newItem) { var relations; - newItem.itemID = Scholar.RDF.getResourceURI(node); + newItem.itemID = Zotero.RDF.getResourceURI(node); newItem.seeAlso = new Array(); if(relations = getFirstResults(node, [n.dc+"relation"])) { for each(var relation in relations) { - newItem.seeAlso.push(Scholar.RDF.getResourceURI(relation)); + newItem.seeAlso.push(Zotero.RDF.getResourceURI(relation)); } } } @@ -5436,9 +5436,9 @@ function getNodeByType(nodes, type) { } for each(node in nodes) { - var nodeType = Scholar.RDF.getTargets(node, rdf+"type"); + var nodeType = Zotero.RDF.getTargets(node, rdf+"type"); if(nodeType) { - nodeType = Scholar.RDF.getResourceURI(nodeType[0]); + nodeType = Zotero.RDF.getResourceURI(nodeType[0]); if(nodeType == type) { // we have a node of the correct type return node; } @@ -5452,10 +5452,10 @@ function getNodeByType(nodes, type) { // // used to differentiate independent notes and files function isPart(node) { - var arcs = Scholar.RDF.getArcsIn(node); + var arcs = Zotero.RDF.getArcsIn(node); var skip = false; for each(var arc in arcs) { - arc = Scholar.RDF.getResourceURI(arc); + arc = Zotero.RDF.getResourceURI(arc); if(arc != n.dc+"relation" && arc != n.dcterms+"hasPart") { // related to another item by some arc besides see also skip = true; @@ -5482,7 +5482,7 @@ function doImport() { n.dcterms+"LCC", n.dcterms+"DDC", n.dcterms+"UDC" ]; - var nodes = Scholar.RDF.getAllResources(); + var nodes = Zotero.RDF.getAllResources(); if(!nodes) { return false; } @@ -5491,25 +5491,25 @@ function doImport() { var collections = new Array(); for each(var node in nodes) { - var newItem = new Scholar.Item(); - newItem.itemID = Scholar.RDF.getResourceURI(node); + var newItem = new Zotero.Item(); + newItem.itemID = Zotero.RDF.getResourceURI(node); var container = undefined; // figure out if this is a part of another resource, or a linked // attachment - if(Scholar.RDF.getSources(node, n.dcterms+"isPartOf") || - Scholar.RDF.getSources(node, n.link+"link")) { + if(Zotero.RDF.getSources(node, n.dcterms+"isPartOf") || + Zotero.RDF.getSources(node, n.link+"link")) { continue; } // type - var type = Scholar.RDF.getTargets(node, rdf+"type"); + var type = Zotero.RDF.getTargets(node, rdf+"type"); // also deal with type detection based on parts, so we can differentiate // magazine and journal articles, and find container elements var isPartOf = getFirstResults(node, [n.dcterms+"isPartOf"]); if(type) { - type = Scholar.RDF.getResourceURI(type[0]); + type = Zotero.RDF.getResourceURI(type[0]); if(type == n.bib+"Book") { newItem.itemType = "book"; @@ -5560,7 +5560,7 @@ function doImport() { // process as file newItem.itemType = "attachment"; handleAttachment(node, newItem); - Scholar.Utilities.debug(newItem); + Zotero.Utilities.debug(newItem); newItem.complete(); continue; } else { // default to book @@ -5623,9 +5623,9 @@ function doImport() { if(typeof(publisher[0]) == "string") { newItem.publisher = publisher[0]; } else { - var type = Scholar.RDF.getTargets(publisher[0], rdf+"type"); + var type = Zotero.RDF.getTargets(publisher[0], rdf+"type"); if(type) { - type = Scholar.RDF.getResourceURI(type[0]); + type = Zotero.RDF.getResourceURI(type[0]); if(type == n.foaf+"Organization") { // handle foaf organizational publishers newItem.publisher = getFirstResults(publisher[0], [n.foaf+"name"], true); var place = getFirstResults(publisher[0], [n.vcard+"adr"]); @@ -5694,10 +5694,10 @@ function doImport() { /** NOTES **/ - var referencedBy = Scholar.RDF.getTargets(node, n.dcterms+"isReferencedBy"); + var referencedBy = Zotero.RDF.getTargets(node, n.dcterms+"isReferencedBy"); for each(var referentNode in referencedBy) { - var type = Scholar.RDF.getTargets(referentNode, rdf+"type"); - if(type && Scholar.RDF.getResourceURI(type[0]) == n.bib+"Memo") { + var type = Zotero.RDF.getTargets(referentNode, rdf+"type"); + if(type && Zotero.RDF.getResourceURI(type[0]) == n.bib+"Memo") { // if this is a memo var note = new Array(); note.note = getFirstResults(referentNode, [rdf+"value", n.dc+"description"], true); @@ -5724,10 +5724,10 @@ function doImport() { if(typeof(subject) == "string") { // a regular tag newItem.tags.push(subject); } else { // a call number - var type = Scholar.RDF.getTargets(subject, rdf+"type"); + var type = Zotero.RDF.getTargets(subject, rdf+"type"); if(type) { - type = Scholar.RDF.getResourceURI(type[0]); - if(Scholar.Utilities.inArray(type, callNumberTypes)) { + type = Zotero.RDF.getResourceURI(type[0]); + if(Zotero.Utilities.inArray(type, callNumberTypes)) { newItem.callNumber = getFirstResults(subject, [rdf+"value"], true); } } @@ -5737,34 +5737,34 @@ function doImport() { /** ATTACHMENTS **/ var relations = getFirstResults(node, [n.link+"link"]); for each(var relation in relations) { - var type = Scholar.RDF.getTargets(relation, rdf+"type"); - if(Scholar.RDF.getResourceURI(type[0]) == n.fs+"Attachment") { + var type = Zotero.RDF.getTargets(relation, rdf+"type"); + if(Zotero.RDF.getResourceURI(type[0]) == n.fs+"Attachment") { newItem.attachments.push(handleAttachment(relation)); } } - Scholar.Utilities.debug(newItem); + Zotero.Utilities.debug(newItem); newItem.complete(); } /* COLLECTIONS */ for each(var collection in collections) { - if(!Scholar.RDF.getArcsIn(collection)) { - var newCollection = new Scholar.Collection(); + if(!Zotero.RDF.getArcsIn(collection)) { + var newCollection = new Zotero.Collection(); processCollection(collection, newCollection); newCollection.complete(); } } }'); -REPLACE INTO "translators" VALUES ('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7', '2006-10-01 17:00:00', 1, 100, 3, 'RIS', 'Simon Kornblith', 'ris', -'Scholar.configure("dataMode", "line"); -Scholar.addOption("exportNotes", true); +REPLACE INTO "translators" VALUES ('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7', '2006-10-02 17:00:00', 1, 100, 3, 'RIS', 'Simon Kornblith', 'ris', +'Zotero.configure("dataMode", "line"); +Zotero.addOption("exportNotes", true); function detectImport() { var line; - while((line = Scholar.read()) !== "false") { + while((line = Zotero.read()) !== "false") { line = line.replace(/^\s+/, ""); if(line != "") { if(line.substr(0, 6) == "TY - ") { @@ -5886,7 +5886,7 @@ function processTag(item, tag, value) { month = undefined; } - item.date = Scholar.Utilities.formatDate({year:dateParts[0], + item.date = Zotero.Utilities.formatDate({year:dateParts[0], month:month, day:dateParts[2], part:dateParts[3]}); @@ -5974,17 +5974,17 @@ function completeItem(item) { function doImport(attachments) { // this is apparently the proper character set for RIS, although i''m not // sure how many people follow this - Scholar.setCharacterSet("IBM850"); + Zotero.setCharacterSet("IBM850"); var line = true; var tag = data = false; do { // first valid line is type - Scholar.Utilities.debug("ignoring "+line); - line = Scholar.read(); + Zotero.Utilities.debug("ignoring "+line); + line = Zotero.read(); line = line.replace(/^\s+/, ""); } while(line !== false && line.substr(0, 6) != "TY - "); - var item = new Scholar.Item(); + var item = new Zotero.Item(); var i = 0; if(attachments && attachments[i]) { item.attachments = attachments[i]; @@ -5992,7 +5992,7 @@ function doImport(attachments) { var tag = "TY"; var data = line.substr(6); - while((line = Scholar.read()) !== false) { // until EOF + while((line = Zotero.read()) !== false) { // until EOF line = line.replace(/^\s+/, ""); if(line.substr(2, 4) == " - ") { // if this line is a tag, take a look at the previous line to map @@ -6005,14 +6005,14 @@ function doImport(attachments) { tag = line.substr(0,2); data = line.substr(6); - Scholar.Utilities.debug("tag: ''"+tag+"''; data: ''"+data+"''"); + Zotero.Utilities.debug("tag: ''"+tag+"''; data: ''"+data+"''"); if(tag == "ER") { // ER signals end of reference // unset info tag = data = false; // new item completeItem(item); - item = new Scholar.Item(); + item = new Zotero.Item(); i++; if(attachments && attachments[i]) { item.attachments = attachments[i]; @@ -6038,18 +6038,18 @@ function doImport(attachments) { function addTag(tag, value) { if(value) { - Scholar.write(tag+" - "+value+"\r\n"); + Zotero.write(tag+" - "+value+"\r\n"); } } function doExport() { // this is apparently the proper character set for RIS, although i''m not // sure how many people follow this - Scholar.setCharacterSet("IBM850"); + Zotero.setCharacterSet("IBM850"); var item; - while(item = Scholar.nextItem()) { + while(item = Zotero.nextItem()) { // can''t store independent notes in RIS if(item.itemType == "note" || item.itemType == "attachment") { continue; @@ -6076,7 +6076,7 @@ function doExport() { // date if(item.date) { - var date = Scholar.Utilities.strToDate(item.date); + var date = Zotero.Utilities.strToDate(item.date); var string = date.year+"/"; if(date.month != undefined) { // deal with javascript months @@ -6097,7 +6097,7 @@ function doExport() { } // notes - if(Scholar.getOption("exportNotes")) { + if(Zotero.getOption("exportNotes")) { for(var j in item.notes) { addTag("N1", item.notes[j].note.replace(/[\r\n]/g, " ")); } @@ -6113,7 +6113,7 @@ function doExport() { if(item.itemType == "book") { addTag("EP", item.pages); } else { - var range = Scholar.Utilities.getPageRange(item.pages); + var range = Zotero.Utilities.getPageRange(item.pages); addTag("SP", range[0]); addTag("EP", range[1]); } @@ -6130,18 +6130,18 @@ function doExport() { addTag("UR", item.source); } - Scholar.write("ER - \r\n\r\n"); + Zotero.write("ER - \r\n\r\n"); } }'); -REPLACE INTO "translators" VALUES ('881f60f2-0802-411a-9228-ce5f47b64c7d', '2006-10-01 17:00:00', 1, 100, 3, 'Refer/BibIX', 'Simon Kornblith', 'txt', -'Scholar.configure("dataMode", "line"); +REPLACE INTO "translators" VALUES ('881f60f2-0802-411a-9228-ce5f47b64c7d', '2006-10-02 17:00:00', 1, 100, 3, 'Refer/BibIX', 'Simon Kornblith', 'txt', +'Zotero.configure("dataMode", "line"); function detectImport() { var lineRe = /%[A-Z0-9\*\$] .+/; var line; var matched = 0; - while((line = Scholar.read()) !== "false") { + while((line = Zotero.read()) !== "false") { line = line.replace(/^\s+/, ""); if(line != "") { if(lineRe.test(line)) { @@ -6238,9 +6238,9 @@ function processTag(item, tag, value) { // use comma only if EndNote format if(isEndNote) { - item.creators.push(Scholar.Utilities.cleanAuthor(value, type, true)); + item.creators.push(Zotero.Utilities.cleanAuthor(value, type, true)); } else { - item.creators.push(Scholar.Utilities.cleanAuthor(value, type)); + item.creators.push(Zotero.Utilities.cleanAuthor(value, type)); } } else if(tag == "Q") { item.creators.push({creatorType:"author", lastName:value, isInstitution:true}); @@ -6271,21 +6271,21 @@ function processTag(item, tag, value) { function doImport() { // no character set is defined for this format. we use UTF-8. - Scholar.setCharacterSet("UTF-8"); + Zotero.setCharacterSet("UTF-8"); var line = true; var tag = data = false; do { // first valid line is type - Scholar.Utilities.debug("ignoring "+line); - line = Scholar.read(); + Zotero.Utilities.debug("ignoring "+line); + line = Zotero.read(); line = line.replace(/^\s+/, ""); } while(line !== false && line[0] != "%"); - var item = new Scholar.Item(); + var item = new Zotero.Item(); var tag = line[1]; var data = line.substr(3); - while((line = Scholar.read()) !== false) { // until EOF + while((line = Zotero.read()) !== false) { // until EOF line = line.replace(/^\s+/, ""); if(!line) { if(tag) { @@ -6294,7 +6294,7 @@ function doImport() { tag = data = readRecordEntry = false; // new item item.complete(); - item = new Scholar.Item(); + item = new Zotero.Item(); } } else if(line[0] == "%" && line[2] == " ") { // if this line is a tag, take a look at the previous line to map @@ -6322,16 +6322,16 @@ function doImport() { function addTag(tag, value) { if(value) { - Scholar.write("%"+tag+" "+value+"\r\n"); + Zotero.write("%"+tag+" "+value+"\r\n"); } } function doExport() { // use UTF-8 to export - Scholar.setCharacterSet("UTF-8"); + Zotero.setCharacterSet("UTF-8"); var item; - while(item = Scholar.nextItem()) { + while(item = Zotero.nextItem()) { // can''t store independent notes in RIS if(item.itemType == "note" || item.itemType == "attachment") { continue; @@ -6364,22 +6364,22 @@ function doExport() { if(item.tags) { addTag("K", item.tags.join("\r\n")); } - Scholar.write("\r\n"); + Zotero.write("\r\n"); } }'); -REPLACE INTO "translators" VALUES ('9cb70025-a888-4a29-a210-93ec52da40d4', '2006-10-01 17:00:00', 1, 100, 3, 'BibTeX', 'Simon Kornblith', 'bib', -'Scholar.configure("dataMode", "block"); +REPLACE INTO "translators" VALUES ('9cb70025-a888-4a29-a210-93ec52da40d4', '2006-10-02 17:00:00', 1, 100, 3, 'BibTeX', 'Simon Kornblith', 'bib', +'Zotero.configure("dataMode", "block"); function detectImport() { var block = ""; var read; // read 20 chars out of the file - while(read = Scholar.read(1)) { + while(read = Zotero.read(1)) { if(read == "%") { // read until next newline block = ""; - while(Scholar.read(1) != "\n") {} + while(Zotero.read(1) != "\n") {} } else if(read == "\n" && block) { break; } else if(" \n\r\t".indexOf(read) == -1) { @@ -6503,7 +6503,7 @@ function processField(item, field, value) { // parse authors/editors var names = value.split(" and "); for each(var name in names) { - item.creators.push(Scholar.Utilities.cleanAuthor(name, field, + item.creators.push(Zotero.Utilities.cleanAuthor(name, field, (name.indexOf(",") != -1))); } } else if(field == "institution" || field == "organization") { @@ -6511,7 +6511,7 @@ function processField(item, field, value) { } else if(field == "month") { var monthIndex = months.indexOf(value.toLowerCase()); if(monthIndex != -1) { - value = Scholar.Utilities.formatDate({month:monthIndex}); + value = Zotero.Utilities.formatDate({month:monthIndex}); } else { value += " "; } @@ -6553,22 +6553,22 @@ function processField(item, field, value) { function getFieldValue() { // read whitespace - var read = Scholar.read(1); + var read = Zotero.read(1); while(" \n\r\t".indexOf(read) != -1) { - read = Scholar.read(1); + read = Zotero.read(1); } var value = ""; // now, we have the first character of the field if("0123456789".indexOf(read) != -1) { // character is a number - while((read = Scholar.read(1)) && ("0123456789".indexOf(read) != -1)) { + while((read = Zotero.read(1)) && ("0123456789".indexOf(read) != -1)) { value += read; } } else if(read == "{") { // character is a brace var openBraces = 1; - while(read = Scholar.read(1)) { + while(read = Zotero.read(1)) { if(read == "{" && value[value.length-1] != "\\") { openBraces++; value += "{"; @@ -6585,7 +6585,7 @@ function getFieldValue() { } } else if(read == ''"'') { var openBraces = 0; - while(read = Scholar.read(1)) { + while(read = Zotero.read(1)) { if(read == "{" && value[value.length-1] != "\\") { openBraces++; value += "{"; @@ -6631,21 +6631,21 @@ function getFieldValue() { function beginRecord(type, closeChar) { type = type.toLowerCase() if(inputTypeMap[type]) { - var item = new Scholar.Item(inputTypeMap[type]); + var item = new Zotero.Item(inputTypeMap[type]); } else { for(var i in typeMap) { if(typeMap[i] == type) { - var item = new Scholar.Item(i); + var item = new Zotero.Item(i); break; } } if(!item) { - Scholar.Utilities.debug("discarded item from BibTeX; type was "+type); + Zotero.Utilities.debug("discarded item from BibTeX; type was "+type); } } var field = ""; - while(read = Scholar.read(1)) { + while(read = Zotero.read(1)) { if(read == "=") { // equals begin a field var value = getFieldValue(); if(item) { @@ -6677,7 +6677,7 @@ function doImport() { var read = "", text = "", recordCloseElement = false; var type = false; - while(read = Scholar.read(1)) { + while(read = Zotero.read(1)) { if(read == "@") { type = ""; } else if(type !== false) { @@ -6709,7 +6709,7 @@ function writeField(field, value) { value = value.replace(/[\u0080-\uFFFF]/g, "?") // write - Scholar.write(",\n\t"+field+" = {"+value+"}"); + Zotero.write(",\n\t"+field+" = {"+value+"}"); } var numberRe = /^[0-9]+/; @@ -6721,12 +6721,12 @@ function doExport() { } accentedCharacters = newArray; - Scholar.write("% BibTeX export generated by Zotero "+Scholar.Utilities.getVersion()); + Zotero.write("% BibTeX export generated by Zotero "+Zotero.Utilities.getVersion()); var first = true; var citekeys = new Object(); var item; - while(item = Scholar.nextItem()) { + while(item = Zotero.nextItem()) { // determine type if(!typeMap[item.itemType]) { continue; @@ -6738,7 +6738,7 @@ function doExport() { basekey = item.creators[0].lastName.toLowerCase(); } if(item.date) { - var date = Scholar.Utilities.strToDate(item.date); + var date = Zotero.Utilities.strToDate(item.date); if(date.year && numberRe.test(date.year)) { basekey += date.year; } @@ -6753,7 +6753,7 @@ function doExport() { citekeys[citekey] = true; // write citation key - Scholar.write((first ? "" : ",") + "\n\n@"+typeMap[item.itemType]+"{"+citekey); + Zotero.write((first ? "" : ",") + "\n\n@"+typeMap[item.itemType]+"{"+citekey); first = false; for(var field in fieldMap) { @@ -6819,14 +6819,14 @@ function doExport() { writeField("keywords", item.tags.join(",")); } - Scholar.write("\n}"); + Zotero.write("\n}"); } }'); -REPLACE INTO "translators" VALUES ('a6ee60df-1ddc-4aae-bb25-45e0537be973', '2006-07-16 17:18:00', 1, 100, 1, 'MARC', 'Simon Kornblith', 'marc', +REPLACE INTO "translators" VALUES ('a6ee60df-1ddc-4aae-bb25-45e0537be973', '2006-10-02 17:00:00', 1, 100, 1, 'MARC', 'Simon Kornblith', 'marc', 'function detectImport() { var marcRecordRegexp = /^[0-9]{5}[a-z ]{3}$/ - var read = Scholar.read(8); + var read = Zotero.read(8); if(marcRecordRegexp.test(read)) { return true; } @@ -6880,7 +6880,7 @@ function corpAuthor(author) { // regular author extraction function author(author, type, useComma) { - return Scholar.Utilities.cleanAuthor(author, type, useComma); + return Zotero.Utilities.cleanAuthor(author, type, useComma); } /* @@ -6947,7 +6947,7 @@ record.prototype.addField = function(field, indicator, value) { if(indicator.length > this.indicatorLength) { indicator = indicator.substr(0, this.indicatorLength); } else if(indicator.length != this.indicatorLength) { - indicator = Scholar.Utilities.lpad(indicator, " ", this.indicatorLength); + indicator = Zotero.Utilities.lpad(indicator, " ", this.indicatorLength); } // add terminator @@ -7012,7 +7012,7 @@ record.prototype.getFieldSubfields = function(tag) { // returns a two-dimensiona // add field to DB record.prototype._associateDBField = function(item, fieldNo, part, fieldName, execMe, arg1, arg2) { var field = this.getFieldSubfields(fieldNo); - Scholar.Utilities.debug(''found ''+field.length+'' matches for ''+fieldNo+part); + Zotero.Utilities.debug(''found ''+field.length+'' matches for ''+fieldNo+part); if(field) { for(var i in field) { var value = false; @@ -7153,7 +7153,7 @@ record.prototype.translate = function(item) { this._associateDBField(item, "050", "ab", "callNumber"); if(item.title) { - item.title = Scholar.Utilities.capitalizeTitle(item.title); + item.title = Zotero.Utilities.capitalizeTitle(item.title); } } @@ -7161,18 +7161,18 @@ function doImport() { var text; var holdOver = ""; // part of the text held over from the last loop - Scholar.setCharacterSet("utf-8"); + Zotero.setCharacterSet("utf-8"); - while(text = Scholar.read(4096)) { // read in 4096 byte increments + while(text = Zotero.read(4096)) { // read in 4096 byte increments var records = text.split("\x1D"); - Scholar.Utilities.debug(records); + Zotero.Utilities.debug(records); if(records.length > 1) { records[0] = holdOver + records[0]; holdOver = records.pop(); // skip last record, since it''s not done for(var i in records) { - var newItem = new Scholar.Item(); + var newItem = new Zotero.Item(); // create new record var rec = new record(); @@ -7187,7 +7187,7 @@ function doImport() { } }'); -REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '2006-09-04 20:14:00', 'American Psychological Association', +REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '2006-10-02 17:00:00', 'American Psychological Association', '<?xml version="1.0" encoding="UTF-8"?> <?oxygen RNGSchema="../schema/trunk/csl.rnc" type="compact"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="author-date" xml:lang="en"> @@ -7348,7 +7348,7 @@ REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '200 </bibliography> </style>'); -REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/chicago-note.csl', '2006-09-04 20:27:00', 'Chicago Manual of Style (Note)', +REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/chicago-note.csl', '2006-10-02 17:00:00', 'Chicago Manual of Style (Note)', '<?xml version="1.0" encoding="UTF-8"?> <?oxygen RNGSchema="../schema/trunk/csl.rnc" type="compact"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="note" xml:lang="en"> @@ -7480,7 +7480,7 @@ REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/chicago-note.c </citation> </style>'); -REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/mla.csl', '2006-09-04 20:28:00', 'Modern Language Association', +REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/mla.csl', '2006-10-02 17:00:00', 'Modern Language Association', '<?xml version="1.0" encoding="UTF-8"?> <?oxygen RNGSchema="../schema/trunk/csl.rnc" type="compact"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="author" xml:lang="en">