Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
function Editor( id, notebook_id, note_text, deleted_from_id, revision, read_write, startup, highlight, focus ) {
|
2007-07-16 20:22:38 +00:00
|
|
|
this.id = id;
|
2007-08-11 21:34:56 +00:00
|
|
|
this.notebook_id = notebook_id;
|
2007-07-26 01:18:41 +00:00
|
|
|
this.initial_text = note_text;
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
this.deleted_from_id = deleted_from_id || null;
|
|
|
|
this.revision = revision;
|
|
|
|
this.revisions_list = new Array(); // cache for this note's list of revisions, loaded from the server on-demand
|
2007-07-16 20:22:38 +00:00
|
|
|
this.read_write = read_write;
|
2007-07-17 01:21:31 +00:00
|
|
|
this.startup = startup || false; // whether this Editor is for a startup note
|
2007-07-16 20:22:38 +00:00
|
|
|
this.init_highlight = highlight || false;
|
|
|
|
this.init_focus = focus || false;
|
2007-09-05 18:49:28 +00:00
|
|
|
this.closed = false;
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = null;
|
2007-07-17 01:21:31 +00:00
|
|
|
var iframe_id = "note_" + id;
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
var self = this;
|
|
|
|
this.document = null;
|
|
|
|
this.iframe = createDOM( "iframe", {
|
2007-09-01 23:46:15 +00:00
|
|
|
"src": "/static/html/blank_note.html",
|
2007-07-16 20:22:38 +00:00
|
|
|
"frameBorder": "0",
|
|
|
|
"scrolling": "no",
|
|
|
|
"id": iframe_id,
|
|
|
|
"name": iframe_id,
|
2007-09-27 05:45:43 +00:00
|
|
|
"class": "note_frame",
|
2007-09-27 06:44:29 +00:00
|
|
|
"onresize": function () { setTimeout( function () { self.resize() }, 50 ); }
|
2007-07-16 20:22:38 +00:00
|
|
|
} );
|
|
|
|
this.iframe.editor = this;
|
|
|
|
this.title = null;
|
|
|
|
|
|
|
|
if ( read_write ) {
|
|
|
|
this.delete_button = createDOM( "input", {
|
|
|
|
"type": "button",
|
2007-07-17 01:21:31 +00:00
|
|
|
"class": "note_button",
|
2007-07-16 20:22:38 +00:00
|
|
|
"id": "delete_" + iframe_id,
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
"value": "delete" + ( this.deleted_from_id ? " forever" : "" ),
|
2007-07-17 01:21:31 +00:00
|
|
|
"title": "delete note [ctrl-d]"
|
2007-07-16 20:22:38 +00:00
|
|
|
} );
|
|
|
|
connect( this.delete_button, "onclick", function ( event ) { signal( self, "delete_clicked", event ); } );
|
|
|
|
|
2007-07-26 01:18:41 +00:00
|
|
|
this.changes_button = createDOM( "input", {
|
|
|
|
"type": "button",
|
|
|
|
"class": "note_button",
|
|
|
|
"id": "changes_" + iframe_id,
|
|
|
|
"value": "changes",
|
|
|
|
"title": "previous revisions"
|
|
|
|
} );
|
|
|
|
connect( this.changes_button, "onclick", function ( event ) { signal( self, "changes_clicked", event ); } );
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
if ( this.deleted_from_id ) {
|
2007-08-07 01:48:43 +00:00
|
|
|
this.undelete_button = createDOM( "input", {
|
|
|
|
"type": "button",
|
|
|
|
"class": "note_button",
|
|
|
|
"id": "undelete_" + iframe_id,
|
|
|
|
"value": "undelete",
|
|
|
|
"title": "undelete note"
|
|
|
|
} );
|
|
|
|
connect( this.undelete_button, "onclick", function ( event ) { signal( self, "undelete_clicked", event ); } );
|
|
|
|
} else {
|
|
|
|
this.options_button = createDOM( "input", {
|
|
|
|
"type": "button",
|
|
|
|
"class": "note_button",
|
|
|
|
"id": "options_" + iframe_id,
|
|
|
|
"value": "options",
|
|
|
|
"title": "note options"
|
|
|
|
} );
|
|
|
|
connect( this.options_button, "onclick", function ( event ) { signal( self, "options_clicked", event ); } );
|
|
|
|
}
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
if ( !this.deleted_from_id && ( read_write || !startup ) ) {
|
2007-07-16 20:22:38 +00:00
|
|
|
this.hide_button = createDOM( "input", {
|
|
|
|
"type": "button",
|
2007-07-17 01:21:31 +00:00
|
|
|
"class": "note_button",
|
2007-07-16 20:22:38 +00:00
|
|
|
"id": "hide_" + iframe_id,
|
|
|
|
"value": "hide",
|
2007-07-17 01:21:31 +00:00
|
|
|
"title": "hide note [ctrl-h]"
|
2007-07-16 20:22:38 +00:00
|
|
|
} );
|
|
|
|
connect( this.hide_button, "onclick", function ( event ) { signal( self, "hide_clicked", event ); } );
|
|
|
|
}
|
|
|
|
|
2007-07-17 01:21:31 +00:00
|
|
|
this.note_controls = createDOM( "span", { "class": "note_controls" },
|
2007-07-16 20:22:38 +00:00
|
|
|
this.delete_button ? this.delete_button : null,
|
|
|
|
this.delete_button ? " " : null,
|
2007-07-26 01:18:41 +00:00
|
|
|
this.changes_button ? this.changes_button : null,
|
|
|
|
this.changes_button ? " " : null,
|
2007-07-16 20:22:38 +00:00
|
|
|
this.options_button ? this.options_button : null,
|
|
|
|
this.options_button ? " " : null,
|
2007-08-07 01:48:43 +00:00
|
|
|
this.undelete_button ? this.undelete_button : null,
|
|
|
|
this.undelete_button ? " " : null,
|
2007-07-16 20:22:38 +00:00
|
|
|
this.hide_button ? this.hide_button : null
|
|
|
|
);
|
|
|
|
|
2007-09-05 18:53:42 +00:00
|
|
|
appendChildNodes( "notes", this.note_controls );
|
|
|
|
appendChildNodes( "notes", this.iframe );
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-09-01 23:46:15 +00:00
|
|
|
connect( this.iframe, "onload", function ( event ) { self.init_document(); } );
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
|
2007-09-01 23:46:15 +00:00
|
|
|
// second stage of construction, invoked by editor_loaded(). do not call directly
|
2007-07-16 20:22:38 +00:00
|
|
|
Editor.prototype.init_document = function () {
|
|
|
|
var self = this; // necessary so that the member functions of this editor object are used
|
|
|
|
|
|
|
|
if ( this.iframe.contentDocument ) { // browsers such as Firefox
|
|
|
|
this.document = this.iframe.contentDocument;
|
|
|
|
|
2007-09-01 23:46:15 +00:00
|
|
|
if ( this.read_write )
|
2007-07-16 20:22:38 +00:00
|
|
|
this.document.designMode = "On";
|
2007-09-01 23:46:15 +00:00
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
setTimeout( function () { self.finish_init(); }, 1 );
|
|
|
|
} else { // browsers such as IE
|
|
|
|
this.document = this.iframe.contentWindow.document;
|
|
|
|
|
|
|
|
if ( this.read_write ) {
|
|
|
|
this.document.designMode = "On";
|
|
|
|
// work-around for IE bug: reget the document after designMode is turned on
|
|
|
|
this.document = this.iframe.contentWindow.document;
|
|
|
|
}
|
|
|
|
setTimeout( function () { self.finish_init(); }, 100 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-01 23:46:15 +00:00
|
|
|
// third and final stage of construction, invoked by init_document(). do not call directly
|
2007-07-16 20:22:38 +00:00
|
|
|
Editor.prototype.finish_init = function () {
|
|
|
|
if ( !this.initial_text )
|
|
|
|
this.initial_text = "<h3>";
|
|
|
|
|
|
|
|
this.insert_html( this.initial_text );
|
|
|
|
|
|
|
|
var self = this; // necessary so that the member functions of this editor object are used
|
|
|
|
if ( this.read_write ) {
|
|
|
|
connect( this.document, "onkeydown", function ( event ) { self.key_pressed( event ); } );
|
|
|
|
connect( this.document, "onkeyup", function ( event ) { self.key_released( event ); } );
|
2007-07-31 22:53:57 +00:00
|
|
|
connect( this.document, "onblur", function ( event ) { self.blurred( event ); } );
|
|
|
|
connect( this.document, "onfocus", function ( event ) { self.focused( event ); } );
|
|
|
|
connect( this.document.body, "onblur", function ( event ) { self.blurred( event ); } );
|
|
|
|
connect( this.document.body, "onfocus", function ( event ) { self.focused( event ); } );
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
connect( this.document, "onclick", function ( event ) { self.mouse_clicked( event ); } );
|
|
|
|
|
2007-07-17 01:21:31 +00:00
|
|
|
// special-case: connect any submit buttons within the contents of this note
|
2007-07-16 20:22:38 +00:00
|
|
|
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" ); } );
|
|
|
|
connect( signup_button, "onclick", function ( event ) {
|
2007-08-02 04:01:11 +00:00
|
|
|
signal( self, "submit_form", "/users/signup", signup_form ); event.stop();
|
2007-07-16 20:22:38 +00:00
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
var login_button = withDocument( this.document, function () { return getElement( "login_button" ); } );
|
|
|
|
if ( login_button ) {
|
|
|
|
var login_form = withDocument( this.document, function () { return getElement( "login_form" ); } );
|
|
|
|
connect( login_button, "onclick", function ( event ) {
|
2007-08-02 04:01:11 +00:00
|
|
|
signal( self, "submit_form", "/users/login", login_form ); event.stop();
|
2007-07-16 20:22:38 +00:00
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2007-09-26 23:49:27 +00:00
|
|
|
var send_reset_button = withDocument( this.document, function () { return getElement( "send_reset_button" ); } );
|
|
|
|
if ( send_reset_button ) {
|
|
|
|
var send_reset_form = withDocument( this.document, function () { return getElement( "send_reset_form" ); } );
|
|
|
|
connect( send_reset_button, "onclick", function ( event ) {
|
|
|
|
signal( self, "submit_form", "/users/send_reset", send_reset_form ); event.stop();
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
var reset_button = withDocument( this.document, function () { return getElement( "reset_button" ); } );
|
|
|
|
if ( reset_button ) {
|
|
|
|
var reset_form = withDocument( this.document, function () { return getElement( "reset_form" ); } );
|
|
|
|
connect( reset_button, "onclick", function ( event ) {
|
|
|
|
signal( self, "submit_form", "/users/reset_password", reset_form ); event.stop();
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
if ( this.iframe.contentDocument ) { // browsers such as Firefox
|
|
|
|
if ( this.read_write ) this.exec_command( "styleWithCSS", false );
|
|
|
|
}
|
|
|
|
|
2007-09-27 05:45:43 +00:00
|
|
|
this.resize();
|
|
|
|
if ( this.init_highlight ) self.highlight();
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
this.scrape_title();
|
|
|
|
if ( this.init_focus )
|
|
|
|
this.focus();
|
2007-09-07 21:05:39 +00:00
|
|
|
|
2007-09-08 00:21:33 +00:00
|
|
|
signal( self, "init_complete" );
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.highlight = function ( scroll ) {
|
|
|
|
if ( scroll == undefined )
|
|
|
|
scroll = true;
|
|
|
|
|
|
|
|
if ( /Opera/.test( navigator.userAgent ) ) { // MochiKit's Highlight is broken in Opera
|
2007-07-23 23:49:57 +00:00
|
|
|
if ( scroll ) ScrollTo( this.note_controls );
|
2007-07-16 20:22:38 +00:00
|
|
|
pulsate( this.iframe, options = { "pulses": 1, "duration": 0.5 } );
|
|
|
|
} else if ( this.iframe.contentDocument ) { // browsers such as Firefox
|
2007-07-23 23:49:57 +00:00
|
|
|
if ( scroll ) ScrollTo( this.note_controls );
|
2007-07-16 20:22:38 +00:00
|
|
|
Highlight( this.iframe, options = { "queue": { "scope": "highlight", "limit": 1 } } );
|
|
|
|
} else { // browsers such as IE
|
2007-07-23 23:49:57 +00:00
|
|
|
if ( scroll ) ScrollTo( this.note_controls );
|
2007-07-16 20:22:38 +00:00
|
|
|
if ( this.document && this.document.body )
|
|
|
|
Highlight( this.document.body, options = { "queue": { "scope": "highlight", "limit": 1 } } );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.exec_command = function ( command, parameter ) {
|
|
|
|
command = command.toLowerCase();
|
|
|
|
|
|
|
|
if ( command == "h3" ) {
|
|
|
|
if ( this.state_enabled( "h3" ) )
|
|
|
|
this.document.execCommand( "formatblock", false, "normal" );
|
|
|
|
else
|
|
|
|
this.document.execCommand( "formatblock", false, "<h3>" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.document.execCommand( command, false, parameter );
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.insert_html = function ( html ) {
|
|
|
|
if ( html.length == 0 ) return;
|
|
|
|
|
|
|
|
if ( !this.read_write ) {
|
|
|
|
this.document.body.innerHTML = html;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try { // browsers supporting insertHTML command, such as Firefox
|
|
|
|
this.document.execCommand( "insertHTML", false, html );
|
|
|
|
|
|
|
|
// for some reason, appending an empty span improves formatting
|
|
|
|
spans = getElementsByTagAndClassName( "span", null, parent = this.document );
|
|
|
|
if ( spans.length == 0 ) {
|
|
|
|
var span = this.document.createElement( "span" );
|
|
|
|
this.document.body.appendChild( span );
|
|
|
|
}
|
|
|
|
} catch ( e ) { // browsers that don't support insertHTML, such as IE
|
|
|
|
this.document.body.innerHTML = html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// resize the editor's frame to fit the dimensions of its content
|
|
|
|
Editor.prototype.resize = function () {
|
|
|
|
var dimensions;
|
|
|
|
// TODO: find a better way to determine which dimensions to use than just checking for contentDocument
|
2007-09-27 05:45:43 +00:00
|
|
|
if ( this.iframe.contentDocument ) { // Firefox
|
2007-07-16 20:22:38 +00:00
|
|
|
dimensions = { "h": elementDimensions( this.document.documentElement ).h };
|
2007-09-27 05:45:43 +00:00
|
|
|
} else { // IE
|
|
|
|
if ( !this.document ) return;
|
2007-07-16 20:22:38 +00:00
|
|
|
dimensions = { "h": this.document.body.scrollHeight };
|
2007-09-27 05:45:43 +00:00
|
|
|
}
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
setElementDimensions( this.iframe, dimensions );
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.key_pressed = function ( event ) {
|
|
|
|
signal( this, "key_pressed", this, event );
|
|
|
|
|
|
|
|
this.resize();
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.key_released = function ( event ) {
|
|
|
|
this.resize();
|
|
|
|
|
2007-09-11 00:10:44 +00:00
|
|
|
// if ctrl keys are released, bail
|
2007-07-16 20:22:38 +00:00
|
|
|
var code = event.key().code;
|
2007-09-11 00:10:44 +00:00
|
|
|
if ( event.modifier().ctrl )
|
2007-07-16 20:22:38 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
signal( this, "state_changed", this );
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.mouse_clicked = function ( event ) {
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = null;
|
|
|
|
|
2007-08-10 19:32:12 +00:00
|
|
|
// update the state no matter what, in case the cursor has moved
|
2007-09-04 22:31:32 +00:00
|
|
|
if ( this.read_write )
|
|
|
|
signal( this, "state_changed", this );
|
2007-08-10 19:32:12 +00:00
|
|
|
|
2007-07-27 00:32:42 +00:00
|
|
|
// we only want to deal with left mouse button clicks
|
|
|
|
if ( event.mouse().button.middle || event.mouse().button.right )
|
|
|
|
return;
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
// search through the tree of elements containing the clicked target. if a link isn't found, bail
|
|
|
|
var link = event.target()
|
|
|
|
while ( link.nodeName != "A" ) {
|
|
|
|
link = link.parentNode;
|
|
|
|
if ( !link )
|
|
|
|
return;
|
|
|
|
}
|
2007-08-16 22:27:58 +00:00
|
|
|
if ( !link.href ) return;
|
|
|
|
|
|
|
|
// links with targets are considered to be external links pointing outside of this wiki
|
|
|
|
if ( link.target ) {
|
|
|
|
// if this is a read-only editor, bail and let the browser handle the link normally
|
|
|
|
if ( !this.read_write ) return;
|
|
|
|
|
|
|
|
// otherwise, this is a read-write editor, so we've got to launch the external link ourselves.
|
|
|
|
// note that this ignores what the link target actually contains and assumes it's "_new"
|
|
|
|
window.open( link.href );
|
|
|
|
event.stop();
|
2007-07-16 20:22:38 +00:00
|
|
|
return;
|
2007-08-16 22:27:58 +00:00
|
|
|
}
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-08-02 04:01:11 +00:00
|
|
|
event.stop();
|
|
|
|
|
2007-08-16 01:29:18 +00:00
|
|
|
// load the note corresponding to the clicked link
|
2007-08-14 04:13:49 +00:00
|
|
|
var query = parse_query( link );
|
2007-08-15 00:18:30 +00:00
|
|
|
var title = link_title( link, query );
|
2007-08-14 04:13:49 +00:00
|
|
|
var id = query.note_id;
|
2007-08-24 20:50:07 +00:00
|
|
|
signal( this, "load_editor", title, id, null, link );
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.scrape_title = function () {
|
2007-07-17 01:21:31 +00:00
|
|
|
// scrape the note title out of the editor
|
2007-07-16 20:22:38 +00:00
|
|
|
var heading = getFirstElementByTagAndClassName( "h3", null, this.document );
|
|
|
|
if ( !heading ) return;
|
|
|
|
var title = scrapeText( heading );
|
|
|
|
|
2007-08-16 01:29:18 +00:00
|
|
|
// issue a signal that the title has changed and save off the new title
|
|
|
|
signal( this, "title_changed", this, this.title, title );
|
2007-07-16 20:22:38 +00:00
|
|
|
this.title = title;
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.focused = function () {
|
|
|
|
signal( this, "focused", this );
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.blurred = function () {
|
|
|
|
this.scrape_title();
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.empty = function () {
|
2007-08-21 19:28:07 +00:00
|
|
|
if ( !this.document || !this.document.body )
|
2007-08-21 21:25:59 +00:00
|
|
|
return true; // consider it empty as of now
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
return ( scrapeText( this.document.body ).length == 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.start_link = function () {
|
|
|
|
// get the current selection, which is the link title
|
|
|
|
if ( this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
|
|
|
|
var selection = this.iframe.contentWindow.getSelection();
|
|
|
|
|
|
|
|
// if no text is selected, then insert a link with a placeholder nbsp as the link title, and
|
|
|
|
// then immediately remove the link title once the link is created
|
|
|
|
if ( selection.toString().length == 0 ) {
|
2007-08-21 19:28:07 +00:00
|
|
|
this.insert_html( '<span id="placeholder_title"> </span>' );
|
|
|
|
var placeholder = withDocument( this.document, function () { return getElement( "placeholder_title" ); } );
|
|
|
|
selection.selectAllChildren( placeholder );
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-07-28 04:22:44 +00:00
|
|
|
this.exec_command( "createLink", "/notebooks/" + this.notebook_id + "?note_id=new" );
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-08-22 21:09:15 +00:00
|
|
|
// hack to prevent Firefox from erasing spaces before links that happen to be at the end of list items
|
|
|
|
var sentinel = createDOM( "span" );
|
|
|
|
insertSiblingNodesBefore( placeholder.parentNode, sentinel );
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = placeholder.parentNode;
|
2007-08-22 21:09:15 +00:00
|
|
|
|
2007-08-14 04:13:49 +00:00
|
|
|
// nuke the link title and collapse the selection, yielding a tasty new link that's completely
|
|
|
|
// titleless and unselected
|
2007-08-21 19:28:07 +00:00
|
|
|
removeElement( placeholder );
|
2007-07-16 20:22:38 +00:00
|
|
|
// otherwise, just create a link with the selected text as the link title
|
|
|
|
} else {
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = null;
|
2007-07-28 04:22:44 +00:00
|
|
|
this.exec_command( "createLink", "/notebooks/" + this.notebook_id + "?note_id=new" );
|
2007-08-14 04:13:49 +00:00
|
|
|
var link = this.find_link_at_cursor();
|
2007-08-16 01:29:18 +00:00
|
|
|
signal( this, "resolve_link", link_title( link ), link );
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
} else if ( this.document.selection ) { // browsers such as IE
|
|
|
|
var range = this.document.selection.createRange();
|
|
|
|
|
|
|
|
// if no text is selected, then insert a link with a placeholder space as the link title, and
|
|
|
|
// then select it
|
|
|
|
if ( range.text.length == 0 ) {
|
|
|
|
range.text = " ";
|
|
|
|
range.moveStart( "character", -1 );
|
|
|
|
range.select();
|
2007-08-14 04:13:49 +00:00
|
|
|
this.exec_command( "createLink", "/notebooks/" + this.notebook_id + "?note_id=new" );
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = this.find_link_at_cursor();
|
2007-08-14 04:13:49 +00:00
|
|
|
} else {
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
this.exec_command( "createLink", "/notebooks/" + this.notebook_id + "?note_id=new" );
|
|
|
|
var link = this.find_link_at_cursor();
|
2007-08-16 01:29:18 +00:00
|
|
|
signal( this, "resolve_link", link_title( link ), link );
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.end_link = function () {
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
var link = this.find_link_at_cursor();
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
if ( this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
|
|
|
|
this.exec_command( "unlink" );
|
|
|
|
} else if ( this.document.selection ) { // browsers such as IE
|
|
|
|
// if some text is already selected, unlink it and bail
|
|
|
|
var range = this.document.selection.createRange();
|
|
|
|
if ( range.text.length > 0 ) {
|
|
|
|
this.exec_command( "unlink" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// since execCommand() with "unlink" removes the entire link instead of just ending it, fake it
|
|
|
|
// by appending a temporary span, selecting it, and then immediately removing it
|
|
|
|
var span = this.document.createElement( "span" );
|
|
|
|
span.innerHTML = " ";
|
2007-07-18 21:51:59 +00:00
|
|
|
range.parentElement().appendChild( span );
|
2007-07-16 20:22:38 +00:00
|
|
|
range.moveToElementText( span );
|
|
|
|
range.select();
|
|
|
|
range.pasteHTML( "" );
|
|
|
|
}
|
2007-08-14 04:13:49 +00:00
|
|
|
|
2007-08-16 01:29:18 +00:00
|
|
|
signal( this, "resolve_link", link_title( link ), link );
|
2007-08-30 20:17:10 +00:00
|
|
|
return link;
|
2007-08-14 04:13:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.find_link_at_cursor = function () {
|
|
|
|
if ( this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
|
|
|
|
var selection = this.iframe.contentWindow.getSelection();
|
|
|
|
var link = selection.anchorNode;
|
|
|
|
|
|
|
|
while ( link.nodeName != "A" ) {
|
|
|
|
link = link.parentNode;
|
|
|
|
if ( !link )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-11 00:10:44 +00:00
|
|
|
if ( link != this.link_started )
|
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
if ( link ) return link;
|
|
|
|
|
|
|
|
// well, that didn't work, so try the selection's focus node instead
|
|
|
|
link = selection.focusNode;
|
|
|
|
|
|
|
|
while ( link.nodeName != "A" ) {
|
|
|
|
link = link.parentNode;
|
2007-09-11 00:10:44 +00:00
|
|
|
if ( !link ) {
|
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
return null;
|
2007-09-11 00:10:44 +00:00
|
|
|
}
|
2007-08-14 04:13:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-11 00:10:44 +00:00
|
|
|
if ( link != this.link_started )
|
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
return link;
|
|
|
|
} else if ( this.document.selection ) { // browsers such as IE
|
|
|
|
var range = this.document.selection.createRange();
|
|
|
|
var link = range.parentElement();
|
|
|
|
|
|
|
|
while ( link.nodeName != "A" ) {
|
|
|
|
link = link.parentNode;
|
2007-09-11 00:10:44 +00:00
|
|
|
if ( !link ) {
|
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
return null;
|
2007-09-11 00:10:44 +00:00
|
|
|
}
|
2007-08-14 04:13:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-11 00:10:44 +00:00
|
|
|
if ( link != this.link_started )
|
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
return link;
|
|
|
|
}
|
|
|
|
|
2007-09-11 00:10:44 +00:00
|
|
|
this.link_started = null;
|
2007-08-14 04:13:49 +00:00
|
|
|
return null;
|
2007-07-16 20:22:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.focus = function () {
|
|
|
|
if ( /Opera/.test( navigator.userAgent ) )
|
|
|
|
this.iframe.focus();
|
|
|
|
else
|
|
|
|
this.iframe.contentWindow.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
// return true if the specified state is enabled
|
|
|
|
Editor.prototype.state_enabled = function ( state_name ) {
|
2007-07-31 22:53:57 +00:00
|
|
|
if ( !this.read_write ) return false;
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
state_name = state_name.toLowerCase();
|
2007-09-04 22:12:44 +00:00
|
|
|
|
2007-09-04 22:31:32 +00:00
|
|
|
var format_block = this.document.queryCommandValue( "formatblock" ).toLowerCase();
|
|
|
|
var heading = ( format_block == "h3" || format_block == "heading 3" );
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
if ( state_name == "h3" )
|
|
|
|
return heading;
|
|
|
|
|
|
|
|
if ( state_name == "bold" && heading )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// to determine if we're within a link, see whether the current selection is contained (directly
|
|
|
|
// or indirectly) by an "A" node
|
|
|
|
if ( state_name == "createlink" ) {
|
|
|
|
var link;
|
|
|
|
if ( window.getSelection ) { // browsers such as Firefox
|
|
|
|
var selection = this.iframe.contentWindow.getSelection();
|
|
|
|
var range = selection.getRangeAt( 0 );
|
|
|
|
link = range.endContainer;
|
|
|
|
} else if ( this.document.selection ) { // browsers such as IE
|
|
|
|
var range = this.document.selection.createRange();
|
|
|
|
link = range.parentElement();
|
|
|
|
}
|
|
|
|
|
|
|
|
while ( link.nodeName != "A" ) {
|
|
|
|
link = link.parentNode;
|
|
|
|
if ( !link )
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ( !link.href )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.document.queryCommandState( state_name )
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.contents = function () {
|
|
|
|
return this.document.body.innerHTML;
|
|
|
|
}
|
|
|
|
|
|
|
|
Editor.prototype.shutdown = function( event ) {
|
2007-08-16 01:29:18 +00:00
|
|
|
signal( this, "title_changed", this, this.title, null );
|
2007-09-05 18:49:28 +00:00
|
|
|
this.closed = true;
|
2007-07-16 20:22:38 +00:00
|
|
|
var iframe = this.iframe;
|
2007-07-17 01:21:31 +00:00
|
|
|
var note_controls = this.note_controls;
|
2007-07-16 20:22:38 +00:00
|
|
|
disconnectAll( this );
|
|
|
|
disconnectAll( this.delete_button );
|
2007-07-26 01:18:41 +00:00
|
|
|
disconnectAll( this.changes_button );
|
2007-07-16 20:22:38 +00:00
|
|
|
disconnectAll( this.options_button );
|
|
|
|
disconnectAll( this.hide_button );
|
|
|
|
disconnectAll( iframe );
|
2007-08-21 21:25:59 +00:00
|
|
|
|
|
|
|
if ( this.document ) {
|
|
|
|
disconnectAll( this.document.body );
|
|
|
|
disconnectAll( this.document );
|
|
|
|
}
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
blindUp( iframe, options = { "duration": 0.5, afterFinish: function () {
|
|
|
|
try {
|
2007-07-17 01:21:31 +00:00
|
|
|
removeElement( note_controls );
|
2007-07-16 20:22:38 +00:00
|
|
|
removeElement( iframe );
|
|
|
|
} catch ( e ) { }
|
|
|
|
} } );
|
|
|
|
}
|
2007-08-14 04:13:49 +00:00
|
|
|
|
|
|
|
// convenience function for parsing a link that has an href URL containing a query string
|
|
|
|
function parse_query( link ) {
|
2007-08-30 20:17:10 +00:00
|
|
|
if ( !link || !link.href )
|
2007-08-15 20:46:37 +00:00
|
|
|
return new Array();
|
|
|
|
|
2007-08-14 04:13:49 +00:00
|
|
|
return parseQueryString( link.href.split( "?" ).pop() );
|
|
|
|
}
|
|
|
|
|
2007-08-15 00:18:30 +00:00
|
|
|
// convenience function for getting a link's title (stripped of whitespace), either from a query
|
2007-10-17 21:22:21 +00:00
|
|
|
// argument in the href, from the actual link title, or from the link's href
|
2007-08-15 00:18:30 +00:00
|
|
|
function link_title( link, query ) {
|
2007-10-17 21:22:21 +00:00
|
|
|
if ( link.target )
|
|
|
|
return link.href;
|
|
|
|
|
2007-08-15 00:18:30 +00:00
|
|
|
if ( !query )
|
|
|
|
query = parse_query( link );
|
|
|
|
|
|
|
|
var link_title = strip( query.title || scrapeText( link ) );
|
|
|
|
|
|
|
|
// work around an IE quirk in which link titles are sometimes 0xa0
|
|
|
|
if ( link_title.charCodeAt( 0 ) == 160 )
|
|
|
|
return "";
|
|
|
|
|
|
|
|
return link_title;
|
|
|
|
}
|