From f07ff9ac2a6b1ced0d52139e0ef0751356e33fc4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 12 Aug 2006 00:18:20 +0000 Subject: [PATCH] Renamed "Files" to "Attachments" -- since Files could be links as well as actually files (or both, for web page snapshots), things were getting just about as confusing as when Items were called Objects. If you have attachments to the old terminology, feel free to file a complaint. Changed interface code too, since David is gone (or at the very least has more important things to do with his remaining time) --- .../chromeFiles/content/scholar/itemPane.js | 68 ++--- .../chromeFiles/content/scholar/itemPane.xul | 14 +- .../content/scholar/itemTreeView.js | 34 +-- chrome/chromeFiles/content/scholar/overlay.js | 60 ++--- .../chromeFiles/content/scholar/overlay.xul | 20 +- .../content/scholar/xpcom/data_access.js | 250 +++++++++--------- .../content/scholar/xpcom/schema.js | 9 +- .../locale/en-US/scholar/scholar.dtd | 12 +- .../locale/en-US/scholar/scholar.properties | 10 +- ...files-add.png => item-attachments-add.png} | Bin .../skin/default/scholar/overlay.css | 20 +- ...-file.png => treeitem-attachment-file.png} | Bin ...-link.png => treeitem-attachment-link.png} | Bin ...t.png => treeitem-attachment-snapshot.png} | Bin ...k.png => treeitem-attachment-web-link.png} | Bin ...eitem-file.png => treeitem-attachment.png} | Bin schema.sql | 18 +- 17 files changed, 259 insertions(+), 256 deletions(-) rename chrome/chromeFiles/skin/default/scholar/{item-files-add.png => item-attachments-add.png} (100%) rename chrome/chromeFiles/skin/default/scholar/{treeitem-file-file.png => treeitem-attachment-file.png} (100%) rename chrome/chromeFiles/skin/default/scholar/{treeitem-file-link.png => treeitem-attachment-link.png} (100%) rename chrome/chromeFiles/skin/default/scholar/{treeitem-file-snapshot.png => treeitem-attachment-snapshot.png} (100%) rename chrome/chromeFiles/skin/default/scholar/{treeitem-file-web-link.png => treeitem-attachment-web-link.png} (100%) rename chrome/chromeFiles/skin/default/scholar/{treeitem-file.png => treeitem-attachment.png} (100%) diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js index 85941b533a..de81d93424 100644 --- a/chrome/chromeFiles/content/scholar/itemPane.js +++ b/chrome/chromeFiles/content/scholar/itemPane.js @@ -46,9 +46,9 @@ ScholarItemPane = new function() this.modifyCreator = modifyCreator; this.removeNote = removeNote; this.addNote = addNote; - this.removeFile = removeFile; - this.addFileFromDialog = addFileFromDialog; - this.addFileFromPage = addFileFromPage; + this.removeAttachment = removeAttachment; + this.addAttachmentFromDialog = addAttachmentFromDialog; + this.addAttachmentFromPage = addAttachmentFromPage; function onLoad() { @@ -58,8 +58,8 @@ ScholarItemPane = new function() _creatorTypeMenu = document.getElementById('creatorTypeMenu'); _notesList = document.getElementById('editpane-dynamic-notes'); _notesLabel = document.getElementById('editpane-notes-label'); - _filesList = document.getElementById('editpane-dynamic-files'); - _filesLabel = document.getElementById('editpane-files-label'); + _attachmentsList = document.getElementById('editpane-dynamic-attachments'); + _attachmentsLabel = document.getElementById('editpane-attachments-label'); _tagsBox = document.getElementById('editpane-tags'); _relatedBox = document.getElementById('editpane-related'); @@ -76,7 +76,7 @@ ScholarItemPane = new function() var itemTypes = Scholar.ItemTypes.getTypes(); for(var i = 0; i - @@ -73,7 +73,7 @@ - + diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js index fe6187f263..2264c2e375 100644 --- a/chrome/chromeFiles/content/scholar/itemTreeView.js +++ b/chrome/chromeFiles/content/scholar/itemTreeView.js @@ -144,7 +144,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) if(!item.getSource()) { - //most likely, the note or file's parent was removed. + //most likely, the note or attachment's parent was removed. this._showItem(new Scholar.ItemTreeView.TreeRow(item,0,false),this.rowCount); this._treebox.rowCountChanged(this.rowCount-1,1); madeChanges = true; @@ -240,22 +240,22 @@ Scholar.ItemTreeView.prototype.getImageSrc = function(row, col) { var item = this._getItemAtRow(row); var itemType = Scholar.ItemTypes.getName(item.getType()); - if(itemType == 'file') + if(itemType == 'attachment') { - var linkMode = item.ref.getFileLinkMode(); - if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_FILE) + var linkMode = item.ref.getAttachmentLinkMode(); + if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_FILE) { itemType = itemType + "-file"; } - else if(linkMode == Scholar.Files.LINK_MODE_LINKED_FILE) + else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_FILE) { itemType = itemType + "-link"; } - else if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_URL) + else if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL) { itemType = itemType + "-snapshot"; } - else if(linkMode == Scholar.Files.LINK_MODE_LINKED_URL) + else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_URL) { itemType = itemType + "-web-link"; } @@ -277,7 +277,7 @@ Scholar.ItemTreeView.prototype.isContainerOpen = function(row) Scholar.ItemTreeView.prototype.isContainerEmpty = function(row) { - return (this._getItemAtRow(row).numNotes() == 0 && this._getItemAtRow(row).numFiles() == 0); + return (this._getItemAtRow(row).numNotes() == 0 && this._getItemAtRow(row).numAttachments() == 0); } Scholar.ItemTreeView.prototype.getLevel = function(row) @@ -323,14 +323,14 @@ Scholar.ItemTreeView.prototype.toggleOpenState = function(row) { var item = this._getItemAtRow(row).ref; //Get children - var files = item.getFiles(); + var attachments = item.getAttachments(); var notes = item.getNotes(); var newRows; - if(files && notes) - newRows = files.concat(notes); - else if(files) - newRows = files; + if(attachments && notes) + newRows = attachments.concat(notes); + else if(attachments) + newRows = attachments; else if(notes) newRows = notes; @@ -737,9 +737,9 @@ Scholar.ItemTreeView.TreeRow.prototype.isNote = function() return this.ref.isNote(); } -Scholar.ItemTreeView.TreeRow.prototype.isFile = function() +Scholar.ItemTreeView.TreeRow.prototype.isAttachment = function() { - return this.ref.isFile(); + return this.ref.isAttachment(); } Scholar.ItemTreeView.TreeRow.prototype.isRegularItem = function() @@ -780,10 +780,10 @@ Scholar.ItemTreeView.TreeRow.prototype.numNotes = function() return 0; } -Scholar.ItemTreeView.TreeRow.prototype.numFiles = function() +Scholar.ItemTreeView.TreeRow.prototype.numAttachments = function() { if(this.isRegularItem()) - return this.ref.numFiles(); + return this.ref.numAttachments(); else return 0; } \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 0815127d35..15d9c2dc11 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -50,9 +50,9 @@ var ScholarPane = new function() this.onDoubleClick = onDoubleClick; this.openNoteWindow = openNoteWindow; this.newNote = newNote; - this.addFileFromDialog = addFileFromDialog; - this.addFileFromPage = addFileFromPage; - this.viewSelectedFile = viewSelectedFile; + this.addAttachmentFromDialog = addAttachmentFromDialog; + this.addAttachmentFromPage = addAttachmentFromPage; + this.viewSelectedAttachment = viewSelectedAttachment; /* * Called when the window is open @@ -223,11 +223,11 @@ var ScholarPane = new function() document.getElementById('scholar-view-note-button').removeAttribute('sourceID'); document.getElementById('item-pane').selectedIndex = 2; } - else if(item.isFile()) + else if(item.isAttachment()) { - document.getElementById('scholar-file-label').setAttribute('value',item.getField('title')); - document.getElementById('scholar-file-view').setAttribute('disabled', item.ref.getFileLinkMode() == Scholar.Files.LINK_MODE_LINKED_URL); - document.getElementById('scholar-file-links').item = item.ref; + document.getElementById('scholar-attachment-label').setAttribute('value',item.getField('title')); + document.getElementById('scholar-attachment-view').setAttribute('disabled', item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_LINKED_URL); + document.getElementById('scholar-attachment-links').item = item.ref; document.getElementById('item-pane').selectedIndex = 3; } else @@ -267,7 +267,7 @@ var ScholarPane = new function() { itemsView.selection.getRangeAt(i,start,end); for (var j=start.value; j<=end.value && !hasChildren; j++) - if(itemsView._getItemAtRow(j).numNotes() || itemsView._getItemAtRow(j).numFiles()) + if(itemsView._getItemAtRow(j).numNotes() || itemsView._getItemAtRow(j).numAttachments()) hasChildren = true; } } @@ -443,9 +443,9 @@ var ScholarPane = new function() { document.getElementById('scholar-view-note-button').doCommand(); } - else if(item && item.isFile()) + else if(item && item.isAttachment()) { - viewSelectedFile(); + viewSelectedAttachment(); } } } @@ -465,31 +465,31 @@ var ScholarPane = new function() window.open('chrome://scholar/content/note.xul?v=1'+(id ? '&id='+id : '')+(parent ? '&coll='+parent : ''),'','chrome,resizable,centerscreen'); } - function addFileFromDialog(link, id) + function addAttachmentFromDialog(link, id) { var nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); - fp.init(window, Scholar.getString('pane.item.files.select'), nsIFilePicker.modeOpen); + fp.init(window, Scholar.getString('pane.item.attachments.select'), nsIFilePicker.modeOpen); if(fp.show() == nsIFilePicker.returnOK) { - var fileID; + var attachmentID; if(link) - fileID = Scholar.Files.linkFromFile(fp.file, id); + attachmentID = Scholar.Attachments.linkFromFile(fp.file, id); else - fileID = Scholar.Files.importFromFile(fp.file, id); + attachmentID = Scholar.Attachments.importFromFile(fp.file, id); - if(fileID && !id) + if(attachmentID && !id) { var c = getSelectedCollection(); if(c) - c.addItem(fileID); + c.addItem(attachmentID); } } } - function addFileFromPage(link, id) + function addAttachmentFromPage(link, id) { var item; if(id == null) @@ -504,36 +504,36 @@ var ScholarPane = new function() } } - var fileID; + var attachmentID; if(link) - fileID = Scholar.Files.linkFromDocument(window.content.document, id); + attachmentID = Scholar.Attachments.linkFromDocument(window.content.document, id); else - fileID = Scholar.Files.importFromDocument(window.content.document, id); + attachmentID = Scholar.Attachments.importFromDocument(window.content.document, id); - if(fileID && item) + if(attachmentID && item) { - var file = Scholar.Items.get(fileID); - if(file) + var attachment = Scholar.Items.get(attachmentID); + if(attachment) { - item.setField('title',file.getField('title')); + item.setField('title',attachment.getField('title')); item.save(); } } } - function viewSelectedFile() + function viewSelectedAttachment() { if(itemsView && itemsView.selection.count == 1) { - var file = getSelectedItems()[0]; + var attachment = getSelectedItems()[0]; - if(file.getFileLinkMode() != Scholar.Files.LINK_MODE_LINKED_URL) + if(attachment.getAttachmentLinkMode() != Scholar.Attachments.LINK_MODE_LINKED_URL) { - window.loadURI(file.getLocalFileURL()); + window.loadURI(attachment.getLocalFileURL()); } else { - window.loadURI(file.getFileURL()); + window.loadURI(attachment.getURL()); } } } diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index f3eb4ef670..75b68223c6 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -101,12 +101,12 @@ - + - - - - + + + + @@ -180,7 +180,7 @@ @@ -194,10 +194,10 @@