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)
|
@ -46,9 +46,9 @@ ScholarItemPane = new function()
|
||||||
this.modifyCreator = modifyCreator;
|
this.modifyCreator = modifyCreator;
|
||||||
this.removeNote = removeNote;
|
this.removeNote = removeNote;
|
||||||
this.addNote = addNote;
|
this.addNote = addNote;
|
||||||
this.removeFile = removeFile;
|
this.removeAttachment = removeAttachment;
|
||||||
this.addFileFromDialog = addFileFromDialog;
|
this.addAttachmentFromDialog = addAttachmentFromDialog;
|
||||||
this.addFileFromPage = addFileFromPage;
|
this.addAttachmentFromPage = addAttachmentFromPage;
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
{
|
{
|
||||||
|
@ -58,8 +58,8 @@ ScholarItemPane = new function()
|
||||||
_creatorTypeMenu = document.getElementById('creatorTypeMenu');
|
_creatorTypeMenu = document.getElementById('creatorTypeMenu');
|
||||||
_notesList = document.getElementById('editpane-dynamic-notes');
|
_notesList = document.getElementById('editpane-dynamic-notes');
|
||||||
_notesLabel = document.getElementById('editpane-notes-label');
|
_notesLabel = document.getElementById('editpane-notes-label');
|
||||||
_filesList = document.getElementById('editpane-dynamic-files');
|
_attachmentsList = document.getElementById('editpane-dynamic-attachments');
|
||||||
_filesLabel = document.getElementById('editpane-files-label');
|
_attachmentsLabel = document.getElementById('editpane-attachments-label');
|
||||||
_tagsBox = document.getElementById('editpane-tags');
|
_tagsBox = document.getElementById('editpane-tags');
|
||||||
_relatedBox = document.getElementById('editpane-related');
|
_relatedBox = document.getElementById('editpane-related');
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ ScholarItemPane = new function()
|
||||||
|
|
||||||
var itemTypes = Scholar.ItemTypes.getTypes();
|
var itemTypes = Scholar.ItemTypes.getTypes();
|
||||||
for(var i = 0; i<itemTypes.length; i++)
|
for(var i = 0; i<itemTypes.length; i++)
|
||||||
if(itemTypes[i]['name'] != 'note' && itemTypes[i]['name'] != 'file')
|
if(itemTypes[i]['name'] != 'note' && itemTypes[i]['name'] != 'attachment')
|
||||||
_itemTypeMenu.appendItem(Scholar.getString("itemTypes."+itemTypes[i]['name']),itemTypes[i]['id']);
|
_itemTypeMenu.appendItem(Scholar.getString("itemTypes."+itemTypes[i]['name']),itemTypes[i]['id']);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -186,42 +186,42 @@ ScholarItemPane = new function()
|
||||||
}
|
}
|
||||||
else if(index == 2)
|
else if(index == 2)
|
||||||
{
|
{
|
||||||
//FILES
|
//ATTACHMENTS
|
||||||
while(_filesList.hasChildNodes())
|
while(_attachmentsList.hasChildNodes())
|
||||||
_filesList.removeChild(_filesList.firstChild);
|
_attachmentsList.removeChild(_attachmentsList.firstChild);
|
||||||
|
|
||||||
var files = Scholar.Items.get(_itemBeingEdited.getFiles());
|
var attachments = Scholar.Items.get(_itemBeingEdited.getAttachments());
|
||||||
if(files.length)
|
if(attachments.length)
|
||||||
{
|
{
|
||||||
for(var i = 0; i < files.length; i++)
|
for(var i = 0; i < attachments.length; i++)
|
||||||
{
|
{
|
||||||
var icon = document.createElement('image');
|
var icon = document.createElement('image');
|
||||||
var linkMode = files[i].getFileLinkMode();
|
var linkMode = attachments[i].getAttachmentLinkMode();
|
||||||
if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_FILE)
|
if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_FILE)
|
||||||
{
|
{
|
||||||
itemType = "-file";
|
itemType = "-file";
|
||||||
}
|
}
|
||||||
else if(linkMode == Scholar.Files.LINK_MODE_LINKED_FILE)
|
else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_FILE)
|
||||||
{
|
{
|
||||||
itemType = "-link";
|
itemType = "-link";
|
||||||
}
|
}
|
||||||
else if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_URL)
|
else if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL)
|
||||||
{
|
{
|
||||||
itemType = "-snapshot";
|
itemType = "-snapshot";
|
||||||
}
|
}
|
||||||
else if(linkMode == Scholar.Files.LINK_MODE_LINKED_URL)
|
else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_URL)
|
||||||
{
|
{
|
||||||
itemType = "-web-link";
|
itemType = "-web-link";
|
||||||
}
|
}
|
||||||
icon.setAttribute('src','chrome://scholar/skin/treeitem-file'+itemType+'.png');
|
icon.setAttribute('src','chrome://scholar/skin/treeitem-file'+itemType+'.png');
|
||||||
|
|
||||||
var label = document.createElement('label');
|
var label = document.createElement('label');
|
||||||
label.setAttribute('value',files[i].getField('title'));
|
label.setAttribute('value',attachments[i].getField('title'));
|
||||||
label.setAttribute('flex','1'); //so that the long names will flex smaller
|
label.setAttribute('flex','1'); //so that the long names will flex smaller
|
||||||
label.setAttribute('crop','end');
|
label.setAttribute('crop','end');
|
||||||
|
|
||||||
var box = document.createElement('box');
|
var box = document.createElement('box');
|
||||||
box.setAttribute('onclick',"ScholarPane.selectItem('"+files[i].getID()+"')");
|
box.setAttribute('onclick',"ScholarPane.selectItem('"+attachments[i].getID()+"')");
|
||||||
box.setAttribute('class','clicky');
|
box.setAttribute('class','clicky');
|
||||||
box.appendChild(icon);
|
box.appendChild(icon);
|
||||||
box.appendChild(label);
|
box.appendChild(label);
|
||||||
|
@ -229,17 +229,17 @@ ScholarItemPane = new function()
|
||||||
var removeButton = document.createElement('label');
|
var removeButton = document.createElement('label');
|
||||||
removeButton.setAttribute("value","-");
|
removeButton.setAttribute("value","-");
|
||||||
removeButton.setAttribute("class","clicky");
|
removeButton.setAttribute("class","clicky");
|
||||||
removeButton.setAttribute("onclick","ScholarItemPane.removeFile("+files[i].getID()+")");
|
removeButton.setAttribute("onclick","ScholarItemPane.removeAttachment("+attachments[i].getID()+")");
|
||||||
|
|
||||||
var row = document.createElement('row');
|
var row = document.createElement('row');
|
||||||
row.appendChild(box);
|
row.appendChild(box);
|
||||||
row.appendChild(removeButton);
|
row.appendChild(removeButton);
|
||||||
|
|
||||||
_filesList.appendChild(row);
|
_attachmentsList.appendChild(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateFileCount();
|
_updateAttachmentCount();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(index == 3)
|
else if(index == 3)
|
||||||
|
@ -471,29 +471,29 @@ ScholarItemPane = new function()
|
||||||
_notesLabel.value = Scholar.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
|
_notesLabel.value = Scholar.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
|
||||||
}
|
}
|
||||||
|
|
||||||
function _updateFileCount()
|
function _updateAttachmentCount()
|
||||||
{
|
{
|
||||||
var c = _filesList.childNodes.length;
|
var c = _attachmentsList.childNodes.length;
|
||||||
|
|
||||||
_filesLabel.value = Scholar.getString('pane.item.files.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
|
_attachmentsLabel.value = Scholar.getString('pane.item.attachments.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeFile(id)
|
function removeAttachment(id)
|
||||||
{
|
{
|
||||||
var file = Scholar.Items.get(id);
|
var attachment = Scholar.Items.get(id);
|
||||||
if(file)
|
if(attachment)
|
||||||
if(confirm(Scholar.getString('pane.item.files.delete.confirm')))
|
if(confirm(Scholar.getString('pane.item.attachments.delete.confirm')))
|
||||||
file.erase();
|
attachment.erase();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addFileFromDialog(link)
|
function addAttachmentFromDialog(link)
|
||||||
{
|
{
|
||||||
ScholarPane.addFileFromDialog(link, _itemBeingEdited.getID());
|
ScholarPane.addAttachmentFromDialog(link, _itemBeingEdited.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
function addFileFromPage(link)
|
function addAttachmentFromPage(link)
|
||||||
{
|
{
|
||||||
ScholarPane.addFileFromPage(link, _itemBeingEdited.getID());
|
ScholarPane.addAttachmentFromPage(link, _itemBeingEdited.getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,13 +58,13 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
<vbox flex="1">
|
<vbox flex="1">
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<label id="editpane-files-label"/>
|
<label id="editpane-attachments-label"/>
|
||||||
<button id="tb-item-files-add" type="menu" label="&item.add;">
|
<button id="tb-item-attachments-add" type="menu" label="&item.add;">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem class="menuitem-iconic" id="tb-item-files-link" label="&toolbar.file.linked;" oncommand="ScholarItemPane.addFileFromDialog(true);"/>
|
<menuitem class="menuitem-iconic" id="tb-item-attachments-link" label="&toolbar.attachment.linked;" oncommand="ScholarItemPane.addAttachmentFromDialog(true);"/>
|
||||||
<menuitem class="menuitem-iconic" id="tb-item-files-file" label="&toolbar.file.add;" oncommand="ScholarItemPane.addFileFromDialog();"/>
|
<menuitem class="menuitem-iconic" id="tb-item-attachments-file" label="&toolbar.attachment.add;" oncommand="ScholarItemPane.addAttachmentFromDialog();"/>
|
||||||
<menuitem class="menuitem-iconic" id="tb-item-files-web-link" label="&toolbar.file.weblink;" oncommand="ScholarItemPane.addFileFromPage(true);"/>
|
<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-files-snapshot" label="&toolbar.file.snapshot;" oncommand="ScholarItemPane.addFileFromPage();"/>
|
<menuitem class="menuitem-iconic" id="tb-item-attachments-snapshot" label="&toolbar.attachment.snapshot;" oncommand="ScholarItemPane.addAttachmentFromPage();"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</button>
|
</button>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
<column flex="1"/>
|
<column flex="1"/>
|
||||||
<column/>
|
<column/>
|
||||||
</columns>
|
</columns>
|
||||||
<rows id="editpane-dynamic-files" flex="1"/>
|
<rows id="editpane-dynamic-attachments" flex="1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</vbox>
|
</vbox>
|
||||||
<tagsbox id="editpane-tags" flex="1"/>
|
<tagsbox id="editpane-tags" flex="1"/>
|
||||||
|
|
|
@ -144,7 +144,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids)
|
||||||
|
|
||||||
if(!item.getSource())
|
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._showItem(new Scholar.ItemTreeView.TreeRow(item,0,false),this.rowCount);
|
||||||
this._treebox.rowCountChanged(this.rowCount-1,1);
|
this._treebox.rowCountChanged(this.rowCount-1,1);
|
||||||
madeChanges = true;
|
madeChanges = true;
|
||||||
|
@ -240,22 +240,22 @@ Scholar.ItemTreeView.prototype.getImageSrc = function(row, col)
|
||||||
{
|
{
|
||||||
var item = this._getItemAtRow(row);
|
var item = this._getItemAtRow(row);
|
||||||
var itemType = Scholar.ItemTypes.getName(item.getType());
|
var itemType = Scholar.ItemTypes.getName(item.getType());
|
||||||
if(itemType == 'file')
|
if(itemType == 'attachment')
|
||||||
{
|
{
|
||||||
var linkMode = item.ref.getFileLinkMode();
|
var linkMode = item.ref.getAttachmentLinkMode();
|
||||||
if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_FILE)
|
if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_FILE)
|
||||||
{
|
{
|
||||||
itemType = itemType + "-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";
|
itemType = itemType + "-link";
|
||||||
}
|
}
|
||||||
else if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_URL)
|
else if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL)
|
||||||
{
|
{
|
||||||
itemType = itemType + "-snapshot";
|
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";
|
itemType = itemType + "-web-link";
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ Scholar.ItemTreeView.prototype.isContainerOpen = function(row)
|
||||||
|
|
||||||
Scholar.ItemTreeView.prototype.isContainerEmpty = 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)
|
Scholar.ItemTreeView.prototype.getLevel = function(row)
|
||||||
|
@ -323,14 +323,14 @@ Scholar.ItemTreeView.prototype.toggleOpenState = function(row)
|
||||||
{
|
{
|
||||||
var item = this._getItemAtRow(row).ref;
|
var item = this._getItemAtRow(row).ref;
|
||||||
//Get children
|
//Get children
|
||||||
var files = item.getFiles();
|
var attachments = item.getAttachments();
|
||||||
var notes = item.getNotes();
|
var notes = item.getNotes();
|
||||||
|
|
||||||
var newRows;
|
var newRows;
|
||||||
if(files && notes)
|
if(attachments && notes)
|
||||||
newRows = files.concat(notes);
|
newRows = attachments.concat(notes);
|
||||||
else if(files)
|
else if(attachments)
|
||||||
newRows = files;
|
newRows = attachments;
|
||||||
else if(notes)
|
else if(notes)
|
||||||
newRows = notes;
|
newRows = notes;
|
||||||
|
|
||||||
|
@ -737,9 +737,9 @@ Scholar.ItemTreeView.TreeRow.prototype.isNote = function()
|
||||||
return this.ref.isNote();
|
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()
|
Scholar.ItemTreeView.TreeRow.prototype.isRegularItem = function()
|
||||||
|
@ -780,10 +780,10 @@ Scholar.ItemTreeView.TreeRow.prototype.numNotes = function()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scholar.ItemTreeView.TreeRow.prototype.numFiles = function()
|
Scholar.ItemTreeView.TreeRow.prototype.numAttachments = function()
|
||||||
{
|
{
|
||||||
if(this.isRegularItem())
|
if(this.isRegularItem())
|
||||||
return this.ref.numFiles();
|
return this.ref.numAttachments();
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -50,9 +50,9 @@ var ScholarPane = new function()
|
||||||
this.onDoubleClick = onDoubleClick;
|
this.onDoubleClick = onDoubleClick;
|
||||||
this.openNoteWindow = openNoteWindow;
|
this.openNoteWindow = openNoteWindow;
|
||||||
this.newNote = newNote;
|
this.newNote = newNote;
|
||||||
this.addFileFromDialog = addFileFromDialog;
|
this.addAttachmentFromDialog = addAttachmentFromDialog;
|
||||||
this.addFileFromPage = addFileFromPage;
|
this.addAttachmentFromPage = addAttachmentFromPage;
|
||||||
this.viewSelectedFile = viewSelectedFile;
|
this.viewSelectedAttachment = viewSelectedAttachment;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when the window is open
|
* Called when the window is open
|
||||||
|
@ -223,11 +223,11 @@ var ScholarPane = new function()
|
||||||
document.getElementById('scholar-view-note-button').removeAttribute('sourceID');
|
document.getElementById('scholar-view-note-button').removeAttribute('sourceID');
|
||||||
document.getElementById('item-pane').selectedIndex = 2;
|
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-attachment-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-attachment-view').setAttribute('disabled', item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_LINKED_URL);
|
||||||
document.getElementById('scholar-file-links').item = item.ref;
|
document.getElementById('scholar-attachment-links').item = item.ref;
|
||||||
document.getElementById('item-pane').selectedIndex = 3;
|
document.getElementById('item-pane').selectedIndex = 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -267,7 +267,7 @@ var ScholarPane = new function()
|
||||||
{
|
{
|
||||||
itemsView.selection.getRangeAt(i,start,end);
|
itemsView.selection.getRangeAt(i,start,end);
|
||||||
for (var j=start.value; j<=end.value && !hasChildren; j++)
|
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;
|
hasChildren = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -443,9 +443,9 @@ var ScholarPane = new function()
|
||||||
{
|
{
|
||||||
document.getElementById('scholar-view-note-button').doCommand();
|
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');
|
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 nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||||
.createInstance(nsIFilePicker);
|
.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)
|
if(fp.show() == nsIFilePicker.returnOK)
|
||||||
{
|
{
|
||||||
var fileID;
|
var attachmentID;
|
||||||
if(link)
|
if(link)
|
||||||
fileID = Scholar.Files.linkFromFile(fp.file, id);
|
attachmentID = Scholar.Attachments.linkFromFile(fp.file, id);
|
||||||
else
|
else
|
||||||
fileID = Scholar.Files.importFromFile(fp.file, id);
|
attachmentID = Scholar.Attachments.importFromFile(fp.file, id);
|
||||||
|
|
||||||
if(fileID && !id)
|
if(attachmentID && !id)
|
||||||
{
|
{
|
||||||
var c = getSelectedCollection();
|
var c = getSelectedCollection();
|
||||||
if(c)
|
if(c)
|
||||||
c.addItem(fileID);
|
c.addItem(attachmentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addFileFromPage(link, id)
|
function addAttachmentFromPage(link, id)
|
||||||
{
|
{
|
||||||
var item;
|
var item;
|
||||||
if(id == null)
|
if(id == null)
|
||||||
|
@ -504,36 +504,36 @@ var ScholarPane = new function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileID;
|
var attachmentID;
|
||||||
if(link)
|
if(link)
|
||||||
fileID = Scholar.Files.linkFromDocument(window.content.document, id);
|
attachmentID = Scholar.Attachments.linkFromDocument(window.content.document, id);
|
||||||
else
|
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);
|
var attachment = Scholar.Items.get(attachmentID);
|
||||||
if(file)
|
if(attachment)
|
||||||
{
|
{
|
||||||
item.setField('title',file.getField('title'));
|
item.setField('title',attachment.getField('title'));
|
||||||
item.save();
|
item.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewSelectedFile()
|
function viewSelectedAttachment()
|
||||||
{
|
{
|
||||||
if(itemsView && itemsView.selection.count == 1)
|
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
|
else
|
||||||
{
|
{
|
||||||
window.loadURI(file.getFileURL());
|
window.loadURI(attachment.getURL());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,12 +101,12 @@
|
||||||
<toolbarbutton id="tb-add" tooltiptext="&toolbar.newItem.label;" type="menu">
|
<toolbarbutton id="tb-add" tooltiptext="&toolbar.newItem.label;" type="menu">
|
||||||
<menupopup/>
|
<menupopup/>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
<toolbarbutton id="tb-file-add" type="menu" tooltiptext="&toolbar.file.standalone;">
|
<toolbarbutton id="tb-attachment-add" type="menu" tooltiptext="&toolbar.attachment.standalone;">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem label="&toolbar.file.linked;" oncommand="ScholarPane.addFileFromDialog(true);"/>
|
<menuitem label="&toolbar.attachment.linked;" oncommand="ScholarPane.addAttachmentFromDialog(true);"/>
|
||||||
<menuitem label="&toolbar.file.add;" oncommand="ScholarPane.addFileFromDialog();"/>
|
<menuitem label="&toolbar.attachment.add;" oncommand="ScholarPane.addAttachmentFromDialog();"/>
|
||||||
<menuitem label="&toolbar.file.weblink;" oncommand="ScholarPane.addFileFromPage(true);"/>
|
<menuitem label="&toolbar.attachment.weblink;" oncommand="ScholarPane.addAttachmentFromPage(true);"/>
|
||||||
<menuitem label="&toolbar.file.snapshot;" oncommand="ScholarPane.addFileFromPage();"/>
|
<menuitem label="&toolbar.attachment.snapshot;" oncommand="ScholarPane.addAttachmentFromPage();"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
<toolbarbutton id="tb-note-add" tooltiptext="&toolbar.note.standalone;" oncommand="ScholarPane.newNote();"/>
|
<toolbarbutton id="tb-note-add" tooltiptext="&toolbar.note.standalone;" oncommand="ScholarPane.newNote();"/>
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
<tabs id="scholar-view-tabs" onselect="document.getElementById('scholar-view-item').selectedIndex = this.selectedIndex;" hidden="true">
|
<tabs id="scholar-view-tabs" onselect="document.getElementById('scholar-view-item').selectedIndex = this.selectedIndex;" hidden="true">
|
||||||
<tab label="&tabs.info.label;"/>
|
<tab label="&tabs.info.label;"/>
|
||||||
<tab label="&tabs.notes.label;"/>
|
<tab label="&tabs.notes.label;"/>
|
||||||
<tab label="&tabs.files.label;"/>
|
<tab label="&tabs.attachments.label;"/>
|
||||||
<tab label="&tabs.tags.label;"/>
|
<tab label="&tabs.tags.label;"/>
|
||||||
<tab label="&tabs.related.label;"/>
|
<tab label="&tabs.related.label;"/>
|
||||||
</tabs>
|
</tabs>
|
||||||
|
@ -194,10 +194,10 @@
|
||||||
<noteeditor id="scholar-note-editor" flex="1"/>
|
<noteeditor id="scholar-note-editor" flex="1"/>
|
||||||
<button id="scholar-view-note-button" label="¬es.separate;" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ScholarPane.selectItem(this.getAttribute('sourceID'));"/>
|
<button id="scholar-view-note-button" label="¬es.separate;" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ScholarPane.selectItem(this.getAttribute('sourceID'));"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
<vbox id="scholar-view-file" flex="1">
|
<vbox id="scholar-view-attachment" flex="1">
|
||||||
<label id="scholar-file-label"/>
|
<label id="scholar-attachment-label"/>
|
||||||
<button id="scholar-file-view" label="View File" oncommand="ScholarPane.viewSelectedFile();"/>
|
<button id="scholar-attachment-view" label="View Attachment" oncommand="ScholarPane.viewSelectedAttachment();"/>
|
||||||
<linksbox id="scholar-file-links" flex="1"/>
|
<linksbox id="scholar-attachment-links" flex="1"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
</deck>
|
</deck>
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
|
@ -49,7 +49,7 @@ Scholar.Item.prototype.isPrimaryField = function(field){
|
||||||
Scholar.Item.primaryFields = Scholar.DB.getColumnHash('items');
|
Scholar.Item.primaryFields = Scholar.DB.getColumnHash('items');
|
||||||
Scholar.Item.primaryFields['firstCreator'] = true;
|
Scholar.Item.primaryFields['firstCreator'] = true;
|
||||||
Scholar.Item.primaryFields['numNotes'] = true;
|
Scholar.Item.primaryFields['numNotes'] = true;
|
||||||
Scholar.Item.primaryFields['numFiles'] = true;
|
Scholar.Item.primaryFields['numAttachments'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!Scholar.Item.primaryFields[field];
|
return !!Scholar.Item.primaryFields[field];
|
||||||
|
@ -77,7 +77,7 @@ Scholar.Item.prototype.loadFromID = function(id){
|
||||||
+ 'CASE ((SELECT COUNT(*) FROM itemCreators WHERE itemID=' + id + ')>1) '
|
+ 'CASE ((SELECT COUNT(*) FROM itemCreators WHERE itemID=' + id + ')>1) '
|
||||||
+ "WHEN 0 THEN '' ELSE ' et al.' END AS firstCreator, "
|
+ "WHEN 0 THEN '' ELSE ' et al.' END AS firstCreator, "
|
||||||
+ "(SELECT COUNT(*) FROM itemNotes WHERE sourceItemID=I.itemID) AS numNotes, "
|
+ "(SELECT COUNT(*) FROM itemNotes WHERE sourceItemID=I.itemID) AS numNotes, "
|
||||||
+ "(SELECT COUNT(*) FROM itemFiles WHERE sourceItemID=I.itemID) AS numFiles "
|
+ "(SELECT COUNT(*) FROM itemAttachments WHERE sourceItemID=I.itemID) AS numAttachments "
|
||||||
+ 'FROM items I '
|
+ 'FROM items I '
|
||||||
+ 'LEFT JOIN itemCreators IC ON (I.itemID=IC.itemID) '
|
+ 'LEFT JOIN itemCreators IC ON (I.itemID=IC.itemID) '
|
||||||
+ 'LEFT JOIN creators C ON (IC.creatorID=C.creatorID) '
|
+ 'LEFT JOIN creators C ON (IC.creatorID=C.creatorID) '
|
||||||
|
@ -778,7 +778,7 @@ Scholar.Item.prototype.updateDateModified = function(){
|
||||||
|
|
||||||
|
|
||||||
Scholar.Item.prototype.isRegularItem = function(){
|
Scholar.Item.prototype.isRegularItem = function(){
|
||||||
return !(this.isNote() || this.isFile());
|
return !(this.isNote() || this.isAttachment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -851,12 +851,12 @@ Scholar.Item.prototype.setSource = function(sourceItemID){
|
||||||
var type = 'note';
|
var type = 'note';
|
||||||
var Type = 'Note';
|
var Type = 'Note';
|
||||||
}
|
}
|
||||||
else if (this.isFile()){
|
else if (this.isAttachment()){
|
||||||
var type = 'file';
|
var type = 'attachment';
|
||||||
var Type = 'file';
|
var Type = 'Attachment';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ("setSource() can only be called on items of type 'note' or 'file'");
|
throw ("setSource() can only be called on items of type 'note' or 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.getID()){
|
if (!this.getID()){
|
||||||
|
@ -902,8 +902,8 @@ Scholar.Item.prototype.setSource = function(sourceItemID){
|
||||||
case 'note':
|
case 'note':
|
||||||
oldItem.decrementNoteCount();
|
oldItem.decrementNoteCount();
|
||||||
break;
|
break;
|
||||||
case 'file':
|
case 'attachment':
|
||||||
oldItem.decrementFileCount();
|
oldItem.decrementAttachmentCount();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Scholar.Notifier.trigger('modify', 'item', oldSourceItemID);
|
Scholar.Notifier.trigger('modify', 'item', oldSourceItemID);
|
||||||
|
@ -913,8 +913,8 @@ Scholar.Item.prototype.setSource = function(sourceItemID){
|
||||||
case 'note':
|
case 'note':
|
||||||
newItem.incrementNoteCount();
|
newItem.incrementNoteCount();
|
||||||
break;
|
break;
|
||||||
case 'file':
|
case 'attachment':
|
||||||
newItem.incrementFileCount();
|
newItem.incrementAttachmentCount();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Scholar.Notifier.trigger('modify', 'item', sourceItemID);
|
Scholar.Notifier.trigger('modify', 'item', sourceItemID);
|
||||||
|
@ -970,11 +970,11 @@ Scholar.Item.prototype.getSource = function(){
|
||||||
if (this.isNote()){
|
if (this.isNote()){
|
||||||
var Type = 'Note';
|
var Type = 'Note';
|
||||||
}
|
}
|
||||||
else if (this.isFile()){
|
else if (this.isAttachment()){
|
||||||
var Type = 'File';
|
var Type = 'Attachment';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ("getSource() can only be called on items of type 'note' or 'file'");
|
throw ("getSource() can only be called on items of type 'note' or 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT sourceItemID FROM item" + Type + "s WHERE itemID=" + this.getID();
|
var sql = "SELECT sourceItemID FROM item" + Type + "s WHERE itemID=" + this.getID();
|
||||||
|
@ -1003,65 +1003,66 @@ Scholar.Item.prototype.getNotes = function(){
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Methods dealing with file items
|
// Methods dealing with attachments
|
||||||
//
|
//
|
||||||
// save() is not required for file functions
|
// save() is not required for attachment functions
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
Scholar.Item.prototype.incrementFileCount = function(){
|
Scholar.Item.prototype.incrementAttachmentCount = function(){
|
||||||
this._data['numFiles']++;
|
this._data['numAttachments']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scholar.Item.prototype.decrementFileCount = function(){
|
Scholar.Item.prototype.decrementAttachmentCount = function(){
|
||||||
this._data['numFiles']--;
|
this._data['numAttachments']--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if an item is a file
|
* Determine if an item is an attachment
|
||||||
**/
|
**/
|
||||||
Scholar.Item.prototype.isFile = function(){
|
Scholar.Item.prototype.isAttachment = function(){
|
||||||
return Scholar.ItemTypes.getName(this.getType())=='file';
|
return Scholar.ItemTypes.getName(this.getType())=='attachment';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns number of files in item
|
* Returns number of files in item
|
||||||
**/
|
**/
|
||||||
Scholar.Item.prototype.numFiles = function(){
|
Scholar.Item.prototype.numAttachments = function(){
|
||||||
if (this.isFile()){
|
if (this.isAttachment()){
|
||||||
throw ("numFiles() cannot be called on items of type 'file'");
|
throw ("numAttachments() cannot be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.getID()){
|
if (!this.getID()){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._data['numFiles'];
|
return this._data['numAttachments'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an nsILocalFile for the file item, or false if the associated file doesn't exist
|
* Get an nsILocalFile for the attachment, or false if the associated file
|
||||||
|
* doesn't exist
|
||||||
*
|
*
|
||||||
* Note: Always returns false for items with LINK_MODE_LINKED_URL,
|
* Note: Always returns false for items with LINK_MODE_LINKED_URL,
|
||||||
* since they have no files -- use getFileURL() instead
|
* since they have no files -- use getURL() instead
|
||||||
**/
|
**/
|
||||||
Scholar.Item.prototype.getFile = function(){
|
Scholar.Item.prototype.getFile = function(){
|
||||||
if (!this.isFile()){
|
if (!this.isAttachment()){
|
||||||
throw ("getFile() can only be called on items of type 'file'");
|
throw ("getFile() can only be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT linkMode, path FROM itemFiles WHERE itemID=" + this.getID();
|
var sql = "SELECT linkMode, path FROM itemAttachments WHERE itemID=" + this.getID();
|
||||||
var row = Scholar.DB.rowQuery(sql);
|
var row = Scholar.DB.rowQuery(sql);
|
||||||
|
|
||||||
if (!row){
|
if (!row){
|
||||||
throw ('File data not found for item ' + this.getID() + ' in getFile()');
|
throw ('Attachment data not found for item ' + this.getID() + ' in getFile()');
|
||||||
}
|
}
|
||||||
|
|
||||||
// No associated files for linked URLs
|
// No associated files for linked URLs
|
||||||
if (row['linkMode']==Scholar.Files.LINK_MODE_LINKED_URL){
|
if (row['linkMode']==Scholar.Attachments.LINK_MODE_LINKED_URL){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1083,26 +1084,26 @@ Scholar.Item.prototype.getFile = function(){
|
||||||
/*
|
/*
|
||||||
* Return the URL string associated with a linked or imported URL
|
* Return the URL string associated with a linked or imported URL
|
||||||
*/
|
*/
|
||||||
Scholar.Item.prototype.getFileURL = function(){
|
Scholar.Item.prototype.getURL = function(){
|
||||||
if (!this.isFile()){
|
if (!this.isAttachment()){
|
||||||
throw ("getFileURL() can only be called on items of type 'file'");
|
throw ("getURL() can only be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT linkMode, path, originalPath FROM itemFiles "
|
var sql = "SELECT linkMode, path, originalPath FROM itemAttachments "
|
||||||
+ "WHERE itemID=" + this.getID();
|
+ "WHERE itemID=" + this.getID();
|
||||||
var row = Scholar.DB.rowQuery(sql);
|
var row = Scholar.DB.rowQuery(sql);
|
||||||
|
|
||||||
if (!row){
|
if (!row){
|
||||||
throw ('File data not found for item ' + this.getID() + ' in getFileURL()');
|
throw ('Attachment data not found for item ' + this.getID() + ' in getURL()');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (row['linkMode']){
|
switch (row['linkMode']){
|
||||||
case Scholar.Files.LINK_MODE_LINKED_URL:
|
case Scholar.Attachments.LINK_MODE_LINKED_URL:
|
||||||
return row['path'];
|
return row['path'];
|
||||||
case Scholar.Files.LINK_MODE_IMPORTED_URL:
|
case Scholar.Attachments.LINK_MODE_IMPORTED_URL:
|
||||||
return row['originalPath'];
|
return row['originalPath'];
|
||||||
default:
|
default:
|
||||||
throw ('getFileURL() cannot be called on files without associated URLs');
|
throw ('getURL() cannot be called on attachments without associated URLs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1111,8 +1112,8 @@ Scholar.Item.prototype.getFileURL = function(){
|
||||||
* Return a file:/// URL path to files and snapshots
|
* Return a file:/// URL path to files and snapshots
|
||||||
*/
|
*/
|
||||||
Scholar.Item.prototype.getLocalFileURL = function(){
|
Scholar.Item.prototype.getLocalFileURL = function(){
|
||||||
if (!this.isFile){
|
if (!this.isAttachment){
|
||||||
throw ("getLocalFileURL() can only be called on items of type 'file'");
|
throw ("getLocalFileURL() can only be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
var file = this.getFile();
|
var file = this.getFile();
|
||||||
|
@ -1125,65 +1126,65 @@ Scholar.Item.prototype.getLocalFileURL = function(){
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the link mode of a file item
|
* Get the link mode of an attachment
|
||||||
*
|
*
|
||||||
* Possible return values specified as constants in Scholar.Files
|
* Possible return values specified as constants in Scholar.Attachments
|
||||||
* (e.g. Scholar.Files.LINK_MODE_LINKED_FILE)
|
* (e.g. Scholar.Attachments.LINK_MODE_LINKED_FILE)
|
||||||
**/
|
**/
|
||||||
Scholar.Item.prototype.getFileLinkMode = function(){
|
Scholar.Item.prototype.getAttachmentLinkMode = function(){
|
||||||
if (!this.isFile()){
|
if (!this.isAttachment()){
|
||||||
throw ("getFileLinkMode() can only be called on items of type 'file'");
|
throw ("getAttachmentLinkMode() can only be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._fileLinkMode!==null){
|
if (this._fileLinkMode!==null){
|
||||||
return this._fileLinkMode;
|
return this._fileLinkMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT linkMode FROM itemFiles WHERE itemID=" + this.getID();
|
var sql = "SELECT linkMode FROM itemAttachments WHERE itemID=" + this.getID();
|
||||||
this._fileLinkMode = Scholar.DB.valueQuery(sql);
|
this._fileLinkMode = Scholar.DB.valueQuery(sql);
|
||||||
return this._fileLinkMode;
|
return this._fileLinkMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mime type of a file item (e.g. text/plain)
|
* Get the mime type of an attachment (e.g. text/plain)
|
||||||
**/
|
**/
|
||||||
Scholar.Item.prototype.getFileMimeType = function(){
|
Scholar.Item.prototype.getAttachmentMimeType = function(){
|
||||||
if (!this.isFile()){
|
if (!this.isAttachment()){
|
||||||
throw ("getFileData() can only be called on items of type 'file'");
|
throw ("getAttachmentMIMEType() can only be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT mimeType FROM itemFiles WHERE itemID=" + this.getID();
|
var sql = "SELECT mimeType FROM itemAttachments WHERE itemID=" + this.getID();
|
||||||
return Scholar.DB.valueQuery(sql);
|
return Scholar.DB.valueQuery(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the character set id of a file item
|
* Get the character set id of an attachment
|
||||||
**/
|
**/
|
||||||
Scholar.Item.prototype.getFileCharset = function(){
|
Scholar.Item.prototype.getAttachmentCharset = function(){
|
||||||
if (!this.isFile()){
|
if (!this.isAttachment()){
|
||||||
throw ("getFileCharset() can only be called on items of type 'file'");
|
throw ("getAttachmentCharset() can only be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT charsetID FROM itemFiles WHERE itemID=" + this.getID();
|
var sql = "SELECT charsetID FROM itemAttachments WHERE itemID=" + this.getID();
|
||||||
return Scholar.DB.valueQuery(sql);
|
return Scholar.DB.valueQuery(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of file itemIDs for this item
|
* Returns an array of attachment itemIDs that have this item as a source
|
||||||
**/
|
**/
|
||||||
Scholar.Item.prototype.getFiles = function(){
|
Scholar.Item.prototype.getAttachments = function(){
|
||||||
if (this.isFile()){
|
if (this.isAttachment()){
|
||||||
throw ("getFiles() cannot be called on items of type 'file'");
|
throw ("getAttachments() cannot be called on items of type 'attachment'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.getID()){
|
if (!this.getID()){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT itemID FROM itemFiles NATURAL JOIN items "
|
var sql = "SELECT itemID FROM itemAttachments NATURAL JOIN items "
|
||||||
+ "WHERE sourceItemID=" + this.getID() + " ORDER BY dateAdded";
|
+ "WHERE sourceItemID=" + this.getID() + " ORDER BY dateAdded";
|
||||||
return Scholar.DB.columnQuery(sql);
|
return Scholar.DB.columnQuery(sql);
|
||||||
}
|
}
|
||||||
|
@ -1325,22 +1326,22 @@ Scholar.Item.prototype.erase = function(deleteChildren){
|
||||||
changedItems.push(sourceItemID);
|
changedItems.push(sourceItemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// File
|
// Attachment
|
||||||
else if (this.isFile()){
|
else if (this.isAttachment()){
|
||||||
// Decrement file count of source items
|
// Decrement file count of source items
|
||||||
var sql = "SELECT sourceItemID FROM itemFiles WHERE itemID=" + this.getID();
|
var sql = "SELECT sourceItemID FROM itemAttachments WHERE itemID=" + this.getID();
|
||||||
var sourceItemID = Scholar.DB.valueQuery(sql);
|
var sourceItemID = Scholar.DB.valueQuery(sql);
|
||||||
if (sourceItemID){
|
if (sourceItemID){
|
||||||
var sourceItem = Scholar.Items.get(sourceItemID);
|
var sourceItem = Scholar.Items.get(sourceItemID);
|
||||||
sourceItem.decrementFileCount();
|
sourceItem.decrementAttachmentCount();
|
||||||
changedItems.push(sourceItemID);
|
changedItems.push(sourceItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete associated files
|
// Delete associated files
|
||||||
var linkMode = this.getFileLinkMode();
|
var linkMode = this.getAttachmentLinkMode();
|
||||||
switch (linkMode){
|
switch (linkMode){
|
||||||
case Scholar.Files.LINK_MODE_LINKED_FILE:
|
case Scholar.Attachments.LINK_MODE_LINKED_FILE:
|
||||||
case Scholar.Files.LINK_MODE_LINKED_URL:
|
case Scholar.Attachments.LINK_MODE_LINKED_URL:
|
||||||
// Links only -- nothing to delete
|
// Links only -- nothing to delete
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1357,7 +1358,7 @@ Scholar.Item.prototype.erase = function(deleteChildren){
|
||||||
// Delete child notes and files
|
// Delete child notes and files
|
||||||
else if (deleteChildren){
|
else if (deleteChildren){
|
||||||
var sql = "SELECT itemID FROM itemNotes WHERE sourceItemID=?1 UNION "
|
var sql = "SELECT itemID FROM itemNotes WHERE sourceItemID=?1 UNION "
|
||||||
+ "SELECT itemID FROM itemFiles WHERE sourceItemID=?1";
|
+ "SELECT itemID FROM itemAttachments WHERE sourceItemID=?1";
|
||||||
var toDelete = Scholar.DB.columnQuery(sql, [this.getID()]);
|
var toDelete = Scholar.DB.columnQuery(sql, [this.getID()]);
|
||||||
|
|
||||||
if (toDelete){
|
if (toDelete){
|
||||||
|
@ -1380,13 +1381,13 @@ Scholar.Item.prototype.erase = function(deleteChildren){
|
||||||
+ this.getID();
|
+ this.getID();
|
||||||
Scholar.DB.query(sql);
|
Scholar.DB.query(sql);
|
||||||
|
|
||||||
// Files
|
// Attachments
|
||||||
var sql = "SELECT itemID FROM itemFiles WHERE sourceItemID=" + this.getID();
|
var sql = "SELECT itemID FROM itemAttachments WHERE sourceItemID=" + this.getID();
|
||||||
var childFiles = Scholar.DB.columnQuery(sql);
|
var childAttachments = Scholar.DB.columnQuery(sql);
|
||||||
if (childFiles){
|
if (childAttachments){
|
||||||
changedItems.push(childFiles);
|
changedItems.push(childAttachments);
|
||||||
}
|
}
|
||||||
var sql = "UPDATE itemFiles SET sourceItemID=NULL WHERE sourceItemID="
|
var sql = "UPDATE itemAttachments SET sourceItemID=NULL WHERE sourceItemID="
|
||||||
+ this.getID();
|
+ this.getID();
|
||||||
Scholar.DB.query(sql);
|
Scholar.DB.query(sql);
|
||||||
}
|
}
|
||||||
|
@ -1399,7 +1400,7 @@ Scholar.Item.prototype.erase = function(deleteChildren){
|
||||||
|
|
||||||
sql = 'DELETE FROM itemCreators WHERE itemID=' + this.getID() + ";\n";
|
sql = 'DELETE FROM itemCreators WHERE itemID=' + this.getID() + ";\n";
|
||||||
sql += 'DELETE FROM itemNotes WHERE itemID=' + this.getID() + ";\n";
|
sql += 'DELETE FROM itemNotes WHERE itemID=' + this.getID() + ";\n";
|
||||||
sql += 'DELETE FROM itemFiles WHERE itemID=' + this.getID() + ";\n";
|
sql += 'DELETE FROM itemAttachments WHERE itemID=' + this.getID() + ";\n";
|
||||||
sql += 'DELETE FROM itemSeeAlso WHERE itemID=' + this.getID() + ";\n";
|
sql += 'DELETE FROM itemSeeAlso WHERE itemID=' + this.getID() + ";\n";
|
||||||
sql += 'DELETE FROM itemSeeAlso WHERE linkedItemID=' + this.getID() + ";\n";
|
sql += 'DELETE FROM itemSeeAlso WHERE linkedItemID=' + this.getID() + ";\n";
|
||||||
sql += 'DELETE FROM itemTags WHERE itemID=' + this.getID() + ";\n";
|
sql += 'DELETE FROM itemTags WHERE itemID=' + this.getID() + ";\n";
|
||||||
|
@ -1418,8 +1419,8 @@ Scholar.Item.prototype.erase = function(deleteChildren){
|
||||||
if (this.isNote()){
|
if (this.isNote()){
|
||||||
sourceItem.incrementNoteCount();
|
sourceItem.incrementNoteCount();
|
||||||
}
|
}
|
||||||
else if (this.isFile()){
|
else if (this.isAttachment()){
|
||||||
sourceItem.incrementFileCount();
|
sourceItem.incrementAttachmentCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Scholar.DB.rollbackTransaction();
|
Scholar.DB.rollbackTransaction();
|
||||||
|
@ -1466,7 +1467,7 @@ Scholar.Item.prototype.toArray = function(){
|
||||||
// Skip certain fields
|
// Skip certain fields
|
||||||
case 'firstCreator':
|
case 'firstCreator':
|
||||||
case 'numNotes':
|
case 'numNotes':
|
||||||
case 'numFiles':
|
case 'numAttachments':
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// For the rest, just copy over
|
// For the rest, just copy over
|
||||||
|
@ -1480,7 +1481,7 @@ Scholar.Item.prototype.toArray = function(){
|
||||||
arr[Scholar.ItemFields.getName(i)] = this._itemData[i];
|
arr[Scholar.ItemFields.getName(i)] = this._itemData[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isNote() && !this.isFile()){
|
if (!this.isNote() && !this.isAttachment()){
|
||||||
// Creators
|
// Creators
|
||||||
arr['creators'] = [];
|
arr['creators'] = [];
|
||||||
var creators = this.getCreators();
|
var creators = this.getCreators();
|
||||||
|
@ -1519,11 +1520,8 @@ Scholar.Item.prototype.toArray = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append source files
|
// Attachments
|
||||||
if (this.isFile()){
|
if (this.isAttachment()){
|
||||||
arr['fileName'] = arr['title'];
|
|
||||||
delete arr['title'];
|
|
||||||
|
|
||||||
// TODO: file data
|
// TODO: file data
|
||||||
|
|
||||||
if (this.getSource()){
|
if (this.getSource()){
|
||||||
|
@ -1531,13 +1529,13 @@ Scholar.Item.prototype.toArray = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not file, append attached files
|
// If not file, append child attachments
|
||||||
else {
|
else {
|
||||||
arr['files'] = [];
|
arr['attachments'] = [];
|
||||||
var files = this.getFiles();
|
var files = this.getAttachments();
|
||||||
for (var i in files){
|
for (var i in files){
|
||||||
var file = Scholar.Items.get(files[i]);
|
var file = Scholar.Items.get(files[i]);
|
||||||
arr['files'].push({
|
arr['attachments'].push({
|
||||||
itemID: file.getID(),
|
itemID: file.getID(),
|
||||||
// TODO
|
// TODO
|
||||||
tags: file.getTags(),
|
tags: file.getTags(),
|
||||||
|
@ -1820,7 +1818,7 @@ Scholar.Items = new function(){
|
||||||
+ 'CASE ((SELECT COUNT(*) FROM itemCreators WHERE itemID=I.itemID)>1) '
|
+ 'CASE ((SELECT COUNT(*) FROM itemCreators WHERE itemID=I.itemID)>1) '
|
||||||
+ "WHEN 0 THEN '' ELSE ' et al.' END AS firstCreator, "
|
+ "WHEN 0 THEN '' ELSE ' et al.' END AS firstCreator, "
|
||||||
+ "(SELECT COUNT(*) FROM itemNotes WHERE sourceItemID=I.itemID) AS numNotes, "
|
+ "(SELECT COUNT(*) FROM itemNotes WHERE sourceItemID=I.itemID) AS numNotes, "
|
||||||
+ "(SELECT COUNT(*) FROM itemFiles WHERE sourceItemID=I.itemID) AS numFiles "
|
+ "(SELECT COUNT(*) FROM itemAttachments WHERE sourceItemID=I.itemID) AS numAttachments "
|
||||||
+ 'FROM items I '
|
+ 'FROM items I '
|
||||||
+ 'LEFT JOIN itemCreators IC ON (I.itemID=IC.itemID) '
|
+ 'LEFT JOIN itemCreators IC ON (I.itemID=IC.itemID) '
|
||||||
+ 'LEFT JOIN creators C ON (IC.creatorID=C.creatorID) '
|
+ 'LEFT JOIN creators C ON (IC.creatorID=C.creatorID) '
|
||||||
|
@ -1905,7 +1903,7 @@ Scholar.Notes = new function(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scholar.Files = new function(){
|
Scholar.Attachments = new function(){
|
||||||
this.LINK_MODE_IMPORTED_FILE = 0;
|
this.LINK_MODE_IMPORTED_FILE = 0;
|
||||||
this.LINK_MODE_IMPORTED_URL = 1;
|
this.LINK_MODE_IMPORTED_URL = 1;
|
||||||
this.LINK_MODE_LINKED_FILE = 2;
|
this.LINK_MODE_LINKED_FILE = 2;
|
||||||
|
@ -1925,13 +1923,13 @@ Scholar.Files = new function(){
|
||||||
|
|
||||||
Scholar.DB.beginTransaction();
|
Scholar.DB.beginTransaction();
|
||||||
|
|
||||||
// Create a new file item
|
// Create a new attachment
|
||||||
var fileItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('file'));
|
var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment'));
|
||||||
fileItem.setField('title', title);
|
attachmentItem.setField('title', title);
|
||||||
fileItem.save();
|
attachmentItem.save();
|
||||||
var itemID = fileItem.getID();
|
var itemID = attachmentItem.getID();
|
||||||
|
|
||||||
// Create directory for item files within storage directory
|
// Create directory for attachment files within storage directory
|
||||||
var destDir = Scholar.getStorageDirectory();
|
var destDir = Scholar.getStorageDirectory();
|
||||||
destDir.append(itemID);
|
destDir.append(itemID);
|
||||||
destDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644);
|
destDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644);
|
||||||
|
@ -1972,7 +1970,7 @@ Scholar.Files = new function(){
|
||||||
function importFromURL(url, sourceItemID){
|
function importFromURL(url, sourceItemID){
|
||||||
var browser = Scholar.Browser.createHiddenBrowser();
|
var browser = Scholar.Browser.createHiddenBrowser();
|
||||||
browser.addEventListener("pageshow", function(){
|
browser.addEventListener("pageshow", function(){
|
||||||
Scholar.Files.importFromDocument(browser.contentDocument, sourceItemID);
|
Scholar.Attachments.importFromDocument(browser.contentDocument, sourceItemID);
|
||||||
browser.removeEventListener("pageshow", arguments.callee, true);
|
browser.removeEventListener("pageshow", arguments.callee, true);
|
||||||
Scholar.Browser.deleteHiddenBrowser(browser);
|
Scholar.Browser.deleteHiddenBrowser(browser);
|
||||||
}, true);
|
}, true);
|
||||||
|
@ -1995,7 +1993,7 @@ Scholar.Files = new function(){
|
||||||
|
|
||||||
// Otherwise do a head request for the mime type
|
// Otherwise do a head request for the mime type
|
||||||
Scholar.Utilities.HTTP.doHead(url, function(obj){
|
Scholar.Utilities.HTTP.doHead(url, function(obj){
|
||||||
_addToDB(null, url, title, Scholar.Files.LINK_MODE_LINKED_URL,
|
_addToDB(null, url, title, Scholar.Attachments.LINK_MODE_LINKED_URL,
|
||||||
obj.channel.contentType, null, sourceItemID);
|
obj.channel.contentType, null, sourceItemID);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2027,11 +2025,11 @@ Scholar.Files = new function(){
|
||||||
|
|
||||||
Scholar.DB.beginTransaction();
|
Scholar.DB.beginTransaction();
|
||||||
|
|
||||||
// Create a new file item
|
// Create a new attachment
|
||||||
var fileItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('file'));
|
var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment'));
|
||||||
fileItem.setField('title', title);
|
attachmentItem.setField('title', title);
|
||||||
fileItem.save();
|
attachmentItem.save();
|
||||||
var itemID = fileItem.getID();
|
var itemID = attachmentItem.getID();
|
||||||
|
|
||||||
// Create a new folder for this item in the storage directory
|
// Create a new folder for this item in the storage directory
|
||||||
var destDir = Scholar.getStorageDirectory();
|
var destDir = Scholar.getStorageDirectory();
|
||||||
|
@ -2087,14 +2085,14 @@ Scholar.Files = new function(){
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new item of type 'file' and add the file link to the itemFiles table
|
* Create a new item of type 'attachment' and add to the itemAttachments table
|
||||||
*
|
*
|
||||||
* Passing an itemID causes it to skip new item creation and use the specified
|
* Passing an itemID causes it to skip new item creation and use the specified
|
||||||
* item instead -- used when importing files (since we have to know
|
* item instead -- used when importing files (since we have to know
|
||||||
* the itemID before copying in a file and don't want to update the DB before
|
* the itemID before copying in a file and don't want to update the DB before
|
||||||
* the file is saved)
|
* the file is saved)
|
||||||
*
|
*
|
||||||
* Returns the itemID of the new file item
|
* Returns the itemID of the new attachment
|
||||||
**/
|
**/
|
||||||
function _addToDB(file, url, title, linkMode, mimeType, charsetID, sourceItemID, itemID){
|
function _addToDB(file, url, title, linkMode, mimeType, charsetID, sourceItemID, itemID){
|
||||||
if (url){
|
if (url){
|
||||||
|
@ -2118,32 +2116,32 @@ Scholar.Files = new function(){
|
||||||
var sourceItem = Scholar.Items.get(sourceItemID);
|
var sourceItem = Scholar.Items.get(sourceItemID);
|
||||||
if (!sourceItem){
|
if (!sourceItem){
|
||||||
Scholar.DB.commitTransaction();
|
Scholar.DB.commitTransaction();
|
||||||
throw ("Cannot set file source to invalid item " + sourceItemID);
|
throw ("Cannot set attachment source to invalid item " + sourceItemID);
|
||||||
}
|
}
|
||||||
if (sourceItem.isFile()){
|
if (sourceItem.isAttachment()){
|
||||||
Scholar.DB.commitTransaction();
|
Scholar.DB.commitTransaction();
|
||||||
throw ("Cannot set file source to another file (" + sourceItemID + ")");
|
throw ("Cannot set attachment source to another file (" + sourceItemID + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an itemID is provided, use that
|
// If an itemID is provided, use that
|
||||||
if (itemID){
|
if (itemID){
|
||||||
var fileItem = Scholar.Items.get(itemID);
|
var attachmentItem = Scholar.Items.get(itemID);
|
||||||
if (!fileItem.isFile()){
|
if (!attachmentItem.isAttachment()){
|
||||||
throw ("Item " + itemID + " is not a valid file item in _addToDB()");
|
throw ("Item " + itemID + " is not a valid attachment in _addToDB()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Otherwise create a new file item
|
// Otherwise create a new attachment
|
||||||
else {
|
else {
|
||||||
var fileItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('file'));
|
var attachmentItem = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('attachment'));
|
||||||
fileItem.setField('title', title);
|
attachmentItem.setField('title', title);
|
||||||
fileItem.save();
|
attachmentItem.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "INSERT INTO itemFiles (itemID, sourceItemID, linkMode, "
|
var sql = "INSERT INTO itemAttachments (itemID, sourceItemID, linkMode, "
|
||||||
+ "mimeType, charsetID, path, originalPath) VALUES (?,?,?,?,?,?,?)";
|
+ "mimeType, charsetID, path, originalPath) VALUES (?,?,?,?,?,?,?)";
|
||||||
var bindParams = [
|
var bindParams = [
|
||||||
fileItem.getID(),
|
attachmentItem.getID(),
|
||||||
(sourceItemID ? {int:sourceItemID} : null),
|
(sourceItemID ? {int:sourceItemID} : null),
|
||||||
{int:linkMode},
|
{int:linkMode},
|
||||||
{string:mimeType},
|
{string:mimeType},
|
||||||
|
@ -2159,9 +2157,9 @@ Scholar.Files = new function(){
|
||||||
Scholar.Notifier.trigger('modify', 'item', sourceItemID);
|
Scholar.Notifier.trigger('modify', 'item', sourceItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scholar.Notifier.trigger('add', 'item', fileItem.getID());
|
Scholar.Notifier.trigger('add', 'item', attachmentItem.getID());
|
||||||
|
|
||||||
return fileItem.getID();
|
return attachmentItem.getID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3274,7 +3272,7 @@ Scholar.getItems = function(parent){
|
||||||
|
|
||||||
if (!parent){
|
if (!parent){
|
||||||
var sql = "SELECT A.itemID FROM items A LEFT JOIN itemNotes B USING (itemID) "
|
var sql = "SELECT A.itemID FROM items A LEFT JOIN itemNotes B USING (itemID) "
|
||||||
+ "LEFT JOIN itemFiles C ON (C.itemID=A.itemID) WHERE B.sourceItemID IS NULL"
|
+ "LEFT JOIN itemAttachments C ON (C.itemID=A.itemID) WHERE B.sourceItemID IS NULL"
|
||||||
+ " AND C.sourceItemID IS NULL";
|
+ " AND C.sourceItemID IS NULL";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -398,7 +398,7 @@ Scholar.Schema = new function(){
|
||||||
//
|
//
|
||||||
// Change this value to match the schema version
|
// Change this value to match the schema version
|
||||||
//
|
//
|
||||||
var toVersion = 38;
|
var toVersion = 39;
|
||||||
|
|
||||||
if (toVersion != _getSchemaSQLVersion()){
|
if (toVersion != _getSchemaSQLVersion()){
|
||||||
throw('Schema version does not match version in _migrateSchema()');
|
throw('Schema version does not match version in _migrateSchema()');
|
||||||
|
@ -422,7 +422,12 @@ Scholar.Schema = new function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i==38){
|
if (i==39){
|
||||||
|
// Clear storage directory
|
||||||
|
var file = Scholar.getStorageDirectory();
|
||||||
|
if (file.exists()){
|
||||||
|
file.remove(true);
|
||||||
|
}
|
||||||
_initializeSchema();
|
_initializeSchema();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<!ENTITY tabs.info.label "Info">
|
<!ENTITY tabs.info.label "Info">
|
||||||
<!ENTITY tabs.notes.label "Notes">
|
<!ENTITY tabs.notes.label "Notes">
|
||||||
<!ENTITY tabs.files.label "Files">
|
<!ENTITY tabs.attachments.label "Attachments">
|
||||||
<!ENTITY tabs.tags.label "Tags">
|
<!ENTITY tabs.tags.label "Tags">
|
||||||
<!ENTITY tabs.related.label "Related">
|
<!ENTITY tabs.related.label "Related">
|
||||||
<!ENTITY notes.separate "Edit in a separate window">
|
<!ENTITY notes.separate "Edit in a separate window">
|
||||||
|
@ -35,11 +35,11 @@
|
||||||
<!ENTITY item.add "Add">
|
<!ENTITY item.add "Add">
|
||||||
|
|
||||||
<!ENTITY toolbar.note.standalone "New Standalone Note">
|
<!ENTITY toolbar.note.standalone "New Standalone Note">
|
||||||
<!ENTITY toolbar.file.standalone "New Standalone File">
|
<!ENTITY toolbar.attachment.standalone "New Standalone Attachment">
|
||||||
<!ENTITY toolbar.file.add "Add File...">
|
<!ENTITY toolbar.attachment.add "Add File...">
|
||||||
<!ENTITY toolbar.file.linked "Add Linked File...">
|
<!ENTITY toolbar.attachment.linked "Add Linked File...">
|
||||||
<!ENTITY toolbar.file.snapshot "Snapshot Current Page">
|
<!ENTITY toolbar.attachment.snapshot "Snapshot Current Page">
|
||||||
<!ENTITY toolbar.file.weblink "Link to Current Page">
|
<!ENTITY toolbar.attachment.weblink "Link to Current Page">
|
||||||
|
|
||||||
<!ENTITY selectitems.title "Select Items">
|
<!ENTITY selectitems.title "Select Items">
|
||||||
<!ENTITY selectitems.intro.label "Select which items you'd like to add to your library">
|
<!ENTITY selectitems.intro.label "Select which items you'd like to add to your library">
|
||||||
|
|
|
@ -23,10 +23,10 @@ pane.item.notes.untitled = Untitled Note
|
||||||
pane.item.notes.delete.confirm = Are you sure you want to delete this note?
|
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.singular = %1 note
|
||||||
pane.item.notes.count.plural = %1 notes
|
pane.item.notes.count.plural = %1 notes
|
||||||
pane.item.files.delete.confirm = Are you sure you want to delete this file?
|
pane.item.attachments.delete.confirm = Are you sure you want to delete this attachment?
|
||||||
pane.item.files.count.singular = %1 file
|
pane.item.attachments.count.singular = %1 attachment
|
||||||
pane.item.files.count.plural = %1 files
|
pane.item.attachments.count.plural = %1 attachments
|
||||||
pane.item.files.select = Select a File
|
pane.item.attachments.select = Select a File
|
||||||
|
|
||||||
itemFields.title = Title
|
itemFields.title = Title
|
||||||
itemFields.dateAdded = Date Added
|
itemFields.dateAdded = Date Added
|
||||||
|
@ -74,7 +74,7 @@ itemTypes.interview = Interview
|
||||||
itemTypes.film = Film
|
itemTypes.film = Film
|
||||||
itemTypes.artwork = Artwork
|
itemTypes.artwork = Artwork
|
||||||
itemTypes.website = Website
|
itemTypes.website = Website
|
||||||
itemTypes.file = File
|
itemTypes.attachment = Attachment
|
||||||
|
|
||||||
creatorTypes.author = Author
|
creatorTypes.author = Author
|
||||||
creatorTypes.contributor = Contributor
|
creatorTypes.contributor = Contributor
|
||||||
|
|
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
|
@ -89,29 +89,29 @@
|
||||||
list-style-image: url('chrome://scholar/skin/toolbar-note-add.png');
|
list-style-image: url('chrome://scholar/skin/toolbar-note-add.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#tb-file-add
|
#tb-attachment-add
|
||||||
{
|
{
|
||||||
list-style-image: url('chrome://scholar/skin/item-files-add.png');
|
list-style-image: url('chrome://scholar/skin/item-attachments-add.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#tb-item-files-file
|
#tb-item-attachments-file
|
||||||
{
|
{
|
||||||
list-style-image: url('chrome://scholar/skin/treeitem-file-file.png');
|
list-style-image: url('chrome://scholar/skin/treeitem-attachment-file.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#tb-item-files-link
|
#tb-item-attachments-link
|
||||||
{
|
{
|
||||||
list-style-image: url('chrome://scholar/skin/treeitem-file-link.png');
|
list-style-image: url('chrome://scholar/skin/treeitem-attachment-link.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#tb-item-files-snapshot
|
#tb-item-attachments-snapshot
|
||||||
{
|
{
|
||||||
list-style-image: url('chrome://scholar/skin/treeitem-file-snapshot.png');
|
list-style-image: url('chrome://scholar/skin/treeitem-attachment-snapshot.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#tb-item-files-web-link
|
#tb-item-attachments-web-link
|
||||||
{
|
{
|
||||||
list-style-image: url('chrome://scholar/skin/treeitem-file-web-link.png');
|
list-style-image: url('chrome://scholar/skin/treeitem-attachment-web-link.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#tb-fullscreen
|
#tb-fullscreen
|
||||||
|
|
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 614 B After Width: | Height: | Size: 614 B |
Before Width: | Height: | Size: 635 B After Width: | Height: | Size: 635 B |
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 830 B |
Before Width: | Height: | Size: 620 B After Width: | Height: | Size: 620 B |
18
schema.sql
|
@ -1,4 +1,4 @@
|
||||||
-- 38
|
-- 39
|
||||||
|
|
||||||
DROP TABLE IF EXISTS version;
|
DROP TABLE IF EXISTS version;
|
||||||
CREATE TABLE version (
|
CREATE TABLE version (
|
||||||
|
@ -106,9 +106,9 @@
|
||||||
DROP INDEX IF EXISTS fileTypeMimeTypes_mimeType;
|
DROP INDEX IF EXISTS fileTypeMimeTypes_mimeType;
|
||||||
CREATE INDEX fileTypeMimeTypes_mimeType ON fileTypeMimeTypes(mimeType);
|
CREATE INDEX fileTypeMimeTypes_mimeType ON fileTypeMimeTypes(mimeType);
|
||||||
|
|
||||||
-- File data for file items
|
-- Metadata for attachment items
|
||||||
DROP TABLE IF EXISTS itemFiles;
|
DROP TABLE IF EXISTS itemAttachments;
|
||||||
CREATE TABLE itemFiles (
|
CREATE TABLE itemAttachments (
|
||||||
itemID INT,
|
itemID INT,
|
||||||
sourceItemID INT,
|
sourceItemID INT,
|
||||||
linkMode INT,
|
linkMode INT,
|
||||||
|
@ -120,10 +120,10 @@
|
||||||
FOREIGN KEY (itemID) REFERENCES items(itemID),
|
FOREIGN KEY (itemID) REFERENCES items(itemID),
|
||||||
FOREIGN KEY (sourceItemID) REFERENCES items(sourceItemID)
|
FOREIGN KEY (sourceItemID) REFERENCES items(sourceItemID)
|
||||||
);
|
);
|
||||||
DROP INDEX IF EXISTS itemFiles_sourceItemID;
|
DROP INDEX IF EXISTS itemAttachments_sourceItemID;
|
||||||
CREATE INDEX itemFiles_sourceItemID ON itemFiles(sourceItemID);
|
CREATE INDEX itemAttachments_sourceItemID ON itemAttachments(sourceItemID);
|
||||||
DROP INDEX IF EXISTS itemFiles_mimeType;
|
DROP INDEX IF EXISTS itemAttachments_mimeType;
|
||||||
CREATE INDEX itemFiles_mimeType ON itemFiles(mimeType);
|
CREATE INDEX itemAttachments_mimeType ON itemAttachments(mimeType);
|
||||||
|
|
||||||
-- Individual entries for each tag
|
-- Individual entries for each tag
|
||||||
DROP TABLE IF EXISTS tags;
|
DROP TABLE IF EXISTS tags;
|
||||||
|
@ -290,7 +290,7 @@
|
||||||
INSERT INTO itemTypes VALUES (11,'film');
|
INSERT INTO itemTypes VALUES (11,'film');
|
||||||
INSERT INTO itemTypes VALUES (12,'artwork');
|
INSERT INTO itemTypes VALUES (12,'artwork');
|
||||||
INSERT INTO itemTypes VALUES (13,'website');
|
INSERT INTO itemTypes VALUES (13,'website');
|
||||||
INSERT INTO itemTypes VALUES (14,'file');
|
INSERT INTO itemTypes VALUES (14,'attachment');
|
||||||
|
|
||||||
INSERT INTO "fieldFormats" VALUES(1, '.*', 0);
|
INSERT INTO "fieldFormats" VALUES(1, '.*', 0);
|
||||||
INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1);
|
INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1);
|
||||||
|
|