diff --git a/chrome/chromeFiles/content/scholar/bindings/noteeditor.xml b/chrome/chromeFiles/content/scholar/bindings/noteeditor.xml
index a590a4cba1..e1ac667e13 100644
--- a/chrome/chromeFiles/content/scholar/bindings/noteeditor.xml
+++ b/chrome/chromeFiles/content/scholar/bindings/noteeditor.xml
@@ -19,8 +19,10 @@
if(citeLabel.firstChild)
citeLabel.removeChild(citeLabel.firstChild);
- if(this.item)
+ if(this.item && !this.getAttribute('notitle')=='1')
+ {
citeLabel.appendChild(document.createTextNode(this.item.getField('title')));
+ }
]]>
diff --git a/chrome/chromeFiles/content/scholar/itemPane.xul b/chrome/chromeFiles/content/scholar/itemPane.xul
index 12a0fce53c..2157ece0f9 100644
--- a/chrome/chromeFiles/content/scholar/itemPane.xul
+++ b/chrome/chromeFiles/content/scholar/itemPane.xul
@@ -58,6 +58,7 @@
+
diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js
index e813881ff4..783287f67d 100644
--- a/chrome/chromeFiles/content/scholar/overlay.js
+++ b/chrome/chromeFiles/content/scholar/overlay.js
@@ -41,6 +41,7 @@ var ScholarPane = new function()
this.addAttachmentFromDialog = addAttachmentFromDialog;
this.addAttachmentFromPage = addAttachmentFromPage;
this.viewSelectedAttachment = viewSelectedAttachment;
+ this.showSelectedAttachmentInFilesystem = showSelectedAttachmentInFilesystem;
/*
* Called when the window is open
@@ -267,17 +268,47 @@ var ScholarPane = new function()
label.appendChild(document.createTextNode(val));
}
+ // Metadata for URL's
if (item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_LINKED_URL
|| item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_IMPORTED_URL)
{
- var str = Scholar.getString('pane.item.attachments.view.link');
+ // "View Page"/"View Snapshot" label
+ if (item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_IMPORTED_URL)
+ {
+ var str = Scholar.getString('pane.item.attachments.view.snapshot');
+ }
+ else
+ {
+ var str = Scholar.getString('pane.item.attachments.view.link');
+ }
+
+ document.getElementById('scholar-attachment-show').setAttribute('hidden', true);
+
+ // URL
+ document.getElementById('scholar-attachment-url').setAttribute('value', item.getField('url'));
+ document.getElementById('scholar-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);
}
+ // 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);
}
+
document.getElementById('scholar-attachment-view').setAttribute('label', str);
- document.getElementById('scholar-attachment-links').item = item.ref;
+
+ var noteEditor = document.getElementById('scholar-attachment-note-editor');
+ noteEditor.item = null;
+ noteEditor.note = item.ref;
+
document.getElementById('item-pane').selectedIndex = 3;
}
else
@@ -454,7 +485,7 @@ var ScholarPane = new function()
{
if(collectionsView.selection.count > 0 && collectionsView.selection.currentIndex != -1)
{
- collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex);
+ var collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex);
if(collection && collection.isCollection())
return collection.ref;
}
@@ -464,7 +495,7 @@ var ScholarPane = new function()
{
if(collectionsView.selection.count > 0 && collectionsView.selection.currentIndex != -1)
{
- collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex);
+ var collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex);
if(collection && collection.isSearch())
{
return collection.ref;
@@ -659,7 +690,7 @@ var ScholarPane = new function()
accessDate: "CURRENT_TIMESTAMP"
}
- newItem(Scholar.ItemTypes.getID('website'), data);
+ newItem(Scholar.ItemTypes.getID('webpage'), data);
}
@@ -682,6 +713,7 @@ var ScholarPane = new function()
}
}
+
function viewSelectedAttachment()
{
if(itemsView && itemsView.selection.count == 1)
@@ -701,7 +733,22 @@ var ScholarPane = new function()
}
else
{
- window.loadURI(attachment.getURL());
+ window.loadURI(attachment.getField('url'));
+ }
+ }
+ }
+
+
+ function showSelectedAttachmentInFilesystem()
+ {
+ if(itemsView && itemsView.selection.count == 1)
+ {
+ var attachment = getSelectedItems()[0];
+
+ if (attachment.getAttachmentLinkMode() != Scholar.Attachments.LINK_MODE_LINKED_URL)
+ {
+ var file = attachment.getFile();
+ file.reveal();
}
}
}
diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul
index 51c3ef06ff..73c4f8a3c4 100644
--- a/chrome/chromeFiles/content/scholar/overlay.xul
+++ b/chrome/chromeFiles/content/scholar/overlay.xul
@@ -104,6 +104,8 @@
+
+
@@ -187,14 +189,23 @@
+
+
-
-
+
+
+
+
+
+
+
+
+
diff --git a/chrome/chromeFiles/content/scholar/xpcom/cite.js b/chrome/chromeFiles/content/scholar/xpcom/cite.js
index aa67196d58..fd38aec53b 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/cite.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/cite.js
@@ -1466,7 +1466,7 @@ Scholar.CSL.prototype._getFieldValue = function(name, element, item, format,
interview:"interview",
film:"motion picture",
artwork:"graphic",
- website:"webpage"
+ webpage:"webpage"
};
// TODO: check with Elena/APA/MLA on this
Scholar.CSL._fallbackTypeMappings = {
@@ -1481,7 +1481,7 @@ Scholar.CSL._fallbackTypeMappings = {
interview:"book",
film:"book",
artwork:"book",
- website:"article"
+ webpage:"article"
};
Scholar.CSL.prototype._getTypeFromItem = function(item) {
diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
index 7bd6085c81..e46c2f197a 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/data_access.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
@@ -587,7 +587,7 @@ Scholar.Item.prototype.save = function(){
this.getField(fieldID));
}
updateStatement.bindInt32Parameter(2, fieldID);
- updateStatement.execute();
+ updateStatement.executeStep();
}
}
@@ -617,7 +617,7 @@ Scholar.Item.prototype.save = function(){
this.getField(fieldID));
}
- insertStatement.execute();
+ insertStatement.executeStep();
}
}
}
@@ -736,7 +736,7 @@ Scholar.Item.prototype.save = function(){
else {
statement.bindUTF8StringParameter(2, this.getField(fieldID));
}
- statement.execute();
+ statement.executeStep();
}
Scholar.History.add('itemData', 'itemID-fieldID',
@@ -868,7 +868,7 @@ Scholar.Item.prototype.isNote = function(){
* Note: This can only be called on note items.
**/
Scholar.Item.prototype.updateNote = function(text){
- if (!this.isNote()){
+ if (!this.isNote() && !this.isAttachment()){
throw ("updateNote() can only be called on items of type 'note'");
}
@@ -878,7 +878,12 @@ Scholar.Item.prototype.updateNote = function(text){
Scholar.DB.beginTransaction();
- var sql = "UPDATE itemNotes SET note=? WHERE itemID=?";
+ if (this.isNote()){
+ var sql = "UPDATE itemNotes SET note=? WHERE itemID=?";
+ }
+ else {
+ var sql = "REPLACE INTO itemNotes (note, itemID) VALUES (?,?)";
+ }
var bindParams = [{string:text}, this.getID()];
var updated = Scholar.DB.query(sql, bindParams);
if (updated){
@@ -897,7 +902,9 @@ Scholar.Item.prototype.updateNote = function(text){
Scholar.Item.prototype.updateNoteCache = function(text){
// Update cached values
this._noteData = text ? text : '';
- this.setField('title', this._noteToTitle(), true);
+ if (this.isNote()){
+ this.setField('title', this._noteToTitle(), true);
+ }
}
@@ -1015,8 +1022,8 @@ Scholar.Item.prototype.numNotes = function(){
* Get the text of an item note
**/
Scholar.Item.prototype.getNote = function(){
- if (!this.isNote()){
- throw ("getNote() can only be called on items of type 'note'");
+ if (!this.isNote() && !this.isAttachment()){
+ throw ("getNote() can only be called on notes and attachments");
}
if (this._noteData !== null){
@@ -1120,7 +1127,7 @@ Scholar.Item.prototype.numAttachments = function(){
* _row_ is optional itemAttachments row if available to skip query
*
* Note: Always returns false for items with LINK_MODE_LINKED_URL,
-* since they have no files -- use getURL() instead
+* since they have no files -- use getField('url') instead
**/
Scholar.Item.prototype.getFile = function(row){
if (!this.isAttachment()){
@@ -1158,33 +1165,6 @@ Scholar.Item.prototype.getFile = function(row){
}
-/*
- * Return the URL string associated with a linked or imported URL
- */
-Scholar.Item.prototype.getURL = function(){
- if (!this.isAttachment()){
- throw ("getURL() can only be called on items of type 'attachment'");
- }
-
- var sql = "SELECT linkMode, path, originalPath FROM itemAttachments "
- + "WHERE itemID=" + this.getID();
- var row = Scholar.DB.rowQuery(sql);
-
- if (!row){
- throw ('Attachment data not found for item ' + this.getID() + ' in getURL()');
- }
-
- switch (row['linkMode']){
- case Scholar.Attachments.LINK_MODE_LINKED_URL:
- return row['path'];
- case Scholar.Attachments.LINK_MODE_IMPORTED_URL:
- return row['originalPath'];
- default:
- throw ('getURL() cannot be called on attachments without associated URLs');
- }
-}
-
-
/*
* Return a file:/// URL path to files and snapshots
*/
@@ -1479,7 +1459,7 @@ Scholar.Item.prototype.erase = function(deleteChildren){
// Regular item
- // Delete child notes and files
+ // If flag given, delete child notes and files
else if (deleteChildren){
var sql = "SELECT itemID FROM itemNotes WHERE sourceItemID=?1 UNION "
+ "SELECT itemID FROM itemAttachments WHERE sourceItemID=?1";
@@ -1493,7 +1473,7 @@ Scholar.Item.prototype.erase = function(deleteChildren){
}
}
- // Just unlink any child notes or files without deleting
+ // Otherwise just unlink any child notes or files without deleting
else {
// Notes
var sql = "SELECT itemID FROM itemNotes WHERE sourceItemID=" + this.getID();
@@ -2127,6 +2107,8 @@ Scholar.Attachments = new function(){
// Create a new attachment
var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment'));
attachmentItem.setField('title', title);
+ attachmentItem.setField('url', url);
+ // TODO: access date
attachmentItem.save();
var itemID = attachmentItem.getID();
@@ -2203,6 +2185,8 @@ Scholar.Attachments = new function(){
// Create a new attachment
var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment'));
attachmentItem.setField('title', title);
+ attachmentItem.setField('url', url);
+ attachmentItem.setField('accessDate', "CURRENT_TIMESTAMP");
attachmentItem.save();
var itemID = attachmentItem.getID();
@@ -2291,6 +2275,8 @@ Scholar.Attachments = new function(){
// Create a new attachment
var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment'));
attachmentItem.setField('title', title);
+ attachmentItem.setField('url', url);
+ attachmentItem.setField('accessDate', "CURRENT_TIMESTAMP");
attachmentItem.save();
var itemID = attachmentItem.getID();
@@ -2363,14 +2349,7 @@ Scholar.Attachments = new function(){
* Returns the itemID of the new attachment
**/
function _addToDB(file, url, title, linkMode, mimeType, charsetID, sourceItemID, itemID){
- if (url){
- var path = url;
- }
if (file){
- if (linkMode==self.LINK_MODE_IMPORTED_URL){
- var originalPath = path;
- }
-
// Path relative to Scholar directory for external files and relative
// to storage directory for imported files
var refDir = (linkMode==this.LINK_MODE_LINKED_FILE)
@@ -2403,19 +2382,23 @@ Scholar.Attachments = new function(){
else {
var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment'));
attachmentItem.setField('title', title);
+ if (linkMode==self.LINK_MODE_IMPORTED_URL
+ || linkMode==self.LINK_MODE_LINKED_URL){
+ attachmentItem.setField('url', url);
+ attachmentItem.setField('accessDate', "CURRENT_TIMESTAMP");
+ }
attachmentItem.save();
}
var sql = "INSERT INTO itemAttachments (itemID, sourceItemID, linkMode, "
- + "mimeType, charsetID, path, originalPath) VALUES (?,?,?,?,?,?,?)";
+ + "mimeType, charsetID, path) VALUES (?,?,?,?,?,?)";
var bindParams = [
attachmentItem.getID(),
(sourceItemID ? {int:sourceItemID} : null),
{int:linkMode},
{string:mimeType},
(charsetID ? {int:charsetID} : null),
- {string:path},
- (originalPath ? {string:originalPath} : null)
+ (path ? {string:path} : null)
];
Scholar.DB.query(sql, bindParams);
Scholar.DB.commitTransaction();
diff --git a/chrome/chromeFiles/content/scholar/xpcom/fulltext.js b/chrome/chromeFiles/content/scholar/xpcom/fulltext.js
index 75960a4dca..af838253b2 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/fulltext.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/fulltext.js
@@ -63,7 +63,7 @@ Scholar.Fulltext = new function(){
* Index multiple words at once
*/
function indexWords(itemID, words){
- if (!words || !words.length){
+ if (!words || !words.length || !itemID){
return false;
}
@@ -98,12 +98,12 @@ Scholar.Fulltext = new function(){
}
else {
statement1.bindUTF8StringParameter(0, word);
- statement1.execute()
+ statement1.executeStep()
var wordID = Scholar.DB.getLastInsertID();
}
statement2.bindInt32Parameter(0, wordID);
- statement2.execute();
+ statement2.executeStep();
}
statement1.reset();
diff --git a/chrome/chromeFiles/content/scholar/xpcom/schema.js b/chrome/chromeFiles/content/scholar/xpcom/schema.js
index bbcd5cd57b..e93ae26e5a 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/schema.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/schema.js
@@ -482,6 +482,15 @@ Scholar.Schema = new function(){
if (i==1){
Scholar.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){}
+ }
}
_updateSchema('user');
diff --git a/chrome/chromeFiles/content/scholar/xpcom/translate.js b/chrome/chromeFiles/content/scholar/xpcom/translate.js
index a4b56b265c..7e73f40a3d 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/translate.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/translate.js
@@ -903,7 +903,7 @@ Scholar.Translate.prototype._translationComplete = function(returnValue, error)
Scholar.debug("translation using "+this.translator[0].label+" failed: \n"+errorString);
if(this.type == "web") {
- // report translation error for websites
+ // report translation error for webpages
this._reportTranslationFailure(errorString);
}
} else {
@@ -1081,8 +1081,8 @@ Scholar.Translate.prototype._itemDone = function(item) {
}
try { // make sure notifier gets turned back on when done
- // Get typeID, defaulting to "website"
- var type = (item.itemType ? item.itemType : "website");
+ // Get typeID, defaulting to "webpage"
+ var type = (item.itemType ? item.itemType : "webpage");
if(type == "note") { // handle notes differently
var myID = Scholar.Notes.add(item.note);
@@ -1717,11 +1717,11 @@ Scholar.Translate.prototype._exportGetAttachment = function(attachment) {
var attachmentID = attachment.getID();
var linkMode = attachment.getAttachmentLinkMode();
- // get url if one exists
+ // get URL and accessDate if they exist
if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_URL ||
linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL) {
- var url = attachment.getURL()
- attachmentArray.url = url;
+ attachmentArray.url = attachment.getField('url');
+ attachmentArray.accessDate = attachment.getField('accessDate');
} else if(!this._displayOptions["exportFileData"]) {
// only export urls, not files, if exportFileData is off
return false;
diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
index d0fb99e714..4ab06eb475 100644
--- a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
+++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
@@ -43,10 +43,12 @@
+
+
diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties
index fe7b746608..829e017b71 100644
--- a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties
+++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties
@@ -30,6 +30,7 @@ pane.item.notes.delete.confirm = Are you sure you want to delete this note?
pane.item.notes.count.singular = %1 note
pane.item.notes.count.plural = %1 notes
pane.item.attachments.view.link = View Page
+pane.item.attachments.view.snapshot = View Snapshot
pane.item.attachments.view.file = View File
pane.item.attachments.delete.confirm = Are you sure you want to delete this attachment?
pane.item.attachments.count.singular = %1 attachment
@@ -81,7 +82,7 @@ itemTypes.manuscript = Manuscript
itemTypes.interview = Interview
itemTypes.film = Film
itemTypes.artwork = Artwork
-itemTypes.website = Web Page
+itemTypes.webpage = Web Page
itemTypes.attachment = Attachment
creatorTypes.author = Author
diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css
index 8a5f964cf7..57cd8c9035 100644
--- a/chrome/chromeFiles/skin/default/scholar/overlay.css
+++ b/chrome/chromeFiles/skin/default/scholar/overlay.css
@@ -52,6 +52,10 @@
height: 24px;
}
+#scholar-pane toolbarseparator {
+ height:24px;
+}
+
#scholar-pane toolbar .toggler
{
margin: 4px;
@@ -108,6 +112,11 @@
list-style-image: url('chrome://scholar/skin/toolbar-item-from-page.png');
}
+#tb-link-page
+{
+ list-style-image: url('chrome://scholar/skin/toolbar-link-add.png');
+}
+
#tb-snapshot-page
{
list-style-image: url('chrome://scholar/skin/toolbar-snapshot-add.png');
diff --git a/chrome/chromeFiles/skin/default/scholar/scholar.css b/chrome/chromeFiles/skin/default/scholar/scholar.css
index 96f6f64fc4..8819b93e1d 100644
--- a/chrome/chromeFiles/skin/default/scholar/scholar.css
+++ b/chrome/chromeFiles/skin/default/scholar/scholar.css
@@ -112,11 +112,12 @@ zoterosearchtextbox .toolbarbutton-menu-dropmarker
margin-bottom:-1px;
}
-/* DEBUG: this doesn't seem to work, unfortunately */
+/* DEBUG: this doesn't seem to work, unfortunately
#editpane-dynamic-fields label[singleField=false]:after
{
content:",";
}
+*/
.clicky, .unclicky
{
diff --git a/chrome/chromeFiles/skin/default/scholar/toolbar-link-add.png b/chrome/chromeFiles/skin/default/scholar/toolbar-link-add.png
new file mode 100644
index 0000000000..00be352c57
Binary files /dev/null and b/chrome/chromeFiles/skin/default/scholar/toolbar-link-add.png differ
diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-website.png b/chrome/chromeFiles/skin/default/scholar/treeitem-webpage.png
similarity index 100%
rename from chrome/chromeFiles/skin/default/scholar/treeitem-website.png
rename to chrome/chromeFiles/skin/default/scholar/treeitem-webpage.png
diff --git a/scrapers.sql b/scrapers.sql
index 0ba898d7dd..85a69e7c11 100644
--- a/scrapers.sql
+++ b/scrapers.sql
@@ -1,7 +1,7 @@
--- 91
+-- 92
-- Set the following timestamp to the most recent scraper update date
-REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00'));
+REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-10-01 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/',
'function detectWeb(doc, url) {
@@ -2713,14 +2713,14 @@ function doSearch(item) {
lookupPMIDs([getPMID(item.contextObject)]);
}');
-REPLACE INTO "translators" VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '2006-06-26 16:41:00', 1, 100, 4, 'Embedded RDF', 'Simon Kornblith', NULL,
+REPLACE INTO "translators" VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '2006-10-01 17:00:00', 1, 100, 4, 'Embedded RDF', 'Simon Kornblith', NULL,
'function detectWeb(doc, url) {
var metaTags = doc.getElementsByTagName("meta");
for(var i=0; i