diff --git a/controller/Expire.py b/controller/Expire.py index 19dbfe8..70d17b9 100644 --- a/controller/Expire.py +++ b/controller/Expire.py @@ -2,14 +2,14 @@ import cherrypy def strongly_expire( function ): - """ - Decorator that sends headers that instruct browsers and proxies not to cache. - """ - def expire( *args, **kwargs ): - cherrypy.response.headers[ "Expires" ] = "Sun, 19 Nov 1978 05:00:00 GMT" - cherrypy.response.headers[ "Cache-Control" ] = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0" - cherrypy.response.headers[ "Pragma" ] = "no-cache" + """ + Decorator that sends headers that instruct browsers and proxies not to cache. + """ + def expire( *args, **kwargs ): + cherrypy.response.headers[ "Expires" ] = "Sun, 19 Nov 1978 05:00:00 GMT" + cherrypy.response.headers[ "Cache-Control" ] = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0" + cherrypy.response.headers[ "Pragma" ] = "no-cache" - return function( *args, **kwargs ) + return function( *args, **kwargs ) - return expire + return expire diff --git a/controller/Notebooks.py b/controller/Notebooks.py index 5d429d3..8975da3 100644 --- a/controller/Notebooks.py +++ b/controller/Notebooks.py @@ -12,7 +12,6 @@ from model.Notebook import Notebook from model.Note import Note from view.Main_page import Main_page from view.Json import Json -from view.Note_page import Note_page from view.Html_file import Html_file @@ -617,19 +616,6 @@ class Notebooks( object ): self.__database.save( notebook ) yield dict() - @expose( view = Note_page ) - @validate( id = Valid_string( min = 1, max = 100 ) ) - def blank_note( self, id ): - """ - Provide the information necessary to display a blank note frame to be filled in by the client. - - @param id: unicode - @type id: id of the note - @rtype: unicode - @return: rendered HTML page - @raise Validation_error: the argument is invalid - """ - return dict( id = id ) @expose( view = Json ) @strongly_expire diff --git a/controller/test/Test_notebooks.py b/controller/test/Test_notebooks.py index df17fd8..8f88874 100644 --- a/controller/test/Test_notebooks.py +++ b/controller/test/Test_notebooks.py @@ -1244,10 +1244,6 @@ class Test_notebooks( Test_controller ): note2 = result.get( "note" ) assert note2.object_id == self.note2.object_id - def test_blank_note( self ): - result = self.http_get( "/notebooks/blank_note/5" ) - assert result[ u"id" ] == u"5" - def test_search_titles_without_titles_only( self ): self.login() diff --git a/static/html/blank_note.html b/static/html/blank_note.html new file mode 100644 index 0000000..6388bcc --- /dev/null +++ b/static/html/blank_note.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/static/js/Editor.js b/static/js/Editor.js index 1d09856..4860fe5 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -13,7 +13,7 @@ function Editor( id, notebook_id, note_text, deleted_from, revisions_list, inser var self = this; this.document = null; this.iframe = createDOM( "iframe", { - "src": "/notebooks/blank_note/" + id, + "src": "/static/html/blank_note.html", "frameBorder": "0", "scrolling": "no", "id": iframe_id, @@ -95,25 +95,20 @@ function Editor( id, notebook_id, note_text, deleted_from, revisions_list, inser appendChildNodes( "notes", this.note_controls ); appendChildNodes( "notes", this.iframe ); } + + connect( this.iframe, "onload", function ( event ) { self.init_document(); } ); } -// 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( "note_" + id ); - setTimeout( function () { iframe.editor.init_document(); }, 1 ); -} - -// third stage of construction, invoked by the editor_loaded() function. do not call directly +// second stage of construction, invoked by editor_loaded(). do not call directly 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; - if ( this.read_write ) { + if ( this.read_write ) this.document.designMode = "On"; - } + setTimeout( function () { self.finish_init(); }, 1 ); } else { // browsers such as IE this.document = this.iframe.contentWindow.document; @@ -127,7 +122,7 @@ Editor.prototype.init_document = function () { } } -// fourth and final stage of construction, invoked by init_document(). do not call directly +// third and final stage of construction, invoked by init_document(). do not call directly Editor.prototype.finish_init = function () { if ( !this.initial_text ) this.initial_text = "

"; diff --git a/view/Note_page.py b/view/Note_page.py deleted file mode 100644 index d7cbe8f..0000000 --- a/view/Note_page.py +++ /dev/null @@ -1,17 +0,0 @@ -from Tags import Html, Head, Link, Script, Meta, Body - - -class Note_page( Html ): - def __init__( self, id ): - Html.__init__( - self, - Head( - Link( rel = u"stylesheet", type = u"text/css", href = u"/static/css/note.css" ), - Script( type = u"text/javascript", src = u"/static/js/MochiKit.js" ), - Script( type = u"text/javascript", src = u"/static/js/Invoker.js" ), - Meta( content = u"text/html; charset=UTF-8", http_equiv = u"content-type" ), - ), - Body( - onload = u"parent.editor_loaded( '%s' );" % id, - ), - )