That's a fair question to be sure, and one that I get a lot. Movable Type was architected originally to publish flat HTML files. It relies on absolute no server side page rendering. Any user specific content is rendered via javascript. At least by default. So my implementation needs to at least maintain the status quo in that respect.
That being said, my javascript library does and can degrade when javascript is turned off, but preferably, when javascript is enabled then dialogs will be used to allow someone to log in and log out. I will also be developing a PHP library to do some additional server side processing so that the page is initially rendered reflecting the appropriate login state of the user. In the end, what I am developing is just one component of many that will be used in a larger solution around the login, logout, registration and edit profile user experience. Byrne On Apr 15, 2009, at 10:00 AM, Chuck Harmston wrote: > I hate to bother you with such a pedantic question, but why is this > being done with Javascript? Shouldn't this type of behavior be > handled server-side? What about users of older browsers, screen > readers, or people who choose to turn Javascript off? > > Chuck Harmston > http://chuckharmston.com > > > On Tue, Apr 14, 2009 at 11:37 PM, Byrne Reese <byrnere...@gmail.com> > wrote: > > First, some background: > > I am one of the lead contributors to the Movable Type Open Source > project and am currently engaged in writing a jquery plugin that would > be used on all of the blogs the platform publishes. So far I have > successfully written a surprisingly complex plugin that works like > this: > > $('#greeting').greet( options ); > > Which would convert: > > <div id="greeting"></div> > > Into a message that would look like this: > > Welcome Byrne! (edit profile | logout) > > You get the idea. > > The options I need to pass into the plugin is pretty substantial so I > won't bother you with the specifics. > > Here is my question: > > I want my plugin to surface multiple event handlers like the > following: > > a) $('#id').greet( { loggedOutMessage: 'Welcome back %user! > %logout' }); > > This is from the example above. > > b) $('#id').loggedIn( function(user) { $(this).show(); alert(u.name + > ' logged in'); } ); > > This would be invoked when a user successfully logged in and would be > invoked whenever a login event occurred (which happens mainly via > Ajax). One use case for this function is to selective show an element > that would otherwise be hidden if the user was logged out. > > c) $('#id').loggedOut( function() { $(this).hide(); } ); > > Similar to (b) above, but this of course would respond to a logout > event. > > Ok, finally the question: I would like for all of the above use cases > to be served by the same plugin. There is a lot of shared code between > all three and a lot of shared config options between them. > > I would like to somehow initialize the system once with the same > config options, but then subsequently invoke the loggedIn, loggedOut > and greet functions on various elements. > > I guess I am just a little lost on the best way to do this and was > wondering if there was any kind of best practice I should follow > here. > > Not knowing a lot about how I *should* do it, here are some ideas I > have for what the client code could look like: > > Idea 1: > > $.mtInit( global_options ); > $(document).ready( function(){ > $('#greet').greet( greet_specific_options ); > }); > $('.hide_when_logged_out').loggedIn( function() { $(this).show(); } ); > $('.hide_when_logged_out').loggedOut( function() { $(this).hide > (); } ); > > Idea 2: > > $.mtInit({ > cookiePath: 'foo', > cookieDomain: 'bar', > cookieName: 'baz', > onLoggedIn: function() { $('#greeting').greet(); }, > onLoggedOut: function() { $('.hide_when_logged_out').hide(); } > }); > > Does anyone have any thoughts to share on the best or better way to do > this? > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---