diff --git a/chrome/chromeFiles/content/scholar/admin/itemTypeManager.js b/chrome/chromeFiles/content/scholar/admin/itemTypeManager.js
index 8f27ccad3..23129bb36 100644
--- a/chrome/chromeFiles/content/scholar/admin/itemTypeManager.js
+++ b/chrome/chromeFiles/content/scholar/admin/itemTypeManager.js
@@ -372,7 +372,8 @@ var Scholar_ItemTypeManager = new function(){
sql += prefix + "INSERT INTO itemTypes VALUES ("
+ types[i]['itemTypeID'] + ", '" + types[i]['typeName'] + "', "
+ (types[i]['templateItemTypeID']
- ? types[i]['templateItemTypeID'] : 'NULL')
+ ? types[i]['templateItemTypeID'] : 'NULL') + ", ",
+ + types[i]['display']
+ ");\n"
}
diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js
index 51429c176..1018a34c2 100644
--- a/chrome/chromeFiles/content/scholar/itemPane.js
+++ b/chrome/chromeFiles/content/scholar/itemPane.js
@@ -39,6 +39,7 @@ var ScholarItemPane = new function()
this.viewItem = viewItem;
this.loadPane = loadPane;
this.changeTypeTo = changeTypeTo;
+ this.onGoToURLClick = onGoToURLClick;
this.onOpenURLClick = onOpenURLClick;
this.addCreatorRow = addCreatorRow;
this.switchCreatorMode = switchCreatorMode;
@@ -127,7 +128,6 @@ var ScholarItemPane = new function()
}
_itemBeingEdited = thisItem;
-
_loaded = {};
loadPane(_tabs.selectedIndex);
@@ -154,6 +154,39 @@ var ScholarItemPane = new function()
// Info pane
if(index == 0)
{
+ // Enable/disable "View =>" button
+ testView: try
+ {
+ var validURI = false;
+ var spec = _itemBeingEdited.getField('url');
+ if (!spec)
+ {
+ break testView;
+ }
+ var uri = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService)
+ .newURI(spec, null, null);
+ validURI = uri.scheme && uri.host;
+ }
+ catch (e){}
+ document.getElementById('tb-go-to-url').setAttribute('disabled', !validURI);
+
+ // Enable/disable "Locate =>" (OpenURL) button
+ switch (_itemBeingEdited.getType())
+ {
+ // DEBUG: handle descendents of these types as well?
+ case Scholar.ItemTypes.getID('book'):
+ case Scholar.ItemTypes.getID('bookSection'):
+ case Scholar.ItemTypes.getID('journalArticle'):
+ case Scholar.ItemTypes.getID('thesis'):
+ var openURL = true;
+ break;
+
+ default:
+ var openURL = false;
+ }
+ document.getElementById('tb-openurl').setAttribute('disabled', !openURL);
+
while(_dynamicFields.hasChildNodes())
_dynamicFields.removeChild(_dynamicFields.firstChild);
@@ -174,8 +207,10 @@ var ScholarItemPane = new function()
var val = _itemBeingEdited.getField(fieldNames[i]);
// Convert dates from UTC
- if (fieldNames[i]=='dateAdded' || fieldNames[i]=='dateModified'){
- val = Scholar.Date.sqlToDate(val, true).toLocaleString();
+ if (fieldNames[i]=='dateAdded' || fieldNames[i]=='dateModified'
+ || fieldNames[i]=='accessDate'){
+ var date = Scholar.Date.sqlToDate(val, true);
+ val = date ? date.toLocaleString() : '';
}
// Start tabindex at 1000 after creators
@@ -347,9 +382,18 @@ var ScholarItemPane = new function()
}
}
+ function onGoToURLClick()
+ {
+ window.loadURI(_itemBeingEdited.getField('url'));
+ }
+
function onOpenURLClick()
{
- window.open(Scholar.OpenURL.resolve(_itemBeingEdited));
+ var url = Scholar.OpenURL.resolve(_itemBeingEdited);
+ if (url)
+ {
+ window.loadURI(Scholar.OpenURL.resolve(_itemBeingEdited));
+ }
}
function addDynamicRow(label, value, beforeElement)
diff --git a/chrome/chromeFiles/content/scholar/itemPane.xul b/chrome/chromeFiles/content/scholar/itemPane.xul
index 9e6e834d0..12a0fce53 100644
--- a/chrome/chromeFiles/content/scholar/itemPane.xul
+++ b/chrome/chromeFiles/content/scholar/itemPane.xul
@@ -21,11 +21,14 @@
ScholarItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1],
'typeID', typeID, otherFields)"/>
+
+
+
+
-
@@ -55,7 +58,6 @@
-
diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js
index 0da4a218f..1bcca9c83 100644
--- a/chrome/chromeFiles/content/scholar/overlay.js
+++ b/chrome/chromeFiles/content/scholar/overlay.js
@@ -37,6 +37,7 @@ var ScholarPane = new function()
this.onDoubleClick = onDoubleClick;
this.openNoteWindow = openNoteWindow;
this.newNote = newNote;
+ this.addItemFromPage = addItemFromPage;
this.addAttachmentFromDialog = addAttachmentFromDialog;
this.addAttachmentFromPage = addAttachmentFromPage;
this.viewSelectedAttachment = viewSelectedAttachment;
@@ -82,20 +83,26 @@ var ScholarPane = new function()
var itemsTree = document.getElementById('items-tree');
itemsTree.controllers.appendController(new Scholar.ItemTreeCommandController(itemsTree));
- //Create the add menu with each item type
+ // Create the add menu with each item type
var addMenu = document.getElementById('tb-add').firstChild;
- var itemTypes = Scholar.ItemTypes.getTypes();
+ var separator = document.getElementById('tb-add').firstChild.firstChild;
+ var moreMenu = document.getElementById('tb-add-more');
+ var itemTypes = Scholar.ItemTypes.getPrimaryTypes();
for(var i = 0; i
-
-
-
+
+
-
-
+
+
+
+
diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
index 3ba435378..c3fd034fe 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/data_access.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
@@ -556,12 +556,20 @@ Scholar.Item.prototype.save = function(){
Scholar.History.modify('itemData', 'itemID-fieldID',
[this.getID(), fieldID]);
- sql = "UPDATE itemData SET value=?";
+ sql = "UPDATE itemData SET value=";
+
+ if (Scholar.ItemFields.getID('accessDate')==fieldID
+ && this.getField(fieldID)=='CURRENT_TIMESTAMP')
+ {
+ sql += "CURRENT_TIMESTAMP";
+ }
// Take advantage of SQLite's manifest typing
- if (Scholar.ItemFields.isInteger(fieldID)){
+ else if (Scholar.ItemFields.isInteger(fieldID)){
+ sql += '?'
sqlValues.push({'int':this.getField(fieldID)});
}
else {
+ sql += '?'
sqlValues.push({'string':this.getField(fieldID)});
}
sql += " WHERE itemID=? AND fieldID=?";
@@ -586,7 +594,13 @@ Scholar.Item.prototype.save = function(){
{'int':fieldID},
];
- if (Scholar.ItemFields.isInteger(fieldID)){
+ if (Scholar.ItemFields.getID('accessDate')==fieldID
+ && this.getField(fieldID)=='CURRENT_TIMESTAMP')
+ {
+ sql = "INSERT INTO itemData VALUES "
+ + "(?,?,CURRENT_TIMESTAMP)";
+ }
+ else if (Scholar.ItemFields.isInteger(fieldID)){
sqlValues.push({'int':this.getField(fieldID)});
}
else {
@@ -697,7 +711,12 @@ Scholar.Item.prototype.save = function(){
{'int':fieldID}
];
- if (Scholar.ItemFields.isInteger(fieldID)){
+ if (Scholar.ItemFields.getID('accessDate')==fieldID
+ && this.getField(fieldID)=='CURRENT_TIMESTAMP')
+ {
+ sql = "INSERT INTO itemData VALUES (?,?,CURRENT_TIMESTAMP)";
+ }
+ else if (Scholar.ItemFields.isInteger(fieldID)){
sqlValues.push({'int':this.getField(fieldID)});
}
else {
@@ -3251,9 +3270,10 @@ Scholar.CachedTypes = function(){
}
- function getTypes(){
+ function getTypes(where){
return Scholar.DB.query('SELECT ' + this._idCol + ' AS id, '
- + this._nameCol + ' AS name FROM ' + this._table + ' order BY ' + this._nameCol);
+ + this._nameCol + ' AS name FROM ' + this._table
+ + (where ? ' ' + where : '') + ' ORDER BY ' + this._nameCol);
}
@@ -3295,10 +3315,26 @@ Scholar.ItemTypes = new function(){
Scholar.CachedTypes.apply(this, arguments);
this.constructor.prototype = new Scholar.CachedTypes();
+ this.getPrimaryTypes = getPrimaryTypes;
+ this.getSecondaryTypes = getSecondaryTypes;
+ this.getHiddenTypes = getHiddenTypes;
+
this._typeDesc = 'item type';
this._idCol = 'itemTypeID';
this._nameCol = 'typeName';
this._table = 'itemTypes';
+
+ function getPrimaryTypes(){
+ return this.getTypes('WHERE display=2');
+ }
+
+ function getSecondaryTypes(){
+ return this.getTypes('WHERE display=1');
+ }
+
+ function getHiddenTypes(){
+ return this.getTypes('WHERE display=0');
+ }
}
diff --git a/chrome/chromeFiles/content/scholar/xpcom/scholar.js b/chrome/chromeFiles/content/scholar/xpcom/scholar.js
index b82f92269..9f498c15e 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/scholar.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/scholar.js
@@ -653,6 +653,11 @@ Scholar.Date = new function(){
timeparts = [false, false, false];
}
+ // Invalid date part
+ if (dateparts.length==1){
+ return false;
+ }
+
if (isUTC){
return new Date(Date.UTC(dateparts[0], dateparts[1]-1, dateparts[2],
timeparts[0], timeparts[1], timeparts[2]));
diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
index bea4cf19d..d0fb99e71 100644
--- a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
+++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
@@ -19,6 +19,8 @@
+
+
@@ -35,16 +37,17 @@
-
+
+
+
+
-
-
-
-
-
+
+
+
diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css
index eed4adc8c..8a5f964cf 100644
--- a/chrome/chromeFiles/skin/default/scholar/overlay.css
+++ b/chrome/chromeFiles/skin/default/scholar/overlay.css
@@ -52,11 +52,6 @@
height: 24px;
}
-#scholar-pane toolbar toolbarbutton
-{
-
-}
-
#scholar-pane toolbar .toggler
{
margin: 4px;
@@ -84,7 +79,7 @@
/* These fix a rendering bug in Fx2.0b2 */
-#scholar-pane .toolbarbutton-text
+#scholar-pane toolbarbutton .toolbarbutton-text
{
margin:0 2px;
}
@@ -108,16 +103,21 @@
list-style-image: url('chrome://scholar/skin/toolbar-item-add.png');
}
+#tb-item-from-page
+{
+ list-style-image: url('chrome://scholar/skin/toolbar-item-from-page.png');
+}
+
+#tb-snapshot-page
+{
+ list-style-image: url('chrome://scholar/skin/toolbar-snapshot-add.png');
+}
+
#tb-note-add
{
list-style-image: url('chrome://scholar/skin/toolbar-note-add.png');
}
-#tb-attachment-add
-{
- list-style-image: url('chrome://scholar/skin/item-attachments-add.png');
-}
-
#tb-item-attachments-file
{
list-style-image: url('chrome://scholar/skin/treeitem-attachment-file.png');
@@ -178,9 +178,15 @@
list-style-image: url('chrome://scholar/skin/search-cancel-active.png');
}
-#tb-openurl
+#tb-go-to-url, #tb-openurl
{
- list-style-image: url('chrome://scholar/skin/toolbar-openurl.png');
+ list-style-image: url('chrome://scholar/skin/toolbar-go-arrow.png');
+ -moz-box-direction: reverse;
+}
+
+#tb-go-to-url[disabled=true], #tb-openurl[disabled=true]
+{
+ list-style-image: url('chrome://scholar/skin/toolbar-go-arrow-disabled.png');
}
#scholar-view-item > vbox
diff --git a/chrome/chromeFiles/skin/default/scholar/toolbar-go-arrow-disabled.png b/chrome/chromeFiles/skin/default/scholar/toolbar-go-arrow-disabled.png
new file mode 100644
index 000000000..f1a044884
Binary files /dev/null and b/chrome/chromeFiles/skin/default/scholar/toolbar-go-arrow-disabled.png differ
diff --git a/chrome/chromeFiles/skin/default/scholar/toolbar-openurl.png b/chrome/chromeFiles/skin/default/scholar/toolbar-go-arrow.png
similarity index 100%
rename from chrome/chromeFiles/skin/default/scholar/toolbar-openurl.png
rename to chrome/chromeFiles/skin/default/scholar/toolbar-go-arrow.png
diff --git a/chrome/chromeFiles/skin/default/scholar/toolbar-item-from-page.png b/chrome/chromeFiles/skin/default/scholar/toolbar-item-from-page.png
new file mode 100644
index 000000000..dc6b2dd1c
Binary files /dev/null and b/chrome/chromeFiles/skin/default/scholar/toolbar-item-from-page.png differ
diff --git a/chrome/chromeFiles/skin/default/scholar/toolbar-snapshot-add.png b/chrome/chromeFiles/skin/default/scholar/toolbar-snapshot-add.png
new file mode 100644
index 000000000..08b5da989
Binary files /dev/null and b/chrome/chromeFiles/skin/default/scholar/toolbar-snapshot-add.png differ
diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-attachment-snapshot.png b/chrome/chromeFiles/skin/default/scholar/treeitem-attachment-snapshot.png
index 03ddd799f..3eef60f15 100755
Binary files a/chrome/chromeFiles/skin/default/scholar/treeitem-attachment-snapshot.png and b/chrome/chromeFiles/skin/default/scholar/treeitem-attachment-snapshot.png differ
diff --git a/system.sql b/system.sql
index 0bb2b3d8d..e6aaf41aa 100644
--- a/system.sql
+++ b/system.sql
@@ -1,4 +1,4 @@
--- 2
+-- 3
-- This file creates system tables that can be safely wiped and reinitialized
-- at any time, as long as existing ids are preserved.
@@ -9,7 +9,8 @@
CREATE TABLE itemTypes (
itemTypeID INTEGER PRIMARY KEY,
typeName TEXT,
- templateItemTypeID INT
+ templateItemTypeID INT,
+ display INT DEFAULT 1 -- 0 == hide, 1 == display, 2 == primary
);
-- Describes various types of fields and their format restrictions,
@@ -130,20 +131,20 @@
INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1);
INSERT INTO "fieldFormats" VALUES(3, '[0-9]{4}', 1);
- INSERT INTO itemTypes VALUES (1,'note',NULL);
- INSERT INTO itemTypes VALUES (2,'book',NULL);
- INSERT INTO itemTypes VALUES (3,'bookSection',2);
- INSERT INTO itemTypes VALUES (4,'journalArticle',NULL);
- INSERT INTO itemTypes VALUES (5,'magazineArticle',NULL);
- INSERT INTO itemTypes VALUES (6,'newspaperArticle',NULL);
- INSERT INTO itemTypes VALUES (7,'thesis',NULL);
- INSERT INTO itemTypes VALUES (8,'letter',NULL);
- INSERT INTO itemTypes VALUES (9,'manuscript',NULL);
- INSERT INTO itemTypes VALUES (10,'interview',NULL);
- INSERT INTO itemTypes VALUES (11,'film',NULL);
- INSERT INTO itemTypes VALUES (12,'artwork',NULL);
- INSERT INTO itemTypes VALUES (13,'website',NULL);
- INSERT INTO itemTypes VALUES (14,'attachment',NULL);
+ INSERT INTO itemTypes VALUES (1,'note',NULL,2);
+ INSERT INTO itemTypes VALUES (2,'book',NULL,2);
+ INSERT INTO itemTypes VALUES (3,'bookSection',2,2);
+ INSERT INTO itemTypes VALUES (4,'journalArticle',NULL,2);
+ INSERT INTO itemTypes VALUES (5,'magazineArticle',NULL,2);
+ INSERT INTO itemTypes VALUES (6,'newspaperArticle',NULL,2);
+ INSERT INTO itemTypes VALUES (7,'thesis',NULL,1);
+ INSERT INTO itemTypes VALUES (8,'letter',NULL,1);
+ INSERT INTO itemTypes VALUES (9,'manuscript',NULL,1);
+ INSERT INTO itemTypes VALUES (10,'interview',NULL,1);
+ INSERT INTO itemTypes VALUES (11,'film',NULL,1);
+ INSERT INTO itemTypes VALUES (12,'artwork',NULL,1);
+ INSERT INTO itemTypes VALUES (13,'website',NULL,2);
+ INSERT INTO itemTypes VALUES (14,'attachment',NULL,0);
INSERT INTO fields VALUES (1,'url',NULL);
INSERT INTO fields VALUES (2,'rights',NULL);
diff --git a/user.sql b/user.sql
index cb7d14d27..7e12f55df 100644
--- a/user.sql
+++ b/user.sql
@@ -1,4 +1,4 @@
--- 3
+-- 4
-- This file creates tables containing user-specific data -- any changes
-- to existing tables made here must be mirrored in transition steps in
@@ -30,6 +30,13 @@ CREATE TABLE IF NOT EXISTS userItemTypes (
PRIMARY KEY (itemTypeID)
);
+-- Control visibility and placement of system and user item types
+CREATE TABLE IF NOT EXISTS userItemTypeMask (
+ itemTypeID INT,
+ display INT, -- 0 == hide, 1 == show, 2 == primary
+ PRIMARY KEY (itemTypeID)
+);
+
-- User-defined fields
CREATE TABLE IF NOT EXISTS userFields (
userFieldID INT,