new blah"
- result = self.http_post( "/notebooks/save_entry/", dict(
+ # save over an existing note supplying new contents and a new title
+ new_note_contents = u"
new title
new blah"
+ result = self.http_post( "/notebooks/save_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
- contents = new_entry_contents,
+ note_id = self.note.object_id,
+ contents = new_note_contents,
startup = startup,
), session_id = self.session_id )
assert result[ "saved" ] == True
# make sure the old title can no longer be loaded
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = "my title",
+ note_title = "my title",
), session_id = self.session_id )
- entry = result[ "entry" ]
- assert entry == None
+ note = result[ "note" ]
+ assert note == None
# make sure the new title is now loadable
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = "new title",
+ note_title = "new title",
), session_id = self.session_id )
- entry = result[ "entry" ]
+ note = result[ "note" ]
- assert entry.object_id == self.entry.object_id
- assert entry.title == self.entry.title
- assert entry.contents == self.entry.contents
+ assert note.object_id == self.note.object_id
+ assert note.title == self.note.title
+ assert note.contents == self.note.contents
- # check that the entry is / is not a startup entry
+ # check that the note is / is not a startup note
if startup:
- assert entry in self.notebook.startup_entries
+ assert note in self.notebook.startup_notes
else:
- assert not entry in self.notebook.startup_entries
+ assert not note in self.notebook.startup_notes
- def test_save_startup_entry( self ):
- self.test_save_entry( startup = True )
+ def test_save_startup_note( self ):
+ self.test_save_note( startup = True )
- def test_save_entry_without_login( self, startup = False ):
- # save over an existing entry supplying new contents and a new title
- new_entry_contents = u"
new title
new blah"
- result = self.http_post( "/notebooks/save_entry/", dict(
+ def test_save_note_without_login( self, startup = False ):
+ # save over an existing note supplying new contents and a new title
+ new_note_contents = u"
new title
new blah"
+ result = self.http_post( "/notebooks/save_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
- contents = new_entry_contents,
+ note_id = self.note.object_id,
+ contents = new_note_contents,
startup = startup,
), session_id = self.session_id )
assert result.get( "error" )
- def test_save_startup_entry_without_login( self ):
- self.test_save_entry_without_login( startup = True )
+ def test_save_startup_note_without_login( self ):
+ self.test_save_note_without_login( startup = True )
- def test_save_entry_with_unknown_notebook( self ):
+ def test_save_note_with_unknown_notebook( self ):
self.login()
- # save over an existing entry supplying new contents and a new title
- new_entry_contents = u"
new title
new blah"
- result = self.http_post( "/notebooks/save_entry/", dict(
+ # save over an existing note supplying new contents and a new title
+ new_note_contents = u"
foo" )
+ self.notebook.add_note( note3 )
result = self.http_get(
"/notebooks/download_html/%s" % self.notebook.object_id,
diff --git a/controller/test/Test_users.py b/controller/test/Test_users.py
index 9478d03..851ed92 100644
--- a/controller/test/Test_users.py
+++ b/controller/test/Test_users.py
@@ -77,8 +77,8 @@ class Test_users( Test_controller ):
assert notebooks[ 0 ] == self.anon_notebook
notebook = notebooks[ 1 ]
assert notebook.object_id == new_notebook_id
- assert len( notebook.entries ) == 1
- assert len( notebook.startup_entries ) == 1
+ assert len( notebook.notes ) == 1
+ assert len( notebook.startup_notes ) == 1
def test_signup_with_different_passwords( self ):
result = self.http_post( "/users/signup", dict(
diff --git a/model/Entry.py b/model/Note.py
similarity index 62%
rename from model/Entry.py
rename to model/Note.py
index 894cec2..d447836 100644
--- a/model/Entry.py
+++ b/model/Note.py
@@ -3,22 +3,31 @@ from Persistent import Persistent
from controller.Html_nuker import Html_nuker
-class Entry( Persistent ):
+class Note( Persistent ):
+ def __setstate__(self, state):
+ if "_Entry__title" in state:
+ state[ "_Note__title" ] = state[ "_Entry__title" ]
+ del( state[ "_Entry__title" ] )
+ if "_Entry__contents" in state:
+ state[ "_Note__contents" ] = state[ "_Entry__contents" ]
+ del( state[ "_Entry__contents" ] )
+ self.__dict__ = state
+
"""
- An single textual wiki entry.
+ An single textual wiki note.
"""
TITLE_PATTERN = re.compile( u"
(.*)
", flags = re.IGNORECASE )
def __init__( self, id, contents = None ):
"""
- Create a new entry with the given id and contents.
+ Create a new note with the given id and contents.
@type id: unicode
- @param id: id of the entry
+ @param id: id of the note
@type contents: unicode or NoneType
- @param contents: initial contents of the entry (optional)
- @rtype: Entry
- @return: newly constructed entry
+ @param contents: initial contents of the note (optional)
+ @rtype: Note
+ @return: newly constructed note
"""
Persistent.__init__( self, id )
self.__title = None
@@ -31,7 +40,7 @@ class Entry( Persistent ):
self.__contents = contents
# parse title out of the beginning of the contents
- result = Entry.TITLE_PATTERN.search( contents )
+ result = Note.TITLE_PATTERN.search( contents )
if result:
self.__title = result.groups()[ 0 ]
diff --git a/model/Notebook.py b/model/Notebook.py
index b1792c7..b20256a 100644
--- a/model/Notebook.py
+++ b/model/Notebook.py
@@ -1,23 +1,32 @@
from copy import copy
-from Entry import Entry
+from Note import Note
from Persistent import Persistent
class Notebook( Persistent ):
+ def __setstate__(self, state):
+ if "_Notebook__entries" in state:
+ state[ "_Notebook__notes" ] = state[ "_Notebook__entries" ]
+ del( state[ "_Notebook__entries" ] )
+ if "_Notebook__startup_entries" in state:
+ state[ "_Notebook__startup_notes" ] = state[ "_Notebook__startup_entries" ]
+ del( state[ "_Notebook__startup_entries" ] )
+ self.__dict__.update(state)
+
"""
- A collection of wiki entries.
+ A collection of wiki notes.
"""
- class UnknownEntryError( ValueError ):
+ class UnknownNoteError( ValueError ):
"""
- Indicates that an accessed entry is not in this notebook.
+ Indicates that an accessed note is not in this notebook.
"""
- def __init__( self, entry_id ):
- ValueError.__init__( self, entry_id )
+ def __init__( self, note_id ):
+ ValueError.__init__( self, note_id )
def __init__( self, id, name ):
"""
- Create a new entry with the given id and name.
+ Create a new note with the given id and name.
@type id: unicode
@param id: id of the notebook
@@ -28,117 +37,117 @@ class Notebook( Persistent ):
"""
Persistent.__init__( self, id )
self.__name = name
- self.__entries = {} # map of entry id to entry
- self.__titles = {} # map of entry title to entry
- self.__startup_entries = [] # list of entries shown on startup
+ self.__notes = {} # map of note id to note
+ self.__titles = {} # map of note title to note
+ self.__startup_notes = [] # list of notes shown on startup
- def add_entry( self, entry ):
+ def add_note( self, note ):
"""
- Add an entry to this notebook.
+ Add an note to this notebook.
- @type entry: Entry
- @param entry: entry to add
+ @type note: Note
+ @param note: note to add
"""
self.update_revision()
- self.__entries[ entry.object_id ] = entry
- self.__titles[ entry.title ] = entry
+ self.__notes[ note.object_id ] = note
+ self.__titles[ note.title ] = note
- def remove_entry( self, entry ):
+ def remove_note( self, note ):
"""
- Remove an entry from this notebook.
+ Remove an note from this notebook.
- @type entry: Entry
- @param entry: entry to remove
+ @type note: Note
+ @param note: note to remove
@rtype: bool
- @return: True if the entry was removed, False if the entry wasn't in this notebook
+ @return: True if the note was removed, False if the note wasn't in this notebook
"""
- if self.__entries.pop( entry.object_id, None ):
+ if self.__notes.pop( note.object_id, None ):
self.update_revision()
- self.__titles.pop( entry.title, None )
- if entry in self.__startup_entries:
- self.__startup_entries.remove( entry )
+ self.__titles.pop( note.title, None )
+ if note in self.__startup_notes:
+ self.__startup_notes.remove( note )
return True
return False
- def lookup_entry( self, entry_id ):
+ def lookup_note( self, note_id ):
"""
- Return the entry in this notebook with the given id.
+ Return the note in this notebook with the given id.
- @type entry_id: unicode
- @param entry_id: id of the entry to return
- @rtype: Entry or NoneType
- @return: entry corresponding to the entry id or None
+ @type note_id: unicode
+ @param note_id: id of the note to return
+ @rtype: Note or NoneType
+ @return: note corresponding to the note id or None
"""
- return self.__entries.get( entry_id )
+ return self.__notes.get( note_id )
- def lookup_entry_by_title( self, title ):
+ def lookup_note_by_title( self, title ):
"""
- Return the entry in this notebook with the given title.
+ Return the note in this notebook with the given title.
@type title: unicode
- @param title: title of the entry to return
- @rtype: Entry or NoneType
- @return: entry corresponding to the title or None
+ @param title: title of the note to return
+ @rtype: Note or NoneType
+ @return: note corresponding to the title or None
"""
return self.__titles.get( title )
- def update_entry( self, entry, contents ):
+ def update_note( self, note, contents ):
"""
- Update the given entry with new contents. Bail if the entry's contents are unchanged.
+ Update the given note with new contents. Bail if the note's contents are unchanged.
- @type entry: Entry
- @param entry: entry to update
+ @type note: Note
+ @param note: note to update
@type contents: unicode
- @param contents: new textual contents for the entry
- @raises UnknownEntryError: entry to update is not in this notebook
+ @param contents: new textual contents for the note
+ @raises UnknownNoteError: note to update is not in this notebook
"""
- old_entry = self.__entries.get( entry.object_id )
- if old_entry is None:
- raise Notebook.UnknownEntryError( entry.object_id )
+ old_note = self.__notes.get( note.object_id )
+ if old_note is None:
+ raise Notebook.UnknownNoteError( note.object_id )
- if contents == old_entry.contents:
+ if contents == old_note.contents:
return
self.update_revision()
- self.__titles.pop( entry.title, None )
+ self.__titles.pop( note.title, None )
- entry.contents = contents
+ note.contents = contents
- self.__titles[ entry.title ] = entry
+ self.__titles[ note.title ] = note
- def add_startup_entry( self, entry ):
+ def add_startup_note( self, note ):
"""
- Add the given entry to be shown on startup. It must already be an entry in this notebook.
+ Add the given note to be shown on startup. It must already be an note in this notebook.
- @type entry: unicode
- @param entry: entry to be added for startup
+ @type note: unicode
+ @param note: note to be added for startup
@rtype: bool
- @return: True if the entry was added for startup
- @raises UnknownEntryError: given entry is not in this notebook
+ @return: True if the note was added for startup
+ @raises UnknownNoteError: given note is not in this notebook
"""
- if self.__entries.get( entry.object_id ) is None:
- raise Notebook.UnknownEntryError( entry.object_id )
+ if self.__notes.get( note.object_id ) is None:
+ raise Notebook.UnknownNoteError( note.object_id )
- if not entry in self.__startup_entries:
+ if not note in self.__startup_notes:
self.update_revision()
- self.__startup_entries.append( entry )
+ self.__startup_notes.append( note )
return True
return False
- def remove_startup_entry( self, entry ):
+ def remove_startup_note( self, note ):
"""
- Remove the given entry from being shown on startup.
+ Remove the given note from being shown on startup.
- @type entry: unicode
- @param entry: entry to be removed from startup
+ @type note: unicode
+ @param note: note to be removed from startup
@rtype: bool
- @return: True if the entry was removed from startup
+ @return: True if the note was removed from startup
"""
- if entry in self.__startup_entries:
+ if note in self.__startup_notes:
self.update_revision()
- self.__startup_entries.remove( entry )
+ self.__startup_notes.remove( note )
return True
return False
@@ -147,7 +156,7 @@ class Notebook( Persistent ):
d = Persistent.to_dict( self )
d.update( dict(
name = self.__name,
- startup_entries = copy( self.startup_entries ),
+ startup_notes = copy( self.startup_notes ),
read_write = True,
) )
@@ -158,5 +167,5 @@ class Notebook( Persistent ):
self.update_revision()
name = property( lambda self: self.__name, __set_name )
- startup_entries = property( lambda self: copy( self.__startup_entries ) )
- entries = property( lambda self: self.__entries.values() )
+ startup_notes = property( lambda self: copy( self.__startup_notes ) )
+ notes = property( lambda self: self.__notes.values() )
diff --git a/model/Read_only_notebook.py b/model/Read_only_notebook.py
index 8c33c82..b79913d 100644
--- a/model/Read_only_notebook.py
+++ b/model/Read_only_notebook.py
@@ -9,11 +9,11 @@ class Read_only_notebook( Persistent ):
Persistent.__init__( self, id )
self.__wrapped = notebook
- def lookup_entry( self, entry_id ):
- return self.__wrapped.lookup_entry( entry_id )
+ def lookup_note( self, note_id ):
+ return self.__wrapped.lookup_note( note_id )
- def lookup_entry_by_title( self, title ):
- return self.__wrapped.lookup_entry_by_title( title )
+ def lookup_note_by_title( self, title ):
+ return self.__wrapped.lookup_note_by_title( title )
def to_dict( self ):
d = self.__wrapped.to_dict()
@@ -25,5 +25,5 @@ class Read_only_notebook( Persistent ):
return d
name = property( lambda self: self.__wrapped.name )
- entries = property( lambda self: self.__wrapped.entries )
- startup_entries = property( lambda self: self.__wrapped.startup_entries )
+ notes = property( lambda self: self.__wrapped.notes )
+ startup_notes = property( lambda self: self.__wrapped.startup_notes )
diff --git a/model/test/Test_entry.py b/model/test/Test_entry.py
deleted file mode 100644
index 7c218b8..0000000
--- a/model/test/Test_entry.py
+++ /dev/null
@@ -1,44 +0,0 @@
-from model.Entry import Entry
-
-
-class Test_entry( object ):
- def setUp( self ):
- self.object_id = 17
- self.title = u"title goes here"
- self.contents = u"
viewing and editing, together at last
-With Luminotes, you can update any wiki entry without having to switch to
+With Luminotes, you can update any wiki note without having to switch to
a separate edit mode. And you can forget about markup or markdown.
big-picture browsing
-Deal with several wiki entries all at once on the same page. Perfect for notes
-and brainstorming.
+Deal with several wiki notes all at once on the same page. Perfect for
+brainstorming.
web-based goodness
@@ -24,7 +24,7 @@ wherever you go.
no FunnyLookingTitles
You like spaces? So do we. Smashed together titles are completely unnecessary.
-You're free to title your wiki entries as you see fit.
+You're free to title your wiki notes as you see fit.
built-in searching
@@ -33,5 +33,5 @@ A single search looks through every word in the entire wiki.
-No account yet? Want to make a wiki? You can try it out for free.
+No account yet? Want to make a wiki? You can try it out for free.
diff --git a/static/html/navigation.html b/static/html/navigation.html
index 54f4abd..d3a3c7a 100644
--- a/static/html/navigation.html
+++ b/static/html/navigation.html
@@ -1,5 +1,5 @@
-about -
-features -
-take a tour -
-try it out -
-login
+about -
+features -
+take a tour -
+try it out -
+login
diff --git a/static/html/supported browsers.html b/static/html/supported browsers.html
index a55fb41..d24dd99 100644
--- a/static/html/supported browsers.html
+++ b/static/html/supported browsers.html
@@ -1,7 +1,7 @@
diff --git a/static/html/try it out.html b/static/html/try it out.html
index dda2ca8..f76ca72 100644
--- a/static/html/try it out.html
+++ b/static/html/try it out.html
@@ -35,5 +35,5 @@ dream of giving out your email address.
-Please make sure you're using one of the supported browsers.
+Please make sure you're using one of the supported browsers.
diff --git a/static/html/welcome to your wiki.html b/static/html/welcome to your wiki.html
index 47d6beb..711f21c 100644
--- a/static/html/welcome to your wiki.html
+++ b/static/html/welcome to your wiki.html
@@ -3,23 +3,23 @@
Here's how to get started with your personal wiki notebook.
First, the basics. A Luminotes notebook is simply a collection of
-linked entries, each with a unique title. Right now you're reading an entry
-titled "welcome to your wiki".
+linked notes, each with a unique title. Right now you're reading a note titled
+"welcome to your wiki".
-
To make a new wiki entry, hit the "+" button on the left, or click
-anywhere on the page's background. Start by typing a title for your new entry,
-say, "ideas", and then press enter. Next, type the contents of your new entry,
+
To make a new wiki note, hit the "+" button on the left, or click
+anywhere on the page's background. Start by typing a title for your new note,
+say, "ideas", and then press enter. Next, type the contents of your new note,
using the formatting buttons on the left for things like bold, italics, or
lists.
-
To link one entry to another, use the entry link button with the
-arrow on it. Hit the button once, type the title of an entry you want to link
-to, and then hit the button again. Or, if you've already typed some text, you
-can select it with your mouse and then hit the entry link button.
+
To link one note to another, use the note link button with the arrow
+on it. Hit the button once, type the title of a note you want to link to, and
+then hit the button again. Or, if you've already typed some text, you can
+select it with your mouse and then hit the note link button.
-
To follow a link to another entry, just click on it and it will open
-up for you to view or edit. You can switch between entries just by clicking on
-them, and hide entries simply by clicking the "hide" button.
+
To follow a link to another note, just click on it and it will open
+up for you to view or edit. You can switch between notes just by clicking on
+them, and hide notes simply by clicking the "hide" button.
That's all you need to know to get started with your personal wiki. It's
that easy. Enjoy!
diff --git a/static/js/Editor.js b/static/js/Editor.js
index 15cbccd..58861de 100644
--- a/static/js/Editor.js
+++ b/static/js/Editor.js
@@ -1,23 +1,23 @@
-entry_titles = {} // map from entry title to the open editor for that entry
+note_titles = {} // map from note title to the open editor for that note
-function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, highlight, focus ) {
- this.initial_text = entry_text;
+function Editor( id, note_text, insert_after_iframe_id, read_write, startup, highlight, focus ) {
+ this.initial_text = note_text;
this.id = id;
this.read_write = read_write;
- this.startup = startup || false; // whether this Editor is for a startup entry
+ this.startup = startup || false; // whether this Editor is for a startup note
this.init_highlight = highlight || false;
this.init_focus = focus || false;
- var iframe_id = "entry_" + id;
+ var iframe_id = "note_" + id;
var self = this;
this.document = null;
this.iframe = createDOM( "iframe", {
- "src": "/notebooks/blank_entry/" + id,
+ "src": "/notebooks/blank_note/" + id,
"frameBorder": "0",
"scrolling": "no",
"id": iframe_id,
"name": iframe_id,
- "class": "entry_frame"
+ "class": "note_frame"
} );
this.iframe.editor = this;
this.title = null;
@@ -25,19 +25,19 @@ function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, hi
if ( read_write ) {
this.delete_button = createDOM( "input", {
"type": "button",
- "class": "entry_button",
+ "class": "note_button",
"id": "delete_" + iframe_id,
"value": "delete",
- "title": "delete entry [ctrl-d]"
+ "title": "delete note [ctrl-d]"
} );
connect( this.delete_button, "onclick", function ( event ) { signal( self, "delete_clicked", event ); } );
this.options_button = createDOM( "input", {
"type": "button",
- "class": "entry_button",
+ "class": "note_button",
"id": "options_" + iframe_id,
"value": "options",
- "title": "entry options"
+ "title": "note options"
} );
connect( this.options_button, "onclick", function ( event ) { signal( self, "options_clicked", event ); } );
}
@@ -45,15 +45,15 @@ function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, hi
if ( read_write || !startup ) {
this.hide_button = createDOM( "input", {
"type": "button",
- "class": "entry_button",
+ "class": "note_button",
"id": "hide_" + iframe_id,
"value": "hide",
- "title": "hide entry [ctrl-h]"
+ "title": "hide note [ctrl-h]"
} );
connect( this.hide_button, "onclick", function ( event ) { signal( self, "hide_clicked", event ); } );
}
- this.entry_controls = createDOM( "span", { "class": "entry_controls" },
+ this.note_controls = createDOM( "span", { "class": "note_controls" },
this.delete_button ? this.delete_button : null,
this.delete_button ? " " : null,
this.options_button ? this.options_button : null,
@@ -64,18 +64,18 @@ function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, hi
// if an iframe has been given to insert this new editor after, then insert the new editor's
// iframe. otherwise just append the iframe for the new editor
if ( insert_after_iframe_id ) {
- insertSiblingNodesAfter( insert_after_iframe_id, this.entry_controls );
- insertSiblingNodesAfter( this.entry_controls, this.iframe );
+ insertSiblingNodesAfter( insert_after_iframe_id, this.note_controls );
+ insertSiblingNodesAfter( this.note_controls, this.iframe );
} else {
- appendChildNodes( "entries", this.entry_controls );
- appendChildNodes( "entries", this.iframe );
+ appendChildNodes( "notes", this.note_controls );
+ appendChildNodes( "notes", this.iframe );
}
}
// second stage of construction, invoked by the iframe's body onload handler. do not call directly.
// four-stage construction is only necessary because IE is such a piece of shit
function editor_loaded( id ) {
- var iframe = getElement( "entry_" + id );
+ var iframe = getElement( "note_" + id );
setTimeout( function () { iframe.editor.init_document(); }, 1 );
}
@@ -121,7 +121,7 @@ Editor.prototype.finish_init = function () {
connect( this.document.body, "onblur", function ( event ) { self.blurred( event ); } );
connect( this.document.body, "onfocus", function ( event ) { self.focused( event ); } );
- // special-case: connect any submit buttons within the contents of this entry
+ // special-case: connect any submit buttons within the contents of this note
var signup_button = withDocument( this.document, function () { return getElement( "signup_button" ); } );
if ( signup_button ) {
var signup_form = withDocument( this.document, function () { return getElement( "signup_form" ); } );
@@ -256,24 +256,24 @@ Editor.prototype.mouse_clicked = function ( event ) {
var id;
var link_title = scrapeText( link );
- var editor = entry_titles[ link_title ];
+ var editor = note_titles[ link_title ];
var href_leaf = link.href.split( "/" ).pop();
- // if the link's title corresponds to an open entry id, set that as the link's destination
+ // if the link's title corresponds to an open note id, set that as the link's destination
if ( editor ) {
id = editor.id;
- link.href = "/entries/" + id;
- // if this is a new link, get a new entry id and set it for the link's destination
+ link.href = "/notes/" + id;
+ // if this is a new link, get a new note id and set it for the link's destination
} else if ( href_leaf == "new" ) {
signal( this, "load_editor_by_title", link_title, this.iframe.id );
return;
// otherwise, use the id from link's current destination
} else {
- // the last part of the current link's href is the entry id
+ // the last part of the current link's href is the note id
id = href_leaf;
}
- // find the entry corresponding to the linked id, or create a new entry
- var iframe = getElement( "entry_" + id );
+ // find the note corresponding to the linked id, or create a new note
+ var iframe = getElement( "note_" + id );
if ( iframe ) {
iframe.editor.highlight();
return;
@@ -283,18 +283,18 @@ Editor.prototype.mouse_clicked = function ( event ) {
}
Editor.prototype.scrape_title = function () {
- // scrape the entry title out of the editor
+ // scrape the note title out of the editor
var heading = getFirstElementByTagAndClassName( "h3", null, this.document );
if ( !heading ) return;
var title = scrapeText( heading );
- // delete the previous title (if any) from the entry_titles map
+ // delete the previous title (if any) from the note_titles map
if ( this.title )
- delete entry_titles[ this.title ];
+ delete note_titles[ this.title ];
- // record the new title in entry_titles
+ // record the new title in note_titles
this.title = title;
- entry_titles[ this.title ] = this;
+ note_titles[ this.title ] = this;
}
Editor.prototype.focused = function () {
@@ -325,13 +325,13 @@ Editor.prototype.start_link = function () {
var container = range.startContainer;
range.setStart( container, range.startOffset - 1 );
- this.exec_command( "createLink", "/entries/new" );
+ this.exec_command( "createLink", "/notes/new" );
container.nodeValue = "";
selection.collapse( container, 0 );
// otherwise, just create a link with the selected text as the link title
} else {
- this.exec_command( "createLink", "/entries/new" );
+ this.exec_command( "createLink", "/notes/new" );
}
} else if ( this.document.selection ) { // browsers such as IE
var range = this.document.selection.createRange();
@@ -344,7 +344,7 @@ Editor.prototype.start_link = function () {
range.select();
}
- this.exec_command( "createLink", "/entries/new" );
+ this.exec_command( "createLink", "/notes/new" );
}
}
@@ -422,10 +422,10 @@ Editor.prototype.contents = function () {
Editor.prototype.shutdown = function( event ) {
if ( this.title )
- delete entry_titles[ this.title ];
+ delete note_titles[ this.title ];
var iframe = this.iframe;
- var entry_controls = this.entry_controls;
+ var note_controls = this.note_controls;
disconnectAll( this );
disconnectAll( this.delete_button );
disconnectAll( this.options_button );
@@ -435,7 +435,7 @@ Editor.prototype.shutdown = function( event ) {
disconnectAll( this.document );
blindUp( iframe, options = { "duration": 0.5, afterFinish: function () {
try {
- removeElement( entry_controls );
+ removeElement( note_controls );
removeElement( iframe );
} catch ( e ) { }
} } );
diff --git a/static/js/Wiki.js b/static/js/Wiki.js
index 44489d9..de234df 100644
--- a/static/js/Wiki.js
+++ b/static/js/Wiki.js
@@ -5,7 +5,7 @@ function Wiki() {
this.notebook = null;
this.notebook_id = getElement( "notebook_id" ).value;
this.read_write = false;
- this.startup_entries = new Array(); // map of startup entries: entry id to bool
+ this.startup_notes = new Array(); // map of startup notes: note id to bool
this.invoker = new Invoker();
connect( this.invoker, "error_message", this, "display_message" );
@@ -45,7 +45,7 @@ Wiki.prototype.display_user = function ( result ) {
// display links for current notebook a list of other notebooks that the user has access to
var span = createDOM( "span" );
replaceChildNodes( "notebook_area", span );
- appendChildNodes( span, createDOM( "a", { "href": "/notebooks/" + this.notebook_id, "id": "recent_entries_link" }, "recent entries" ) );
+ appendChildNodes( span, createDOM( "a", { "href": "/notebooks/" + this.notebook_id, "id": "recent_notes_link" }, "recent notes" ) );
appendChildNodes( span, createDOM( "br" ) );
appendChildNodes( span, createDOM( "a", { "href": "/notebooks/download_html/" + this.notebook_id, "id": "download_html_link" }, "download as html" ) );
@@ -69,9 +69,9 @@ Wiki.prototype.display_user = function ( result ) {
appendChildNodes( span, createDOM( "a", { "href": "/", "id": "logout_link" }, "logout" ) );
var self = this;
- connect( "recent_entries_link", "onclick", function ( event ) {
+ connect( "recent_notes_link", "onclick", function ( event ) {
self.invoker.invoke(
- "/notebooks/recent_entries", "GET", { "notebook_id": self.notebook_id },
+ "/notebooks/recent_notes", "GET", { "notebook_id": self.notebook_id },
function( result ) { self.display_search_results( result ); }
);
event.stop();
@@ -107,7 +107,7 @@ Wiki.prototype.populate = function ( result ) {
connect( "insertUnorderedList", "onclick", function ( event ) { self.toggle_button( event, "insertUnorderedList" ); } );
connect( "insertOrderedList", "onclick", function ( event ) { self.toggle_button( event, "insertOrderedList" ); } );
connect( "createLink", "onclick", this, "toggle_link_button" );
- connect( "newEntry", "onclick", this, "create_blank_editor" );
+ connect( "newNote", "onclick", this, "create_blank_editor" );
connect( "html", "onclick", this, "background_clicked" );
// grab the next available object id
@@ -116,13 +116,13 @@ Wiki.prototype.populate = function ( result ) {
);
}
- // create an editor for each startup entry in the received notebook, focusing the first one
- for ( var i in this.notebook.startup_entries ) {
- var entry = this.notebook.startup_entries[ i ];
- if ( !entry ) continue;
- this.startup_entries[ entry.object_id ] = true;
+ // create an editor for each startup note in the received notebook, focusing the first one
+ for ( var i in this.notebook.startup_notes ) {
+ var note = this.notebook.startup_notes[ i ];
+ if ( !note ) continue;
+ this.startup_notes[ note.object_id ] = true;
var focus = ( i == 0 );
- this.create_editor( entry.object_id, entry.contents, undefined, undefined, false, focus );
+ this.create_editor( note.object_id, note.contents, undefined, undefined, false, focus );
}
}
@@ -142,7 +142,7 @@ Wiki.prototype.create_blank_editor = function ( event ) {
// if there is already a blank editor, then highlight it and bail
if ( this.blank_editor_id != null ) {
- var blank_iframe_id = "entry_" + this.blank_editor_id;
+ var blank_iframe_id = "note_" + this.blank_editor_id;
var iframe = getElement( blank_iframe_id );
if ( iframe && iframe.editor.empty() ) {
iframe.editor.highlight();
@@ -153,43 +153,43 @@ Wiki.prototype.create_blank_editor = function ( event ) {
this.blank_editor_id = this.create_editor( undefined, undefined, undefined, undefined, true, true );
}
-Wiki.prototype.load_editor = function ( entry_title, insert_after_iframe_id, entry_id ) {
+Wiki.prototype.load_editor = function ( note_title, insert_after_iframe_id, note_id ) {
var self = this;
this.invoker.invoke(
- "/notebooks/load_entry", "GET", {
+ "/notebooks/load_note", "GET", {
"notebook_id": this.notebook_id,
- "entry_id": entry_id
+ "note_id": note_id
},
- function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, entry_title ); }
+ function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, note_title ); }
);
}
-Wiki.prototype.load_editor_by_title = function ( entry_title, insert_after_iframe_id ) {
+Wiki.prototype.load_editor_by_title = function ( note_title, insert_after_iframe_id ) {
var self = this;
this.invoker.invoke(
- "/notebooks/load_entry_by_title", "GET", {
+ "/notebooks/load_note_by_title", "GET", {
"notebook_id": this.notebook_id,
- "entry_title": entry_title
+ "note_title": note_title
},
- function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, entry_title ); }
+ function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, note_title ); }
);
}
-Wiki.prototype.parse_loaded_editor = function ( result, insert_after_iframe_id, entry_title ) {
- if ( result.entry ) {
- var id = result.entry.object_id
- var entry_text = result.entry.contents;
+Wiki.prototype.parse_loaded_editor = function ( result, insert_after_iframe_id, note_title ) {
+ if ( result.note ) {
+ var id = result.note.object_id
+ var note_text = result.note.contents;
} else {
var id = null;
- var entry_text = "
" + entry_title;
+ var note_text = "
" + note_title;
}
- this.create_editor( id, entry_text, insert_after_iframe_id, entry_title, true, false );
+ this.create_editor( id, note_text, insert_after_iframe_id, note_title, true, false );
}
-Wiki.prototype.create_editor = function ( id, entry_text, insert_after_iframe_id, entry_title, highlight, focus ) {
+Wiki.prototype.create_editor = function ( id, note_text, insert_after_iframe_id, note_title, highlight, focus ) {
this.clear_messages();
this.clear_pulldowns();
@@ -209,9 +209,9 @@ Wiki.prototype.create_editor = function ( id, entry_text, insert_after_iframe_id
if ( insert_after_iframe_id ) {
var links = getElementsByTagAndClassName( "a", null, getElement( insert_after_iframe_id ).editor.document );
for ( var i in links ) {
- // a link matches if its contained text is the same as this entry's title
- if ( scrapeText( links[ i ] ) == entry_title )
- links[ i ].href = "/entries/" + id;
+ // a link matches if its contained text is the same as this note's title
+ if ( scrapeText( links[ i ] ) == note_title )
+ links[ i ].href = "/notes/" + id;
}
}
@@ -228,8 +228,8 @@ Wiki.prototype.create_editor = function ( id, entry_text, insert_after_iframe_id
}
}
- var startup = this.startup_entries[ id ];
- var editor = new Editor( id, entry_text, undefined, this.read_write, startup, highlight, focus );
+ var startup = this.startup_notes[ id ];
+ var editor = new Editor( id, note_text, undefined, this.read_write, startup, highlight, focus );
if ( this.read_write ) {
connect( editor, "state_changed", this, "editor_state_changed" );
@@ -258,10 +258,10 @@ Wiki.prototype.editor_focused = function ( editor, fire_and_forget ) {
this.clear_pulldowns();
if ( editor )
- addElementClass( editor.iframe, "focused_entry_frame" );
+ addElementClass( editor.iframe, "focused_note_frame" );
if ( this.focused_editor && this.focused_editor != editor ) {
- removeElementClass( this.focused_editor.iframe, "focused_entry_frame" );
+ removeElementClass( this.focused_editor.iframe, "focused_note_frame" );
// if the formerly focused editor is completely empty, then remove it as the user leaves it and switches to this editor
if ( this.focused_editor.empty() ) {
@@ -297,16 +297,16 @@ Wiki.prototype.editor_key_pressed = function ( editor, event ) {
// ctrl-n: ordered list
} else if ( code == 49 ) {
this.toggle_button( event, "insertOrderedList" );
- // ctrl-e: make an entry link
+ // ctrl-e: make an note link
} else if ( code == 69 ) {
this.toggle_link_button( event );
- // ctrl-n: new entry
+ // ctrl-n: new note
} else if ( code == 78 ) {
this.create_blank_editor( event );
- // ctrl-h: hide entry
+ // ctrl-h: hide note
} else if ( code == 72 ) {
this.hide_editor( event );
- // ctrl-d: delete entry
+ // ctrl-d: delete note
} else if ( code == 68 ) {
this.delete_editor( event );
}
@@ -397,13 +397,13 @@ Wiki.prototype.delete_editor = function ( event, editor ) {
}
if ( editor ) {
- if ( this.startup_entries[ editor.id ] )
- delete this.startup_entries[ editor.id ];
+ if ( this.startup_notes[ editor.id ] )
+ delete this.startup_notes[ editor.id ];
if ( this.read_write ) {
- this.invoker.invoke( "/notebooks/delete_entry", "POST", {
+ this.invoker.invoke( "/notebooks/delete_note", "POST", {
"notebook_id": this.notebook_id,
- "entry_id": editor.id
+ "note_id": editor.id
} );
}
@@ -422,9 +422,9 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget ) {
if ( editor && !editor.empty() ) {
// TODO: do something with the result other than just ignoring it
- this.invoker.invoke( "/notebooks/save_entry", "POST", {
+ this.invoker.invoke( "/notebooks/save_note", "POST", {
"notebook_id": this.notebook_id,
- "entry_id": editor.id,
+ "note_id": editor.id,
"contents": editor.contents(),
"startup": editor.startup
}, null, null, fire_and_forget );
@@ -449,26 +449,26 @@ Wiki.prototype.display_search_results = function ( result ) {
this.save_editor();
// TODO: somehow highlight the search term within the search results?
- // make a map of entry object id to entry
- var entries = {};
- for ( var i in result.entries ) {
- var entry = result.entries[ i ];
- entries[ entry.object_id ] = entry;
+ // make a map of note object id to note
+ var notes = {};
+ for ( var i in result.notes ) {
+ var note = result.notes[ i ];
+ notes[ note.object_id ] = note;
}
- // hide all existing editors except those for startup entries or search results
- var iframes = getElementsByTagAndClassName( "iframe", "entry_frame" );
+ // hide all existing editors except those for startup notes or search results
+ var iframes = getElementsByTagAndClassName( "iframe", "note_frame" );
for ( var i in iframes ) {
var iframe = iframes[ i ];
- // don't hide an existing entry if it's in the search results
- if ( entries[ iframe.editor.id ] ) {
+ // don't hide an existing note if it's in the search results
+ if ( notes[ iframe.editor.id ] ) {
iframe.editor.highlight( false );
- delete entries[ iframe.editor.id ];
+ delete notes[ iframe.editor.id ];
continue;
}
- // don't hide an existing entry if it's a read-only startup entry
+ // don't hide an existing note if it's a read-only startup note
if ( iframe.editor.startup && !iframe.editor.read_write )
continue;
@@ -476,17 +476,17 @@ Wiki.prototype.display_search_results = function ( result ) {
}
// if there are no search results, indicate that and bail
- if ( result.entries.length == 0 ) {
- this.display_message( "No matching entries." );
+ if ( result.notes.length == 0 ) {
+ this.display_message( "No matching notes." );
return;
}
- // create an editor for each entry search result, focusing the first one
+ // create an editor for each note search result, focusing the first one
var i = 0;
- for ( var id in entries ) {
- var entry = entries[ id ];
+ for ( var id in notes ) {
+ var note = notes[ id ];
var focus = ( i == 0 );
- this.create_editor( id, entry.contents, undefined, undefined, false, focus );
+ this.create_editor( id, note.contents, undefined, undefined, false, focus );
i += 1;
}
}
@@ -497,7 +497,7 @@ Wiki.prototype.display_message = function ( text ) {
var inner_div = DIV( { "class": "message_inner" }, text );
var div = DIV( { "class": "message" }, inner_div );
- appendChildNodes( "entries", div );
+ appendChildNodes( "notes", div );
ScrollTo( div );
}
@@ -578,11 +578,11 @@ Pulldown.prototype.startup_clicked = function ( event ) {
this.startup_checkbox.checked = this.startup_checkbox.checked ? false : true;
this.editor.startup = this.startup_checkbox.checked;
- // if this entry isn't empty, save it along with its startup status
+ // if this note isn't empty, save it along with its startup status
if ( !this.editor.empty() ) {
- this.invoker.invoke( "/notebooks/save_entry", "POST", {
+ this.invoker.invoke( "/notebooks/save_note", "POST", {
"notebook_id": this.notebook_id,
- "entry_id": this.editor.id,
+ "note_id": this.editor.id,
"contents": this.editor.contents(),
"startup": this.editor.startup
} );
diff --git a/tools/initdb.py b/tools/initdb.py
index fa46978..4acde4c 100644
--- a/tools/initdb.py
+++ b/tools/initdb.py
@@ -6,13 +6,13 @@ from controller.Database import Database
from controller.Scheduler import Scheduler
from model.Notebook import Notebook
from model.Read_only_notebook import Read_only_notebook
-from model.Entry import Entry
+from model.Note import Note
from model.User import User
class Initializer( object ):
HTML_PATH = u"static/html"
- ENTRY_FILES = [ # the second element of the tuple is whether to show the entry on startup
+ ENTRY_FILES = [ # the second element of the tuple is whether to show the note on startup
( u"navigation.html", True ),
( u"about.html", True ),
( u"features.html", True ),
@@ -45,7 +45,7 @@ class Initializer( object ):
self.scheduler.wait_for( thread )
def create_main_notebook( self ):
- # create the main notebook and all of its entries
+ # create the main notebook and all of its notes
self.database.next_id( self.scheduler.thread )
main_notebook_id = ( yield Scheduler.SLEEP )
self.main_notebook = Notebook( main_notebook_id, u"Luminotes" )
@@ -55,13 +55,13 @@ class Initializer( object ):
contents = file( full_filename ).read()
self.database.next_id( self.scheduler.thread )
- entry_id = ( yield Scheduler.SLEEP )
+ note_id = ( yield Scheduler.SLEEP )
- entry = Entry( entry_id, contents )
- self.main_notebook.add_entry( entry )
+ note = Note( note_id, contents )
+ self.main_notebook.add_note( note )
if startup:
- self.main_notebook.add_startup_entry( entry )
+ self.main_notebook.add_startup_note( note )
self.database.save( self.main_notebook )
@@ -80,16 +80,16 @@ class Initializer( object ):
self.database.save( self.anonymous )
def create_user_notebook( self ):
- # create the user notebook along with a startup entry
+ # create the user notebook along with a startup note
self.database.next_id( self.scheduler.thread )
user_notebook_id = ( yield Scheduler.SLEEP )
self.user_notebook = Notebook( user_notebook_id, u"my notebook" )
self.database.next_id( self.scheduler.thread )
- entry_id = ( yield Scheduler.SLEEP )
- entry = Entry( entry_id, u"