commit 20bad3609d14bb7c7f05a55706cd9398a409f298
parent e22bdaab33226db5b2f5ba6bd2292fa16a98e792
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 28 Jun 2006 18:30:20 +0000
Moving Scholar.Notes in the code -- ignore
Diffstat:
1 file changed, 49 insertions(+), 49 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
@@ -1214,55 +1214,6 @@ Scholar.Item.prototype._loadItemData = function(){
-Scholar.Notes = new function(){
- this.add = add;
-
- /**
- * Create a new item of type 'note' and add the note text to the itemNotes table
- *
- * Returns the itemID of the new note item
- **/
- function add(text, sourceItemID){
- Scholar.DB.beginTransaction();
-
- if (sourceItemID){
- var sourceItem = Scholar.Items.get(sourceItemID);
- if (!sourceItem){
- Scholar.DB.commitTransaction();
- throw ("Cannot set note source to invalid item " + sourceItemID);
- }
- if (sourceItem.isNote()){
- Scholar.DB.commitTransaction();
- throw ("Cannot set note source to another note (" + sourceItemID + ")");
- }
- }
-
- var note = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('note'));
- note.save();
-
- var sql = "INSERT INTO itemNotes VALUES (?,?,?)";
- var bindParams = [
- note.getID(),
- (sourceItemID ? {int:sourceItemID} : null),
- {string:text}
- ];
- Scholar.DB.query(sql, bindParams);
- Scholar.DB.commitTransaction();
-
- if (sourceItemID){
- sourceItem.incrementNoteCount();
- Scholar.Notifier.trigger('modify', 'item', sourceItemID);
- }
-
- Scholar.Notifier.trigger('add', 'item', note.getID());
-
- return note.getID();
- }
-}
-
-
-
-
/*
* Primary interface for accessing Scholar items
*/
@@ -1473,6 +1424,55 @@ Scholar.Items = new function(){
+Scholar.Notes = new function(){
+ this.add = add;
+
+ /**
+ * Create a new item of type 'note' and add the note text to the itemNotes table
+ *
+ * Returns the itemID of the new note item
+ **/
+ function add(text, sourceItemID){
+ Scholar.DB.beginTransaction();
+
+ if (sourceItemID){
+ var sourceItem = Scholar.Items.get(sourceItemID);
+ if (!sourceItem){
+ Scholar.DB.commitTransaction();
+ throw ("Cannot set note source to invalid item " + sourceItemID);
+ }
+ if (sourceItem.isNote()){
+ Scholar.DB.commitTransaction();
+ throw ("Cannot set note source to another note (" + sourceItemID + ")");
+ }
+ }
+
+ var note = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('note'));
+ note.save();
+
+ var sql = "INSERT INTO itemNotes VALUES (?,?,?)";
+ var bindParams = [
+ note.getID(),
+ (sourceItemID ? {int:sourceItemID} : null),
+ {string:text}
+ ];
+ Scholar.DB.query(sql, bindParams);
+ Scholar.DB.commitTransaction();
+
+ if (sourceItemID){
+ sourceItem.incrementNoteCount();
+ Scholar.Notifier.trigger('modify', 'item', sourceItemID);
+ }
+
+ Scholar.Notifier.trigger('add', 'item', note.getID());
+
+ return note.getID();
+ }
+}
+
+
+
+
/*
* Constructor for Collection object