[pLog-svn] r5725 - plog/trunk/js/ui
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Wed Jul 25 17:05:34 EDT 2007
Author: oscar
Date: 2007-07-25 17:05:34 -0400 (Wed, 25 Jul 2007)
New Revision: 5725
Modified:
plog/trunk/js/ui/contentoverlay.js
Log:
Small usability improvement to the ContentOverlay class, so that panels can easily be closed when pressing the ESC key.
Modified: plog/trunk/js/ui/contentoverlay.js
===================================================================
--- plog/trunk/js/ui/contentoverlay.js 2007-07-25 20:44:56 UTC (rev 5724)
+++ plog/trunk/js/ui/contentoverlay.js 2007-07-25 21:05:34 UTC (rev 5725)
@@ -1,3 +1,8 @@
+/**
+ * Class that extends YAHOO.widget.Panel to provide an overlaid panel
+ * that is able to load remote data via XmlHttpRequest and put it in the
+ * page, just as something like greybox would do.
+ */
Lifetype.UI.ContentOverlay = function( el, url, userConfig )
{
if( arguments.length < 3 ) {
@@ -16,9 +21,23 @@
Lifetype.UI.ContentOverlay.superclass.constructor.call( this, el, userConfig );
this.setBody( "" );
this.url = url;
+
+ // add a key listener assigned to the ESC key, so that dialogs can be quickly dismissed via the keyboard
+ this.cfg.queueProperty( "keylisteners", new YAHOO.util.KeyListener(document, { keys:27 },
+ { fn:this.hide,
+ scope:this,
+ correctScope:true } ));
}
YAHOO.extend( Lifetype.UI.ContentOverlay, YAHOO.widget.Panel );
+Lifetype.UI.ContentOverlay.prototype.hide = function()
+{
+ // this is doing nothing now, but I am planning to perform a check here
+ // to see if the content of the dialog changed before it was submitted, so that
+ // we can inform the user that changes will be lost if the dialog is closed
+ Lifetype.UI.ContentOverlay.superclass.hide.call( this );
+}
+
Lifetype.UI.ContentOverlay.prototype.show = function()
{
c = YAHOO.util.Connect.asyncRequest( 'GET', this.url, { scope:this, success: function(o) {
More information about the pLog-svn
mailing list