Opened 10 years ago

Closed 10 years ago

#29 closed enhancement (fixed)

independent notes

Reported by: dcohen Owned by: dstillman
Priority: major Milestone: 1.0 Beta 1
Component: data layer Version: 1.0
Keywords: Cc:

Description


Change History (2)

comment:1 Changed 10 years ago by david

  • Component changed from notes to data layer
  • Owner changed from nobody to dstillman

comment:2 Changed 10 years ago by dstillman

  • Resolution set to fixed
  • Status changed from new to closed

(In [311]) Fixes #29, independent notes

  • Added 'note' item type
  • Updated API to support independent note creation

Notes are, more or less, just regular items, with an item type of 1. They're created through Scholar.Notes.add(text, sourceItemID), which returns the itemID of the new note. sourceItemID is optional--if left out, an independent note will be created. (There's currently nothing stopping you from doing getNewItemByType(1) yourself, but the note would be contentless and broken, so you shouldn't do that.) Note data could've been stuffed into itemData, but I kept it separate in itemNotes to keep metadata searching faster and to keep things cleaner.

Methods calls that can be called on all items:

isNote() (same as testing for itemTypeID 1)

Method calls that can be called on source items only:

numNotes()
getNotes() (array of note itemIDs for a source)

Method calls that can be called on note items only:

updateNote(text)
setNoteSource(sourceItemID) (for changing source--use empty or false to make independent, which is currently what happens when you delete a note--will get option with #91)
getNote() (note content)
getNoteSource() (sourceItemID of a note)

Calling the above methods on the wrong item types will throw an error.

* This will break note creation/display until David updates interface code. *

Note: See TracTickets for help on using tickets.